@infinilabs/ai-chat 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +310 -56
  2. package/dist/_baseUniq-BFn6cCm9.js +152 -0
  3. package/dist/_baseUniq-nfJyj2zU.cjs +151 -0
  4. package/dist/arc-BWSMkwk2.cjs +130 -0
  5. package/dist/arc-DODeX7B9.js +131 -0
  6. package/dist/architecture-U656AL7Q-B4C0nw6C.js +5 -0
  7. package/dist/architecture-U656AL7Q-CVURQXwt.cjs +5 -0
  8. package/dist/architectureDiagram-VXUJARFQ-2UbdzpNz.cjs +8681 -0
  9. package/dist/architectureDiagram-VXUJARFQ-NCVmzKuE.js +8681 -0
  10. package/dist/blockDiagram-VD42YOAC-B3yCPK1N.cjs +3606 -0
  11. package/dist/blockDiagram-VD42YOAC-C4FsmQfk.js +3606 -0
  12. package/dist/c4Diagram-YG6GDRKO-ATyoKzFV.js +2481 -0
  13. package/dist/c4Diagram-YG6GDRKO-COwVcHWj.cjs +2481 -0
  14. package/dist/channel-2Y73gsu9.cjs +6 -0
  15. package/dist/channel-oB8MffQV.js +7 -0
  16. package/dist/chunk-4BX2VUAB-C3diNHZw.cjs +15 -0
  17. package/dist/chunk-4BX2VUAB-sd2zFBFz.js +16 -0
  18. package/dist/chunk-55IACEB6-6ohTnYE3.js +13 -0
  19. package/dist/chunk-55IACEB6-T-CzlJke.cjs +12 -0
  20. package/dist/chunk-B4BG7PRW-B1zqG62l.cjs +1825 -0
  21. package/dist/chunk-B4BG7PRW-E1dti26Y.js +1826 -0
  22. package/dist/chunk-DI55MBZ5-Dk0kfYBV.cjs +1914 -0
  23. package/dist/chunk-DI55MBZ5-DpHw-vMw.js +1915 -0
  24. package/dist/chunk-FMBD7UC4-B1vXpasq.js +19 -0
  25. package/dist/chunk-FMBD7UC4-CShN9-qf.cjs +18 -0
  26. package/dist/chunk-QN33PNHL-Cw7FG91D.js +24 -0
  27. package/dist/chunk-QN33PNHL-DJi1fhak.cjs +23 -0
  28. package/dist/chunk-QZHKN3VN-BweiBR9P.js +17 -0
  29. package/dist/chunk-QZHKN3VN-DfUW_gDw.cjs +16 -0
  30. package/dist/chunk-TZMSLE5B-DY2Kbag4.cjs +107 -0
  31. package/dist/chunk-TZMSLE5B-ZQ2Esoix.js +108 -0
  32. package/dist/classDiagram-2ON5EDUG-D2tIbkjc.js +19 -0
  33. package/dist/classDiagram-2ON5EDUG-DRhRmkUb.cjs +19 -0
  34. package/dist/classDiagram-v2-WZHVMYZB-D2tIbkjc.js +19 -0
  35. package/dist/classDiagram-v2-WZHVMYZB-DRhRmkUb.cjs +19 -0
  36. package/dist/clone-BMkj3yun.cjs +7 -0
  37. package/dist/clone-ChHXIoR6.js +8 -0
  38. package/dist/cose-bilkent-S5V4N54A-BXnWH5Od.cjs +4942 -0
  39. package/dist/cose-bilkent-S5V4N54A-D15BmpCb.js +4942 -0
  40. package/dist/cytoscape.esm-BfvZ3QT_.js +30239 -0
  41. package/dist/cytoscape.esm-D8IBYQeQ.cjs +30238 -0
  42. package/dist/dagre-6UL2VRFP-DGQ6TW_g.cjs +693 -0
  43. package/dist/dagre-6UL2VRFP-WmhUYWg8.js +693 -0
  44. package/dist/defaultLocale-DVr69WTU.js +206 -0
  45. package/dist/defaultLocale-DwYGIg9G.cjs +203 -0
  46. package/dist/diagram-PSM6KHXK-DSfHBoUT.js +845 -0
  47. package/dist/diagram-PSM6KHXK-J4qyGeN7.cjs +845 -0
  48. package/dist/diagram-QEK2KX5R-D96wT5cH.cjs +300 -0
  49. package/dist/diagram-QEK2KX5R-I_nyexpY.js +300 -0
  50. package/dist/diagram-S2PKOQOG-BC_WyKEe.cjs +210 -0
  51. package/dist/diagram-S2PKOQOG-aooXSMNo.js +210 -0
  52. package/dist/erDiagram-Q2GNP2WA-DQ8Lquay.cjs +1158 -0
  53. package/dist/erDiagram-Q2GNP2WA-DWF8e6EL.js +1158 -0
  54. package/dist/flowDiagram-NV44I4VS-CM9c4F1o.js +2331 -0
  55. package/dist/flowDiagram-NV44I4VS-DpYNkyM2.cjs +2331 -0
  56. package/dist/ganttDiagram-JELNMOA3-CAsoD6rZ.js +3679 -0
  57. package/dist/ganttDiagram-JELNMOA3-DfKahpj4.cjs +3679 -0
  58. package/dist/gitGraph-F6HP7TQM-BX2fz4_i.js +5 -0
  59. package/dist/gitGraph-F6HP7TQM-DRkGg4T1.cjs +5 -0
  60. package/dist/gitGraphDiagram-NY62KEGX-PXpI94u6.js +1203 -0
  61. package/dist/gitGraphDiagram-NY62KEGX-YhnKpooH.cjs +1203 -0
  62. package/dist/graph-BvxpI7Xc.js +596 -0
  63. package/dist/graph-CI_TWBSn.cjs +595 -0
  64. package/dist/index-BctLGjTK.cjs +120500 -0
  65. package/dist/index-CjSgoo1P.js +120485 -0
  66. package/dist/index.cjs +19 -0
  67. package/dist/index.js +12 -19961
  68. package/dist/info-NVLQJR56-BGbTE7dw.cjs +5 -0
  69. package/dist/info-NVLQJR56-DRxIh-N8.js +5 -0
  70. package/dist/infoDiagram-WHAUD3N6-BB2Bnbnh.cjs +31 -0
  71. package/dist/infoDiagram-WHAUD3N6-D_RrgwxS.js +31 -0
  72. package/dist/init-DevvdK2U.cjs +15 -0
  73. package/dist/init-ZxktEp_H.js +16 -0
  74. package/dist/journeyDiagram-XKPGCS4Q-BJjXlMIj.js +1254 -0
  75. package/dist/journeyDiagram-XKPGCS4Q-BcBLsfI9.cjs +1254 -0
  76. package/dist/kanban-definition-3W4ZIXB7-0wwNBZ93.js +1047 -0
  77. package/dist/kanban-definition-3W4ZIXB7-CaY0q4j9.cjs +1047 -0
  78. package/dist/katex-BhpYeT3b.cjs +14523 -0
  79. package/dist/katex-ei8sH3Uy.js +14524 -0
  80. package/dist/layout-CcghncRv.js +2183 -0
  81. package/dist/layout-CvwzED_C.cjs +2182 -0
  82. package/dist/linear-CYow-mAK.cjs +339 -0
  83. package/dist/linear-D_gKQzVp.js +340 -0
  84. package/dist/mermaid-parser.core-CzmkR-3i.cjs +18703 -0
  85. package/dist/mermaid-parser.core-DCMDT-Cp.js +18704 -0
  86. package/dist/min-BBp7Smma.js +41 -0
  87. package/dist/min-Gu1I_bJ9.cjs +40 -0
  88. package/dist/mindmap-definition-VGOIOE7T-D16Pp1u5.cjs +1126 -0
  89. package/dist/mindmap-definition-VGOIOE7T-PjSLRtz4.js +1126 -0
  90. package/dist/ordinal-CxptdPJm.js +76 -0
  91. package/dist/ordinal-D7sQNqXZ.cjs +75 -0
  92. package/dist/packet-BFZMPI3H-BvdogPiS.js +5 -0
  93. package/dist/packet-BFZMPI3H-C7pOHUWY.cjs +5 -0
  94. package/dist/pie-7BOR55EZ-D-DxSHbP.cjs +5 -0
  95. package/dist/pie-7BOR55EZ-DEWJe4Xn.js +5 -0
  96. package/dist/pieDiagram-ADFJNKIX-CoDddKZl.js +237 -0
  97. package/dist/pieDiagram-ADFJNKIX-DjN4DU9l.cjs +237 -0
  98. package/dist/quadrantDiagram-AYHSOK5B-BZOg0JMm.js +1335 -0
  99. package/dist/quadrantDiagram-AYHSOK5B-DXjTSOL4.cjs +1335 -0
  100. package/dist/radar-NHE76QYJ-BrnDXy9q.cjs +5 -0
  101. package/dist/radar-NHE76QYJ-C2WmPmJ4.js +5 -0
  102. package/dist/requirementDiagram-UZGBJVZJ-CCW1O1xH.js +1161 -0
  103. package/dist/requirementDiagram-UZGBJVZJ-e5F3-dDI.cjs +1161 -0
  104. package/dist/sankeyDiagram-TZEHDZUN-BaGzCxTp.js +1193 -0
  105. package/dist/sankeyDiagram-TZEHDZUN-DtIvOvVI.cjs +1193 -0
  106. package/dist/sequenceDiagram-WL72ISMW-0vFhYnxn.cjs +3874 -0
  107. package/dist/sequenceDiagram-WL72ISMW-DL3B7U56.js +3874 -0
  108. package/dist/stateDiagram-FKZM4ZOC-CXW608BR.cjs +447 -0
  109. package/dist/stateDiagram-FKZM4ZOC-Ddw6HxPD.js +447 -0
  110. package/dist/stateDiagram-v2-4FDKWEC3-DZCkQKmp.js +19 -0
  111. package/dist/stateDiagram-v2-4FDKWEC3-DefWUbvq.cjs +19 -0
  112. package/dist/timeline-definition-IT6M3QCI-C3TfA9lE.cjs +1222 -0
  113. package/dist/timeline-definition-IT6M3QCI-DiS88lUo.js +1222 -0
  114. package/dist/treemap-KMMF4GRG-Bl-H6j2c.cjs +5 -0
  115. package/dist/treemap-KMMF4GRG-DGGr_R9A.js +5 -0
  116. package/dist/xychartDiagram-PRI3JC2R-BrOwRjfF.js +1886 -0
  117. package/dist/xychartDiagram-PRI3JC2R-CM06DttH.cjs +1886 -0
  118. package/package.json +22 -11
  119. package/dist/index.css +0 -1582
@@ -0,0 +1,1254 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const chunkTZMSLE5B = require("./chunk-TZMSLE5B-DY2Kbag4.cjs");
4
+ const chunkFMBD7UC4 = require("./chunk-FMBD7UC4-CShN9-qf.cjs");
5
+ const index = require("./index-BctLGjTK.cjs");
6
+ const arc = require("./arc-BWSMkwk2.cjs");
7
+ var parser = (function() {
8
+ var o = /* @__PURE__ */ index.__name(function(k, v, o2, l) {
9
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
10
+ return o2;
11
+ }, "o"), $V0 = [6, 8, 10, 11, 12, 14, 16, 17, 18], $V1 = [1, 9], $V2 = [1, 10], $V3 = [1, 11], $V4 = [1, 12], $V5 = [1, 13], $V6 = [1, 14];
12
+ var parser2 = {
13
+ trace: /* @__PURE__ */ index.__name(function trace() {
14
+ }, "trace"),
15
+ yy: {},
16
+ symbols_: { "error": 2, "start": 3, "journey": 4, "document": 5, "EOF": 6, "line": 7, "SPACE": 8, "statement": 9, "NEWLINE": 10, "title": 11, "acc_title": 12, "acc_title_value": 13, "acc_descr": 14, "acc_descr_value": 15, "acc_descr_multiline_value": 16, "section": 17, "taskName": 18, "taskData": 19, "$accept": 0, "$end": 1 },
17
+ terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
18
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
19
+ performAction: /* @__PURE__ */ index.__name(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
20
+ var $0 = $$.length - 1;
21
+ switch (yystate) {
22
+ case 1:
23
+ return $$[$0 - 1];
24
+ case 2:
25
+ this.$ = [];
26
+ break;
27
+ case 3:
28
+ $$[$0 - 1].push($$[$0]);
29
+ this.$ = $$[$0 - 1];
30
+ break;
31
+ case 4:
32
+ case 5:
33
+ this.$ = $$[$0];
34
+ break;
35
+ case 6:
36
+ case 7:
37
+ this.$ = [];
38
+ break;
39
+ case 8:
40
+ yy.setDiagramTitle($$[$0].substr(6));
41
+ this.$ = $$[$0].substr(6);
42
+ break;
43
+ case 9:
44
+ this.$ = $$[$0].trim();
45
+ yy.setAccTitle(this.$);
46
+ break;
47
+ case 10:
48
+ case 11:
49
+ this.$ = $$[$0].trim();
50
+ yy.setAccDescription(this.$);
51
+ break;
52
+ case 12:
53
+ yy.addSection($$[$0].substr(8));
54
+ this.$ = $$[$0].substr(8);
55
+ break;
56
+ case 13:
57
+ yy.addTask($$[$0 - 1], $$[$0]);
58
+ this.$ = "task";
59
+ break;
60
+ }
61
+ }, "anonymous"),
62
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 15, 11: $V1, 12: $V2, 14: $V3, 16: $V4, 17: $V5, 18: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, o($V0, [2, 11]), o($V0, [2, 12]), { 19: [1, 18] }, o($V0, [2, 4]), o($V0, [2, 9]), o($V0, [2, 10]), o($V0, [2, 13])],
63
+ defaultActions: {},
64
+ parseError: /* @__PURE__ */ index.__name(function parseError(str, hash) {
65
+ if (hash.recoverable) {
66
+ this.trace(str);
67
+ } else {
68
+ var error = new Error(str);
69
+ error.hash = hash;
70
+ throw error;
71
+ }
72
+ }, "parseError"),
73
+ parse: /* @__PURE__ */ index.__name(function parse(input) {
74
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
75
+ var args = lstack.slice.call(arguments, 1);
76
+ var lexer2 = Object.create(this.lexer);
77
+ var sharedState = { yy: {} };
78
+ for (var k in this.yy) {
79
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
80
+ sharedState.yy[k] = this.yy[k];
81
+ }
82
+ }
83
+ lexer2.setInput(input, sharedState.yy);
84
+ sharedState.yy.lexer = lexer2;
85
+ sharedState.yy.parser = this;
86
+ if (typeof lexer2.yylloc == "undefined") {
87
+ lexer2.yylloc = {};
88
+ }
89
+ var yyloc = lexer2.yylloc;
90
+ lstack.push(yyloc);
91
+ var ranges = lexer2.options && lexer2.options.ranges;
92
+ if (typeof sharedState.yy.parseError === "function") {
93
+ this.parseError = sharedState.yy.parseError;
94
+ } else {
95
+ this.parseError = Object.getPrototypeOf(this).parseError;
96
+ }
97
+ function popStack(n) {
98
+ stack.length = stack.length - 2 * n;
99
+ vstack.length = vstack.length - n;
100
+ lstack.length = lstack.length - n;
101
+ }
102
+ index.__name(popStack, "popStack");
103
+ function lex() {
104
+ var token;
105
+ token = tstack.pop() || lexer2.lex() || EOF;
106
+ if (typeof token !== "number") {
107
+ if (token instanceof Array) {
108
+ tstack = token;
109
+ token = tstack.pop();
110
+ }
111
+ token = self.symbols_[token] || token;
112
+ }
113
+ return token;
114
+ }
115
+ index.__name(lex, "lex");
116
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
117
+ while (true) {
118
+ state = stack[stack.length - 1];
119
+ if (this.defaultActions[state]) {
120
+ action = this.defaultActions[state];
121
+ } else {
122
+ if (symbol === null || typeof symbol == "undefined") {
123
+ symbol = lex();
124
+ }
125
+ action = table[state] && table[state][symbol];
126
+ }
127
+ if (typeof action === "undefined" || !action.length || !action[0]) {
128
+ var errStr = "";
129
+ expected = [];
130
+ for (p in table[state]) {
131
+ if (this.terminals_[p] && p > TERROR) {
132
+ expected.push("'" + this.terminals_[p] + "'");
133
+ }
134
+ }
135
+ if (lexer2.showPosition) {
136
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
137
+ } else {
138
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
139
+ }
140
+ this.parseError(errStr, {
141
+ text: lexer2.match,
142
+ token: this.terminals_[symbol] || symbol,
143
+ line: lexer2.yylineno,
144
+ loc: yyloc,
145
+ expected
146
+ });
147
+ }
148
+ if (action[0] instanceof Array && action.length > 1) {
149
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
150
+ }
151
+ switch (action[0]) {
152
+ case 1:
153
+ stack.push(symbol);
154
+ vstack.push(lexer2.yytext);
155
+ lstack.push(lexer2.yylloc);
156
+ stack.push(action[1]);
157
+ symbol = null;
158
+ {
159
+ yyleng = lexer2.yyleng;
160
+ yytext = lexer2.yytext;
161
+ yylineno = lexer2.yylineno;
162
+ yyloc = lexer2.yylloc;
163
+ }
164
+ break;
165
+ case 2:
166
+ len = this.productions_[action[1]][1];
167
+ yyval.$ = vstack[vstack.length - len];
168
+ yyval._$ = {
169
+ first_line: lstack[lstack.length - (len || 1)].first_line,
170
+ last_line: lstack[lstack.length - 1].last_line,
171
+ first_column: lstack[lstack.length - (len || 1)].first_column,
172
+ last_column: lstack[lstack.length - 1].last_column
173
+ };
174
+ if (ranges) {
175
+ yyval._$.range = [
176
+ lstack[lstack.length - (len || 1)].range[0],
177
+ lstack[lstack.length - 1].range[1]
178
+ ];
179
+ }
180
+ r = this.performAction.apply(yyval, [
181
+ yytext,
182
+ yyleng,
183
+ yylineno,
184
+ sharedState.yy,
185
+ action[1],
186
+ vstack,
187
+ lstack
188
+ ].concat(args));
189
+ if (typeof r !== "undefined") {
190
+ return r;
191
+ }
192
+ if (len) {
193
+ stack = stack.slice(0, -1 * len * 2);
194
+ vstack = vstack.slice(0, -1 * len);
195
+ lstack = lstack.slice(0, -1 * len);
196
+ }
197
+ stack.push(this.productions_[action[1]][0]);
198
+ vstack.push(yyval.$);
199
+ lstack.push(yyval._$);
200
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
201
+ stack.push(newState);
202
+ break;
203
+ case 3:
204
+ return true;
205
+ }
206
+ }
207
+ return true;
208
+ }, "parse")
209
+ };
210
+ var lexer = /* @__PURE__ */ (function() {
211
+ var lexer2 = {
212
+ EOF: 1,
213
+ parseError: /* @__PURE__ */ index.__name(function parseError(str, hash) {
214
+ if (this.yy.parser) {
215
+ this.yy.parser.parseError(str, hash);
216
+ } else {
217
+ throw new Error(str);
218
+ }
219
+ }, "parseError"),
220
+ // resets the lexer, sets new input
221
+ setInput: /* @__PURE__ */ index.__name(function(input, yy) {
222
+ this.yy = yy || this.yy || {};
223
+ this._input = input;
224
+ this._more = this._backtrack = this.done = false;
225
+ this.yylineno = this.yyleng = 0;
226
+ this.yytext = this.matched = this.match = "";
227
+ this.conditionStack = ["INITIAL"];
228
+ this.yylloc = {
229
+ first_line: 1,
230
+ first_column: 0,
231
+ last_line: 1,
232
+ last_column: 0
233
+ };
234
+ if (this.options.ranges) {
235
+ this.yylloc.range = [0, 0];
236
+ }
237
+ this.offset = 0;
238
+ return this;
239
+ }, "setInput"),
240
+ // consumes and returns one char from the input
241
+ input: /* @__PURE__ */ index.__name(function() {
242
+ var ch = this._input[0];
243
+ this.yytext += ch;
244
+ this.yyleng++;
245
+ this.offset++;
246
+ this.match += ch;
247
+ this.matched += ch;
248
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
249
+ if (lines) {
250
+ this.yylineno++;
251
+ this.yylloc.last_line++;
252
+ } else {
253
+ this.yylloc.last_column++;
254
+ }
255
+ if (this.options.ranges) {
256
+ this.yylloc.range[1]++;
257
+ }
258
+ this._input = this._input.slice(1);
259
+ return ch;
260
+ }, "input"),
261
+ // unshifts one char (or a string) into the input
262
+ unput: /* @__PURE__ */ index.__name(function(ch) {
263
+ var len = ch.length;
264
+ var lines = ch.split(/(?:\r\n?|\n)/g);
265
+ this._input = ch + this._input;
266
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
267
+ this.offset -= len;
268
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
269
+ this.match = this.match.substr(0, this.match.length - 1);
270
+ this.matched = this.matched.substr(0, this.matched.length - 1);
271
+ if (lines.length - 1) {
272
+ this.yylineno -= lines.length - 1;
273
+ }
274
+ var r = this.yylloc.range;
275
+ this.yylloc = {
276
+ first_line: this.yylloc.first_line,
277
+ last_line: this.yylineno + 1,
278
+ first_column: this.yylloc.first_column,
279
+ 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
280
+ };
281
+ if (this.options.ranges) {
282
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
283
+ }
284
+ this.yyleng = this.yytext.length;
285
+ return this;
286
+ }, "unput"),
287
+ // When called from action, caches matched text and appends it on next action
288
+ more: /* @__PURE__ */ index.__name(function() {
289
+ this._more = true;
290
+ return this;
291
+ }, "more"),
292
+ // 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.
293
+ reject: /* @__PURE__ */ index.__name(function() {
294
+ if (this.options.backtrack_lexer) {
295
+ this._backtrack = true;
296
+ } else {
297
+ 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(), {
298
+ text: "",
299
+ token: null,
300
+ line: this.yylineno
301
+ });
302
+ }
303
+ return this;
304
+ }, "reject"),
305
+ // retain first n characters of the match
306
+ less: /* @__PURE__ */ index.__name(function(n) {
307
+ this.unput(this.match.slice(n));
308
+ }, "less"),
309
+ // displays already matched input, i.e. for error messages
310
+ pastInput: /* @__PURE__ */ index.__name(function() {
311
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
312
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
313
+ }, "pastInput"),
314
+ // displays upcoming input, i.e. for error messages
315
+ upcomingInput: /* @__PURE__ */ index.__name(function() {
316
+ var next = this.match;
317
+ if (next.length < 20) {
318
+ next += this._input.substr(0, 20 - next.length);
319
+ }
320
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
321
+ }, "upcomingInput"),
322
+ // displays the character position where the lexing error occurred, i.e. for error messages
323
+ showPosition: /* @__PURE__ */ index.__name(function() {
324
+ var pre = this.pastInput();
325
+ var c = new Array(pre.length + 1).join("-");
326
+ return pre + this.upcomingInput() + "\n" + c + "^";
327
+ }, "showPosition"),
328
+ // test the lexed token: return FALSE when not a match, otherwise return token
329
+ test_match: /* @__PURE__ */ index.__name(function(match, indexed_rule) {
330
+ var token, lines, backup;
331
+ if (this.options.backtrack_lexer) {
332
+ backup = {
333
+ yylineno: this.yylineno,
334
+ yylloc: {
335
+ first_line: this.yylloc.first_line,
336
+ last_line: this.last_line,
337
+ first_column: this.yylloc.first_column,
338
+ last_column: this.yylloc.last_column
339
+ },
340
+ yytext: this.yytext,
341
+ match: this.match,
342
+ matches: this.matches,
343
+ matched: this.matched,
344
+ yyleng: this.yyleng,
345
+ offset: this.offset,
346
+ _more: this._more,
347
+ _input: this._input,
348
+ yy: this.yy,
349
+ conditionStack: this.conditionStack.slice(0),
350
+ done: this.done
351
+ };
352
+ if (this.options.ranges) {
353
+ backup.yylloc.range = this.yylloc.range.slice(0);
354
+ }
355
+ }
356
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
357
+ if (lines) {
358
+ this.yylineno += lines.length;
359
+ }
360
+ this.yylloc = {
361
+ first_line: this.yylloc.last_line,
362
+ last_line: this.yylineno + 1,
363
+ first_column: this.yylloc.last_column,
364
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
365
+ };
366
+ this.yytext += match[0];
367
+ this.match += match[0];
368
+ this.matches = match;
369
+ this.yyleng = this.yytext.length;
370
+ if (this.options.ranges) {
371
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
372
+ }
373
+ this._more = false;
374
+ this._backtrack = false;
375
+ this._input = this._input.slice(match[0].length);
376
+ this.matched += match[0];
377
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
378
+ if (this.done && this._input) {
379
+ this.done = false;
380
+ }
381
+ if (token) {
382
+ return token;
383
+ } else if (this._backtrack) {
384
+ for (var k in backup) {
385
+ this[k] = backup[k];
386
+ }
387
+ return false;
388
+ }
389
+ return false;
390
+ }, "test_match"),
391
+ // return next match in input
392
+ next: /* @__PURE__ */ index.__name(function() {
393
+ if (this.done) {
394
+ return this.EOF;
395
+ }
396
+ if (!this._input) {
397
+ this.done = true;
398
+ }
399
+ var token, match, tempMatch, index2;
400
+ if (!this._more) {
401
+ this.yytext = "";
402
+ this.match = "";
403
+ }
404
+ var rules = this._currentRules();
405
+ for (var i = 0; i < rules.length; i++) {
406
+ tempMatch = this._input.match(this.rules[rules[i]]);
407
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
408
+ match = tempMatch;
409
+ index2 = i;
410
+ if (this.options.backtrack_lexer) {
411
+ token = this.test_match(tempMatch, rules[i]);
412
+ if (token !== false) {
413
+ return token;
414
+ } else if (this._backtrack) {
415
+ match = false;
416
+ continue;
417
+ } else {
418
+ return false;
419
+ }
420
+ } else if (!this.options.flex) {
421
+ break;
422
+ }
423
+ }
424
+ }
425
+ if (match) {
426
+ token = this.test_match(match, rules[index2]);
427
+ if (token !== false) {
428
+ return token;
429
+ }
430
+ return false;
431
+ }
432
+ if (this._input === "") {
433
+ return this.EOF;
434
+ } else {
435
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
436
+ text: "",
437
+ token: null,
438
+ line: this.yylineno
439
+ });
440
+ }
441
+ }, "next"),
442
+ // return next match that has a token
443
+ lex: /* @__PURE__ */ index.__name(function lex() {
444
+ var r = this.next();
445
+ if (r) {
446
+ return r;
447
+ } else {
448
+ return this.lex();
449
+ }
450
+ }, "lex"),
451
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
452
+ begin: /* @__PURE__ */ index.__name(function begin(condition) {
453
+ this.conditionStack.push(condition);
454
+ }, "begin"),
455
+ // pop the previously active lexer condition state off the condition stack
456
+ popState: /* @__PURE__ */ index.__name(function popState() {
457
+ var n = this.conditionStack.length - 1;
458
+ if (n > 0) {
459
+ return this.conditionStack.pop();
460
+ } else {
461
+ return this.conditionStack[0];
462
+ }
463
+ }, "popState"),
464
+ // produce the lexer rule set which is active for the currently active lexer condition state
465
+ _currentRules: /* @__PURE__ */ index.__name(function _currentRules() {
466
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
467
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
468
+ } else {
469
+ return this.conditions["INITIAL"].rules;
470
+ }
471
+ }, "_currentRules"),
472
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
473
+ topState: /* @__PURE__ */ index.__name(function topState(n) {
474
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
475
+ if (n >= 0) {
476
+ return this.conditionStack[n];
477
+ } else {
478
+ return "INITIAL";
479
+ }
480
+ }, "topState"),
481
+ // alias for begin(condition)
482
+ pushState: /* @__PURE__ */ index.__name(function pushState(condition) {
483
+ this.begin(condition);
484
+ }, "pushState"),
485
+ // return the number of states currently on the stack
486
+ stateStackSize: /* @__PURE__ */ index.__name(function stateStackSize() {
487
+ return this.conditionStack.length;
488
+ }, "stateStackSize"),
489
+ options: { "case-insensitive": true },
490
+ performAction: /* @__PURE__ */ index.__name(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
491
+ switch ($avoiding_name_collisions) {
492
+ case 0:
493
+ break;
494
+ case 1:
495
+ break;
496
+ case 2:
497
+ return 10;
498
+ case 3:
499
+ break;
500
+ case 4:
501
+ break;
502
+ case 5:
503
+ return 4;
504
+ case 6:
505
+ return 11;
506
+ case 7:
507
+ this.begin("acc_title");
508
+ return 12;
509
+ case 8:
510
+ this.popState();
511
+ return "acc_title_value";
512
+ case 9:
513
+ this.begin("acc_descr");
514
+ return 14;
515
+ case 10:
516
+ this.popState();
517
+ return "acc_descr_value";
518
+ case 11:
519
+ this.begin("acc_descr_multiline");
520
+ break;
521
+ case 12:
522
+ this.popState();
523
+ break;
524
+ case 13:
525
+ return "acc_descr_multiline_value";
526
+ case 14:
527
+ return 17;
528
+ case 15:
529
+ return 18;
530
+ case 16:
531
+ return 19;
532
+ case 17:
533
+ return ":";
534
+ case 18:
535
+ return 6;
536
+ case 19:
537
+ return "INVALID";
538
+ }
539
+ }, "anonymous"),
540
+ rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
541
+ conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], "inclusive": true } }
542
+ };
543
+ return lexer2;
544
+ })();
545
+ parser2.lexer = lexer;
546
+ function Parser() {
547
+ this.yy = {};
548
+ }
549
+ index.__name(Parser, "Parser");
550
+ Parser.prototype = parser2;
551
+ parser2.Parser = Parser;
552
+ return new Parser();
553
+ })();
554
+ parser.parser = parser;
555
+ var journey_default = parser;
556
+ var currentSection = "";
557
+ var sections = [];
558
+ var tasks = [];
559
+ var rawTasks = [];
560
+ var clear2 = /* @__PURE__ */ index.__name(function() {
561
+ sections.length = 0;
562
+ tasks.length = 0;
563
+ currentSection = "";
564
+ rawTasks.length = 0;
565
+ index.clear();
566
+ }, "clear");
567
+ var addSection = /* @__PURE__ */ index.__name(function(txt) {
568
+ currentSection = txt;
569
+ sections.push(txt);
570
+ }, "addSection");
571
+ var getSections = /* @__PURE__ */ index.__name(function() {
572
+ return sections;
573
+ }, "getSections");
574
+ var getTasks = /* @__PURE__ */ index.__name(function() {
575
+ let allItemsProcessed = compileTasks();
576
+ const maxDepth = 100;
577
+ let iterationCount = 0;
578
+ while (!allItemsProcessed && iterationCount < maxDepth) {
579
+ allItemsProcessed = compileTasks();
580
+ iterationCount++;
581
+ }
582
+ tasks.push(...rawTasks);
583
+ return tasks;
584
+ }, "getTasks");
585
+ var updateActors = /* @__PURE__ */ index.__name(function() {
586
+ const tempActors = [];
587
+ tasks.forEach((task) => {
588
+ if (task.people) {
589
+ tempActors.push(...task.people);
590
+ }
591
+ });
592
+ const unique = new Set(tempActors);
593
+ return [...unique].sort();
594
+ }, "updateActors");
595
+ var addTask = /* @__PURE__ */ index.__name(function(descr, taskData) {
596
+ const pieces = taskData.substr(1).split(":");
597
+ let score = 0;
598
+ let peeps = [];
599
+ if (pieces.length === 1) {
600
+ score = Number(pieces[0]);
601
+ peeps = [];
602
+ } else {
603
+ score = Number(pieces[0]);
604
+ peeps = pieces[1].split(",");
605
+ }
606
+ const peopleList = peeps.map((s) => s.trim());
607
+ const rawTask = {
608
+ section: currentSection,
609
+ type: currentSection,
610
+ people: peopleList,
611
+ task: descr,
612
+ score
613
+ };
614
+ rawTasks.push(rawTask);
615
+ }, "addTask");
616
+ var addTaskOrg = /* @__PURE__ */ index.__name(function(descr) {
617
+ const newTask = {
618
+ section: currentSection,
619
+ type: currentSection,
620
+ description: descr,
621
+ task: descr,
622
+ classes: []
623
+ };
624
+ tasks.push(newTask);
625
+ }, "addTaskOrg");
626
+ var compileTasks = /* @__PURE__ */ index.__name(function() {
627
+ const compileTask = /* @__PURE__ */ index.__name(function(pos) {
628
+ return rawTasks[pos].processed;
629
+ }, "compileTask");
630
+ let allProcessed = true;
631
+ for (const [i, rawTask] of rawTasks.entries()) {
632
+ compileTask(i);
633
+ allProcessed = allProcessed && rawTask.processed;
634
+ }
635
+ return allProcessed;
636
+ }, "compileTasks");
637
+ var getActors = /* @__PURE__ */ index.__name(function() {
638
+ return updateActors();
639
+ }, "getActors");
640
+ var journeyDb_default = {
641
+ getConfig: /* @__PURE__ */ index.__name(() => index.getConfig2().journey, "getConfig"),
642
+ clear: clear2,
643
+ setDiagramTitle: index.setDiagramTitle,
644
+ getDiagramTitle: index.getDiagramTitle,
645
+ setAccTitle: index.setAccTitle,
646
+ getAccTitle: index.getAccTitle,
647
+ setAccDescription: index.setAccDescription,
648
+ getAccDescription: index.getAccDescription,
649
+ addSection,
650
+ getSections,
651
+ getTasks,
652
+ addTask,
653
+ addTaskOrg,
654
+ getActors
655
+ };
656
+ var getStyles = /* @__PURE__ */ index.__name((options) => `.label {
657
+ font-family: ${options.fontFamily};
658
+ color: ${options.textColor};
659
+ }
660
+ .mouth {
661
+ stroke: #666;
662
+ }
663
+
664
+ line {
665
+ stroke: ${options.textColor}
666
+ }
667
+
668
+ .legend {
669
+ fill: ${options.textColor};
670
+ font-family: ${options.fontFamily};
671
+ }
672
+
673
+ .label text {
674
+ fill: #333;
675
+ }
676
+ .label {
677
+ color: ${options.textColor}
678
+ }
679
+
680
+ .face {
681
+ ${options.faceColor ? `fill: ${options.faceColor}` : "fill: #FFF8DC"};
682
+ stroke: #999;
683
+ }
684
+
685
+ .node rect,
686
+ .node circle,
687
+ .node ellipse,
688
+ .node polygon,
689
+ .node path {
690
+ fill: ${options.mainBkg};
691
+ stroke: ${options.nodeBorder};
692
+ stroke-width: 1px;
693
+ }
694
+
695
+ .node .label {
696
+ text-align: center;
697
+ }
698
+ .node.clickable {
699
+ cursor: pointer;
700
+ }
701
+
702
+ .arrowheadPath {
703
+ fill: ${options.arrowheadColor};
704
+ }
705
+
706
+ .edgePath .path {
707
+ stroke: ${options.lineColor};
708
+ stroke-width: 1.5px;
709
+ }
710
+
711
+ .flowchart-link {
712
+ stroke: ${options.lineColor};
713
+ fill: none;
714
+ }
715
+
716
+ .edgeLabel {
717
+ background-color: ${options.edgeLabelBackground};
718
+ rect {
719
+ opacity: 0.5;
720
+ }
721
+ text-align: center;
722
+ }
723
+
724
+ .cluster rect {
725
+ }
726
+
727
+ .cluster text {
728
+ fill: ${options.titleColor};
729
+ }
730
+
731
+ div.mermaidTooltip {
732
+ position: absolute;
733
+ text-align: center;
734
+ max-width: 200px;
735
+ padding: 2px;
736
+ font-family: ${options.fontFamily};
737
+ font-size: 12px;
738
+ background: ${options.tertiaryColor};
739
+ border: 1px solid ${options.border2};
740
+ border-radius: 2px;
741
+ pointer-events: none;
742
+ z-index: 100;
743
+ }
744
+
745
+ .task-type-0, .section-type-0 {
746
+ ${options.fillType0 ? `fill: ${options.fillType0}` : ""};
747
+ }
748
+ .task-type-1, .section-type-1 {
749
+ ${options.fillType0 ? `fill: ${options.fillType1}` : ""};
750
+ }
751
+ .task-type-2, .section-type-2 {
752
+ ${options.fillType0 ? `fill: ${options.fillType2}` : ""};
753
+ }
754
+ .task-type-3, .section-type-3 {
755
+ ${options.fillType0 ? `fill: ${options.fillType3}` : ""};
756
+ }
757
+ .task-type-4, .section-type-4 {
758
+ ${options.fillType0 ? `fill: ${options.fillType4}` : ""};
759
+ }
760
+ .task-type-5, .section-type-5 {
761
+ ${options.fillType0 ? `fill: ${options.fillType5}` : ""};
762
+ }
763
+ .task-type-6, .section-type-6 {
764
+ ${options.fillType0 ? `fill: ${options.fillType6}` : ""};
765
+ }
766
+ .task-type-7, .section-type-7 {
767
+ ${options.fillType0 ? `fill: ${options.fillType7}` : ""};
768
+ }
769
+
770
+ .actor-0 {
771
+ ${options.actor0 ? `fill: ${options.actor0}` : ""};
772
+ }
773
+ .actor-1 {
774
+ ${options.actor1 ? `fill: ${options.actor1}` : ""};
775
+ }
776
+ .actor-2 {
777
+ ${options.actor2 ? `fill: ${options.actor2}` : ""};
778
+ }
779
+ .actor-3 {
780
+ ${options.actor3 ? `fill: ${options.actor3}` : ""};
781
+ }
782
+ .actor-4 {
783
+ ${options.actor4 ? `fill: ${options.actor4}` : ""};
784
+ }
785
+ .actor-5 {
786
+ ${options.actor5 ? `fill: ${options.actor5}` : ""};
787
+ }
788
+ ${chunkFMBD7UC4.getIconStyles()}
789
+ `, "getStyles");
790
+ var styles_default = getStyles;
791
+ var drawRect2 = /* @__PURE__ */ index.__name(function(elem, rectData) {
792
+ return chunkTZMSLE5B.drawRect(elem, rectData);
793
+ }, "drawRect");
794
+ var drawFace = /* @__PURE__ */ index.__name(function(element, faceData) {
795
+ const radius = 15;
796
+ const circleElement = element.append("circle").attr("cx", faceData.cx).attr("cy", faceData.cy).attr("class", "face").attr("r", radius).attr("stroke-width", 2).attr("overflow", "visible");
797
+ const face = element.append("g");
798
+ face.append("circle").attr("cx", faceData.cx - radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
799
+ face.append("circle").attr("cx", faceData.cx + radius / 3).attr("cy", faceData.cy - radius / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
800
+ function smile(face2) {
801
+ const arc$1 = arc.d3arc().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
802
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 2) + ")");
803
+ }
804
+ index.__name(smile, "smile");
805
+ function sad(face2) {
806
+ const arc$1 = arc.d3arc().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2);
807
+ face2.append("path").attr("class", "mouth").attr("d", arc$1).attr("transform", "translate(" + faceData.cx + "," + (faceData.cy + 7) + ")");
808
+ }
809
+ index.__name(sad, "sad");
810
+ function ambivalent(face2) {
811
+ face2.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", faceData.cx - 5).attr("y1", faceData.cy + 7).attr("x2", faceData.cx + 5).attr("y2", faceData.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
812
+ }
813
+ index.__name(ambivalent, "ambivalent");
814
+ if (faceData.score > 3) {
815
+ smile(face);
816
+ } else if (faceData.score < 3) {
817
+ sad(face);
818
+ } else {
819
+ ambivalent(face);
820
+ }
821
+ return circleElement;
822
+ }, "drawFace");
823
+ var drawCircle = /* @__PURE__ */ index.__name(function(element, circleData) {
824
+ const circleElement = element.append("circle");
825
+ circleElement.attr("cx", circleData.cx);
826
+ circleElement.attr("cy", circleData.cy);
827
+ circleElement.attr("class", "actor-" + circleData.pos);
828
+ circleElement.attr("fill", circleData.fill);
829
+ circleElement.attr("stroke", circleData.stroke);
830
+ circleElement.attr("r", circleData.r);
831
+ if (circleElement.class !== void 0) {
832
+ circleElement.attr("class", circleElement.class);
833
+ }
834
+ if (circleData.title !== void 0) {
835
+ circleElement.append("title").text(circleData.title);
836
+ }
837
+ return circleElement;
838
+ }, "drawCircle");
839
+ var drawText2 = /* @__PURE__ */ index.__name(function(elem, textData) {
840
+ return chunkTZMSLE5B.drawText(elem, textData);
841
+ }, "drawText");
842
+ var drawLabel = /* @__PURE__ */ index.__name(function(elem, txtObject) {
843
+ function genPoints(x, y, width, height, cut) {
844
+ return x + "," + y + " " + (x + width) + "," + y + " " + (x + width) + "," + (y + height - cut) + " " + (x + width - cut * 1.2) + "," + (y + height) + " " + x + "," + (y + height);
845
+ }
846
+ index.__name(genPoints, "genPoints");
847
+ const polygon = elem.append("polygon");
848
+ polygon.attr("points", genPoints(txtObject.x, txtObject.y, 50, 20, 7));
849
+ polygon.attr("class", "labelBox");
850
+ txtObject.y = txtObject.y + txtObject.labelMargin;
851
+ txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
852
+ drawText2(elem, txtObject);
853
+ }, "drawLabel");
854
+ var drawSection = /* @__PURE__ */ index.__name(function(elem, section, conf2) {
855
+ const g = elem.append("g");
856
+ const rect = chunkTZMSLE5B.getNoteRect();
857
+ rect.x = section.x;
858
+ rect.y = section.y;
859
+ rect.fill = section.fill;
860
+ rect.width = conf2.width * section.taskCount + // width of the tasks
861
+ conf2.diagramMarginX * (section.taskCount - 1);
862
+ rect.height = conf2.height;
863
+ rect.class = "journey-section section-type-" + section.num;
864
+ rect.rx = 3;
865
+ rect.ry = 3;
866
+ drawRect2(g, rect);
867
+ _drawTextCandidateFunc(conf2)(
868
+ section.text,
869
+ g,
870
+ rect.x,
871
+ rect.y,
872
+ rect.width,
873
+ rect.height,
874
+ { class: "journey-section section-type-" + section.num },
875
+ conf2,
876
+ section.colour
877
+ );
878
+ }, "drawSection");
879
+ var taskCount = -1;
880
+ var drawTask = /* @__PURE__ */ index.__name(function(elem, task, conf2) {
881
+ const center = task.x + conf2.width / 2;
882
+ const g = elem.append("g");
883
+ taskCount++;
884
+ const maxHeight = 300 + 5 * 30;
885
+ g.append("line").attr("id", "task" + taskCount).attr("x1", center).attr("y1", task.y).attr("x2", center).attr("y2", maxHeight).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666");
886
+ drawFace(g, {
887
+ cx: center,
888
+ cy: 300 + (5 - task.score) * 30,
889
+ score: task.score
890
+ });
891
+ const rect = chunkTZMSLE5B.getNoteRect();
892
+ rect.x = task.x;
893
+ rect.y = task.y;
894
+ rect.fill = task.fill;
895
+ rect.width = conf2.width;
896
+ rect.height = conf2.height;
897
+ rect.class = "task task-type-" + task.num;
898
+ rect.rx = 3;
899
+ rect.ry = 3;
900
+ drawRect2(g, rect);
901
+ let xPos = task.x + 14;
902
+ task.people.forEach((person) => {
903
+ const colour = task.actors[person].color;
904
+ const circle = {
905
+ cx: xPos,
906
+ cy: task.y,
907
+ r: 7,
908
+ fill: colour,
909
+ stroke: "#000",
910
+ title: person,
911
+ pos: task.actors[person].position
912
+ };
913
+ drawCircle(g, circle);
914
+ xPos += 10;
915
+ });
916
+ _drawTextCandidateFunc(conf2)(
917
+ task.task,
918
+ g,
919
+ rect.x,
920
+ rect.y,
921
+ rect.width,
922
+ rect.height,
923
+ { class: "task" },
924
+ conf2,
925
+ task.colour
926
+ );
927
+ }, "drawTask");
928
+ var drawBackgroundRect2 = /* @__PURE__ */ index.__name(function(elem, bounds2) {
929
+ chunkTZMSLE5B.drawBackgroundRect(elem, bounds2);
930
+ }, "drawBackgroundRect");
931
+ var _drawTextCandidateFunc = /* @__PURE__ */ (function() {
932
+ function byText(content, g, x, y, width, height, textAttrs, colour) {
933
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y + height / 2 + 5).style("font-color", colour).style("text-anchor", "middle").text(content);
934
+ _setTextAttrs(text, textAttrs);
935
+ }
936
+ index.__name(byText, "byText");
937
+ function byTspan(content, g, x, y, width, height, textAttrs, conf2, colour) {
938
+ const { taskFontSize, taskFontFamily } = conf2;
939
+ const lines = content.split(/<br\s*\/?>/gi);
940
+ for (let i = 0; i < lines.length; i++) {
941
+ const dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
942
+ const text = g.append("text").attr("x", x + width / 2).attr("y", y).attr("fill", colour).style("text-anchor", "middle").style("font-size", taskFontSize).style("font-family", taskFontFamily);
943
+ text.append("tspan").attr("x", x + width / 2).attr("dy", dy).text(lines[i]);
944
+ text.attr("y", y + height / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central");
945
+ _setTextAttrs(text, textAttrs);
946
+ }
947
+ }
948
+ index.__name(byTspan, "byTspan");
949
+ function byFo(content, g, x, y, width, height, textAttrs, conf2) {
950
+ const body = g.append("switch");
951
+ const f = body.append("foreignObject").attr("x", x).attr("y", y).attr("width", width).attr("height", height).attr("position", "fixed");
952
+ const text = f.append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
953
+ text.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(content);
954
+ byTspan(content, body, x, y, width, height, textAttrs, conf2);
955
+ _setTextAttrs(text, textAttrs);
956
+ }
957
+ index.__name(byFo, "byFo");
958
+ function _setTextAttrs(toText, fromTextAttrsDict) {
959
+ for (const key in fromTextAttrsDict) {
960
+ if (key in fromTextAttrsDict) {
961
+ toText.attr(key, fromTextAttrsDict[key]);
962
+ }
963
+ }
964
+ }
965
+ index.__name(_setTextAttrs, "_setTextAttrs");
966
+ return function(conf2) {
967
+ return conf2.textPlacement === "fo" ? byFo : conf2.textPlacement === "old" ? byText : byTspan;
968
+ };
969
+ })();
970
+ var initGraphics = /* @__PURE__ */ index.__name(function(graphics) {
971
+ graphics.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
972
+ }, "initGraphics");
973
+ var svgDraw_default = {
974
+ drawRect: drawRect2,
975
+ drawCircle,
976
+ drawSection,
977
+ drawText: drawText2,
978
+ drawLabel,
979
+ drawTask,
980
+ drawBackgroundRect: drawBackgroundRect2,
981
+ initGraphics
982
+ };
983
+ var setConf = /* @__PURE__ */ index.__name(function(cnf) {
984
+ const keys = Object.keys(cnf);
985
+ keys.forEach(function(key) {
986
+ conf[key] = cnf[key];
987
+ });
988
+ }, "setConf");
989
+ var actors = {};
990
+ var maxWidth = 0;
991
+ function drawActorLegend(diagram2) {
992
+ const conf2 = index.getConfig2().journey;
993
+ const maxLabelWidth = conf2.maxLabelWidth;
994
+ maxWidth = 0;
995
+ let yPos = 60;
996
+ Object.keys(actors).forEach((person) => {
997
+ const colour = actors[person].color;
998
+ const circleData = {
999
+ cx: 20,
1000
+ cy: yPos,
1001
+ r: 7,
1002
+ fill: colour,
1003
+ stroke: "#000",
1004
+ pos: actors[person].position
1005
+ };
1006
+ svgDraw_default.drawCircle(diagram2, circleData);
1007
+ let measureText = diagram2.append("text").attr("visibility", "hidden").text(person);
1008
+ const fullTextWidth = measureText.node().getBoundingClientRect().width;
1009
+ measureText.remove();
1010
+ let lines = [];
1011
+ if (fullTextWidth <= maxLabelWidth) {
1012
+ lines = [person];
1013
+ } else {
1014
+ const words = person.split(" ");
1015
+ let currentLine = "";
1016
+ measureText = diagram2.append("text").attr("visibility", "hidden");
1017
+ words.forEach((word) => {
1018
+ const testLine = currentLine ? `${currentLine} ${word}` : word;
1019
+ measureText.text(testLine);
1020
+ const textWidth = measureText.node().getBoundingClientRect().width;
1021
+ if (textWidth > maxLabelWidth) {
1022
+ if (currentLine) {
1023
+ lines.push(currentLine);
1024
+ }
1025
+ currentLine = word;
1026
+ measureText.text(word);
1027
+ if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
1028
+ let brokenWord = "";
1029
+ for (const char of word) {
1030
+ brokenWord += char;
1031
+ measureText.text(brokenWord + "-");
1032
+ if (measureText.node().getBoundingClientRect().width > maxLabelWidth) {
1033
+ lines.push(brokenWord.slice(0, -1) + "-");
1034
+ brokenWord = char;
1035
+ }
1036
+ }
1037
+ currentLine = brokenWord;
1038
+ }
1039
+ } else {
1040
+ currentLine = testLine;
1041
+ }
1042
+ });
1043
+ if (currentLine) {
1044
+ lines.push(currentLine);
1045
+ }
1046
+ measureText.remove();
1047
+ }
1048
+ lines.forEach((line, index2) => {
1049
+ const labelData = {
1050
+ x: 40,
1051
+ y: yPos + 7 + index2 * 20,
1052
+ fill: "#666",
1053
+ text: line,
1054
+ textMargin: conf2.boxTextMargin ?? 5
1055
+ };
1056
+ const textElement = svgDraw_default.drawText(diagram2, labelData);
1057
+ const lineWidth = textElement.node().getBoundingClientRect().width;
1058
+ if (lineWidth > maxWidth && lineWidth > conf2.leftMargin - lineWidth) {
1059
+ maxWidth = lineWidth;
1060
+ }
1061
+ });
1062
+ yPos += Math.max(20, lines.length * 20);
1063
+ });
1064
+ }
1065
+ index.__name(drawActorLegend, "drawActorLegend");
1066
+ var conf = index.getConfig2().journey;
1067
+ var leftMargin = 0;
1068
+ var draw = /* @__PURE__ */ index.__name(function(text, id, version, diagObj) {
1069
+ const configObject = index.getConfig2();
1070
+ const titleColor = configObject.journey.titleColor;
1071
+ const titleFontSize = configObject.journey.titleFontSize;
1072
+ const titleFontFamily = configObject.journey.titleFontFamily;
1073
+ const securityLevel = configObject.securityLevel;
1074
+ let sandboxElement;
1075
+ if (securityLevel === "sandbox") {
1076
+ sandboxElement = index.select("#i" + id);
1077
+ }
1078
+ const root = securityLevel === "sandbox" ? index.select(sandboxElement.nodes()[0].contentDocument.body) : index.select("body");
1079
+ bounds.init();
1080
+ const diagram2 = root.select("#" + id);
1081
+ svgDraw_default.initGraphics(diagram2);
1082
+ const tasks2 = diagObj.db.getTasks();
1083
+ const title = diagObj.db.getDiagramTitle();
1084
+ const actorNames = diagObj.db.getActors();
1085
+ for (const member in actors) {
1086
+ delete actors[member];
1087
+ }
1088
+ let actorPos = 0;
1089
+ actorNames.forEach((actorName) => {
1090
+ actors[actorName] = {
1091
+ color: conf.actorColours[actorPos % conf.actorColours.length],
1092
+ position: actorPos
1093
+ };
1094
+ actorPos++;
1095
+ });
1096
+ drawActorLegend(diagram2);
1097
+ leftMargin = conf.leftMargin + maxWidth;
1098
+ bounds.insert(0, 0, leftMargin, Object.keys(actors).length * 50);
1099
+ drawTasks(diagram2, tasks2, 0);
1100
+ const box = bounds.getBounds();
1101
+ if (title) {
1102
+ diagram2.append("text").text(title).attr("x", leftMargin).attr("font-size", titleFontSize).attr("font-weight", "bold").attr("y", 25).attr("fill", titleColor).attr("font-family", titleFontFamily);
1103
+ }
1104
+ const height = box.stopy - box.starty + 2 * conf.diagramMarginY;
1105
+ const width = leftMargin + box.stopx + 2 * conf.diagramMarginX;
1106
+ index.configureSvgSize(diagram2, height, width, conf.useMaxWidth);
1107
+ diagram2.append("line").attr("x1", leftMargin).attr("y1", conf.height * 4).attr("x2", width - leftMargin - 4).attr("y2", conf.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
1108
+ const extraVertForTitle = title ? 70 : 0;
1109
+ diagram2.attr("viewBox", `${box.startx} -25 ${width} ${height + extraVertForTitle}`);
1110
+ diagram2.attr("preserveAspectRatio", "xMinYMin meet");
1111
+ diagram2.attr("height", height + extraVertForTitle + 25);
1112
+ }, "draw");
1113
+ var bounds = {
1114
+ data: {
1115
+ startx: void 0,
1116
+ stopx: void 0,
1117
+ starty: void 0,
1118
+ stopy: void 0
1119
+ },
1120
+ verticalPos: 0,
1121
+ sequenceItems: [],
1122
+ init: /* @__PURE__ */ index.__name(function() {
1123
+ this.sequenceItems = [];
1124
+ this.data = {
1125
+ startx: void 0,
1126
+ stopx: void 0,
1127
+ starty: void 0,
1128
+ stopy: void 0
1129
+ };
1130
+ this.verticalPos = 0;
1131
+ }, "init"),
1132
+ updateVal: /* @__PURE__ */ index.__name(function(obj, key, val, fun) {
1133
+ if (obj[key] === void 0) {
1134
+ obj[key] = val;
1135
+ } else {
1136
+ obj[key] = fun(val, obj[key]);
1137
+ }
1138
+ }, "updateVal"),
1139
+ updateBounds: /* @__PURE__ */ index.__name(function(startx, starty, stopx, stopy) {
1140
+ const conf2 = index.getConfig2().journey;
1141
+ const _self = this;
1142
+ let cnt = 0;
1143
+ function updateFn(type) {
1144
+ return /* @__PURE__ */ index.__name(function updateItemBounds(item) {
1145
+ cnt++;
1146
+ const n = _self.sequenceItems.length - cnt + 1;
1147
+ _self.updateVal(item, "starty", starty - n * conf2.boxMargin, Math.min);
1148
+ _self.updateVal(item, "stopy", stopy + n * conf2.boxMargin, Math.max);
1149
+ _self.updateVal(bounds.data, "startx", startx - n * conf2.boxMargin, Math.min);
1150
+ _self.updateVal(bounds.data, "stopx", stopx + n * conf2.boxMargin, Math.max);
1151
+ if (!(type === "activation")) {
1152
+ _self.updateVal(item, "startx", startx - n * conf2.boxMargin, Math.min);
1153
+ _self.updateVal(item, "stopx", stopx + n * conf2.boxMargin, Math.max);
1154
+ _self.updateVal(bounds.data, "starty", starty - n * conf2.boxMargin, Math.min);
1155
+ _self.updateVal(bounds.data, "stopy", stopy + n * conf2.boxMargin, Math.max);
1156
+ }
1157
+ }, "updateItemBounds");
1158
+ }
1159
+ index.__name(updateFn, "updateFn");
1160
+ this.sequenceItems.forEach(updateFn());
1161
+ }, "updateBounds"),
1162
+ insert: /* @__PURE__ */ index.__name(function(startx, starty, stopx, stopy) {
1163
+ const _startx = Math.min(startx, stopx);
1164
+ const _stopx = Math.max(startx, stopx);
1165
+ const _starty = Math.min(starty, stopy);
1166
+ const _stopy = Math.max(starty, stopy);
1167
+ this.updateVal(bounds.data, "startx", _startx, Math.min);
1168
+ this.updateVal(bounds.data, "starty", _starty, Math.min);
1169
+ this.updateVal(bounds.data, "stopx", _stopx, Math.max);
1170
+ this.updateVal(bounds.data, "stopy", _stopy, Math.max);
1171
+ this.updateBounds(_startx, _starty, _stopx, _stopy);
1172
+ }, "insert"),
1173
+ bumpVerticalPos: /* @__PURE__ */ index.__name(function(bump) {
1174
+ this.verticalPos = this.verticalPos + bump;
1175
+ this.data.stopy = this.verticalPos;
1176
+ }, "bumpVerticalPos"),
1177
+ getVerticalPos: /* @__PURE__ */ index.__name(function() {
1178
+ return this.verticalPos;
1179
+ }, "getVerticalPos"),
1180
+ getBounds: /* @__PURE__ */ index.__name(function() {
1181
+ return this.data;
1182
+ }, "getBounds")
1183
+ };
1184
+ var fills = conf.sectionFills;
1185
+ var textColours = conf.sectionColours;
1186
+ var drawTasks = /* @__PURE__ */ index.__name(function(diagram2, tasks2, verticalPos) {
1187
+ const conf2 = index.getConfig2().journey;
1188
+ let lastSection = "";
1189
+ const sectionVHeight = conf2.height * 2 + conf2.diagramMarginY;
1190
+ const taskPos = verticalPos + sectionVHeight;
1191
+ let sectionNumber = 0;
1192
+ let fill = "#CCC";
1193
+ let colour = "black";
1194
+ let num = 0;
1195
+ for (const [i, task] of tasks2.entries()) {
1196
+ if (lastSection !== task.section) {
1197
+ fill = fills[sectionNumber % fills.length];
1198
+ num = sectionNumber % fills.length;
1199
+ colour = textColours[sectionNumber % textColours.length];
1200
+ let taskInSectionCount = 0;
1201
+ const currentSection2 = task.section;
1202
+ for (let taskIndex = i; taskIndex < tasks2.length; taskIndex++) {
1203
+ if (tasks2[taskIndex].section == currentSection2) {
1204
+ taskInSectionCount = taskInSectionCount + 1;
1205
+ } else {
1206
+ break;
1207
+ }
1208
+ }
1209
+ const section = {
1210
+ x: i * conf2.taskMargin + i * conf2.width + leftMargin,
1211
+ y: 50,
1212
+ text: task.section,
1213
+ fill,
1214
+ num,
1215
+ colour,
1216
+ taskCount: taskInSectionCount
1217
+ };
1218
+ svgDraw_default.drawSection(diagram2, section, conf2);
1219
+ lastSection = task.section;
1220
+ sectionNumber++;
1221
+ }
1222
+ const taskActors = task.people.reduce((acc, actorName) => {
1223
+ if (actors[actorName]) {
1224
+ acc[actorName] = actors[actorName];
1225
+ }
1226
+ return acc;
1227
+ }, {});
1228
+ task.x = i * conf2.taskMargin + i * conf2.width + leftMargin;
1229
+ task.y = taskPos;
1230
+ task.width = conf2.diagramMarginX;
1231
+ task.height = conf2.diagramMarginY;
1232
+ task.colour = colour;
1233
+ task.fill = fill;
1234
+ task.num = num;
1235
+ task.actors = taskActors;
1236
+ svgDraw_default.drawTask(diagram2, task, conf2);
1237
+ bounds.insert(task.x, task.y, task.x + task.width + conf2.taskMargin, 300 + 5 * 30);
1238
+ }
1239
+ }, "drawTasks");
1240
+ var journeyRenderer_default = {
1241
+ setConf,
1242
+ draw
1243
+ };
1244
+ var diagram = {
1245
+ parser: journey_default,
1246
+ db: journeyDb_default,
1247
+ renderer: journeyRenderer_default,
1248
+ styles: styles_default,
1249
+ init: /* @__PURE__ */ index.__name((cnf) => {
1250
+ journeyRenderer_default.setConf(cnf.journey);
1251
+ journeyDb_default.clear();
1252
+ }, "init")
1253
+ };
1254
+ exports.diagram = diagram;