PageSourceSearch

https://app.docuopia.com/_nuxt/xychartDiagram-f11f50a6.6b58294f.js

js docuopia.com collected 2026-09-30 12:13:44 UTC 68,305 bytes, 1,809 lines download raw bytes

1import { ap as getThemeVariables$2, aq as getConfig$1, ab as cleanAndMerge, aa as defaultConfig$2, s as setAccTitle, c as getAccTitle, B as setDiagramTitle, C as getDiagramTitle, d as getAccDescription, f as setAccDescription, F as clear$1, m as log$1, a8 as selectSvgElement, n as configureSvgSize, i as sanitizeText$2 } from "./api.379b1bff.js";
2import { a as computeDimensionOfText } from "./createText-ca0c5216.d00edb41.js";
3import "./entry.bb9e2e36.js";
4import { i as initRange } from "./init.cc95ec8e.js";
5import { o as ordinal } from "./ordinal.af43018c.js";
6import { l as linear } from "./linear.f1ef8b79.js";
7import { l as line } from "./line.6444da66.js";
8import "./config.e62ee83f.js";
9import "./manualClipboard.b88be980.js";
10import "./dropdown.34b625b6.js";
11import "./_basePickBy.8a3207f1.js";
12import "./el-dropdown.eea22da0.js";
13import "./_createAggregator.fbbc9a33.js";
14import "./_baseEach.b6b6e731.js";
15import "./main.94a554bc.js";
16import "./array.b7dcf730.js";
17import "./path.39bad7e2.js";
18function range(start, stop, step) {
19  start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
20  var i = -1, n = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n);
21  while (++i < n) {
22    range2[i] = start + i * step;
23  }
24  return range2;
25}
26function band() {
27  var scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5;
28  delete scale.unknown;
29  function rescale() {
30    var n = domain().length, reverse = r1 < r0, start = reverse ? r1 : r0, stop = reverse ? r0 : r1;
31    step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
32    if (round)
33      step = Math.floor(step);
34    start += (stop - start - step * (n - paddingInner)) * align;
35    bandwidth = step * (1 - paddingInner);
36    if (round)
37      start = Math.round(start), bandwidth = Math.round(bandwidth);
38    var values = range(n).map(function(i) {
39      return start + step * i;
40    });
41    return ordinalRange(reverse ? values.reverse() : values);
42  }
43  scale.domain = function(_) {
44    return arguments.length ? (domain(_), rescale()) : domain();
45  };
46  scale.range = function(_) {
47    return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
48  };
49  scale.rangeRound = function(_) {
50    return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
51  };
52  scale.bandwidth = function() {
53    return bandwidth;
54  };
55  scale.step = function() {
56    return step;
57  };
58  scale.round = function(_) {
59    return arguments.length ? (round = !!_, rescale()) : round;
60  };
61  scale.padding = function(_) {
62    return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
63  };
64  scale.paddingInner = function(_) {
65    return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
66  };
67  scale.paddingOuter = function(_) {
68    return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
69  };
70  scale.align = function(_) {
71    return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
72  };
73  scale.copy = function() {
74    return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
75  };
76  return initRange.apply(rescale(), arguments);
77}
78var parser = function() {
79  var o = function(k, v, o2, l) {
80    for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
81      ;
82    return o2;
83  }, $V0 = [1, 10, 12, 14, 16, 18, 19, 21, 23], $V1 = [2, 6], $V2 = [1, 3], $V3 = [1, 5], $V4 = [1, 6], $V5 = [1, 7], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $V7 = [1, 25], $V8 = [1, 26], $V9 = [1, 28], $Va = [1, 29], $Vb = [1, 30], $Vc = [1, 31], $Vd = [1, 32], $Ve = [1, 33], $Vf = [1, 34], $Vg = [1, 35], $Vh = [1, 36], $Vi = [1, 37], $Vj = [1, 43], $Vk = [1, 42], $Vl = [1, 47], $Vm = [1, 50], $Vn = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], $Vo = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], $Vp = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], $Vq = [1, 64];
84  var parser2 = {
85    trace: function trace() {
86    },
87    yy: {},
88    symbols_: { "error": 2, "start": 3, "eol": 4, "XYCHART": 5, "chartConfig": 6, "document": 7, "CHART_ORIENTATION": 8, "statement": 9, "title": 10, "text": 11, "X_AXIS": 12, "parseXAxis": 13, "Y_AXIS": 14, "parseYAxis": 15, "LINE": 16, "plotData": 17, "BAR": 18, "acc_title": 19, "acc_title_value": 20, "acc_descr": 21, "acc_descr_value": 22, "acc_descr_multiline_value": 23, "SQUARE_BRACES_START": 24, "commaSeparatedNumbers": 25, "SQUARE_BRACES_END": 26, "NUMBER_WITH_DECIMAL": 27, "COMMA": 28, "xAxisData": 29, "bandData": 30, "ARROW_DELIMITER": 31, "commaSeparatedTexts": 32, "yAxisData": 33, "NEWLINE": 34, "SEMI": 35, "EOF": 36, "alphaNum": 37, "STR": 38, "MD_STR": 39, "alphaNumToken": 40, "AMP": 41, "NUM": 42, "ALPHA": 43, "PLUS": 44, "EQUALS": 45, "MULT": 46, "DOT": 47, "BRKT": 48, "MINUS": 49, "UNDERSCORE": 50, "$accept": 0, "$end": 1 },
89    terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
90    productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
91    performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
92      var $0 = $$.length - 1;
93      switch (yystate) {
94        case 5:
95          yy.setOrientation($$[$0]);
96          break;
97        case 9:
98          yy.setDiagramTitle($$[$0].text.trim());
99          break;
100        case 12:
101          yy.setLineData({ text: "", type: "text" }, $$[$0]);
102          break;
103        case 13:
104          yy.setLineData($$[$0 - 1], $$[$0]);
105          break;
106        case 14:
107          yy.setBarData({ text: "", type: "text" }, $$[$0]);
108          break;
109        case 15:
110          yy.setBarData($$[$0 - 1], $$[$0]);
111          break;
112        case 16:
113          this.$ = $$[$0].trim();
114          yy.setAccTitle(this.$);
115          break;
116        case 17:
117        case 18:
118          this.$ = $$[$0].trim();
119          yy.setAccDescription(this.$);
120          break;
121        case 19:
122          this.$ = $$[$0 - 1];
123          break;
124        case 20:
125          this.$ = [Number($$[$0 - 2]), ...$$[$0]];
126          break;
127        case 21:
128          this.$ = [Number($$[$0])];
129          break;
130        case 22:
131          yy.setXAxisTitle($$[$0]);
132          break;
133        case 23:
134          yy.setXAxisTitle($$[$0 - 1]);
135          break;
136        case 24:
137          yy.setXAxisTitle({ type: "text", text: "" });
138          break;
139        case 25:
140          yy.setXAxisBand($$[$0]);
141          break;
142        case 26:
143          yy.setXAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
144          break;
145        case 27:
146          this.$ = $$[$0 - 1];
147          break;
148        case 28:
149          this.$ = [$$[$0 - 2], ...$$[$0]];
150          break;
151        case 29:
152          this.$ = [$$[$0]];
153          break;
154        case 30:
155          yy.setYAxisTitle($$[$0]);
156          break;
157        case 31:
158          yy.setYAxisTitle($$[$0 - 1]);
159          break;
160        case 32:
161          yy.setYAxisTitle({ type: "text", text: "" });
162          break;
163        case 33:
164          yy.setYAxisRangeData(Number($$[$0 - 2]), Number($$[$0]));
165          break;
166        case 37:
167          this.$ = { text: $$[$0], type: "text" };
168          break;
169        case 38:
170          this.$ = { text: $$[$0], type: "text" };
171          break;
172        case 39:
173          this.$ = { text: $$[$0], type: "markdown" };
174          break;
175        case 40:
176          this.$ = $$[$0];
177          break;
178        case 41:
179          this.$ = $$[$0 - 1] + "" + $$[$0];
180          break;
181      }
182    },
183    table: [o($V0, $V1, { 3: 1, 4: 2, 7: 4, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [3] }, o($V0, $V1, { 4: 2, 7: 4, 3: 8, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), o($V0, $V1, { 4: 2, 7: 4, 6: 9, 3: 10, 5: $V2, 8: [1, 11], 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, o($V6, [2, 34]), o($V6, [2, 35]), o($V6, [2, 36]), { 1: [2, 1] }, o($V0, $V1, { 4: 2, 7: 4, 3: 21, 5: $V2, 34: $V3, 35: $V4, 36: $V5 }), { 1: [2, 3] }, o($V6, [2, 5]), o($V0, [2, 7], { 4: 22, 34: $V3, 35: $V4, 36: $V5 }), { 11: 23, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 39, 13: 38, 24: $Vj, 27: $Vk, 29: 40, 30: 41, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 45, 15: 44, 27: $Vl, 33: 46, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 49, 17: 48, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 11: 52, 17: 51, 24: $Vm, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, { 20: [1, 53] }, { 22: [1, 54] }, o($Vn, [2, 18]), { 1: [2, 2] }, o($Vn, [2, 8]), o($Vn, [2, 9]), o($Vo, [2, 37], { 40: 55, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }), o($Vo, [2, 38]), o($Vo, [2, 39]), o($Vp, [2, 40]), o($Vp, [2, 42]), o($Vp, [2, 43]), o($Vp, [2, 44]), o($Vp, [2, 45]), o($Vp, [2, 46]), o($Vp, [2, 47]), o($Vp, [2, 48]), o($Vp, [2, 49]), o($Vp, [2, 50]), o($Vp, [2, 51]), o($Vn, [2, 10]), o($Vn, [2, 22], { 30: 41, 29: 56, 24: $Vj, 27: $Vk }), o($Vn, [2, 24]), o($Vn, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 11]), o($Vn, [2, 30], { 33: 60, 27: $Vl }), o($Vn, [2, 32]), { 31: [1, 61] }, o($Vn, [2, 12]), { 17: 62, 24: $Vm }, { 25: 63, 27: $Vq }, o($Vn, [2, 14]), { 17: 65, 24: $Vm }, o($Vn, [2, 16]), o($Vn, [2, 17]), o($Vp, [2, 41]), o($Vn, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, o($Vn, [2, 31]), { 27: [1, 69] }, o($Vn, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, o($Vn, [2, 15]), o($Vn, [2, 26]), o($Vn, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: $V7, 39: $V8, 40: 27, 41: $V9, 42: $Va, 43: $Vb, 44: $Vc, 45: $Vd, 46: $Ve, 47: $Vf, 48: $Vg, 49: $Vh, 50: $Vi }, o($Vn, [2, 33]), o($Vn, [2, 19]), { 25: 73, 27: $Vq }, { 26: [2, 28] }, { 26: [2, 20] }],
184    defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
185    parseError: function parseError(str, hash) {
186      if (hash.recoverable) {
187        this.trace(str);
188      } else {
189        var error = new Error(str);
190        error.hash = hash;
191        throw error;
192      }
193    },
194    parse: function parse(input) {
195      var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
196      var args = lstack.slice.call(arguments, 1);
197      var lexer2 = Object.create(this.lexer);
198      var sharedState = { yy: {} };
199      for (var k in this.yy) {
200        if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
201          sharedState.yy[k] = this.yy[k];
202        }
203      }
204      lexer2.setInput(input, sharedState.yy);
205      sharedState.yy.lexer = lexer2;
206      sharedState.yy.parser = this;
207      if (typeof lexer2.yylloc == "undefined") {
208        lexer2.yylloc = {};
209      }
210      var yyloc = lexer2.yylloc;
211      lstack.push(yyloc);
212      var ranges = lexer2.options && lexer2.options.ranges;
213      if (typeof sharedState.yy.parseError === "function") {
214        this.parseError = sharedState.yy.parseError;
215      } else {
216        this.parseError = Object.getPrototypeOf(this).parseError;
217      }
218      function lex() {
219        var token;
220        token = tstack.pop() || lexer2.lex() || EOF;
221        if (typeof token !== "number") {
222          if (token instanceof Array) {
223            tstack = token;
224            token = tstack.pop();
225          }
226          token = self.symbols_[token] || token;
227        }
228        return token;
229      }
230      var symbol, state, action, r, yyval = {}, p, len, newState, expected;
231      while (true) {
232        state = stack[stack.length - 1];
233        if (this.defaultActions[state]) {
234          action = this.defaultActions[state];
235        } else {
236          if (symbol === null || typeof symbol == "undefined") {
237            symbol = lex();
238          }
239          action = table[state] && table[state][symbol];
240        }
241        if (typeof action === "undefined" || !action.length || !action[0]) {
242          var errStr = "";
243          expected = [];
244          for (p in table[state]) {
245            if (this.terminals_[p] && p > TERROR) {
246              expected.push("'" + this.terminals_[p] + "'");
247            }
248          }
249          if (lexer2.showPosition) {
250            errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
251          } else {
252            errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
253          }
254          this.parseError(errStr, {
255            text: lexer2.match,
256            token: this.terminals_[symbol] || symbol,
257            line: lexer2.yylineno,
258            loc: yyloc,
259            expected
260          });
261        }
262        if (action[0] instanceof Array && action.length > 1) {
263          throw new Error("Parse Error: multiple actions possible at state: " + state 
vendor: 11,581 bytes, lines 263-586
263+ ", token: " + symbol);
264        }
265        switch (action[0]) {
266          case 1:
267            stack.push(symbol);
268            vstack.push(lexer2.yytext);
269            lstack.push(lexer2.yylloc);
270            stack.push(action[1]);
271            symbol = null;
272            {
273              yyleng = lexer2.yyleng;
274              yytext = lexer2.yytext;
275              yylineno = lexer2.yylineno;
276              yyloc = lexer2.yylloc;
277            }
278            break;
279          case 2:
280            len = this.productions_[action[1]][1];
281            yyval.$ = vstack[vstack.length - len];
282            yyval._$ = {
283              first_line: lstack[lstack.length - (len || 1)].first_line,
284              last_line: lstack[lstack.length - 1].last_line,
285              first_column: lstack[lstack.length - (len || 1)].first_column,
286              last_column: lstack[lstack.length - 1].last_column
287            };
288            if (ranges) {
289              yyval._$.range = [
290                lstack[lstack.length - (len || 1)].range[0],
291                lstack[lstack.length - 1].range[1]
292              ];
293            }
294            r = this.performAction.apply(yyval, [
295              yytext,
296              yyleng,
297              yylineno,
298              sharedState.yy,
299              action[1],
300              vstack,
301              lstack
302            ].concat(args));
303            if (typeof r !== "undefined") {
304              return r;
305            }
306            if (len) {
307              stack = stack.slice(0, -1 * len * 2);
308              vstack = vstack.slice(0, -1 * len);
309              lstack = lstack.slice(0, -1 * len);
310            }
311            stack.push(this.productions_[action[1]][0]);
312            vstack.push(yyval.$);
313            lstack.push(yyval._$);
314            newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
315            stack.push(newState);
316            break;
317          case 3:
318            return true;
319        }
320      }
321      return true;
322    }
323  };
324  var lexer = function() {
325    var lexer2 = {
326      EOF: 1,
327      parseError: function parseError(str, hash) {
328        if (this.yy.parser) {
329          this.yy.parser.parseError(str, hash);
330        } else {
331          throw new Error(str);
332        }
333      },
334      // resets the lexer, sets new input
335      setInput: function(input, yy) {
336        this.yy = yy || this.yy || {};
337        this._input = input;
338        this._more = this._backtrack = this.done = false;
339        this.yylineno = this.yyleng = 0;
340        this.yytext = this.matched = this.match = "";
341        this.conditionStack = ["INITIAL"];
342        this.yylloc = {
343          first_line: 1,
344          first_column: 0,
345          last_line: 1,
346          last_column: 0
347        };
348        if (this.options.ranges) {
349          this.yylloc.range = [0, 0];
350        }
351        this.offset = 0;
352        return this;
353      },
354      // consumes and returns one char from the input
355      input: function() {
356        var ch = this._input[0];
357        this.yytext += ch;
358        this.yyleng++;
359        this.offset++;
360        this.match += ch;
361        this.matched += ch;
362        var lines = ch.match(/(?:\r\n?|\n).*/g);
363        if (lines) {
364          this.yylineno++;
365          this.yylloc.last_line++;
366        } else {
367          this.yylloc.last_column++;
368        }
369        if (this.options.ranges) {
370          this.yylloc.range[1]++;
371        }
372        this._input = this._input.slice(1);
373        return ch;
374      },
375      // unshifts one char (or a string) into the input
376      unput: function(ch) {
377        var len = ch.length;
378        var lines = ch.split(/(?:\r\n?|\n)/g);
379        this._input = ch + this._input;
380        this.yytext = this.yytext.substr(0, this.yytext.length - len);
381        this.offset -= len;
382        var oldLines = this.match.split(/(?:\r\n?|\n)/g);
383        this.match = this.match.substr(0, this.match.length - 1);
384        this.matched = this.matched.substr(0, this.matched.length - 1);
385        if (lines.length - 1) {
386          this.yylineno -= lines.length - 1;
387        }
388        var r = this.yylloc.range;
389        this.yylloc = {
390          first_line: this.yylloc.first_line,
391          last_line: this.yylineno + 1,
392          first_column: this.yylloc.first_column,
393          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
394        };
395        if (this.options.ranges) {
396          this.yylloc.range = [r[0], r[0] + this.yyleng - len];
397        }
398        this.yyleng = this.yytext.length;
399        return this;
400      },
401      // When called from action, caches matched text and appends it on next action
402      more: function() {
403        this._more = true;
404        return this;
405      },
406      // 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.
407      reject: function() {
408        if (this.options.backtrack_lexer) {
409          this._backtrack = true;
410        } else {
411          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(), {
412            text: "",
413            token: null,
414            line: this.yylineno
415          });
416        }
417        return this;
418      },
419      // retain first n characters of the match
420      less: function(n) {
421        this.unput(this.match.slice(n));
422      },
423      // displays already matched input, i.e. for error messages
424      pastInput: function() {
425        var past = this.matched.substr(0, this.matched.length - this.match.length);
426        return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
427      },
428      // displays upcoming input, i.e. for error messages
429      upcomingInput: function() {
430        var next = this.match;
431        if (next.length < 20) {
432          next += this._input.substr(0, 20 - next.length);
433        }
434        return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
435      },
436      // displays the character position where the lexing error occurred, i.e. for error messages
437      showPosition: function() {
438        var pre = this.pastInput();
439        var c = new Array(pre.length + 1).join("-");
440        return pre + this.upcomingInput() + "\n" + c + "^";
441      },
442      // test the lexed token: return FALSE when not a match, otherwise return token
443      test_match: function(match, indexed_rule) {
444        var token, lines, backup;
445        if (this.options.backtrack_lexer) {
446          backup = {
447            yylineno: this.yylineno,
448            yylloc: {
449              first_line: this.yylloc.first_line,
450              last_line: this.last_line,
451              first_column: this.yylloc.first_column,
452              last_column: this.yylloc.last_column
453            },
454            yytext: this.yytext,
455            match: this.match,
456            matches: this.matches,
457            matched: this.matched,
458            yyleng: this.yyleng,
459            offset: this.offset,
460            _more: this._more,
461            _input: this._input,
462            yy: this.yy,
463            conditionStack: this.conditionStack.slice(0),
464            done: this.done
465          };
466          if (this.options.ranges) {
467            backup.yylloc.range = this.yylloc.range.slice(0);
468          }
469        }
470        lines = match[0].match(/(?:\r\n?|\n).*/g);
471        if (lines) {
472          this.yylineno += lines.length;
473        }
474        this.yylloc = {
475          first_line: this.yylloc.last_line,
476          last_line: this.yylineno + 1,
477          first_column: this.yylloc.last_column,
478          last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
479        };
480        this.yytext += match[0];
481        this.match += match[0];
482        this.matches = match;
483        this.yyleng = this.yytext.length;
484        if (this.options.ranges) {
485          this.yylloc.range = [this.offset, this.offset += this.yyleng];
486        }
487        this._more = false;
488        this._backtrack = false;
489        this._input = this._input.slice(match[0].length);
490        this.matched += match[0];
491        token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
492        if (this.done && this._input) {
493          this.done = false;
494        }
495        if (token) {
496          return token;
497        } else if (this._backtrack) {
498          for (var k in backup) {
499            this[k] = backup[k];
500          }
501          return false;
502        }
503        return false;
504      },
505      // return next match in input
506      next: function() {
507        if (this.done) {
508          return this.EOF;
509        }
510        if (!this._input) {
511          this.done = true;
512        }
513        var token, match, tempMatch, index;
514        if (!this._more) {
515          this.yytext = "";
516          this.match = "";
517        }
518        var rules = this._currentRules();
519        for (var i = 0; i < rules.length; i++) {
520          tempMatch = this._input.match(this.rules[rules[i]]);
521          if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
522            match = tempMatch;
523            index = i;
524            if (this.options.backtrack_lexer) {
525              token = this.test_match(tempMatch, rules[i]);
526              if (token !== false) {
527                return token;
528              } else if (this._backtrack) {
529                match = false;
530                continue;
531              } else {
532                return false;
533              }
534            } else if (!this.options.flex) {
535              break;
536            }
537          }
538        }
539        if (match) {
540          token = this.test_match(match, rules[index]);
541          if (token !== false) {
542            return token;
543          }
544          return false;
545        }
546        if (this._input === "") {
547          return this.EOF;
548        } else {
549          return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
550            text: "",
551            token: null,
552            line: this.yylineno
553          });
554        }
555      },
556      // return next match that has a token
557      lex: function lex() {
558        var r = this.next();
559        if (r) {
560          return r;
561        } else {
562          return this.lex();
563        }
564      },
565      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
566      begin: function begin(condition) {
567        this.conditionStack.push(condition);
568      },
569      // pop the previously active lexer condition state off the condition stack
570      popState: function popState() {
571        var n = this.conditionStack.length - 1;
572        if (n > 0) {
573          return this.conditionStack.pop();
574        } else {
575          return this.conditionStack[0];
576        }
577      },
578      // produce the lexer rule set which is active for the currently active lexer condition state
579      _currentRules: function _currentRules() {
580        if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
581          return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
582        } else {
583          return this.conditions["INITIAL"].rules;
584        }
585      },
586      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
587      topState: function topState(n) {
588        n = this.conditionStack.length - 1 - Math.abs(n || 0);
589        if (n >= 0) {
590          return this.conditionStack[n];
591        } else {
592          return "INITIAL";
593        }
594      },
595      // alias for begin(condition)
596      pushState: function pushState(condition) {
597        this.begin(condition);
598      },
599      // return the number of states currently on the stack
600      stateStackSize: function stateStackSize() {
601        return this.conditionStack.length;
602      },
603      options: { "case-insensitive": true },
604      performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
605        switch ($avoiding_name_collisions) {
606          case 0:
607            break;
608          case 1:
609            break;
610          case 2:
611            this.popState();
612            return 34;
613          case 3:
614            this.popState();
615            return 34;
616          case 4:
617            return 34;
618          case 5:
619            break;
620          case 6:
621            return 10;
622          case 7:
623            this.pushState("acc_title");
624            return 19;
625          case 8:
626            this.popState();
627            return "acc_title_value";
628          case 9:
629            this.pushState("acc_descr");
630            return 21;
631          case 10:
632            this.popState();
633            return "acc_descr_value";
634          case 11:
635            this.pushState("acc_descr_multiline");
636            break;
637          case 12:
638            this.popState();
639            break;
640          case 13:
641            return "acc_descr_multiline_value";
642          case 14:
643            return 5;
644          case 15:
645            return 8;
646          case 16:
647            this.pushState("axis_data");
648            return "X_AXIS";
649          case 17:
650            this.pushState("axis_data");
651            return "Y_AXIS";
652          case 18:
653            this.pushState("axis_band_data");
654            return 24;
655          case 19:
656            return 31;
657          case 20:
658            this.pushState("data");
659            return 16;
660          case 21:
661            this.pushState("data");
662            return 18;
663          case 22:
664            this.pushState("data_inner");
665            return 24;
666          case 23:
667            return 27;
668          case 24:
669            this.popState();
670            return 26;
671          case 25:
672            this.popState();
673            break;
674          case 26:
675            this.pushState("string");
676            break;
677          case 27:
678            this.popState();
679            break;
680          case 28:
681            return "STR";
682          case 29:
683            return 24;
684          case 30:
685            return 26;
686          case 31:
687            return 43;
688          case 32:
689            return "COLON";
690          case 33:
691            return 44;
692          case 34:
693            return 28;
694          case 35:
695            return 45;
696          case 36:
697            return 46;
698          case 37:
699            return 48;
700          case 38:
701            return 50;
702          case 39:
703            return 47;
704          case 40:
705            return 41;
706          case 41:
707            return 49;
708          case 42:
709            return 42;
710          case 43:
711            break;
712          case 44:
713            return 35;
714          case 45:
715            return 36;
716        }
717      },
718      rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\)                                    \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+                  \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
719      conditions: { "data_inner": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "data": { "rules": [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_band_data": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "axis_data": { "rules": [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true }, "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [], "inclusive": false }, "md_string": { "rules": [], "inclusive": false }, "string": { "rules": [27, 28], "inclusive": false }, "INITIAL": { "rules": [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], "inclusive": true } }
720    };
721    return lexer2;
722  }();
723  parser2.lexer = lexer;
724  function Parser() {
725    this.yy = {};
726  }
727  Parser.prototype = parser2;
728  parser2.Parser = Parser;
729  return new Parser();
730}();
731parser.parser = parser;
732const parser$1 = parser;
733function isBarPlot(data) {
734  return data.type === "bar";
735}
736function isBandAxisData(data) {
737  return data.type === "band";
738}
739function isLinearAxisData(data) {
740  return data.type === "linear";
741}
742class TextDimensionCalculatorWithFont {
743  constructor(parentGroup) {
744    this.parentGroup = parentGroup;
745  }
746  getMaxDimension(texts, fontSize) {
747    if (!this.parentGroup) {
748      return {
749        width: texts.reduce((acc, cur) => Math.max(cur.length, acc), 0) * fontSize,
750        height: fontSize
751      };
752    }
753    const dimension = {
754      width: 0,
755      height: 0
756    };
757    const elem = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", fontSize);
758    for (const t of texts) {
759      const bbox = computeDimensionOfText(elem, 1, t);
760      const width = bbox ? bbox.width : t.length * fontSize;
761      const height = bbox ? bbox.height : fontSize;
762      dimension.width = Math.max(dimension.width, width);
763      dimension.height = Math.max(dimension.height, height);
764    }
765    elem.remove();
766    return dimension;
767  }
768}
769const BAR_WIDTH_TO_TICK_WIDTH_RATIO = 0.7;
770const MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL = 0.2;
771class BaseAxis {
772  constructor(axisConfig, title, textDimensionCalculator, axisThemeConfig) {
773    this.axisConfig = axisConfig;
774    this.title = title;
775    this.textDimensionCalculator = textDimensionCalculator;
776    this.axisThemeConfig = axisThemeConfig;
777    this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
778    this.axisPosition = "left";
779    this.showTitle = false;
780    this.showLabel = false;
781    this.showTick = false;
782    this.showAxisLine = false;
783    this.outerPadding = 0;
784    this.titleTextHeight = 0;
785    this.labelTextHeight = 0;
786    this.range = [0, 10];
787    this.boundingRect = { x: 0, y: 0, width: 0, height: 0 };
788    this.axisPosition = "left";
789  }
790  setRange(range2) {
791    this.range = range2;
792    if (this.axisPosition === "left" || this.axisPosition === "right") {
793      this.boundingRect.height = range2[1] - range2[0];
794    } else {
795      this.boundingRect.width = range2[1] - range2[0];
796    }
797    this.recalculateScale();
798  }
799  getRange() {
800    return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
801  }
802  setAxisPosition(axisPosition) {
803    this.axisPosition = axisPosition;
804    this.setRange(this.range);
805  }
806  getTickDistance() {
807    const range2 = this.getRange();
808    return Math.abs(range2[0] - range2[1]) / this.getTickValues().length;
809  }
810  getAxisOuterPadding() {
811    return this.outerPadding;
812  }
813  getLabelDimension() {
814    return this.textDimensionCalculator.getMaxDimension(
815      this.getTickValues().map((tick) => tick.toString()),
816      this.axisConfig.labelFontSize
817    );
818  }
819  recalculateOuterPaddingToDrawBar() {
820    if (BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() > this.outerPadding * 2) {
821      this.outerPadding = Math.floor(BAR_WIDTH_TO_TICK_WIDTH_RATIO * this.getTickDistance() / 2);
822    }
823    this.recalculateScale();
824  }
825  calculateSpaceIfDrawnHorizontally(availableSpace) {
826    let availableHeight = availableSpace.height;
827    if (this.axisConfig.showAxisLine && availableHeight > this.axisConfig.axisLineWidth) {
828      availableHeight -= this.axisConfig.axisLineWidth;
829      this.showAxisLine = true;
830    }
831    if (this.axisConfig.showLabel) {
832      const spaceRequired = this.getLabelDimension();
833      const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.width;
834      this.outerPadding = Math.min(spaceRequired.width / 2, maxPadding);
835      const heightRequired = spaceRequired.height + this.axisConfig.labelPadding * 2;
836      this.labelTextHeight = spaceRequired.height;
837      if (heightRequired <= availableHeight) {
838        availableHeight -= heightRequired;
839        this.showLabel = true;
840      }
841    }
842    if (this.axisConfig.showTick && availableHeight >= this.axisConfig.tickLength) {
843      this.showTick = true;
844      availableHeight -= this.axisConfig.tickLength;
845    }
846    if (this.axisConfig.showTitle && this.title) {
847      const spaceRequired = this.textDimensionCalculator.getMaxDimension(
848        [this.title],
849        this.axisConfig.titleFontSize
850      );
851      const heightRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
852      this.titleTextHeight = spaceRequired.height;
853      if (heightRequired <= availableHeight) {
854        availableHeight -= heightRequired;
855        this.showTitle = true;
856      }
857    }
858    this.boundingRect.width = availableSpace.width;
859    this.boundingRect.height = availableSpace.height - availableHeight;
860  }
861  calculateSpaceIfDrawnVertical(availableSpace) {
862    let availableWidth = availableSpace.width;
863    if (this.axisConfig.showAxisLine && availableWidth >
vendor: 4,394 bytes, lines 863-979
863 this.axisConfig.axisLineWidth) {
864      availableWidth -= this.axisConfig.axisLineWidth;
865      this.showAxisLine = true;
866    }
867    if (this.axisConfig.showLabel) {
868      const spaceRequired = this.getLabelDimension();
869      const maxPadding = MAX_OUTER_PADDING_PERCENT_FOR_WRT_LABEL * availableSpace.height;
870      this.outerPadding = Math.min(spaceRequired.height / 2, maxPadding);
871      const widthRequired = spaceRequired.width + this.axisConfig.labelPadding * 2;
872      if (widthRequired <= availableWidth) {
873        availableWidth -= widthRequired;
874        this.showLabel = true;
875      }
876    }
877    if (this.axisConfig.showTick && availableWidth >= this.axisConfig.tickLength) {
878      this.showTick = true;
879      availableWidth -= this.axisConfig.tickLength;
880    }
881    if (this.axisConfig.showTitle && this.title) {
882      const spaceRequired = this.textDimensionCalculator.getMaxDimension(
883        [this.title],
884        this.axisConfig.titleFontSize
885      );
886      const widthRequired = spaceRequired.height + this.axisConfig.titlePadding * 2;
887      this.titleTextHeight = spaceRequired.height;
888      if (widthRequired <= availableWidth) {
889        availableWidth -= widthRequired;
890        this.showTitle = true;
891      }
892    }
893    this.boundingRect.width = availableSpace.width - availableWidth;
894    this.boundingRect.height = availableSpace.height;
895  }
896  calculateSpace(availableSpace) {
897    if (this.axisPosition === "left" || this.axisPosition === "right") {
898      this.calculateSpaceIfDrawnVertical(availableSpace);
899    } else {
900      this.calculateSpaceIfDrawnHorizontally(availableSpace);
901    }
902    this.recalculateScale();
903    return {
904      width: this.boundingRect.width,
905      height: this.boundingRect.height
906    };
907  }
908  setBoundingBoxXY(point) {
909    this.boundingRect.x = point.x;
910    this.boundingRect.y = point.y;
911  }
912  getDrawableElementsForLeftAxis() {
913    const drawableElement = [];
914    if (this.showAxisLine) {
915      const x = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
916      drawableElement.push({
917        type: "path",
918        groupTexts: ["left-axis", "axisl-line"],
919        data: [
920          {
921            path: `M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y + this.boundingRect.height} `,
922            strokeFill: this.axisThemeConfig.axisLineColor,
923            strokeWidth: this.axisConfig.axisLineWidth
924          }
925        ]
926      });
927    }
928    if (this.showLabel) {
929      drawableElement.push({
930        type: "text",
931        groupTexts: ["left-axis", "label"],
932        data: this.getTickValues().map((tick) => ({
933          text: tick.toString(),
934          x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
935          y: this.getScaleValue(tick),
936          fill: this.axisThemeConfig.labelColor,
937          fontSize: this.axisConfig.labelFontSize,
938          rotation: 0,
939          verticalPos: "middle",
940          horizontalPos: "right"
941        }))
942      });
943    }
944    if (this.showTick) {
945      const x = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
946      drawableElement.push({
947        type: "path",
948        groupTexts: ["left-axis", "ticks"],
949        data: this.getTickValues().map((tick) => ({
950          path: `M ${x},${this.getScaleValue(tick)} L ${x - this.axisConfig.tickLength},${this.getScaleValue(tick)}`,
951          strokeFill: this.axisThemeConfig.tickColor,
952          strokeWidth: this.axisConfig.tickWidth
953        }))
954      });
955    }
956    if (this.showTitle) {
957      drawableElement.push({
958        type: "text",
959        groupTexts: ["left-axis", "title"],
960        data: [
961          {
962            text: this.title,
963            x: this.boundingRect.x + this.axisConfig.titlePadding,
964            y: this.boundingRect.y + this.boundingRect.height / 2,
965            fill: this.axisThemeConfig.titleColor,
966            fontSize: this.axisConfig.titleFontSize,
967            rotation: 270,
968            verticalPos: "top",
969            horizontalPos: "center"
970          }
971        ]
972      });
973    }
974    return drawableElement;
975  }
976  getDrawableElementsForBottomAxis() {
977    const drawableElement = [];
978    if (this.showAxisLine) {
979      const y = this.boundingRect.y + this.axisConfig.axisLineWi
979dth / 2;
980      drawableElement.push({
981        type: "path",
982        groupTexts: ["bottom-axis", "axis-line"],
983        data: [
984          {
985            path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
986            strokeFill: this.axisThemeConfig.axisLineColor,
987            strokeWidth: this.axisConfig.axisLineWidth
988          }
989        ]
990      });
991    }
992    if (this.showLabel) {
993      drawableElement.push({
994        type: "text",
995        groupTexts: ["bottom-axis", "label"],
996        data: this.getTickValues().map((tick) => ({
997          text: tick.toString(),
998          x: this.getScaleValue(tick),
999          y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
1000          fill: this.axisThemeConfig.labelColor,
1001          fontSize: this.axisConfig.labelFontSize,
1002          rotation: 0
vendor: 4,090 bytes, lines 1002-1119
1002,
1003          verticalPos: "top",
1004          horizontalPos: "center"
1005        }))
1006      });
1007    }
1008    if (this.showTick) {
1009      const y = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
1010      drawableElement.push({
1011        type: "path",
1012        groupTexts: ["bottom-axis", "ticks"],
1013        data: this.getTickValues().map((tick) => ({
1014          path: `M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y + this.axisConfig.tickLength}`,
1015          strokeFill: this.axisThemeConfig.tickColor,
1016          strokeWidth: this.axisConfig.tickWidth
1017        }))
1018      });
1019    }
1020    if (this.showTitle) {
1021      drawableElement.push({
1022        type: "text",
1023        groupTexts: ["bottom-axis", "title"],
1024        data: [
1025          {
1026            text: this.title,
1027            x: this.range[0] + (this.range[1] - this.range[0]) / 2,
1028            y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
1029            fill: this.axisThemeConfig.titleColor,
1030            fontSize: this.axisConfig.titleFontSize,
1031            rotation: 0,
1032            verticalPos: "top",
1033            horizontalPos: "center"
1034          }
1035        ]
1036      });
1037    }
1038    return drawableElement;
1039  }
1040  getDrawableElementsForTopAxis() {
1041    const drawableElement = [];
1042    if (this.showAxisLine) {
1043      const y = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
1044      drawableElement.push({
1045        type: "path",
1046        groupTexts: ["top-axis", "axis-line"],
1047        data: [
1048          {
1049            path: `M ${this.boundingRect.x},${y} L ${this.boundingRect.x + this.boundingRect.width},${y}`,
1050            strokeFill: this.axisThemeConfig.axisLineColor,
1051            strokeWidth: this.axisConfig.axisLineWidth
1052          }
1053        ]
1054      });
1055    }
1056    if (this.showLabel) {
1057      drawableElement.push({
1058        type: "text",
1059        groupTexts: ["top-axis", "label"],
1060        data: this.getTickValues().map((tick) => ({
1061          text: tick.toString(),
1062          x: this.getScaleValue(tick),
1063          y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
1064          fill: this.axisThemeConfig.labelColor,
1065          fontSize: this.axisConfig.labelFontSize,
1066          rotation: 0,
1067          verticalPos: "top",
1068          horizontalPos: "center"
1069        }))
1070      });
1071    }
1072    if (this.showTick) {
1073      const y = this.boundingRect.y;
1074      drawableElement.push({
1075        type: "path",
1076        groupTexts: ["top-axis", "ticks"],
1077        data: this.getTickValues().map((tick) => ({
1078          path: `M ${this.getScaleValue(tick)},${y + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(tick)},${y + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
1079          strokeFill: this.axisThemeConfig.tickColor,
1080          strokeWidth: this.axisConfig.tickWidth
1081        }))
1082      });
1083    }
1084    if (this.showTitle) {
1085      drawableElement.push({
1086        type: "text",
1087        groupTexts: ["top-axis", "title"],
1088        data: [
1089          {
1090            text: this.title,
1091            x: this.boundingRect.x + this.boundingRect.width / 2,
1092            y: this.boundingRect.y + this.axisConfig.titlePadding,
1093            fill: this.axisThemeConfig.titleColor,
1094            fontSize: this.axisConfig.titleFontSize,
1095            rotation: 0,
1096            verticalPos: "top",
1097            horizontalPos: "center"
1098          }
1099        ]
1100      });
1101    }
1102    return drawableElement;
1103  }
1104  getDrawableElements() {
1105    if (this.axisPosition === "left") {
1106      return this.getDrawableElementsForLeftAxis();
1107    }
1108    if (this.axisPosition === "right") {
1109      throw Error("Drawing of right axis is not implemented");
1110    }
1111    if (this.axisPosition === "bottom") {
1112      return this.getDrawableElementsForBottomAxis();
1113    }
1114    if (this.axisPosition === "top") {
1115      return this.getDrawableElementsForTopAxis();
1116    }
1117    return [];
1118  }
1119}
1119
1120class BandAxis extends BaseAxis {
1121  constructor(axisConfig, axisThemeConfig, categories, title, textDimensionCalculator) {
1122    super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1123    this.categories = categories;
1124    this.scale = band().domain(this.categories).range(this.getRange());
1125  }
1126  setRange(range2) {
1127    super.setRange(range2);
1128  }
1129  recalculateScale() {
1130    this.scale = band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5);
1131    log$1.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
1132  }
1133  getTickValues() {
1134    return this.categories;
1135  }
1136  getScaleValue(value) {
1137    return this.scale(value) || this.getRange()[0];
1138  }
1139}
1140class LinearAxis extends BaseAxis {
1141  constructor(axisConfig, axisThemeConfig, domain, title, textDimensionCalculator) {
1142    super(axisConfig, title, textDimensionCalculator, axisThemeConfig);
1143    this.domain = domain;
1144    this.scale = linear().domain(this.domain).range(this.getRange());
1145  }
1146  getTickValues() {
1147    return this.scale.ticks();
1148  }
1149  recalculateScale() {
1150    const domain = [...this.domain];
1151    if (this.axisPosition === "left") {
1152      domain.reverse();
1153    }
1154    this.scale = linear().domain(domain).range(this.getRange());
1155  }
1156  getScaleValue(value) {
1157    return this.scale(value);
1158  }
1159}
1160function getAxis(data, axisConfig, axisThemeConfig, tmpSVGGroup2) {
1161  const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1162  if (isBandAxisData(data)) {
1163    return new BandAxis(
1164      axisConfig,
1165      axisThemeConfig,
1166      data.categories,
1167      data.title,
1168      textDimensionCalculator
1169    );
1170  }
1171  return new LinearAxis(
1172    axisConfig,
1173    axisThemeConfig,
1174    [data.min, data.max],
1175    data.title,
1176    textDimensionCalculator
1177  );
1178}
1179class ChartTitle {
1180  constructor(textDimensionCalculator, chartConfig, chartData, chartThemeConfig) {
1181    this.textDimensionCalculator = textDimensionCalculator;
1182    this.chartConfig = chartConfig;
1183    this.chartData = chartData;
1184    this.chartThemeConfig = chartThemeConfig;
1185    this.boundingRect = {
1186      x: 0,
1187      y: 0,
1188      width: 0,
1189      height: 0
1190    };
1191    this.showChartTitle = false;
1192  }
1193  setBoundingBoxXY(point) {
1194    this.boundingRect.x = point.x;
1195    this.boundingRect.y = point.y;
1196  }
1197  calculateSpace(availableSpace) {
1198    const titleDimension = this.textDimensionCalculator.getMaxDimension(
1199      [this.chartData.title],
1200      this.chartConfig.titleFontSize
1201    );
1202    const widthRequired = Math.max(titleDimension.width, availableSpace.width);
1203    const heightRequired = titleDimension.height + 2 * this.chartConfig.titlePadding;
1204    if (titleDimension.width <= widthRequired && titleDimension.height <= heightRequired && this.chartConfig.showTitle && this.chartData.title) {
1205      this.boundingRect.width = widthRequired;
1206      this.boundingRect.height = heightRequired;
1207      this.showChartTitle = true;
1208    }
1209    return {
1210      width: this.boundingRect.width,
1211      height: this.boundingRect.height
1212    };
1213  }
1214  getDrawableElements() {
1215    const drawableElem = [];
1216    if (this.showChartTitle) {
1217      drawableElem.push({
1218        groupTexts: ["chart-title"],
1219        type: "text",
1220        data: [
1221          {
1222            fontSize: this.chartConfig.titleFontSize,
1223            text: this.chartData.title,
1224            verticalPos: "middle",
1225            horizontalPos: "center",
1226            x: this.boundingRect.x + this.boundingRect.width / 2,
1227            y: this.boundingRect.y + this.boundingRect.height / 2,
1228            fill: this.chartThemeConfig.titleColor,
1229            rotation: 0
1230          }
1231        ]
1232      });
1233    }
1234    return drawableElem;
1235  }
1236}
1237function getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1238  const textDimensionCalculator = new TextDimensionCalculatorWithFont(tmpSVGGroup2);
1239  return new ChartTitle(textDimensionCalculator, chartConfig, chartData, chartThemeConfig);
1240}
1241class LinePlot {
1242  constructor(plotData, xAxis, yAxis, orientation, plotIndex2) {
1243    this.plotData = plotData;
1244    this.xAxis = xAxis;
1245    this.yAxis = yAxis;
1246    this.orientation = orientation;
1247    this.plotIndex = plotIndex2;
1248  }
1249  getDrawableElement() {
1250    const finalData = this.plotData.data.map((d) => [
1251      this.xAxis.getScaleValue(d[0]),
1252      this.yAxis.getScaleValue(d[1])
1253    ]);
1254    let path;
1255    if (this.orientation === "horizontal") {
1256      path = line().y((d) => d[0]).x((d) => d[1])(finalData);
1257    } else {
1258      path = line().x((d) => d[0]).y((d) => d[1])(finalData);
1259    }
1260    if (!path) {
1261      return [];
1262    }
1263    return [
1264      {
1265        groupTexts: ["plot", `line-plot-${this.plotIndex}`],
1266        type: "path",
1267        data: [
1268          {
1269            path,
1270            strokeFill: this.plotData.strokeFill,
1271            strokeWidth: this.plotData.strokeWidth
1272          }
1273        ]
1274      }
1275    ];
1276  }
1277}
1278class BarPlot {
1279  constructor(barData, boundingRect, xAxis, yAxis, orientation, plotIndex2) {
1280    this.barData = barData;
1281    this.boundingRect = boundingRect;
1282    this.xAxis = xAxis;
1283    this.yAxis = yAxis;
1284    this.orientation = orientation;
1285    this.plotIndex = plotIndex2;
1286  }
1287  getDrawableElement() {
1288    const finalData = this.barData.data.map((d) => [
1289      this.xAxis.getScaleValue(d[0]),
1290      this.yAxis.getScaleValue(d[1])
1291    ]);
1292    const barPaddingPercent = 0.05;
1293    const barWidth = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - barPaddingPercent);
1294    const barWidthHalf = barWidth / 2;
1295    if (this.orientation === "horizontal") {
1296      return [
1297        {
1298          groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1299          type: "rect",
1300          data: finalData.map((data) => ({
1301            x: this.boundingRect.x,
1302            y: data[0] - barWidthHalf,
1303            height: barWidth,
1304            width: data[1] - this.boundingRect.x,
1305            fill: this.barData.fill,
1306            strokeWidth: 0,
1307            strokeFill: this.barData.fill
1308          }))
1309        }
1310      ];
1311    }
1312    return [
1313      {
1314        groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
1315        type: "rect",
1316        data: finalData.map((data) => ({
1317          x: data[0] - barWidthHalf,
1318          y: data[1],
1319          width: barWidth,
1320          height: this.boundingRect.y + this.boundingRect.height - data[1],
1321          fill: this.barData.fill,
1322          strokeWidth: 0,
1323          strokeFill: this.barData.fill
1324        }))
1325      }
1326    ];
1327  }
1328}
1329class BasePlot {
1330  constructor(chartConfig, chartData, chartThemeConfig) {
1331    this.chartConfig = chartConfig;
1332    this.chartData = chartData;
1333    this.chartThemeConfig = chartThemeConfig;
1334    this.boundingRect = {
1335      x: 0,
1336      y: 0,
1337      width: 0,
1338      height: 0
1339    };
1340  }
1341  setAxes(xAxis, yAxis) {
1342    this.xAxis = xAxis;
1343    this.yAxis = yAxis;
1344  }
1345  setBoundingBoxXY(point) {
1346    this.boundingRect.x = point.x;
1347    this.boundingRect.y = point.y;
1348  }
1349  calculateSpace(availableSpace) {
1350    this.boundingRect.width = availableSpace.width;
1351    this.boundingRect.height = availableSpace.height;
1352    return {
1353      width: this.boundingRect.width,
1354      height: this.boundingRect.height
1355    };
1356  }
1357  getDrawableElements() {
1358    if (!(this.xAxis && this.yAxis)) {
1359      throw Error("Axes must be passed to render Plots");
1360    }
1361    const drawableElem = [];
1362    for (const [i, plot] of this.chartData.plots.entries()) {
1363      switch (plot.type) {
1364        case "line":
1365          {
1366            const linePlot = new LinePlot(
1367              plot,
1368              this.xAxis,
1369              this.yAxis,
1370              this.chartConfig.chartOrientation,
1371              i
1372            );
1373            drawableElem.push(...linePlot.getDrawableElement());
1374          }
1375          break;
1376        case "bar":
1377          {
1378            const barPlot = new BarPlot(
1379              plot,
1380              this.boundingRect,
1381              this.xAxis,
1382              this.yAxis,
1383              this.chartConfig.chartOrientation,
1384              i
1385            );
1386            drawableElem.push(...barPlot.getDrawableElement());
1387          }
1388          break;
1389      }
1390    }
1391    return drawableElem;
1392  }
1393}
1394function getPlotComponent(chartConfig, chartData, chartThemeConfig) {
1395  return new BasePlot(chartConfig, chartData, chartThemeConfig);
1396}
1397class Orchestrator {
1398  constructor(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2) {
1399    this.chartConfig = chartConfig;
1400    this.chartData = chartData;
1401    this.componentStore = {
1402      title: getChartTitleComponent(chartConfig, chartData, chartThemeConfig, tmpSVGGroup2),
1403      plot: getPlotComponent(chartConfig, chartData, chartThemeConfig),
1404      xAxis: getAxis(
1405        chartData.xAxis,
1406        chartConfig.xAxis,
1407        {
1408          titleColor: chartThemeConfig.xAxisTitleColor,
1409          labelColor: chartThemeConfig.xAxisLabelColor,
1410          tickColor: chartThemeConfig.xAxisTickColor,
1411          axisLineColor: chartThemeConfig.xAxisLineColor
1412        },
1413        tmpSVGGroup2
1414      ),
1415      yAxis: getAxis(
1416        chartData.yAxis,
1417        chartConfig.yAxis,
1418        {
1419          titleColor: chartThemeConfig.yAxisTitleColor,
1420          labelColor: chartThemeConfig.yAxisLabelColor,
1421          tickColor: chartThemeConfig.yAxisTickColor,
1422          axisLineColor: chartThemeConfig.yAxisLineColor
1423        },
1424        tmpSVGGroup2
1425      )
1426    };
1427  }
1428  calculateVerticalSpace() {
1429    let availableWidth = this.chartConfig.width;
1430    let availableHeight = this.chartConfig.height;
1431    let plotX = 0;
1432    let plotY = 0;
vendor: 4,372 bytes, lines 1433-1550
1433    let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1434    let chartHeight = Math.floor(
1435      availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1436    );
1437    let spaceUsed = this.componentStore.plot.calculateSpace({
1438      width: chartWidth,
1439      height: chartHeight
1440    });
1441    availableWidth -= spaceUsed.width;
1442    availableHeight -= spaceUsed.height;
1443    spaceUsed = this.componentStore.title.calculateSpace({
1444      width: this.chartConfig.width,
1445      height: availableHeight
1446    });
1447    plotY = spaceUsed.height;
1448    availableHeight -= spaceUsed.height;
1449    this.componentStore.xAxis.setAxisPosition("bottom");
1450    spaceUsed = this.componentStore.xAxis.calculateSpace({
1451      width: availableWidth,
1452      height: availableHeight
1453    });
1454    availableHeight -= spaceUsed.height;
1455    this.componentStore.yAxis.setAxisPosition("left");
1456    spaceUsed = this.componentStore.yAxis.calculateSpace({
1457      width: availableWidth,
1458      height: availableHeight
1459    });
1460    plotX = spaceUsed.width;
1461    availableWidth -= spaceUsed.width;
1462    if (availableWidth > 0) {
1463      chartWidth += availableWidth;
1464      availableWidth = 0;
1465    }
1466    if (availableHeight > 0) {
1467      chartHeight += availableHeight;
1468      availableHeight = 0;
1469    }
1470    this.componentStore.plot.calculateSpace({
1471      width: chartWidth,
1472      height: chartHeight
1473    });
1474    this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1475    this.componentStore.xAxis.setRange([plotX, plotX + chartWidth]);
1476    this.componentStore.xAxis.setBoundingBoxXY({ x: plotX, y: plotY + chartHeight });
1477    this.componentStore.yAxis.setRange([plotY, plotY + chartHeight]);
1478    this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: plotY });
1479    if (this.chartData.plots.some((p) => isBarPlot(p))) {
1480      this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1481    }
1482  }
1483  calculateHorizontalSpace() {
1484    let availableWidth = this.chartConfig.width;
1485    let availableHeight = this.chartConfig.height;
1486    let titleYEnd = 0;
1487    let plotX = 0;
1488    let plotY = 0;
1489    let chartWidth = Math.floor(availableWidth * this.chartConfig.plotReservedSpacePercent / 100);
1490    let chartHeight = Math.floor(
1491      availableHeight * this.chartConfig.plotReservedSpacePercent / 100
1492    );
1493    let spaceUsed = this.componentStore.plot.calculateSpace({
1494      width: chartWidth,
1495      height: chartHeight
1496    });
1497    availableWidth -= spaceUsed.width;
1498    availableHeight -= spaceUsed.height;
1499    spaceUsed = this.componentStore.title.calculateSpace({
1500      width: this.chartConfig.width,
1501      height: availableHeight
1502    });
1503    titleYEnd = spaceUsed.height;
1504    availableHeight -= spaceUsed.height;
1505    this.componentStore.xAxis.setAxisPosition("left");
1506    spaceUsed = this.componentStore.xAxis.calculateSpace({
1507      width: availableWidth,
1508      height: availableHeight
1509    });
1510    availableWidth -= spaceUsed.width;
1511    plotX = spaceUsed.width;
1512    this.componentStore.yAxis.setAxisPosition("top");
1513    spaceUsed = this.componentStore.yAxis.calculateSpace({
1514      width: availableWidth,
1515      height: availableHeight
1516    });
1517    availableHeight -= spaceUsed.height;
1518    plotY = titleYEnd + spaceUsed.height;
1519    if (availableWidth > 0) {
1520      chartWidth += availableWidth;
1521      availableWidth = 0;
1522    }
1523    if (availableHeight > 0) {
1524      chartHeight += availableHeight;
1525      availableHeight = 0;
1526    }
1527    this.componentStore.plot.calculateSpace({
1528      width: chartWidth,
1529      height: chartHeight
1530    });
1531    this.componentStore.plot.setBoundingBoxXY({ x: plotX, y: plotY });
1532    this.componentStore.yAxis.setRange([plotX, plotX + chartWidth]);
1533    this.componentStore.yAxis.setBoundingBoxXY({ x: plotX, y: titleYEnd });
1534    this.componentStore.xAxis.setRange([plotY, plotY + chartHeight]);
1535    this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: plotY });
1536    if (this.chartData.plots.some((p) => isBarPlot(p))) {
1537      this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
1538    }
1539  }
1540  calculateSpace() {
1541    if (this.chartConfig.chartOrientation === "horizontal") {
1542      this.calculateHorizontalSpace();
1543    } else {
1544      this.calculateVerticalSpace();
1545    }
1546  }
1547  getDrawableElement() {
1548    this.calculateSpace();
1549    const drawableElem = [];
1550    this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
1551    for (const component of Object.values(this.componentStore)) {
1552      drawableElem.push(...component.getDrawableElements());
1553    }
1554    return drawableElem;
1555  }
1556}
1557class XYChartBuilder {
1558  static build(config, chartData, chartThemeConfig, tmpSVGGroup2) {
1559    const orchestrator = new Orchestrator(config, chartData, chartThemeConfig, tmpSVGGroup2);
1560    return orchestrator.getDrawableElement();
1561  }
1562}
1563let plotIndex = 0;
1564let tmpSVGGroup;
1565let xyChartConfig = getChartDefaultConfig();
1566let xyChartThemeConfig = getChartDefaultThemeConfig();
1567let xyChartData = getChartDefaultData();
1568let plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1569let hasSetXAxis = false;
1570let hasSetYAxis = false;
1571function getChartDefaultThemeConfig() {
1572  const defaultThemeVariables = getThemeVariables$2();
1573  const config = getConfig$1();
1574  return cleanAndMerge(defaultThemeVariables.xyChart, config.themeVariables.xyChart);
1575}
1576function getChartDefaultConfig() {
1577  const config = getConfig$1();
1578  return cleanAndMerge(
1579    defaultConfig$2.xyChart,
1580    config.xyChart
1581  );
1582}
1583function getChartDefaultData() {
1584  return {
1585    yAxis: {
1586      type: "linear",
1587      title: "",
1588      min: Infinity,
1589      max: -Infinity
1590    },
1591    xAxis: {
1592      type: "band",
1593      title: "",
1594      categories: []
1595    },
1596    title: "",
1597    plots: []
1598  };
1599}
1600function textSanitizer(text) {
1601  const config = getConfig$1();
1602  return sanitizeText$2(text.trim(), config);
1603}
1604function setTmpSVGG(SVGG) {
1605  tmpSVGGroup = SVGG;
1606}
1607function setOrientation(orientation) {
1608  if (orientation === "horizontal") {
1609    xyChartConfig.chartOrientation = "horizontal";
1610  } else {
1611    xyChartConfig.chartOrientation = "vertical";
1612  }
1613}
1614function setXAxisTitle(title) {
1615  xyChartData.xAxis.title = textSanitizer(title.text);
1616}
1617function setXAxisRangeData(min, max) {
1618  xyChartData.xAxis = { type: "linear", title: xyChartData.xAxis.title, min, max };
1619  hasSetXAxis = true;
1620}
1621function setXAxisBand(categories) {
1622  xyChartData.xAxis = {
1623    type: "band",
1624    title: xyChartData.xAxis.title,
1625    categories: categories.map((c) => textSanitizer(c.text))
1626  };
1627  hasSetXAxis = true;
1628}
1629function setYAxisTitle(title) {
1630  xyChartData.yAxis.title = textSanitizer(title.text);
1631}
1632function setYAxisRangeData(min, max) {
1633  xyChartData.yAxis = { type: "linear", title: xyChartData.yAxis.title, min, max };
1634  hasSetYAxis = true;
1635}
1636function setYAxisRangeFromPlotData(data) {
1637  const minValue = Math.min(...data);
1638  const maxValue = Math.max(...data);
1639  const prevMinValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.min : Infinity;
1640  const prevMaxValue = isLinearAxisData(xyChartData.yAxis) ? xyChartData.yAxis.max : -Infinity;
1641  xyChartData.yAxis = {
1642    type: "linear",
1643    title: xyChartData.yAxis.title,
1644    min: Math.min(prevMinValue, minValue),
1645    max: Math.max(prevMaxValue, maxValue)
1646  };
1647}
1648function transformDataWithoutCategory(data) {
1649  let retData = [];
1650  if (data.length === 0) {
1651    return retData;
1652  }
1653  if (!hasSetXAxis) {
1654    const prevMinValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.min : Infinity;
1655    const prevMaxValue = isLinearAxisData(xyChartData.xAxis) ? xyChartData.xAxis.max : -Infinity;
1656    setXAxisRangeData(Math.min(prevMinValue, 1), Math.max(prevMaxValue, data.length));
1657  }
1658  if (!hasSetYAxis) {
1659    setYAxisRangeFromPlotData(data);
1660  }
1661  if (isBandAxisData(xyChartData.xAxis)) {
1662    retData = xyChartData.xAxis.categories.map((c, i) => [c, data[i]]);
1663  }
1664  if (isLinearAxisData(xyChartData.xAxis)) {
1665    const min = xyChartData.xAxis.min;
1666    const max = xyChartData.xAxis.max;
1667    const step = (max - min + 1) / data.length;
1668    const categories = [];
1669    for (let i = min; i <= max; i += step) {
1670      categories.push(`${i}`);
1671    }
1672    retData = categories.map((c, i) => [c, data[i]]);
1673  }
1674  return retData;
1675}
1676function getPlotColorFromPalette(plotIndex2) {
1677  return plotColorPalette[plotIndex2 === 0 ? 0 : plotIndex2 % plotColorPalette.length];
1678}
1679function setLineData(title, data) {
1680  const plotData = transformDataWithoutCategory(data);
1681  xyChartData.plots.push({
1682    type: "line",
1683    strokeFill: getPlotColorFromPalette(plotIndex),
1684    strokeWidth: 2,
1685    data: plotData
1686  });
1687  plotIndex++;
1688}
1689function setBarData(title, data) {
1690  const plotData = transformDataWithoutCategory(data);
1691  xyChartData.plots.push({
1692    type: "bar",
1693    fill: getPlotColorFromPalette(plotIndex),
1694    data: plotData
1695  });
1696  plotIndex++;
1697}
1698function getDrawableElem() {
1699  if (xyChartData.plots.length === 0) {
1700    throw Error("No Plot to render, please provide a plot with some data");
1701  }
1702  xyChartData.title = getDiagramTitle();
1703  return XYChartBuilder.build(xyChartConfig, xyChartData, xyChartThemeConfig, tmpSVGGroup);
1704}
1705function getChartThemeConfig() {
1706  return xyChartThemeConfig;
1707}
1708function getChartConfig() {
1709  return xyChartConfig;
1710}
1711const clear = function() {
1712  clear$1();
1713  plotIndex = 0;
1714  xyChartConfig = getChartDefaultConfig();
1715  xyChartData = getChartDefaultData();
1716  xyChartThemeConfig = getChartDefaultThemeConfig();
1717  plotColorPalette = xyChartThemeConfig.plotColorPalette.split(",").map((color) => color.trim());
1718  hasSetXAxis = false;
1719  hasSetYAxis = false;
1720};
1721const db = {
1722  getDrawableElem,
1723  clear,
1724  setAccTitle,
1725  getAccTitle,
1726  setDiagramTitle,
1727  getDiagramTitle,
1728  getAccDescription,
1729  setAccDescription,
1730  setOrientation,
1731  setXAxisTitle,
1732  setXAxisRangeData,
1733  setXAxisBand,
1734  setYAxisTitle,
1735  setYAxisRangeData,
1736  setLineData,
1737  setBarData,
1738  setTmpSVGG,
1739  getChartThemeConfig,
1740  getChartConfig
1741};
1742const draw = (txt, id, _version, diagObj) => {
1743  const db2 = diagObj.db;
1744  const themeConfig = db2.getChartThemeConfig();
1745  const chartConfig = db2.getChartConfig();
1746  function getDominantBaseLine(horizontalPos) {
1747    return horizontalPos === "top" ? "text-before-edge" : "middle";
1748  }
1749  function getTextAnchor(verticalPos) {
1750    return verticalPos === "left" ? "start" : verticalPos === "right" ? "end" : "middle";
1751  }
1752  function getTextTransformation(data) {
1753    return `translate(${data.x}, ${data.y}) rotate(${data.rotation || 0})`;
1754  }
1755  log$1.debug("Rendering xychart chart\n" + txt);
1756  const svg = selectSvgElement(id);
1757  const group = svg.append("g").attr("class", "main");
1758  const background = group.append("rect").attr("width", chartConfig.width).attr("height", chartConfig.height).attr("class", "background");
1759  configureSvgSize(svg, chartConfig.height, chartConfig.width, true);
1760  svg.attr("viewBox", `0 0 ${chartConfig.width} ${chartConfig.height}`);
1761  background.attr("fill", themeConfig.backgroundColor);
1762  db2.setTmpSVGG(svg.append("g").attr("class", "mermaid-tmp-group"));
1763  const shapes = db2.getDrawableElem();
1764  const groups = {};
1765  function getGroup(gList) {
1766    let elem = group;
1767    let prefix = "";
1768    for (const [i] of gList.entries()) {
1769      let parent = group;
1770      if (i > 0 && groups[prefix]) {
1771        parent = groups[prefix];
1772      }
1773      prefix += gList[i];
1774      elem = groups[prefix];
1775      if (!elem) {
1776        elem = groups[prefix] = parent.append("g").attr("class", gList[i]);
1777      }
1778    }
1779    return elem;
1780  }
1781  for (const shape of shapes) {
1782    if (shape.data.length === 0) {
1783      continue;
1784    }
1785    const shapeGroup = getGroup(shape.groupTexts);
1786    switch (shape.type) {
1787      case "rect":
1788        shapeGroup.selectAll("rect").data(shape.data).enter().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).attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1789        break;
1790      case "text":
1791        shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (data) => data.fill).attr("font-size", (data) => data.fontSize).attr("dominant-baseline", (data) => getDominantBaseLine(data.verticalPos)).attr("text-anchor", (data) => getTextAnchor(data.horizontalPos)).attr("transform", (data) => getTextTransformation(data)).text((data) => data.text);
1792        break;
1793      case "path":
1794        shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d", (data) => data.path).attr("fill", (data) => data.fill ? data.fill : "none").attr("stroke", (data) => data.strokeFill).attr("stroke-width", (data) => data.strokeWidth);
1795        break;
1796    }
1797  }
1798};
1799const renderer = {
1800  draw
1801};
1802const diagram = {
1803  parser: parser$1,
1804  db,
1805  renderer
1806};
1807export {
1808  diagram
1809};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.