UNPKG

1.19 MBJavaScriptView Raw
1(function webpackUniversalModuleDefinition(root, factory) {
2 if(typeof exports === 'object' && typeof module === 'object')
3 module.exports = factory();
4 else if(typeof define === 'function' && define.amd)
5 define([], factory);
6 else if(typeof exports === 'object')
7 exports["mermaid"] = factory();
8 else
9 root["mermaid"] = factory();
10})(typeof self !== "undefined" ? self : this, function() {
11return /******/ (() => { // webpackBootstrap
12/******/ var __webpack_modules__ = ({
13
14/***/ "./src/diagrams/class/parser/classDiagram.jison":
15/*!******************************************************!*\
16 !*** ./src/diagrams/class/parser/classDiagram.jison ***!
17 \******************************************************/
18/***/ ((module, exports, __webpack_require__) => {
19
20/* module decorator */ module = __webpack_require__.nmd(module);
21/* parser generated by jison 0.4.18 */
22/*
23 Returns a Parser object of the following structure:
24
25 Parser: {
26 yy: {}
27 }
28
29 Parser.prototype: {
30 yy: {},
31 trace: function(),
32 symbols_: {associative list: name ==> number},
33 terminals_: {associative list: number ==> name},
34 productions_: [...],
35 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
36 table: [...],
37 defaultActions: {...},
38 parseError: function(str, hash),
39 parse: function(input),
40
41 lexer: {
42 EOF: 1,
43 parseError: function(str, hash),
44 setInput: function(input),
45 input: function(),
46 unput: function(str),
47 more: function(),
48 less: function(n),
49 pastInput: function(),
50 upcomingInput: function(),
51 showPosition: function(),
52 test_match: function(regex_match_array, rule_index),
53 next: function(),
54 lex: function(),
55 begin: function(condition),
56 popState: function(),
57 _currentRules: function(),
58 topState: function(),
59 pushState: function(condition),
60
61 options: {
62 ranges: boolean (optional: true ==> token location info will include a .range[] member)
63 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
64 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
65 },
66
67 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
68 rules: [...],
69 conditions: {associative list: name ==> set},
70 }
71 }
72
73
74 token location info (@$, _$, etc.): {
75 first_line: n,
76 last_line: n,
77 first_column: n,
78 last_column: n,
79 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
80 }
81
82
83 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
84 text: (matched text)
85 token: (the produced terminal token, if any)
86 line: (yylineno)
87 }
88 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
89 loc: (yylloc)
90 expected: (string describing the set of expected tokens)
91 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
92 }
93*/
94var parser = (function(){
95var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,6],$V1=[1,7],$V2=[1,8],$V3=[1,9],$V4=[1,12],$V5=[1,11],$V6=[1,15,24],$V7=[1,19],$V8=[1,31],$V9=[1,34],$Va=[1,32],$Vb=[1,33],$Vc=[1,35],$Vd=[1,36],$Ve=[1,37],$Vf=[1,38],$Vg=[1,41],$Vh=[1,42],$Vi=[1,43],$Vj=[1,44],$Vk=[15,24],$Vl=[1,56],$Vm=[1,57],$Vn=[1,58],$Vo=[1,59],$Vp=[1,60],$Vq=[1,61],$Vr=[15,24,31,38,39,47,50,51,52,53,54,55,60,62],$Vs=[15,24,29,31,38,39,43,47,50,51,52,53,54,55,60,62,77,78,79,80],$Vt=[7,8,9,10,15,18,22,24],$Vu=[47,77,78,79,80],$Vv=[47,54,55,77,78,79,80],$Vw=[47,50,51,52,53,77,78,79,80],$Vx=[15,24,31],$Vy=[1,93];
96var parser = {trace: function trace () { },
97yy: {},
98symbols_: {"error":2,"start":3,"mermaidDoc":4,"direction":5,"directive":6,"direction_tb":7,"direction_bt":8,"direction_rl":9,"direction_lr":10,"graphConfig":11,"openDirective":12,"typeDirective":13,"closeDirective":14,"NEWLINE":15,":":16,"argDirective":17,"open_directive":18,"type_directive":19,"arg_directive":20,"close_directive":21,"CLASS_DIAGRAM":22,"statements":23,"EOF":24,"statement":25,"className":26,"alphaNumToken":27,"classLiteralName":28,"GENERICTYPE":29,"relationStatement":30,"LABEL":31,"classStatement":32,"methodStatement":33,"annotationStatement":34,"clickStatement":35,"cssClassStatement":36,"CLASS":37,"STYLE_SEPARATOR":38,"STRUCT_START":39,"members":40,"STRUCT_STOP":41,"ANNOTATION_START":42,"ANNOTATION_END":43,"MEMBER":44,"SEPARATOR":45,"relation":46,"STR":47,"relationType":48,"lineType":49,"AGGREGATION":50,"EXTENSION":51,"COMPOSITION":52,"DEPENDENCY":53,"LINE":54,"DOTTED_LINE":55,"CALLBACK":56,"LINK":57,"LINK_TARGET":58,"CLICK":59,"CALLBACK_NAME":60,"CALLBACK_ARGS":61,"HREF":62,"CSSCLASS":63,"commentToken":64,"textToken":65,"graphCodeTokens":66,"textNoTagsToken":67,"TAGSTART":68,"TAGEND":69,"==":70,"--":71,"PCT":72,"DEFAULT":73,"SPACE":74,"MINUS":75,"keywords":76,"UNICODE_TEXT":77,"NUM":78,"ALPHA":79,"BQUOTE_STR":80,"$accept":0,"$end":1},
99terminals_: {2:"error",7:"direction_tb",8:"direction_bt",9:"direction_rl",10:"direction_lr",15:"NEWLINE",16:":",18:"open_directive",19:"type_directive",20:"arg_directive",21:"close_directive",22:"CLASS_DIAGRAM",24:"EOF",29:"GENERICTYPE",31:"LABEL",37:"CLASS",38:"STYLE_SEPARATOR",39:"STRUCT_START",41:"STRUCT_STOP",42:"ANNOTATION_START",43:"ANNOTATION_END",44:"MEMBER",45:"SEPARATOR",47:"STR",50:"AGGREGATION",51:"EXTENSION",52:"COMPOSITION",53:"DEPENDENCY",54:"LINE",55:"DOTTED_LINE",56:"CALLBACK",57:"LINK",58:"LINK_TARGET",59:"CLICK",60:"CALLBACK_NAME",61:"CALLBACK_ARGS",62:"HREF",63:"CSSCLASS",66:"graphCodeTokens",68:"TAGSTART",69:"TAGEND",70:"==",71:"--",72:"PCT",73:"DEFAULT",74:"SPACE",75:"MINUS",76:"keywords",77:"UNICODE_TEXT",78:"NUM",79:"ALPHA",80:"BQUOTE_STR"},
100productions_: [0,[3,1],[3,1],[3,2],[5,1],[5,1],[5,1],[5,1],[4,1],[6,4],[6,6],[12,1],[13,1],[17,1],[14,1],[11,4],[23,1],[23,2],[23,3],[26,1],[26,1],[26,2],[26,2],[26,2],[25,1],[25,2],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[32,2],[32,4],[32,5],[32,7],[34,4],[40,1],[40,2],[33,1],[33,2],[33,1],[33,1],[30,3],[30,4],[30,4],[30,5],[46,3],[46,2],[46,2],[46,1],[48,1],[48,1],[48,1],[48,1],[49,1],[49,1],[35,3],[35,4],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[35,3],[35,4],[35,4],[35,5],[36,3],[64,1],[64,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[65,1],[67,1],[67,1],[67,1],[67,1],[27,1],[27,1],[27,1],[28,1]],
101performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
102/* this == yyval */
103
104var $0 = $$.length - 1;
105switch (yystate) {
106case 4:
107 yy.setDirection('TB');
108break;
109case 5:
110 yy.setDirection('BT');
111break;
112case 6:
113 yy.setDirection('RL');
114break;
115case 7:
116 yy.setDirection('LR');
117break;
118case 11:
119 yy.parseDirective('%%{', 'open_directive');
120break;
121case 12:
122 yy.parseDirective($$[$0], 'type_directive');
123break;
124case 13:
125 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
126break;
127case 14:
128 yy.parseDirective('}%%', 'close_directive', 'class');
129break;
130case 19: case 20:
131 this.$=$$[$0];
132break;
133case 21:
134 this.$=$$[$0-1]+$$[$0];
135break;
136case 22: case 23:
137 this.$=$$[$0-1]+'~'+$$[$0];
138break;
139case 24:
140 yy.addRelation($$[$0]);
141break;
142case 25:
143 $$[$0-1].title = yy.cleanupLabel($$[$0]); yy.addRelation($$[$0-1]);
144break;
145case 33:
146yy.addClass($$[$0]);
147break;
148case 34:
149yy.addClass($$[$0-2]);yy.setCssClass($$[$0-2], $$[$0]);
150break;
151case 35:
152/*console.log($$[$0-3],JSON.stringify($$[$0-1]));*/yy.addClass($$[$0-3]);yy.addMembers($$[$0-3],$$[$0-1]);
153break;
154case 36:
155yy.addClass($$[$0-5]);yy.setCssClass($$[$0-5], $$[$0-3]);yy.addMembers($$[$0-5],$$[$0-1]);
156break;
157case 37:
158 yy.addAnnotation($$[$0],$$[$0-2]);
159break;
160case 38:
161 this.$ = [$$[$0]];
162break;
163case 39:
164 $$[$0].push($$[$0-1]);this.$=$$[$0];
165break;
166case 40:
167/*console.log('Rel found',$$[$0]);*/
168break;
169case 41:
170yy.addMember($$[$0-1],yy.cleanupLabel($$[$0]));
171break;
172case 42:
173/*console.warn('Member',$$[$0]);*/
174break;
175case 43:
176/*console.log('sep found',$$[$0]);*/
177break;
178case 44:
179 this.$ = {'id1':$$[$0-2],'id2':$$[$0], relation:$$[$0-1], relationTitle1:'none', relationTitle2:'none'};
180break;
181case 45:
182 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-1], relationTitle1:$$[$0-2], relationTitle2:'none'}
183break;
184case 46:
185 this.$ = {id1:$$[$0-3], id2:$$[$0], relation:$$[$0-2], relationTitle1:'none', relationTitle2:$$[$0-1]};
186break;
187case 47:
188 this.$ = {id1:$$[$0-4], id2:$$[$0], relation:$$[$0-2], relationTitle1:$$[$0-3], relationTitle2:$$[$0-1]}
189break;
190case 48:
191 this.$={type1:$$[$0-2],type2:$$[$0],lineType:$$[$0-1]};
192break;
193case 49:
194 this.$={type1:'none',type2:$$[$0],lineType:$$[$0-1]};
195break;
196case 50:
197 this.$={type1:$$[$0-1],type2:'none',lineType:$$[$0]};
198break;
199case 51:
200 this.$={type1:'none',type2:'none',lineType:$$[$0]};
201break;
202case 52:
203 this.$=yy.relationType.AGGREGATION;
204break;
205case 53:
206 this.$=yy.relationType.EXTENSION;
207break;
208case 54:
209 this.$=yy.relationType.COMPOSITION;
210break;
211case 55:
212 this.$=yy.relationType.DEPENDENCY;
213break;
214case 56:
215this.$=yy.lineType.LINE;
216break;
217case 57:
218this.$=yy.lineType.DOTTED_LINE;
219break;
220case 58: case 64:
221this.$ = $$[$0-2];yy.setClickEvent($$[$0-1], $$[$0]);
222break;
223case 59: case 65:
224this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
225break;
226case 60: case 68:
227this.$ = $$[$0-2];yy.setLink($$[$0-1], $$[$0]);
228break;
229case 61:
230this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1],$$[$0]);
231break;
232case 62: case 70:
233this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-2], $$[$0]);
234break;
235case 63: case 71:
236this.$ = $$[$0-4];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);yy.setTooltip($$[$0-3], $$[$0-1]);
237break;
238case 66:
239this.$ = $$[$0-3];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
240break;
241case 67:
242this.$ = $$[$0-4];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setTooltip($$[$0-3], $$[$0]);
243break;
244case 69:
245this.$ = $$[$0-3];yy.setLink($$[$0-2], $$[$0-1], $$[$0]);
246break;
247case 72:
248yy.setCssClass($$[$0-1], $$[$0]);
249break;
250}
251},
252table: [{3:1,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5},{1:[3]},{1:[2,1]},{1:[2,2]},{3:13,4:2,5:3,6:4,7:$V0,8:$V1,9:$V2,10:$V3,11:5,12:10,18:$V4,22:$V5},{1:[2,8]},o($V6,[2,4]),o($V6,[2,5]),o($V6,[2,6]),o($V6,[2,7]),{13:14,19:[1,15]},{15:[1,16]},{19:[2,11]},{1:[2,3]},{14:17,16:[1,18],21:$V7},o([16,21],[2,12]),{5:29,6:28,7:$V0,8:$V1,9:$V2,10:$V3,12:10,18:$V4,23:20,25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:$V8,42:$V9,44:$Va,45:$Vb,56:$Vc,57:$Vd,59:$Ve,63:$Vf,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{15:[1,45]},{17:46,20:[1,47]},{15:[2,14]},{24:[1,48]},{15:[1,49],24:[2,16]},o($Vk,[2,24],{31:[1,50]}),o($Vk,[2,26]),o($Vk,[2,27]),o($Vk,[2,28]),o($Vk,[2,29]),o($Vk,[2,30]),o($Vk,[2,31]),o($Vk,[2,32]),o($Vk,[2,40],{46:51,48:54,49:55,31:[1,53],47:[1,52],50:$Vl,51:$Vm,52:$Vn,53:$Vo,54:$Vp,55:$Vq}),{26:62,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,42]),o($Vk,[2,43]),{27:63,77:$Vg,78:$Vh,79:$Vi},{26:64,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:65,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:66,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{47:[1,67]},o($Vr,[2,19],{27:39,28:40,26:68,29:[1,69],77:$Vg,78:$Vh,79:$Vi,80:$Vj}),o($Vr,[2,20],{29:[1,70]}),o($Vs,[2,86]),o($Vs,[2,87]),o($Vs,[2,88]),o([15,24,29,31,38,39,47,50,51,52,53,54,55,60,62],[2,89]),o($Vt,[2,9]),{14:71,21:$V7},{21:[2,13]},{1:[2,15]},{5:29,6:28,7:$V0,8:$V1,9:$V2,10:$V3,12:10,18:$V4,23:72,24:[2,17],25:21,26:30,27:39,28:40,30:22,32:23,33:24,34:25,35:26,36:27,37:$V8,42:$V9,44:$Va,45:$Vb,56:$Vc,57:$Vd,59:$Ve,63:$Vf,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,25]),{26:73,27:39,28:40,47:[1,74],77:$Vg,78:$Vh,79:$Vi,80:$Vj},{46:75,48:54,49:55,50:$Vl,51:$Vm,52:$Vn,53:$Vo,54:$Vp,55:$Vq},o($Vk,[2,41]),{49:76,54:$Vp,55:$Vq},o($Vu,[2,51],{48:77,50:$Vl,51:$Vm,52:$Vn,53:$Vo}),o($Vv,[2,52]),o($Vv,[2,53]),o($Vv,[2,54]),o($Vv,[2,55]),o($Vw,[2,56]),o($Vw,[2,57]),o($Vk,[2,33],{38:[1,78],39:[1,79]}),{43:[1,80]},{47:[1,81]},{47:[1,82]},{60:[1,83],62:[1,84]},{27:85,77:$Vg,78:$Vh,79:$Vi},o($Vr,[2,21]),o($Vr,[2,22]),o($Vr,[2,23]),{15:[1,86]},{24:[2,18]},o($Vx,[2,44]),{26:87,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},{26:88,27:39,28:40,47:[1,89],77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vu,[2,50],{48:90,50:$Vl,51:$Vm,52:$Vn,53:$Vo}),o($Vu,[2,49]),{27:91,77:$Vg,78:$Vh,79:$Vi},{40:92,44:$Vy},{26:94,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vk,[2,58],{47:[1,95]}),o($Vk,[2,60],{47:[1,97],58:[1,96]}),o($Vk,[2,64],{47:[1,98],61:[1,99]}),o($Vk,[2,68],{47:[1,101],58:[1,100]}),o($Vk,[2,72]),o($Vt,[2,10]),o($Vx,[2,46]),o($Vx,[2,45]),{26:102,27:39,28:40,77:$Vg,78:$Vh,79:$Vi,80:$Vj},o($Vu,[2,48]),o($Vk,[2,34],{39:[1,103]}),{41:[1,104]},{40:105,41:[2,38],44:$Vy},o($Vk,[2,37]),o($Vk,[2,59]),o($Vk,[2,61]),o($Vk,[2,62],{58:[1,106]}),o($Vk,[2,65]),o($Vk,[2,66],{47:[1,107]}),o($Vk,[2,69]),o($Vk,[2,70],{58:[1,108]}),o($Vx,[2,47]),{40:109,44:$Vy},o($Vk,[2,35]),{41:[2,39]},o($Vk,[2,63]),o($Vk,[2,67]),o($Vk,[2,71]),{41:[1,110]},o($Vk,[2,36])],
253defaultActions: {2:[2,1],3:[2,2],5:[2,8],12:[2,11],13:[2,3],19:[2,14],47:[2,13],48:[2,15],72:[2,18],105:[2,39]},
254parseError: function parseError (str, hash) {
255 if (hash.recoverable) {
256 this.trace(str);
257 } else {
258 var error = new Error(str);
259 error.hash = hash;
260 throw error;
261 }
262},
263parse: function parse(input) {
264 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
265 var args = lstack.slice.call(arguments, 1);
266 var lexer = Object.create(this.lexer);
267 var sharedState = { yy: {} };
268 for (var k in this.yy) {
269 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
270 sharedState.yy[k] = this.yy[k];
271 }
272 }
273 lexer.setInput(input, sharedState.yy);
274 sharedState.yy.lexer = lexer;
275 sharedState.yy.parser = this;
276 if (typeof lexer.yylloc == 'undefined') {
277 lexer.yylloc = {};
278 }
279 var yyloc = lexer.yylloc;
280 lstack.push(yyloc);
281 var ranges = lexer.options && lexer.options.ranges;
282 if (typeof sharedState.yy.parseError === 'function') {
283 this.parseError = sharedState.yy.parseError;
284 } else {
285 this.parseError = Object.getPrototypeOf(this).parseError;
286 }
287 function popStack(n) {
288 stack.length = stack.length - 2 * n;
289 vstack.length = vstack.length - n;
290 lstack.length = lstack.length - n;
291 }
292 function lex() {
293 var token;
294 token = tstack.pop() || lexer.lex() || EOF;
295 if (typeof token !== 'number') {
296 if (token instanceof Array) {
297 tstack = token;
298 token = tstack.pop();
299 }
300 token = self.symbols_[token] || token;
301 }
302 return token;
303 }
304 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
305 while (true) {
306 state = stack[stack.length - 1];
307 if (this.defaultActions[state]) {
308 action = this.defaultActions[state];
309 } else {
310 if (symbol === null || typeof symbol == 'undefined') {
311 symbol = lex();
312 }
313 action = table[state] && table[state][symbol];
314 }
315 if (typeof action === 'undefined' || !action.length || !action[0]) {
316 var errStr = '';
317 expected = [];
318 for (p in table[state]) {
319 if (this.terminals_[p] && p > TERROR) {
320 expected.push('\'' + this.terminals_[p] + '\'');
321 }
322 }
323 if (lexer.showPosition) {
324 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
325 } else {
326 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
327 }
328 this.parseError(errStr, {
329 text: lexer.match,
330 token: this.terminals_[symbol] || symbol,
331 line: lexer.yylineno,
332 loc: yyloc,
333 expected: expected
334 });
335 }
336 if (action[0] instanceof Array && action.length > 1) {
337 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
338 }
339 switch (action[0]) {
340 case 1:
341 stack.push(symbol);
342 vstack.push(lexer.yytext);
343 lstack.push(lexer.yylloc);
344 stack.push(action[1]);
345 symbol = null;
346 if (!preErrorSymbol) {
347 yyleng = lexer.yyleng;
348 yytext = lexer.yytext;
349 yylineno = lexer.yylineno;
350 yyloc = lexer.yylloc;
351 if (recovering > 0) {
352 recovering--;
353 }
354 } else {
355 symbol = preErrorSymbol;
356 preErrorSymbol = null;
357 }
358 break;
359 case 2:
360 len = this.productions_[action[1]][1];
361 yyval.$ = vstack[vstack.length - len];
362 yyval._$ = {
363 first_line: lstack[lstack.length - (len || 1)].first_line,
364 last_line: lstack[lstack.length - 1].last_line,
365 first_column: lstack[lstack.length - (len || 1)].first_column,
366 last_column: lstack[lstack.length - 1].last_column
367 };
368 if (ranges) {
369 yyval._$.range = [
370 lstack[lstack.length - (len || 1)].range[0],
371 lstack[lstack.length - 1].range[1]
372 ];
373 }
374 r = this.performAction.apply(yyval, [
375 yytext,
376 yyleng,
377 yylineno,
378 sharedState.yy,
379 action[1],
380 vstack,
381 lstack
382 ].concat(args));
383 if (typeof r !== 'undefined') {
384 return r;
385 }
386 if (len) {
387 stack = stack.slice(0, -1 * len * 2);
388 vstack = vstack.slice(0, -1 * len);
389 lstack = lstack.slice(0, -1 * len);
390 }
391 stack.push(this.productions_[action[1]][0]);
392 vstack.push(yyval.$);
393 lstack.push(yyval._$);
394 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
395 stack.push(newState);
396 break;
397 case 3:
398 return true;
399 }
400 }
401 return true;
402}};
403
404/* generated by jison-lex 0.3.4 */
405var lexer = (function(){
406var lexer = ({
407
408EOF:1,
409
410parseError:function parseError(str, hash) {
411 if (this.yy.parser) {
412 this.yy.parser.parseError(str, hash);
413 } else {
414 throw new Error(str);
415 }
416 },
417
418// resets the lexer, sets new input
419setInput:function (input, yy) {
420 this.yy = yy || this.yy || {};
421 this._input = input;
422 this._more = this._backtrack = this.done = false;
423 this.yylineno = this.yyleng = 0;
424 this.yytext = this.matched = this.match = '';
425 this.conditionStack = ['INITIAL'];
426 this.yylloc = {
427 first_line: 1,
428 first_column: 0,
429 last_line: 1,
430 last_column: 0
431 };
432 if (this.options.ranges) {
433 this.yylloc.range = [0,0];
434 }
435 this.offset = 0;
436 return this;
437 },
438
439// consumes and returns one char from the input
440input:function () {
441 var ch = this._input[0];
442 this.yytext += ch;
443 this.yyleng++;
444 this.offset++;
445 this.match += ch;
446 this.matched += ch;
447 var lines = ch.match(/(?:\r\n?|\n).*/g);
448 if (lines) {
449 this.yylineno++;
450 this.yylloc.last_line++;
451 } else {
452 this.yylloc.last_column++;
453 }
454 if (this.options.ranges) {
455 this.yylloc.range[1]++;
456 }
457
458 this._input = this._input.slice(1);
459 return ch;
460 },
461
462// unshifts one char (or a string) into the input
463unput:function (ch) {
464 var len = ch.length;
465 var lines = ch.split(/(?:\r\n?|\n)/g);
466
467 this._input = ch + this._input;
468 this.yytext = this.yytext.substr(0, this.yytext.length - len);
469 //this.yyleng -= len;
470 this.offset -= len;
471 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
472 this.match = this.match.substr(0, this.match.length - 1);
473 this.matched = this.matched.substr(0, this.matched.length - 1);
474
475 if (lines.length - 1) {
476 this.yylineno -= lines.length - 1;
477 }
478 var r = this.yylloc.range;
479
480 this.yylloc = {
481 first_line: this.yylloc.first_line,
482 last_line: this.yylineno + 1,
483 first_column: this.yylloc.first_column,
484 last_column: lines ?
485 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
486 + oldLines[oldLines.length - lines.length].length - lines[0].length :
487 this.yylloc.first_column - len
488 };
489
490 if (this.options.ranges) {
491 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
492 }
493 this.yyleng = this.yytext.length;
494 return this;
495 },
496
497// When called from action, caches matched text and appends it on next action
498more:function () {
499 this._more = true;
500 return this;
501 },
502
503// 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.
504reject:function () {
505 if (this.options.backtrack_lexer) {
506 this._backtrack = true;
507 } else {
508 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(), {
509 text: "",
510 token: null,
511 line: this.yylineno
512 });
513
514 }
515 return this;
516 },
517
518// retain first n characters of the match
519less:function (n) {
520 this.unput(this.match.slice(n));
521 },
522
523// displays already matched input, i.e. for error messages
524pastInput:function () {
525 var past = this.matched.substr(0, this.matched.length - this.match.length);
526 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
527 },
528
529// displays upcoming input, i.e. for error messages
530upcomingInput:function () {
531 var next = this.match;
532 if (next.length < 20) {
533 next += this._input.substr(0, 20-next.length);
534 }
535 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
536 },
537
538// displays the character position where the lexing error occurred, i.e. for error messages
539showPosition:function () {
540 var pre = this.pastInput();
541 var c = new Array(pre.length + 1).join("-");
542 return pre + this.upcomingInput() + "\n" + c + "^";
543 },
544
545// test the lexed token: return FALSE when not a match, otherwise return token
546test_match:function(match, indexed_rule) {
547 var token,
548 lines,
549 backup;
550
551 if (this.options.backtrack_lexer) {
552 // save context
553 backup = {
554 yylineno: this.yylineno,
555 yylloc: {
556 first_line: this.yylloc.first_line,
557 last_line: this.last_line,
558 first_column: this.yylloc.first_column,
559 last_column: this.yylloc.last_column
560 },
561 yytext: this.yytext,
562 match: this.match,
563 matches: this.matches,
564 matched: this.matched,
565 yyleng: this.yyleng,
566 offset: this.offset,
567 _more: this._more,
568 _input: this._input,
569 yy: this.yy,
570 conditionStack: this.conditionStack.slice(0),
571 done: this.done
572 };
573 if (this.options.ranges) {
574 backup.yylloc.range = this.yylloc.range.slice(0);
575 }
576 }
577
578 lines = match[0].match(/(?:\r\n?|\n).*/g);
579 if (lines) {
580 this.yylineno += lines.length;
581 }
582 this.yylloc = {
583 first_line: this.yylloc.last_line,
584 last_line: this.yylineno + 1,
585 first_column: this.yylloc.last_column,
586 last_column: lines ?
587 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
588 this.yylloc.last_column + match[0].length
589 };
590 this.yytext += match[0];
591 this.match += match[0];
592 this.matches = match;
593 this.yyleng = this.yytext.length;
594 if (this.options.ranges) {
595 this.yylloc.range = [this.offset, this.offset += this.yyleng];
596 }
597 this._more = false;
598 this._backtrack = false;
599 this._input = this._input.slice(match[0].length);
600 this.matched += match[0];
601 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
602 if (this.done && this._input) {
603 this.done = false;
604 }
605 if (token) {
606 return token;
607 } else if (this._backtrack) {
608 // recover context
609 for (var k in backup) {
610 this[k] = backup[k];
611 }
612 return false; // rule action called reject() implying the next rule should be tested instead.
613 }
614 return false;
615 },
616
617// return next match in input
618next:function () {
619 if (this.done) {
620 return this.EOF;
621 }
622 if (!this._input) {
623 this.done = true;
624 }
625
626 var token,
627 match,
628 tempMatch,
629 index;
630 if (!this._more) {
631 this.yytext = '';
632 this.match = '';
633 }
634 var rules = this._currentRules();
635 for (var i = 0; i < rules.length; i++) {
636 tempMatch = this._input.match(this.rules[rules[i]]);
637 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
638 match = tempMatch;
639 index = i;
640 if (this.options.backtrack_lexer) {
641 token = this.test_match(tempMatch, rules[i]);
642 if (token !== false) {
643 return token;
644 } else if (this._backtrack) {
645 match = false;
646 continue; // rule action called reject() implying a rule MISmatch.
647 } else {
648 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
649 return false;
650 }
651 } else if (!this.options.flex) {
652 break;
653 }
654 }
655 }
656 if (match) {
657 token = this.test_match(match, rules[index]);
658 if (token !== false) {
659 return token;
660 }
661 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
662 return false;
663 }
664 if (this._input === "") {
665 return this.EOF;
666 } else {
667 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
668 text: "",
669 token: null,
670 line: this.yylineno
671 });
672 }
673 },
674
675// return next match that has a token
676lex:function lex () {
677 var r = this.next();
678 if (r) {
679 return r;
680 } else {
681 return this.lex();
682 }
683 },
684
685// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
686begin:function begin (condition) {
687 this.conditionStack.push(condition);
688 },
689
690// pop the previously active lexer condition state off the condition stack
691popState:function popState () {
692 var n = this.conditionStack.length - 1;
693 if (n > 0) {
694 return this.conditionStack.pop();
695 } else {
696 return this.conditionStack[0];
697 }
698 },
699
700// produce the lexer rule set which is active for the currently active lexer condition state
701_currentRules:function _currentRules () {
702 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
703 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
704 } else {
705 return this.conditions["INITIAL"].rules;
706 }
707 },
708
709// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
710topState:function topState (n) {
711 n = this.conditionStack.length - 1 - Math.abs(n || 0);
712 if (n >= 0) {
713 return this.conditionStack[n];
714 } else {
715 return "INITIAL";
716 }
717 },
718
719// alias for begin(condition)
720pushState:function pushState (condition) {
721 this.begin(condition);
722 },
723
724// return the number of states currently on the stack
725stateStackSize:function stateStackSize() {
726 return this.conditionStack.length;
727 },
728options: {},
729performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
730var YYSTATE=YY_START;
731switch($avoiding_name_collisions) {
732case 0: this.begin('open_directive'); return 18;
733break;
734case 1:return 7;
735break;
736case 2:return 8;
737break;
738case 3:return 9;
739break;
740case 4:return 10;
741break;
742case 5: this.begin('type_directive'); return 19;
743break;
744case 6: this.popState(); this.begin('arg_directive'); return 16;
745break;
746case 7: this.popState(); this.popState(); return 21;
747break;
748case 8:return 20;
749break;
750case 9:/* skip comments */
751break;
752case 10:/* skip comments */
753break;
754case 11:return 15;
755break;
756case 12:/* skip whitespace */
757break;
758case 13:return 22;
759break;
760case 14:return 22;
761break;
762case 15: this.begin("struct"); /*console.log('Starting struct');*/ return 39;
763break;
764case 16:return "EOF_IN_STRUCT";
765break;
766case 17:return "OPEN_IN_STRUCT";
767break;
768case 18: /*console.log('Ending struct');*/this.popState(); return 41;
769break;
770case 19:/* nothing */
771break;
772case 20: /*console.log('lex-member: ' + yy_.yytext);*/ return "MEMBER";
773break;
774case 21:return 37;
775break;
776case 22:return 63;
777break;
778case 23:return 56;
779break;
780case 24:return 57;
781break;
782case 25:return 59;
783break;
784case 26:return 42;
785break;
786case 27:return 43;
787break;
788case 28:this.begin("generic");
789break;
790case 29:this.popState();
791break;
792case 30:return "GENERICTYPE";
793break;
794case 31:this.begin("string");
795break;
796case 32:this.popState();
797break;
798case 33:return "STR";
799break;
800case 34:this.begin("bqstring");
801break;
802case 35:this.popState();
803break;
804case 36:return "BQUOTE_STR";
805break;
806case 37:this.begin("href");
807break;
808case 38:this.popState();
809break;
810case 39:return 62;
811break;
812case 40:this.begin("callback_name");
813break;
814case 41:this.popState();
815break;
816case 42:this.popState(); this.begin("callback_args");
817break;
818case 43:return 60;
819break;
820case 44:this.popState();
821break;
822case 45:return 61;
823break;
824case 46:return 58;
825break;
826case 47:return 58;
827break;
828case 48:return 58;
829break;
830case 49:return 58;
831break;
832case 50:return 51;
833break;
834case 51:return 51;
835break;
836case 52:return 53;
837break;
838case 53:return 53;
839break;
840case 54:return 52;
841break;
842case 55:return 50;
843break;
844case 56:return 54;
845break;
846case 57:return 55;
847break;
848case 58:return 31;
849break;
850case 59:return 38;
851break;
852case 60:return 75;
853break;
854case 61:return 'DOT';
855break;
856case 62:return 'PLUS';
857break;
858case 63:return 72;
859break;
860case 64:return 'EQUALS';
861break;
862case 65:return 'EQUALS';
863break;
864case 66:return 79;
865break;
866case 67:return 'PUNCTUATION';
867break;
868case 68:return 78;
869break;
870case 69:return 77;
871break;
872case 70:return 74;
873break;
874case 71:return 24;
875break;
876}
877},
878rules: [/^(?:%%\{)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:classDiagram-v2\b)/,/^(?:classDiagram\b)/,/^(?:[{])/,/^(?:$)/,/^(?:[{])/,/^(?:[}])/,/^(?:[\n])/,/^(?:[^{}\n]*)/,/^(?:class\b)/,/^(?:cssClass\b)/,/^(?:callback\b)/,/^(?:link\b)/,/^(?:click\b)/,/^(?:<<)/,/^(?:>>)/,/^(?:[~])/,/^(?:[~])/,/^(?:[^~]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[`])/,/^(?:[`])/,/^(?:[^`]+)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:\s*<\|)/,/^(?:\s*\|>)/,/^(?:\s*>)/,/^(?:\s*<)/,/^(?:\s*\*)/,/^(?:\s*o\b)/,/^(?:--)/,/^(?:\.\.)/,/^(?::{1}[^:\n;]+)/,/^(?::{3})/,/^(?:-)/,/^(?:\.)/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:\w+)/,/^(?:[!"#$%&'*+,-.`?\\/])/,/^(?:[0-9]+)/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\s)/,/^(?:$)/],
879conditions: {"arg_directive":{"rules":[7,8],"inclusive":false},"type_directive":{"rules":[6,7],"inclusive":false},"open_directive":{"rules":[5],"inclusive":false},"callback_args":{"rules":[44,45],"inclusive":false},"callback_name":{"rules":[41,42,43],"inclusive":false},"href":{"rules":[38,39],"inclusive":false},"struct":{"rules":[16,17,18,19,20],"inclusive":false},"generic":{"rules":[29,30],"inclusive":false},"bqstring":{"rules":[35,36],"inclusive":false},"string":{"rules":[32,33],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,13,14,15,21,22,23,24,25,26,27,28,31,34,37,40,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71],"inclusive":true}}
880});
881return lexer;
882})();
883parser.lexer = lexer;
884function Parser () {
885 this.yy = {};
886}
887Parser.prototype = parser;parser.Parser = Parser;
888return new Parser;
889})();
890
891
892if (true) {
893exports.parser = parser;
894exports.Parser = parser.Parser;
895exports.parse = function () { return parser.parse.apply(parser, arguments); };
896exports.main = function commonjsMain (args) {
897 if (!args[1]) {
898 console.log('Usage: '+args[0]+' FILE');
899 process.exit(1);
900 }
901 var source = (__webpack_require__(/*! fs */ "?35ed").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
902 return exports.parser.parse(source);
903};
904if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
905 exports.main(process.argv.slice(1));
906}
907}
908
909/***/ }),
910
911/***/ "./src/diagrams/er/parser/erDiagram.jison":
912/*!************************************************!*\
913 !*** ./src/diagrams/er/parser/erDiagram.jison ***!
914 \************************************************/
915/***/ ((module, exports, __webpack_require__) => {
916
917/* module decorator */ module = __webpack_require__.nmd(module);
918/* parser generated by jison 0.4.18 */
919/*
920 Returns a Parser object of the following structure:
921
922 Parser: {
923 yy: {}
924 }
925
926 Parser.prototype: {
927 yy: {},
928 trace: function(),
929 symbols_: {associative list: name ==> number},
930 terminals_: {associative list: number ==> name},
931 productions_: [...],
932 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
933 table: [...],
934 defaultActions: {...},
935 parseError: function(str, hash),
936 parse: function(input),
937
938 lexer: {
939 EOF: 1,
940 parseError: function(str, hash),
941 setInput: function(input),
942 input: function(),
943 unput: function(str),
944 more: function(),
945 less: function(n),
946 pastInput: function(),
947 upcomingInput: function(),
948 showPosition: function(),
949 test_match: function(regex_match_array, rule_index),
950 next: function(),
951 lex: function(),
952 begin: function(condition),
953 popState: function(),
954 _currentRules: function(),
955 topState: function(),
956 pushState: function(condition),
957
958 options: {
959 ranges: boolean (optional: true ==> token location info will include a .range[] member)
960 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
961 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
962 },
963
964 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
965 rules: [...],
966 conditions: {associative list: name ==> set},
967 }
968 }
969
970
971 token location info (@$, _$, etc.): {
972 first_line: n,
973 last_line: n,
974 first_column: n,
975 last_column: n,
976 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
977 }
978
979
980 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
981 text: (matched text)
982 token: (the produced terminal token, if any)
983 line: (yylineno)
984 }
985 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
986 loc: (yylloc)
987 expected: (string describing the set of expected tokens)
988 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
989 }
990*/
991var parser = (function(){
992var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,23,40],$V3=[1,17],$V4=[1,20],$V5=[1,25],$V6=[1,26],$V7=[1,27],$V8=[1,28],$V9=[1,37],$Va=[23,37,38],$Vb=[4,6,9,11,23,40],$Vc=[33,34,35,36],$Vd=[22,29];
993var parser = {trace: function trace () { },
994yy: {},
995symbols_: {"error":2,"start":3,"ER_DIAGRAM":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"entityName":17,"relSpec":18,"role":19,"BLOCK_START":20,"attributes":21,"BLOCK_STOP":22,"ALPHANUM":23,"attribute":24,"attributeType":25,"attributeName":26,"attributeKeyType":27,"COMMENT":28,"ATTRIBUTE_WORD":29,"ATTRIBUTE_KEY":30,"cardinality":31,"relType":32,"ZERO_OR_ONE":33,"ZERO_OR_MORE":34,"ONE_OR_MORE":35,"ONLY_ONE":36,"NON_IDENTIFYING":37,"IDENTIFYING":38,"WORD":39,"open_directive":40,"type_directive":41,"arg_directive":42,"close_directive":43,"$accept":0,"$end":1},
996terminals_: {2:"error",4:"ER_DIAGRAM",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",20:"BLOCK_START",22:"BLOCK_STOP",23:"ALPHANUM",28:"COMMENT",29:"ATTRIBUTE_WORD",30:"ATTRIBUTE_KEY",33:"ZERO_OR_ONE",34:"ZERO_OR_MORE",35:"ONE_OR_MORE",36:"ONLY_ONE",37:"NON_IDENTIFYING",38:"IDENTIFYING",39:"WORD",40:"open_directive",41:"type_directive",42:"arg_directive",43:"close_directive"},
997productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,5],[10,4],[10,3],[10,1],[17,1],[21,1],[21,2],[24,2],[24,3],[24,3],[24,4],[25,1],[26,1],[27,1],[18,3],[31,1],[31,1],[31,1],[31,1],[32,1],[32,1],[19,1],[19,1],[12,1],[13,1],[16,1],[14,1]],
998performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
999/* this == yyval */
1000
1001var $0 = $$.length - 1;
1002switch (yystate) {
1003case 1:
1004 /*console.log('finished parsing');*/
1005break;
1006case 3:
1007 this.$ = []
1008break;
1009case 4:
1010$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
1011break;
1012case 5: case 6:
1013 this.$ = $$[$0]
1014break;
1015case 7: case 8:
1016 this.$=[];
1017break;
1018case 12:
1019
1020 yy.addEntity($$[$0-4]);
1021 yy.addEntity($$[$0-2]);
1022 yy.addRelationship($$[$0-4], $$[$0], $$[$0-2], $$[$0-3]);
1023 /*console.log($$[$0-4] + $$[$0-3] + $$[$0-2] + ':' + $$[$0]);*/
1024
1025break;
1026case 13:
1027
1028 /* console.log('detected block'); */
1029 yy.addEntity($$[$0-3]);
1030 yy.addAttributes($$[$0-3], $$[$0-1]);
1031 /* console.log('handled block'); */
1032
1033break;
1034case 14:
1035 yy.addEntity($$[$0-2]);
1036break;
1037case 15:
1038 yy.addEntity($$[$0]);
1039break;
1040case 16:
1041 this.$ = $$[$0]; /*console.log('Entity: ' + $$[$0]);*/
1042break;
1043case 17:
1044 this.$ = [$$[$0]];
1045break;
1046case 18:
1047 $$[$0].push($$[$0-1]); this.$=$$[$0];
1048break;
1049case 19:
1050 this.$ = { attributeType: $$[$0-1], attributeName: $$[$0] };
1051break;
1052case 20:
1053 this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeKeyType: $$[$0] };
1054break;
1055case 21:
1056 this.$ = { attributeType: $$[$0-2], attributeName: $$[$0-1], attributeComment: $$[$0] };
1057break;
1058case 22:
1059 this.$ = { attributeType: $$[$0-3], attributeName: $$[$0-2], attributeKeyType: $$[$0-1], attributeComment: $$[$0] };
1060break;
1061case 23: case 24: case 25:
1062 this.$=$$[$0];
1063break;
1064case 26:
1065
1066 this.$ = { cardA: $$[$0], relType: $$[$0-1], cardB: $$[$0-2] };
1067 /*console.log('relSpec: ' + $$[$0] + $$[$0-1] + $$[$0-2]);*/
1068
1069break;
1070case 27:
1071 this.$ = yy.Cardinality.ZERO_OR_ONE;
1072break;
1073case 28:
1074 this.$ = yy.Cardinality.ZERO_OR_MORE;
1075break;
1076case 29:
1077 this.$ = yy.Cardinality.ONE_OR_MORE;
1078break;
1079case 30:
1080 this.$ = yy.Cardinality.ONLY_ONE;
1081break;
1082case 31:
1083 this.$ = yy.Identification.NON_IDENTIFYING;
1084break;
1085case 32:
1086 this.$ = yy.Identification.IDENTIFYING;
1087break;
1088case 33:
1089 this.$ = $$[$0].replace(/"/g, '');
1090break;
1091case 34:
1092 this.$ = $$[$0];
1093break;
1094case 35:
1095 yy.parseDirective('%%{', 'open_directive');
1096break;
1097case 36:
1098 yy.parseDirective($$[$0], 'type_directive');
1099break;
1100case 37:
1101 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
1102break;
1103case 38:
1104 yy.parseDirective('}%%', 'close_directive', 'er');
1105break;
1106}
1107},
1108table: [{3:1,4:$V0,7:3,12:4,40:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,40:$V1},{13:8,41:[1,9]},{41:[2,35]},{6:[1,10],7:15,8:11,9:[1,12],10:13,11:[1,14],12:4,17:16,23:$V3,40:$V1},{1:[2,2]},{14:18,15:[1,19],43:$V4},o([15,43],[2,36]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:15,10:21,12:4,17:16,23:$V3,40:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,15],{18:22,31:24,20:[1,23],33:$V5,34:$V6,35:$V7,36:$V8}),o([6,9,11,15,20,23,33,34,35,36,40],[2,16]),{11:[1,29]},{16:30,42:[1,31]},{11:[2,38]},o($V2,[2,5]),{17:32,23:$V3},{21:33,22:[1,34],24:35,25:36,29:$V9},{32:38,37:[1,39],38:[1,40]},o($Va,[2,27]),o($Va,[2,28]),o($Va,[2,29]),o($Va,[2,30]),o($Vb,[2,9]),{14:41,43:$V4},{43:[2,37]},{15:[1,42]},{22:[1,43]},o($V2,[2,14]),{21:44,22:[2,17],24:35,25:36,29:$V9},{26:45,29:[1,46]},{29:[2,23]},{31:47,33:$V5,34:$V6,35:$V7,36:$V8},o($Vc,[2,31]),o($Vc,[2,32]),{11:[1,48]},{19:49,23:[1,51],39:[1,50]},o($V2,[2,13]),{22:[2,18]},o($Vd,[2,19],{27:52,28:[1,53],30:[1,54]}),o([22,28,29,30],[2,24]),{23:[2,26]},o($Vb,[2,10]),o($V2,[2,12]),o($V2,[2,33]),o($V2,[2,34]),o($Vd,[2,20],{28:[1,55]}),o($Vd,[2,21]),o([22,28,29],[2,25]),o($Vd,[2,22])],
1109defaultActions: {5:[2,35],7:[2,2],20:[2,38],31:[2,37],37:[2,23],44:[2,18],47:[2,26]},
1110parseError: function parseError (str, hash) {
1111 if (hash.recoverable) {
1112 this.trace(str);
1113 } else {
1114 var error = new Error(str);
1115 error.hash = hash;
1116 throw error;
1117 }
1118},
1119parse: function parse(input) {
1120 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
1121 var args = lstack.slice.call(arguments, 1);
1122 var lexer = Object.create(this.lexer);
1123 var sharedState = { yy: {} };
1124 for (var k in this.yy) {
1125 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
1126 sharedState.yy[k] = this.yy[k];
1127 }
1128 }
1129 lexer.setInput(input, sharedState.yy);
1130 sharedState.yy.lexer = lexer;
1131 sharedState.yy.parser = this;
1132 if (typeof lexer.yylloc == 'undefined') {
1133 lexer.yylloc = {};
1134 }
1135 var yyloc = lexer.yylloc;
1136 lstack.push(yyloc);
1137 var ranges = lexer.options && lexer.options.ranges;
1138 if (typeof sharedState.yy.parseError === 'function') {
1139 this.parseError = sharedState.yy.parseError;
1140 } else {
1141 this.parseError = Object.getPrototypeOf(this).parseError;
1142 }
1143 function popStack(n) {
1144 stack.length = stack.length - 2 * n;
1145 vstack.length = vstack.length - n;
1146 lstack.length = lstack.length - n;
1147 }
1148 function lex() {
1149 var token;
1150 token = tstack.pop() || lexer.lex() || EOF;
1151 if (typeof token !== 'number') {
1152 if (token instanceof Array) {
1153 tstack = token;
1154 token = tstack.pop();
1155 }
1156 token = self.symbols_[token] || token;
1157 }
1158 return token;
1159 }
1160 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
1161 while (true) {
1162 state = stack[stack.length - 1];
1163 if (this.defaultActions[state]) {
1164 action = this.defaultActions[state];
1165 } else {
1166 if (symbol === null || typeof symbol == 'undefined') {
1167 symbol = lex();
1168 }
1169 action = table[state] && table[state][symbol];
1170 }
1171 if (typeof action === 'undefined' || !action.length || !action[0]) {
1172 var errStr = '';
1173 expected = [];
1174 for (p in table[state]) {
1175 if (this.terminals_[p] && p > TERROR) {
1176 expected.push('\'' + this.terminals_[p] + '\'');
1177 }
1178 }
1179 if (lexer.showPosition) {
1180 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
1181 } else {
1182 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
1183 }
1184 this.parseError(errStr, {
1185 text: lexer.match,
1186 token: this.terminals_[symbol] || symbol,
1187 line: lexer.yylineno,
1188 loc: yyloc,
1189 expected: expected
1190 });
1191 }
1192 if (action[0] instanceof Array && action.length > 1) {
1193 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
1194 }
1195 switch (action[0]) {
1196 case 1:
1197 stack.push(symbol);
1198 vstack.push(lexer.yytext);
1199 lstack.push(lexer.yylloc);
1200 stack.push(action[1]);
1201 symbol = null;
1202 if (!preErrorSymbol) {
1203 yyleng = lexer.yyleng;
1204 yytext = lexer.yytext;
1205 yylineno = lexer.yylineno;
1206 yyloc = lexer.yylloc;
1207 if (recovering > 0) {
1208 recovering--;
1209 }
1210 } else {
1211 symbol = preErrorSymbol;
1212 preErrorSymbol = null;
1213 }
1214 break;
1215 case 2:
1216 len = this.productions_[action[1]][1];
1217 yyval.$ = vstack[vstack.length - len];
1218 yyval._$ = {
1219 first_line: lstack[lstack.length - (len || 1)].first_line,
1220 last_line: lstack[lstack.length - 1].last_line,
1221 first_column: lstack[lstack.length - (len || 1)].first_column,
1222 last_column: lstack[lstack.length - 1].last_column
1223 };
1224 if (ranges) {
1225 yyval._$.range = [
1226 lstack[lstack.length - (len || 1)].range[0],
1227 lstack[lstack.length - 1].range[1]
1228 ];
1229 }
1230 r = this.performAction.apply(yyval, [
1231 yytext,
1232 yyleng,
1233 yylineno,
1234 sharedState.yy,
1235 action[1],
1236 vstack,
1237 lstack
1238 ].concat(args));
1239 if (typeof r !== 'undefined') {
1240 return r;
1241 }
1242 if (len) {
1243 stack = stack.slice(0, -1 * len * 2);
1244 vstack = vstack.slice(0, -1 * len);
1245 lstack = lstack.slice(0, -1 * len);
1246 }
1247 stack.push(this.productions_[action[1]][0]);
1248 vstack.push(yyval.$);
1249 lstack.push(yyval._$);
1250 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
1251 stack.push(newState);
1252 break;
1253 case 3:
1254 return true;
1255 }
1256 }
1257 return true;
1258}};
1259
1260/* generated by jison-lex 0.3.4 */
1261var lexer = (function(){
1262var lexer = ({
1263
1264EOF:1,
1265
1266parseError:function parseError(str, hash) {
1267 if (this.yy.parser) {
1268 this.yy.parser.parseError(str, hash);
1269 } else {
1270 throw new Error(str);
1271 }
1272 },
1273
1274// resets the lexer, sets new input
1275setInput:function (input, yy) {
1276 this.yy = yy || this.yy || {};
1277 this._input = input;
1278 this._more = this._backtrack = this.done = false;
1279 this.yylineno = this.yyleng = 0;
1280 this.yytext = this.matched = this.match = '';
1281 this.conditionStack = ['INITIAL'];
1282 this.yylloc = {
1283 first_line: 1,
1284 first_column: 0,
1285 last_line: 1,
1286 last_column: 0
1287 };
1288 if (this.options.ranges) {
1289 this.yylloc.range = [0,0];
1290 }
1291 this.offset = 0;
1292 return this;
1293 },
1294
1295// consumes and returns one char from the input
1296input:function () {
1297 var ch = this._input[0];
1298 this.yytext += ch;
1299 this.yyleng++;
1300 this.offset++;
1301 this.match += ch;
1302 this.matched += ch;
1303 var lines = ch.match(/(?:\r\n?|\n).*/g);
1304 if (lines) {
1305 this.yylineno++;
1306 this.yylloc.last_line++;
1307 } else {
1308 this.yylloc.last_column++;
1309 }
1310 if (this.options.ranges) {
1311 this.yylloc.range[1]++;
1312 }
1313
1314 this._input = this._input.slice(1);
1315 return ch;
1316 },
1317
1318// unshifts one char (or a string) into the input
1319unput:function (ch) {
1320 var len = ch.length;
1321 var lines = ch.split(/(?:\r\n?|\n)/g);
1322
1323 this._input = ch + this._input;
1324 this.yytext = this.yytext.substr(0, this.yytext.length - len);
1325 //this.yyleng -= len;
1326 this.offset -= len;
1327 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
1328 this.match = this.match.substr(0, this.match.length - 1);
1329 this.matched = this.matched.substr(0, this.matched.length - 1);
1330
1331 if (lines.length - 1) {
1332 this.yylineno -= lines.length - 1;
1333 }
1334 var r = this.yylloc.range;
1335
1336 this.yylloc = {
1337 first_line: this.yylloc.first_line,
1338 last_line: this.yylineno + 1,
1339 first_column: this.yylloc.first_column,
1340 last_column: lines ?
1341 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
1342 + oldLines[oldLines.length - lines.length].length - lines[0].length :
1343 this.yylloc.first_column - len
1344 };
1345
1346 if (this.options.ranges) {
1347 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1348 }
1349 this.yyleng = this.yytext.length;
1350 return this;
1351 },
1352
1353// When called from action, caches matched text and appends it on next action
1354more:function () {
1355 this._more = true;
1356 return this;
1357 },
1358
1359// 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.
1360reject:function () {
1361 if (this.options.backtrack_lexer) {
1362 this._backtrack = true;
1363 } else {
1364 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(), {
1365 text: "",
1366 token: null,
1367 line: this.yylineno
1368 });
1369
1370 }
1371 return this;
1372 },
1373
1374// retain first n characters of the match
1375less:function (n) {
1376 this.unput(this.match.slice(n));
1377 },
1378
1379// displays already matched input, i.e. for error messages
1380pastInput:function () {
1381 var past = this.matched.substr(0, this.matched.length - this.match.length);
1382 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
1383 },
1384
1385// displays upcoming input, i.e. for error messages
1386upcomingInput:function () {
1387 var next = this.match;
1388 if (next.length < 20) {
1389 next += this._input.substr(0, 20-next.length);
1390 }
1391 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
1392 },
1393
1394// displays the character position where the lexing error occurred, i.e. for error messages
1395showPosition:function () {
1396 var pre = this.pastInput();
1397 var c = new Array(pre.length + 1).join("-");
1398 return pre + this.upcomingInput() + "\n" + c + "^";
1399 },
1400
1401// test the lexed token: return FALSE when not a match, otherwise return token
1402test_match:function(match, indexed_rule) {
1403 var token,
1404 lines,
1405 backup;
1406
1407 if (this.options.backtrack_lexer) {
1408 // save context
1409 backup = {
1410 yylineno: this.yylineno,
1411 yylloc: {
1412 first_line: this.yylloc.first_line,
1413 last_line: this.last_line,
1414 first_column: this.yylloc.first_column,
1415 last_column: this.yylloc.last_column
1416 },
1417 yytext: this.yytext,
1418 match: this.match,
1419 matches: this.matches,
1420 matched: this.matched,
1421 yyleng: this.yyleng,
1422 offset: this.offset,
1423 _more: this._more,
1424 _input: this._input,
1425 yy: this.yy,
1426 conditionStack: this.conditionStack.slice(0),
1427 done: this.done
1428 };
1429 if (this.options.ranges) {
1430 backup.yylloc.range = this.yylloc.range.slice(0);
1431 }
1432 }
1433
1434 lines = match[0].match(/(?:\r\n?|\n).*/g);
1435 if (lines) {
1436 this.yylineno += lines.length;
1437 }
1438 this.yylloc = {
1439 first_line: this.yylloc.last_line,
1440 last_line: this.yylineno + 1,
1441 first_column: this.yylloc.last_column,
1442 last_column: lines ?
1443 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
1444 this.yylloc.last_column + match[0].length
1445 };
1446 this.yytext += match[0];
1447 this.match += match[0];
1448 this.matches = match;
1449 this.yyleng = this.yytext.length;
1450 if (this.options.ranges) {
1451 this.yylloc.range = [this.offset, this.offset += this.yyleng];
1452 }
1453 this._more = false;
1454 this._backtrack = false;
1455 this._input = this._input.slice(match[0].length);
1456 this.matched += match[0];
1457 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
1458 if (this.done && this._input) {
1459 this.done = false;
1460 }
1461 if (token) {
1462 return token;
1463 } else if (this._backtrack) {
1464 // recover context
1465 for (var k in backup) {
1466 this[k] = backup[k];
1467 }
1468 return false; // rule action called reject() implying the next rule should be tested instead.
1469 }
1470 return false;
1471 },
1472
1473// return next match in input
1474next:function () {
1475 if (this.done) {
1476 return this.EOF;
1477 }
1478 if (!this._input) {
1479 this.done = true;
1480 }
1481
1482 var token,
1483 match,
1484 tempMatch,
1485 index;
1486 if (!this._more) {
1487 this.yytext = '';
1488 this.match = '';
1489 }
1490 var rules = this._currentRules();
1491 for (var i = 0; i < rules.length; i++) {
1492 tempMatch = this._input.match(this.rules[rules[i]]);
1493 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1494 match = tempMatch;
1495 index = i;
1496 if (this.options.backtrack_lexer) {
1497 token = this.test_match(tempMatch, rules[i]);
1498 if (token !== false) {
1499 return token;
1500 } else if (this._backtrack) {
1501 match = false;
1502 continue; // rule action called reject() implying a rule MISmatch.
1503 } else {
1504 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
1505 return false;
1506 }
1507 } else if (!this.options.flex) {
1508 break;
1509 }
1510 }
1511 }
1512 if (match) {
1513 token = this.test_match(match, rules[index]);
1514 if (token !== false) {
1515 return token;
1516 }
1517 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
1518 return false;
1519 }
1520 if (this._input === "") {
1521 return this.EOF;
1522 } else {
1523 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
1524 text: "",
1525 token: null,
1526 line: this.yylineno
1527 });
1528 }
1529 },
1530
1531// return next match that has a token
1532lex:function lex () {
1533 var r = this.next();
1534 if (r) {
1535 return r;
1536 } else {
1537 return this.lex();
1538 }
1539 },
1540
1541// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1542begin:function begin (condition) {
1543 this.conditionStack.push(condition);
1544 },
1545
1546// pop the previously active lexer condition state off the condition stack
1547popState:function popState () {
1548 var n = this.conditionStack.length - 1;
1549 if (n > 0) {
1550 return this.conditionStack.pop();
1551 } else {
1552 return this.conditionStack[0];
1553 }
1554 },
1555
1556// produce the lexer rule set which is active for the currently active lexer condition state
1557_currentRules:function _currentRules () {
1558 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
1559 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1560 } else {
1561 return this.conditions["INITIAL"].rules;
1562 }
1563 },
1564
1565// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
1566topState:function topState (n) {
1567 n = this.conditionStack.length - 1 - Math.abs(n || 0);
1568 if (n >= 0) {
1569 return this.conditionStack[n];
1570 } else {
1571 return "INITIAL";
1572 }
1573 },
1574
1575// alias for begin(condition)
1576pushState:function pushState (condition) {
1577 this.begin(condition);
1578 },
1579
1580// return the number of states currently on the stack
1581stateStackSize:function stateStackSize() {
1582 return this.conditionStack.length;
1583 },
1584options: {"case-insensitive":true},
1585performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
1586var YYSTATE=YY_START;
1587switch($avoiding_name_collisions) {
1588case 0: this.begin('open_directive'); return 40;
1589break;
1590case 1: this.begin('type_directive'); return 41;
1591break;
1592case 2: this.popState(); this.begin('arg_directive'); return 15;
1593break;
1594case 3: this.popState(); this.popState(); return 43;
1595break;
1596case 4:return 42;
1597break;
1598case 5:/* skip comments */
1599break;
1600case 6:/* skip comments */
1601break;
1602case 7:return 11;
1603break;
1604case 8:/* skip whitespace */
1605break;
1606case 9:return 9;
1607break;
1608case 10:return 39;
1609break;
1610case 11:return 4;
1611break;
1612case 12: this.begin("block"); return 20;
1613break;
1614case 13:/* skip whitespace in block */
1615break;
1616case 14:return 30
1617break;
1618case 15:return 29
1619break;
1620case 16:return 28;
1621break;
1622case 17:/* nothing */
1623break;
1624case 18: this.popState(); return 22;
1625break;
1626case 19:return yy_.yytext[0];
1627break;
1628case 20:return 33;
1629break;
1630case 21:return 34;
1631break;
1632case 22:return 35;
1633break;
1634case 23:return 36;
1635break;
1636case 24:return 33;
1637break;
1638case 25:return 34;
1639break;
1640case 26:return 35;
1641break;
1642case 27:return 37;
1643break;
1644case 28:return 38;
1645break;
1646case 29:return 37;
1647break;
1648case 30:return 37;
1649break;
1650case 31:return 23;
1651break;
1652case 32:return yy_.yytext[0];
1653break;
1654case 33:return 6;
1655break;
1656}
1657},
1658rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:\s+)/i,/^(?:(?:PK)|(?:FK))/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\|o\b)/i,/^(?:\}o\b)/i,/^(?:\}\|)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:[A-Za-z][A-Za-z0-9\-_]*)/i,/^(?:.)/i,/^(?:$)/i],
1659conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"block":{"rules":[13,14,15,16,17,18,19],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"inclusive":true}}
1660});
1661return lexer;
1662})();
1663parser.lexer = lexer;
1664function Parser () {
1665 this.yy = {};
1666}
1667Parser.prototype = parser;parser.Parser = Parser;
1668return new Parser;
1669})();
1670
1671
1672if (true) {
1673exports.parser = parser;
1674exports.Parser = parser.Parser;
1675exports.parse = function () { return parser.parse.apply(parser, arguments); };
1676exports.main = function commonjsMain (args) {
1677 if (!args[1]) {
1678 console.log('Usage: '+args[0]+' FILE');
1679 process.exit(1);
1680 }
1681 var source = (__webpack_require__(/*! fs */ "?3c87").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
1682 return exports.parser.parse(source);
1683};
1684if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
1685 exports.main(process.argv.slice(1));
1686}
1687}
1688
1689/***/ }),
1690
1691/***/ "./src/diagrams/flowchart/parser/flow.jison":
1692/*!**************************************************!*\
1693 !*** ./src/diagrams/flowchart/parser/flow.jison ***!
1694 \**************************************************/
1695/***/ ((module, exports, __webpack_require__) => {
1696
1697/* module decorator */ module = __webpack_require__.nmd(module);
1698/* parser generated by jison 0.4.18 */
1699/*
1700 Returns a Parser object of the following structure:
1701
1702 Parser: {
1703 yy: {}
1704 }
1705
1706 Parser.prototype: {
1707 yy: {},
1708 trace: function(),
1709 symbols_: {associative list: name ==> number},
1710 terminals_: {associative list: number ==> name},
1711 productions_: [...],
1712 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
1713 table: [...],
1714 defaultActions: {...},
1715 parseError: function(str, hash),
1716 parse: function(input),
1717
1718 lexer: {
1719 EOF: 1,
1720 parseError: function(str, hash),
1721 setInput: function(input),
1722 input: function(),
1723 unput: function(str),
1724 more: function(),
1725 less: function(n),
1726 pastInput: function(),
1727 upcomingInput: function(),
1728 showPosition: function(),
1729 test_match: function(regex_match_array, rule_index),
1730 next: function(),
1731 lex: function(),
1732 begin: function(condition),
1733 popState: function(),
1734 _currentRules: function(),
1735 topState: function(),
1736 pushState: function(condition),
1737
1738 options: {
1739 ranges: boolean (optional: true ==> token location info will include a .range[] member)
1740 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
1741 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
1742 },
1743
1744 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
1745 rules: [...],
1746 conditions: {associative list: name ==> set},
1747 }
1748 }
1749
1750
1751 token location info (@$, _$, etc.): {
1752 first_line: n,
1753 last_line: n,
1754 first_column: n,
1755 last_column: n,
1756 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
1757 }
1758
1759
1760 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
1761 text: (matched text)
1762 token: (the produced terminal token, if any)
1763 line: (yylineno)
1764 }
1765 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
1766 loc: (yylloc)
1767 expected: (string describing the set of expected tokens)
1768 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
1769 }
1770*/
1771var parser = (function(){
1772var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,9],$V1=[1,7],$V2=[1,6],$V3=[1,8],$V4=[1,20,21,22,23,38,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$V5=[2,10],$V6=[1,20],$V7=[1,21],$V8=[1,22],$V9=[1,23],$Va=[1,30],$Vb=[1,59],$Vc=[1,33],$Vd=[1,34],$Ve=[1,35],$Vf=[1,36],$Vg=[1,37],$Vh=[1,53],$Vi=[1,48],$Vj=[1,50],$Vk=[1,45],$Vl=[1,49],$Vm=[1,52],$Vn=[1,56],$Vo=[1,57],$Vp=[1,38],$Vq=[1,39],$Vr=[1,40],$Vs=[1,41],$Vt=[1,58],$Vu=[1,47],$Vv=[1,51],$Vw=[1,54],$Vx=[1,55],$Vy=[1,46],$Vz=[1,62],$VA=[1,67],$VB=[1,20,21,22,23,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$VC=[1,71],$VD=[1,70],$VE=[1,72],$VF=[20,21,23,70,71],$VG=[1,93],$VH=[1,98],$VI=[1,95],$VJ=[1,100],$VK=[1,103],$VL=[1,101],$VM=[1,102],$VN=[1,96],$VO=[1,108],$VP=[1,107],$VQ=[1,97],$VR=[1,99],$VS=[1,104],$VT=[1,105],$VU=[1,106],$VV=[1,109],$VW=[20,21,22,23,70,71],$VX=[20,21,22,23,48,70,71],$VY=[20,21,22,23,40,47,48,50,52,54,56,58,60,62,63,65,70,71,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$VZ=[20,21,23],$V_=[20,21,23,47,70,71,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$V$=[1,12,20,21,22,23,24,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$V01=[47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$V11=[1,141],$V21=[1,149],$V31=[1,150],$V41=[1,151],$V51=[1,152],$V61=[1,136],$V71=[1,137],$V81=[1,133],$V91=[1,144],$Va1=[1,145],$Vb1=[1,146],$Vc1=[1,147],$Vd1=[1,148],$Ve1=[1,153],$Vf1=[1,154],$Vg1=[1,139],$Vh1=[1,142],$Vi1=[1,138],$Vj1=[1,135],$Vk1=[20,21,22,23,38,42,47,76,77,78,79,80,81,95,96,99,100,101,103,104,110,111,112,113,114,115,116,117,118,119],$Vl1=[1,157],$Vm1=[20,21,22,23,26,47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],$Vn1=[20,21,22,23,24,26,38,40,41,42,47,51,53,55,57,59,61,62,64,66,70,71,72,76,77,78,79,80,81,82,85,95,96,99,100,101,103,104,105,106,114,115,116,117,118,119],$Vo1=[12,21,22,24],$Vp1=[22,96],$Vq1=[1,238],$Vr1=[1,242],$Vs1=[1,239],$Vt1=[1,236],$Vu1=[1,233],$Vv1=[1,234],$Vw1=[1,235],$Vx1=[1,237],$Vy1=[1,240],$Vz1=[1,241],$VA1=[1,243],$VB1=[1,260],$VC1=[20,21,23,96],$VD1=[20,21,22,23,76,92,95,96,99,100,101,102,103,104,105];
1773var parser = {trace: function trace () { },
1774yy: {},
1775symbols_: {"error":2,"start":3,"mermaidDoc":4,"directive":5,"openDirective":6,"typeDirective":7,"closeDirective":8,"separator":9,":":10,"argDirective":11,"open_directive":12,"type_directive":13,"arg_directive":14,"close_directive":15,"graphConfig":16,"document":17,"line":18,"statement":19,"SEMI":20,"NEWLINE":21,"SPACE":22,"EOF":23,"GRAPH":24,"NODIR":25,"DIR":26,"FirstStmtSeperator":27,"ending":28,"endToken":29,"spaceList":30,"spaceListNewline":31,"verticeStatement":32,"styleStatement":33,"linkStyleStatement":34,"classDefStatement":35,"classStatement":36,"clickStatement":37,"subgraph":38,"text":39,"SQS":40,"SQE":41,"end":42,"direction":43,"link":44,"node":45,"vertex":46,"AMP":47,"STYLE_SEPARATOR":48,"idString":49,"PS":50,"PE":51,"(-":52,"-)":53,"STADIUMSTART":54,"STADIUMEND":55,"SUBROUTINESTART":56,"SUBROUTINEEND":57,"CYLINDERSTART":58,"CYLINDEREND":59,"DIAMOND_START":60,"DIAMOND_STOP":61,"TAGEND":62,"TRAPSTART":63,"TRAPEND":64,"INVTRAPSTART":65,"INVTRAPEND":66,"linkStatement":67,"arrowText":68,"TESTSTR":69,"START_LINK":70,"LINK":71,"PIPE":72,"textToken":73,"STR":74,"keywords":75,"STYLE":76,"LINKSTYLE":77,"CLASSDEF":78,"CLASS":79,"CLICK":80,"DOWN":81,"UP":82,"textNoTags":83,"textNoTagsToken":84,"DEFAULT":85,"stylesOpt":86,"alphaNum":87,"CALLBACKNAME":88,"CALLBACKARGS":89,"HREF":90,"LINK_TARGET":91,"HEX":92,"numList":93,"INTERPOLATE":94,"NUM":95,"COMMA":96,"style":97,"styleComponent":98,"ALPHA":99,"COLON":100,"MINUS":101,"UNIT":102,"BRKT":103,"DOT":104,"PCT":105,"TAGSTART":106,"alphaNumToken":107,"idStringToken":108,"alphaNumStatement":109,"direction_tb":110,"direction_bt":111,"direction_rl":112,"direction_lr":113,"PUNCTUATION":114,"UNICODE_TEXT":115,"PLUS":116,"EQUALS":117,"MULT":118,"UNDERSCORE":119,"graphCodeTokens":120,"ARROW_CROSS":121,"ARROW_POINT":122,"ARROW_CIRCLE":123,"ARROW_OPEN":124,"QUOTE":125,"$accept":0,"$end":1},
1776terminals_: {2:"error",10:":",12:"open_directive",13:"type_directive",14:"arg_directive",15:"close_directive",20:"SEMI",21:"NEWLINE",22:"SPACE",23:"EOF",24:"GRAPH",25:"NODIR",26:"DIR",38:"subgraph",40:"SQS",41:"SQE",42:"end",47:"AMP",48:"STYLE_SEPARATOR",50:"PS",51:"PE",52:"(-",53:"-)",54:"STADIUMSTART",55:"STADIUMEND",56:"SUBROUTINESTART",57:"SUBROUTINEEND",58:"CYLINDERSTART",59:"CYLINDEREND",60:"DIAMOND_START",61:"DIAMOND_STOP",62:"TAGEND",63:"TRAPSTART",64:"TRAPEND",65:"INVTRAPSTART",66:"INVTRAPEND",69:"TESTSTR",70:"START_LINK",71:"LINK",72:"PIPE",74:"STR",76:"STYLE",77:"LINKSTYLE",78:"CLASSDEF",79:"CLASS",80:"CLICK",81:"DOWN",82:"UP",85:"DEFAULT",88:"CALLBACKNAME",89:"CALLBACKARGS",90:"HREF",91:"LINK_TARGET",92:"HEX",94:"INTERPOLATE",95:"NUM",96:"COMMA",99:"ALPHA",100:"COLON",101:"MINUS",102:"UNIT",103:"BRKT",104:"DOT",105:"PCT",106:"TAGSTART",110:"direction_tb",111:"direction_bt",112:"direction_rl",113:"direction_lr",114:"PUNCTUATION",115:"UNICODE_TEXT",116:"PLUS",117:"EQUALS",118:"MULT",119:"UNDERSCORE",121:"ARROW_CROSS",122:"ARROW_POINT",123:"ARROW_CIRCLE",124:"ARROW_OPEN",125:"QUOTE"},
1777productions_: [0,[3,1],[3,2],[5,4],[5,6],[6,1],[7,1],[11,1],[8,1],[4,2],[17,0],[17,2],[18,1],[18,1],[18,1],[18,1],[18,1],[16,2],[16,2],[16,2],[16,3],[28,2],[28,1],[29,1],[29,1],[29,1],[27,1],[27,1],[27,2],[31,2],[31,2],[31,1],[31,1],[30,2],[30,1],[19,2],[19,2],[19,2],[19,2],[19,2],[19,2],[19,9],[19,6],[19,4],[19,1],[9,1],[9,1],[9,1],[32,3],[32,4],[32,2],[32,1],[45,1],[45,5],[45,3],[46,4],[46,6],[46,4],[46,4],[46,4],[46,4],[46,4],[46,4],[46,6],[46,4],[46,4],[46,4],[46,4],[46,4],[46,1],[44,2],[44,3],[44,3],[44,1],[44,3],[67,1],[68,3],[39,1],[39,2],[39,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[75,1],[83,1],[83,2],[35,5],[35,5],[36,5],[37,2],[37,4],[37,3],[37,5],[37,2],[37,4],[37,4],[37,6],[37,2],[37,4],[37,2],[37,4],[37,4],[37,6],[33,5],[33,5],[34,5],[34,5],[34,9],[34,9],[34,7],[34,7],[93,1],[93,3],[86,1],[86,3],[97,1],[97,2],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[98,1],[73,1],[73,1],[73,1],[73,1],[73,1],[73,1],[84,1],[84,1],[84,1],[84,1],[49,1],[49,2],[87,1],[87,2],[109,1],[109,1],[109,1],[109,1],[43,1],[43,1],[43,1],[43,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[107,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[108,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1],[120,1]],
1778performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
1779/* this == yyval */
1780
1781var $0 = $$.length - 1;
1782switch (yystate) {
1783case 5:
1784 yy.parseDirective('%%{', 'open_directive');
1785break;
1786case 6:
1787 yy.parseDirective($$[$0], 'type_directive');
1788break;
1789case 7:
1790 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
1791break;
1792case 8:
1793 yy.parseDirective('}%%', 'close_directive', 'flowchart');
1794break;
1795case 10:
1796 this.$ = [];
1797break;
1798case 11:
1799
1800 if($$[$0] !== []){
1801 $$[$0-1].push($$[$0]);
1802 }
1803 this.$=$$[$0-1];
1804break;
1805case 12: case 77: case 79: case 91: case 147: case 149: case 150:
1806this.$=$$[$0];
1807break;
1808case 19:
1809 yy.setDirection('TB');this.$ = 'TB';
1810break;
1811case 20:
1812 yy.setDirection($$[$0-1]);this.$ = $$[$0-1];
1813break;
1814case 35:
1815 /* console.warn('finat vs', $$[$0-1].nodes); */ this.$=$$[$0-1].nodes
1816break;
1817case 36: case 37: case 38: case 39: case 40:
1818this.$=[];
1819break;
1820case 41:
1821this.$=yy.addSubGraph($$[$0-6],$$[$0-1],$$[$0-4]);
1822break;
1823case 42:
1824this.$=yy.addSubGraph($$[$0-3],$$[$0-1],$$[$0-3]);
1825break;
1826case 43:
1827this.$=yy.addSubGraph(undefined,$$[$0-1],undefined);
1828break;
1829case 48:
1830 /* console.warn('vs',$$[$0-2].stmt,$$[$0]); */ yy.addLink($$[$0-2].stmt,$$[$0],$$[$0-1]); this.$ = { stmt: $$[$0], nodes: $$[$0].concat($$[$0-2].nodes) }
1831break;
1832case 49:
1833 /* console.warn('vs',$$[$0-3].stmt,$$[$0-1]); */ yy.addLink($$[$0-3].stmt,$$[$0-1],$$[$0-2]); this.$ = { stmt: $$[$0-1], nodes: $$[$0-1].concat($$[$0-3].nodes) }
1834break;
1835case 50:
1836/*console.warn('noda', $$[$0-1]);*/ this.$ = {stmt: $$[$0-1], nodes:$$[$0-1] }
1837break;
1838case 51:
1839 /*console.warn('noda', $$[$0]);*/ this.$ = {stmt: $$[$0], nodes:$$[$0] }
1840break;
1841case 52:
1842 /* console.warn('nod', $$[$0]); */ this.$ = [$$[$0]];
1843break;
1844case 53:
1845 this.$ = $$[$0-4].concat($$[$0]); /* console.warn('pip', $$[$0-4][0], $$[$0], this.$); */
1846break;
1847case 54:
1848this.$ = [$$[$0-2]];yy.setClass($$[$0-2],$$[$0])
1849break;
1850case 55:
1851this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'square');
1852break;
1853case 56:
1854this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'circle');
1855break;
1856case 57:
1857this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'ellipse');
1858break;
1859case 58:
1860this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'stadium');
1861break;
1862case 59:
1863this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'subroutine');
1864break;
1865case 60:
1866this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'cylinder');
1867break;
1868case 61:
1869this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'round');
1870break;
1871case 62:
1872this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'diamond');
1873break;
1874case 63:
1875this.$ = $$[$0-5];yy.addVertex($$[$0-5],$$[$0-2],'hexagon');
1876break;
1877case 64:
1878this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'odd');
1879break;
1880case 65:
1881this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'trapezoid');
1882break;
1883case 66:
1884this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'inv_trapezoid');
1885break;
1886case 67:
1887this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_right');
1888break;
1889case 68:
1890this.$ = $$[$0-3];yy.addVertex($$[$0-3],$$[$0-1],'lean_left');
1891break;
1892case 69:
1893 /*console.warn('h: ', $$[$0]);*/this.$ = $$[$0];yy.addVertex($$[$0]);
1894break;
1895case 70:
1896$$[$0-1].text = $$[$0];this.$ = $$[$0-1];
1897break;
1898case 71: case 72:
1899$$[$0-2].text = $$[$0-1];this.$ = $$[$0-2];
1900break;
1901case 73:
1902this.$ = $$[$0];
1903break;
1904case 74:
1905var inf = yy.destructLink($$[$0], $$[$0-2]); this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length,"text":$$[$0-1]};
1906break;
1907case 75:
1908var inf = yy.destructLink($$[$0]);this.$ = {"type":inf.type,"stroke":inf.stroke,"length":inf.length};
1909break;
1910case 76:
1911this.$ = $$[$0-1];
1912break;
1913case 78: case 92: case 148:
1914this.$=$$[$0-1]+''+$$[$0];
1915break;
1916case 93: case 94:
1917this.$ = $$[$0-4];yy.addClass($$[$0-2],$$[$0]);
1918break;
1919case 95:
1920this.$ = $$[$0-4];yy.setClass($$[$0-2], $$[$0]);
1921break;
1922case 96: case 104:
1923this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0]);
1924break;
1925case 97: case 105:
1926this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
1927break;
1928case 98:
1929this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
1930break;
1931case 99:
1932this.$ = $$[$0-4];yy.setClickEvent($$[$0-4], $$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-4], $$[$0]);
1933break;
1934case 100: case 106:
1935this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
1936break;
1937case 101: case 107:
1938this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2]);yy.setTooltip($$[$0-3], $$[$0]);
1939break;
1940case 102: case 108:
1941this.$ = $$[$0-3];yy.setLink($$[$0-3], $$[$0-2], $$[$0]);
1942break;
1943case 103: case 109:
1944this.$ = $$[$0-5];yy.setLink($$[$0-5], $$[$0-4], $$[$0]);yy.setTooltip($$[$0-5], $$[$0-2]);
1945break;
1946case 110:
1947this.$ = $$[$0-4];yy.addVertex($$[$0-2],undefined,undefined,$$[$0]);
1948break;
1949case 111: case 113:
1950this.$ = $$[$0-4];yy.updateLink($$[$0-2],$$[$0]);
1951break;
1952case 112:
1953this.$ = $$[$0-4];yy.updateLink([$$[$0-2]],$$[$0]);
1954break;
1955case 114:
1956this.$ = $$[$0-8];yy.updateLinkInterpolate([$$[$0-6]],$$[$0-2]);yy.updateLink([$$[$0-6]],$$[$0]);
1957break;
1958case 115:
1959this.$ = $$[$0-8];yy.updateLinkInterpolate($$[$0-6],$$[$0-2]);yy.updateLink($$[$0-6],$$[$0]);
1960break;
1961case 116:
1962this.$ = $$[$0-6];yy.updateLinkInterpolate([$$[$0-4]],$$[$0]);
1963break;
1964case 117:
1965this.$ = $$[$0-6];yy.updateLinkInterpolate($$[$0-4],$$[$0]);
1966break;
1967case 118: case 120:
1968this.$ = [$$[$0]]
1969break;
1970case 119: case 121:
1971$$[$0-2].push($$[$0]);this.$ = $$[$0-2];
1972break;
1973case 123:
1974this.$ = $$[$0-1] + $$[$0];
1975break;
1976case 145:
1977this.$=$$[$0]
1978break;
1979case 146:
1980this.$=$$[$0-1]+''+$$[$0]
1981break;
1982case 151:
1983this.$='v';
1984break;
1985case 152:
1986this.$='-';
1987break;
1988case 153:
1989 this.$={stmt:'dir', value:'TB'};
1990break;
1991case 154:
1992 this.$={stmt:'dir', value:'BT'};
1993break;
1994case 155:
1995 this.$={stmt:'dir', value:'RL'};
1996break;
1997case 156:
1998 this.$={stmt:'dir', value:'LR'};
1999break;
2000}
2001},
2002table: [{3:1,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},{1:[3]},{1:[2,1]},{3:10,4:2,5:3,6:5,12:$V0,16:4,21:$V1,22:$V2,24:$V3},o($V4,$V5,{17:11}),{7:12,13:[1,13]},{16:14,21:$V1,22:$V2,24:$V3},{16:15,21:$V1,22:$V2,24:$V3},{25:[1,16],26:[1,17]},{13:[2,5]},{1:[2,2]},{1:[2,9],18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{8:60,10:[1,61],15:$Vz},o([10,15],[2,6]),o($V4,[2,17]),o($V4,[2,18]),o($V4,[2,19]),{20:[1,64],21:[1,65],22:$VA,27:63,30:66},o($VB,[2,11]),o($VB,[2,12]),o($VB,[2,13]),o($VB,[2,14]),o($VB,[2,15]),o($VB,[2,16]),{9:68,20:$VC,21:$VD,23:$VE,44:69,67:73,70:[1,74],71:[1,75]},{9:76,20:$VC,21:$VD,23:$VE},{9:77,20:$VC,21:$VD,23:$VE},{9:78,20:$VC,21:$VD,23:$VE},{9:79,20:$VC,21:$VD,23:$VE},{9:80,20:$VC,21:$VD,23:$VE},{9:82,20:$VC,21:$VD,22:[1,81],23:$VE},o($VB,[2,44]),o($VF,[2,51],{30:83,22:$VA}),{22:[1,84]},{22:[1,85]},{22:[1,86]},{22:[1,87]},{26:$VG,47:$VH,74:[1,91],81:$VI,87:90,88:[1,88],90:[1,89],95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VB,[2,153]),o($VB,[2,154]),o($VB,[2,155]),o($VB,[2,156]),o($VW,[2,52],{48:[1,110]}),o($VX,[2,69],{108:121,40:[1,111],47:$Vb,50:[1,112],52:[1,113],54:[1,114],56:[1,115],58:[1,116],60:[1,117],62:[1,118],63:[1,119],65:[1,120],81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy}),o($VY,[2,145]),o($VY,[2,170]),o($VY,[2,171]),o($VY,[2,172]),o($VY,[2,173]),o($VY,[2,174]),o($VY,[2,175]),o($VY,[2,176]),o($VY,[2,177]),o($VY,[2,178]),o($VY,[2,179]),o($VY,[2,180]),o($VY,[2,181]),o($VY,[2,182]),o($VY,[2,183]),o($VY,[2,184]),{9:122,20:$VC,21:$VD,23:$VE},{11:123,14:[1,124]},o($VZ,[2,8]),o($V4,[2,20]),o($V4,[2,26]),o($V4,[2,27]),{21:[1,125]},o($V_,[2,34],{30:126,22:$VA}),o($VB,[2,35]),{45:127,46:42,47:$Vb,49:43,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},o($V$,[2,45]),o($V$,[2,46]),o($V$,[2,47]),o($V01,[2,73],{68:128,69:[1,129],72:[1,130]}),{22:$V11,24:$V21,26:$V31,38:$V41,39:131,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o([47,69,72,81,95,96,99,100,101,103,104,114,115,116,117,118,119],[2,75]),o($VB,[2,36]),o($VB,[2,37]),o($VB,[2,38]),o($VB,[2,39]),o($VB,[2,40]),{22:$V11,24:$V21,26:$V31,38:$V41,39:155,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vk1,$V5,{17:156}),o($VF,[2,50],{47:$Vl1}),{26:$VG,47:$VH,81:$VI,87:158,92:[1,159],95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{85:[1,160],93:161,95:[1,162]},{26:$VG,47:$VH,81:$VI,85:[1,163],87:164,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{26:$VG,47:$VH,81:$VI,87:165,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,96],{22:[1,166],89:[1,167]}),o($VZ,[2,100],{22:[1,168]}),o($VZ,[2,104],{107:94,109:170,22:[1,169],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,106],{22:[1,171]}),o($Vm1,[2,147]),o($Vm1,[2,149]),o($Vm1,[2,150]),o($Vm1,[2,151]),o($Vm1,[2,152]),o($Vn1,[2,157]),o($Vn1,[2,158]),o($Vn1,[2,159]),o($Vn1,[2,160]),o($Vn1,[2,161]),o($Vn1,[2,162]),o($Vn1,[2,163]),o($Vn1,[2,164]),o($Vn1,[2,165]),o($Vn1,[2,166]),o($Vn1,[2,167]),o($Vn1,[2,168]),o($Vn1,[2,169]),{47:$Vb,49:172,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$V11,24:$V21,26:$V31,38:$V41,39:173,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:175,42:$V51,47:$VH,50:[1,174],62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:176,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:177,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:178,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:179,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:180,42:$V51,47:$VH,60:[1,181],62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:182,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:183,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:184,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VY,[2,146]),o($Vo1,[2,3]),{8:185,15:$Vz},{15:[2,7]},o($V4,[2,28]),o($V_,[2,33]),o($VF,[2,48],{30:186,22:$VA}),o($V01,[2,70],{22:[1,187]}),{22:[1,188]},{22:$V11,24:$V21,26:$V31,38:$V41,39:189,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,70:$V71,71:[1,190],73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vn1,[2,77]),o($Vn1,[2,79]),o($Vn1,[2,135]),o($Vn1,[2,136]),o($Vn1,[2,137]),o($Vn1,[2,138]),o($Vn1,[2,139]),o($Vn1,[2,140]),o($Vn1,[2,141]),o($Vn1,[2,142]),o($Vn1,[2,143]),o($Vn1,[2,144]),o($Vn1,[2,80]),o($Vn1,[2,81]),o($Vn1,[2,82]),o($Vn1,[2,83]),o($Vn1,[2,84]),o($Vn1,[2,85]),o($Vn1,[2,86]),o($Vn1,[2,87]),o($Vn1,[2,88]),o($Vn1,[2,89]),o($Vn1,[2,90]),{9:193,20:$VC,21:$VD,22:$V11,23:$VE,24:$V21,26:$V31,38:$V41,40:[1,192],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,194],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$VA,30:195},{22:[1,196],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:[1,197]},{22:[1,198]},{22:[1,199],96:[1,200]},o($Vp1,[2,118]),{22:[1,201]},{22:[1,202],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:[1,203],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:170,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{74:[1,204]},o($VZ,[2,98],{22:[1,205]}),{74:[1,206],91:[1,207]},{74:[1,208]},o($Vm1,[2,148]),{74:[1,209],91:[1,210]},o($VW,[2,54],{108:121,47:$Vb,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy}),{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,211],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:212,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,51:[1,213],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,53:[1,214],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,55:[1,215],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,57:[1,216],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,59:[1,217],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,61:[1,218],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,39:219,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,220],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,64:[1,221],66:[1,222],70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,64:[1,224],66:[1,223],70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{9:225,20:$VC,21:$VD,23:$VE},o($VF,[2,49],{47:$Vl1}),o($V01,[2,72]),o($V01,[2,71]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,62:$V61,70:$V71,72:[1,226],73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($V01,[2,74]),o($Vn1,[2,78]),{22:$V11,24:$V21,26:$V31,38:$V41,39:227,42:$V51,47:$VH,62:$V61,70:$V71,73:132,74:$V81,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($Vk1,$V5,{17:228}),o($VB,[2,43]),{46:229,47:$Vb,49:43,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$Vq1,76:$Vr1,86:230,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:244,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:245,92:$Vs1,94:[1,246],95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:247,92:$Vs1,94:[1,248],95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{95:[1,249]},{22:$Vq1,76:$Vr1,86:250,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:251,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{26:$VG,47:$VH,81:$VI,87:252,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,97]),{74:[1,253]},o($VZ,[2,101],{22:[1,254]}),o($VZ,[2,102]),o($VZ,[2,105]),o($VZ,[2,107],{22:[1,255]}),o($VZ,[2,108]),o($VX,[2,55]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,51:[1,256],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VX,[2,61]),o($VX,[2,57]),o($VX,[2,58]),o($VX,[2,59]),o($VX,[2,60]),o($VX,[2,62]),{22:$V11,24:$V21,26:$V31,38:$V41,42:$V51,47:$VH,61:[1,257],62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VX,[2,64]),o($VX,[2,65]),o($VX,[2,67]),o($VX,[2,66]),o($VX,[2,68]),o($Vo1,[2,4]),o([22,47,81,95,96,99,100,101,103,104,114,115,116,117,118,119],[2,76]),{22:$V11,24:$V21,26:$V31,38:$V41,41:[1,258],42:$V51,47:$VH,62:$V61,70:$V71,73:191,75:143,76:$V91,77:$Va1,78:$Vb1,79:$Vc1,80:$Vd1,81:$Ve1,82:$Vf1,84:134,85:$Vg1,95:$VJ,96:$VK,99:$VL,100:$VM,101:$Vh1,103:$VO,104:$VP,105:$Vi1,106:$Vj1,107:140,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,259],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},o($VW,[2,53]),o($VZ,[2,110],{96:$VB1}),o($VC1,[2,120],{98:261,22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1}),o($VD1,[2,122]),o($VD1,[2,124]),o($VD1,[2,125]),o($VD1,[2,126]),o($VD1,[2,127]),o($VD1,[2,128]),o($VD1,[2,129]),o($VD1,[2,130]),o($VD1,[2,131]),o($VD1,[2,132]),o($VD1,[2,133]),o($VD1,[2,134]),o($VZ,[2,111],{96:$VB1}),o($VZ,[2,112],{96:$VB1}),{22:[1,262]},o($VZ,[2,113],{96:$VB1}),{22:[1,263]},o($Vp1,[2,119]),o($VZ,[2,93],{96:$VB1}),o($VZ,[2,94],{96:$VB1}),o($VZ,[2,95],{107:94,109:170,26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,99]),{91:[1,264]},{91:[1,265]},{51:[1,266]},{61:[1,267]},{9:268,20:$VC,21:$VD,23:$VE},o($VB,[2,42]),{22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,97:269,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},o($VD1,[2,123]),{26:$VG,47:$VH,81:$VI,87:270,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},{26:$VG,47:$VH,81:$VI,87:271,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,107:94,109:92,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV},o($VZ,[2,103]),o($VZ,[2,109]),o($VX,[2,56]),o($VX,[2,63]),o($Vk1,$V5,{17:272}),o($VC1,[2,121],{98:261,22:$Vq1,76:$Vr1,92:$Vs1,95:$Vt1,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1}),o($VZ,[2,116],{107:94,109:170,22:[1,273],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),o($VZ,[2,117],{107:94,109:170,22:[1,274],26:$VG,47:$VH,81:$VI,95:$VJ,96:$VK,99:$VL,100:$VM,101:$VN,103:$VO,104:$VP,114:$VQ,115:$VR,116:$VS,117:$VT,118:$VU,119:$VV}),{18:18,19:19,20:$V6,21:$V7,22:$V8,23:$V9,32:24,33:25,34:26,35:27,36:28,37:29,38:$Va,42:[1,275],43:31,45:32,46:42,47:$Vb,49:43,76:$Vc,77:$Vd,78:$Ve,79:$Vf,80:$Vg,81:$Vh,95:$Vi,96:$Vj,99:$Vk,100:$Vl,101:$Vm,103:$Vn,104:$Vo,108:44,110:$Vp,111:$Vq,112:$Vr,113:$Vs,114:$Vt,115:$Vu,116:$Vv,117:$Vw,118:$Vx,119:$Vy},{22:$Vq1,76:$Vr1,86:276,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},{22:$Vq1,76:$Vr1,86:277,92:$Vs1,95:$Vt1,97:231,98:232,99:$Vu1,100:$Vv1,101:$Vw1,102:$Vx1,103:$Vy1,104:$Vz1,105:$VA1},o($VB,[2,41]),o($VZ,[2,114],{96:$VB1}),o($VZ,[2,115],{96:$VB1})],
2003defaultActions: {2:[2,1],9:[2,5],10:[2,2],124:[2,7]},
2004parseError: function parseError (str, hash) {
2005 if (hash.recoverable) {
2006 this.trace(str);
2007 } else {
2008 var error = new Error(str);
2009 error.hash = hash;
2010 throw error;
2011 }
2012},
2013parse: function parse(input) {
2014 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
2015 var args = lstack.slice.call(arguments, 1);
2016 var lexer = Object.create(this.lexer);
2017 var sharedState = { yy: {} };
2018 for (var k in this.yy) {
2019 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
2020 sharedState.yy[k] = this.yy[k];
2021 }
2022 }
2023 lexer.setInput(input, sharedState.yy);
2024 sharedState.yy.lexer = lexer;
2025 sharedState.yy.parser = this;
2026 if (typeof lexer.yylloc == 'undefined') {
2027 lexer.yylloc = {};
2028 }
2029 var yyloc = lexer.yylloc;
2030 lstack.push(yyloc);
2031 var ranges = lexer.options && lexer.options.ranges;
2032 if (typeof sharedState.yy.parseError === 'function') {
2033 this.parseError = sharedState.yy.parseError;
2034 } else {
2035 this.parseError = Object.getPrototypeOf(this).parseError;
2036 }
2037 function popStack(n) {
2038 stack.length = stack.length - 2 * n;
2039 vstack.length = vstack.length - n;
2040 lstack.length = lstack.length - n;
2041 }
2042 function lex() {
2043 var token;
2044 token = tstack.pop() || lexer.lex() || EOF;
2045 if (typeof token !== 'number') {
2046 if (token instanceof Array) {
2047 tstack = token;
2048 token = tstack.pop();
2049 }
2050 token = self.symbols_[token] || token;
2051 }
2052 return token;
2053 }
2054 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
2055 while (true) {
2056 state = stack[stack.length - 1];
2057 if (this.defaultActions[state]) {
2058 action = this.defaultActions[state];
2059 } else {
2060 if (symbol === null || typeof symbol == 'undefined') {
2061 symbol = lex();
2062 }
2063 action = table[state] && table[state][symbol];
2064 }
2065 if (typeof action === 'undefined' || !action.length || !action[0]) {
2066 var errStr = '';
2067 expected = [];
2068 for (p in table[state]) {
2069 if (this.terminals_[p] && p > TERROR) {
2070 expected.push('\'' + this.terminals_[p] + '\'');
2071 }
2072 }
2073 if (lexer.showPosition) {
2074 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
2075 } else {
2076 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
2077 }
2078 this.parseError(errStr, {
2079 text: lexer.match,
2080 token: this.terminals_[symbol] || symbol,
2081 line: lexer.yylineno,
2082 loc: yyloc,
2083 expected: expected
2084 });
2085 }
2086 if (action[0] instanceof Array && action.length > 1) {
2087 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
2088 }
2089 switch (action[0]) {
2090 case 1:
2091 stack.push(symbol);
2092 vstack.push(lexer.yytext);
2093 lstack.push(lexer.yylloc);
2094 stack.push(action[1]);
2095 symbol = null;
2096 if (!preErrorSymbol) {
2097 yyleng = lexer.yyleng;
2098 yytext = lexer.yytext;
2099 yylineno = lexer.yylineno;
2100 yyloc = lexer.yylloc;
2101 if (recovering > 0) {
2102 recovering--;
2103 }
2104 } else {
2105 symbol = preErrorSymbol;
2106 preErrorSymbol = null;
2107 }
2108 break;
2109 case 2:
2110 len = this.productions_[action[1]][1];
2111 yyval.$ = vstack[vstack.length - len];
2112 yyval._$ = {
2113 first_line: lstack[lstack.length - (len || 1)].first_line,
2114 last_line: lstack[lstack.length - 1].last_line,
2115 first_column: lstack[lstack.length - (len || 1)].first_column,
2116 last_column: lstack[lstack.length - 1].last_column
2117 };
2118 if (ranges) {
2119 yyval._$.range = [
2120 lstack[lstack.length - (len || 1)].range[0],
2121 lstack[lstack.length - 1].range[1]
2122 ];
2123 }
2124 r = this.performAction.apply(yyval, [
2125 yytext,
2126 yyleng,
2127 yylineno,
2128 sharedState.yy,
2129 action[1],
2130 vstack,
2131 lstack
2132 ].concat(args));
2133 if (typeof r !== 'undefined') {
2134 return r;
2135 }
2136 if (len) {
2137 stack = stack.slice(0, -1 * len * 2);
2138 vstack = vstack.slice(0, -1 * len);
2139 lstack = lstack.slice(0, -1 * len);
2140 }
2141 stack.push(this.productions_[action[1]][0]);
2142 vstack.push(yyval.$);
2143 lstack.push(yyval._$);
2144 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
2145 stack.push(newState);
2146 break;
2147 case 3:
2148 return true;
2149 }
2150 }
2151 return true;
2152}};
2153
2154/* generated by jison-lex 0.3.4 */
2155var lexer = (function(){
2156var lexer = ({
2157
2158EOF:1,
2159
2160parseError:function parseError(str, hash) {
2161 if (this.yy.parser) {
2162 this.yy.parser.parseError(str, hash);
2163 } else {
2164 throw new Error(str);
2165 }
2166 },
2167
2168// resets the lexer, sets new input
2169setInput:function (input, yy) {
2170 this.yy = yy || this.yy || {};
2171 this._input = input;
2172 this._more = this._backtrack = this.done = false;
2173 this.yylineno = this.yyleng = 0;
2174 this.yytext = this.matched = this.match = '';
2175 this.conditionStack = ['INITIAL'];
2176 this.yylloc = {
2177 first_line: 1,
2178 first_column: 0,
2179 last_line: 1,
2180 last_column: 0
2181 };
2182 if (this.options.ranges) {
2183 this.yylloc.range = [0,0];
2184 }
2185 this.offset = 0;
2186 return this;
2187 },
2188
2189// consumes and returns one char from the input
2190input:function () {
2191 var ch = this._input[0];
2192 this.yytext += ch;
2193 this.yyleng++;
2194 this.offset++;
2195 this.match += ch;
2196 this.matched += ch;
2197 var lines = ch.match(/(?:\r\n?|\n).*/g);
2198 if (lines) {
2199 this.yylineno++;
2200 this.yylloc.last_line++;
2201 } else {
2202 this.yylloc.last_column++;
2203 }
2204 if (this.options.ranges) {
2205 this.yylloc.range[1]++;
2206 }
2207
2208 this._input = this._input.slice(1);
2209 return ch;
2210 },
2211
2212// unshifts one char (or a string) into the input
2213unput:function (ch) {
2214 var len = ch.length;
2215 var lines = ch.split(/(?:\r\n?|\n)/g);
2216
2217 this._input = ch + this._input;
2218 this.yytext = this.yytext.substr(0, this.yytext.length - len);
2219 //this.yyleng -= len;
2220 this.offset -= len;
2221 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
2222 this.match = this.match.substr(0, this.match.length - 1);
2223 this.matched = this.matched.substr(0, this.matched.length - 1);
2224
2225 if (lines.length - 1) {
2226 this.yylineno -= lines.length - 1;
2227 }
2228 var r = this.yylloc.range;
2229
2230 this.yylloc = {
2231 first_line: this.yylloc.first_line,
2232 last_line: this.yylineno + 1,
2233 first_column: this.yylloc.first_column,
2234 last_column: lines ?
2235 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
2236 + oldLines[oldLines.length - lines.length].length - lines[0].length :
2237 this.yylloc.first_column - len
2238 };
2239
2240 if (this.options.ranges) {
2241 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
2242 }
2243 this.yyleng = this.yytext.length;
2244 return this;
2245 },
2246
2247// When called from action, caches matched text and appends it on next action
2248more:function () {
2249 this._more = true;
2250 return this;
2251 },
2252
2253// 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.
2254reject:function () {
2255 if (this.options.backtrack_lexer) {
2256 this._backtrack = true;
2257 } else {
2258 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(), {
2259 text: "",
2260 token: null,
2261 line: this.yylineno
2262 });
2263
2264 }
2265 return this;
2266 },
2267
2268// retain first n characters of the match
2269less:function (n) {
2270 this.unput(this.match.slice(n));
2271 },
2272
2273// displays already matched input, i.e. for error messages
2274pastInput:function () {
2275 var past = this.matched.substr(0, this.matched.length - this.match.length);
2276 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
2277 },
2278
2279// displays upcoming input, i.e. for error messages
2280upcomingInput:function () {
2281 var next = this.match;
2282 if (next.length < 20) {
2283 next += this._input.substr(0, 20-next.length);
2284 }
2285 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
2286 },
2287
2288// displays the character position where the lexing error occurred, i.e. for error messages
2289showPosition:function () {
2290 var pre = this.pastInput();
2291 var c = new Array(pre.length + 1).join("-");
2292 return pre + this.upcomingInput() + "\n" + c + "^";
2293 },
2294
2295// test the lexed token: return FALSE when not a match, otherwise return token
2296test_match:function(match, indexed_rule) {
2297 var token,
2298 lines,
2299 backup;
2300
2301 if (this.options.backtrack_lexer) {
2302 // save context
2303 backup = {
2304 yylineno: this.yylineno,
2305 yylloc: {
2306 first_line: this.yylloc.first_line,
2307 last_line: this.last_line,
2308 first_column: this.yylloc.first_column,
2309 last_column: this.yylloc.last_column
2310 },
2311 yytext: this.yytext,
2312 match: this.match,
2313 matches: this.matches,
2314 matched: this.matched,
2315 yyleng: this.yyleng,
2316 offset: this.offset,
2317 _more: this._more,
2318 _input: this._input,
2319 yy: this.yy,
2320 conditionStack: this.conditionStack.slice(0),
2321 done: this.done
2322 };
2323 if (this.options.ranges) {
2324 backup.yylloc.range = this.yylloc.range.slice(0);
2325 }
2326 }
2327
2328 lines = match[0].match(/(?:\r\n?|\n).*/g);
2329 if (lines) {
2330 this.yylineno += lines.length;
2331 }
2332 this.yylloc = {
2333 first_line: this.yylloc.last_line,
2334 last_line: this.yylineno + 1,
2335 first_column: this.yylloc.last_column,
2336 last_column: lines ?
2337 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
2338 this.yylloc.last_column + match[0].length
2339 };
2340 this.yytext += match[0];
2341 this.match += match[0];
2342 this.matches = match;
2343 this.yyleng = this.yytext.length;
2344 if (this.options.ranges) {
2345 this.yylloc.range = [this.offset, this.offset += this.yyleng];
2346 }
2347 this._more = false;
2348 this._backtrack = false;
2349 this._input = this._input.slice(match[0].length);
2350 this.matched += match[0];
2351 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
2352 if (this.done && this._input) {
2353 this.done = false;
2354 }
2355 if (token) {
2356 return token;
2357 } else if (this._backtrack) {
2358 // recover context
2359 for (var k in backup) {
2360 this[k] = backup[k];
2361 }
2362 return false; // rule action called reject() implying the next rule should be tested instead.
2363 }
2364 return false;
2365 },
2366
2367// return next match in input
2368next:function () {
2369 if (this.done) {
2370 return this.EOF;
2371 }
2372 if (!this._input) {
2373 this.done = true;
2374 }
2375
2376 var token,
2377 match,
2378 tempMatch,
2379 index;
2380 if (!this._more) {
2381 this.yytext = '';
2382 this.match = '';
2383 }
2384 var rules = this._currentRules();
2385 for (var i = 0; i < rules.length; i++) {
2386 tempMatch = this._input.match(this.rules[rules[i]]);
2387 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
2388 match = tempMatch;
2389 index = i;
2390 if (this.options.backtrack_lexer) {
2391 token = this.test_match(tempMatch, rules[i]);
2392 if (token !== false) {
2393 return token;
2394 } else if (this._backtrack) {
2395 match = false;
2396 continue; // rule action called reject() implying a rule MISmatch.
2397 } else {
2398 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
2399 return false;
2400 }
2401 } else if (!this.options.flex) {
2402 break;
2403 }
2404 }
2405 }
2406 if (match) {
2407 token = this.test_match(match, rules[index]);
2408 if (token !== false) {
2409 return token;
2410 }
2411 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
2412 return false;
2413 }
2414 if (this._input === "") {
2415 return this.EOF;
2416 } else {
2417 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
2418 text: "",
2419 token: null,
2420 line: this.yylineno
2421 });
2422 }
2423 },
2424
2425// return next match that has a token
2426lex:function lex () {
2427 var r = this.next();
2428 if (r) {
2429 return r;
2430 } else {
2431 return this.lex();
2432 }
2433 },
2434
2435// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
2436begin:function begin (condition) {
2437 this.conditionStack.push(condition);
2438 },
2439
2440// pop the previously active lexer condition state off the condition stack
2441popState:function popState () {
2442 var n = this.conditionStack.length - 1;
2443 if (n > 0) {
2444 return this.conditionStack.pop();
2445 } else {
2446 return this.conditionStack[0];
2447 }
2448 },
2449
2450// produce the lexer rule set which is active for the currently active lexer condition state
2451_currentRules:function _currentRules () {
2452 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
2453 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
2454 } else {
2455 return this.conditions["INITIAL"].rules;
2456 }
2457 },
2458
2459// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
2460topState:function topState (n) {
2461 n = this.conditionStack.length - 1 - Math.abs(n || 0);
2462 if (n >= 0) {
2463 return this.conditionStack[n];
2464 } else {
2465 return "INITIAL";
2466 }
2467 },
2468
2469// alias for begin(condition)
2470pushState:function pushState (condition) {
2471 this.begin(condition);
2472 },
2473
2474// return the number of states currently on the stack
2475stateStackSize:function stateStackSize() {
2476 return this.conditionStack.length;
2477 },
2478options: {},
2479performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
2480var YYSTATE=YY_START;
2481switch($avoiding_name_collisions) {
2482case 0: this.begin('open_directive'); return 12;
2483break;
2484case 1: this.begin('type_directive'); return 13;
2485break;
2486case 2: this.popState(); this.begin('arg_directive'); return 10;
2487break;
2488case 3: this.popState(); this.popState(); return 15;
2489break;
2490case 4:return 14;
2491break;
2492case 5:/* skip comments */
2493break;
2494case 6:/* skip comments */
2495break;
2496case 7:this.begin("string");
2497break;
2498case 8:this.popState();
2499break;
2500case 9:return "STR";
2501break;
2502case 10:return 76;
2503break;
2504case 11:return 85;
2505break;
2506case 12:return 77;
2507break;
2508case 13:return 94;
2509break;
2510case 14:return 78;
2511break;
2512case 15:return 79;
2513break;
2514case 16:this.begin("href");
2515break;
2516case 17:this.popState();
2517break;
2518case 18:return 90;
2519break;
2520case 19:this.begin("callbackname");
2521break;
2522case 20:this.popState();
2523break;
2524case 21:this.popState(); this.begin("callbackargs");
2525break;
2526case 22:return 88;
2527break;
2528case 23:this.popState();
2529break;
2530case 24:return 89;
2531break;
2532case 25:this.begin("click");
2533break;
2534case 26:this.popState();
2535break;
2536case 27:return 80;
2537break;
2538case 28:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
2539break;
2540case 29:if(yy.lex.firstGraph()){this.begin("dir");} return 24;
2541break;
2542case 30:return 38;
2543break;
2544case 31:return 42;
2545break;
2546case 32:return 91;
2547break;
2548case 33:return 91;
2549break;
2550case 34:return 91;
2551break;
2552case 35:return 91;
2553break;
2554case 36: this.popState(); return 25;
2555break;
2556case 37: this.popState(); return 26;
2557break;
2558case 38: this.popState(); return 26;
2559break;
2560case 39: this.popState(); return 26;
2561break;
2562case 40: this.popState(); return 26;
2563break;
2564case 41: this.popState(); return 26;
2565break;
2566case 42: this.popState(); return 26;
2567break;
2568case 43: this.popState(); return 26;
2569break;
2570case 44: this.popState(); return 26;
2571break;
2572case 45: this.popState(); return 26;
2573break;
2574case 46: this.popState(); return 26;
2575break;
2576case 47:return 110;
2577break;
2578case 48:return 111;
2579break;
2580case 49:return 112;
2581break;
2582case 50:return 113;
2583break;
2584case 51: return 95;
2585break;
2586case 52:return 103;
2587break;
2588case 53:return 48;
2589break;
2590case 54:return 100;
2591break;
2592case 55:return 47;
2593break;
2594case 56:return 20;
2595break;
2596case 57:return 96;
2597break;
2598case 58:return 118;
2599break;
2600case 59:return 71;
2601break;
2602case 60:return 71;
2603break;
2604case 61:return 71;
2605break;
2606case 62:return 70;
2607break;
2608case 63:return 70;
2609break;
2610case 64:return 70;
2611break;
2612case 65:return 52;
2613break;
2614case 66:return 53;
2615break;
2616case 67:return 54;
2617break;
2618case 68:return 55;
2619break;
2620case 69:return 56;
2621break;
2622case 70:return 57;
2623break;
2624case 71:return 58;
2625break;
2626case 72:return 59;
2627break;
2628case 73:return 101;
2629break;
2630case 74:return 104;
2631break;
2632case 75:return 119;
2633break;
2634case 76:return 116;
2635break;
2636case 77:return 105;
2637break;
2638case 78:return 117;
2639break;
2640case 79:return 117;
2641break;
2642case 80:return 106;
2643break;
2644case 81:return 62;
2645break;
2646case 82:return 82;
2647break;
2648case 83:return 'SEP';
2649break;
2650case 84:return 81;
2651break;
2652case 85:return 99;
2653break;
2654case 86:return 64;
2655break;
2656case 87:return 63;
2657break;
2658case 88:return 66;
2659break;
2660case 89:return 65;
2661break;
2662case 90:return 114;
2663break;
2664case 91:return 115;
2665break;
2666case 92:return 72;
2667break;
2668case 93:return 50;
2669break;
2670case 94:return 51;
2671break;
2672case 95:return 40;
2673break;
2674case 96:return 41;
2675break;
2676case 97:return 60
2677break;
2678case 98:return 61
2679break;
2680case 99:return 125;
2681break;
2682case 100:return 21;
2683break;
2684case 101:return 22;
2685break;
2686case 102:return 23;
2687break;
2688}
2689},
2690rules: [/^(?:%%\{)/,/^(?:((?:(?!\}%%)[^:.])*))/,/^(?::)/,/^(?:\}%%)/,/^(?:((?:(?!\}%%).|\n)*))/,/^(?:%%(?!\{)[^\n]*)/,/^(?:[^\}]%%[^\n]*)/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:style\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\b)/,/^(?:class\b)/,/^(?:href[\s]+["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:call[\s]+)/,/^(?:\([\s]*\))/,/^(?:\()/,/^(?:[^(]*)/,/^(?:\))/,/^(?:[^)]*)/,/^(?:click[\s]+)/,/^(?:[\s\n])/,/^(?:[^\s\n]*)/,/^(?:graph\b)/,/^(?:flowchart\b)/,/^(?:subgraph\b)/,/^(?:end\b\s*)/,/^(?:_self\b)/,/^(?:_blank\b)/,/^(?:_parent\b)/,/^(?:_top\b)/,/^(?:(\r?\n)*\s*\n)/,/^(?:\s*LR\b)/,/^(?:\s*RL\b)/,/^(?:\s*TB\b)/,/^(?:\s*BT\b)/,/^(?:\s*TD\b)/,/^(?:\s*BR\b)/,/^(?:\s*<)/,/^(?:\s*>)/,/^(?:\s*\^)/,/^(?:\s*v\b)/,/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?::::)/,/^(?::)/,/^(?:&)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\[)/,/^(?:\]\))/,/^(?:\[\[)/,/^(?:\]\])/,/^(?:\[\()/,/^(?:\)\])/,/^(?:-)/,/^(?:\.)/,/^(?:[\_])/,/^(?:\+)/,/^(?:%)/,/^(?:=)/,/^(?:=)/,/^(?:<)/,/^(?:>)/,/^(?:\^)/,/^(?:\\\|)/,/^(?:v\b)/,/^(?:[A-Za-z]+)/,/^(?:\\\])/,/^(?:\[\/)/,/^(?:\/\])/,/^(?:\[\\)/,/^(?:[!"#$%&'*+,-.`?\\_/])/,/^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:")/,/^(?:(\r?\n)+)/,/^(?:\s)/,/^(?:$)/],
2691conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"callbackargs":{"rules":[23,24],"inclusive":false},"callbackname":{"rules":[20,21,22],"inclusive":false},"href":{"rules":[17,18],"inclusive":false},"click":{"rules":[26,27],"inclusive":false},"vertex":{"rules":[],"inclusive":false},"dir":{"rules":[36,37,38,39,40,41,42,43,44,45,46],"inclusive":false},"string":{"rules":[8,9],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,10,11,12,13,14,15,16,19,25,28,29,30,31,32,33,34,35,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102],"inclusive":true}}
2692});
2693return lexer;
2694})();
2695parser.lexer = lexer;
2696function Parser () {
2697 this.yy = {};
2698}
2699Parser.prototype = parser;parser.Parser = Parser;
2700return new Parser;
2701})();
2702
2703
2704if (true) {
2705exports.parser = parser;
2706exports.Parser = parser.Parser;
2707exports.parse = function () { return parser.parse.apply(parser, arguments); };
2708exports.main = function commonjsMain (args) {
2709 if (!args[1]) {
2710 console.log('Usage: '+args[0]+' FILE');
2711 process.exit(1);
2712 }
2713 var source = (__webpack_require__(/*! fs */ "?dbae").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
2714 return exports.parser.parse(source);
2715};
2716if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
2717 exports.main(process.argv.slice(1));
2718}
2719}
2720
2721/***/ }),
2722
2723/***/ "./src/diagrams/gantt/parser/gantt.jison":
2724/*!***********************************************!*\
2725 !*** ./src/diagrams/gantt/parser/gantt.jison ***!
2726 \***********************************************/
2727/***/ ((module, exports, __webpack_require__) => {
2728
2729/* module decorator */ module = __webpack_require__.nmd(module);
2730/* parser generated by jison 0.4.18 */
2731/*
2732 Returns a Parser object of the following structure:
2733
2734 Parser: {
2735 yy: {}
2736 }
2737
2738 Parser.prototype: {
2739 yy: {},
2740 trace: function(),
2741 symbols_: {associative list: name ==> number},
2742 terminals_: {associative list: number ==> name},
2743 productions_: [...],
2744 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
2745 table: [...],
2746 defaultActions: {...},
2747 parseError: function(str, hash),
2748 parse: function(input),
2749
2750 lexer: {
2751 EOF: 1,
2752 parseError: function(str, hash),
2753 setInput: function(input),
2754 input: function(),
2755 unput: function(str),
2756 more: function(),
2757 less: function(n),
2758 pastInput: function(),
2759 upcomingInput: function(),
2760 showPosition: function(),
2761 test_match: function(regex_match_array, rule_index),
2762 next: function(),
2763 lex: function(),
2764 begin: function(condition),
2765 popState: function(),
2766 _currentRules: function(),
2767 topState: function(),
2768 pushState: function(condition),
2769
2770 options: {
2771 ranges: boolean (optional: true ==> token location info will include a .range[] member)
2772 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
2773 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
2774 },
2775
2776 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
2777 rules: [...],
2778 conditions: {associative list: name ==> set},
2779 }
2780 }
2781
2782
2783 token location info (@$, _$, etc.): {
2784 first_line: n,
2785 last_line: n,
2786 first_column: n,
2787 last_column: n,
2788 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
2789 }
2790
2791
2792 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
2793 text: (matched text)
2794 token: (the produced terminal token, if any)
2795 line: (yylineno)
2796 }
2797 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
2798 loc: (yylloc)
2799 expected: (string describing the set of expected tokens)
2800 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
2801 }
2802*/
2803var parser = (function(){
2804var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,5],$V2=[7,9,11,12,13,14,15,16,17,18,19,20,22,29,34],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,18],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,25],$Vd=[1,27],$Ve=[1,30],$Vf=[5,7,9,11,12,13,14,15,16,17,18,19,20,22,29,34];
2805var parser = {trace: function trace () { },
2806yy: {},
2807symbols_: {"error":2,"start":3,"directive":4,"gantt":5,"document":6,"EOF":7,"line":8,"SPACE":9,"statement":10,"NL":11,"dateFormat":12,"inclusiveEndDates":13,"topAxis":14,"axisFormat":15,"excludes":16,"includes":17,"todayMarker":18,"title":19,"section":20,"clickStatement":21,"taskTxt":22,"taskData":23,"openDirective":24,"typeDirective":25,"closeDirective":26,":":27,"argDirective":28,"click":29,"callbackname":30,"callbackargs":31,"href":32,"clickStatementDebug":33,"open_directive":34,"type_directive":35,"arg_directive":36,"close_directive":37,"$accept":0,"$end":1},
2808terminals_: {2:"error",5:"gantt",7:"EOF",9:"SPACE",11:"NL",12:"dateFormat",13:"inclusiveEndDates",14:"topAxis",15:"axisFormat",16:"excludes",17:"includes",18:"todayMarker",19:"title",20:"section",22:"taskTxt",23:"taskData",27:":",29:"click",30:"callbackname",31:"callbackargs",32:"href",34:"open_directive",35:"type_directive",36:"arg_directive",37:"close_directive"},
2809productions_: [0,[3,2],[3,3],[6,0],[6,2],[8,2],[8,1],[8,1],[8,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,1],[4,4],[4,6],[21,2],[21,3],[21,3],[21,4],[21,3],[21,4],[21,2],[33,2],[33,3],[33,3],[33,4],[33,3],[33,4],[33,2],[24,1],[25,1],[28,1],[26,1]],
2810performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
2811/* this == yyval */
2812
2813var $0 = $$.length - 1;
2814switch (yystate) {
2815case 2:
2816 return $$[$0-1];
2817break;
2818case 3:
2819 this.$ = []
2820break;
2821case 4:
2822$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
2823break;
2824case 5: case 6:
2825 this.$ = $$[$0]
2826break;
2827case 7: case 8:
2828 this.$=[];
2829break;
2830case 9:
2831yy.setDateFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
2832break;
2833case 10:
2834yy.enableInclusiveEndDates();this.$=$$[$0].substr(18);
2835break;
2836case 11:
2837yy.TopAxis();this.$=$$[$0].substr(8);
2838break;
2839case 12:
2840yy.setAxisFormat($$[$0].substr(11));this.$=$$[$0].substr(11);
2841break;
2842case 13:
2843yy.setExcludes($$[$0].substr(9));this.$=$$[$0].substr(9);
2844break;
2845case 14:
2846yy.setIncludes($$[$0].substr(9));this.$=$$[$0].substr(9);
2847break;
2848case 15:
2849yy.setTodayMarker($$[$0].substr(12));this.$=$$[$0].substr(12);
2850break;
2851case 16:
2852yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
2853break;
2854case 17:
2855yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
2856break;
2857case 19:
2858yy.addTask($$[$0-1],$$[$0]);this.$='task';
2859break;
2860case 23:
2861this.$ = $$[$0-1];yy.setClickEvent($$[$0-1], $$[$0], null);
2862break;
2863case 24:
2864this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], $$[$0]);
2865break;
2866case 25:
2867this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0-1], null);yy.setLink($$[$0-2],$$[$0]);
2868break;
2869case 26:
2870this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-2], $$[$0-1]);yy.setLink($$[$0-3],$$[$0]);
2871break;
2872case 27:
2873this.$ = $$[$0-2];yy.setClickEvent($$[$0-2], $$[$0], null);yy.setLink($$[$0-2],$$[$0-1]);
2874break;
2875case 28:
2876this.$ = $$[$0-3];yy.setClickEvent($$[$0-3], $$[$0-1], $$[$0]);yy.setLink($$[$0-3],$$[$0-2]);
2877break;
2878case 29:
2879this.$ = $$[$0-1];yy.setLink($$[$0-1], $$[$0]);
2880break;
2881case 30: case 36:
2882this.$=$$[$0-1] + ' ' + $$[$0];
2883break;
2884case 31: case 32: case 34:
2885this.$=$$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
2886break;
2887case 33: case 35:
2888this.$=$$[$0-3] + ' ' + $$[$0-2] + ' ' + $$[$0-1] + ' ' + $$[$0];
2889break;
2890case 37:
2891 yy.parseDirective('%%{', 'open_directive');
2892break;
2893case 38:
2894 yy.parseDirective($$[$0], 'type_directive');
2895break;
2896case 39:
2897 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
2898break;
2899case 40:
2900 yy.parseDirective('}%%', 'close_directive', 'gantt');
2901break;
2902}
2903},
2904table: [{3:1,4:2,5:$V0,24:4,34:$V1},{1:[3]},{3:6,4:2,5:$V0,24:4,34:$V1},o($V2,[2,3],{6:7}),{25:8,35:[1,9]},{35:[2,37]},{1:[2,1]},{4:26,7:[1,10],8:11,9:[1,12],10:13,11:[1,14],12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:$Vb,21:24,22:$Vc,24:4,29:$Vd,34:$V1},{26:28,27:[1,29],37:$Ve},o([27,37],[2,38]),o($V2,[2,8],{1:[2,2]}),o($V2,[2,4]),{4:26,10:31,12:$V3,13:$V4,14:$V5,15:$V6,16:$V7,17:$V8,18:$V9,19:$Va,20:$Vb,21:24,22:$Vc,24:4,29:$Vd,34:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,9]),o($V2,[2,10]),o($V2,[2,11]),o($V2,[2,12]),o($V2,[2,13]),o($V2,[2,14]),o($V2,[2,15]),o($V2,[2,16]),o($V2,[2,17]),o($V2,[2,18]),{23:[1,32]},o($V2,[2,20]),{30:[1,33],32:[1,34]},{11:[1,35]},{28:36,36:[1,37]},{11:[2,40]},o($V2,[2,5]),o($V2,[2,19]),o($V2,[2,23],{31:[1,38],32:[1,39]}),o($V2,[2,29],{30:[1,40]}),o($Vf,[2,21]),{26:41,37:$Ve},{37:[2,39]},o($V2,[2,24],{32:[1,42]}),o($V2,[2,25]),o($V2,[2,27],{31:[1,43]}),{11:[1,44]},o($V2,[2,26]),o($V2,[2,28]),o($Vf,[2,22])],
2905defaultActions: {5:[2,37],6:[2,1],30:[2,40],37:[2,39]},
2906parseError: function parseError (str, hash) {
2907 if (hash.recoverable) {
2908 this.trace(str);
2909 } else {
2910 var error = new Error(str);
2911 error.hash = hash;
2912 throw error;
2913 }
2914},
2915parse: function parse(input) {
2916 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
2917 var args = lstack.slice.call(arguments, 1);
2918 var lexer = Object.create(this.lexer);
2919 var sharedState = { yy: {} };
2920 for (var k in this.yy) {
2921 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
2922 sharedState.yy[k] = this.yy[k];
2923 }
2924 }
2925 lexer.setInput(input, sharedState.yy);
2926 sharedState.yy.lexer = lexer;
2927 sharedState.yy.parser = this;
2928 if (typeof lexer.yylloc == 'undefined') {
2929 lexer.yylloc = {};
2930 }
2931 var yyloc = lexer.yylloc;
2932 lstack.push(yyloc);
2933 var ranges = lexer.options && lexer.options.ranges;
2934 if (typeof sharedState.yy.parseError === 'function') {
2935 this.parseError = sharedState.yy.parseError;
2936 } else {
2937 this.parseError = Object.getPrototypeOf(this).parseError;
2938 }
2939 function popStack(n) {
2940 stack.length = stack.length - 2 * n;
2941 vstack.length = vstack.length - n;
2942 lstack.length = lstack.length - n;
2943 }
2944 function lex() {
2945 var token;
2946 token = tstack.pop() || lexer.lex() || EOF;
2947 if (typeof token !== 'number') {
2948 if (token instanceof Array) {
2949 tstack = token;
2950 token = tstack.pop();
2951 }
2952 token = self.symbols_[token] || token;
2953 }
2954 return token;
2955 }
2956 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
2957 while (true) {
2958 state = stack[stack.length - 1];
2959 if (this.defaultActions[state]) {
2960 action = this.defaultActions[state];
2961 } else {
2962 if (symbol === null || typeof symbol == 'undefined') {
2963 symbol = lex();
2964 }
2965 action = table[state] && table[state][symbol];
2966 }
2967 if (typeof action === 'undefined' || !action.length || !action[0]) {
2968 var errStr = '';
2969 expected = [];
2970 for (p in table[state]) {
2971 if (this.terminals_[p] && p > TERROR) {
2972 expected.push('\'' + this.terminals_[p] + '\'');
2973 }
2974 }
2975 if (lexer.showPosition) {
2976 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
2977 } else {
2978 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
2979 }
2980 this.parseError(errStr, {
2981 text: lexer.match,
2982 token: this.terminals_[symbol] || symbol,
2983 line: lexer.yylineno,
2984 loc: yyloc,
2985 expected: expected
2986 });
2987 }
2988 if (action[0] instanceof Array && action.length > 1) {
2989 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
2990 }
2991 switch (action[0]) {
2992 case 1:
2993 stack.push(symbol);
2994 vstack.push(lexer.yytext);
2995 lstack.push(lexer.yylloc);
2996 stack.push(action[1]);
2997 symbol = null;
2998 if (!preErrorSymbol) {
2999 yyleng = lexer.yyleng;
3000 yytext = lexer.yytext;
3001 yylineno = lexer.yylineno;
3002 yyloc = lexer.yylloc;
3003 if (recovering > 0) {
3004 recovering--;
3005 }
3006 } else {
3007 symbol = preErrorSymbol;
3008 preErrorSymbol = null;
3009 }
3010 break;
3011 case 2:
3012 len = this.productions_[action[1]][1];
3013 yyval.$ = vstack[vstack.length - len];
3014 yyval._$ = {
3015 first_line: lstack[lstack.length - (len || 1)].first_line,
3016 last_line: lstack[lstack.length - 1].last_line,
3017 first_column: lstack[lstack.length - (len || 1)].first_column,
3018 last_column: lstack[lstack.length - 1].last_column
3019 };
3020 if (ranges) {
3021 yyval._$.range = [
3022 lstack[lstack.length - (len || 1)].range[0],
3023 lstack[lstack.length - 1].range[1]
3024 ];
3025 }
3026 r = this.performAction.apply(yyval, [
3027 yytext,
3028 yyleng,
3029 yylineno,
3030 sharedState.yy,
3031 action[1],
3032 vstack,
3033 lstack
3034 ].concat(args));
3035 if (typeof r !== 'undefined') {
3036 return r;
3037 }
3038 if (len) {
3039 stack = stack.slice(0, -1 * len * 2);
3040 vstack = vstack.slice(0, -1 * len);
3041 lstack = lstack.slice(0, -1 * len);
3042 }
3043 stack.push(this.productions_[action[1]][0]);
3044 vstack.push(yyval.$);
3045 lstack.push(yyval._$);
3046 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
3047 stack.push(newState);
3048 break;
3049 case 3:
3050 return true;
3051 }
3052 }
3053 return true;
3054}};
3055
3056/* generated by jison-lex 0.3.4 */
3057var lexer = (function(){
3058var lexer = ({
3059
3060EOF:1,
3061
3062parseError:function parseError(str, hash) {
3063 if (this.yy.parser) {
3064 this.yy.parser.parseError(str, hash);
3065 } else {
3066 throw new Error(str);
3067 }
3068 },
3069
3070// resets the lexer, sets new input
3071setInput:function (input, yy) {
3072 this.yy = yy || this.yy || {};
3073 this._input = input;
3074 this._more = this._backtrack = this.done = false;
3075 this.yylineno = this.yyleng = 0;
3076 this.yytext = this.matched = this.match = '';
3077 this.conditionStack = ['INITIAL'];
3078 this.yylloc = {
3079 first_line: 1,
3080 first_column: 0,
3081 last_line: 1,
3082 last_column: 0
3083 };
3084 if (this.options.ranges) {
3085 this.yylloc.range = [0,0];
3086 }
3087 this.offset = 0;
3088 return this;
3089 },
3090
3091// consumes and returns one char from the input
3092input:function () {
3093 var ch = this._input[0];
3094 this.yytext += ch;
3095 this.yyleng++;
3096 this.offset++;
3097 this.match += ch;
3098 this.matched += ch;
3099 var lines = ch.match(/(?:\r\n?|\n).*/g);
3100 if (lines) {
3101 this.yylineno++;
3102 this.yylloc.last_line++;
3103 } else {
3104 this.yylloc.last_column++;
3105 }
3106 if (this.options.ranges) {
3107 this.yylloc.range[1]++;
3108 }
3109
3110 this._input = this._input.slice(1);
3111 return ch;
3112 },
3113
3114// unshifts one char (or a string) into the input
3115unput:function (ch) {
3116 var len = ch.length;
3117 var lines = ch.split(/(?:\r\n?|\n)/g);
3118
3119 this._input = ch + this._input;
3120 this.yytext = this.yytext.substr(0, this.yytext.length - len);
3121 //this.yyleng -= len;
3122 this.offset -= len;
3123 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
3124 this.match = this.match.substr(0, this.match.length - 1);
3125 this.matched = this.matched.substr(0, this.matched.length - 1);
3126
3127 if (lines.length - 1) {
3128 this.yylineno -= lines.length - 1;
3129 }
3130 var r = this.yylloc.range;
3131
3132 this.yylloc = {
3133 first_line: this.yylloc.first_line,
3134 last_line: this.yylineno + 1,
3135 first_column: this.yylloc.first_column,
3136 last_column: lines ?
3137 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
3138 + oldLines[oldLines.length - lines.length].length - lines[0].length :
3139 this.yylloc.first_column - len
3140 };
3141
3142 if (this.options.ranges) {
3143 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
3144 }
3145 this.yyleng = this.yytext.length;
3146 return this;
3147 },
3148
3149// When called from action, caches matched text and appends it on next action
3150more:function () {
3151 this._more = true;
3152 return this;
3153 },
3154
3155// 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.
3156reject:function () {
3157 if (this.options.backtrack_lexer) {
3158 this._backtrack = true;
3159 } else {
3160 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(), {
3161 text: "",
3162 token: null,
3163 line: this.yylineno
3164 });
3165
3166 }
3167 return this;
3168 },
3169
3170// retain first n characters of the match
3171less:function (n) {
3172 this.unput(this.match.slice(n));
3173 },
3174
3175// displays already matched input, i.e. for error messages
3176pastInput:function () {
3177 var past = this.matched.substr(0, this.matched.length - this.match.length);
3178 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
3179 },
3180
3181// displays upcoming input, i.e. for error messages
3182upcomingInput:function () {
3183 var next = this.match;
3184 if (next.length < 20) {
3185 next += this._input.substr(0, 20-next.length);
3186 }
3187 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
3188 },
3189
3190// displays the character position where the lexing error occurred, i.e. for error messages
3191showPosition:function () {
3192 var pre = this.pastInput();
3193 var c = new Array(pre.length + 1).join("-");
3194 return pre + this.upcomingInput() + "\n" + c + "^";
3195 },
3196
3197// test the lexed token: return FALSE when not a match, otherwise return token
3198test_match:function(match, indexed_rule) {
3199 var token,
3200 lines,
3201 backup;
3202
3203 if (this.options.backtrack_lexer) {
3204 // save context
3205 backup = {
3206 yylineno: this.yylineno,
3207 yylloc: {
3208 first_line: this.yylloc.first_line,
3209 last_line: this.last_line,
3210 first_column: this.yylloc.first_column,
3211 last_column: this.yylloc.last_column
3212 },
3213 yytext: this.yytext,
3214 match: this.match,
3215 matches: this.matches,
3216 matched: this.matched,
3217 yyleng: this.yyleng,
3218 offset: this.offset,
3219 _more: this._more,
3220 _input: this._input,
3221 yy: this.yy,
3222 conditionStack: this.conditionStack.slice(0),
3223 done: this.done
3224 };
3225 if (this.options.ranges) {
3226 backup.yylloc.range = this.yylloc.range.slice(0);
3227 }
3228 }
3229
3230 lines = match[0].match(/(?:\r\n?|\n).*/g);
3231 if (lines) {
3232 this.yylineno += lines.length;
3233 }
3234 this.yylloc = {
3235 first_line: this.yylloc.last_line,
3236 last_line: this.yylineno + 1,
3237 first_column: this.yylloc.last_column,
3238 last_column: lines ?
3239 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
3240 this.yylloc.last_column + match[0].length
3241 };
3242 this.yytext += match[0];
3243 this.match += match[0];
3244 this.matches = match;
3245 this.yyleng = this.yytext.length;
3246 if (this.options.ranges) {
3247 this.yylloc.range = [this.offset, this.offset += this.yyleng];
3248 }
3249 this._more = false;
3250 this._backtrack = false;
3251 this._input = this._input.slice(match[0].length);
3252 this.matched += match[0];
3253 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
3254 if (this.done && this._input) {
3255 this.done = false;
3256 }
3257 if (token) {
3258 return token;
3259 } else if (this._backtrack) {
3260 // recover context
3261 for (var k in backup) {
3262 this[k] = backup[k];
3263 }
3264 return false; // rule action called reject() implying the next rule should be tested instead.
3265 }
3266 return false;
3267 },
3268
3269// return next match in input
3270next:function () {
3271 if (this.done) {
3272 return this.EOF;
3273 }
3274 if (!this._input) {
3275 this.done = true;
3276 }
3277
3278 var token,
3279 match,
3280 tempMatch,
3281 index;
3282 if (!this._more) {
3283 this.yytext = '';
3284 this.match = '';
3285 }
3286 var rules = this._currentRules();
3287 for (var i = 0; i < rules.length; i++) {
3288 tempMatch = this._input.match(this.rules[rules[i]]);
3289 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
3290 match = tempMatch;
3291 index = i;
3292 if (this.options.backtrack_lexer) {
3293 token = this.test_match(tempMatch, rules[i]);
3294 if (token !== false) {
3295 return token;
3296 } else if (this._backtrack) {
3297 match = false;
3298 continue; // rule action called reject() implying a rule MISmatch.
3299 } else {
3300 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
3301 return false;
3302 }
3303 } else if (!this.options.flex) {
3304 break;
3305 }
3306 }
3307 }
3308 if (match) {
3309 token = this.test_match(match, rules[index]);
3310 if (token !== false) {
3311 return token;
3312 }
3313 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
3314 return false;
3315 }
3316 if (this._input === "") {
3317 return this.EOF;
3318 } else {
3319 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
3320 text: "",
3321 token: null,
3322 line: this.yylineno
3323 });
3324 }
3325 },
3326
3327// return next match that has a token
3328lex:function lex () {
3329 var r = this.next();
3330 if (r) {
3331 return r;
3332 } else {
3333 return this.lex();
3334 }
3335 },
3336
3337// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
3338begin:function begin (condition) {
3339 this.conditionStack.push(condition);
3340 },
3341
3342// pop the previously active lexer condition state off the condition stack
3343popState:function popState () {
3344 var n = this.conditionStack.length - 1;
3345 if (n > 0) {
3346 return this.conditionStack.pop();
3347 } else {
3348 return this.conditionStack[0];
3349 }
3350 },
3351
3352// produce the lexer rule set which is active for the currently active lexer condition state
3353_currentRules:function _currentRules () {
3354 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
3355 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
3356 } else {
3357 return this.conditions["INITIAL"].rules;
3358 }
3359 },
3360
3361// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
3362topState:function topState (n) {
3363 n = this.conditionStack.length - 1 - Math.abs(n || 0);
3364 if (n >= 0) {
3365 return this.conditionStack[n];
3366 } else {
3367 return "INITIAL";
3368 }
3369 },
3370
3371// alias for begin(condition)
3372pushState:function pushState (condition) {
3373 this.begin(condition);
3374 },
3375
3376// return the number of states currently on the stack
3377stateStackSize:function stateStackSize() {
3378 return this.conditionStack.length;
3379 },
3380options: {"case-insensitive":true},
3381performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
3382var YYSTATE=YY_START;
3383switch($avoiding_name_collisions) {
3384case 0: this.begin('open_directive'); return 34;
3385break;
3386case 1: this.begin('type_directive'); return 35;
3387break;
3388case 2: this.popState(); this.begin('arg_directive'); return 27;
3389break;
3390case 3: this.popState(); this.popState(); return 37;
3391break;
3392case 4:return 36;
3393break;
3394case 5:/* skip comments */
3395break;
3396case 6:/* skip comments */
3397break;
3398case 7:/* do nothing */
3399break;
3400case 8:return 11;
3401break;
3402case 9:/* skip whitespace */
3403break;
3404case 10:/* skip comments */
3405break;
3406case 11:/* skip comments */
3407break;
3408case 12:this.begin("href");
3409break;
3410case 13:this.popState();
3411break;
3412case 14:return 32;
3413break;
3414case 15:this.begin("callbackname");
3415break;
3416case 16:this.popState();
3417break;
3418case 17:this.popState(); this.begin("callbackargs");
3419break;
3420case 18:return 30;
3421break;
3422case 19:this.popState();
3423break;
3424case 20:return 31;
3425break;
3426case 21:this.begin("click");
3427break;
3428case 22:this.popState();
3429break;
3430case 23:return 29;
3431break;
3432case 24:return 5;
3433break;
3434case 25:return 12;
3435break;
3436case 26:return 13;
3437break;
3438case 27:return 14;
3439break;
3440case 28:return 15;
3441break;
3442case 29:return 17;
3443break;
3444case 30:return 16;
3445break;
3446case 31:return 18;
3447break;
3448case 32:return 'date';
3449break;
3450case 33:return 19;
3451break;
3452case 34:return 20;
3453break;
3454case 35:return 22;
3455break;
3456case 36:return 23;
3457break;
3458case 37:return 27;
3459break;
3460case 38:return 7;
3461break;
3462case 39:return 'INVALID';
3463break;
3464}
3465},
3466rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)*[^\n]*)/i,/^(?:[^\}]%%*[^\n]*)/i,/^(?:%%*[^\n]*[\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:href[\s]+["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:call[\s]+)/i,/^(?:\([\s]*\))/i,/^(?:\()/i,/^(?:[^(]*)/i,/^(?:\))/i,/^(?:[^)]*)/i,/^(?:click[\s]+)/i,/^(?:[\s\n])/i,/^(?:[^\s\n]*)/i,/^(?:gantt\b)/i,/^(?:dateFormat\s[^#\n;]+)/i,/^(?:inclusiveEndDates\b)/i,/^(?:topAxis\b)/i,/^(?:axisFormat\s[^#\n;]+)/i,/^(?:includes\s[^#\n;]+)/i,/^(?:excludes\s[^#\n;]+)/i,/^(?:todayMarker\s[^\n;]+)/i,/^(?:\d\d\d\d-\d\d-\d\d\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
3467conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"callbackargs":{"rules":[19,20],"inclusive":false},"callbackname":{"rules":[16,17,18],"inclusive":false},"href":{"rules":[13,14],"inclusive":false},"click":{"rules":[22,23],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,15,21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"inclusive":true}}
3468});
3469return lexer;
3470})();
3471parser.lexer = lexer;
3472function Parser () {
3473 this.yy = {};
3474}
3475Parser.prototype = parser;parser.Parser = Parser;
3476return new Parser;
3477})();
3478
3479
3480if (true) {
3481exports.parser = parser;
3482exports.Parser = parser.Parser;
3483exports.parse = function () { return parser.parse.apply(parser, arguments); };
3484exports.main = function commonjsMain (args) {
3485 if (!args[1]) {
3486 console.log('Usage: '+args[0]+' FILE');
3487 process.exit(1);
3488 }
3489 var source = (__webpack_require__(/*! fs */ "?8ed1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
3490 return exports.parser.parse(source);
3491};
3492if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
3493 exports.main(process.argv.slice(1));
3494}
3495}
3496
3497/***/ }),
3498
3499/***/ "./src/diagrams/git/parser/gitGraph.jison":
3500/*!************************************************!*\
3501 !*** ./src/diagrams/git/parser/gitGraph.jison ***!
3502 \************************************************/
3503/***/ ((module, exports, __webpack_require__) => {
3504
3505/* module decorator */ module = __webpack_require__.nmd(module);
3506/* parser generated by jison 0.4.18 */
3507/*
3508 Returns a Parser object of the following structure:
3509
3510 Parser: {
3511 yy: {}
3512 }
3513
3514 Parser.prototype: {
3515 yy: {},
3516 trace: function(),
3517 symbols_: {associative list: name ==> number},
3518 terminals_: {associative list: number ==> name},
3519 productions_: [...],
3520 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
3521 table: [...],
3522 defaultActions: {...},
3523 parseError: function(str, hash),
3524 parse: function(input),
3525
3526 lexer: {
3527 EOF: 1,
3528 parseError: function(str, hash),
3529 setInput: function(input),
3530 input: function(),
3531 unput: function(str),
3532 more: function(),
3533 less: function(n),
3534 pastInput: function(),
3535 upcomingInput: function(),
3536 showPosition: function(),
3537 test_match: function(regex_match_array, rule_index),
3538 next: function(),
3539 lex: function(),
3540 begin: function(condition),
3541 popState: function(),
3542 _currentRules: function(),
3543 topState: function(),
3544 pushState: function(condition),
3545
3546 options: {
3547 ranges: boolean (optional: true ==> token location info will include a .range[] member)
3548 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
3549 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
3550 },
3551
3552 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
3553 rules: [...],
3554 conditions: {associative list: name ==> set},
3555 }
3556 }
3557
3558
3559 token location info (@$, _$, etc.): {
3560 first_line: n,
3561 last_line: n,
3562 first_column: n,
3563 last_column: n,
3564 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
3565 }
3566
3567
3568 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
3569 text: (matched text)
3570 token: (the produced terminal token, if any)
3571 line: (yylineno)
3572 }
3573 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
3574 loc: (yylloc)
3575 expected: (string describing the set of expected tokens)
3576 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
3577 }
3578*/
3579var parser = (function(){
3580var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,3],$V1=[1,7],$V2=[7,12,15,17,19,20,21],$V3=[7,11,12,15,17,19,20,21],$V4=[2,20],$V5=[1,32];
3581var parser = {trace: function trace () { },
3582yy: {},
3583symbols_: {"error":2,"start":3,"GG":4,":":5,"document":6,"EOF":7,"DIR":8,"options":9,"body":10,"OPT":11,"NL":12,"line":13,"statement":14,"COMMIT":15,"commit_arg":16,"BRANCH":17,"ID":18,"CHECKOUT":19,"MERGE":20,"RESET":21,"reset_arg":22,"STR":23,"HEAD":24,"reset_parents":25,"CARET":26,"$accept":0,"$end":1},
3584terminals_: {2:"error",4:"GG",5:":",7:"EOF",8:"DIR",11:"OPT",12:"NL",15:"COMMIT",17:"BRANCH",18:"ID",19:"CHECKOUT",20:"MERGE",21:"RESET",23:"STR",24:"HEAD",26:"CARET"},
3585productions_: [0,[3,4],[3,5],[6,0],[6,2],[9,2],[9,1],[10,0],[10,2],[13,2],[13,1],[14,2],[14,2],[14,2],[14,2],[14,2],[16,0],[16,1],[22,2],[22,2],[25,0],[25,2]],
3586performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
3587/* this == yyval */
3588
3589var $0 = $$.length - 1;
3590switch (yystate) {
3591case 1:
3592 return $$[$0-1];
3593break;
3594case 2:
3595yy.setDirection($$[$0-3]); return $$[$0-1];
3596break;
3597case 4:
3598 yy.setOptions($$[$0-1]); this.$ = $$[$0]
3599break;
3600case 5:
3601$$[$0-1] +=$$[$0]; this.$=$$[$0-1]
3602break;
3603case 7:
3604this.$ = []
3605break;
3606case 8:
3607$$[$0-1].push($$[$0]); this.$=$$[$0-1];
3608break;
3609case 9:
3610this.$ =$$[$0-1]
3611break;
3612case 11:
3613yy.commit($$[$0])
3614break;
3615case 12:
3616yy.branch($$[$0])
3617break;
3618case 13:
3619yy.checkout($$[$0])
3620break;
3621case 14:
3622yy.merge($$[$0])
3623break;
3624case 15:
3625yy.reset($$[$0])
3626break;
3627case 16:
3628this.$ = ""
3629break;
3630case 17:
3631this.$=$$[$0]
3632break;
3633case 18:
3634this.$ = $$[$0-1]+ ":" + $$[$0]
3635break;
3636case 19:
3637this.$ = $$[$0-1]+ ":" + yy.count; yy.count = 0
3638break;
3639case 20:
3640yy.count = 0
3641break;
3642case 21:
3643 yy.count += 1
3644break;
3645}
3646},
3647table: [{3:1,4:[1,2]},{1:[3]},{5:[1,3],8:[1,4]},{6:5,7:$V0,9:6,12:$V1},{5:[1,8]},{7:[1,9]},o($V2,[2,7],{10:10,11:[1,11]}),o($V3,[2,6]),{6:12,7:$V0,9:6,12:$V1},{1:[2,1]},{7:[2,4],12:[1,15],13:13,14:14,15:[1,16],17:[1,17],19:[1,18],20:[1,19],21:[1,20]},o($V3,[2,5]),{7:[1,21]},o($V2,[2,8]),{12:[1,22]},o($V2,[2,10]),{12:[2,16],16:23,23:[1,24]},{18:[1,25]},{18:[1,26]},{18:[1,27]},{18:[1,30],22:28,24:[1,29]},{1:[2,2]},o($V2,[2,9]),{12:[2,11]},{12:[2,17]},{12:[2,12]},{12:[2,13]},{12:[2,14]},{12:[2,15]},{12:$V4,25:31,26:$V5},{12:$V4,25:33,26:$V5},{12:[2,18]},{12:$V4,25:34,26:$V5},{12:[2,19]},{12:[2,21]}],
3648defaultActions: {9:[2,1],21:[2,2],23:[2,11],24:[2,17],25:[2,12],26:[2,13],27:[2,14],28:[2,15],31:[2,18],33:[2,19],34:[2,21]},
3649parseError: function parseError (str, hash) {
3650 if (hash.recoverable) {
3651 this.trace(str);
3652 } else {
3653 var error = new Error(str);
3654 error.hash = hash;
3655 throw error;
3656 }
3657},
3658parse: function parse(input) {
3659 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
3660 var args = lstack.slice.call(arguments, 1);
3661 var lexer = Object.create(this.lexer);
3662 var sharedState = { yy: {} };
3663 for (var k in this.yy) {
3664 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
3665 sharedState.yy[k] = this.yy[k];
3666 }
3667 }
3668 lexer.setInput(input, sharedState.yy);
3669 sharedState.yy.lexer = lexer;
3670 sharedState.yy.parser = this;
3671 if (typeof lexer.yylloc == 'undefined') {
3672 lexer.yylloc = {};
3673 }
3674 var yyloc = lexer.yylloc;
3675 lstack.push(yyloc);
3676 var ranges = lexer.options && lexer.options.ranges;
3677 if (typeof sharedState.yy.parseError === 'function') {
3678 this.parseError = sharedState.yy.parseError;
3679 } else {
3680 this.parseError = Object.getPrototypeOf(this).parseError;
3681 }
3682 function popStack(n) {
3683 stack.length = stack.length - 2 * n;
3684 vstack.length = vstack.length - n;
3685 lstack.length = lstack.length - n;
3686 }
3687 function lex() {
3688 var token;
3689 token = tstack.pop() || lexer.lex() || EOF;
3690 if (typeof token !== 'number') {
3691 if (token instanceof Array) {
3692 tstack = token;
3693 token = tstack.pop();
3694 }
3695 token = self.symbols_[token] || token;
3696 }
3697 return token;
3698 }
3699 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
3700 while (true) {
3701 state = stack[stack.length - 1];
3702 if (this.defaultActions[state]) {
3703 action = this.defaultActions[state];
3704 } else {
3705 if (symbol === null || typeof symbol == 'undefined') {
3706 symbol = lex();
3707 }
3708 action = table[state] && table[state][symbol];
3709 }
3710 if (typeof action === 'undefined' || !action.length || !action[0]) {
3711 var errStr = '';
3712 expected = [];
3713 for (p in table[state]) {
3714 if (this.terminals_[p] && p > TERROR) {
3715 expected.push('\'' + this.terminals_[p] + '\'');
3716 }
3717 }
3718 if (lexer.showPosition) {
3719 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
3720 } else {
3721 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
3722 }
3723 this.parseError(errStr, {
3724 text: lexer.match,
3725 token: this.terminals_[symbol] || symbol,
3726 line: lexer.yylineno,
3727 loc: yyloc,
3728 expected: expected
3729 });
3730 }
3731 if (action[0] instanceof Array && action.length > 1) {
3732 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
3733 }
3734 switch (action[0]) {
3735 case 1:
3736 stack.push(symbol);
3737 vstack.push(lexer.yytext);
3738 lstack.push(lexer.yylloc);
3739 stack.push(action[1]);
3740 symbol = null;
3741 if (!preErrorSymbol) {
3742 yyleng = lexer.yyleng;
3743 yytext = lexer.yytext;
3744 yylineno = lexer.yylineno;
3745 yyloc = lexer.yylloc;
3746 if (recovering > 0) {
3747 recovering--;
3748 }
3749 } else {
3750 symbol = preErrorSymbol;
3751 preErrorSymbol = null;
3752 }
3753 break;
3754 case 2:
3755 len = this.productions_[action[1]][1];
3756 yyval.$ = vstack[vstack.length - len];
3757 yyval._$ = {
3758 first_line: lstack[lstack.length - (len || 1)].first_line,
3759 last_line: lstack[lstack.length - 1].last_line,
3760 first_column: lstack[lstack.length - (len || 1)].first_column,
3761 last_column: lstack[lstack.length - 1].last_column
3762 };
3763 if (ranges) {
3764 yyval._$.range = [
3765 lstack[lstack.length - (len || 1)].range[0],
3766 lstack[lstack.length - 1].range[1]
3767 ];
3768 }
3769 r = this.performAction.apply(yyval, [
3770 yytext,
3771 yyleng,
3772 yylineno,
3773 sharedState.yy,
3774 action[1],
3775 vstack,
3776 lstack
3777 ].concat(args));
3778 if (typeof r !== 'undefined') {
3779 return r;
3780 }
3781 if (len) {
3782 stack = stack.slice(0, -1 * len * 2);
3783 vstack = vstack.slice(0, -1 * len);
3784 lstack = lstack.slice(0, -1 * len);
3785 }
3786 stack.push(this.productions_[action[1]][0]);
3787 vstack.push(yyval.$);
3788 lstack.push(yyval._$);
3789 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
3790 stack.push(newState);
3791 break;
3792 case 3:
3793 return true;
3794 }
3795 }
3796 return true;
3797}};
3798/* generated by jison-lex 0.3.4 */
3799var lexer = (function(){
3800var lexer = ({
3801
3802EOF:1,
3803
3804parseError:function parseError(str, hash) {
3805 if (this.yy.parser) {
3806 this.yy.parser.parseError(str, hash);
3807 } else {
3808 throw new Error(str);
3809 }
3810 },
3811
3812// resets the lexer, sets new input
3813setInput:function (input, yy) {
3814 this.yy = yy || this.yy || {};
3815 this._input = input;
3816 this._more = this._backtrack = this.done = false;
3817 this.yylineno = this.yyleng = 0;
3818 this.yytext = this.matched = this.match = '';
3819 this.conditionStack = ['INITIAL'];
3820 this.yylloc = {
3821 first_line: 1,
3822 first_column: 0,
3823 last_line: 1,
3824 last_column: 0
3825 };
3826 if (this.options.ranges) {
3827 this.yylloc.range = [0,0];
3828 }
3829 this.offset = 0;
3830 return this;
3831 },
3832
3833// consumes and returns one char from the input
3834input:function () {
3835 var ch = this._input[0];
3836 this.yytext += ch;
3837 this.yyleng++;
3838 this.offset++;
3839 this.match += ch;
3840 this.matched += ch;
3841 var lines = ch.match(/(?:\r\n?|\n).*/g);
3842 if (lines) {
3843 this.yylineno++;
3844 this.yylloc.last_line++;
3845 } else {
3846 this.yylloc.last_column++;
3847 }
3848 if (this.options.ranges) {
3849 this.yylloc.range[1]++;
3850 }
3851
3852 this._input = this._input.slice(1);
3853 return ch;
3854 },
3855
3856// unshifts one char (or a string) into the input
3857unput:function (ch) {
3858 var len = ch.length;
3859 var lines = ch.split(/(?:\r\n?|\n)/g);
3860
3861 this._input = ch + this._input;
3862 this.yytext = this.yytext.substr(0, this.yytext.length - len);
3863 //this.yyleng -= len;
3864 this.offset -= len;
3865 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
3866 this.match = this.match.substr(0, this.match.length - 1);
3867 this.matched = this.matched.substr(0, this.matched.length - 1);
3868
3869 if (lines.length - 1) {
3870 this.yylineno -= lines.length - 1;
3871 }
3872 var r = this.yylloc.range;
3873
3874 this.yylloc = {
3875 first_line: this.yylloc.first_line,
3876 last_line: this.yylineno + 1,
3877 first_column: this.yylloc.first_column,
3878 last_column: lines ?
3879 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
3880 + oldLines[oldLines.length - lines.length].length - lines[0].length :
3881 this.yylloc.first_column - len
3882 };
3883
3884 if (this.options.ranges) {
3885 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
3886 }
3887 this.yyleng = this.yytext.length;
3888 return this;
3889 },
3890
3891// When called from action, caches matched text and appends it on next action
3892more:function () {
3893 this._more = true;
3894 return this;
3895 },
3896
3897// 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.
3898reject:function () {
3899 if (this.options.backtrack_lexer) {
3900 this._backtrack = true;
3901 } else {
3902 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(), {
3903 text: "",
3904 token: null,
3905 line: this.yylineno
3906 });
3907
3908 }
3909 return this;
3910 },
3911
3912// retain first n characters of the match
3913less:function (n) {
3914 this.unput(this.match.slice(n));
3915 },
3916
3917// displays already matched input, i.e. for error messages
3918pastInput:function () {
3919 var past = this.matched.substr(0, this.matched.length - this.match.length);
3920 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
3921 },
3922
3923// displays upcoming input, i.e. for error messages
3924upcomingInput:function () {
3925 var next = this.match;
3926 if (next.length < 20) {
3927 next += this._input.substr(0, 20-next.length);
3928 }
3929 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
3930 },
3931
3932// displays the character position where the lexing error occurred, i.e. for error messages
3933showPosition:function () {
3934 var pre = this.pastInput();
3935 var c = new Array(pre.length + 1).join("-");
3936 return pre + this.upcomingInput() + "\n" + c + "^";
3937 },
3938
3939// test the lexed token: return FALSE when not a match, otherwise return token
3940test_match:function(match, indexed_rule) {
3941 var token,
3942 lines,
3943 backup;
3944
3945 if (this.options.backtrack_lexer) {
3946 // save context
3947 backup = {
3948 yylineno: this.yylineno,
3949 yylloc: {
3950 first_line: this.yylloc.first_line,
3951 last_line: this.last_line,
3952 first_column: this.yylloc.first_column,
3953 last_column: this.yylloc.last_column
3954 },
3955 yytext: this.yytext,
3956 match: this.match,
3957 matches: this.matches,
3958 matched: this.matched,
3959 yyleng: this.yyleng,
3960 offset: this.offset,
3961 _more: this._more,
3962 _input: this._input,
3963 yy: this.yy,
3964 conditionStack: this.conditionStack.slice(0),
3965 done: this.done
3966 };
3967 if (this.options.ranges) {
3968 backup.yylloc.range = this.yylloc.range.slice(0);
3969 }
3970 }
3971
3972 lines = match[0].match(/(?:\r\n?|\n).*/g);
3973 if (lines) {
3974 this.yylineno += lines.length;
3975 }
3976 this.yylloc = {
3977 first_line: this.yylloc.last_line,
3978 last_line: this.yylineno + 1,
3979 first_column: this.yylloc.last_column,
3980 last_column: lines ?
3981 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
3982 this.yylloc.last_column + match[0].length
3983 };
3984 this.yytext += match[0];
3985 this.match += match[0];
3986 this.matches = match;
3987 this.yyleng = this.yytext.length;
3988 if (this.options.ranges) {
3989 this.yylloc.range = [this.offset, this.offset += this.yyleng];
3990 }
3991 this._more = false;
3992 this._backtrack = false;
3993 this._input = this._input.slice(match[0].length);
3994 this.matched += match[0];
3995 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
3996 if (this.done && this._input) {
3997 this.done = false;
3998 }
3999 if (token) {
4000 return token;
4001 } else if (this._backtrack) {
4002 // recover context
4003 for (var k in backup) {
4004 this[k] = backup[k];
4005 }
4006 return false; // rule action called reject() implying the next rule should be tested instead.
4007 }
4008 return false;
4009 },
4010
4011// return next match in input
4012next:function () {
4013 if (this.done) {
4014 return this.EOF;
4015 }
4016 if (!this._input) {
4017 this.done = true;
4018 }
4019
4020 var token,
4021 match,
4022 tempMatch,
4023 index;
4024 if (!this._more) {
4025 this.yytext = '';
4026 this.match = '';
4027 }
4028 var rules = this._currentRules();
4029 for (var i = 0; i < rules.length; i++) {
4030 tempMatch = this._input.match(this.rules[rules[i]]);
4031 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
4032 match = tempMatch;
4033 index = i;
4034 if (this.options.backtrack_lexer) {
4035 token = this.test_match(tempMatch, rules[i]);
4036 if (token !== false) {
4037 return token;
4038 } else if (this._backtrack) {
4039 match = false;
4040 continue; // rule action called reject() implying a rule MISmatch.
4041 } else {
4042 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
4043 return false;
4044 }
4045 } else if (!this.options.flex) {
4046 break;
4047 }
4048 }
4049 }
4050 if (match) {
4051 token = this.test_match(match, rules[index]);
4052 if (token !== false) {
4053 return token;
4054 }
4055 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
4056 return false;
4057 }
4058 if (this._input === "") {
4059 return this.EOF;
4060 } else {
4061 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
4062 text: "",
4063 token: null,
4064 line: this.yylineno
4065 });
4066 }
4067 },
4068
4069// return next match that has a token
4070lex:function lex () {
4071 var r = this.next();
4072 if (r) {
4073 return r;
4074 } else {
4075 return this.lex();
4076 }
4077 },
4078
4079// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
4080begin:function begin (condition) {
4081 this.conditionStack.push(condition);
4082 },
4083
4084// pop the previously active lexer condition state off the condition stack
4085popState:function popState () {
4086 var n = this.conditionStack.length - 1;
4087 if (n > 0) {
4088 return this.conditionStack.pop();
4089 } else {
4090 return this.conditionStack[0];
4091 }
4092 },
4093
4094// produce the lexer rule set which is active for the currently active lexer condition state
4095_currentRules:function _currentRules () {
4096 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
4097 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
4098 } else {
4099 return this.conditions["INITIAL"].rules;
4100 }
4101 },
4102
4103// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
4104topState:function topState (n) {
4105 n = this.conditionStack.length - 1 - Math.abs(n || 0);
4106 if (n >= 0) {
4107 return this.conditionStack[n];
4108 } else {
4109 return "INITIAL";
4110 }
4111 },
4112
4113// alias for begin(condition)
4114pushState:function pushState (condition) {
4115 this.begin(condition);
4116 },
4117
4118// return the number of states currently on the stack
4119stateStackSize:function stateStackSize() {
4120 return this.conditionStack.length;
4121 },
4122options: {"case-insensitive":true},
4123performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
4124var YYSTATE=YY_START;
4125switch($avoiding_name_collisions) {
4126case 0:return 12;
4127break;
4128case 1:/* skip all whitespace */
4129break;
4130case 2:/* skip comments */
4131break;
4132case 3:/* skip comments */
4133break;
4134case 4:return 4;
4135break;
4136case 5:return 15;
4137break;
4138case 6:return 17;
4139break;
4140case 7:return 20;
4141break;
4142case 8:return 21;
4143break;
4144case 9:return 19;
4145break;
4146case 10:return 8;
4147break;
4148case 11:return 8;
4149break;
4150case 12:return 5;
4151break;
4152case 13:return 26
4153break;
4154case 14:this.begin("options");
4155break;
4156case 15:this.popState();
4157break;
4158case 16:return 11;
4159break;
4160case 17:this.begin("string");
4161break;
4162case 18:this.popState();
4163break;
4164case 19:return 23;
4165break;
4166case 20:return 18;
4167break;
4168case 21:return 7;
4169break;
4170}
4171},
4172rules: [/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:gitGraph\b)/i,/^(?:commit\b)/i,/^(?:branch\b)/i,/^(?:merge\b)/i,/^(?:reset\b)/i,/^(?:checkout\b)/i,/^(?:LR\b)/i,/^(?:BT\b)/i,/^(?::)/i,/^(?:\^)/i,/^(?:options\r?\n)/i,/^(?:end\r?\n)/i,/^(?:[^\n]+\r?\n)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[a-zA-Z][-_\.a-zA-Z0-9]*[-_a-zA-Z0-9])/i,/^(?:$)/i],
4173conditions: {"options":{"rules":[15,16],"inclusive":false},"string":{"rules":[18,19],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,17,20,21],"inclusive":true}}
4174});
4175return lexer;
4176})();
4177parser.lexer = lexer;
4178function Parser () {
4179 this.yy = {};
4180}
4181Parser.prototype = parser;parser.Parser = Parser;
4182return new Parser;
4183})();
4184
4185
4186if (true) {
4187exports.parser = parser;
4188exports.Parser = parser.Parser;
4189exports.parse = function () { return parser.parse.apply(parser, arguments); };
4190exports.main = function commonjsMain (args) {
4191 if (!args[1]) {
4192 console.log('Usage: '+args[0]+' FILE');
4193 process.exit(1);
4194 }
4195 var source = (__webpack_require__(/*! fs */ "?2b40").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
4196 return exports.parser.parse(source);
4197};
4198if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
4199 exports.main(process.argv.slice(1));
4200}
4201}
4202
4203/***/ }),
4204
4205/***/ "./src/diagrams/info/parser/info.jison":
4206/*!*********************************************!*\
4207 !*** ./src/diagrams/info/parser/info.jison ***!
4208 \*********************************************/
4209/***/ ((module, exports, __webpack_require__) => {
4210
4211/* module decorator */ module = __webpack_require__.nmd(module);
4212/* parser generated by jison 0.4.18 */
4213/*
4214 Returns a Parser object of the following structure:
4215
4216 Parser: {
4217 yy: {}
4218 }
4219
4220 Parser.prototype: {
4221 yy: {},
4222 trace: function(),
4223 symbols_: {associative list: name ==> number},
4224 terminals_: {associative list: number ==> name},
4225 productions_: [...],
4226 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
4227 table: [...],
4228 defaultActions: {...},
4229 parseError: function(str, hash),
4230 parse: function(input),
4231
4232 lexer: {
4233 EOF: 1,
4234 parseError: function(str, hash),
4235 setInput: function(input),
4236 input: function(),
4237 unput: function(str),
4238 more: function(),
4239 less: function(n),
4240 pastInput: function(),
4241 upcomingInput: function(),
4242 showPosition: function(),
4243 test_match: function(regex_match_array, rule_index),
4244 next: function(),
4245 lex: function(),
4246 begin: function(condition),
4247 popState: function(),
4248 _currentRules: function(),
4249 topState: function(),
4250 pushState: function(condition),
4251
4252 options: {
4253 ranges: boolean (optional: true ==> token location info will include a .range[] member)
4254 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
4255 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
4256 },
4257
4258 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
4259 rules: [...],
4260 conditions: {associative list: name ==> set},
4261 }
4262 }
4263
4264
4265 token location info (@$, _$, etc.): {
4266 first_line: n,
4267 last_line: n,
4268 first_column: n,
4269 last_column: n,
4270 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
4271 }
4272
4273
4274 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
4275 text: (matched text)
4276 token: (the produced terminal token, if any)
4277 line: (yylineno)
4278 }
4279 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
4280 loc: (yylloc)
4281 expected: (string describing the set of expected tokens)
4282 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
4283 }
4284*/
4285var parser = (function(){
4286var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,9,10];
4287var parser = {trace: function trace () { },
4288yy: {},
4289symbols_: {"error":2,"start":3,"info":4,"document":5,"EOF":6,"line":7,"statement":8,"NL":9,"showInfo":10,"$accept":0,"$end":1},
4290terminals_: {2:"error",4:"info",6:"EOF",9:"NL",10:"showInfo"},
4291productions_: [0,[3,3],[5,0],[5,2],[7,1],[7,1],[8,1]],
4292performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
4293/* this == yyval */
4294
4295var $0 = $$.length - 1;
4296switch (yystate) {
4297case 1:
4298 return yy;
4299break;
4300case 4:
4301
4302break;
4303case 6:
4304 yy.setInfo(true);
4305break;
4306}
4307},
4308table: [{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:6,9:[1,7],10:[1,8]},{1:[2,1]},o($V0,[2,3]),o($V0,[2,4]),o($V0,[2,5]),o($V0,[2,6])],
4309defaultActions: {4:[2,1]},
4310parseError: function parseError (str, hash) {
4311 if (hash.recoverable) {
4312 this.trace(str);
4313 } else {
4314 var error = new Error(str);
4315 error.hash = hash;
4316 throw error;
4317 }
4318},
4319parse: function parse(input) {
4320 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
4321 var args = lstack.slice.call(arguments, 1);
4322 var lexer = Object.create(this.lexer);
4323 var sharedState = { yy: {} };
4324 for (var k in this.yy) {
4325 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
4326 sharedState.yy[k] = this.yy[k];
4327 }
4328 }
4329 lexer.setInput(input, sharedState.yy);
4330 sharedState.yy.lexer = lexer;
4331 sharedState.yy.parser = this;
4332 if (typeof lexer.yylloc == 'undefined') {
4333 lexer.yylloc = {};
4334 }
4335 var yyloc = lexer.yylloc;
4336 lstack.push(yyloc);
4337 var ranges = lexer.options && lexer.options.ranges;
4338 if (typeof sharedState.yy.parseError === 'function') {
4339 this.parseError = sharedState.yy.parseError;
4340 } else {
4341 this.parseError = Object.getPrototypeOf(this).parseError;
4342 }
4343 function popStack(n) {
4344 stack.length = stack.length - 2 * n;
4345 vstack.length = vstack.length - n;
4346 lstack.length = lstack.length - n;
4347 }
4348 function lex() {
4349 var token;
4350 token = tstack.pop() || lexer.lex() || EOF;
4351 if (typeof token !== 'number') {
4352 if (token instanceof Array) {
4353 tstack = token;
4354 token = tstack.pop();
4355 }
4356 token = self.symbols_[token] || token;
4357 }
4358 return token;
4359 }
4360 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
4361 while (true) {
4362 state = stack[stack.length - 1];
4363 if (this.defaultActions[state]) {
4364 action = this.defaultActions[state];
4365 } else {
4366 if (symbol === null || typeof symbol == 'undefined') {
4367 symbol = lex();
4368 }
4369 action = table[state] && table[state][symbol];
4370 }
4371 if (typeof action === 'undefined' || !action.length || !action[0]) {
4372 var errStr = '';
4373 expected = [];
4374 for (p in table[state]) {
4375 if (this.terminals_[p] && p > TERROR) {
4376 expected.push('\'' + this.terminals_[p] + '\'');
4377 }
4378 }
4379 if (lexer.showPosition) {
4380 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
4381 } else {
4382 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
4383 }
4384 this.parseError(errStr, {
4385 text: lexer.match,
4386 token: this.terminals_[symbol] || symbol,
4387 line: lexer.yylineno,
4388 loc: yyloc,
4389 expected: expected
4390 });
4391 }
4392 if (action[0] instanceof Array && action.length > 1) {
4393 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
4394 }
4395 switch (action[0]) {
4396 case 1:
4397 stack.push(symbol);
4398 vstack.push(lexer.yytext);
4399 lstack.push(lexer.yylloc);
4400 stack.push(action[1]);
4401 symbol = null;
4402 if (!preErrorSymbol) {
4403 yyleng = lexer.yyleng;
4404 yytext = lexer.yytext;
4405 yylineno = lexer.yylineno;
4406 yyloc = lexer.yylloc;
4407 if (recovering > 0) {
4408 recovering--;
4409 }
4410 } else {
4411 symbol = preErrorSymbol;
4412 preErrorSymbol = null;
4413 }
4414 break;
4415 case 2:
4416 len = this.productions_[action[1]][1];
4417 yyval.$ = vstack[vstack.length - len];
4418 yyval._$ = {
4419 first_line: lstack[lstack.length - (len || 1)].first_line,
4420 last_line: lstack[lstack.length - 1].last_line,
4421 first_column: lstack[lstack.length - (len || 1)].first_column,
4422 last_column: lstack[lstack.length - 1].last_column
4423 };
4424 if (ranges) {
4425 yyval._$.range = [
4426 lstack[lstack.length - (len || 1)].range[0],
4427 lstack[lstack.length - 1].range[1]
4428 ];
4429 }
4430 r = this.performAction.apply(yyval, [
4431 yytext,
4432 yyleng,
4433 yylineno,
4434 sharedState.yy,
4435 action[1],
4436 vstack,
4437 lstack
4438 ].concat(args));
4439 if (typeof r !== 'undefined') {
4440 return r;
4441 }
4442 if (len) {
4443 stack = stack.slice(0, -1 * len * 2);
4444 vstack = vstack.slice(0, -1 * len);
4445 lstack = lstack.slice(0, -1 * len);
4446 }
4447 stack.push(this.productions_[action[1]][0]);
4448 vstack.push(yyval.$);
4449 lstack.push(yyval._$);
4450 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
4451 stack.push(newState);
4452 break;
4453 case 3:
4454 return true;
4455 }
4456 }
4457 return true;
4458}};
4459
4460/* generated by jison-lex 0.3.4 */
4461var lexer = (function(){
4462var lexer = ({
4463
4464EOF:1,
4465
4466parseError:function parseError(str, hash) {
4467 if (this.yy.parser) {
4468 this.yy.parser.parseError(str, hash);
4469 } else {
4470 throw new Error(str);
4471 }
4472 },
4473
4474// resets the lexer, sets new input
4475setInput:function (input, yy) {
4476 this.yy = yy || this.yy || {};
4477 this._input = input;
4478 this._more = this._backtrack = this.done = false;
4479 this.yylineno = this.yyleng = 0;
4480 this.yytext = this.matched = this.match = '';
4481 this.conditionStack = ['INITIAL'];
4482 this.yylloc = {
4483 first_line: 1,
4484 first_column: 0,
4485 last_line: 1,
4486 last_column: 0
4487 };
4488 if (this.options.ranges) {
4489 this.yylloc.range = [0,0];
4490 }
4491 this.offset = 0;
4492 return this;
4493 },
4494
4495// consumes and returns one char from the input
4496input:function () {
4497 var ch = this._input[0];
4498 this.yytext += ch;
4499 this.yyleng++;
4500 this.offset++;
4501 this.match += ch;
4502 this.matched += ch;
4503 var lines = ch.match(/(?:\r\n?|\n).*/g);
4504 if (lines) {
4505 this.yylineno++;
4506 this.yylloc.last_line++;
4507 } else {
4508 this.yylloc.last_column++;
4509 }
4510 if (this.options.ranges) {
4511 this.yylloc.range[1]++;
4512 }
4513
4514 this._input = this._input.slice(1);
4515 return ch;
4516 },
4517
4518// unshifts one char (or a string) into the input
4519unput:function (ch) {
4520 var len = ch.length;
4521 var lines = ch.split(/(?:\r\n?|\n)/g);
4522
4523 this._input = ch + this._input;
4524 this.yytext = this.yytext.substr(0, this.yytext.length - len);
4525 //this.yyleng -= len;
4526 this.offset -= len;
4527 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
4528 this.match = this.match.substr(0, this.match.length - 1);
4529 this.matched = this.matched.substr(0, this.matched.length - 1);
4530
4531 if (lines.length - 1) {
4532 this.yylineno -= lines.length - 1;
4533 }
4534 var r = this.yylloc.range;
4535
4536 this.yylloc = {
4537 first_line: this.yylloc.first_line,
4538 last_line: this.yylineno + 1,
4539 first_column: this.yylloc.first_column,
4540 last_column: lines ?
4541 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
4542 + oldLines[oldLines.length - lines.length].length - lines[0].length :
4543 this.yylloc.first_column - len
4544 };
4545
4546 if (this.options.ranges) {
4547 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
4548 }
4549 this.yyleng = this.yytext.length;
4550 return this;
4551 },
4552
4553// When called from action, caches matched text and appends it on next action
4554more:function () {
4555 this._more = true;
4556 return this;
4557 },
4558
4559// 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.
4560reject:function () {
4561 if (this.options.backtrack_lexer) {
4562 this._backtrack = true;
4563 } else {
4564 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(), {
4565 text: "",
4566 token: null,
4567 line: this.yylineno
4568 });
4569
4570 }
4571 return this;
4572 },
4573
4574// retain first n characters of the match
4575less:function (n) {
4576 this.unput(this.match.slice(n));
4577 },
4578
4579// displays already matched input, i.e. for error messages
4580pastInput:function () {
4581 var past = this.matched.substr(0, this.matched.length - this.match.length);
4582 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
4583 },
4584
4585// displays upcoming input, i.e. for error messages
4586upcomingInput:function () {
4587 var next = this.match;
4588 if (next.length < 20) {
4589 next += this._input.substr(0, 20-next.length);
4590 }
4591 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
4592 },
4593
4594// displays the character position where the lexing error occurred, i.e. for error messages
4595showPosition:function () {
4596 var pre = this.pastInput();
4597 var c = new Array(pre.length + 1).join("-");
4598 return pre + this.upcomingInput() + "\n" + c + "^";
4599 },
4600
4601// test the lexed token: return FALSE when not a match, otherwise return token
4602test_match:function(match, indexed_rule) {
4603 var token,
4604 lines,
4605 backup;
4606
4607 if (this.options.backtrack_lexer) {
4608 // save context
4609 backup = {
4610 yylineno: this.yylineno,
4611 yylloc: {
4612 first_line: this.yylloc.first_line,
4613 last_line: this.last_line,
4614 first_column: this.yylloc.first_column,
4615 last_column: this.yylloc.last_column
4616 },
4617 yytext: this.yytext,
4618 match: this.match,
4619 matches: this.matches,
4620 matched: this.matched,
4621 yyleng: this.yyleng,
4622 offset: this.offset,
4623 _more: this._more,
4624 _input: this._input,
4625 yy: this.yy,
4626 conditionStack: this.conditionStack.slice(0),
4627 done: this.done
4628 };
4629 if (this.options.ranges) {
4630 backup.yylloc.range = this.yylloc.range.slice(0);
4631 }
4632 }
4633
4634 lines = match[0].match(/(?:\r\n?|\n).*/g);
4635 if (lines) {
4636 this.yylineno += lines.length;
4637 }
4638 this.yylloc = {
4639 first_line: this.yylloc.last_line,
4640 last_line: this.yylineno + 1,
4641 first_column: this.yylloc.last_column,
4642 last_column: lines ?
4643 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
4644 this.yylloc.last_column + match[0].length
4645 };
4646 this.yytext += match[0];
4647 this.match += match[0];
4648 this.matches = match;
4649 this.yyleng = this.yytext.length;
4650 if (this.options.ranges) {
4651 this.yylloc.range = [this.offset, this.offset += this.yyleng];
4652 }
4653 this._more = false;
4654 this._backtrack = false;
4655 this._input = this._input.slice(match[0].length);
4656 this.matched += match[0];
4657 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
4658 if (this.done && this._input) {
4659 this.done = false;
4660 }
4661 if (token) {
4662 return token;
4663 } else if (this._backtrack) {
4664 // recover context
4665 for (var k in backup) {
4666 this[k] = backup[k];
4667 }
4668 return false; // rule action called reject() implying the next rule should be tested instead.
4669 }
4670 return false;
4671 },
4672
4673// return next match in input
4674next:function () {
4675 if (this.done) {
4676 return this.EOF;
4677 }
4678 if (!this._input) {
4679 this.done = true;
4680 }
4681
4682 var token,
4683 match,
4684 tempMatch,
4685 index;
4686 if (!this._more) {
4687 this.yytext = '';
4688 this.match = '';
4689 }
4690 var rules = this._currentRules();
4691 for (var i = 0; i < rules.length; i++) {
4692 tempMatch = this._input.match(this.rules[rules[i]]);
4693 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
4694 match = tempMatch;
4695 index = i;
4696 if (this.options.backtrack_lexer) {
4697 token = this.test_match(tempMatch, rules[i]);
4698 if (token !== false) {
4699 return token;
4700 } else if (this._backtrack) {
4701 match = false;
4702 continue; // rule action called reject() implying a rule MISmatch.
4703 } else {
4704 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
4705 return false;
4706 }
4707 } else if (!this.options.flex) {
4708 break;
4709 }
4710 }
4711 }
4712 if (match) {
4713 token = this.test_match(match, rules[index]);
4714 if (token !== false) {
4715 return token;
4716 }
4717 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
4718 return false;
4719 }
4720 if (this._input === "") {
4721 return this.EOF;
4722 } else {
4723 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
4724 text: "",
4725 token: null,
4726 line: this.yylineno
4727 });
4728 }
4729 },
4730
4731// return next match that has a token
4732lex:function lex () {
4733 var r = this.next();
4734 if (r) {
4735 return r;
4736 } else {
4737 return this.lex();
4738 }
4739 },
4740
4741// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
4742begin:function begin (condition) {
4743 this.conditionStack.push(condition);
4744 },
4745
4746// pop the previously active lexer condition state off the condition stack
4747popState:function popState () {
4748 var n = this.conditionStack.length - 1;
4749 if (n > 0) {
4750 return this.conditionStack.pop();
4751 } else {
4752 return this.conditionStack[0];
4753 }
4754 },
4755
4756// produce the lexer rule set which is active for the currently active lexer condition state
4757_currentRules:function _currentRules () {
4758 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
4759 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
4760 } else {
4761 return this.conditions["INITIAL"].rules;
4762 }
4763 },
4764
4765// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
4766topState:function topState (n) {
4767 n = this.conditionStack.length - 1 - Math.abs(n || 0);
4768 if (n >= 0) {
4769 return this.conditionStack[n];
4770 } else {
4771 return "INITIAL";
4772 }
4773 },
4774
4775// alias for begin(condition)
4776pushState:function pushState (condition) {
4777 this.begin(condition);
4778 },
4779
4780// return the number of states currently on the stack
4781stateStackSize:function stateStackSize() {
4782 return this.conditionStack.length;
4783 },
4784options: {"case-insensitive":true},
4785performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
4786 // Pre-lexer code can go here
4787
4788var YYSTATE=YY_START;
4789switch($avoiding_name_collisions) {
4790case 0:return 4 ;
4791break;
4792case 1:return 9 ;
4793break;
4794case 2:return 'space';
4795break;
4796case 3:return 10;
4797break;
4798case 4:return 6 ;
4799break;
4800case 5:return 'TXT' ;
4801break;
4802}
4803},
4804rules: [/^(?:info\b)/i,/^(?:[\s\n\r]+)/i,/^(?:[\s]+)/i,/^(?:showInfo\b)/i,/^(?:$)/i,/^(?:.)/i],
4805conditions: {"INITIAL":{"rules":[0,1,2,3,4,5],"inclusive":true}}
4806});
4807return lexer;
4808})();
4809parser.lexer = lexer;
4810function Parser () {
4811 this.yy = {};
4812}
4813Parser.prototype = parser;parser.Parser = Parser;
4814return new Parser;
4815})();
4816
4817
4818if (true) {
4819exports.parser = parser;
4820exports.Parser = parser.Parser;
4821exports.parse = function () { return parser.parse.apply(parser, arguments); };
4822exports.main = function commonjsMain (args) {
4823 if (!args[1]) {
4824 console.log('Usage: '+args[0]+' FILE');
4825 process.exit(1);
4826 }
4827 var source = (__webpack_require__(/*! fs */ "?c5f1").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
4828 return exports.parser.parse(source);
4829};
4830if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
4831 exports.main(process.argv.slice(1));
4832}
4833}
4834
4835/***/ }),
4836
4837/***/ "./src/diagrams/pie/parser/pie.jison":
4838/*!*******************************************!*\
4839 !*** ./src/diagrams/pie/parser/pie.jison ***!
4840 \*******************************************/
4841/***/ ((module, exports, __webpack_require__) => {
4842
4843/* module decorator */ module = __webpack_require__.nmd(module);
4844/* parser generated by jison 0.4.18 */
4845/*
4846 Returns a Parser object of the following structure:
4847
4848 Parser: {
4849 yy: {}
4850 }
4851
4852 Parser.prototype: {
4853 yy: {},
4854 trace: function(),
4855 symbols_: {associative list: name ==> number},
4856 terminals_: {associative list: number ==> name},
4857 productions_: [...],
4858 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
4859 table: [...],
4860 defaultActions: {...},
4861 parseError: function(str, hash),
4862 parse: function(input),
4863
4864 lexer: {
4865 EOF: 1,
4866 parseError: function(str, hash),
4867 setInput: function(input),
4868 input: function(),
4869 unput: function(str),
4870 more: function(),
4871 less: function(n),
4872 pastInput: function(),
4873 upcomingInput: function(),
4874 showPosition: function(),
4875 test_match: function(regex_match_array, rule_index),
4876 next: function(),
4877 lex: function(),
4878 begin: function(condition),
4879 popState: function(),
4880 _currentRules: function(),
4881 topState: function(),
4882 pushState: function(condition),
4883
4884 options: {
4885 ranges: boolean (optional: true ==> token location info will include a .range[] member)
4886 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
4887 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
4888 },
4889
4890 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
4891 rules: [...],
4892 conditions: {associative list: name ==> set},
4893 }
4894 }
4895
4896
4897 token location info (@$, _$, etc.): {
4898 first_line: n,
4899 last_line: n,
4900 first_column: n,
4901 last_column: n,
4902 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
4903 }
4904
4905
4906 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
4907 text: (matched text)
4908 token: (the produced terminal token, if any)
4909 line: (yylineno)
4910 }
4911 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
4912 loc: (yylloc)
4913 expected: (string describing the set of expected tokens)
4914 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
4915 }
4916*/
4917var parser = (function(){
4918var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,4],$V1=[1,5],$V2=[1,6],$V3=[1,7],$V4=[1,9],$V5=[1,11,13,20,21,22,23],$V6=[2,5],$V7=[1,6,11,13,20,21,22,23],$V8=[20,21,22],$V9=[2,8],$Va=[1,18],$Vb=[1,19],$Vc=[1,24],$Vd=[6,20,21,22,23];
4919var parser = {trace: function trace () { },
4920yy: {},
4921symbols_: {"error":2,"start":3,"eol":4,"directive":5,"PIE":6,"document":7,"showData":8,"line":9,"statement":10,"txt":11,"value":12,"title":13,"title_value":14,"openDirective":15,"typeDirective":16,"closeDirective":17,":":18,"argDirective":19,"NEWLINE":20,";":21,"EOF":22,"open_directive":23,"type_directive":24,"arg_directive":25,"close_directive":26,"$accept":0,"$end":1},
4922terminals_: {2:"error",6:"PIE",8:"showData",11:"txt",12:"value",13:"title",14:"title_value",18:":",20:"NEWLINE",21:";",22:"EOF",23:"open_directive",24:"type_directive",25:"arg_directive",26:"close_directive"},
4923productions_: [0,[3,2],[3,2],[3,2],[3,3],[7,0],[7,2],[9,2],[10,0],[10,2],[10,2],[10,1],[5,3],[5,5],[4,1],[4,1],[4,1],[15,1],[16,1],[19,1],[17,1]],
4924performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
4925/* this == yyval */
4926
4927var $0 = $$.length - 1;
4928switch (yystate) {
4929case 4:
4930yy.setShowData(true);
4931break;
4932case 7:
4933 this.$ = $$[$0-1]
4934break;
4935case 9:
4936 yy.addSection($$[$0-1],yy.cleanupValue($$[$0]));
4937break;
4938case 10:
4939 this.$=$$[$0].trim();yy.setTitle(this.$);
4940break;
4941case 17:
4942 yy.parseDirective('%%{', 'open_directive');
4943break;
4944case 18:
4945 yy.parseDirective($$[$0], 'type_directive');
4946break;
4947case 19:
4948 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
4949break;
4950case 20:
4951 yy.parseDirective('}%%', 'close_directive', 'pie');
4952break;
4953}
4954},
4955table: [{3:1,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},{1:[3]},{3:10,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},{3:11,4:2,5:3,6:$V0,15:8,20:$V1,21:$V2,22:$V3,23:$V4},o($V5,$V6,{7:12,8:[1,13]}),o($V7,[2,14]),o($V7,[2,15]),o($V7,[2,16]),{16:14,24:[1,15]},{24:[2,17]},{1:[2,1]},{1:[2,2]},o($V8,$V9,{15:8,9:16,10:17,5:20,1:[2,3],11:$Va,13:$Vb,23:$V4}),o($V5,$V6,{7:21}),{17:22,18:[1,23],26:$Vc},o([18,26],[2,18]),o($V5,[2,6]),{4:25,20:$V1,21:$V2,22:$V3},{12:[1,26]},{14:[1,27]},o($V8,[2,11]),o($V8,$V9,{15:8,9:16,10:17,5:20,1:[2,4],11:$Va,13:$Vb,23:$V4}),o($Vd,[2,12]),{19:28,25:[1,29]},o($Vd,[2,20]),o($V5,[2,7]),o($V8,[2,9]),o($V8,[2,10]),{17:30,26:$Vc},{26:[2,19]},o($Vd,[2,13])],
4956defaultActions: {9:[2,17],10:[2,1],11:[2,2],29:[2,19]},
4957parseError: function parseError (str, hash) {
4958 if (hash.recoverable) {
4959 this.trace(str);
4960 } else {
4961 var error = new Error(str);
4962 error.hash = hash;
4963 throw error;
4964 }
4965},
4966parse: function parse(input) {
4967 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
4968 var args = lstack.slice.call(arguments, 1);
4969 var lexer = Object.create(this.lexer);
4970 var sharedState = { yy: {} };
4971 for (var k in this.yy) {
4972 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
4973 sharedState.yy[k] = this.yy[k];
4974 }
4975 }
4976 lexer.setInput(input, sharedState.yy);
4977 sharedState.yy.lexer = lexer;
4978 sharedState.yy.parser = this;
4979 if (typeof lexer.yylloc == 'undefined') {
4980 lexer.yylloc = {};
4981 }
4982 var yyloc = lexer.yylloc;
4983 lstack.push(yyloc);
4984 var ranges = lexer.options && lexer.options.ranges;
4985 if (typeof sharedState.yy.parseError === 'function') {
4986 this.parseError = sharedState.yy.parseError;
4987 } else {
4988 this.parseError = Object.getPrototypeOf(this).parseError;
4989 }
4990 function popStack(n) {
4991 stack.length = stack.length - 2 * n;
4992 vstack.length = vstack.length - n;
4993 lstack.length = lstack.length - n;
4994 }
4995 function lex() {
4996 var token;
4997 token = tstack.pop() || lexer.lex() || EOF;
4998 if (typeof token !== 'number') {
4999 if (token instanceof Array) {
5000 tstack = token;
5001 token = tstack.pop();
5002 }
5003 token = self.symbols_[token] || token;
5004 }
5005 return token;
5006 }
5007 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
5008 while (true) {
5009 state = stack[stack.length - 1];
5010 if (this.defaultActions[state]) {
5011 action = this.defaultActions[state];
5012 } else {
5013 if (symbol === null || typeof symbol == 'undefined') {
5014 symbol = lex();
5015 }
5016 action = table[state] && table[state][symbol];
5017 }
5018 if (typeof action === 'undefined' || !action.length || !action[0]) {
5019 var errStr = '';
5020 expected = [];
5021 for (p in table[state]) {
5022 if (this.terminals_[p] && p > TERROR) {
5023 expected.push('\'' + this.terminals_[p] + '\'');
5024 }
5025 }
5026 if (lexer.showPosition) {
5027 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
5028 } else {
5029 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
5030 }
5031 this.parseError(errStr, {
5032 text: lexer.match,
5033 token: this.terminals_[symbol] || symbol,
5034 line: lexer.yylineno,
5035 loc: yyloc,
5036 expected: expected
5037 });
5038 }
5039 if (action[0] instanceof Array && action.length > 1) {
5040 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
5041 }
5042 switch (action[0]) {
5043 case 1:
5044 stack.push(symbol);
5045 vstack.push(lexer.yytext);
5046 lstack.push(lexer.yylloc);
5047 stack.push(action[1]);
5048 symbol = null;
5049 if (!preErrorSymbol) {
5050 yyleng = lexer.yyleng;
5051 yytext = lexer.yytext;
5052 yylineno = lexer.yylineno;
5053 yyloc = lexer.yylloc;
5054 if (recovering > 0) {
5055 recovering--;
5056 }
5057 } else {
5058 symbol = preErrorSymbol;
5059 preErrorSymbol = null;
5060 }
5061 break;
5062 case 2:
5063 len = this.productions_[action[1]][1];
5064 yyval.$ = vstack[vstack.length - len];
5065 yyval._$ = {
5066 first_line: lstack[lstack.length - (len || 1)].first_line,
5067 last_line: lstack[lstack.length - 1].last_line,
5068 first_column: lstack[lstack.length - (len || 1)].first_column,
5069 last_column: lstack[lstack.length - 1].last_column
5070 };
5071 if (ranges) {
5072 yyval._$.range = [
5073 lstack[lstack.length - (len || 1)].range[0],
5074 lstack[lstack.length - 1].range[1]
5075 ];
5076 }
5077 r = this.performAction.apply(yyval, [
5078 yytext,
5079 yyleng,
5080 yylineno,
5081 sharedState.yy,
5082 action[1],
5083 vstack,
5084 lstack
5085 ].concat(args));
5086 if (typeof r !== 'undefined') {
5087 return r;
5088 }
5089 if (len) {
5090 stack = stack.slice(0, -1 * len * 2);
5091 vstack = vstack.slice(0, -1 * len);
5092 lstack = lstack.slice(0, -1 * len);
5093 }
5094 stack.push(this.productions_[action[1]][0]);
5095 vstack.push(yyval.$);
5096 lstack.push(yyval._$);
5097 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
5098 stack.push(newState);
5099 break;
5100 case 3:
5101 return true;
5102 }
5103 }
5104 return true;
5105}};
5106
5107/* generated by jison-lex 0.3.4 */
5108var lexer = (function(){
5109var lexer = ({
5110
5111EOF:1,
5112
5113parseError:function parseError(str, hash) {
5114 if (this.yy.parser) {
5115 this.yy.parser.parseError(str, hash);
5116 } else {
5117 throw new Error(str);
5118 }
5119 },
5120
5121// resets the lexer, sets new input
5122setInput:function (input, yy) {
5123 this.yy = yy || this.yy || {};
5124 this._input = input;
5125 this._more = this._backtrack = this.done = false;
5126 this.yylineno = this.yyleng = 0;
5127 this.yytext = this.matched = this.match = '';
5128 this.conditionStack = ['INITIAL'];
5129 this.yylloc = {
5130 first_line: 1,
5131 first_column: 0,
5132 last_line: 1,
5133 last_column: 0
5134 };
5135 if (this.options.ranges) {
5136 this.yylloc.range = [0,0];
5137 }
5138 this.offset = 0;
5139 return this;
5140 },
5141
5142// consumes and returns one char from the input
5143input:function () {
5144 var ch = this._input[0];
5145 this.yytext += ch;
5146 this.yyleng++;
5147 this.offset++;
5148 this.match += ch;
5149 this.matched += ch;
5150 var lines = ch.match(/(?:\r\n?|\n).*/g);
5151 if (lines) {
5152 this.yylineno++;
5153 this.yylloc.last_line++;
5154 } else {
5155 this.yylloc.last_column++;
5156 }
5157 if (this.options.ranges) {
5158 this.yylloc.range[1]++;
5159 }
5160
5161 this._input = this._input.slice(1);
5162 return ch;
5163 },
5164
5165// unshifts one char (or a string) into the input
5166unput:function (ch) {
5167 var len = ch.length;
5168 var lines = ch.split(/(?:\r\n?|\n)/g);
5169
5170 this._input = ch + this._input;
5171 this.yytext = this.yytext.substr(0, this.yytext.length - len);
5172 //this.yyleng -= len;
5173 this.offset -= len;
5174 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
5175 this.match = this.match.substr(0, this.match.length - 1);
5176 this.matched = this.matched.substr(0, this.matched.length - 1);
5177
5178 if (lines.length - 1) {
5179 this.yylineno -= lines.length - 1;
5180 }
5181 var r = this.yylloc.range;
5182
5183 this.yylloc = {
5184 first_line: this.yylloc.first_line,
5185 last_line: this.yylineno + 1,
5186 first_column: this.yylloc.first_column,
5187 last_column: lines ?
5188 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
5189 + oldLines[oldLines.length - lines.length].length - lines[0].length :
5190 this.yylloc.first_column - len
5191 };
5192
5193 if (this.options.ranges) {
5194 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
5195 }
5196 this.yyleng = this.yytext.length;
5197 return this;
5198 },
5199
5200// When called from action, caches matched text and appends it on next action
5201more:function () {
5202 this._more = true;
5203 return this;
5204 },
5205
5206// 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.
5207reject:function () {
5208 if (this.options.backtrack_lexer) {
5209 this._backtrack = true;
5210 } else {
5211 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(), {
5212 text: "",
5213 token: null,
5214 line: this.yylineno
5215 });
5216
5217 }
5218 return this;
5219 },
5220
5221// retain first n characters of the match
5222less:function (n) {
5223 this.unput(this.match.slice(n));
5224 },
5225
5226// displays already matched input, i.e. for error messages
5227pastInput:function () {
5228 var past = this.matched.substr(0, this.matched.length - this.match.length);
5229 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
5230 },
5231
5232// displays upcoming input, i.e. for error messages
5233upcomingInput:function () {
5234 var next = this.match;
5235 if (next.length < 20) {
5236 next += this._input.substr(0, 20-next.length);
5237 }
5238 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
5239 },
5240
5241// displays the character position where the lexing error occurred, i.e. for error messages
5242showPosition:function () {
5243 var pre = this.pastInput();
5244 var c = new Array(pre.length + 1).join("-");
5245 return pre + this.upcomingInput() + "\n" + c + "^";
5246 },
5247
5248// test the lexed token: return FALSE when not a match, otherwise return token
5249test_match:function(match, indexed_rule) {
5250 var token,
5251 lines,
5252 backup;
5253
5254 if (this.options.backtrack_lexer) {
5255 // save context
5256 backup = {
5257 yylineno: this.yylineno,
5258 yylloc: {
5259 first_line: this.yylloc.first_line,
5260 last_line: this.last_line,
5261 first_column: this.yylloc.first_column,
5262 last_column: this.yylloc.last_column
5263 },
5264 yytext: this.yytext,
5265 match: this.match,
5266 matches: this.matches,
5267 matched: this.matched,
5268 yyleng: this.yyleng,
5269 offset: this.offset,
5270 _more: this._more,
5271 _input: this._input,
5272 yy: this.yy,
5273 conditionStack: this.conditionStack.slice(0),
5274 done: this.done
5275 };
5276 if (this.options.ranges) {
5277 backup.yylloc.range = this.yylloc.range.slice(0);
5278 }
5279 }
5280
5281 lines = match[0].match(/(?:\r\n?|\n).*/g);
5282 if (lines) {
5283 this.yylineno += lines.length;
5284 }
5285 this.yylloc = {
5286 first_line: this.yylloc.last_line,
5287 last_line: this.yylineno + 1,
5288 first_column: this.yylloc.last_column,
5289 last_column: lines ?
5290 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
5291 this.yylloc.last_column + match[0].length
5292 };
5293 this.yytext += match[0];
5294 this.match += match[0];
5295 this.matches = match;
5296 this.yyleng = this.yytext.length;
5297 if (this.options.ranges) {
5298 this.yylloc.range = [this.offset, this.offset += this.yyleng];
5299 }
5300 this._more = false;
5301 this._backtrack = false;
5302 this._input = this._input.slice(match[0].length);
5303 this.matched += match[0];
5304 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
5305 if (this.done && this._input) {
5306 this.done = false;
5307 }
5308 if (token) {
5309 return token;
5310 } else if (this._backtrack) {
5311 // recover context
5312 for (var k in backup) {
5313 this[k] = backup[k];
5314 }
5315 return false; // rule action called reject() implying the next rule should be tested instead.
5316 }
5317 return false;
5318 },
5319
5320// return next match in input
5321next:function () {
5322 if (this.done) {
5323 return this.EOF;
5324 }
5325 if (!this._input) {
5326 this.done = true;
5327 }
5328
5329 var token,
5330 match,
5331 tempMatch,
5332 index;
5333 if (!this._more) {
5334 this.yytext = '';
5335 this.match = '';
5336 }
5337 var rules = this._currentRules();
5338 for (var i = 0; i < rules.length; i++) {
5339 tempMatch = this._input.match(this.rules[rules[i]]);
5340 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
5341 match = tempMatch;
5342 index = i;
5343 if (this.options.backtrack_lexer) {
5344 token = this.test_match(tempMatch, rules[i]);
5345 if (token !== false) {
5346 return token;
5347 } else if (this._backtrack) {
5348 match = false;
5349 continue; // rule action called reject() implying a rule MISmatch.
5350 } else {
5351 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
5352 return false;
5353 }
5354 } else if (!this.options.flex) {
5355 break;
5356 }
5357 }
5358 }
5359 if (match) {
5360 token = this.test_match(match, rules[index]);
5361 if (token !== false) {
5362 return token;
5363 }
5364 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
5365 return false;
5366 }
5367 if (this._input === "") {
5368 return this.EOF;
5369 } else {
5370 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
5371 text: "",
5372 token: null,
5373 line: this.yylineno
5374 });
5375 }
5376 },
5377
5378// return next match that has a token
5379lex:function lex () {
5380 var r = this.next();
5381 if (r) {
5382 return r;
5383 } else {
5384 return this.lex();
5385 }
5386 },
5387
5388// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
5389begin:function begin (condition) {
5390 this.conditionStack.push(condition);
5391 },
5392
5393// pop the previously active lexer condition state off the condition stack
5394popState:function popState () {
5395 var n = this.conditionStack.length - 1;
5396 if (n > 0) {
5397 return this.conditionStack.pop();
5398 } else {
5399 return this.conditionStack[0];
5400 }
5401 },
5402
5403// produce the lexer rule set which is active for the currently active lexer condition state
5404_currentRules:function _currentRules () {
5405 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
5406 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
5407 } else {
5408 return this.conditions["INITIAL"].rules;
5409 }
5410 },
5411
5412// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
5413topState:function topState (n) {
5414 n = this.conditionStack.length - 1 - Math.abs(n || 0);
5415 if (n >= 0) {
5416 return this.conditionStack[n];
5417 } else {
5418 return "INITIAL";
5419 }
5420 },
5421
5422// alias for begin(condition)
5423pushState:function pushState (condition) {
5424 this.begin(condition);
5425 },
5426
5427// return the number of states currently on the stack
5428stateStackSize:function stateStackSize() {
5429 return this.conditionStack.length;
5430 },
5431options: {"case-insensitive":true},
5432performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
5433var YYSTATE=YY_START;
5434switch($avoiding_name_collisions) {
5435case 0: this.begin('open_directive'); return 23;
5436break;
5437case 1: this.begin('type_directive'); return 24;
5438break;
5439case 2: this.popState(); this.begin('arg_directive'); return 18;
5440break;
5441case 3: this.popState(); this.popState(); return 26;
5442break;
5443case 4:return 25;
5444break;
5445case 5:/* skip comments */
5446break;
5447case 6:/* skip comments */{ /*console.log('');*/ }
5448break;
5449case 7:return 20;
5450break;
5451case 8:/* do nothing */
5452break;
5453case 9:/* ignore */
5454break;
5455case 10: this.begin("title");return 13;
5456break;
5457case 11: this.popState(); return "title_value";
5458break;
5459case 12: this.begin("string");
5460break;
5461case 13: this.popState();
5462break;
5463case 14: return "txt";
5464break;
5465case 15:return 6;
5466break;
5467case 16:return 8;
5468break;
5469case 17:return "value";
5470break;
5471case 18:return 22;
5472break;
5473}
5474},
5475rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[\s]+)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:pie\b)/i,/^(?:showData\b)/i,/^(?::[\s]*[\d]+(?:\.[\d]+)?)/i,/^(?:$)/i],
5476conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"title":{"rules":[11],"inclusive":false},"string":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,12,15,16,17,18],"inclusive":true}}
5477});
5478return lexer;
5479})();
5480parser.lexer = lexer;
5481function Parser () {
5482 this.yy = {};
5483}
5484Parser.prototype = parser;parser.Parser = Parser;
5485return new Parser;
5486})();
5487
5488
5489if (true) {
5490exports.parser = parser;
5491exports.Parser = parser.Parser;
5492exports.parse = function () { return parser.parse.apply(parser, arguments); };
5493exports.main = function commonjsMain (args) {
5494 if (!args[1]) {
5495 console.log('Usage: '+args[0]+' FILE');
5496 process.exit(1);
5497 }
5498 var source = (__webpack_require__(/*! fs */ "?a3fa").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
5499 return exports.parser.parse(source);
5500};
5501if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
5502 exports.main(process.argv.slice(1));
5503}
5504}
5505
5506/***/ }),
5507
5508/***/ "./src/diagrams/requirement/parser/requirementDiagram.jison":
5509/*!******************************************************************!*\
5510 !*** ./src/diagrams/requirement/parser/requirementDiagram.jison ***!
5511 \******************************************************************/
5512/***/ ((module, exports, __webpack_require__) => {
5513
5514/* module decorator */ module = __webpack_require__.nmd(module);
5515/* parser generated by jison 0.4.18 */
5516/*
5517 Returns a Parser object of the following structure:
5518
5519 Parser: {
5520 yy: {}
5521 }
5522
5523 Parser.prototype: {
5524 yy: {},
5525 trace: function(),
5526 symbols_: {associative list: name ==> number},
5527 terminals_: {associative list: number ==> name},
5528 productions_: [...],
5529 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
5530 table: [...],
5531 defaultActions: {...},
5532 parseError: function(str, hash),
5533 parse: function(input),
5534
5535 lexer: {
5536 EOF: 1,
5537 parseError: function(str, hash),
5538 setInput: function(input),
5539 input: function(),
5540 unput: function(str),
5541 more: function(),
5542 less: function(n),
5543 pastInput: function(),
5544 upcomingInput: function(),
5545 showPosition: function(),
5546 test_match: function(regex_match_array, rule_index),
5547 next: function(),
5548 lex: function(),
5549 begin: function(condition),
5550 popState: function(),
5551 _currentRules: function(),
5552 topState: function(),
5553 pushState: function(condition),
5554
5555 options: {
5556 ranges: boolean (optional: true ==> token location info will include a .range[] member)
5557 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
5558 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
5559 },
5560
5561 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
5562 rules: [...],
5563 conditions: {associative list: name ==> set},
5564 }
5565 }
5566
5567
5568 token location info (@$, _$, etc.): {
5569 first_line: n,
5570 last_line: n,
5571 first_column: n,
5572 last_column: n,
5573 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
5574 }
5575
5576
5577 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
5578 text: (matched text)
5579 token: (the produced terminal token, if any)
5580 line: (yylineno)
5581 }
5582 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
5583 loc: (yylloc)
5584 expected: (string describing the set of expected tokens)
5585 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
5586 }
5587*/
5588var parser = (function(){
5589var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,3],$V1=[1,5],$V2=[1,17],$V3=[2,10],$V4=[1,21],$V5=[1,22],$V6=[1,23],$V7=[1,24],$V8=[1,25],$V9=[1,26],$Va=[1,19],$Vb=[1,27],$Vc=[1,28],$Vd=[1,31],$Ve=[66,67],$Vf=[5,8,14,35,36,37,38,39,40,48,55,57,66,67],$Vg=[5,6,8,14,35,36,37,38,39,40,48,66,67],$Vh=[1,51],$Vi=[1,52],$Vj=[1,53],$Vk=[1,54],$Vl=[1,55],$Vm=[1,56],$Vn=[1,57],$Vo=[57,58],$Vp=[1,69],$Vq=[1,65],$Vr=[1,66],$Vs=[1,67],$Vt=[1,68],$Vu=[1,70],$Vv=[1,74],$Vw=[1,75],$Vx=[1,72],$Vy=[1,73],$Vz=[5,8,14,35,36,37,38,39,40,48,66,67];
5590var parser = {trace: function trace () { },
5591yy: {},
5592symbols_: {"error":2,"start":3,"directive":4,"NEWLINE":5,"RD":6,"diagram":7,"EOF":8,"openDirective":9,"typeDirective":10,"closeDirective":11,":":12,"argDirective":13,"open_directive":14,"type_directive":15,"arg_directive":16,"close_directive":17,"requirementDef":18,"elementDef":19,"relationshipDef":20,"requirementType":21,"requirementName":22,"STRUCT_START":23,"requirementBody":24,"ID":25,"COLONSEP":26,"id":27,"TEXT":28,"text":29,"RISK":30,"riskLevel":31,"VERIFYMTHD":32,"verifyType":33,"STRUCT_STOP":34,"REQUIREMENT":35,"FUNCTIONAL_REQUIREMENT":36,"INTERFACE_REQUIREMENT":37,"PERFORMANCE_REQUIREMENT":38,"PHYSICAL_REQUIREMENT":39,"DESIGN_CONSTRAINT":40,"LOW_RISK":41,"MED_RISK":42,"HIGH_RISK":43,"VERIFY_ANALYSIS":44,"VERIFY_DEMONSTRATION":45,"VERIFY_INSPECTION":46,"VERIFY_TEST":47,"ELEMENT":48,"elementName":49,"elementBody":50,"TYPE":51,"type":52,"DOCREF":53,"ref":54,"END_ARROW_L":55,"relationship":56,"LINE":57,"END_ARROW_R":58,"CONTAINS":59,"COPIES":60,"DERIVES":61,"SATISFIES":62,"VERIFIES":63,"REFINES":64,"TRACES":65,"unqString":66,"qString":67,"$accept":0,"$end":1},
5593terminals_: {2:"error",5:"NEWLINE",6:"RD",8:"EOF",12:":",14:"open_directive",15:"type_directive",16:"arg_directive",17:"close_directive",23:"STRUCT_START",25:"ID",26:"COLONSEP",28:"TEXT",30:"RISK",32:"VERIFYMTHD",34:"STRUCT_STOP",35:"REQUIREMENT",36:"FUNCTIONAL_REQUIREMENT",37:"INTERFACE_REQUIREMENT",38:"PERFORMANCE_REQUIREMENT",39:"PHYSICAL_REQUIREMENT",40:"DESIGN_CONSTRAINT",41:"LOW_RISK",42:"MED_RISK",43:"HIGH_RISK",44:"VERIFY_ANALYSIS",45:"VERIFY_DEMONSTRATION",46:"VERIFY_INSPECTION",47:"VERIFY_TEST",48:"ELEMENT",51:"TYPE",53:"DOCREF",55:"END_ARROW_L",57:"LINE",58:"END_ARROW_R",59:"CONTAINS",60:"COPIES",61:"DERIVES",62:"SATISFIES",63:"VERIFIES",64:"REFINES",65:"TRACES",66:"unqString",67:"qString"},
5594productions_: [0,[3,3],[3,2],[3,4],[4,3],[4,5],[9,1],[10,1],[13,1],[11,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[18,5],[24,5],[24,5],[24,5],[24,5],[24,2],[24,1],[21,1],[21,1],[21,1],[21,1],[21,1],[21,1],[31,1],[31,1],[31,1],[33,1],[33,1],[33,1],[33,1],[19,5],[50,5],[50,5],[50,2],[50,1],[20,5],[20,5],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[56,1],[22,1],[22,1],[27,1],[27,1],[29,1],[29,1],[49,1],[49,1],[52,1],[52,1],[54,1],[54,1]],
5595performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
5596/* this == yyval */
5597
5598var $0 = $$.length - 1;
5599switch (yystate) {
5600case 6:
5601 yy.parseDirective('%%{', 'open_directive');
5602break;
5603case 7:
5604 yy.parseDirective($$[$0], 'type_directive');
5605break;
5606case 8:
5607 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
5608break;
5609case 9:
5610 yy.parseDirective('}%%', 'close_directive', 'pie');
5611break;
5612case 10:
5613 this.$ = []
5614break;
5615case 16:
5616 yy.addRequirement($$[$0-3], $$[$0-4])
5617break;
5618case 17:
5619 yy.setNewReqId($$[$0-2]);
5620break;
5621case 18:
5622 yy.setNewReqText($$[$0-2]);
5623break;
5624case 19:
5625 yy.setNewReqRisk($$[$0-2]);
5626break;
5627case 20:
5628 yy.setNewReqVerifyMethod($$[$0-2]);
5629break;
5630case 23:
5631 this.$=yy.RequirementType.REQUIREMENT;
5632break;
5633case 24:
5634 this.$=yy.RequirementType.FUNCTIONAL_REQUIREMENT;
5635break;
5636case 25:
5637 this.$=yy.RequirementType.INTERFACE_REQUIREMENT;
5638break;
5639case 26:
5640 this.$=yy.RequirementType.PERFORMANCE_REQUIREMENT;
5641break;
5642case 27:
5643 this.$=yy.RequirementType.PHYSICAL_REQUIREMENT;
5644break;
5645case 28:
5646 this.$=yy.RequirementType.DESIGN_CONSTRAINT;
5647break;
5648case 29:
5649 this.$=yy.RiskLevel.LOW_RISK;
5650break;
5651case 30:
5652 this.$=yy.RiskLevel.MED_RISK;
5653break;
5654case 31:
5655 this.$=yy.RiskLevel.HIGH_RISK;
5656break;
5657case 32:
5658 this.$=yy.VerifyType.VERIFY_ANALYSIS;
5659break;
5660case 33:
5661 this.$=yy.VerifyType.VERIFY_DEMONSTRATION;
5662break;
5663case 34:
5664 this.$=yy.VerifyType.VERIFY_INSPECTION;
5665break;
5666case 35:
5667 this.$=yy.VerifyType.VERIFY_TEST;
5668break;
5669case 36:
5670 yy.addElement($$[$0-3])
5671break;
5672case 37:
5673 yy.setNewElementType($$[$0-2]);
5674break;
5675case 38:
5676 yy.setNewElementDocRef($$[$0-2]);
5677break;
5678case 41:
5679 yy.addRelationship($$[$0-2], $$[$0], $$[$0-4])
5680break;
5681case 42:
5682 yy.addRelationship($$[$0-2], $$[$0-4], $$[$0])
5683break;
5684case 43:
5685 this.$=yy.Relationships.CONTAINS;
5686break;
5687case 44:
5688 this.$=yy.Relationships.COPIES;
5689break;
5690case 45:
5691 this.$=yy.Relationships.DERIVES;
5692break;
5693case 46:
5694 this.$=yy.Relationships.SATISFIES;
5695break;
5696case 47:
5697 this.$=yy.Relationships.VERIFIES;
5698break;
5699case 48:
5700 this.$=yy.Relationships.REFINES;
5701break;
5702case 49:
5703 this.$=yy.Relationships.TRACES;
5704break;
5705}
5706},
5707table: [{3:1,4:2,6:$V0,9:4,14:$V1},{1:[3]},{3:7,4:2,5:[1,6],6:$V0,9:4,14:$V1},{5:[1,8]},{10:9,15:[1,10]},{15:[2,6]},{3:11,4:2,6:$V0,9:4,14:$V1},{1:[2,2]},{4:16,5:$V2,7:12,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{11:29,12:[1,30],17:$Vd},o([12,17],[2,7]),{1:[2,1]},{8:[1,32]},{4:16,5:$V2,7:33,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:34,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:35,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:36,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{4:16,5:$V2,7:37,8:$V3,9:4,14:$V1,18:13,19:14,20:15,21:18,27:20,35:$V4,36:$V5,37:$V6,38:$V7,39:$V8,40:$V9,48:$Va,66:$Vb,67:$Vc},{22:38,66:[1,39],67:[1,40]},{49:41,66:[1,42],67:[1,43]},{55:[1,44],57:[1,45]},o($Ve,[2,23]),o($Ve,[2,24]),o($Ve,[2,25]),o($Ve,[2,26]),o($Ve,[2,27]),o($Ve,[2,28]),o($Vf,[2,52]),o($Vf,[2,53]),o($Vg,[2,4]),{13:46,16:[1,47]},o($Vg,[2,9]),{1:[2,3]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{23:[1,48]},{23:[2,50]},{23:[2,51]},{23:[1,49]},{23:[2,56]},{23:[2,57]},{56:50,59:$Vh,60:$Vi,61:$Vj,62:$Vk,63:$Vl,64:$Vm,65:$Vn},{56:58,59:$Vh,60:$Vi,61:$Vj,62:$Vk,63:$Vl,64:$Vm,65:$Vn},{11:59,17:$Vd},{17:[2,8]},{5:[1,60]},{5:[1,61]},{57:[1,62]},o($Vo,[2,43]),o($Vo,[2,44]),o($Vo,[2,45]),o($Vo,[2,46]),o($Vo,[2,47]),o($Vo,[2,48]),o($Vo,[2,49]),{58:[1,63]},o($Vg,[2,5]),{5:$Vp,24:64,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vv,34:$Vw,50:71,51:$Vx,53:$Vy},{27:76,66:$Vb,67:$Vc},{27:77,66:$Vb,67:$Vc},o($Vz,[2,16]),{26:[1,78]},{26:[1,79]},{26:[1,80]},{26:[1,81]},{5:$Vp,24:82,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},o($Vz,[2,22]),o($Vz,[2,36]),{26:[1,83]},{26:[1,84]},{5:$Vv,34:$Vw,50:85,51:$Vx,53:$Vy},o($Vz,[2,40]),o($Vz,[2,41]),o($Vz,[2,42]),{27:86,66:$Vb,67:$Vc},{29:87,66:[1,88],67:[1,89]},{31:90,41:[1,91],42:[1,92],43:[1,93]},{33:94,44:[1,95],45:[1,96],46:[1,97],47:[1,98]},o($Vz,[2,21]),{52:99,66:[1,100],67:[1,101]},{54:102,66:[1,103],67:[1,104]},o($Vz,[2,39]),{5:[1,105]},{5:[1,106]},{5:[2,54]},{5:[2,55]},{5:[1,107]},{5:[2,29]},{5:[2,30]},{5:[2,31]},{5:[1,108]},{5:[2,32]},{5:[2,33]},{5:[2,34]},{5:[2,35]},{5:[1,109]},{5:[2,58]},{5:[2,59]},{5:[1,110]},{5:[2,60]},{5:[2,61]},{5:$Vp,24:111,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:112,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:113,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vp,24:114,25:$Vq,28:$Vr,30:$Vs,32:$Vt,34:$Vu},{5:$Vv,34:$Vw,50:115,51:$Vx,53:$Vy},{5:$Vv,34:$Vw,50:116,51:$Vx,53:$Vy},o($Vz,[2,17]),o($Vz,[2,18]),o($Vz,[2,19]),o($Vz,[2,20]),o($Vz,[2,37]),o($Vz,[2,38])],
5708defaultActions: {5:[2,6],7:[2,2],11:[2,1],32:[2,3],33:[2,11],34:[2,12],35:[2,13],36:[2,14],37:[2,15],39:[2,50],40:[2,51],42:[2,56],43:[2,57],47:[2,8],88:[2,54],89:[2,55],91:[2,29],92:[2,30],93:[2,31],95:[2,32],96:[2,33],97:[2,34],98:[2,35],100:[2,58],101:[2,59],103:[2,60],104:[2,61]},
5709parseError: function parseError (str, hash) {
5710 if (hash.recoverable) {
5711 this.trace(str);
5712 } else {
5713 var error = new Error(str);
5714 error.hash = hash;
5715 throw error;
5716 }
5717},
5718parse: function parse(input) {
5719 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
5720 var args = lstack.slice.call(arguments, 1);
5721 var lexer = Object.create(this.lexer);
5722 var sharedState = { yy: {} };
5723 for (var k in this.yy) {
5724 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
5725 sharedState.yy[k] = this.yy[k];
5726 }
5727 }
5728 lexer.setInput(input, sharedState.yy);
5729 sharedState.yy.lexer = lexer;
5730 sharedState.yy.parser = this;
5731 if (typeof lexer.yylloc == 'undefined') {
5732 lexer.yylloc = {};
5733 }
5734 var yyloc = lexer.yylloc;
5735 lstack.push(yyloc);
5736 var ranges = lexer.options && lexer.options.ranges;
5737 if (typeof sharedState.yy.parseError === 'function') {
5738 this.parseError = sharedState.yy.parseError;
5739 } else {
5740 this.parseError = Object.getPrototypeOf(this).parseError;
5741 }
5742 function popStack(n) {
5743 stack.length = stack.length - 2 * n;
5744 vstack.length = vstack.length - n;
5745 lstack.length = lstack.length - n;
5746 }
5747 function lex() {
5748 var token;
5749 token = tstack.pop() || lexer.lex() || EOF;
5750 if (typeof token !== 'number') {
5751 if (token instanceof Array) {
5752 tstack = token;
5753 token = tstack.pop();
5754 }
5755 token = self.symbols_[token] || token;
5756 }
5757 return token;
5758 }
5759 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
5760 while (true) {
5761 state = stack[stack.length - 1];
5762 if (this.defaultActions[state]) {
5763 action = this.defaultActions[state];
5764 } else {
5765 if (symbol === null || typeof symbol == 'undefined') {
5766 symbol = lex();
5767 }
5768 action = table[state] && table[state][symbol];
5769 }
5770 if (typeof action === 'undefined' || !action.length || !action[0]) {
5771 var errStr = '';
5772 expected = [];
5773 for (p in table[state]) {
5774 if (this.terminals_[p] && p > TERROR) {
5775 expected.push('\'' + this.terminals_[p] + '\'');
5776 }
5777 }
5778 if (lexer.showPosition) {
5779 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
5780 } else {
5781 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
5782 }
5783 this.parseError(errStr, {
5784 text: lexer.match,
5785 token: this.terminals_[symbol] || symbol,
5786 line: lexer.yylineno,
5787 loc: yyloc,
5788 expected: expected
5789 });
5790 }
5791 if (action[0] instanceof Array && action.length > 1) {
5792 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
5793 }
5794 switch (action[0]) {
5795 case 1:
5796 stack.push(symbol);
5797 vstack.push(lexer.yytext);
5798 lstack.push(lexer.yylloc);
5799 stack.push(action[1]);
5800 symbol = null;
5801 if (!preErrorSymbol) {
5802 yyleng = lexer.yyleng;
5803 yytext = lexer.yytext;
5804 yylineno = lexer.yylineno;
5805 yyloc = lexer.yylloc;
5806 if (recovering > 0) {
5807 recovering--;
5808 }
5809 } else {
5810 symbol = preErrorSymbol;
5811 preErrorSymbol = null;
5812 }
5813 break;
5814 case 2:
5815 len = this.productions_[action[1]][1];
5816 yyval.$ = vstack[vstack.length - len];
5817 yyval._$ = {
5818 first_line: lstack[lstack.length - (len || 1)].first_line,
5819 last_line: lstack[lstack.length - 1].last_line,
5820 first_column: lstack[lstack.length - (len || 1)].first_column,
5821 last_column: lstack[lstack.length - 1].last_column
5822 };
5823 if (ranges) {
5824 yyval._$.range = [
5825 lstack[lstack.length - (len || 1)].range[0],
5826 lstack[lstack.length - 1].range[1]
5827 ];
5828 }
5829 r = this.performAction.apply(yyval, [
5830 yytext,
5831 yyleng,
5832 yylineno,
5833 sharedState.yy,
5834 action[1],
5835 vstack,
5836 lstack
5837 ].concat(args));
5838 if (typeof r !== 'undefined') {
5839 return r;
5840 }
5841 if (len) {
5842 stack = stack.slice(0, -1 * len * 2);
5843 vstack = vstack.slice(0, -1 * len);
5844 lstack = lstack.slice(0, -1 * len);
5845 }
5846 stack.push(this.productions_[action[1]][0]);
5847 vstack.push(yyval.$);
5848 lstack.push(yyval._$);
5849 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
5850 stack.push(newState);
5851 break;
5852 case 3:
5853 return true;
5854 }
5855 }
5856 return true;
5857}};
5858
5859/* generated by jison-lex 0.3.4 */
5860var lexer = (function(){
5861var lexer = ({
5862
5863EOF:1,
5864
5865parseError:function parseError(str, hash) {
5866 if (this.yy.parser) {
5867 this.yy.parser.parseError(str, hash);
5868 } else {
5869 throw new Error(str);
5870 }
5871 },
5872
5873// resets the lexer, sets new input
5874setInput:function (input, yy) {
5875 this.yy = yy || this.yy || {};
5876 this._input = input;
5877 this._more = this._backtrack = this.done = false;
5878 this.yylineno = this.yyleng = 0;
5879 this.yytext = this.matched = this.match = '';
5880 this.conditionStack = ['INITIAL'];
5881 this.yylloc = {
5882 first_line: 1,
5883 first_column: 0,
5884 last_line: 1,
5885 last_column: 0
5886 };
5887 if (this.options.ranges) {
5888 this.yylloc.range = [0,0];
5889 }
5890 this.offset = 0;
5891 return this;
5892 },
5893
5894// consumes and returns one char from the input
5895input:function () {
5896 var ch = this._input[0];
5897 this.yytext += ch;
5898 this.yyleng++;
5899 this.offset++;
5900 this.match += ch;
5901 this.matched += ch;
5902 var lines = ch.match(/(?:\r\n?|\n).*/g);
5903 if (lines) {
5904 this.yylineno++;
5905 this.yylloc.last_line++;
5906 } else {
5907 this.yylloc.last_column++;
5908 }
5909 if (this.options.ranges) {
5910 this.yylloc.range[1]++;
5911 }
5912
5913 this._input = this._input.slice(1);
5914 return ch;
5915 },
5916
5917// unshifts one char (or a string) into the input
5918unput:function (ch) {
5919 var len = ch.length;
5920 var lines = ch.split(/(?:\r\n?|\n)/g);
5921
5922 this._input = ch + this._input;
5923 this.yytext = this.yytext.substr(0, this.yytext.length - len);
5924 //this.yyleng -= len;
5925 this.offset -= len;
5926 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
5927 this.match = this.match.substr(0, this.match.length - 1);
5928 this.matched = this.matched.substr(0, this.matched.length - 1);
5929
5930 if (lines.length - 1) {
5931 this.yylineno -= lines.length - 1;
5932 }
5933 var r = this.yylloc.range;
5934
5935 this.yylloc = {
5936 first_line: this.yylloc.first_line,
5937 last_line: this.yylineno + 1,
5938 first_column: this.yylloc.first_column,
5939 last_column: lines ?
5940 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
5941 + oldLines[oldLines.length - lines.length].length - lines[0].length :
5942 this.yylloc.first_column - len
5943 };
5944
5945 if (this.options.ranges) {
5946 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
5947 }
5948 this.yyleng = this.yytext.length;
5949 return this;
5950 },
5951
5952// When called from action, caches matched text and appends it on next action
5953more:function () {
5954 this._more = true;
5955 return this;
5956 },
5957
5958// 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.
5959reject:function () {
5960 if (this.options.backtrack_lexer) {
5961 this._backtrack = true;
5962 } else {
5963 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(), {
5964 text: "",
5965 token: null,
5966 line: this.yylineno
5967 });
5968
5969 }
5970 return this;
5971 },
5972
5973// retain first n characters of the match
5974less:function (n) {
5975 this.unput(this.match.slice(n));
5976 },
5977
5978// displays already matched input, i.e. for error messages
5979pastInput:function () {
5980 var past = this.matched.substr(0, this.matched.length - this.match.length);
5981 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
5982 },
5983
5984// displays upcoming input, i.e. for error messages
5985upcomingInput:function () {
5986 var next = this.match;
5987 if (next.length < 20) {
5988 next += this._input.substr(0, 20-next.length);
5989 }
5990 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
5991 },
5992
5993// displays the character position where the lexing error occurred, i.e. for error messages
5994showPosition:function () {
5995 var pre = this.pastInput();
5996 var c = new Array(pre.length + 1).join("-");
5997 return pre + this.upcomingInput() + "\n" + c + "^";
5998 },
5999
6000// test the lexed token: return FALSE when not a match, otherwise return token
6001test_match:function(match, indexed_rule) {
6002 var token,
6003 lines,
6004 backup;
6005
6006 if (this.options.backtrack_lexer) {
6007 // save context
6008 backup = {
6009 yylineno: this.yylineno,
6010 yylloc: {
6011 first_line: this.yylloc.first_line,
6012 last_line: this.last_line,
6013 first_column: this.yylloc.first_column,
6014 last_column: this.yylloc.last_column
6015 },
6016 yytext: this.yytext,
6017 match: this.match,
6018 matches: this.matches,
6019 matched: this.matched,
6020 yyleng: this.yyleng,
6021 offset: this.offset,
6022 _more: this._more,
6023 _input: this._input,
6024 yy: this.yy,
6025 conditionStack: this.conditionStack.slice(0),
6026 done: this.done
6027 };
6028 if (this.options.ranges) {
6029 backup.yylloc.range = this.yylloc.range.slice(0);
6030 }
6031 }
6032
6033 lines = match[0].match(/(?:\r\n?|\n).*/g);
6034 if (lines) {
6035 this.yylineno += lines.length;
6036 }
6037 this.yylloc = {
6038 first_line: this.yylloc.last_line,
6039 last_line: this.yylineno + 1,
6040 first_column: this.yylloc.last_column,
6041 last_column: lines ?
6042 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
6043 this.yylloc.last_column + match[0].length
6044 };
6045 this.yytext += match[0];
6046 this.match += match[0];
6047 this.matches = match;
6048 this.yyleng = this.yytext.length;
6049 if (this.options.ranges) {
6050 this.yylloc.range = [this.offset, this.offset += this.yyleng];
6051 }
6052 this._more = false;
6053 this._backtrack = false;
6054 this._input = this._input.slice(match[0].length);
6055 this.matched += match[0];
6056 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
6057 if (this.done && this._input) {
6058 this.done = false;
6059 }
6060 if (token) {
6061 return token;
6062 } else if (this._backtrack) {
6063 // recover context
6064 for (var k in backup) {
6065 this[k] = backup[k];
6066 }
6067 return false; // rule action called reject() implying the next rule should be tested instead.
6068 }
6069 return false;
6070 },
6071
6072// return next match in input
6073next:function () {
6074 if (this.done) {
6075 return this.EOF;
6076 }
6077 if (!this._input) {
6078 this.done = true;
6079 }
6080
6081 var token,
6082 match,
6083 tempMatch,
6084 index;
6085 if (!this._more) {
6086 this.yytext = '';
6087 this.match = '';
6088 }
6089 var rules = this._currentRules();
6090 for (var i = 0; i < rules.length; i++) {
6091 tempMatch = this._input.match(this.rules[rules[i]]);
6092 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
6093 match = tempMatch;
6094 index = i;
6095 if (this.options.backtrack_lexer) {
6096 token = this.test_match(tempMatch, rules[i]);
6097 if (token !== false) {
6098 return token;
6099 } else if (this._backtrack) {
6100 match = false;
6101 continue; // rule action called reject() implying a rule MISmatch.
6102 } else {
6103 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
6104 return false;
6105 }
6106 } else if (!this.options.flex) {
6107 break;
6108 }
6109 }
6110 }
6111 if (match) {
6112 token = this.test_match(match, rules[index]);
6113 if (token !== false) {
6114 return token;
6115 }
6116 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
6117 return false;
6118 }
6119 if (this._input === "") {
6120 return this.EOF;
6121 } else {
6122 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
6123 text: "",
6124 token: null,
6125 line: this.yylineno
6126 });
6127 }
6128 },
6129
6130// return next match that has a token
6131lex:function lex () {
6132 var r = this.next();
6133 if (r) {
6134 return r;
6135 } else {
6136 return this.lex();
6137 }
6138 },
6139
6140// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
6141begin:function begin (condition) {
6142 this.conditionStack.push(condition);
6143 },
6144
6145// pop the previously active lexer condition state off the condition stack
6146popState:function popState () {
6147 var n = this.conditionStack.length - 1;
6148 if (n > 0) {
6149 return this.conditionStack.pop();
6150 } else {
6151 return this.conditionStack[0];
6152 }
6153 },
6154
6155// produce the lexer rule set which is active for the currently active lexer condition state
6156_currentRules:function _currentRules () {
6157 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
6158 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
6159 } else {
6160 return this.conditions["INITIAL"].rules;
6161 }
6162 },
6163
6164// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
6165topState:function topState (n) {
6166 n = this.conditionStack.length - 1 - Math.abs(n || 0);
6167 if (n >= 0) {
6168 return this.conditionStack[n];
6169 } else {
6170 return "INITIAL";
6171 }
6172 },
6173
6174// alias for begin(condition)
6175pushState:function pushState (condition) {
6176 this.begin(condition);
6177 },
6178
6179// return the number of states currently on the stack
6180stateStackSize:function stateStackSize() {
6181 return this.conditionStack.length;
6182 },
6183options: {"case-insensitive":true},
6184performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
6185var YYSTATE=YY_START;
6186switch($avoiding_name_collisions) {
6187case 0: this.begin('open_directive'); return 14;
6188break;
6189case 1: this.begin('type_directive'); return 15;
6190break;
6191case 2: this.popState(); this.begin('arg_directive'); return 12;
6192break;
6193case 3: this.popState(); this.popState(); return 17;
6194break;
6195case 4:return 16;
6196break;
6197case 5:return 5;
6198break;
6199case 6:/* skip all whitespace */
6200break;
6201case 7:/* skip comments */
6202break;
6203case 8:/* skip comments */
6204break;
6205case 9:return 8;
6206break;
6207case 10:return 6;
6208break;
6209case 11:return 23;
6210break;
6211case 12:return 34;
6212break;
6213case 13:return 26;
6214break;
6215case 14:return 25;
6216break;
6217case 15:return 28;
6218break;
6219case 16:return 30;
6220break;
6221case 17:return 32;
6222break;
6223case 18:return 35;
6224break;
6225case 19:return 36;
6226break;
6227case 20:return 37;
6228break;
6229case 21:return 38;
6230break;
6231case 22:return 39;
6232break;
6233case 23:return 40;
6234break;
6235case 24:return 41;
6236break;
6237case 25:return 42;
6238break;
6239case 26:return 43;
6240break;
6241case 27:return 44;
6242break;
6243case 28:return 45;
6244break;
6245case 29:return 46;
6246break;
6247case 30:return 47;
6248break;
6249case 31:return 48;
6250break;
6251case 32:return 59;
6252break;
6253case 33:return 60;
6254break;
6255case 34:return 61;
6256break;
6257case 35:return 62;
6258break;
6259case 36:return 63;
6260break;
6261case 37:return 64;
6262break;
6263case 38:return 65;
6264break;
6265case 39:return 51;
6266break;
6267case 40:return 53;
6268break;
6269case 41:return 55;
6270break;
6271case 42:return 58;
6272break;
6273case 43:return 57;
6274break;
6275case 44: this.begin("string");
6276break;
6277case 45: this.popState();
6278break;
6279case 46: return "qString";
6280break;
6281case 47: yy_.yytext = yy_.yytext.trim(); return 66;
6282break;
6283}
6284},
6285rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
6286conditions: {"close_directive":{"rules":[],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"open_directive":{"rules":[1],"inclusive":false},"unqString":{"rules":[],"inclusive":false},"token":{"rules":[],"inclusive":false},"string":{"rules":[45,46],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,47],"inclusive":true}}
6287});
6288return lexer;
6289})();
6290parser.lexer = lexer;
6291function Parser () {
6292 this.yy = {};
6293}
6294Parser.prototype = parser;parser.Parser = Parser;
6295return new Parser;
6296})();
6297
6298
6299if (true) {
6300exports.parser = parser;
6301exports.Parser = parser.Parser;
6302exports.parse = function () { return parser.parse.apply(parser, arguments); };
6303exports.main = function commonjsMain (args) {
6304 if (!args[1]) {
6305 console.log('Usage: '+args[0]+' FILE');
6306 process.exit(1);
6307 }
6308 var source = (__webpack_require__(/*! fs */ "?ebf4").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
6309 return exports.parser.parse(source);
6310};
6311if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
6312 exports.main(process.argv.slice(1));
6313}
6314}
6315
6316/***/ }),
6317
6318/***/ "./src/diagrams/sequence/parser/sequenceDiagram.jison":
6319/*!************************************************************!*\
6320 !*** ./src/diagrams/sequence/parser/sequenceDiagram.jison ***!
6321 \************************************************************/
6322/***/ ((module, exports, __webpack_require__) => {
6323
6324/* module decorator */ module = __webpack_require__.nmd(module);
6325/* parser generated by jison 0.4.18 */
6326/*
6327 Returns a Parser object of the following structure:
6328
6329 Parser: {
6330 yy: {}
6331 }
6332
6333 Parser.prototype: {
6334 yy: {},
6335 trace: function(),
6336 symbols_: {associative list: name ==> number},
6337 terminals_: {associative list: number ==> name},
6338 productions_: [...],
6339 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
6340 table: [...],
6341 defaultActions: {...},
6342 parseError: function(str, hash),
6343 parse: function(input),
6344
6345 lexer: {
6346 EOF: 1,
6347 parseError: function(str, hash),
6348 setInput: function(input),
6349 input: function(),
6350 unput: function(str),
6351 more: function(),
6352 less: function(n),
6353 pastInput: function(),
6354 upcomingInput: function(),
6355 showPosition: function(),
6356 test_match: function(regex_match_array, rule_index),
6357 next: function(),
6358 lex: function(),
6359 begin: function(condition),
6360 popState: function(),
6361 _currentRules: function(),
6362 topState: function(),
6363 pushState: function(condition),
6364
6365 options: {
6366 ranges: boolean (optional: true ==> token location info will include a .range[] member)
6367 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
6368 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
6369 },
6370
6371 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
6372 rules: [...],
6373 conditions: {associative list: name ==> set},
6374 }
6375 }
6376
6377
6378 token location info (@$, _$, etc.): {
6379 first_line: n,
6380 last_line: n,
6381 first_column: n,
6382 last_column: n,
6383 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
6384 }
6385
6386
6387 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
6388 text: (matched text)
6389 token: (the produced terminal token, if any)
6390 line: (yylineno)
6391 }
6392 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
6393 loc: (yylloc)
6394 expected: (string describing the set of expected tokens)
6395 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
6396 }
6397*/
6398var parser = (function(){
6399var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,18],$V8=[1,19],$V9=[1,21],$Va=[1,22],$Vb=[1,23],$Vc=[1,29],$Vd=[1,30],$Ve=[1,31],$Vf=[1,32],$Vg=[1,33],$Vh=[1,34],$Vi=[1,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[1,41],$Vn=[1,42],$Vo=[1,45],$Vp=[1,4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67],$Vq=[1,58],$Vr=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,42,46,47,48,49,57,67],$Vs=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,41,42,46,47,48,49,57,67],$Vt=[4,5,16,20,22,23,24,30,32,33,34,35,36,38,40,42,46,47,48,49,57,67],$Vu=[55,56,57],$Vv=[1,4,5,7,16,20,22,23,24,30,32,33,34,35,36,38,40,41,42,46,47,48,49,57,67];
6400var parser = {trace: function trace () { },
6401yy: {},
6402symbols_: {"error":2,"start":3,"SPACE":4,"NEWLINE":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"openDirective":11,"typeDirective":12,"closeDirective":13,":":14,"argDirective":15,"participant":16,"actor":17,"AS":18,"restOfLine":19,"participant_actor":20,"signal":21,"autonumber":22,"activate":23,"deactivate":24,"note_statement":25,"links_statement":26,"link_statement":27,"properties_statement":28,"details_statement":29,"title":30,"text2":31,"loop":32,"end":33,"rect":34,"opt":35,"alt":36,"else_sections":37,"par":38,"par_sections":39,"and":40,"else":41,"note":42,"placement":43,"over":44,"actor_pair":45,"links":46,"link":47,"properties":48,"details":49,"spaceList":50,",":51,"left_of":52,"right_of":53,"signaltype":54,"+":55,"-":56,"ACTOR":57,"SOLID_OPEN_ARROW":58,"DOTTED_OPEN_ARROW":59,"SOLID_ARROW":60,"DOTTED_ARROW":61,"SOLID_CROSS":62,"DOTTED_CROSS":63,"SOLID_POINT":64,"DOTTED_POINT":65,"TXT":66,"open_directive":67,"type_directive":68,"arg_directive":69,"close_directive":70,"$accept":0,"$end":1},
6403terminals_: {2:"error",4:"SPACE",5:"NEWLINE",7:"SD",14:":",16:"participant",18:"AS",19:"restOfLine",20:"participant_actor",22:"autonumber",23:"activate",24:"deactivate",30:"title",32:"loop",33:"end",34:"rect",35:"opt",36:"alt",38:"par",40:"and",41:"else",42:"note",44:"over",46:"links",47:"link",48:"properties",49:"details",51:",",52:"left_of",53:"right_of",55:"+",56:"-",57:"ACTOR",58:"SOLID_OPEN_ARROW",59:"DOTTED_OPEN_ARROW",60:"SOLID_ARROW",61:"DOTTED_ARROW",62:"SOLID_CROSS",63:"DOTTED_CROSS",64:"SOLID_POINT",65:"DOTTED_POINT",66:"TXT",67:"open_directive",68:"type_directive",69:"arg_directive",70:"close_directive"},
6404productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[6,4],[6,6],[10,5],[10,3],[10,5],[10,3],[10,2],[10,1],[10,3],[10,3],[10,2],[10,2],[10,2],[10,2],[10,2],[10,3],[10,4],[10,4],[10,4],[10,4],[10,4],[10,1],[39,1],[39,4],[37,1],[37,4],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[50,2],[50,1],[45,3],[45,1],[43,1],[43,1],[21,5],[21,5],[21,4],[17,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[54,1],[31,1],[11,1],[12,1],[15,1],[13,1]],
6405performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
6406/* this == yyval */
6407
6408var $0 = $$.length - 1;
6409switch (yystate) {
6410case 4:
6411 yy.apply($$[$0]);return $$[$0];
6412break;
6413case 5:
6414 this.$ = []
6415break;
6416case 6:
6417$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
6418break;
6419case 7: case 8:
6420 this.$ = $$[$0]
6421break;
6422case 9:
6423 this.$=[];
6424break;
6425case 12:
6426$$[$0-3].type='addParticipant';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
6427break;
6428case 13:
6429$$[$0-1].type='addParticipant';this.$=$$[$0-1];
6430break;
6431case 14:
6432$$[$0-3].type='addActor';$$[$0-3].description=yy.parseMessage($$[$0-1]); this.$=$$[$0-3];
6433break;
6434case 15:
6435$$[$0-1].type='addActor'; this.$=$$[$0-1];
6436break;
6437case 17:
6438yy.enableSequenceNumbers()
6439break;
6440case 18:
6441this.$={type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]};
6442break;
6443case 19:
6444this.$={type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-1]};
6445break;
6446case 25:
6447this.$=[{type:'setTitle', text:$$[$0-1]}]
6448break;
6449case 26:
6450
6451 $$[$0-1].unshift({type: 'loopStart', loopText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.LOOP_START});
6452 $$[$0-1].push({type: 'loopEnd', loopText:$$[$0-2], signalType: yy.LINETYPE.LOOP_END});
6453 this.$=$$[$0-1];
6454break;
6455case 27:
6456
6457 $$[$0-1].unshift({type: 'rectStart', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_START });
6458 $$[$0-1].push({type: 'rectEnd', color:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.RECT_END });
6459 this.$=$$[$0-1];
6460break;
6461case 28:
6462
6463 $$[$0-1].unshift({type: 'optStart', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_START});
6464 $$[$0-1].push({type: 'optEnd', optText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.OPT_END});
6465 this.$=$$[$0-1];
6466break;
6467case 29:
6468
6469 // Alt start
6470 $$[$0-1].unshift({type: 'altStart', altText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.ALT_START});
6471 // Content in alt is already in $$[$0-1]
6472 // End
6473 $$[$0-1].push({type: 'altEnd', signalType: yy.LINETYPE.ALT_END});
6474 this.$=$$[$0-1];
6475break;
6476case 30:
6477
6478 // Parallel start
6479 $$[$0-1].unshift({type: 'parStart', parText:yy.parseMessage($$[$0-2]), signalType: yy.LINETYPE.PAR_START});
6480 // Content in par is already in $$[$0-1]
6481 // End
6482 $$[$0-1].push({type: 'parEnd', signalType: yy.LINETYPE.PAR_END});
6483 this.$=$$[$0-1];
6484break;
6485case 33:
6486 this.$ = $$[$0-3].concat([{type: 'and', parText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.PAR_AND}, $$[$0]]);
6487break;
6488case 35:
6489 this.$ = $$[$0-3].concat([{type: 'else', altText:yy.parseMessage($$[$0-1]), signalType: yy.LINETYPE.ALT_ELSE}, $$[$0]]);
6490break;
6491case 36:
6492
6493 this.$ = [$$[$0-1], {type:'addNote', placement:$$[$0-2], actor:$$[$0-1].actor, text:$$[$0]}];
6494break;
6495case 37:
6496
6497 // Coerce actor_pair into a [to, from, ...] array
6498 $$[$0-2] = [].concat($$[$0-1], $$[$0-1]).slice(0, 2);
6499 $$[$0-2][0] = $$[$0-2][0].actor;
6500 $$[$0-2][1] = $$[$0-2][1].actor;
6501 this.$ = [$$[$0-1], {type:'addNote', placement:yy.PLACEMENT.OVER, actor:$$[$0-2].slice(0, 2), text:$$[$0]}];
6502break;
6503case 38:
6504
6505 this.$ = [$$[$0-1], {type:'addLinks', actor:$$[$0-1].actor, text:$$[$0]}];
6506
6507break;
6508case 39:
6509
6510 this.$ = [$$[$0-1], {type:'addALink', actor:$$[$0-1].actor, text:$$[$0]}];
6511
6512break;
6513case 40:
6514
6515 this.$ = [$$[$0-1], {type:'addProperties', actor:$$[$0-1].actor, text:$$[$0]}];
6516
6517break;
6518case 41:
6519
6520 this.$ = [$$[$0-1], {type:'addDetails', actor:$$[$0-1].actor, text:$$[$0]}];
6521
6522break;
6523case 44:
6524 this.$ = [$$[$0-2], $$[$0]];
6525break;
6526case 45:
6527 this.$ = $$[$0];
6528break;
6529case 46:
6530 this.$ = yy.PLACEMENT.LEFTOF;
6531break;
6532case 47:
6533 this.$ = yy.PLACEMENT.RIGHTOF;
6534break;
6535case 48:
6536 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
6537 {type: 'activeStart', signalType: yy.LINETYPE.ACTIVE_START, actor: $$[$0-1]}
6538 ]
6539break;
6540case 49:
6541 this.$ = [$$[$0-4],$$[$0-1],{type: 'addMessage', from:$$[$0-4].actor, to:$$[$0-1].actor, signalType:$$[$0-3], msg:$$[$0]},
6542 {type: 'activeEnd', signalType: yy.LINETYPE.ACTIVE_END, actor: $$[$0-4]}
6543 ]
6544break;
6545case 50:
6546 this.$ = [$$[$0-3],$$[$0-1],{type: 'addMessage', from:$$[$0-3].actor, to:$$[$0-1].actor, signalType:$$[$0-2], msg:$$[$0]}]
6547break;
6548case 51:
6549this.$={ type: 'addParticipant', actor:$$[$0]}
6550break;
6551case 52:
6552 this.$ = yy.LINETYPE.SOLID_OPEN;
6553break;
6554case 53:
6555 this.$ = yy.LINETYPE.DOTTED_OPEN;
6556break;
6557case 54:
6558 this.$ = yy.LINETYPE.SOLID;
6559break;
6560case 55:
6561 this.$ = yy.LINETYPE.DOTTED;
6562break;
6563case 56:
6564 this.$ = yy.LINETYPE.SOLID_CROSS;
6565break;
6566case 57:
6567 this.$ = yy.LINETYPE.DOTTED_CROSS;
6568break;
6569case 58:
6570 this.$ = yy.LINETYPE.SOLID_POINT;
6571break;
6572case 59:
6573 this.$ = yy.LINETYPE.DOTTED_POINT;
6574break;
6575case 60:
6576this.$ = yy.parseMessage($$[$0].trim().substring(1))
6577break;
6578case 61:
6579 yy.parseDirective('%%{', 'open_directive');
6580break;
6581case 62:
6582 yy.parseDirective($$[$0], 'type_directive');
6583break;
6584case 63:
6585 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
6586break;
6587case 64:
6588 yy.parseDirective('}%%', 'close_directive', 'sequence');
6589break;
6590}
6591},
6592table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,11:6,67:$V3},o([1,4,5,16,20,22,23,24,30,32,34,35,36,38,42,46,47,48,49,57,67],$V4,{8:11}),{12:12,68:[1,13]},{68:[2,61]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{13:43,14:[1,44],70:$Vo},o([14,70],[2,62]),o($Vp,[2,6]),{6:35,10:46,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},o($Vp,[2,8]),o($Vp,[2,9]),{17:47,57:$Vn},{17:48,57:$Vn},{5:[1,49]},o($Vp,[2,17]),{17:50,57:$Vn},{17:51,57:$Vn},{5:[1,52]},{5:[1,53]},{5:[1,54]},{5:[1,55]},{5:[1,56]},{31:57,66:$Vq},{19:[1,59]},{19:[1,60]},{19:[1,61]},{19:[1,62]},{19:[1,63]},o($Vp,[2,31]),{54:64,58:[1,65],59:[1,66],60:[1,67],61:[1,68],62:[1,69],63:[1,70],64:[1,71],65:[1,72]},{43:73,44:[1,74],52:[1,75],53:[1,76]},{17:77,57:$Vn},{17:78,57:$Vn},{17:79,57:$Vn},{17:80,57:$Vn},o([5,18,51,58,59,60,61,62,63,64,65,66],[2,51]),{5:[1,81]},{15:82,69:[1,83]},{5:[2,64]},o($Vp,[2,7]),{5:[1,85],18:[1,84]},{5:[1,87],18:[1,86]},o($Vp,[2,16]),{5:[1,88]},{5:[1,89]},o($Vp,[2,20]),o($Vp,[2,21]),o($Vp,[2,22]),o($Vp,[2,23]),o($Vp,[2,24]),{5:[1,90]},{5:[2,60]},o($Vr,$V4,{8:91}),o($Vr,$V4,{8:92}),o($Vr,$V4,{8:93}),o($Vs,$V4,{37:94,8:95}),o($Vt,$V4,{39:96,8:97}),{17:100,55:[1,98],56:[1,99],57:$Vn},o($Vu,[2,52]),o($Vu,[2,53]),o($Vu,[2,54]),o($Vu,[2,55]),o($Vu,[2,56]),o($Vu,[2,57]),o($Vu,[2,58]),o($Vu,[2,59]),{17:101,57:$Vn},{17:103,45:102,57:$Vn},{57:[2,46]},{57:[2,47]},{31:104,66:$Vq},{31:105,66:$Vq},{31:106,66:$Vq},{31:107,66:$Vq},o($Vv,[2,10]),{13:108,70:$Vo},{70:[2,63]},{19:[1,109]},o($Vp,[2,13]),{19:[1,110]},o($Vp,[2,15]),o($Vp,[2,18]),o($Vp,[2,19]),o($Vp,[2,25]),{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,111],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,112],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[1,113],34:$Ve,35:$Vf,36:$Vg,38:$Vh,42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{33:[1,114]},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[2,34],34:$Ve,35:$Vf,36:$Vg,38:$Vh,41:[1,115],42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{33:[1,116]},{4:$V5,5:$V6,6:35,9:14,10:16,11:6,16:$V7,17:36,20:$V8,21:20,22:$V9,23:$Va,24:$Vb,25:24,26:25,27:26,28:27,29:28,30:$Vc,32:$Vd,33:[2,32],34:$Ve,35:$Vf,36:$Vg,38:$Vh,40:[1,117],42:$Vi,46:$Vj,47:$Vk,48:$Vl,49:$Vm,57:$Vn,67:$V3},{17:118,57:$Vn},{17:119,57:$Vn},{31:120,66:$Vq},{31:121,66:$Vq},{31:122,66:$Vq},{51:[1,123],66:[2,45]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},{5:[1,124]},{5:[1,125]},{5:[1,126]},o($Vp,[2,26]),o($Vp,[2,27]),o($Vp,[2,28]),o($Vp,[2,29]),{19:[1,127]},o($Vp,[2,30]),{19:[1,128]},{31:129,66:$Vq},{31:130,66:$Vq},{5:[2,50]},{5:[2,36]},{5:[2,37]},{17:131,57:$Vn},o($Vv,[2,11]),o($Vp,[2,12]),o($Vp,[2,14]),o($Vs,$V4,{8:95,37:132}),o($Vt,$V4,{8:97,39:133}),{5:[2,48]},{5:[2,49]},{66:[2,44]},{33:[2,35]},{33:[2,33]}],
6593defaultActions: {7:[2,61],8:[2,1],9:[2,2],10:[2,3],45:[2,64],58:[2,60],75:[2,46],76:[2,47],83:[2,63],104:[2,38],105:[2,39],106:[2,40],107:[2,41],120:[2,50],121:[2,36],122:[2,37],129:[2,48],130:[2,49],131:[2,44],132:[2,35],133:[2,33]},
6594parseError: function parseError (str, hash) {
6595 if (hash.recoverable) {
6596 this.trace(str);
6597 } else {
6598 var error = new Error(str);
6599 error.hash = hash;
6600 throw error;
6601 }
6602},
6603parse: function parse(input) {
6604 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
6605 var args = lstack.slice.call(arguments, 1);
6606 var lexer = Object.create(this.lexer);
6607 var sharedState = { yy: {} };
6608 for (var k in this.yy) {
6609 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
6610 sharedState.yy[k] = this.yy[k];
6611 }
6612 }
6613 lexer.setInput(input, sharedState.yy);
6614 sharedState.yy.lexer = lexer;
6615 sharedState.yy.parser = this;
6616 if (typeof lexer.yylloc == 'undefined') {
6617 lexer.yylloc = {};
6618 }
6619 var yyloc = lexer.yylloc;
6620 lstack.push(yyloc);
6621 var ranges = lexer.options && lexer.options.ranges;
6622 if (typeof sharedState.yy.parseError === 'function') {
6623 this.parseError = sharedState.yy.parseError;
6624 } else {
6625 this.parseError = Object.getPrototypeOf(this).parseError;
6626 }
6627 function popStack(n) {
6628 stack.length = stack.length - 2 * n;
6629 vstack.length = vstack.length - n;
6630 lstack.length = lstack.length - n;
6631 }
6632 function lex() {
6633 var token;
6634 token = tstack.pop() || lexer.lex() || EOF;
6635 if (typeof token !== 'number') {
6636 if (token instanceof Array) {
6637 tstack = token;
6638 token = tstack.pop();
6639 }
6640 token = self.symbols_[token] || token;
6641 }
6642 return token;
6643 }
6644 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
6645 while (true) {
6646 state = stack[stack.length - 1];
6647 if (this.defaultActions[state]) {
6648 action = this.defaultActions[state];
6649 } else {
6650 if (symbol === null || typeof symbol == 'undefined') {
6651 symbol = lex();
6652 }
6653 action = table[state] && table[state][symbol];
6654 }
6655 if (typeof action === 'undefined' || !action.length || !action[0]) {
6656 var errStr = '';
6657 expected = [];
6658 for (p in table[state]) {
6659 if (this.terminals_[p] && p > TERROR) {
6660 expected.push('\'' + this.terminals_[p] + '\'');
6661 }
6662 }
6663 if (lexer.showPosition) {
6664 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
6665 } else {
6666 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
6667 }
6668 this.parseError(errStr, {
6669 text: lexer.match,
6670 token: this.terminals_[symbol] || symbol,
6671 line: lexer.yylineno,
6672 loc: yyloc,
6673 expected: expected
6674 });
6675 }
6676 if (action[0] instanceof Array && action.length > 1) {
6677 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
6678 }
6679 switch (action[0]) {
6680 case 1:
6681 stack.push(symbol);
6682 vstack.push(lexer.yytext);
6683 lstack.push(lexer.yylloc);
6684 stack.push(action[1]);
6685 symbol = null;
6686 if (!preErrorSymbol) {
6687 yyleng = lexer.yyleng;
6688 yytext = lexer.yytext;
6689 yylineno = lexer.yylineno;
6690 yyloc = lexer.yylloc;
6691 if (recovering > 0) {
6692 recovering--;
6693 }
6694 } else {
6695 symbol = preErrorSymbol;
6696 preErrorSymbol = null;
6697 }
6698 break;
6699 case 2:
6700 len = this.productions_[action[1]][1];
6701 yyval.$ = vstack[vstack.length - len];
6702 yyval._$ = {
6703 first_line: lstack[lstack.length - (len || 1)].first_line,
6704 last_line: lstack[lstack.length - 1].last_line,
6705 first_column: lstack[lstack.length - (len || 1)].first_column,
6706 last_column: lstack[lstack.length - 1].last_column
6707 };
6708 if (ranges) {
6709 yyval._$.range = [
6710 lstack[lstack.length - (len || 1)].range[0],
6711 lstack[lstack.length - 1].range[1]
6712 ];
6713 }
6714 r = this.performAction.apply(yyval, [
6715 yytext,
6716 yyleng,
6717 yylineno,
6718 sharedState.yy,
6719 action[1],
6720 vstack,
6721 lstack
6722 ].concat(args));
6723 if (typeof r !== 'undefined') {
6724 return r;
6725 }
6726 if (len) {
6727 stack = stack.slice(0, -1 * len * 2);
6728 vstack = vstack.slice(0, -1 * len);
6729 lstack = lstack.slice(0, -1 * len);
6730 }
6731 stack.push(this.productions_[action[1]][0]);
6732 vstack.push(yyval.$);
6733 lstack.push(yyval._$);
6734 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
6735 stack.push(newState);
6736 break;
6737 case 3:
6738 return true;
6739 }
6740 }
6741 return true;
6742}};
6743
6744/* generated by jison-lex 0.3.4 */
6745var lexer = (function(){
6746var lexer = ({
6747
6748EOF:1,
6749
6750parseError:function parseError(str, hash) {
6751 if (this.yy.parser) {
6752 this.yy.parser.parseError(str, hash);
6753 } else {
6754 throw new Error(str);
6755 }
6756 },
6757
6758// resets the lexer, sets new input
6759setInput:function (input, yy) {
6760 this.yy = yy || this.yy || {};
6761 this._input = input;
6762 this._more = this._backtrack = this.done = false;
6763 this.yylineno = this.yyleng = 0;
6764 this.yytext = this.matched = this.match = '';
6765 this.conditionStack = ['INITIAL'];
6766 this.yylloc = {
6767 first_line: 1,
6768 first_column: 0,
6769 last_line: 1,
6770 last_column: 0
6771 };
6772 if (this.options.ranges) {
6773 this.yylloc.range = [0,0];
6774 }
6775 this.offset = 0;
6776 return this;
6777 },
6778
6779// consumes and returns one char from the input
6780input:function () {
6781 var ch = this._input[0];
6782 this.yytext += ch;
6783 this.yyleng++;
6784 this.offset++;
6785 this.match += ch;
6786 this.matched += ch;
6787 var lines = ch.match(/(?:\r\n?|\n).*/g);
6788 if (lines) {
6789 this.yylineno++;
6790 this.yylloc.last_line++;
6791 } else {
6792 this.yylloc.last_column++;
6793 }
6794 if (this.options.ranges) {
6795 this.yylloc.range[1]++;
6796 }
6797
6798 this._input = this._input.slice(1);
6799 return ch;
6800 },
6801
6802// unshifts one char (or a string) into the input
6803unput:function (ch) {
6804 var len = ch.length;
6805 var lines = ch.split(/(?:\r\n?|\n)/g);
6806
6807 this._input = ch + this._input;
6808 this.yytext = this.yytext.substr(0, this.yytext.length - len);
6809 //this.yyleng -= len;
6810 this.offset -= len;
6811 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
6812 this.match = this.match.substr(0, this.match.length - 1);
6813 this.matched = this.matched.substr(0, this.matched.length - 1);
6814
6815 if (lines.length - 1) {
6816 this.yylineno -= lines.length - 1;
6817 }
6818 var r = this.yylloc.range;
6819
6820 this.yylloc = {
6821 first_line: this.yylloc.first_line,
6822 last_line: this.yylineno + 1,
6823 first_column: this.yylloc.first_column,
6824 last_column: lines ?
6825 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
6826 + oldLines[oldLines.length - lines.length].length - lines[0].length :
6827 this.yylloc.first_column - len
6828 };
6829
6830 if (this.options.ranges) {
6831 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
6832 }
6833 this.yyleng = this.yytext.length;
6834 return this;
6835 },
6836
6837// When called from action, caches matched text and appends it on next action
6838more:function () {
6839 this._more = true;
6840 return this;
6841 },
6842
6843// 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.
6844reject:function () {
6845 if (this.options.backtrack_lexer) {
6846 this._backtrack = true;
6847 } else {
6848 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(), {
6849 text: "",
6850 token: null,
6851 line: this.yylineno
6852 });
6853
6854 }
6855 return this;
6856 },
6857
6858// retain first n characters of the match
6859less:function (n) {
6860 this.unput(this.match.slice(n));
6861 },
6862
6863// displays already matched input, i.e. for error messages
6864pastInput:function () {
6865 var past = this.matched.substr(0, this.matched.length - this.match.length);
6866 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
6867 },
6868
6869// displays upcoming input, i.e. for error messages
6870upcomingInput:function () {
6871 var next = this.match;
6872 if (next.length < 20) {
6873 next += this._input.substr(0, 20-next.length);
6874 }
6875 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
6876 },
6877
6878// displays the character position where the lexing error occurred, i.e. for error messages
6879showPosition:function () {
6880 var pre = this.pastInput();
6881 var c = new Array(pre.length + 1).join("-");
6882 return pre + this.upcomingInput() + "\n" + c + "^";
6883 },
6884
6885// test the lexed token: return FALSE when not a match, otherwise return token
6886test_match:function(match, indexed_rule) {
6887 var token,
6888 lines,
6889 backup;
6890
6891 if (this.options.backtrack_lexer) {
6892 // save context
6893 backup = {
6894 yylineno: this.yylineno,
6895 yylloc: {
6896 first_line: this.yylloc.first_line,
6897 last_line: this.last_line,
6898 first_column: this.yylloc.first_column,
6899 last_column: this.yylloc.last_column
6900 },
6901 yytext: this.yytext,
6902 match: this.match,
6903 matches: this.matches,
6904 matched: this.matched,
6905 yyleng: this.yyleng,
6906 offset: this.offset,
6907 _more: this._more,
6908 _input: this._input,
6909 yy: this.yy,
6910 conditionStack: this.conditionStack.slice(0),
6911 done: this.done
6912 };
6913 if (this.options.ranges) {
6914 backup.yylloc.range = this.yylloc.range.slice(0);
6915 }
6916 }
6917
6918 lines = match[0].match(/(?:\r\n?|\n).*/g);
6919 if (lines) {
6920 this.yylineno += lines.length;
6921 }
6922 this.yylloc = {
6923 first_line: this.yylloc.last_line,
6924 last_line: this.yylineno + 1,
6925 first_column: this.yylloc.last_column,
6926 last_column: lines ?
6927 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
6928 this.yylloc.last_column + match[0].length
6929 };
6930 this.yytext += match[0];
6931 this.match += match[0];
6932 this.matches = match;
6933 this.yyleng = this.yytext.length;
6934 if (this.options.ranges) {
6935 this.yylloc.range = [this.offset, this.offset += this.yyleng];
6936 }
6937 this._more = false;
6938 this._backtrack = false;
6939 this._input = this._input.slice(match[0].length);
6940 this.matched += match[0];
6941 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
6942 if (this.done && this._input) {
6943 this.done = false;
6944 }
6945 if (token) {
6946 return token;
6947 } else if (this._backtrack) {
6948 // recover context
6949 for (var k in backup) {
6950 this[k] = backup[k];
6951 }
6952 return false; // rule action called reject() implying the next rule should be tested instead.
6953 }
6954 return false;
6955 },
6956
6957// return next match in input
6958next:function () {
6959 if (this.done) {
6960 return this.EOF;
6961 }
6962 if (!this._input) {
6963 this.done = true;
6964 }
6965
6966 var token,
6967 match,
6968 tempMatch,
6969 index;
6970 if (!this._more) {
6971 this.yytext = '';
6972 this.match = '';
6973 }
6974 var rules = this._currentRules();
6975 for (var i = 0; i < rules.length; i++) {
6976 tempMatch = this._input.match(this.rules[rules[i]]);
6977 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
6978 match = tempMatch;
6979 index = i;
6980 if (this.options.backtrack_lexer) {
6981 token = this.test_match(tempMatch, rules[i]);
6982 if (token !== false) {
6983 return token;
6984 } else if (this._backtrack) {
6985 match = false;
6986 continue; // rule action called reject() implying a rule MISmatch.
6987 } else {
6988 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
6989 return false;
6990 }
6991 } else if (!this.options.flex) {
6992 break;
6993 }
6994 }
6995 }
6996 if (match) {
6997 token = this.test_match(match, rules[index]);
6998 if (token !== false) {
6999 return token;
7000 }
7001 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7002 return false;
7003 }
7004 if (this._input === "") {
7005 return this.EOF;
7006 } else {
7007 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
7008 text: "",
7009 token: null,
7010 line: this.yylineno
7011 });
7012 }
7013 },
7014
7015// return next match that has a token
7016lex:function lex () {
7017 var r = this.next();
7018 if (r) {
7019 return r;
7020 } else {
7021 return this.lex();
7022 }
7023 },
7024
7025// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
7026begin:function begin (condition) {
7027 this.conditionStack.push(condition);
7028 },
7029
7030// pop the previously active lexer condition state off the condition stack
7031popState:function popState () {
7032 var n = this.conditionStack.length - 1;
7033 if (n > 0) {
7034 return this.conditionStack.pop();
7035 } else {
7036 return this.conditionStack[0];
7037 }
7038 },
7039
7040// produce the lexer rule set which is active for the currently active lexer condition state
7041_currentRules:function _currentRules () {
7042 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
7043 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
7044 } else {
7045 return this.conditions["INITIAL"].rules;
7046 }
7047 },
7048
7049// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
7050topState:function topState (n) {
7051 n = this.conditionStack.length - 1 - Math.abs(n || 0);
7052 if (n >= 0) {
7053 return this.conditionStack[n];
7054 } else {
7055 return "INITIAL";
7056 }
7057 },
7058
7059// alias for begin(condition)
7060pushState:function pushState (condition) {
7061 this.begin(condition);
7062 },
7063
7064// return the number of states currently on the stack
7065stateStackSize:function stateStackSize() {
7066 return this.conditionStack.length;
7067 },
7068options: {"case-insensitive":true},
7069performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
7070var YYSTATE=YY_START;
7071switch($avoiding_name_collisions) {
7072case 0: this.begin('open_directive'); return 67;
7073break;
7074case 1: this.begin('type_directive'); return 68;
7075break;
7076case 2: this.popState(); this.begin('arg_directive'); return 14;
7077break;
7078case 3: this.popState(); this.popState(); return 70;
7079break;
7080case 4:return 69;
7081break;
7082case 5:return 5;
7083break;
7084case 6:/* skip all whitespace */
7085break;
7086case 7:/* skip same-line whitespace */
7087break;
7088case 8:/* skip comments */
7089break;
7090case 9:/* skip comments */
7091break;
7092case 10:/* skip comments */
7093break;
7094case 11: this.begin('ID'); return 16;
7095break;
7096case 12: this.begin('ID'); return 20;
7097break;
7098case 13: yy_.yytext = yy_.yytext.trim(); this.begin('ALIAS'); return 57;
7099break;
7100case 14: this.popState(); this.popState(); this.begin('LINE'); return 18;
7101break;
7102case 15: this.popState(); this.popState(); return 5;
7103break;
7104case 16: this.begin('LINE'); return 32;
7105break;
7106case 17: this.begin('LINE'); return 34;
7107break;
7108case 18: this.begin('LINE'); return 35;
7109break;
7110case 19: this.begin('LINE'); return 36;
7111break;
7112case 20: this.begin('LINE'); return 41;
7113break;
7114case 21: this.begin('LINE'); return 38;
7115break;
7116case 22: this.begin('LINE'); return 40;
7117break;
7118case 23: this.popState(); return 19;
7119break;
7120case 24:return 33;
7121break;
7122case 25:return 52;
7123break;
7124case 26:return 53;
7125break;
7126case 27:return 46;
7127break;
7128case 28:return 47;
7129break;
7130case 29:return 48;
7131break;
7132case 30:return 49;
7133break;
7134case 31:return 44;
7135break;
7136case 32:return 42;
7137break;
7138case 33: this.begin('ID'); return 23;
7139break;
7140case 34: this.begin('ID'); return 24;
7141break;
7142case 35:return 30;
7143break;
7144case 36:return 7;
7145break;
7146case 37:return 22;
7147break;
7148case 38:return 51;
7149break;
7150case 39:return 5;
7151break;
7152case 40: yy_.yytext = yy_.yytext.trim(); return 57;
7153break;
7154case 41:return 60;
7155break;
7156case 42:return 61;
7157break;
7158case 43:return 58;
7159break;
7160case 44:return 59;
7161break;
7162case 45:return 62;
7163break;
7164case 46:return 63;
7165break;
7166case 47:return 64;
7167break;
7168case 48:return 65;
7169break;
7170case 49:return 66;
7171break;
7172case 50:return 55;
7173break;
7174case 51:return 56;
7175break;
7176case 52:return 5;
7177break;
7178case 53:return 'INVALID';
7179break;
7180}
7181},
7182rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:[^\->:\n,;]+?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i,/^(?:as\b)/i,/^(?:(?:))/i,/^(?:loop\b)/i,/^(?:rect\b)/i,/^(?:opt\b)/i,/^(?:alt\b)/i,/^(?:else\b)/i,/^(?:par\b)/i,/^(?:and\b)/i,/^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i,/^(?:end\b)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:links\b)/i,/^(?:link\b)/i,/^(?:properties\b)/i,/^(?:details\b)/i,/^(?:over\b)/i,/^(?:note\b)/i,/^(?:activate\b)/i,/^(?:deactivate\b)/i,/^(?:title\b)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:,)/i,/^(?:;)/i,/^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i,/^(?:->>)/i,/^(?:-->>)/i,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]+)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],
7183conditions: {"open_directive":{"rules":[1,8],"inclusive":false},"type_directive":{"rules":[2,3,8],"inclusive":false},"arg_directive":{"rules":[3,4,8],"inclusive":false},"ID":{"rules":[7,8,13],"inclusive":false},"ALIAS":{"rules":[7,8,14,15],"inclusive":false},"LINE":{"rules":[7,8,23],"inclusive":false},"INITIAL":{"rules":[0,5,6,8,9,10,11,12,16,17,18,19,20,21,22,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53],"inclusive":true}}
7184});
7185return lexer;
7186})();
7187parser.lexer = lexer;
7188function Parser () {
7189 this.yy = {};
7190}
7191Parser.prototype = parser;parser.Parser = Parser;
7192return new Parser;
7193})();
7194
7195
7196if (true) {
7197exports.parser = parser;
7198exports.Parser = parser.Parser;
7199exports.parse = function () { return parser.parse.apply(parser, arguments); };
7200exports.main = function commonjsMain (args) {
7201 if (!args[1]) {
7202 console.log('Usage: '+args[0]+' FILE');
7203 process.exit(1);
7204 }
7205 var source = (__webpack_require__(/*! fs */ "?e940").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
7206 return exports.parser.parse(source);
7207};
7208if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
7209 exports.main(process.argv.slice(1));
7210}
7211}
7212
7213/***/ }),
7214
7215/***/ "./src/diagrams/state/parser/stateDiagram.jison":
7216/*!******************************************************!*\
7217 !*** ./src/diagrams/state/parser/stateDiagram.jison ***!
7218 \******************************************************/
7219/***/ ((module, exports, __webpack_require__) => {
7220
7221/* module decorator */ module = __webpack_require__.nmd(module);
7222/* parser generated by jison 0.4.18 */
7223/*
7224 Returns a Parser object of the following structure:
7225
7226 Parser: {
7227 yy: {}
7228 }
7229
7230 Parser.prototype: {
7231 yy: {},
7232 trace: function(),
7233 symbols_: {associative list: name ==> number},
7234 terminals_: {associative list: number ==> name},
7235 productions_: [...],
7236 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
7237 table: [...],
7238 defaultActions: {...},
7239 parseError: function(str, hash),
7240 parse: function(input),
7241
7242 lexer: {
7243 EOF: 1,
7244 parseError: function(str, hash),
7245 setInput: function(input),
7246 input: function(),
7247 unput: function(str),
7248 more: function(),
7249 less: function(n),
7250 pastInput: function(),
7251 upcomingInput: function(),
7252 showPosition: function(),
7253 test_match: function(regex_match_array, rule_index),
7254 next: function(),
7255 lex: function(),
7256 begin: function(condition),
7257 popState: function(),
7258 _currentRules: function(),
7259 topState: function(),
7260 pushState: function(condition),
7261
7262 options: {
7263 ranges: boolean (optional: true ==> token location info will include a .range[] member)
7264 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
7265 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
7266 },
7267
7268 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
7269 rules: [...],
7270 conditions: {associative list: name ==> set},
7271 }
7272 }
7273
7274
7275 token location info (@$, _$, etc.): {
7276 first_line: n,
7277 last_line: n,
7278 first_column: n,
7279 last_column: n,
7280 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
7281 }
7282
7283
7284 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
7285 text: (matched text)
7286 token: (the produced terminal token, if any)
7287 line: (yylineno)
7288 }
7289 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
7290 loc: (yylloc)
7291 expected: (string describing the set of expected tokens)
7292 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
7293 }
7294*/
7295var parser = (function(){
7296var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,3],$V2=[1,5],$V3=[1,7],$V4=[2,5],$V5=[1,15],$V6=[1,17],$V7=[1,19],$V8=[1,20],$V9=[1,21],$Va=[1,22],$Vb=[1,30],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,26],$Vg=[1,27],$Vh=[1,32],$Vi=[1,33],$Vj=[1,34],$Vk=[1,35],$Vl=[1,31],$Vm=[1,38],$Vn=[1,4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vo=[1,4,5,12,13,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vp=[1,4,5,7,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45],$Vq=[4,5,14,15,17,19,20,22,23,24,25,26,27,36,37,38,39,42,45];
7297var parser = {trace: function trace () { },
7298yy: {},
7299symbols_: {"error":2,"start":3,"SPACE":4,"NL":5,"directive":6,"SD":7,"document":8,"line":9,"statement":10,"idStatement":11,"DESCR":12,"-->":13,"HIDE_EMPTY":14,"scale":15,"WIDTH":16,"COMPOSIT_STATE":17,"STRUCT_START":18,"STRUCT_STOP":19,"STATE_DESCR":20,"AS":21,"ID":22,"FORK":23,"JOIN":24,"CHOICE":25,"CONCURRENT":26,"note":27,"notePosition":28,"NOTE_TEXT":29,"direction":30,"openDirective":31,"typeDirective":32,"closeDirective":33,":":34,"argDirective":35,"direction_tb":36,"direction_bt":37,"direction_rl":38,"direction_lr":39,"eol":40,";":41,"EDGE_STATE":42,"left_of":43,"right_of":44,"open_directive":45,"type_directive":46,"arg_directive":47,"close_directive":48,"$accept":0,"$end":1},
7300terminals_: {2:"error",4:"SPACE",5:"NL",7:"SD",12:"DESCR",13:"-->",14:"HIDE_EMPTY",15:"scale",16:"WIDTH",17:"COMPOSIT_STATE",18:"STRUCT_START",19:"STRUCT_STOP",20:"STATE_DESCR",21:"AS",22:"ID",23:"FORK",24:"JOIN",25:"CHOICE",26:"CONCURRENT",27:"note",29:"NOTE_TEXT",34:":",36:"direction_tb",37:"direction_bt",38:"direction_rl",39:"direction_lr",41:";",42:"EDGE_STATE",43:"left_of",44:"right_of",45:"open_directive",46:"type_directive",47:"arg_directive",48:"close_directive"},
7301productions_: [0,[3,2],[3,2],[3,2],[3,2],[8,0],[8,2],[9,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,1],[10,2],[10,1],[10,4],[10,3],[10,6],[10,1],[10,1],[10,1],[10,1],[10,4],[10,4],[10,1],[10,1],[6,3],[6,5],[30,1],[30,1],[30,1],[30,1],[40,1],[40,1],[11,1],[11,1],[28,1],[28,1],[31,1],[32,1],[35,1],[33,1]],
7302performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
7303/* this == yyval */
7304
7305var $0 = $$.length - 1;
7306switch (yystate) {
7307case 4:
7308 /*console.warn('Root document', $$[$0]);*/ yy.setRootDoc($$[$0]);return $$[$0];
7309break;
7310case 5:
7311 this.$ = []
7312break;
7313case 6:
7314
7315 if($$[$0]!='nl'){
7316 $$[$0-1].push($$[$0]);this.$ = $$[$0-1]
7317 }
7318 // console.warn('Got document',$$[$0-1], $$[$0]);
7319
7320break;
7321case 7: case 8:
7322 this.$ = $$[$0]
7323break;
7324case 9:
7325 this.$='nl';
7326break;
7327case 10:
7328 /*console.warn('got id and descr', $$[$0]);*/this.$={ stmt: 'state', id: $$[$0], type: 'default', description: ''};
7329break;
7330case 11:
7331 /*console.warn('got id and descr', $$[$0-1], $$[$0].trim());*/this.$={ stmt: 'state', id: $$[$0-1], type: 'default', description: yy.trimColon($$[$0])};
7332break;
7333case 12:
7334
7335 /*console.warn('got id', $$[$0-2]);yy.addRelation($$[$0-2], $$[$0]);*/
7336 this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-2], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0] ,type: 'default', description: ''}};
7337
7338break;
7339case 13:
7340
7341 /*yy.addRelation($$[$0-3], $$[$0-1], $$[$0].substr(1).trim());*/
7342 this.$={ stmt: 'relation', state1: { stmt: 'state', id: $$[$0-3], type: 'default', description: '' }, state2:{ stmt: 'state', id: $$[$0-1] ,type: 'default', description: ''}, description: $$[$0].substr(1).trim()};
7343
7344break;
7345case 17:
7346
7347 /* console.warn('Adding document for state without id ', $$[$0-3]);*/
7348 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: '', doc: $$[$0-1] }
7349
7350break;
7351case 18:
7352
7353 var id=$$[$0];
7354 var description = $$[$0-2].trim();
7355 if($$[$0].match(':')){
7356 var parts = $$[$0].split(':');
7357 id=parts[0];
7358 description = [description, parts[1]];
7359 }
7360 this.$={stmt: 'state', id: id, type: 'default', description: description};
7361
7362
7363break;
7364case 19:
7365
7366 // console.warn('Adding document for state with id zxzx', $$[$0-3], $$[$0-2], yy.getDirection()); yy.addDocument($$[$0-3]);
7367 this.$={ stmt: 'state', id: $$[$0-3], type: 'default', description: $$[$0-5], doc: $$[$0-1] }
7368
7369break;
7370case 20:
7371
7372 this.$={ stmt: 'state', id: $$[$0], type: 'fork' }
7373
7374break;
7375case 21:
7376
7377 this.$={ stmt: 'state', id: $$[$0], type: 'join' }
7378
7379break;
7380case 22:
7381
7382 this.$={ stmt: 'state', id: $$[$0], type: 'choice' }
7383
7384break;
7385case 23:
7386
7387 this.$={ stmt: 'state', id: yy.getDividerId(), type: 'divider' }
7388
7389break;
7390case 24:
7391
7392 /* console.warn('got NOTE, position: ', $$[$0-2].trim(), 'id = ', $$[$0-1].trim(), 'note: ', $$[$0]);*/
7393 this.$={ stmt: 'state', id: $$[$0-1].trim(), note:{position: $$[$0-2].trim(), text: $$[$0].trim()}};
7394
7395break;
7396case 30:
7397 yy.setDirection('TB');this.$={stmt:'dir', value:'TB'};
7398break;
7399case 31:
7400 yy.setDirection('BT');this.$={stmt:'dir', value:'BT'};
7401break;
7402case 32:
7403 yy.setDirection('RL'); this.$={stmt:'dir', value:'RL'};
7404break;
7405case 33:
7406 yy.setDirection('LR');this.$={stmt:'dir', value:'LR'};
7407break;
7408case 36: case 37:
7409this.$=$$[$0];
7410break;
7411case 40:
7412 yy.parseDirective('%%{', 'open_directive');
7413break;
7414case 41:
7415 yy.parseDirective($$[$0], 'type_directive');
7416break;
7417case 42:
7418 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
7419break;
7420case 43:
7421 yy.parseDirective('}%%', 'close_directive', 'state');
7422break;
7423}
7424},
7425table: [{3:1,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{1:[3]},{3:8,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{3:9,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},{3:10,4:$V0,5:$V1,6:4,7:$V2,31:6,45:$V3},o([1,4,5,14,15,17,20,22,23,24,25,26,27,36,37,38,39,42,45],$V4,{8:11}),{32:12,46:[1,13]},{46:[2,40]},{1:[2,1]},{1:[2,2]},{1:[2,3]},{1:[2,4],4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},{33:36,34:[1,37],48:$Vm},o([34,48],[2,41]),o($Vn,[2,6]),{6:28,10:39,11:18,14:$V7,15:$V8,17:$V9,20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,8]),o($Vn,[2,9]),o($Vn,[2,10],{12:[1,40],13:[1,41]}),o($Vn,[2,14]),{16:[1,42]},o($Vn,[2,16],{18:[1,43]}),{21:[1,44]},o($Vn,[2,20]),o($Vn,[2,21]),o($Vn,[2,22]),o($Vn,[2,23]),{28:45,29:[1,46],43:[1,47],44:[1,48]},o($Vn,[2,26]),o($Vn,[2,27]),o($Vo,[2,36]),o($Vo,[2,37]),o($Vn,[2,30]),o($Vn,[2,31]),o($Vn,[2,32]),o($Vn,[2,33]),o($Vp,[2,28]),{35:49,47:[1,50]},o($Vp,[2,43]),o($Vn,[2,7]),o($Vn,[2,11]),{11:51,22:$Vb,42:$Vl},o($Vn,[2,15]),o($Vq,$V4,{8:52}),{22:[1,53]},{22:[1,54]},{21:[1,55]},{22:[2,38]},{22:[2,39]},{33:56,48:$Vm},{48:[2,42]},o($Vn,[2,12],{12:[1,57]}),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,58],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,18],{18:[1,59]}),{29:[1,60]},{22:[1,61]},o($Vp,[2,29]),o($Vn,[2,13]),o($Vn,[2,17]),o($Vq,$V4,{8:62}),o($Vn,[2,24]),o($Vn,[2,25]),{4:$V5,5:$V6,6:28,9:14,10:16,11:18,14:$V7,15:$V8,17:$V9,19:[1,63],20:$Va,22:$Vb,23:$Vc,24:$Vd,25:$Ve,26:$Vf,27:$Vg,30:29,31:6,36:$Vh,37:$Vi,38:$Vj,39:$Vk,42:$Vl,45:$V3},o($Vn,[2,19])],
7426defaultActions: {7:[2,40],8:[2,1],9:[2,2],10:[2,3],47:[2,38],48:[2,39],50:[2,42]},
7427parseError: function parseError (str, hash) {
7428 if (hash.recoverable) {
7429 this.trace(str);
7430 } else {
7431 var error = new Error(str);
7432 error.hash = hash;
7433 throw error;
7434 }
7435},
7436parse: function parse(input) {
7437 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
7438 var args = lstack.slice.call(arguments, 1);
7439 var lexer = Object.create(this.lexer);
7440 var sharedState = { yy: {} };
7441 for (var k in this.yy) {
7442 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
7443 sharedState.yy[k] = this.yy[k];
7444 }
7445 }
7446 lexer.setInput(input, sharedState.yy);
7447 sharedState.yy.lexer = lexer;
7448 sharedState.yy.parser = this;
7449 if (typeof lexer.yylloc == 'undefined') {
7450 lexer.yylloc = {};
7451 }
7452 var yyloc = lexer.yylloc;
7453 lstack.push(yyloc);
7454 var ranges = lexer.options && lexer.options.ranges;
7455 if (typeof sharedState.yy.parseError === 'function') {
7456 this.parseError = sharedState.yy.parseError;
7457 } else {
7458 this.parseError = Object.getPrototypeOf(this).parseError;
7459 }
7460 function popStack(n) {
7461 stack.length = stack.length - 2 * n;
7462 vstack.length = vstack.length - n;
7463 lstack.length = lstack.length - n;
7464 }
7465 function lex() {
7466 var token;
7467 token = tstack.pop() || lexer.lex() || EOF;
7468 if (typeof token !== 'number') {
7469 if (token instanceof Array) {
7470 tstack = token;
7471 token = tstack.pop();
7472 }
7473 token = self.symbols_[token] || token;
7474 }
7475 return token;
7476 }
7477 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
7478 while (true) {
7479 state = stack[stack.length - 1];
7480 if (this.defaultActions[state]) {
7481 action = this.defaultActions[state];
7482 } else {
7483 if (symbol === null || typeof symbol == 'undefined') {
7484 symbol = lex();
7485 }
7486 action = table[state] && table[state][symbol];
7487 }
7488 if (typeof action === 'undefined' || !action.length || !action[0]) {
7489 var errStr = '';
7490 expected = [];
7491 for (p in table[state]) {
7492 if (this.terminals_[p] && p > TERROR) {
7493 expected.push('\'' + this.terminals_[p] + '\'');
7494 }
7495 }
7496 if (lexer.showPosition) {
7497 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
7498 } else {
7499 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
7500 }
7501 this.parseError(errStr, {
7502 text: lexer.match,
7503 token: this.terminals_[symbol] || symbol,
7504 line: lexer.yylineno,
7505 loc: yyloc,
7506 expected: expected
7507 });
7508 }
7509 if (action[0] instanceof Array && action.length > 1) {
7510 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
7511 }
7512 switch (action[0]) {
7513 case 1:
7514 stack.push(symbol);
7515 vstack.push(lexer.yytext);
7516 lstack.push(lexer.yylloc);
7517 stack.push(action[1]);
7518 symbol = null;
7519 if (!preErrorSymbol) {
7520 yyleng = lexer.yyleng;
7521 yytext = lexer.yytext;
7522 yylineno = lexer.yylineno;
7523 yyloc = lexer.yylloc;
7524 if (recovering > 0) {
7525 recovering--;
7526 }
7527 } else {
7528 symbol = preErrorSymbol;
7529 preErrorSymbol = null;
7530 }
7531 break;
7532 case 2:
7533 len = this.productions_[action[1]][1];
7534 yyval.$ = vstack[vstack.length - len];
7535 yyval._$ = {
7536 first_line: lstack[lstack.length - (len || 1)].first_line,
7537 last_line: lstack[lstack.length - 1].last_line,
7538 first_column: lstack[lstack.length - (len || 1)].first_column,
7539 last_column: lstack[lstack.length - 1].last_column
7540 };
7541 if (ranges) {
7542 yyval._$.range = [
7543 lstack[lstack.length - (len || 1)].range[0],
7544 lstack[lstack.length - 1].range[1]
7545 ];
7546 }
7547 r = this.performAction.apply(yyval, [
7548 yytext,
7549 yyleng,
7550 yylineno,
7551 sharedState.yy,
7552 action[1],
7553 vstack,
7554 lstack
7555 ].concat(args));
7556 if (typeof r !== 'undefined') {
7557 return r;
7558 }
7559 if (len) {
7560 stack = stack.slice(0, -1 * len * 2);
7561 vstack = vstack.slice(0, -1 * len);
7562 lstack = lstack.slice(0, -1 * len);
7563 }
7564 stack.push(this.productions_[action[1]][0]);
7565 vstack.push(yyval.$);
7566 lstack.push(yyval._$);
7567 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
7568 stack.push(newState);
7569 break;
7570 case 3:
7571 return true;
7572 }
7573 }
7574 return true;
7575}};
7576
7577/* generated by jison-lex 0.3.4 */
7578var lexer = (function(){
7579var lexer = ({
7580
7581EOF:1,
7582
7583parseError:function parseError(str, hash) {
7584 if (this.yy.parser) {
7585 this.yy.parser.parseError(str, hash);
7586 } else {
7587 throw new Error(str);
7588 }
7589 },
7590
7591// resets the lexer, sets new input
7592setInput:function (input, yy) {
7593 this.yy = yy || this.yy || {};
7594 this._input = input;
7595 this._more = this._backtrack = this.done = false;
7596 this.yylineno = this.yyleng = 0;
7597 this.yytext = this.matched = this.match = '';
7598 this.conditionStack = ['INITIAL'];
7599 this.yylloc = {
7600 first_line: 1,
7601 first_column: 0,
7602 last_line: 1,
7603 last_column: 0
7604 };
7605 if (this.options.ranges) {
7606 this.yylloc.range = [0,0];
7607 }
7608 this.offset = 0;
7609 return this;
7610 },
7611
7612// consumes and returns one char from the input
7613input:function () {
7614 var ch = this._input[0];
7615 this.yytext += ch;
7616 this.yyleng++;
7617 this.offset++;
7618 this.match += ch;
7619 this.matched += ch;
7620 var lines = ch.match(/(?:\r\n?|\n).*/g);
7621 if (lines) {
7622 this.yylineno++;
7623 this.yylloc.last_line++;
7624 } else {
7625 this.yylloc.last_column++;
7626 }
7627 if (this.options.ranges) {
7628 this.yylloc.range[1]++;
7629 }
7630
7631 this._input = this._input.slice(1);
7632 return ch;
7633 },
7634
7635// unshifts one char (or a string) into the input
7636unput:function (ch) {
7637 var len = ch.length;
7638 var lines = ch.split(/(?:\r\n?|\n)/g);
7639
7640 this._input = ch + this._input;
7641 this.yytext = this.yytext.substr(0, this.yytext.length - len);
7642 //this.yyleng -= len;
7643 this.offset -= len;
7644 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
7645 this.match = this.match.substr(0, this.match.length - 1);
7646 this.matched = this.matched.substr(0, this.matched.length - 1);
7647
7648 if (lines.length - 1) {
7649 this.yylineno -= lines.length - 1;
7650 }
7651 var r = this.yylloc.range;
7652
7653 this.yylloc = {
7654 first_line: this.yylloc.first_line,
7655 last_line: this.yylineno + 1,
7656 first_column: this.yylloc.first_column,
7657 last_column: lines ?
7658 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
7659 + oldLines[oldLines.length - lines.length].length - lines[0].length :
7660 this.yylloc.first_column - len
7661 };
7662
7663 if (this.options.ranges) {
7664 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
7665 }
7666 this.yyleng = this.yytext.length;
7667 return this;
7668 },
7669
7670// When called from action, caches matched text and appends it on next action
7671more:function () {
7672 this._more = true;
7673 return this;
7674 },
7675
7676// 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.
7677reject:function () {
7678 if (this.options.backtrack_lexer) {
7679 this._backtrack = true;
7680 } else {
7681 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(), {
7682 text: "",
7683 token: null,
7684 line: this.yylineno
7685 });
7686
7687 }
7688 return this;
7689 },
7690
7691// retain first n characters of the match
7692less:function (n) {
7693 this.unput(this.match.slice(n));
7694 },
7695
7696// displays already matched input, i.e. for error messages
7697pastInput:function () {
7698 var past = this.matched.substr(0, this.matched.length - this.match.length);
7699 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
7700 },
7701
7702// displays upcoming input, i.e. for error messages
7703upcomingInput:function () {
7704 var next = this.match;
7705 if (next.length < 20) {
7706 next += this._input.substr(0, 20-next.length);
7707 }
7708 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
7709 },
7710
7711// displays the character position where the lexing error occurred, i.e. for error messages
7712showPosition:function () {
7713 var pre = this.pastInput();
7714 var c = new Array(pre.length + 1).join("-");
7715 return pre + this.upcomingInput() + "\n" + c + "^";
7716 },
7717
7718// test the lexed token: return FALSE when not a match, otherwise return token
7719test_match:function(match, indexed_rule) {
7720 var token,
7721 lines,
7722 backup;
7723
7724 if (this.options.backtrack_lexer) {
7725 // save context
7726 backup = {
7727 yylineno: this.yylineno,
7728 yylloc: {
7729 first_line: this.yylloc.first_line,
7730 last_line: this.last_line,
7731 first_column: this.yylloc.first_column,
7732 last_column: this.yylloc.last_column
7733 },
7734 yytext: this.yytext,
7735 match: this.match,
7736 matches: this.matches,
7737 matched: this.matched,
7738 yyleng: this.yyleng,
7739 offset: this.offset,
7740 _more: this._more,
7741 _input: this._input,
7742 yy: this.yy,
7743 conditionStack: this.conditionStack.slice(0),
7744 done: this.done
7745 };
7746 if (this.options.ranges) {
7747 backup.yylloc.range = this.yylloc.range.slice(0);
7748 }
7749 }
7750
7751 lines = match[0].match(/(?:\r\n?|\n).*/g);
7752 if (lines) {
7753 this.yylineno += lines.length;
7754 }
7755 this.yylloc = {
7756 first_line: this.yylloc.last_line,
7757 last_line: this.yylineno + 1,
7758 first_column: this.yylloc.last_column,
7759 last_column: lines ?
7760 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
7761 this.yylloc.last_column + match[0].length
7762 };
7763 this.yytext += match[0];
7764 this.match += match[0];
7765 this.matches = match;
7766 this.yyleng = this.yytext.length;
7767 if (this.options.ranges) {
7768 this.yylloc.range = [this.offset, this.offset += this.yyleng];
7769 }
7770 this._more = false;
7771 this._backtrack = false;
7772 this._input = this._input.slice(match[0].length);
7773 this.matched += match[0];
7774 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
7775 if (this.done && this._input) {
7776 this.done = false;
7777 }
7778 if (token) {
7779 return token;
7780 } else if (this._backtrack) {
7781 // recover context
7782 for (var k in backup) {
7783 this[k] = backup[k];
7784 }
7785 return false; // rule action called reject() implying the next rule should be tested instead.
7786 }
7787 return false;
7788 },
7789
7790// return next match in input
7791next:function () {
7792 if (this.done) {
7793 return this.EOF;
7794 }
7795 if (!this._input) {
7796 this.done = true;
7797 }
7798
7799 var token,
7800 match,
7801 tempMatch,
7802 index;
7803 if (!this._more) {
7804 this.yytext = '';
7805 this.match = '';
7806 }
7807 var rules = this._currentRules();
7808 for (var i = 0; i < rules.length; i++) {
7809 tempMatch = this._input.match(this.rules[rules[i]]);
7810 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
7811 match = tempMatch;
7812 index = i;
7813 if (this.options.backtrack_lexer) {
7814 token = this.test_match(tempMatch, rules[i]);
7815 if (token !== false) {
7816 return token;
7817 } else if (this._backtrack) {
7818 match = false;
7819 continue; // rule action called reject() implying a rule MISmatch.
7820 } else {
7821 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7822 return false;
7823 }
7824 } else if (!this.options.flex) {
7825 break;
7826 }
7827 }
7828 }
7829 if (match) {
7830 token = this.test_match(match, rules[index]);
7831 if (token !== false) {
7832 return token;
7833 }
7834 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
7835 return false;
7836 }
7837 if (this._input === "") {
7838 return this.EOF;
7839 } else {
7840 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
7841 text: "",
7842 token: null,
7843 line: this.yylineno
7844 });
7845 }
7846 },
7847
7848// return next match that has a token
7849lex:function lex () {
7850 var r = this.next();
7851 if (r) {
7852 return r;
7853 } else {
7854 return this.lex();
7855 }
7856 },
7857
7858// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
7859begin:function begin (condition) {
7860 this.conditionStack.push(condition);
7861 },
7862
7863// pop the previously active lexer condition state off the condition stack
7864popState:function popState () {
7865 var n = this.conditionStack.length - 1;
7866 if (n > 0) {
7867 return this.conditionStack.pop();
7868 } else {
7869 return this.conditionStack[0];
7870 }
7871 },
7872
7873// produce the lexer rule set which is active for the currently active lexer condition state
7874_currentRules:function _currentRules () {
7875 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
7876 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
7877 } else {
7878 return this.conditions["INITIAL"].rules;
7879 }
7880 },
7881
7882// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
7883topState:function topState (n) {
7884 n = this.conditionStack.length - 1 - Math.abs(n || 0);
7885 if (n >= 0) {
7886 return this.conditionStack[n];
7887 } else {
7888 return "INITIAL";
7889 }
7890 },
7891
7892// alias for begin(condition)
7893pushState:function pushState (condition) {
7894 this.begin(condition);
7895 },
7896
7897// return the number of states currently on the stack
7898stateStackSize:function stateStackSize() {
7899 return this.conditionStack.length;
7900 },
7901options: {"case-insensitive":true},
7902performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
7903var YYSTATE=YY_START;
7904switch($avoiding_name_collisions) {
7905case 0:return 36;
7906break;
7907case 1:return 37;
7908break;
7909case 2:return 38;
7910break;
7911case 3:return 39;
7912break;
7913case 4: this.begin('open_directive'); return 45;
7914break;
7915case 5: this.begin('type_directive'); return 46;
7916break;
7917case 6: this.popState(); this.begin('arg_directive'); return 34;
7918break;
7919case 7: this.popState(); this.popState(); return 48;
7920break;
7921case 8:return 47;
7922break;
7923case 9:/* skip comments */
7924break;
7925case 10:/* skip comments */{ /*console.log('Crap after close');*/ }
7926break;
7927case 11:return 5;
7928break;
7929case 12:/* skip all whitespace */
7930break;
7931case 13:/* skip same-line whitespace */
7932break;
7933case 14:/* skip comments */
7934break;
7935case 15:/* skip comments */
7936break;
7937case 16: this.pushState('SCALE'); /* console.log('Got scale', yy_.yytext);*/ return 15;
7938break;
7939case 17:return 16;
7940break;
7941case 18:this.popState();
7942break;
7943case 19: /*console.log('Starting STATE zxzx'+yy.getDirection());*/this.pushState('STATE');
7944break;
7945case 20:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim(); /*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
7946break;
7947case 21:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
7948break;
7949case 22:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
7950break;
7951case 23:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Fork: ',yy_.yytext);*/return 23;
7952break;
7953case 24:this.popState();yy_.yytext=yy_.yytext.slice(0,-8).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 24;
7954break;
7955case 25:this.popState();yy_.yytext=yy_.yytext.slice(0,-10).trim();/*console.warn('Fork Join: ',yy_.yytext);*/return 25;
7956break;
7957case 26: return 36;
7958break;
7959case 27: return 37;
7960break;
7961case 28: return 38;
7962break;
7963case 29: return 39;
7964break;
7965case 30: /*console.log('Starting STATE_STRING zxzx');*/this.begin("STATE_STRING");
7966break;
7967case 31:this.popState();this.pushState('STATE_ID');return "AS";
7968break;
7969case 32:this.popState();/* console.log('STATE_ID', yy_.yytext);*/return "ID";
7970break;
7971case 33:this.popState();
7972break;
7973case 34: /*console.log('Long description:', yy_.yytext);*/return "STATE_DESCR";
7974break;
7975case 35:/*console.log('COMPOSIT_STATE', yy_.yytext);*/return 17;
7976break;
7977case 36:this.popState();
7978break;
7979case 37:this.popState();this.pushState('struct'); /*console.log('begin struct', yy_.yytext);*/return 18;
7980break;
7981case 38: /*console.log('Ending struct');*/ this.popState(); return 19;
7982break;
7983case 39:/* nothing */
7984break;
7985case 40: this.begin('NOTE'); return 27;
7986break;
7987case 41: this.popState();this.pushState('NOTE_ID');return 43;
7988break;
7989case 42: this.popState();this.pushState('NOTE_ID');return 44;
7990break;
7991case 43: this.popState();this.pushState('FLOATING_NOTE');
7992break;
7993case 44:this.popState();this.pushState('FLOATING_NOTE_ID');return "AS";
7994break;
7995case 45:/**/
7996break;
7997case 46: /*console.log('Floating note text: ', yy_.yytext);*/return "NOTE_TEXT";
7998break;
7999case 47:this.popState();/*console.log('Floating note ID', yy_.yytext);*/return "ID";
8000break;
8001case 48: this.popState();this.pushState('NOTE_TEXT');/*console.log('Got ID for note', yy_.yytext);*/return 22;
8002break;
8003case 49: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.substr(2).trim();return 29;
8004break;
8005case 50: this.popState();/*console.log('Got NOTE_TEXT for note',yy_.yytext);*/yy_.yytext = yy_.yytext.slice(0,-8).trim();return 29;
8006break;
8007case 51: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
8008break;
8009case 52: /*console.log('Got state diagram', yy_.yytext,'#');*/return 7;
8010break;
8011case 53: /*console.log('HIDE_EMPTY', yy_.yytext,'#');*/return 14;
8012break;
8013case 54: /*console.log('EDGE_STATE=',yy_.yytext);*/ return 42;
8014break;
8015case 55: /*console.log('=>ID=',yy_.yytext);*/ return 22;
8016break;
8017case 56: yy_.yytext = yy_.yytext.trim(); /*console.log('Descr = ', yy_.yytext);*/ return 12;
8018break;
8019case 57:return 13;
8020break;
8021case 58:return 26;
8022break;
8023case 59:return 5;
8024break;
8025case 60:return 'INVALID';
8026break;
8027}
8028},
8029rules: [/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?:$)/i,/^(?:.)/i],
8030conditions: {"LINE":{"rules":[13,14],"inclusive":false},"close_directive":{"rules":[13,14],"inclusive":false},"arg_directive":{"rules":[7,8,13,14],"inclusive":false},"type_directive":{"rules":[6,7,13,14],"inclusive":false},"open_directive":{"rules":[5,13,14],"inclusive":false},"struct":{"rules":[13,14,19,26,27,28,29,38,39,40,54,55,56,57,58],"inclusive":false},"FLOATING_NOTE_ID":{"rules":[47],"inclusive":false},"FLOATING_NOTE":{"rules":[44,45,46],"inclusive":false},"NOTE_TEXT":{"rules":[49,50],"inclusive":false},"NOTE_ID":{"rules":[48],"inclusive":false},"NOTE":{"rules":[41,42,43],"inclusive":false},"SCALE":{"rules":[17,18],"inclusive":false},"ALIAS":{"rules":[],"inclusive":false},"STATE_ID":{"rules":[32],"inclusive":false},"STATE_STRING":{"rules":[33,34],"inclusive":false},"FORK_STATE":{"rules":[],"inclusive":false},"STATE":{"rules":[13,14,20,21,22,23,24,25,30,31,35,36,37],"inclusive":false},"ID":{"rules":[13,14],"inclusive":false},"INITIAL":{"rules":[0,1,2,3,4,9,10,11,12,14,15,16,19,37,40,51,52,53,54,55,56,57,59,60],"inclusive":true}}
8031});
8032return lexer;
8033})();
8034parser.lexer = lexer;
8035function Parser () {
8036 this.yy = {};
8037}
8038Parser.prototype = parser;parser.Parser = Parser;
8039return new Parser;
8040})();
8041
8042
8043if (true) {
8044exports.parser = parser;
8045exports.Parser = parser.Parser;
8046exports.parse = function () { return parser.parse.apply(parser, arguments); };
8047exports.main = function commonjsMain (args) {
8048 if (!args[1]) {
8049 console.log('Usage: '+args[0]+' FILE');
8050 process.exit(1);
8051 }
8052 var source = (__webpack_require__(/*! fs */ "?a3b8").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
8053 return exports.parser.parse(source);
8054};
8055if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
8056 exports.main(process.argv.slice(1));
8057}
8058}
8059
8060/***/ }),
8061
8062/***/ "./src/diagrams/user-journey/parser/journey.jison":
8063/*!********************************************************!*\
8064 !*** ./src/diagrams/user-journey/parser/journey.jison ***!
8065 \********************************************************/
8066/***/ ((module, exports, __webpack_require__) => {
8067
8068/* module decorator */ module = __webpack_require__.nmd(module);
8069/* parser generated by jison 0.4.18 */
8070/*
8071 Returns a Parser object of the following structure:
8072
8073 Parser: {
8074 yy: {}
8075 }
8076
8077 Parser.prototype: {
8078 yy: {},
8079 trace: function(),
8080 symbols_: {associative list: name ==> number},
8081 terminals_: {associative list: number ==> name},
8082 productions_: [...],
8083 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
8084 table: [...],
8085 defaultActions: {...},
8086 parseError: function(str, hash),
8087 parse: function(input),
8088
8089 lexer: {
8090 EOF: 1,
8091 parseError: function(str, hash),
8092 setInput: function(input),
8093 input: function(),
8094 unput: function(str),
8095 more: function(),
8096 less: function(n),
8097 pastInput: function(),
8098 upcomingInput: function(),
8099 showPosition: function(),
8100 test_match: function(regex_match_array, rule_index),
8101 next: function(),
8102 lex: function(),
8103 begin: function(condition),
8104 popState: function(),
8105 _currentRules: function(),
8106 topState: function(),
8107 pushState: function(condition),
8108
8109 options: {
8110 ranges: boolean (optional: true ==> token location info will include a .range[] member)
8111 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
8112 backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
8113 },
8114
8115 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
8116 rules: [...],
8117 conditions: {associative list: name ==> set},
8118 }
8119 }
8120
8121
8122 token location info (@$, _$, etc.): {
8123 first_line: n,
8124 last_line: n,
8125 first_column: n,
8126 last_column: n,
8127 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
8128 }
8129
8130
8131 the parseError function receives a 'hash' object with these members for lexer and parser errors: {
8132 text: (matched text)
8133 token: (the produced terminal token, if any)
8134 line: (yylineno)
8135 }
8136 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
8137 loc: (yylloc)
8138 expected: (string describing the set of expected tokens)
8139 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
8140 }
8141*/
8142var parser = (function(){
8143var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,2],$V1=[1,5],$V2=[6,9,11,17,18,19,21],$V3=[1,15],$V4=[1,16],$V5=[1,17],$V6=[1,21],$V7=[4,6,9,11,17,18,19,21];
8144var parser = {trace: function trace () { },
8145yy: {},
8146symbols_: {"error":2,"start":3,"journey":4,"document":5,"EOF":6,"directive":7,"line":8,"SPACE":9,"statement":10,"NEWLINE":11,"openDirective":12,"typeDirective":13,"closeDirective":14,":":15,"argDirective":16,"title":17,"section":18,"taskName":19,"taskData":20,"open_directive":21,"type_directive":22,"arg_directive":23,"close_directive":24,"$accept":0,"$end":1},
8147terminals_: {2:"error",4:"journey",6:"EOF",9:"SPACE",11:"NEWLINE",15:":",17:"title",18:"section",19:"taskName",20:"taskData",21:"open_directive",22:"type_directive",23:"arg_directive",24:"close_directive"},
8148productions_: [0,[3,3],[3,2],[5,0],[5,2],[8,2],[8,1],[8,1],[8,1],[7,4],[7,6],[10,1],[10,1],[10,2],[10,1],[12,1],[13,1],[16,1],[14,1]],
8149performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) {
8150/* this == yyval */
8151
8152var $0 = $$.length - 1;
8153switch (yystate) {
8154case 1:
8155 return $$[$0-1];
8156break;
8157case 3:
8158 this.$ = []
8159break;
8160case 4:
8161$$[$0-1].push($$[$0]);this.$ = $$[$0-1]
8162break;
8163case 5: case 6:
8164 this.$ = $$[$0]
8165break;
8166case 7: case 8:
8167 this.$=[];
8168break;
8169case 11:
8170yy.setTitle($$[$0].substr(6));this.$=$$[$0].substr(6);
8171break;
8172case 12:
8173yy.addSection($$[$0].substr(8));this.$=$$[$0].substr(8);
8174break;
8175case 13:
8176yy.addTask($$[$0-1], $$[$0]);this.$='task';
8177break;
8178case 15:
8179 yy.parseDirective('%%{', 'open_directive');
8180break;
8181case 16:
8182 yy.parseDirective($$[$0], 'type_directive');
8183break;
8184case 17:
8185 $$[$0] = $$[$0].trim().replace(/'/g, '"'); yy.parseDirective($$[$0], 'arg_directive');
8186break;
8187case 18:
8188 yy.parseDirective('}%%', 'close_directive', 'journey');
8189break;
8190}
8191},
8192table: [{3:1,4:$V0,7:3,12:4,21:$V1},{1:[3]},o($V2,[2,3],{5:6}),{3:7,4:$V0,7:3,12:4,21:$V1},{13:8,22:[1,9]},{22:[2,15]},{6:[1,10],7:18,8:11,9:[1,12],10:13,11:[1,14],12:4,17:$V3,18:$V4,19:$V5,21:$V1},{1:[2,2]},{14:19,15:[1,20],24:$V6},o([15,24],[2,16]),o($V2,[2,8],{1:[2,1]}),o($V2,[2,4]),{7:18,10:22,12:4,17:$V3,18:$V4,19:$V5,21:$V1},o($V2,[2,6]),o($V2,[2,7]),o($V2,[2,11]),o($V2,[2,12]),{20:[1,23]},o($V2,[2,14]),{11:[1,24]},{16:25,23:[1,26]},{11:[2,18]},o($V2,[2,5]),o($V2,[2,13]),o($V7,[2,9]),{14:27,24:$V6},{24:[2,17]},{11:[1,28]},o($V7,[2,10])],
8193defaultActions: {5:[2,15],7:[2,2],21:[2,18],26:[2,17]},
8194parseError: function parseError (str, hash) {
8195 if (hash.recoverable) {
8196 this.trace(str);
8197 } else {
8198 var error = new Error(str);
8199 error.hash = hash;
8200 throw error;
8201 }
8202},
8203parse: function parse(input) {
8204 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
8205 var args = lstack.slice.call(arguments, 1);
8206 var lexer = Object.create(this.lexer);
8207 var sharedState = { yy: {} };
8208 for (var k in this.yy) {
8209 if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
8210 sharedState.yy[k] = this.yy[k];
8211 }
8212 }
8213 lexer.setInput(input, sharedState.yy);
8214 sharedState.yy.lexer = lexer;
8215 sharedState.yy.parser = this;
8216 if (typeof lexer.yylloc == 'undefined') {
8217 lexer.yylloc = {};
8218 }
8219 var yyloc = lexer.yylloc;
8220 lstack.push(yyloc);
8221 var ranges = lexer.options && lexer.options.ranges;
8222 if (typeof sharedState.yy.parseError === 'function') {
8223 this.parseError = sharedState.yy.parseError;
8224 } else {
8225 this.parseError = Object.getPrototypeOf(this).parseError;
8226 }
8227 function popStack(n) {
8228 stack.length = stack.length - 2 * n;
8229 vstack.length = vstack.length - n;
8230 lstack.length = lstack.length - n;
8231 }
8232 function lex() {
8233 var token;
8234 token = tstack.pop() || lexer.lex() || EOF;
8235 if (typeof token !== 'number') {
8236 if (token instanceof Array) {
8237 tstack = token;
8238 token = tstack.pop();
8239 }
8240 token = self.symbols_[token] || token;
8241 }
8242 return token;
8243 }
8244 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
8245 while (true) {
8246 state = stack[stack.length - 1];
8247 if (this.defaultActions[state]) {
8248 action = this.defaultActions[state];
8249 } else {
8250 if (symbol === null || typeof symbol == 'undefined') {
8251 symbol = lex();
8252 }
8253 action = table[state] && table[state][symbol];
8254 }
8255 if (typeof action === 'undefined' || !action.length || !action[0]) {
8256 var errStr = '';
8257 expected = [];
8258 for (p in table[state]) {
8259 if (this.terminals_[p] && p > TERROR) {
8260 expected.push('\'' + this.terminals_[p] + '\'');
8261 }
8262 }
8263 if (lexer.showPosition) {
8264 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
8265 } else {
8266 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
8267 }
8268 this.parseError(errStr, {
8269 text: lexer.match,
8270 token: this.terminals_[symbol] || symbol,
8271 line: lexer.yylineno,
8272 loc: yyloc,
8273 expected: expected
8274 });
8275 }
8276 if (action[0] instanceof Array && action.length > 1) {
8277 throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
8278 }
8279 switch (action[0]) {
8280 case 1:
8281 stack.push(symbol);
8282 vstack.push(lexer.yytext);
8283 lstack.push(lexer.yylloc);
8284 stack.push(action[1]);
8285 symbol = null;
8286 if (!preErrorSymbol) {
8287 yyleng = lexer.yyleng;
8288 yytext = lexer.yytext;
8289 yylineno = lexer.yylineno;
8290 yyloc = lexer.yylloc;
8291 if (recovering > 0) {
8292 recovering--;
8293 }
8294 } else {
8295 symbol = preErrorSymbol;
8296 preErrorSymbol = null;
8297 }
8298 break;
8299 case 2:
8300 len = this.productions_[action[1]][1];
8301 yyval.$ = vstack[vstack.length - len];
8302 yyval._$ = {
8303 first_line: lstack[lstack.length - (len || 1)].first_line,
8304 last_line: lstack[lstack.length - 1].last_line,
8305 first_column: lstack[lstack.length - (len || 1)].first_column,
8306 last_column: lstack[lstack.length - 1].last_column
8307 };
8308 if (ranges) {
8309 yyval._$.range = [
8310 lstack[lstack.length - (len || 1)].range[0],
8311 lstack[lstack.length - 1].range[1]
8312 ];
8313 }
8314 r = this.performAction.apply(yyval, [
8315 yytext,
8316 yyleng,
8317 yylineno,
8318 sharedState.yy,
8319 action[1],
8320 vstack,
8321 lstack
8322 ].concat(args));
8323 if (typeof r !== 'undefined') {
8324 return r;
8325 }
8326 if (len) {
8327 stack = stack.slice(0, -1 * len * 2);
8328 vstack = vstack.slice(0, -1 * len);
8329 lstack = lstack.slice(0, -1 * len);
8330 }
8331 stack.push(this.productions_[action[1]][0]);
8332 vstack.push(yyval.$);
8333 lstack.push(yyval._$);
8334 newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
8335 stack.push(newState);
8336 break;
8337 case 3:
8338 return true;
8339 }
8340 }
8341 return true;
8342}};
8343
8344/* generated by jison-lex 0.3.4 */
8345var lexer = (function(){
8346var lexer = ({
8347
8348EOF:1,
8349
8350parseError:function parseError(str, hash) {
8351 if (this.yy.parser) {
8352 this.yy.parser.parseError(str, hash);
8353 } else {
8354 throw new Error(str);
8355 }
8356 },
8357
8358// resets the lexer, sets new input
8359setInput:function (input, yy) {
8360 this.yy = yy || this.yy || {};
8361 this._input = input;
8362 this._more = this._backtrack = this.done = false;
8363 this.yylineno = this.yyleng = 0;
8364 this.yytext = this.matched = this.match = '';
8365 this.conditionStack = ['INITIAL'];
8366 this.yylloc = {
8367 first_line: 1,
8368 first_column: 0,
8369 last_line: 1,
8370 last_column: 0
8371 };
8372 if (this.options.ranges) {
8373 this.yylloc.range = [0,0];
8374 }
8375 this.offset = 0;
8376 return this;
8377 },
8378
8379// consumes and returns one char from the input
8380input:function () {
8381 var ch = this._input[0];
8382 this.yytext += ch;
8383 this.yyleng++;
8384 this.offset++;
8385 this.match += ch;
8386 this.matched += ch;
8387 var lines = ch.match(/(?:\r\n?|\n).*/g);
8388 if (lines) {
8389 this.yylineno++;
8390 this.yylloc.last_line++;
8391 } else {
8392 this.yylloc.last_column++;
8393 }
8394 if (this.options.ranges) {
8395 this.yylloc.range[1]++;
8396 }
8397
8398 this._input = this._input.slice(1);
8399 return ch;
8400 },
8401
8402// unshifts one char (or a string) into the input
8403unput:function (ch) {
8404 var len = ch.length;
8405 var lines = ch.split(/(?:\r\n?|\n)/g);
8406
8407 this._input = ch + this._input;
8408 this.yytext = this.yytext.substr(0, this.yytext.length - len);
8409 //this.yyleng -= len;
8410 this.offset -= len;
8411 var oldLines = this.match.split(/(?:\r\n?|\n)/g);
8412 this.match = this.match.substr(0, this.match.length - 1);
8413 this.matched = this.matched.substr(0, this.matched.length - 1);
8414
8415 if (lines.length - 1) {
8416 this.yylineno -= lines.length - 1;
8417 }
8418 var r = this.yylloc.range;
8419
8420 this.yylloc = {
8421 first_line: this.yylloc.first_line,
8422 last_line: this.yylineno + 1,
8423 first_column: this.yylloc.first_column,
8424 last_column: lines ?
8425 (lines.length === oldLines.length ? this.yylloc.first_column : 0)
8426 + oldLines[oldLines.length - lines.length].length - lines[0].length :
8427 this.yylloc.first_column - len
8428 };
8429
8430 if (this.options.ranges) {
8431 this.yylloc.range = [r[0], r[0] + this.yyleng - len];
8432 }
8433 this.yyleng = this.yytext.length;
8434 return this;
8435 },
8436
8437// When called from action, caches matched text and appends it on next action
8438more:function () {
8439 this._more = true;
8440 return this;
8441 },
8442
8443// 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.
8444reject:function () {
8445 if (this.options.backtrack_lexer) {
8446 this._backtrack = true;
8447 } else {
8448 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(), {
8449 text: "",
8450 token: null,
8451 line: this.yylineno
8452 });
8453
8454 }
8455 return this;
8456 },
8457
8458// retain first n characters of the match
8459less:function (n) {
8460 this.unput(this.match.slice(n));
8461 },
8462
8463// displays already matched input, i.e. for error messages
8464pastInput:function () {
8465 var past = this.matched.substr(0, this.matched.length - this.match.length);
8466 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
8467 },
8468
8469// displays upcoming input, i.e. for error messages
8470upcomingInput:function () {
8471 var next = this.match;
8472 if (next.length < 20) {
8473 next += this._input.substr(0, 20-next.length);
8474 }
8475 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, "");
8476 },
8477
8478// displays the character position where the lexing error occurred, i.e. for error messages
8479showPosition:function () {
8480 var pre = this.pastInput();
8481 var c = new Array(pre.length + 1).join("-");
8482 return pre + this.upcomingInput() + "\n" + c + "^";
8483 },
8484
8485// test the lexed token: return FALSE when not a match, otherwise return token
8486test_match:function(match, indexed_rule) {
8487 var token,
8488 lines,
8489 backup;
8490
8491 if (this.options.backtrack_lexer) {
8492 // save context
8493 backup = {
8494 yylineno: this.yylineno,
8495 yylloc: {
8496 first_line: this.yylloc.first_line,
8497 last_line: this.last_line,
8498 first_column: this.yylloc.first_column,
8499 last_column: this.yylloc.last_column
8500 },
8501 yytext: this.yytext,
8502 match: this.match,
8503 matches: this.matches,
8504 matched: this.matched,
8505 yyleng: this.yyleng,
8506 offset: this.offset,
8507 _more: this._more,
8508 _input: this._input,
8509 yy: this.yy,
8510 conditionStack: this.conditionStack.slice(0),
8511 done: this.done
8512 };
8513 if (this.options.ranges) {
8514 backup.yylloc.range = this.yylloc.range.slice(0);
8515 }
8516 }
8517
8518 lines = match[0].match(/(?:\r\n?|\n).*/g);
8519 if (lines) {
8520 this.yylineno += lines.length;
8521 }
8522 this.yylloc = {
8523 first_line: this.yylloc.last_line,
8524 last_line: this.yylineno + 1,
8525 first_column: this.yylloc.last_column,
8526 last_column: lines ?
8527 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length :
8528 this.yylloc.last_column + match[0].length
8529 };
8530 this.yytext += match[0];
8531 this.match += match[0];
8532 this.matches = match;
8533 this.yyleng = this.yytext.length;
8534 if (this.options.ranges) {
8535 this.yylloc.range = [this.offset, this.offset += this.yyleng];
8536 }
8537 this._more = false;
8538 this._backtrack = false;
8539 this._input = this._input.slice(match[0].length);
8540 this.matched += match[0];
8541 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
8542 if (this.done && this._input) {
8543 this.done = false;
8544 }
8545 if (token) {
8546 return token;
8547 } else if (this._backtrack) {
8548 // recover context
8549 for (var k in backup) {
8550 this[k] = backup[k];
8551 }
8552 return false; // rule action called reject() implying the next rule should be tested instead.
8553 }
8554 return false;
8555 },
8556
8557// return next match in input
8558next:function () {
8559 if (this.done) {
8560 return this.EOF;
8561 }
8562 if (!this._input) {
8563 this.done = true;
8564 }
8565
8566 var token,
8567 match,
8568 tempMatch,
8569 index;
8570 if (!this._more) {
8571 this.yytext = '';
8572 this.match = '';
8573 }
8574 var rules = this._currentRules();
8575 for (var i = 0; i < rules.length; i++) {
8576 tempMatch = this._input.match(this.rules[rules[i]]);
8577 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
8578 match = tempMatch;
8579 index = i;
8580 if (this.options.backtrack_lexer) {
8581 token = this.test_match(tempMatch, rules[i]);
8582 if (token !== false) {
8583 return token;
8584 } else if (this._backtrack) {
8585 match = false;
8586 continue; // rule action called reject() implying a rule MISmatch.
8587 } else {
8588 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
8589 return false;
8590 }
8591 } else if (!this.options.flex) {
8592 break;
8593 }
8594 }
8595 }
8596 if (match) {
8597 token = this.test_match(match, rules[index]);
8598 if (token !== false) {
8599 return token;
8600 }
8601 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
8602 return false;
8603 }
8604 if (this._input === "") {
8605 return this.EOF;
8606 } else {
8607 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
8608 text: "",
8609 token: null,
8610 line: this.yylineno
8611 });
8612 }
8613 },
8614
8615// return next match that has a token
8616lex:function lex () {
8617 var r = this.next();
8618 if (r) {
8619 return r;
8620 } else {
8621 return this.lex();
8622 }
8623 },
8624
8625// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
8626begin:function begin (condition) {
8627 this.conditionStack.push(condition);
8628 },
8629
8630// pop the previously active lexer condition state off the condition stack
8631popState:function popState () {
8632 var n = this.conditionStack.length - 1;
8633 if (n > 0) {
8634 return this.conditionStack.pop();
8635 } else {
8636 return this.conditionStack[0];
8637 }
8638 },
8639
8640// produce the lexer rule set which is active for the currently active lexer condition state
8641_currentRules:function _currentRules () {
8642 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
8643 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
8644 } else {
8645 return this.conditions["INITIAL"].rules;
8646 }
8647 },
8648
8649// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
8650topState:function topState (n) {
8651 n = this.conditionStack.length - 1 - Math.abs(n || 0);
8652 if (n >= 0) {
8653 return this.conditionStack[n];
8654 } else {
8655 return "INITIAL";
8656 }
8657 },
8658
8659// alias for begin(condition)
8660pushState:function pushState (condition) {
8661 this.begin(condition);
8662 },
8663
8664// return the number of states currently on the stack
8665stateStackSize:function stateStackSize() {
8666 return this.conditionStack.length;
8667 },
8668options: {"case-insensitive":true},
8669performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
8670var YYSTATE=YY_START;
8671switch($avoiding_name_collisions) {
8672case 0: this.begin('open_directive'); return 21;
8673break;
8674case 1: this.begin('type_directive'); return 22;
8675break;
8676case 2: this.popState(); this.begin('arg_directive'); return 15;
8677break;
8678case 3: this.popState(); this.popState(); return 24;
8679break;
8680case 4:return 23;
8681break;
8682case 5:/* skip comments */
8683break;
8684case 6:/* skip comments */
8685break;
8686case 7:return 11;
8687break;
8688case 8:/* skip whitespace */
8689break;
8690case 9:/* skip comments */
8691break;
8692case 10:return 4;
8693break;
8694case 11:return 17;
8695break;
8696case 12:return 18;
8697break;
8698case 13:return 19;
8699break;
8700case 14:return 20;
8701break;
8702case 15:return 15;
8703break;
8704case 16:return 6;
8705break;
8706case 17:return 'INVALID';
8707break;
8708}
8709},
8710rules: [/^(?:%%\{)/i,/^(?:((?:(?!\}%%)[^:.])*))/i,/^(?::)/i,/^(?:\}%%)/i,/^(?:((?:(?!\}%%).|\n)*))/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],
8711conditions: {"open_directive":{"rules":[1],"inclusive":false},"type_directive":{"rules":[2,3],"inclusive":false},"arg_directive":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}}
8712});
8713return lexer;
8714})();
8715parser.lexer = lexer;
8716function Parser () {
8717 this.yy = {};
8718}
8719Parser.prototype = parser;parser.Parser = Parser;
8720return new Parser;
8721})();
8722
8723
8724if (true) {
8725exports.parser = parser;
8726exports.Parser = parser.Parser;
8727exports.parse = function () { return parser.parse.apply(parser, arguments); };
8728exports.main = function commonjsMain (args) {
8729 if (!args[1]) {
8730 console.log('Usage: '+args[0]+' FILE');
8731 process.exit(1);
8732 }
8733 var source = (__webpack_require__(/*! fs */ "?0f62").readFileSync)((__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js").normalize)(args[1]), "utf8");
8734 return exports.parser.parse(source);
8735};
8736if ( true && __webpack_require__.c[__webpack_require__.s] === module) {
8737 exports.main(process.argv.slice(1));
8738}
8739}
8740
8741/***/ }),
8742
8743/***/ "./src/config.js":
8744/*!***********************!*\
8745 !*** ./src/config.js ***!
8746 \***********************/
8747/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8748
8749"use strict";
8750__webpack_require__.r(__webpack_exports__);
8751/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8752/* harmony export */ "defaultConfig": () => (/* binding */ defaultConfig),
8753/* harmony export */ "updateCurrentConfig": () => (/* binding */ updateCurrentConfig),
8754/* harmony export */ "setSiteConfig": () => (/* binding */ setSiteConfig),
8755/* harmony export */ "saveConfigFromInitilize": () => (/* binding */ saveConfigFromInitilize),
8756/* harmony export */ "updateSiteConfig": () => (/* binding */ updateSiteConfig),
8757/* harmony export */ "getSiteConfig": () => (/* binding */ getSiteConfig),
8758/* harmony export */ "setConfig": () => (/* binding */ setConfig),
8759/* harmony export */ "getConfig": () => (/* binding */ getConfig),
8760/* harmony export */ "sanitize": () => (/* binding */ sanitize),
8761/* harmony export */ "addDirective": () => (/* binding */ addDirective),
8762/* harmony export */ "reset": () => (/* binding */ reset)
8763/* harmony export */ });
8764/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
8765/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
8766/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
8767/* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
8768function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8769
8770
8771
8772
8773 // debugger;
8774
8775var defaultConfig = Object.freeze(_defaultConfig__WEBPACK_IMPORTED_MODULE_0__["default"]);
8776var siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
8777var configFromInitialize;
8778var directives = [];
8779var currentConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
8780var updateCurrentConfig = function updateCurrentConfig(siteCfg, _directives) {
8781 // start with config beeing the siteConfig
8782 var cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteCfg); // let sCfg = assignWithDepth(defaultConfig, siteConfigDelta);
8783 // Join directives
8784
8785 var sumOfDirectives = {};
8786
8787 for (var i = 0; i < _directives.length; i++) {
8788 var d = _directives[i];
8789 sanitize(d); // Apply the data from the directive where the the overrides the themeVaraibles
8790
8791 sumOfDirectives = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(sumOfDirectives, d);
8792 }
8793
8794 cfg = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(cfg, sumOfDirectives);
8795
8796 if (sumOfDirectives.theme) {
8797 var tmpConfigFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, configFromInitialize);
8798 var themeVariables = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(tmpConfigFromInitialize.themeVariables || {}, sumOfDirectives.themeVariables);
8799 cfg.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][cfg.theme].getThemeVariables(themeVariables);
8800 }
8801
8802 currentConfig = cfg;
8803 return cfg;
8804};
8805/**
8806 *## setSiteConfig
8807 *| Function | Description | Type | Values |
8808 *| --------- | ------------------- | ------- | ------------------ |
8809 *| setSiteConfig|Sets the siteConfig to desired values | Put Request | Any Values, except ones in secure array|
8810 ***Notes:**
8811 *Sets the siteConfig. The siteConfig is a protected configuration for repeat use. Calls to reset() will reset
8812 *the currentConfig to siteConfig. Calls to reset(configApi.defaultConfig) will reset siteConfig and currentConfig
8813 *to the defaultConfig
8814 *Note: currentConfig is set in this function
8815 **Default value: At default, will mirror Global Config**
8816 * @param conf - the base currentConfig to use as siteConfig
8817 * @returns {Object} - the siteConfig
8818 */
8819
8820var setSiteConfig = function setSiteConfig(conf) {
8821 siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, defaultConfig);
8822 siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf);
8823
8824 if (conf.theme) {
8825 siteConfig.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_2__["default"][conf.theme].getThemeVariables(conf.themeVariables);
8826 }
8827
8828 currentConfig = updateCurrentConfig(siteConfig, directives);
8829 return siteConfig;
8830};
8831var saveConfigFromInitilize = function saveConfigFromInitilize(conf) {
8832 configFromInitialize = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, conf);
8833};
8834var updateSiteConfig = function updateSiteConfig(conf) {
8835 siteConfig = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(siteConfig, conf);
8836 updateCurrentConfig(siteConfig, directives);
8837 return siteConfig;
8838};
8839/**
8840 *## getSiteConfig
8841 *| Function | Description | Type | Values |
8842 *| --------- | ------------------- | ------- | ------------------ |
8843 *| setSiteConfig|Returns the current siteConfig base configuration | Get Request | Returns Any Values in siteConfig|
8844 ***Notes**:
8845 *Returns **any** values in siteConfig.
8846 * @returns {Object} - the siteConfig
8847 */
8848
8849var getSiteConfig = function getSiteConfig() {
8850 return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, siteConfig);
8851};
8852/**
8853 *## setConfig
8854 *| Function | Description | Type | Values |
8855 *| --------- | ------------------- | ------- | ------------------ |
8856 *| setSiteConfig|Sets the siteConfig to desired values | Put Request| Any Values, except ones in secure array|
8857 ***Notes**:
8858 *Sets the currentConfig. The parameter conf is sanitized based on the siteConfig.secure keys. Any
8859 *values found in conf with key found in siteConfig.secure will be replaced with the corresponding
8860 *siteConfig value.
8861 * @param conf - the potential currentConfig
8862 * @returns {*} - the currentConfig merged with the sanitized conf
8863 */
8864
8865var setConfig = function setConfig(conf) {
8866 // sanitize(conf);
8867 // Object.keys(conf).forEach(key => {
8868 // const manipulator = manipulators[key];
8869 // conf[key] = manipulator ? manipulator(conf[key]) : conf[key];
8870 // });
8871 (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)(currentConfig, conf);
8872 return getConfig();
8873};
8874/**
8875 * ## getConfig
8876 *| Function | Description | Type | Return Values |
8877 *| --------- | ------------------- | ------- | ------------------ |
8878 *| getConfig |Obtains the currentConfig | Get Request | Any Values from currentConfig|
8879 ***Notes**:
8880 *Returns **any** the currentConfig
8881 * @returns {*} - the currentConfig
8882 */
8883
8884var getConfig = function getConfig() {
8885 return (0,_utils__WEBPACK_IMPORTED_MODULE_1__.assignWithDepth)({}, currentConfig);
8886};
8887/**
8888 *## sanitize
8889 *| Function | Description | Type | Values |
8890 *| --------- | ------------------- | ------- | ------------------ |
8891 *| sanitize |Sets the siteConfig to desired values. | Put Request |None|
8892 *Ensures options parameter does not attempt to override siteConfig secure keys
8893 *Note: modifies options in-place
8894 * @param options - the potential setConfig parameter
8895 */
8896
8897var sanitize = function sanitize(options) {
8898 // Checking that options are not in the list of excluded options
8899 Object.keys(siteConfig.secure).forEach(function (key) {
8900 if (typeof options[siteConfig.secure[key]] !== 'undefined') {
8901 // DO NOT attempt to print options[siteConfig.secure[key]] within `${}` as a malicious script
8902 // can exploit the logger's attempt to stringify the value and execute arbitrary code
8903 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug("Denied attempt to modify a secure key ".concat(siteConfig.secure[key]), options[siteConfig.secure[key]]);
8904 delete options[siteConfig.secure[key]];
8905 }
8906 }); // Check that there no attempts of prototype pollution
8907
8908 Object.keys(options).forEach(function (key) {
8909 if (key.indexOf('__') === 0) {
8910 delete options[key];
8911 }
8912 }); // Check that there no attempts of xss, there should be no tags at all in the directive
8913 // blocking data urls as base64 urls can contain svgs with inline script tags
8914
8915 Object.keys(options).forEach(function (key) {
8916 if (typeof options[key] === 'string') {
8917 if (options[key].indexOf('<') > -1 || options[key].indexOf('>') > -1 || options[key].indexOf('url(data:') > -1) {
8918 delete options[key];
8919 }
8920 }
8921
8922 if (_typeof(options[key]) === 'object') {
8923 sanitize(options[key]);
8924 }
8925 });
8926};
8927/**
8928 * Pushes in a directive to the configuration
8929 * @param {Object} directive The directive to push in
8930 */
8931
8932var addDirective = function addDirective(directive) {
8933 if (directive.fontFamily) {
8934 if (!directive.themeVariables) {
8935 directive.themeVariables = {
8936 fontFamily: directive.fontFamily
8937 };
8938 } else {
8939 if (!directive.themeVariables.fontFamily) {
8940 directive.themeVariables = {
8941 fontFamily: directive.fontFamily
8942 };
8943 }
8944 }
8945 }
8946
8947 directives.push(directive);
8948 updateCurrentConfig(siteConfig, directives);
8949};
8950/**
8951 *## reset
8952 *| Function | Description | Type | Required | Values |
8953 *| --------- | ------------------- | ------- | -------- | ------------------ |
8954 *| reset|Resets currentConfig to conf| Put Request | Required | None|
8955 *
8956 *| Parameter | Description |Type | Required | Values|
8957 *| --- | --- | --- | --- | --- |
8958 *| conf| base set of values, which currentConfig coul be **reset** to.| Dictionary | Required | Any Values, with respect to the secure Array|
8959 *
8960 **Notes :
8961 (default: current siteConfig ) (optional, default `getSiteConfig()`)
8962 * @param conf the base currentConfig to reset to (default: current siteConfig ) (optional, default `getSiteConfig()`)
8963 */
8964
8965var reset = function reset() {
8966 // Replace current config with siteConfig
8967 directives = [];
8968 updateCurrentConfig(siteConfig, directives);
8969};
8970
8971/***/ }),
8972
8973/***/ "./src/dagre-wrapper/clusters.js":
8974/*!***************************************!*\
8975 !*** ./src/dagre-wrapper/clusters.js ***!
8976 \***************************************/
8977/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8978
8979"use strict";
8980__webpack_require__.r(__webpack_exports__);
8981/* harmony export */ __webpack_require__.d(__webpack_exports__, {
8982/* harmony export */ "insertCluster": () => (/* binding */ insertCluster),
8983/* harmony export */ "getClusterTitleWidth": () => (/* binding */ getClusterTitleWidth),
8984/* harmony export */ "clear": () => (/* binding */ clear),
8985/* harmony export */ "positionCluster": () => (/* binding */ positionCluster)
8986/* harmony export */ });
8987/* harmony import */ var _intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intersect/intersect-rect */ "./src/dagre-wrapper/intersect/intersect-rect.js");
8988/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
8989/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
8990/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
8991/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
8992/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../config */ "./src/config.js");
8993/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
8994
8995
8996
8997
8998
8999
9000
9001var rect = function rect(parent, node) {
9002 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Creating subgraph rect for ', node.id, node); // Add outer g element
9003
9004 var shapeSvg = parent.insert('g').attr('class', 'cluster' + (node.class ? ' ' + node.class : '')).attr('id', node.id); // add the rect
9005
9006 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
9007
9008 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
9009 var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
9010
9011 var bbox = text.getBBox();
9012
9013 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
9014 var div = text.children[0];
9015 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
9016 bbox = div.getBoundingClientRect();
9017 dv.attr('width', bbox.width);
9018 dv.attr('height', bbox.height);
9019 }
9020
9021 var padding = 0 * node.padding;
9022 var halfPadding = padding / 2;
9023 var width = node.width <= bbox.width + padding ? bbox.width + padding : node.width;
9024
9025 if (node.width <= bbox.width + padding) {
9026 node.diff = (bbox.width - node.width) / 2;
9027 } else {
9028 node.diff = -node.padding / 2;
9029 }
9030
9031 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Data ', node, JSON.stringify(node)); // center the rect around its coordinate
9032
9033 rect.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - width / 2).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width).attr('height', node.height + padding); // Center the label
9034
9035 label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 + node.padding / 3) + ')');
9036 var rectBox = rect.node().getBBox();
9037 node.width = rectBox.width;
9038 node.height = rectBox.height;
9039
9040 node.intersect = function (point) {
9041 return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
9042 };
9043
9044 return shapeSvg;
9045};
9046/**
9047 * Non visiable cluster where the note is group with its
9048 */
9049
9050
9051var noteGroup = function noteGroup(parent, node) {
9052 // Add outer g element
9053 var shapeSvg = parent.insert('g').attr('class', 'note-cluster').attr('id', node.id); // add the rect
9054
9055 var rect = shapeSvg.insert('rect', ':first-child');
9056 var padding = 0 * node.padding;
9057 var halfPadding = padding / 2; // center the rect around its coordinate
9058
9059 rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', node.width + padding).attr('height', node.height + padding).attr('fill', 'none');
9060 var rectBox = rect.node().getBBox();
9061 node.width = rectBox.width;
9062 node.height = rectBox.height;
9063
9064 node.intersect = function (point) {
9065 return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
9066 };
9067
9068 return shapeSvg;
9069};
9070
9071var roundedWithTitle = function roundedWithTitle(parent, node) {
9072 // Add outer g element
9073 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
9074
9075 var rect = shapeSvg.insert('rect', ':first-child'); // Create the label and insert it after the rect
9076
9077 var label = shapeSvg.insert('g').attr('class', 'cluster-label');
9078 var innerRect = shapeSvg.append('rect');
9079 var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true)); // Get the size of the label
9080
9081 var bbox = text.getBBox();
9082
9083 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
9084 var div = text.children[0];
9085 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
9086 bbox = div.getBoundingClientRect();
9087 dv.attr('width', bbox.width);
9088 dv.attr('height', bbox.height);
9089 }
9090
9091 bbox = text.getBBox();
9092 var padding = 0 * node.padding;
9093 var halfPadding = padding / 2;
9094 var width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
9095
9096 if (node.width <= bbox.width + node.padding) {
9097 node.diff = (bbox.width + node.padding * 0 - node.width) / 2;
9098 } else {
9099 node.diff = -node.padding / 2;
9100 } // center the rect around its coordinate
9101
9102
9103 rect.attr('class', 'outer').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding).attr('width', width + padding).attr('height', node.height + padding);
9104 innerRect.attr('class', 'inner').attr('x', node.x - width / 2 - halfPadding).attr('y', node.y - node.height / 2 - halfPadding + bbox.height - 1).attr('width', width + padding).attr('height', node.height + padding - bbox.height - 3); // Center the label
9105
9106 label.attr('transform', 'translate(' + (node.x - bbox.width / 2) + ', ' + (node.y - node.height / 2 - node.padding / 3 + ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels) ? 5 : 3)) + ')');
9107 var rectBox = rect.node().getBBox();
9108 node.height = rectBox.height;
9109
9110 node.intersect = function (point) {
9111 return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
9112 };
9113
9114 return shapeSvg;
9115};
9116
9117var divider = function divider(parent, node) {
9118 // Add outer g element
9119 var shapeSvg = parent.insert('g').attr('class', node.classes).attr('id', node.id); // add the rect
9120
9121 var rect = shapeSvg.insert('rect', ':first-child');
9122 var padding = 0 * node.padding;
9123 var halfPadding = padding / 2; // center the rect around its coordinate
9124
9125 rect.attr('class', 'divider').attr('x', node.x - node.width / 2 - halfPadding).attr('y', node.y - node.height / 2).attr('width', node.width + padding).attr('height', node.height + padding);
9126 var rectBox = rect.node().getBBox();
9127 node.width = rectBox.width;
9128 node.height = rectBox.height;
9129 node.diff = -node.padding / 2;
9130
9131 node.intersect = function (point) {
9132 return (0,_intersect_intersect_rect__WEBPACK_IMPORTED_MODULE_5__["default"])(node, point);
9133 };
9134
9135 return shapeSvg;
9136};
9137
9138var shapes = {
9139 rect: rect,
9140 roundedWithTitle: roundedWithTitle,
9141 noteGroup: noteGroup,
9142 divider: divider
9143};
9144var clusterElems = {};
9145var insertCluster = function insertCluster(elem, node) {
9146 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Inserting cluster');
9147 var shape = node.shape || 'rect';
9148 clusterElems[node.id] = shapes[shape](elem, node);
9149};
9150var getClusterTitleWidth = function getClusterTitleWidth(elem, node) {
9151 var label = (0,_createLabel__WEBPACK_IMPORTED_MODULE_2__["default"])(node.labelText, node.labelStyle, undefined, true);
9152 elem.node().appendChild(label);
9153 var width = label.getBBox().width;
9154 elem.node().removeChild(label);
9155 return width;
9156};
9157var clear = function clear() {
9158 clusterElems = {};
9159};
9160var positionCluster = function positionCluster(node) {
9161 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Position cluster (' + node.id + ', ' + node.x + ', ' + node.y + ')');
9162 var el = clusterElems[node.id];
9163 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
9164};
9165
9166/***/ }),
9167
9168/***/ "./src/dagre-wrapper/createLabel.js":
9169/*!******************************************!*\
9170 !*** ./src/dagre-wrapper/createLabel.js ***!
9171 \******************************************/
9172/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9173
9174"use strict";
9175__webpack_require__.r(__webpack_exports__);
9176/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9177/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
9178/* harmony export */ });
9179/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
9180/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
9181/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
9182/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../config */ "./src/config.js");
9183/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
9184function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
9185
9186
9187 // eslint-disable-line
9188
9189
9190 // let vertexNode;
9191// if (evaluate(getConfig().flowchart.htmlLabels)) {
9192// // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9193// const node = {
9194// label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, s => `<i class='${s.replace(':', ' ')}'></i>`)
9195// };
9196// vertexNode = addHtmlLabel(svg, node).node();
9197// vertexNode.parentNode.removeChild(vertexNode);
9198// } else {
9199// const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9200// svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
9201// const rows = vertexText.split(common.lineBreakRegex);
9202// for (let j = 0; j < rows.length; j++) {
9203// const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9204// tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9205// tspan.setAttribute('dy', '1em');
9206// tspan.setAttribute('x', '1');
9207// tspan.textContent = rows[j];
9208// svgLabel.appendChild(tspan);
9209// }
9210// vertexNode = svgLabel;
9211// }
9212
9213function applyStyle(dom, styleFn) {
9214 if (styleFn) {
9215 dom.attr('style', styleFn);
9216 }
9217}
9218
9219function addHtmlLabel(node) {
9220 // var fo = root.append('foreignObject').attr('width', '100000');
9221 // var div = fo.append('xhtml:div');
9222 // div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
9223 // var label = node.label;
9224 // switch (typeof label) {
9225 // case 'function':
9226 // div.insert(label);
9227 // break;
9228 // case 'object':
9229 // // Currently we assume this is a DOM object.
9230 // div.insert(function() {
9231 // return label;
9232 // });
9233 // break;
9234 // default:
9235 // div.html(label);
9236 // }
9237 // applyStyle(div, node.labelStyle);
9238 // div.style('display', 'inline-block');
9239 // // Fix for firefox
9240 // div.style('white-space', 'nowrap');
9241 // var client = div.node().getBoundingClientRect();
9242 // fo.attr('width', client.width).attr('height', client.height);
9243 var fo = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject'));
9244 var div = fo.append('xhtml:div');
9245 var label = node.label;
9246 var labelClass = node.isNode ? 'nodeLabel' : 'edgeLabel';
9247 div.html('<span class="' + labelClass + '" ' + (node.labelStyle ? 'style="' + node.labelStyle + '"' : '') + '>' + label + '</span>');
9248 applyStyle(div, node.labelStyle);
9249 div.style('display', 'inline-block'); // Fix for firefox
9250
9251 div.style('white-space', 'nowrap');
9252 div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
9253 return fo.node();
9254}
9255
9256var createLabel = function createLabel(_vertexText, style, isTitle, isNode) {
9257 var vertexText = _vertexText || '';
9258 if (_typeof(vertexText) === 'object') vertexText = vertexText[0];
9259
9260 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_1__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_2__.getConfig)().flowchart.htmlLabels)) {
9261 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
9262 vertexText = vertexText.replace(/\\n|\n/g, '<br />');
9263 _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('vertexText' + vertexText);
9264 var node = {
9265 isNode: isNode,
9266 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
9267 return "<i class='".concat(s.replace(':', ' '), "'></i>");
9268 }),
9269 labelStyle: style.replace('fill:', 'color:')
9270 };
9271 var vertexNode = addHtmlLabel(node); // vertexNode.parentNode.removeChild(vertexNode);
9272
9273 return vertexNode;
9274 } else {
9275 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
9276 svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
9277 var rows = [];
9278
9279 if (typeof vertexText === 'string') {
9280 rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
9281 } else if (Array.isArray(vertexText)) {
9282 rows = vertexText;
9283 } else {
9284 rows = [];
9285 }
9286
9287 for (var j = 0; j < rows.length; j++) {
9288 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
9289 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
9290 tspan.setAttribute('dy', '1em');
9291 tspan.setAttribute('x', '0');
9292
9293 if (isTitle) {
9294 tspan.setAttribute('class', 'title-row');
9295 } else {
9296 tspan.setAttribute('class', 'row');
9297 }
9298
9299 tspan.textContent = rows[j].trim();
9300 svgLabel.appendChild(tspan);
9301 }
9302
9303 return svgLabel;
9304 }
9305};
9306
9307/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (createLabel);
9308
9309/***/ }),
9310
9311/***/ "./src/dagre-wrapper/edges.js":
9312/*!************************************!*\
9313 !*** ./src/dagre-wrapper/edges.js ***!
9314 \************************************/
9315/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9316
9317"use strict";
9318__webpack_require__.r(__webpack_exports__);
9319/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9320/* harmony export */ "clear": () => (/* binding */ clear),
9321/* harmony export */ "insertEdgeLabel": () => (/* binding */ insertEdgeLabel),
9322/* harmony export */ "positionEdgeLabel": () => (/* binding */ positionEdgeLabel),
9323/* harmony export */ "intersection": () => (/* binding */ intersection),
9324/* harmony export */ "insertEdge": () => (/* binding */ insertEdge)
9325/* harmony export */ });
9326/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
9327/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
9328/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
9329/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
9330/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../config */ "./src/config.js");
9331/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils */ "./src/utils.js");
9332/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
9333 // eslint-disable-line
9334
9335 // import { line, curveBasis, curveLinear, select } from 'd3';
9336
9337
9338
9339
9340
9341var edgeLabels = {};
9342var terminalLabels = {};
9343var clear = function clear() {
9344 edgeLabels = {};
9345 terminalLabels = {};
9346};
9347var insertEdgeLabel = function insertEdgeLabel(elem, edge) {
9348 // Create the actual text element
9349 var labelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.label, edge.labelStyle); // Create outer g, edgeLabel, this will be positioned after graph layout
9350
9351 var edgeLabel = elem.insert('g').attr('class', 'edgeLabel'); // Create inner g, label, this will be positioned now for centering the text
9352
9353 var label = edgeLabel.insert('g').attr('class', 'label');
9354 label.node().appendChild(labelElement); // Center the label
9355
9356 var bbox = labelElement.getBBox();
9357
9358 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels)) {
9359 var div = labelElement.children[0];
9360 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(labelElement);
9361 bbox = div.getBoundingClientRect();
9362 dv.attr('width', bbox.width);
9363 dv.attr('height', bbox.height);
9364 }
9365
9366 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')'); // Make element accessible by id for positioning
9367
9368 edgeLabels[edge.id] = edgeLabel; // Update the abstract data of the edge with the new information about its width and height
9369
9370 edge.width = bbox.width;
9371 edge.height = bbox.height;
9372 var fo;
9373
9374 if (edge.startLabelLeft) {
9375 // Create the actual text element
9376 var startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelLeft, edge.labelStyle);
9377 var startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
9378 var inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
9379 fo = inner.node().appendChild(startLabelElement);
9380 var slBox = startLabelElement.getBBox();
9381 inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
9382
9383 if (!terminalLabels[edge.id]) {
9384 terminalLabels[edge.id] = {};
9385 }
9386
9387 terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
9388 setTerminalWidth(fo, edge.startLabelLeft);
9389 }
9390
9391 if (edge.startLabelRight) {
9392 // Create the actual text element
9393 var _startLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.startLabelRight, edge.labelStyle);
9394
9395 var startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
9396
9397 var _inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
9398
9399 fo = startEdgeLabelRight.node().appendChild(_startLabelElement);
9400
9401 _inner.node().appendChild(_startLabelElement);
9402
9403 var _slBox = _startLabelElement.getBBox();
9404
9405 _inner.attr('transform', 'translate(' + -_slBox.width / 2 + ', ' + -_slBox.height / 2 + ')');
9406
9407 if (!terminalLabels[edge.id]) {
9408 terminalLabels[edge.id] = {};
9409 }
9410
9411 terminalLabels[edge.id].startRight = startEdgeLabelRight;
9412 setTerminalWidth(fo, edge.startLabelRight);
9413 }
9414
9415 if (edge.endLabelLeft) {
9416 // Create the actual text element
9417 var endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelLeft, edge.labelStyle);
9418 var endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
9419
9420 var _inner2 = endEdgeLabelLeft.insert('g').attr('class', 'inner');
9421
9422 fo = _inner2.node().appendChild(endLabelElement);
9423
9424 var _slBox2 = endLabelElement.getBBox();
9425
9426 _inner2.attr('transform', 'translate(' + -_slBox2.width / 2 + ', ' + -_slBox2.height / 2 + ')');
9427
9428 endEdgeLabelLeft.node().appendChild(endLabelElement);
9429
9430 if (!terminalLabels[edge.id]) {
9431 terminalLabels[edge.id] = {};
9432 }
9433
9434 terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
9435 setTerminalWidth(fo, edge.endLabelLeft);
9436 }
9437
9438 if (edge.endLabelRight) {
9439 // Create the actual text element
9440 var _endLabelElement = (0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])(edge.endLabelRight, edge.labelStyle);
9441
9442 var endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
9443
9444 var _inner3 = endEdgeLabelRight.insert('g').attr('class', 'inner');
9445
9446 fo = _inner3.node().appendChild(_endLabelElement);
9447
9448 var _slBox3 = _endLabelElement.getBBox();
9449
9450 _inner3.attr('transform', 'translate(' + -_slBox3.width / 2 + ', ' + -_slBox3.height / 2 + ')');
9451
9452 endEdgeLabelRight.node().appendChild(_endLabelElement);
9453
9454 if (!terminalLabels[edge.id]) {
9455 terminalLabels[edge.id] = {};
9456 }
9457
9458 terminalLabels[edge.id].endRight = endEdgeLabelRight;
9459 setTerminalWidth(fo, edge.endLabelRight);
9460 }
9461};
9462
9463function setTerminalWidth(fo, value) {
9464 if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().flowchart.htmlLabels && fo) {
9465 fo.style.width = value.length * 9 + 'px';
9466 fo.style.height = '12px';
9467 }
9468}
9469
9470var positionEdgeLabel = function positionEdgeLabel(edge, paths) {
9471 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label abc78 ', edge.id, edge.label, edgeLabels[edge.id]);
9472 var path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
9473
9474 if (edge.label) {
9475 var el = edgeLabels[edge.id];
9476 var x = edge.x;
9477 var y = edge.y;
9478
9479 if (path) {
9480 // // debugger;
9481 var pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path);
9482 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Moving label from (', x, ',', y, ') to (', pos.x, ',', pos.y, ') abc78'); // x = pos.x;
9483 // y = pos.y;
9484 }
9485
9486 el.attr('transform', 'translate(' + x + ', ' + y + ')');
9487 } //let path = paths.updatedPath ? paths.updatedPath : paths.originalPath;
9488
9489
9490 if (edge.startLabelLeft) {
9491 var _el = terminalLabels[edge.id].startLeft;
9492 var _x2 = edge.x;
9493 var _y2 = edge.y;
9494
9495 if (path) {
9496 // debugger;
9497 var _pos = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_left', path);
9498
9499 _x2 = _pos.x;
9500 _y2 = _pos.y;
9501 }
9502
9503 _el.attr('transform', 'translate(' + _x2 + ', ' + _y2 + ')');
9504 }
9505
9506 if (edge.startLabelRight) {
9507 var _el2 = terminalLabels[edge.id].startRight;
9508 var _x3 = edge.x;
9509 var _y3 = edge.y;
9510
9511 if (path) {
9512 // debugger;
9513 var _pos2 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeStart ? 10 : 0, 'start_right', path);
9514
9515 _x3 = _pos2.x;
9516 _y3 = _pos2.y;
9517 }
9518
9519 _el2.attr('transform', 'translate(' + _x3 + ', ' + _y3 + ')');
9520 }
9521
9522 if (edge.endLabelLeft) {
9523 var _el3 = terminalLabels[edge.id].endLeft;
9524 var _x4 = edge.x;
9525 var _y4 = edge.y;
9526
9527 if (path) {
9528 // debugger;
9529 var _pos3 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_left', path);
9530
9531 _x4 = _pos3.x;
9532 _y4 = _pos3.y;
9533 }
9534
9535 _el3.attr('transform', 'translate(' + _x4 + ', ' + _y4 + ')');
9536 }
9537
9538 if (edge.endLabelRight) {
9539 var _el4 = terminalLabels[edge.id].endRight;
9540 var _x5 = edge.x;
9541 var _y5 = edge.y;
9542
9543 if (path) {
9544 // debugger;
9545 var _pos4 = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcTerminalLabelPosition(edge.arrowTypeEnd ? 10 : 0, 'end_right', path);
9546
9547 _x5 = _pos4.x;
9548 _y5 = _pos4.y;
9549 }
9550
9551 _el4.attr('transform', 'translate(' + _x5 + ', ' + _y5 + ')');
9552 }
9553}; // const getRelationType = function(type) {
9554// switch (type) {
9555// case stateDb.relationType.AGGREGATION:
9556// return 'aggregation';
9557// case stateDb.relationType.EXTENSION:
9558// return 'extension';
9559// case stateDb.relationType.COMPOSITION:
9560// return 'composition';
9561// case stateDb.relationType.DEPENDENCY:
9562// return 'dependency';
9563// }
9564// };
9565
9566var outsideNode = function outsideNode(node, point) {
9567 // log.warn('Checking bounds ', node, point);
9568 var x = node.x;
9569 var y = node.y;
9570 var dx = Math.abs(point.x - x);
9571 var dy = Math.abs(point.y - y);
9572 var w = node.width / 2;
9573 var h = node.height / 2;
9574
9575 if (dx >= w || dy >= h) {
9576 return true;
9577 }
9578
9579 return false;
9580};
9581
9582var intersection = function intersection(node, outsidePoint, insidePoint) {
9583 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("intersection calc abc89:\n outsidePoint: ".concat(JSON.stringify(outsidePoint), "\n insidePoint : ").concat(JSON.stringify(insidePoint), "\n node : x:").concat(node.x, " y:").concat(node.y, " w:").concat(node.width, " h:").concat(node.height));
9584 var x = node.x;
9585 var y = node.y;
9586 var dx = Math.abs(x - insidePoint.x); // const dy = Math.abs(y - insidePoint.y);
9587
9588 var w = node.width / 2;
9589 var r = insidePoint.x < outsidePoint.x ? w - dx : w + dx;
9590 var h = node.height / 2; // const edges = {
9591 // x1: x - w,
9592 // x2: x + w,
9593 // y1: y - h,
9594 // y2: y + h
9595 // };
9596 // if (
9597 // outsidePoint.x === edges.x1 ||
9598 // outsidePoint.x === edges.x2 ||
9599 // outsidePoint.y === edges.y1 ||
9600 // outsidePoint.y === edges.y2
9601 // ) {
9602 // log.warn('abc89 calc equals on edge', outsidePoint, edges);
9603 // return outsidePoint;
9604 // }
9605
9606 var Q = Math.abs(outsidePoint.y - insidePoint.y);
9607 var R = Math.abs(outsidePoint.x - insidePoint.x); // log.warn();
9608
9609 if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
9610 // eslint-disable-line
9611 // Intersection is top or bottom of rect.
9612 // let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
9613 var q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
9614 r = R * q / Q;
9615 var res = {
9616 x: insidePoint.x < outsidePoint.x ? insidePoint.x + r : insidePoint.x - R + r,
9617 y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q
9618 };
9619
9620 if (r === 0) {
9621 res.x = outsidePoint.x;
9622 res.y = outsidePoint.y;
9623 }
9624
9625 if (R === 0) {
9626 res.x = outsidePoint.x;
9627 }
9628
9629 if (Q === 0) {
9630 res.y = outsidePoint.y;
9631 }
9632
9633 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("abc89 topp/bott calc, Q ".concat(Q, ", q ").concat(q, ", R ").concat(R, ", r ").concat(r), res);
9634 return res;
9635 } else {
9636 // Intersection onn sides of rect
9637 if (insidePoint.x < outsidePoint.x) {
9638 r = outsidePoint.x - w - x;
9639 } else {
9640 // r = outsidePoint.x - w - x;
9641 r = x - w - outsidePoint.x;
9642 }
9643
9644 var _q = Q * r / R; // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x + dx - w;
9645 // OK let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r;
9646
9647
9648 var _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : insidePoint.x - R + r; // let _x = insidePoint.x < outsidePoint.x ? insidePoint.x + R - r : outsidePoint.x + r;
9649
9650
9651 var _y = insidePoint.y < outsidePoint.y ? insidePoint.y + _q : insidePoint.y - _q;
9652
9653 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("sides calc abc89, Q ".concat(Q, ", q ").concat(_q, ", R ").concat(R, ", r ").concat(r), {
9654 _x: _x,
9655 _y: _y
9656 });
9657
9658 if (r === 0) {
9659 _x = outsidePoint.x;
9660 _y = outsidePoint.y;
9661 }
9662
9663 if (R === 0) {
9664 _x = outsidePoint.x;
9665 }
9666
9667 if (Q === 0) {
9668 _y = outsidePoint.y;
9669 }
9670
9671 return {
9672 x: _x,
9673 y: _y
9674 };
9675 }
9676};
9677/**
9678 * This function will page a path and node where the last point(s) in the path is inside the node
9679 * and return an update path ending by the border of the node.
9680 * @param {*} points
9681 * @param {*} boundryNode
9682 * @returns
9683 */
9684
9685var cutPathAtIntersect = function cutPathAtIntersect(_points, boundryNode) {
9686 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 cutPathAtIntersect', _points, boundryNode);
9687 var points = [];
9688 var lastPointOutside = _points[0];
9689 var isInside = false;
9690
9691 _points.forEach(function (point) {
9692 // const node = clusterDb[edge.toCluster].node;
9693 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 checking point', point, boundryNode); // check if point is inside the boundry rect
9694
9695 if (!outsideNode(boundryNode, point) && !isInside) {
9696 // First point inside the rect found
9697 // Calc the intersection coord between the point anf the last opint ouside the rect
9698 var inter = intersection(boundryNode, lastPointOutside, point);
9699 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 inside', point, lastPointOutside, inter);
9700 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 intersection', inter); // // Check case where the intersection is the same as the last point
9701
9702 var pointPresent = false;
9703 points.forEach(function (p) {
9704 pointPresent = pointPresent || p.x === inter.x && p.y === inter.y;
9705 }); // // if (!pointPresent) {
9706
9707 if (!points.find(function (e) {
9708 return e.x === inter.x && e.y === inter.y;
9709 })) {
9710 points.push(inter);
9711 } else {
9712 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 no intersect', inter, points);
9713 } // points.push(inter);
9714
9715
9716 isInside = true;
9717 } else {
9718 // Outside
9719 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 outside', point, lastPointOutside);
9720 lastPointOutside = point; // points.push(point);
9721
9722 if (!isInside) points.push(point);
9723 }
9724 });
9725
9726 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn('abc88 returning points', points);
9727 return points;
9728}; //(edgePaths, e, edge, clusterDb, diagramtype, graph)
9729
9730
9731var insertEdge = function insertEdge(elem, e, edge, clusterDb, diagramType, graph) {
9732 var points = edge.points;
9733 var pointsHasChanged = false;
9734 var tail = graph.node(e.v);
9735 var head = graph.node(e.w);
9736 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('abc88 InsertEdge: ', edge);
9737
9738 if (head.intersect && tail.intersect) {
9739 points = points.slice(1, edge.points.length - 1);
9740 points.unshift(tail.intersect(points[0]));
9741 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('Last point', points[points.length - 1], head, head.intersect(points[points.length - 1]));
9742 points.push(head.intersect(points[points.length - 1]));
9743 }
9744
9745 if (edge.toCluster) {
9746 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('to cluster abc88', clusterDb[edge.toCluster]);
9747 points = cutPathAtIntersect(edge.points, clusterDb[edge.toCluster].node); // log.trace('edge', edge);
9748 // points = [];
9749 // let lastPointOutside; // = edge.points[0];
9750 // let isInside = false;
9751 // edge.points.forEach(point => {
9752 // const node = clusterDb[edge.toCluster].node;
9753 // log.warn('checking from', edge.fromCluster, point, node);
9754 // if (!outsideNode(node, point) && !isInside) {
9755 // log.trace('inside', edge.toCluster, point, lastPointOutside);
9756 // // First point inside the rect
9757 // const inter = intersection(node, lastPointOutside, point);
9758 // let pointPresent = false;
9759 // points.forEach(p => {
9760 // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
9761 // });
9762 // // if (!pointPresent) {
9763 // if (!points.find(e => e.x === inter.x && e.y === inter.y)) {
9764 // points.push(inter);
9765 // } else {
9766 // log.warn('no intersect', inter, points);
9767 // }
9768 // isInside = true;
9769 // } else {
9770 // // outtside
9771 // lastPointOutside = point;
9772 // if (!isInside) points.push(point);
9773 // }
9774 // });
9775
9776 pointsHasChanged = true;
9777 }
9778
9779 if (edge.fromCluster) {
9780 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('from cluster abc88', clusterDb[edge.fromCluster]);
9781 points = cutPathAtIntersect(points.reverse(), clusterDb[edge.fromCluster].node).reverse(); // log.warn('edge', edge);
9782 // log.warn('from cluster', clusterDb[edge.fromCluster], points);
9783 // const updatedPoints = [];
9784 // let lastPointOutside = edge.points[edge.points.length - 1];
9785 // let isInside = false;
9786 // for (let i = points.length - 1; i >= 0; i--) {
9787 // const point = points[i];
9788 // const node = clusterDb[edge.fromCluster].node;
9789 // log.warn('checking to', edge.fromCluster, point, node);
9790 // if (!outsideNode(node, point) && !isInside) {
9791 // log.warn('inside', edge.fromCluster, point, node);
9792 // // First point inside the rect
9793 // const inter = intersection(node, lastPointOutside, point);
9794 // log.warn('intersect', intersection(node, lastPointOutside, point));
9795 // let pointPresent = false;
9796 // points.forEach(p => {
9797 // pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y);
9798 // });
9799 // // if (!pointPresent) {
9800 // if (!points.find(e => e.x === inter.x && e.y === inter.y)) {
9801 // updatedPoints.unshift(inter);
9802 // log.warn('Adding point -updated = ', updatedPoints);
9803 // } else {
9804 // log.warn('no intersect', inter, points);
9805 // }
9806 // // points.push(insterection);
9807 // isInside = true;
9808 // } else {
9809 // // at the outside
9810 // // if (!isInside) updatedPoints.unshift(point);
9811 // updatedPoints.unshift(point);
9812 // log.warn('Outside point', point, updatedPoints);
9813 // }
9814 // lastPointOutside = point;
9815 // }
9816 // points = updatedPoints;
9817 // points = edge.points;
9818
9819 pointsHasChanged = true;
9820 } // The data for our line
9821
9822
9823 var lineData = points.filter(function (p) {
9824 return !Number.isNaN(p.y);
9825 }); // This is the accessor function we talked about above
9826
9827 var curve; // Currently only flowcharts get the curve from the settings, perhaps this should
9828 // be expanded to a common setting? Restricting it for now in order not to cause side-effects that
9829 // have not been thought through
9830
9831 if (diagramType === 'graph' || diagramType === 'flowchart') {
9832 curve = edge.curve || d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
9833 } else {
9834 curve = d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis;
9835 } // curve = curveLinear;
9836
9837
9838 var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
9839 return d.x;
9840 }).y(function (d) {
9841 return d.y;
9842 }).curve(curve); // Contruct stroke classes based on properties
9843
9844 var strokeClasses;
9845
9846 switch (edge.thickness) {
9847 case 'normal':
9848 strokeClasses = 'edge-thickness-normal';
9849 break;
9850
9851 case 'thick':
9852 strokeClasses = 'edge-thickness-thick';
9853 break;
9854
9855 default:
9856 strokeClasses = '';
9857 }
9858
9859 switch (edge.pattern) {
9860 case 'solid':
9861 strokeClasses += ' edge-pattern-solid';
9862 break;
9863
9864 case 'dotted':
9865 strokeClasses += ' edge-pattern-dotted';
9866 break;
9867
9868 case 'dashed':
9869 strokeClasses += ' edge-pattern-dashed';
9870 break;
9871 }
9872
9873 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', edge.id).attr('class', ' ' + strokeClasses + (edge.classes ? ' ' + edge.classes : '')).attr('style', edge.style); // DEBUG code, adds a red circle at each edge coordinate
9874 // edge.points.forEach(point => {
9875 // elem
9876 // .append('circle')
9877 // .style('stroke', 'red')
9878 // .style('fill', 'red')
9879 // .attr('r', 1)
9880 // .attr('cx', point.x)
9881 // .attr('cy', point.y);
9882 // });
9883
9884 var url = '';
9885
9886 if ((0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().state.arrowMarkerAbsolute) {
9887 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
9888 url = url.replace(/\(/g, '\\(');
9889 url = url.replace(/\)/g, '\\)');
9890 }
9891
9892 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeStart', edge.arrowTypeStart);
9893 _logger__WEBPACK_IMPORTED_MODULE_4__.log.info('arrowTypeEnd', edge.arrowTypeEnd);
9894
9895 switch (edge.arrowTypeStart) {
9896 case 'arrow_cross':
9897 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-crossStart' + ')');
9898 break;
9899
9900 case 'arrow_point':
9901 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-pointStart' + ')');
9902 break;
9903
9904 case 'arrow_barb':
9905 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-barbStart' + ')');
9906 break;
9907
9908 case 'arrow_circle':
9909 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-circleStart' + ')');
9910 break;
9911
9912 case 'aggregation':
9913 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-aggregationStart' + ')');
9914 break;
9915
9916 case 'extension':
9917 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-extensionStart' + ')');
9918 break;
9919
9920 case 'composition':
9921 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-compositionStart' + ')');
9922 break;
9923
9924 case 'dependency':
9925 svgPath.attr('marker-start', 'url(' + url + '#' + diagramType + '-dependencyStart' + ')');
9926 break;
9927
9928 default:
9929 }
9930
9931 switch (edge.arrowTypeEnd) {
9932 case 'arrow_cross':
9933 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-crossEnd' + ')');
9934 break;
9935
9936 case 'arrow_point':
9937 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-pointEnd' + ')');
9938 break;
9939
9940 case 'arrow_barb':
9941 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-barbEnd' + ')');
9942 break;
9943
9944 case 'arrow_circle':
9945 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-circleEnd' + ')');
9946 break;
9947
9948 case 'aggregation':
9949 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-aggregationEnd' + ')');
9950 break;
9951
9952 case 'extension':
9953 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-extensionEnd' + ')');
9954 break;
9955
9956 case 'composition':
9957 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-compositionEnd' + ')');
9958 break;
9959
9960 case 'dependency':
9961 svgPath.attr('marker-end', 'url(' + url + '#' + diagramType + '-dependencyEnd' + ')');
9962 break;
9963
9964 default:
9965 }
9966
9967 var paths = {};
9968
9969 if (pointsHasChanged) {
9970 paths.updatedPath = points;
9971 }
9972
9973 paths.originalPath = edge.points;
9974 return paths;
9975};
9976
9977/***/ }),
9978
9979/***/ "./src/dagre-wrapper/index.js":
9980/*!************************************!*\
9981 !*** ./src/dagre-wrapper/index.js ***!
9982 \************************************/
9983/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9984
9985"use strict";
9986__webpack_require__.r(__webpack_exports__);
9987/* harmony export */ __webpack_require__.d(__webpack_exports__, {
9988/* harmony export */ "render": () => (/* binding */ render)
9989/* harmony export */ });
9990/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre */ "dagre");
9991/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_0__);
9992/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! graphlib */ "graphlib");
9993/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_1__);
9994/* harmony import */ var _markers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./markers */ "./src/dagre-wrapper/markers.js");
9995/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
9996/* harmony import */ var _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./mermaid-graphlib */ "./src/dagre-wrapper/mermaid-graphlib.js");
9997/* harmony import */ var _nodes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nodes */ "./src/dagre-wrapper/nodes.js");
9998/* harmony import */ var _clusters__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./clusters */ "./src/dagre-wrapper/clusters.js");
9999/* harmony import */ var _edges__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./edges */ "./src/dagre-wrapper/edges.js");
10000/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011var recursiveRender = function recursiveRender(_elem, graph, diagramtype, parentCluster) {
10012 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph in recursive render: XXX', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph), parentCluster);
10013 var dir = graph.graph().rankdir;
10014 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Dir in recursive render - dir:', dir);
10015
10016 var elem = _elem.insert('g').attr('class', 'root'); // eslint-disable-line
10017
10018
10019 if (!graph.nodes()) {
10020 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('No nodes found for', graph);
10021 } else {
10022 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Recursive render XXX', graph.nodes());
10023 }
10024
10025 if (graph.edges().length > 0) {
10026 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Recursive edges', graph.edge(graph.edges()[0]));
10027 }
10028
10029 var clusters = elem.insert('g').attr('class', 'clusters'); // eslint-disable-line
10030
10031 var edgePaths = elem.insert('g').attr('class', 'edgePaths');
10032 var edgeLabels = elem.insert('g').attr('class', 'edgeLabels');
10033 var nodes = elem.insert('g').attr('class', 'nodes'); // Insert nodes, this will insert them into the dom and each node will get a size. The size is updated
10034 // to the abstract node and is later used by dagre for the layout
10035
10036 graph.nodes().forEach(function (v) {
10037 var node = graph.node(v);
10038
10039 if (typeof parentCluster !== 'undefined') {
10040 var data = JSON.parse(JSON.stringify(parentCluster.clusterData)); // data.clusterPositioning = true;
10041
10042 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting data for cluster XXX (', v, ') ', data, parentCluster);
10043 graph.setNode(parentCluster.id, data);
10044
10045 if (!graph.parent(v)) {
10046 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting parent', v, parentCluster.id);
10047 graph.setParent(v, parentCluster.id, data);
10048 }
10049 }
10050
10051 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('(Insert) Node XXX' + v + ': ' + JSON.stringify(graph.node(v)));
10052
10053 if (node && node.clusterNode) {
10054 // const children = graph.children(v);
10055 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster identified', v, node.width, graph.node(v));
10056 var o = recursiveRender(nodes, node.graph, diagramtype, graph.node(v));
10057 var newEl = o.elem;
10058 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_3__.updateNodeBounds)(node, newEl);
10059 node.diff = o.diff || 0;
10060 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node bounds (abc123)', v, node, node.width, node.x, node.y);
10061 (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.setNodeElem)(newEl, node);
10062 _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Recursive render complete ', newEl, node);
10063 } else {
10064 if (graph.children(v).length > 0) {
10065 // This is a cluster but not to be rendered recusively
10066 // Render as before
10067 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Cluster - the non recursive path XXX', v, node.id, node, graph);
10068 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info((0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph));
10069 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id] = {
10070 id: (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.findNonClusterChild)(node.id, graph),
10071 node: node
10072 }; // insertCluster(clusters, graph.node(v));
10073 } else {
10074 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Node - the non recursive path', v, node.id, node);
10075 (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.insertNode)(nodes, graph.node(v), dir);
10076 }
10077 }
10078 }); // Insert labels, this will insert them into the dom so that the width can be calculated
10079 // Also figure out which edges point to/from clusters and adjust them accordingly
10080 // Edges from/to clusters really points to the first child in the cluster.
10081 // TODO: pick optimal child in the cluster to us as link anchor
10082
10083 graph.edges().forEach(function (e) {
10084 var edge = graph.edge(e.v, e.w, e.name);
10085 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
10086 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ', e, ' ', JSON.stringify(graph.edge(e))); // Check if link is either from or to a cluster
10087
10088 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Fix', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, 'ids:', e.v, e.w, 'Translateing: ', _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.v], _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[e.w]);
10089 (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdgeLabel)(edgeLabels, edge);
10090 });
10091 graph.edges().forEach(function (e) {
10092 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
10093 });
10094 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
10095 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('### Layout ###');
10096 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('#############################################');
10097 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(graph);
10098 dagre__WEBPACK_IMPORTED_MODULE_0___default().layout(graph);
10099 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Graph after layout:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // Move the nodes to the correct place
10100
10101 var diff = 0;
10102 (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.sortNodesByHierarchy)(graph).forEach(function (v) {
10103 var node = graph.node(v);
10104 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': ' + JSON.stringify(graph.node(v)));
10105 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Position ' + v + ': (' + node.x, ',' + node.y, ') width: ', node.width, ' height: ', node.height);
10106
10107 if (node && node.clusterNode) {
10108 // clusterDb[node.id].node = node;
10109 (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
10110 } else {
10111 // Non cluster node
10112 if (graph.children(v).length > 0) {
10113 // A cluster in the non-recurive way
10114 // positionCluster(node);
10115 (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.insertCluster)(clusters, node);
10116 _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb[node.id].node = node;
10117 } else {
10118 (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.positionNode)(node);
10119 }
10120 }
10121 }); // Move the edge labels to the correct place after layout
10122
10123 graph.edges().forEach(function (e) {
10124 var edge = graph.edge(e);
10125 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(edge), edge);
10126 var paths = (0,_edges__WEBPACK_IMPORTED_MODULE_6__.insertEdge)(edgePaths, e, edge, _mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clusterDb, diagramtype, graph);
10127 (0,_edges__WEBPACK_IMPORTED_MODULE_6__.positionEdgeLabel)(edge, paths);
10128 });
10129 graph.nodes().forEach(function (v) {
10130 var n = graph.node(v);
10131 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(v, n.type, n.diff);
10132
10133 if (n.type === 'group') {
10134 diff = n.diff;
10135 }
10136 });
10137 return {
10138 elem: elem,
10139 diff: diff
10140 };
10141};
10142
10143var render = function render(elem, graph, markers, diagramtype, id) {
10144 (0,_markers__WEBPACK_IMPORTED_MODULE_8__["default"])(elem, markers, diagramtype, id);
10145 (0,_nodes__WEBPACK_IMPORTED_MODULE_4__.clear)();
10146 (0,_edges__WEBPACK_IMPORTED_MODULE_6__.clear)();
10147 (0,_clusters__WEBPACK_IMPORTED_MODULE_7__.clear)();
10148 (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.clear)();
10149 _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph at first:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph));
10150 (0,_mermaid_graphlib__WEBPACK_IMPORTED_MODULE_5__.adjustClustersAndEdges)(graph);
10151 _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Graph after:', graphlib__WEBPACK_IMPORTED_MODULE_1___default().json.write(graph)); // log.warn('Graph ever after:', graphlib.json.write(graph.node('A').graph));
10152
10153 recursiveRender(elem, graph, diagramtype);
10154}; // const shapeDefinitions = {};
10155// export const addShape = ({ shapeType: fun }) => {
10156// shapeDefinitions[shapeType] = fun;
10157// };
10158// const arrowDefinitions = {};
10159// export const addArrow = ({ arrowType: fun }) => {
10160// arrowDefinitions[arrowType] = fun;
10161// };
10162
10163/***/ }),
10164
10165/***/ "./src/dagre-wrapper/intersect/index.js":
10166/*!**********************************************!*\
10167 !*** ./src/dagre-wrapper/intersect/index.js ***!
10168 \**********************************************/
10169/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10170
10171"use strict";
10172__webpack_require__.r(__webpack_exports__);
10173/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10174/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10175/* harmony export */ });
10176/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-node.js */ "./src/dagre-wrapper/intersect/intersect-node.js");
10177/* harmony import */ var _intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_intersect_node_js__WEBPACK_IMPORTED_MODULE_0__);
10178/* harmony import */ var _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./intersect-circle.js */ "./src/dagre-wrapper/intersect/intersect-circle.js");
10179/* harmony import */ var _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intersect-ellipse.js */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
10180/* harmony import */ var _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect-polygon.js */ "./src/dagre-wrapper/intersect/intersect-polygon.js");
10181/* harmony import */ var _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./intersect-rect.js */ "./src/dagre-wrapper/intersect/intersect-rect.js");
10182/*
10183 * Borrowed with love from from dagrge-d3. Many thanks to cpettitt!
10184 */
10185
10186
10187
10188
10189
10190/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
10191 node: (_intersect_node_js__WEBPACK_IMPORTED_MODULE_0___default()),
10192 circle: _intersect_circle_js__WEBPACK_IMPORTED_MODULE_1__["default"],
10193 ellipse: _intersect_ellipse_js__WEBPACK_IMPORTED_MODULE_2__["default"],
10194 polygon: _intersect_polygon_js__WEBPACK_IMPORTED_MODULE_3__["default"],
10195 rect: _intersect_rect_js__WEBPACK_IMPORTED_MODULE_4__["default"]
10196});
10197
10198/***/ }),
10199
10200/***/ "./src/dagre-wrapper/intersect/intersect-circle.js":
10201/*!*********************************************************!*\
10202 !*** ./src/dagre-wrapper/intersect/intersect-circle.js ***!
10203 \*********************************************************/
10204/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10205
10206"use strict";
10207__webpack_require__.r(__webpack_exports__);
10208/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10209/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10210/* harmony export */ });
10211/* harmony import */ var _intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-ellipse */ "./src/dagre-wrapper/intersect/intersect-ellipse.js");
10212
10213
10214function intersectCircle(node, rx, point) {
10215 return (0,_intersect_ellipse__WEBPACK_IMPORTED_MODULE_0__["default"])(node, rx, rx, point);
10216}
10217
10218/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectCircle);
10219
10220/***/ }),
10221
10222/***/ "./src/dagre-wrapper/intersect/intersect-ellipse.js":
10223/*!**********************************************************!*\
10224 !*** ./src/dagre-wrapper/intersect/intersect-ellipse.js ***!
10225 \**********************************************************/
10226/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10227
10228"use strict";
10229__webpack_require__.r(__webpack_exports__);
10230/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10231/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10232/* harmony export */ });
10233function intersectEllipse(node, rx, ry, point) {
10234 // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html
10235 var cx = node.x;
10236 var cy = node.y;
10237 var px = cx - point.x;
10238 var py = cy - point.y;
10239 var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);
10240 var dx = Math.abs(rx * ry * px / det);
10241
10242 if (point.x < cx) {
10243 dx = -dx;
10244 }
10245
10246 var dy = Math.abs(rx * ry * py / det);
10247
10248 if (point.y < cy) {
10249 dy = -dy;
10250 }
10251
10252 return {
10253 x: cx + dx,
10254 y: cy + dy
10255 };
10256}
10257
10258/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectEllipse);
10259
10260/***/ }),
10261
10262/***/ "./src/dagre-wrapper/intersect/intersect-line.js":
10263/*!*******************************************************!*\
10264 !*** ./src/dagre-wrapper/intersect/intersect-line.js ***!
10265 \*******************************************************/
10266/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10267
10268"use strict";
10269__webpack_require__.r(__webpack_exports__);
10270/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10271/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10272/* harmony export */ });
10273/*
10274 * Returns the point at which two lines, p and q, intersect or returns
10275 * undefined if they do not intersect.
10276 */
10277function intersectLine(p1, p2, q1, q2) {
10278 // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,
10279 // p7 and p473.
10280 var a1, a2, b1, b2, c1, c2;
10281 var r1, r2, r3, r4;
10282 var denom, offset, num;
10283 var x, y; // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +
10284 // b1 y + c1 = 0.
10285
10286 a1 = p2.y - p1.y;
10287 b1 = p1.x - p2.x;
10288 c1 = p2.x * p1.y - p1.x * p2.y; // Compute r3 and r4.
10289
10290 r3 = a1 * q1.x + b1 * q1.y + c1;
10291 r4 = a1 * q2.x + b1 * q2.y + c1; // Check signs of r3 and r4. If both point 3 and point 4 lie on
10292 // same side of line 1, the line segments do not intersect.
10293
10294 if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {
10295 return;
10296 } // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0
10297
10298
10299 a2 = q2.y - q1.y;
10300 b2 = q1.x - q2.x;
10301 c2 = q2.x * q1.y - q1.x * q2.y; // Compute r1 and r2
10302
10303 r1 = a2 * p1.x + b2 * p1.y + c2;
10304 r2 = a2 * p2.x + b2 * p2.y + c2; // Check signs of r1 and r2. If both point 1 and point 2 lie
10305 // on same side of second line segment, the line segments do
10306 // not intersect.
10307
10308 if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {
10309 return;
10310 } // Line segments intersect: compute intersection point.
10311
10312
10313 denom = a1 * b2 - a2 * b1;
10314
10315 if (denom === 0) {
10316 return;
10317 }
10318
10319 offset = Math.abs(denom / 2); // The denom/2 is to get rounding instead of truncating. It
10320 // is added or subtracted to the numerator, depending upon the
10321 // sign of the numerator.
10322
10323 num = b1 * c2 - b2 * c1;
10324 x = num < 0 ? (num - offset) / denom : (num + offset) / denom;
10325 num = a2 * c1 - a1 * c2;
10326 y = num < 0 ? (num - offset) / denom : (num + offset) / denom;
10327 return {
10328 x: x,
10329 y: y
10330 };
10331}
10332
10333function sameSign(r1, r2) {
10334 return r1 * r2 > 0;
10335}
10336
10337/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectLine);
10338
10339/***/ }),
10340
10341/***/ "./src/dagre-wrapper/intersect/intersect-node.js":
10342/*!*******************************************************!*\
10343 !*** ./src/dagre-wrapper/intersect/intersect-node.js ***!
10344 \*******************************************************/
10345/***/ ((module) => {
10346
10347module.exports = intersectNode;
10348
10349function intersectNode(node, point) {
10350 // console.info('Intersect Node');
10351 return node.intersect(point);
10352}
10353
10354/***/ }),
10355
10356/***/ "./src/dagre-wrapper/intersect/intersect-polygon.js":
10357/*!**********************************************************!*\
10358 !*** ./src/dagre-wrapper/intersect/intersect-polygon.js ***!
10359 \**********************************************************/
10360/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10361
10362"use strict";
10363__webpack_require__.r(__webpack_exports__);
10364/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10365/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10366/* harmony export */ });
10367/* harmony import */ var _intersect_line__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./intersect-line */ "./src/dagre-wrapper/intersect/intersect-line.js");
10368/* eslint "no-console": off */
10369
10370/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectPolygon);
10371/*
10372 * Returns the point ({x, y}) at which the point argument intersects with the
10373 * node argument assuming that it has the shape specified by polygon.
10374 */
10375
10376function intersectPolygon(node, polyPoints, point) {
10377 var x1 = node.x;
10378 var y1 = node.y;
10379 var intersections = [];
10380 var minX = Number.POSITIVE_INFINITY;
10381 var minY = Number.POSITIVE_INFINITY;
10382
10383 if (typeof polyPoints.forEach === 'function') {
10384 polyPoints.forEach(function (entry) {
10385 minX = Math.min(minX, entry.x);
10386 minY = Math.min(minY, entry.y);
10387 });
10388 } else {
10389 minX = Math.min(minX, polyPoints.x);
10390 minY = Math.min(minY, polyPoints.y);
10391 }
10392
10393 var left = x1 - node.width / 2 - minX;
10394 var top = y1 - node.height / 2 - minY;
10395
10396 for (var i = 0; i < polyPoints.length; i++) {
10397 var p1 = polyPoints[i];
10398 var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];
10399 var intersect = (0,_intersect_line__WEBPACK_IMPORTED_MODULE_0__["default"])(node, point, {
10400 x: left + p1.x,
10401 y: top + p1.y
10402 }, {
10403 x: left + p2.x,
10404 y: top + p2.y
10405 });
10406
10407 if (intersect) {
10408 intersections.push(intersect);
10409 }
10410 }
10411
10412 if (!intersections.length) {
10413 // console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);
10414 return node;
10415 }
10416
10417 if (intersections.length > 1) {
10418 // More intersections, find the one nearest to edge end point
10419 intersections.sort(function (p, q) {
10420 var pdx = p.x - point.x;
10421 var pdy = p.y - point.y;
10422 var distp = Math.sqrt(pdx * pdx + pdy * pdy);
10423 var qdx = q.x - point.x;
10424 var qdy = q.y - point.y;
10425 var distq = Math.sqrt(qdx * qdx + qdy * qdy);
10426 return distp < distq ? -1 : distp === distq ? 0 : 1;
10427 });
10428 }
10429
10430 return intersections[0];
10431}
10432
10433/***/ }),
10434
10435/***/ "./src/dagre-wrapper/intersect/intersect-rect.js":
10436/*!*******************************************************!*\
10437 !*** ./src/dagre-wrapper/intersect/intersect-rect.js ***!
10438 \*******************************************************/
10439/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10440
10441"use strict";
10442__webpack_require__.r(__webpack_exports__);
10443/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10444/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10445/* harmony export */ });
10446var intersectRect = function intersectRect(node, point) {
10447 var x = node.x;
10448 var y = node.y; // Rectangle intersection algorithm from:
10449 // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes
10450
10451 var dx = point.x - x;
10452 var dy = point.y - y;
10453 var w = node.width / 2;
10454 var h = node.height / 2;
10455 var sx, sy;
10456
10457 if (Math.abs(dy) * w > Math.abs(dx) * h) {
10458 // Intersection is top or bottom of rect.
10459 if (dy < 0) {
10460 h = -h;
10461 }
10462
10463 sx = dy === 0 ? 0 : h * dx / dy;
10464 sy = h;
10465 } else {
10466 // Intersection is left or right of rect.
10467 if (dx < 0) {
10468 w = -w;
10469 }
10470
10471 sx = w;
10472 sy = dx === 0 ? 0 : w * dy / dx;
10473 }
10474
10475 return {
10476 x: x + sx,
10477 y: y + sy
10478 };
10479};
10480
10481/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (intersectRect);
10482
10483/***/ }),
10484
10485/***/ "./src/dagre-wrapper/markers.js":
10486/*!**************************************!*\
10487 !*** ./src/dagre-wrapper/markers.js ***!
10488 \**************************************/
10489/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10490
10491"use strict";
10492__webpack_require__.r(__webpack_exports__);
10493/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10494/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
10495/* harmony export */ });
10496/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
10497/**
10498 * Setup arrow head and define the marker. The result is appended to the svg.
10499 */
10500 // Only add the number of markers that the diagram needs
10501
10502var insertMarkers = function insertMarkers(elem, markerArray, type, id) {
10503 markerArray.forEach(function (markerName) {
10504 markers[markerName](elem, type, id);
10505 });
10506};
10507
10508var extension = function extension(elem, type, id) {
10509 _logger__WEBPACK_IMPORTED_MODULE_0__.log.trace('Making markers for ', id);
10510 elem.append('defs').append('marker').attr('id', type + '-extensionStart').attr('class', 'marker extension ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 1,7 L18,13 V 1 Z');
10511 elem.append('defs').append('marker').attr('id', type + '-extensionEnd').attr('class', 'marker extension ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 1,1 V 13 L18,7 Z'); // this is actual shape for arrowhead
10512};
10513
10514var composition = function composition(elem, type) {
10515 elem.append('defs').append('marker').attr('id', type + '-compositionStart').attr('class', 'marker composition ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
10516 elem.append('defs').append('marker').attr('id', type + '-compositionEnd').attr('class', 'marker composition ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
10517};
10518
10519var aggregation = function aggregation(elem, type) {
10520 elem.append('defs').append('marker').attr('id', type + '-aggregationStart').attr('class', 'marker aggregation ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
10521 elem.append('defs').append('marker').attr('id', type + '-aggregationEnd').attr('class', 'marker aggregation ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
10522};
10523
10524var dependency = function dependency(elem, type) {
10525 elem.append('defs').append('marker').attr('id', type + '-dependencyStart').attr('class', 'marker dependency ' + type).attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');
10526 elem.append('defs').append('marker').attr('id', type + '-dependencyEnd').attr('class', 'marker dependency ' + type).attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
10527};
10528
10529var point = function point(elem, type) {
10530 elem.append('marker').attr('id', type + '-pointEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
10531 elem.append('marker').attr('id', type + '-pointStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 0).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 5 L 10 10 L 10 0 z').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
10532};
10533
10534var circle = function circle(elem, type) {
10535 elem.append('marker').attr('id', type + '-circleEnd').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', 11).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
10536 elem.append('marker').attr('id', type + '-circleStart').attr('class', 'marker ' + type).attr('viewBox', '0 0 10 10').attr('refX', -1).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('circle').attr('cx', '5').attr('cy', '5').attr('r', '5').attr('class', 'arrowMarkerPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
10537};
10538
10539var cross = function cross(elem, type) {
10540 elem.append('marker').attr('id', type + '-crossEnd').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', 12).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
10541 .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
10542 elem.append('marker').attr('id', type + '-crossStart').attr('class', 'marker cross ' + type).attr('viewBox', '0 0 11 11').attr('refX', -1).attr('refY', 5.2).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 11).attr('markerHeight', 11).attr('orient', 'auto').append('path') // .attr('stroke', 'black')
10543 .attr('d', 'M 1,1 l 9,9 M 10,1 l -9,9').attr('class', 'arrowMarkerPath').style('stroke-width', 2).style('stroke-dasharray', '1,0');
10544};
10545
10546var barb = function barb(elem, type) {
10547 elem.append('defs').append('marker').attr('id', type + '-barbEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 14).attr('markerUnits', 'strokeWidth').attr('orient', 'auto').append('path').attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
10548}; // TODO rename the class diagram markers to something shape descriptive and semanitc free
10549
10550
10551var markers = {
10552 extension: extension,
10553 composition: composition,
10554 aggregation: aggregation,
10555 dependency: dependency,
10556 point: point,
10557 circle: circle,
10558 cross: cross,
10559 barb: barb
10560};
10561/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (insertMarkers);
10562
10563/***/ }),
10564
10565/***/ "./src/dagre-wrapper/mermaid-graphlib.js":
10566/*!***********************************************!*\
10567 !*** ./src/dagre-wrapper/mermaid-graphlib.js ***!
10568 \***********************************************/
10569/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10570
10571"use strict";
10572__webpack_require__.r(__webpack_exports__);
10573/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10574/* harmony export */ "clusterDb": () => (/* binding */ clusterDb),
10575/* harmony export */ "clear": () => (/* binding */ clear),
10576/* harmony export */ "extractDecendants": () => (/* binding */ extractDecendants),
10577/* harmony export */ "validate": () => (/* binding */ validate),
10578/* harmony export */ "findNonClusterChild": () => (/* binding */ findNonClusterChild),
10579/* harmony export */ "adjustClustersAndEdges": () => (/* binding */ adjustClustersAndEdges),
10580/* harmony export */ "extractor": () => (/* binding */ extractor),
10581/* harmony export */ "sortNodesByHierarchy": () => (/* binding */ sortNodesByHierarchy)
10582/* harmony export */ });
10583/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
10584/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
10585/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
10586/**
10587 * Decorates with functions required by mermaids dagre-wrapper.
10588 */
10589
10590
10591var clusterDb = {};
10592var decendants = {};
10593var parents = {};
10594var clear = function clear() {
10595 decendants = {};
10596 parents = {};
10597 clusterDb = {};
10598};
10599
10600var isDecendant = function isDecendant(id, ancenstorId) {
10601 // if (id === ancenstorId) return true;
10602 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('In isDecendant', ancenstorId, ' ', id, ' = ', decendants[ancenstorId].indexOf(id) >= 0);
10603 if (decendants[ancenstorId].indexOf(id) >= 0) return true;
10604 return false;
10605};
10606
10607var edgeInCluster = function edgeInCluster(edge, clusterId) {
10608 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Decendants of ', clusterId, ' is ', decendants[clusterId]);
10609 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge is ', edge); // Edges to/from the cluster is not in the cluster, they are in the parent
10610
10611 if (edge.v === clusterId) return false;
10612 if (edge.w === clusterId) return false;
10613
10614 if (!decendants[clusterId]) {
10615 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Tilt, ', clusterId, ',not in decendants');
10616 return false;
10617 }
10618
10619 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Here ');
10620 if (decendants[clusterId].indexOf(edge.v) >= 0) return true;
10621 if (isDecendant(edge.v, clusterId)) return true;
10622 if (isDecendant(edge.w, clusterId)) return true;
10623 if (decendants[clusterId].indexOf(edge.w) >= 0) return true;
10624 return false;
10625};
10626
10627var copy = function copy(clusterId, graph, newGraph, rootId) {
10628 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying children of ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
10629 var nodes = graph.children(clusterId) || []; // Include cluster node if it is not the root
10630
10631 if (clusterId !== rootId) {
10632 nodes.push(clusterId);
10633 }
10634
10635 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Copying (nodes) clusterId', clusterId, 'nodes', nodes);
10636 nodes.forEach(function (node) {
10637 if (graph.children(node).length > 0) {
10638 copy(node, graph, newGraph, rootId);
10639 } else {
10640 var data = graph.node(node);
10641 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('cp ', node, ' to ', rootId, ' with parent ', clusterId); //,node, data, ' parent is ', clusterId);
10642
10643 newGraph.setNode(node, data);
10644
10645 if (rootId !== graph.parent(node)) {
10646 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Setting parent', node, graph.parent(node));
10647 newGraph.setParent(node, graph.parent(node));
10648 }
10649
10650 if (clusterId !== rootId && node !== clusterId) {
10651 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Setting parent', node, clusterId);
10652 newGraph.setParent(node, clusterId);
10653 } else {
10654 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('In copy ', clusterId, 'root', rootId, 'data', graph.node(clusterId), rootId);
10655 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not Setting parent for node=', node, 'cluster!==rootId', clusterId !== rootId, 'node!==clusterId', node !== clusterId);
10656 }
10657
10658 var edges = graph.edges(node);
10659 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Copying Edges', edges);
10660 edges.forEach(function (edge) {
10661 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge', edge);
10662 var data = graph.edge(edge.v, edge.w, edge.name);
10663 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Edge data', data, rootId);
10664
10665 try {
10666 // Do not copy edges in and out of the root cluster, they belong to the parent graph
10667 if (edgeInCluster(edge, rootId)) {
10668 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Copying as ', edge.v, edge.w, data, edge.name);
10669 newGraph.setEdge(edge.v, edge.w, data, edge.name);
10670 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('newGraph edges ', newGraph.edges(), newGraph.edge(newGraph.edges()[0]));
10671 } else {
10672 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Skipping copy of edge ', edge.v, '-->', edge.w, ' rootId: ', rootId, ' clusterId:', clusterId);
10673 }
10674 } catch (e) {
10675 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e);
10676 }
10677 });
10678 }
10679
10680 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Removing node', node);
10681 graph.removeNode(node);
10682 });
10683};
10684
10685var extractDecendants = function extractDecendants(id, graph) {
10686 // log.debug('Extracting ', id);
10687 var children = graph.children(id);
10688 var res = [].concat(children);
10689
10690 for (var i = 0; i < children.length; i++) {
10691 parents[children[i]] = id;
10692 res = res.concat(extractDecendants(children[i], graph));
10693 }
10694
10695 return res;
10696};
10697/**
10698 * Validates the graph, checking that all parent child relation points to existing nodes and that
10699 * edges between nodes also ia correct. When not correct the function logs the discrepancies.
10700 * @param {graphlib graph} g
10701 */
10702
10703var validate = function validate(graph) {
10704 var edges = graph.edges();
10705 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Edges: ', edges);
10706
10707 for (var i = 0; i < edges.length; i++) {
10708 if (graph.children(edges[i].v).length > 0) {
10709 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].v, ' is part of and edge even though it has children');
10710 return false;
10711 }
10712
10713 if (graph.children(edges[i].w).length > 0) {
10714 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('The node ', edges[i].w, ' is part of and edge even though it has children');
10715 return false;
10716 }
10717 }
10718
10719 return true;
10720};
10721/**
10722 * Finds a child that is not a cluster. When faking a edge between a node and a cluster.
10723 * @param {Finds a } id
10724 * @param {*} graph
10725 */
10726
10727var findNonClusterChild = function findNonClusterChild(id, graph) {
10728 // const node = graph.node(id);
10729 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching', id); // const children = graph.children(id).reverse();
10730
10731 var children = graph.children(id); //.reverse();
10732
10733 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Searching children of id ', id, children);
10734
10735 if (children.length < 1) {
10736 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('This is a valid node', id);
10737 return id;
10738 }
10739
10740 for (var i = 0; i < children.length; i++) {
10741 var _id = findNonClusterChild(children[i], graph);
10742
10743 if (_id) {
10744 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace('Found replacement for', id, ' => ', _id);
10745 return _id;
10746 }
10747 }
10748};
10749
10750var getAnchorId = function getAnchorId(id) {
10751 if (!clusterDb[id]) {
10752 return id;
10753 } // If the cluster has no external connections
10754
10755
10756 if (!clusterDb[id].externalConnections) {
10757 return id;
10758 } // Return the replacement node
10759
10760
10761 if (clusterDb[id]) {
10762 return clusterDb[id].id;
10763 }
10764
10765 return id;
10766};
10767
10768var adjustClustersAndEdges = function adjustClustersAndEdges(graph, depth) {
10769 if (!graph || depth > 10) {
10770 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting out, no graph ');
10771 return;
10772 } else {
10773 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Opting in, graph ');
10774 } // Go through the nodes and for each cluster found, save a replacment node, this can be used when
10775 // faking a link to a cluster
10776
10777
10778 graph.nodes().forEach(function (id) {
10779 var children = graph.children(id);
10780
10781 if (children.length > 0) {
10782 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster identified', id, ' Replacement id in edges: ', findNonClusterChild(id, graph));
10783 decendants[id] = extractDecendants(id, graph);
10784 clusterDb[id] = {
10785 id: findNonClusterChild(id, graph),
10786 clusterData: graph.node(id)
10787 };
10788 }
10789 }); // Check incoming and outgoing edges for each cluster
10790
10791 graph.nodes().forEach(function (id) {
10792 var children = graph.children(id);
10793 var edges = graph.edges();
10794
10795 if (children.length > 0) {
10796 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Cluster identified', id, decendants);
10797 edges.forEach(function (edge) {
10798 // log.debug('Edge, decendants: ', edge, decendants[id]);
10799 // Check if any edge leaves the cluster (not the actual cluster, thats a link from the box)
10800 if (edge.v !== id && edge.w !== id) {
10801 // Any edge where either the one of the nodes is decending to the cluster but not the other
10802 // if (decendants[id].indexOf(edge.v) < 0 && decendants[id].indexOf(edge.w) < 0) {
10803 var d1 = isDecendant(edge.v, id);
10804 var d2 = isDecendant(edge.w, id); // d1 xor d2 - if either d1 is true and d2 is false or the other way around
10805
10806 if (d1 ^ d2) {
10807 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge: ', edge, ' leaves cluster ', id);
10808 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Decendants of XXX ', id, ': ', decendants[id]);
10809 clusterDb[id].externalConnections = true;
10810 }
10811 }
10812 });
10813 } else {
10814 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster ', id, decendants);
10815 }
10816 }); // For clusters with incoming and/or outgoing edges translate those edges to a real node
10817 // in the cluster inorder to fake the edge
10818
10819 graph.edges().forEach(function (e) {
10820 var edge = graph.edge(e);
10821 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));
10822 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
10823 var v = e.v;
10824 var w = e.w; // Check if link is either from or to a cluster
10825
10826 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix XXX', clusterDb, 'ids:', e.v, e.w, 'Translateing: ', clusterDb[e.v], ' --- ', clusterDb[e.w]);
10827
10828 if (clusterDb[e.v] || clusterDb[e.w]) {
10829 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
10830 v = getAnchorId(e.v);
10831 w = getAnchorId(e.w);
10832 graph.removeEdge(e.v, e.w, e.name);
10833 if (v !== e.v) edge.fromCluster = e.v;
10834 if (w !== e.w) edge.toCluster = e.w;
10835 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fix Replacing with XXX', v, w, e.name);
10836 graph.setEdge(v, w, edge, e.name);
10837 }
10838 });
10839 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Adjusted Graph', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
10840 extractor(graph, 0);
10841 _logger__WEBPACK_IMPORTED_MODULE_1__.log.trace(clusterDb); // Remove references to extracted cluster
10842 // graph.edges().forEach(edge => {
10843 // if (isDecendant(edge.v, clusterId) || isDecendant(edge.w, clusterId)) {
10844 // graph.removeEdge(edge);
10845 // }
10846 // });
10847};
10848var extractor = function extractor(graph, depth) {
10849 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('extractor - ', depth, graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph), graph.children('D'));
10850
10851 if (depth > 10) {
10852 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Bailing out');
10853 return;
10854 } // For clusters without incoming and/or outgoing edges, create a new cluster-node
10855 // containing the nodes and edges in the custer in a new graph
10856 // for (let i = 0;)
10857
10858
10859 var nodes = graph.nodes();
10860 var hasChildren = false;
10861
10862 for (var i = 0; i < nodes.length; i++) {
10863 var node = nodes[i];
10864 var children = graph.children(node);
10865 hasChildren = hasChildren || children.length > 0;
10866 }
10867
10868 if (!hasChildren) {
10869 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Done, no node has children', graph.nodes());
10870 return;
10871 } // const clusters = Object.keys(clusterDb);
10872 // clusters.forEach(clusterId => {
10873
10874
10875 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Nodes = ', nodes, depth);
10876
10877 for (var _i = 0; _i < nodes.length; _i++) {
10878 var _node = nodes[_i];
10879 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Extracting node', _node, clusterDb, clusterDb[_node] && !clusterDb[_node].externalConnections, !graph.parent(_node), graph.node(_node), graph.children('D'), ' Depth ', depth); // Note that the node might have been removed after the Object.keys call so better check
10880 // that it still is in the game
10881
10882 if (!clusterDb[_node]) {
10883 // Skip if the node is not a cluster
10884 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Not a cluster', _node, depth); // break;
10885 } else if (!clusterDb[_node].externalConnections && // !graph.parent(node) &&
10886 graph.children(_node) && graph.children(_node).length > 0) {
10887 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster without external connections, without a parent and with children', _node, depth);
10888 var graphSettings = graph.graph();
10889 var dir = graphSettings.rankdir === 'TB' ? 'LR' : 'TB';
10890
10891 if (clusterDb[_node]) {
10892 if (clusterDb[_node].clusterData && clusterDb[_node].clusterData.dir) {
10893 dir = clusterDb[_node].clusterData.dir;
10894 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Fixing dir', clusterDb[_node].clusterData.dir, dir);
10895 }
10896 }
10897
10898 var clusterGraph = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
10899 multigraph: true,
10900 compound: true
10901 }).setGraph({
10902 rankdir: dir,
10903 // Todo: set proper spacing
10904 nodesep: 50,
10905 ranksep: 50,
10906 marginx: 8,
10907 marginy: 8
10908 }).setDefaultEdgeLabel(function () {
10909 return {};
10910 });
10911 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Old graph before copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
10912 copy(_node, graph, clusterGraph, _node);
10913 graph.setNode(_node, {
10914 clusterNode: true,
10915 id: _node,
10916 clusterData: clusterDb[_node].clusterData,
10917 labelText: clusterDb[_node].labelText,
10918 graph: clusterGraph
10919 });
10920 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New graph after copy node: (', _node, ')', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(clusterGraph));
10921 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Old graph after copy', graphlib__WEBPACK_IMPORTED_MODULE_0___default().json.write(graph));
10922 } else {
10923 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Cluster ** ', _node, ' **not meeting the criteria !externalConnections:', !clusterDb[_node].externalConnections, ' no parent: ', !graph.parent(_node), ' children ', graph.children(_node) && graph.children(_node).length > 0, graph.children('D'), depth);
10924 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(clusterDb);
10925 }
10926 }
10927
10928 nodes = graph.nodes();
10929 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('New list of nodes', nodes);
10930
10931 for (var _i2 = 0; _i2 < nodes.length; _i2++) {
10932 var _node2 = nodes[_i2];
10933 var data = graph.node(_node2);
10934 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(' Now next level', _node2, data);
10935
10936 if (data.clusterNode) {
10937 extractor(data.graph, depth + 1);
10938 }
10939 }
10940};
10941
10942var sorter = function sorter(graph, nodes) {
10943 if (nodes.length === 0) return [];
10944 var result = Object.assign(nodes);
10945 nodes.forEach(function (node) {
10946 var children = graph.children(node);
10947 var sorted = sorter(graph, children);
10948 result = result.concat(sorted);
10949 });
10950 return result;
10951};
10952
10953var sortNodesByHierarchy = function sortNodesByHierarchy(graph) {
10954 return sorter(graph, graph.children());
10955};
10956
10957/***/ }),
10958
10959/***/ "./src/dagre-wrapper/nodes.js":
10960/*!************************************!*\
10961 !*** ./src/dagre-wrapper/nodes.js ***!
10962 \************************************/
10963/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
10964
10965"use strict";
10966__webpack_require__.r(__webpack_exports__);
10967/* harmony export */ __webpack_require__.d(__webpack_exports__, {
10968/* harmony export */ "insertNode": () => (/* binding */ insertNode),
10969/* harmony export */ "setNodeElem": () => (/* binding */ setNodeElem),
10970/* harmony export */ "clear": () => (/* binding */ clear),
10971/* harmony export */ "positionNode": () => (/* binding */ positionNode)
10972/* harmony export */ });
10973/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
10974/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
10975/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../logger */ "./src/logger.js");
10976/* harmony import */ var _shapes_util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./shapes/util */ "./src/dagre-wrapper/shapes/util.js");
10977/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../config */ "./src/config.js");
10978/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
10979/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./createLabel */ "./src/dagre-wrapper/createLabel.js");
10980/* harmony import */ var _shapes_note__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes/note */ "./src/dagre-wrapper/shapes/note.js");
10981/* harmony import */ var _diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../diagrams/class/svgDraw */ "./src/diagrams/class/svgDraw.js");
10982/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../diagrams/common/common */ "./src/diagrams/common/common.js");
10983function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
10984
10985
10986 // eslint-disable-line
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996var question = function question(parent, node) {
10997 var _labelHelper = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
10998 shapeSvg = _labelHelper.shapeSvg,
10999 bbox = _labelHelper.bbox;
11000
11001 var w = bbox.width + node.padding;
11002 var h = bbox.height + node.padding;
11003 var s = w + h;
11004 var points = [{
11005 x: s / 2,
11006 y: 0
11007 }, {
11008 x: s,
11009 y: -s / 2
11010 }, {
11011 x: s / 2,
11012 y: -s
11013 }, {
11014 x: 0,
11015 y: -s / 2
11016 }];
11017 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Question main (Circle)');
11018 var questionElem = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, s, s, points);
11019 questionElem.attr('style', node.style);
11020 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, questionElem);
11021
11022 node.intersect = function (point) {
11023 _logger__WEBPACK_IMPORTED_MODULE_2__.log.warn('Intersect called');
11024 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11025 };
11026
11027 return shapeSvg;
11028};
11029
11030var choice = function choice(parent, node) {
11031 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
11032 var s = 28;
11033 var points = [{
11034 x: 0,
11035 y: s / 2
11036 }, {
11037 x: s / 2,
11038 y: 0
11039 }, {
11040 x: 0,
11041 y: -s / 2
11042 }, {
11043 x: -s / 2,
11044 y: 0
11045 }];
11046 var choice = shapeSvg.insert('polygon', ':first-child').attr('points', points.map(function (d) {
11047 return d.x + ',' + d.y;
11048 }).join(' ')); // center the circle around its coordinate
11049
11050 choice.attr('class', 'state-start').attr('r', 7).attr('width', 28).attr('height', 28);
11051 node.width = 28;
11052 node.height = 28;
11053
11054 node.intersect = function (point) {
11055 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 14, point);
11056 };
11057
11058 return shapeSvg;
11059};
11060
11061var hexagon = function hexagon(parent, node) {
11062 var _labelHelper2 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11063 shapeSvg = _labelHelper2.shapeSvg,
11064 bbox = _labelHelper2.bbox;
11065
11066 var f = 4;
11067 var h = bbox.height + node.padding;
11068 var m = h / f;
11069 var w = bbox.width + 2 * m + node.padding;
11070 var points = [{
11071 x: m,
11072 y: 0
11073 }, {
11074 x: w - m,
11075 y: 0
11076 }, {
11077 x: w,
11078 y: -h / 2
11079 }, {
11080 x: w - m,
11081 y: -h
11082 }, {
11083 x: m,
11084 y: -h
11085 }, {
11086 x: 0,
11087 y: -h / 2
11088 }];
11089 var hex = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11090 hex.attr('style', node.style);
11091 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, hex);
11092
11093 node.intersect = function (point) {
11094 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11095 };
11096
11097 return shapeSvg;
11098};
11099
11100var rect_left_inv_arrow = function rect_left_inv_arrow(parent, node) {
11101 var _labelHelper3 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11102 shapeSvg = _labelHelper3.shapeSvg,
11103 bbox = _labelHelper3.bbox;
11104
11105 var w = bbox.width + node.padding;
11106 var h = bbox.height + node.padding;
11107 var points = [{
11108 x: -h / 2,
11109 y: 0
11110 }, {
11111 x: w,
11112 y: 0
11113 }, {
11114 x: w,
11115 y: -h
11116 }, {
11117 x: -h / 2,
11118 y: -h
11119 }, {
11120 x: 0,
11121 y: -h / 2
11122 }];
11123 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11124 el.attr('style', node.style);
11125 node.width = w + h;
11126 node.height = h;
11127
11128 node.intersect = function (point) {
11129 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11130 };
11131
11132 return shapeSvg;
11133};
11134
11135var lean_right = function lean_right(parent, node) {
11136 var _labelHelper4 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11137 shapeSvg = _labelHelper4.shapeSvg,
11138 bbox = _labelHelper4.bbox;
11139
11140 var w = bbox.width + node.padding;
11141 var h = bbox.height + node.padding;
11142 var points = [{
11143 x: -2 * h / 6,
11144 y: 0
11145 }, {
11146 x: w - h / 6,
11147 y: 0
11148 }, {
11149 x: w + 2 * h / 6,
11150 y: -h
11151 }, {
11152 x: h / 6,
11153 y: -h
11154 }];
11155 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11156 el.attr('style', node.style);
11157 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11158
11159 node.intersect = function (point) {
11160 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11161 };
11162
11163 return shapeSvg;
11164};
11165
11166var lean_left = function lean_left(parent, node) {
11167 var _labelHelper5 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11168 shapeSvg = _labelHelper5.shapeSvg,
11169 bbox = _labelHelper5.bbox;
11170
11171 var w = bbox.width + node.padding;
11172 var h = bbox.height + node.padding;
11173 var points = [{
11174 x: 2 * h / 6,
11175 y: 0
11176 }, {
11177 x: w + h / 6,
11178 y: 0
11179 }, {
11180 x: w - 2 * h / 6,
11181 y: -h
11182 }, {
11183 x: -h / 6,
11184 y: -h
11185 }];
11186 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11187 el.attr('style', node.style);
11188 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11189
11190 node.intersect = function (point) {
11191 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11192 };
11193
11194 return shapeSvg;
11195};
11196
11197var trapezoid = function trapezoid(parent, node) {
11198 var _labelHelper6 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11199 shapeSvg = _labelHelper6.shapeSvg,
11200 bbox = _labelHelper6.bbox;
11201
11202 var w = bbox.width + node.padding;
11203 var h = bbox.height + node.padding;
11204 var points = [{
11205 x: -2 * h / 6,
11206 y: 0
11207 }, {
11208 x: w + 2 * h / 6,
11209 y: 0
11210 }, {
11211 x: w - h / 6,
11212 y: -h
11213 }, {
11214 x: h / 6,
11215 y: -h
11216 }];
11217 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11218 el.attr('style', node.style);
11219 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11220
11221 node.intersect = function (point) {
11222 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11223 };
11224
11225 return shapeSvg;
11226};
11227
11228var inv_trapezoid = function inv_trapezoid(parent, node) {
11229 var _labelHelper7 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11230 shapeSvg = _labelHelper7.shapeSvg,
11231 bbox = _labelHelper7.bbox;
11232
11233 var w = bbox.width + node.padding;
11234 var h = bbox.height + node.padding;
11235 var points = [{
11236 x: h / 6,
11237 y: 0
11238 }, {
11239 x: w - h / 6,
11240 y: 0
11241 }, {
11242 x: w + 2 * h / 6,
11243 y: -h
11244 }, {
11245 x: -2 * h / 6,
11246 y: -h
11247 }];
11248 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11249 el.attr('style', node.style);
11250 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11251
11252 node.intersect = function (point) {
11253 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11254 };
11255
11256 return shapeSvg;
11257};
11258
11259var rect_right_inv_arrow = function rect_right_inv_arrow(parent, node) {
11260 var _labelHelper8 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11261 shapeSvg = _labelHelper8.shapeSvg,
11262 bbox = _labelHelper8.bbox;
11263
11264 var w = bbox.width + node.padding;
11265 var h = bbox.height + node.padding;
11266 var points = [{
11267 x: 0,
11268 y: 0
11269 }, {
11270 x: w + h / 2,
11271 y: 0
11272 }, {
11273 x: w,
11274 y: -h / 2
11275 }, {
11276 x: w + h / 2,
11277 y: -h
11278 }, {
11279 x: 0,
11280 y: -h
11281 }];
11282 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11283 el.attr('style', node.style);
11284 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11285
11286 node.intersect = function (point) {
11287 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11288 };
11289
11290 return shapeSvg;
11291};
11292
11293var cylinder = function cylinder(parent, node) {
11294 var _labelHelper9 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11295 shapeSvg = _labelHelper9.shapeSvg,
11296 bbox = _labelHelper9.bbox;
11297
11298 var w = bbox.width + node.padding;
11299 var rx = w / 2;
11300 var ry = rx / (2.5 + w / 50);
11301 var h = bbox.height + ry + node.padding;
11302 var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
11303 var el = shapeSvg.attr('label-offset-y', ry).insert('path', ':first-child').attr('style', node.style).attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
11304 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11305
11306 node.intersect = function (point) {
11307 var pos = _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11308 var x = pos.x - node.x;
11309
11310 if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
11311 // ellipsis equation: x*x / a*a + y*y / b*b = 1
11312 // solve for y to get adjustion value for pos.y
11313 var y = ry * ry * (1 - x * x / (rx * rx));
11314 if (y != 0) y = Math.sqrt(y);
11315 y = ry - y;
11316 if (point.y - node.y > 0) y = -y;
11317 pos.y += y;
11318 }
11319
11320 return pos;
11321 };
11322
11323 return shapeSvg;
11324};
11325
11326var rect = function rect(parent, node) {
11327 var _labelHelper10 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, 'node ' + node.classes, true),
11328 shapeSvg = _labelHelper10.shapeSvg,
11329 bbox = _labelHelper10.bbox,
11330 halfPadding = _labelHelper10.halfPadding;
11331
11332 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Classes = ', node.classes); // add the rect
11333
11334 var rect = shapeSvg.insert('rect', ':first-child');
11335 rect.attr('class', 'basic label-container').attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
11336 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
11337
11338 node.intersect = function (point) {
11339 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11340 };
11341
11342 return shapeSvg;
11343};
11344
11345var rectWithTitle = function rectWithTitle(parent, node) {
11346 // const { shapeSvg, bbox, halfPadding } = labelHelper(parent, node, 'node ' + node.classes);
11347 var classes;
11348
11349 if (!node.classes) {
11350 classes = 'node default';
11351 } else {
11352 classes = 'node ' + node.classes;
11353 } // Add outer g element
11354
11355
11356 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
11357
11358 var rect = shapeSvg.insert('rect', ':first-child'); // const innerRect = shapeSvg.insert('rect');
11359
11360 var innerLine = shapeSvg.insert('line');
11361 var label = shapeSvg.insert('g').attr('class', 'label');
11362 var text2 = node.labelText.flat ? node.labelText.flat() : node.labelText; // const text2 = typeof text2prim === 'object' ? text2prim[0] : text2prim;
11363
11364 var title = '';
11365
11366 if (_typeof(text2) === 'object') {
11367 title = text2[0];
11368 } else {
11369 title = text2;
11370 }
11371
11372 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Label text abc79', title, text2, _typeof(text2) === 'object');
11373 var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(title, node.labelStyle, true, true));
11374 var bbox = {
11375 width: 0,
11376 height: 0
11377 };
11378
11379 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11380 var div = text.children[0];
11381 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
11382 bbox = div.getBoundingClientRect();
11383 dv.attr('width', bbox.width);
11384 dv.attr('height', bbox.height);
11385 }
11386
11387 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Text 2', text2);
11388 var textRows = text2.slice(1, text2.length);
11389 var titleBox = text.getBBox();
11390 var descr = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(textRows.join ? textRows.join('<br/>') : textRows, node.labelStyle, true, true));
11391
11392 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11393 var _div = descr.children[0];
11394
11395 var _dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr);
11396
11397 bbox = _div.getBoundingClientRect();
11398
11399 _dv.attr('width', bbox.width);
11400
11401 _dv.attr('height', bbox.height);
11402 } // bbox = label.getBBox();
11403 // log.info(descr);
11404
11405
11406 var halfPadding = node.padding / 2;
11407 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
11408 bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
11409 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
11410 bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
11411 // Bounding box for title and text
11412
11413 bbox = label.node().getBBox(); // Center the label
11414
11415 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')');
11416 rect.attr('class', 'outer title-state').attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
11417 innerLine.attr('class', 'divider').attr('x1', -bbox.width / 2 - halfPadding).attr('x2', bbox.width / 2 + halfPadding).attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding).attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
11418 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
11419
11420 node.intersect = function (point) {
11421 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11422 };
11423
11424 return shapeSvg;
11425};
11426
11427var stadium = function stadium(parent, node) {
11428 var _labelHelper11 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11429 shapeSvg = _labelHelper11.shapeSvg,
11430 bbox = _labelHelper11.bbox;
11431
11432 var h = bbox.height + node.padding;
11433 var w = bbox.width + h / 4 + node.padding; // add the rect
11434
11435 var rect = shapeSvg.insert('rect', ':first-child').attr('style', node.style).attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
11436 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
11437
11438 node.intersect = function (point) {
11439 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11440 };
11441
11442 return shapeSvg;
11443};
11444
11445var circle = function circle(parent, node) {
11446 var _labelHelper12 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11447 shapeSvg = _labelHelper12.shapeSvg,
11448 bbox = _labelHelper12.bbox,
11449 halfPadding = _labelHelper12.halfPadding;
11450
11451 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
11452
11453 circle.attr('style', node.style).attr('rx', node.rx).attr('ry', node.ry).attr('r', bbox.width / 2 + halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
11454 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Circle main');
11455 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
11456
11457 node.intersect = function (point) {
11458 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Circle intersect', node, bbox.width / 2 + halfPadding, point);
11459 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, bbox.width / 2 + halfPadding, point);
11460 };
11461
11462 return shapeSvg;
11463};
11464
11465var subroutine = function subroutine(parent, node) {
11466 var _labelHelper13 = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.labelHelper)(parent, node, undefined, true),
11467 shapeSvg = _labelHelper13.shapeSvg,
11468 bbox = _labelHelper13.bbox;
11469
11470 var w = bbox.width + node.padding;
11471 var h = bbox.height + node.padding;
11472 var points = [{
11473 x: 0,
11474 y: 0
11475 }, {
11476 x: w,
11477 y: 0
11478 }, {
11479 x: w,
11480 y: -h
11481 }, {
11482 x: 0,
11483 y: -h
11484 }, {
11485 x: 0,
11486 y: 0
11487 }, {
11488 x: -8,
11489 y: 0
11490 }, {
11491 x: w + 8,
11492 y: 0
11493 }, {
11494 x: w + 8,
11495 y: -h
11496 }, {
11497 x: -8,
11498 y: -h
11499 }, {
11500 x: -8,
11501 y: 0
11502 }];
11503 var el = (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.insertPolygonShape)(shapeSvg, w, h, points);
11504 el.attr('style', node.style);
11505 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, el);
11506
11507 node.intersect = function (point) {
11508 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].polygon(node, points, point);
11509 };
11510
11511 return shapeSvg;
11512};
11513
11514var start = function start(parent, node) {
11515 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
11516 var circle = shapeSvg.insert('circle', ':first-child'); // center the circle around its coordinate
11517
11518 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
11519 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
11520
11521 node.intersect = function (point) {
11522 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 7, point);
11523 };
11524
11525 return shapeSvg;
11526};
11527
11528var forkJoin = function forkJoin(parent, node, dir) {
11529 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
11530 var width = 70;
11531 var height = 10;
11532
11533 if (dir === 'LR') {
11534 width = 10;
11535 height = 70;
11536 }
11537
11538 var shape = shapeSvg.append('rect').attr('x', -1 * width / 2).attr('y', -1 * height / 2).attr('width', width).attr('height', height).attr('class', 'fork-join');
11539 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, shape);
11540 node.height = node.height + node.padding / 2;
11541 node.width = node.width + node.padding / 2;
11542
11543 node.intersect = function (point) {
11544 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11545 };
11546
11547 return shapeSvg;
11548};
11549
11550var end = function end(parent, node) {
11551 var shapeSvg = parent.insert('g').attr('class', 'node default').attr('id', node.domId || node.id);
11552 var innerCircle = shapeSvg.insert('circle', ':first-child');
11553 var circle = shapeSvg.insert('circle', ':first-child');
11554 circle.attr('class', 'state-start').attr('r', 7).attr('width', 14).attr('height', 14);
11555 innerCircle.attr('class', 'state-end').attr('r', 5).attr('width', 10).attr('height', 10);
11556 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, circle);
11557
11558 node.intersect = function (point) {
11559 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].circle(node, 7, point);
11560 };
11561
11562 return shapeSvg;
11563};
11564
11565var class_box = function class_box(parent, node) {
11566 var halfPadding = node.padding / 2;
11567 var rowPadding = 4;
11568 var lineHeight = 8;
11569 var classes;
11570
11571 if (!node.classes) {
11572 classes = 'node default';
11573 } else {
11574 classes = 'node ' + node.classes;
11575 } // Add outer g element
11576
11577
11578 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the title label and insert it after the rect
11579
11580 var rect = shapeSvg.insert('rect', ':first-child');
11581 var topLine = shapeSvg.insert('line');
11582 var bottomLine = shapeSvg.insert('line');
11583 var maxWidth = 0;
11584 var maxHeight = rowPadding;
11585 var labelContainer = shapeSvg.insert('g').attr('class', 'label');
11586 var verticalPos = 0;
11587 var hasInterface = node.classData.annotations && node.classData.annotations[0]; // 1. Create the labels
11588
11589 var interfaceLabelText = node.classData.annotations[0] ? '«' + node.classData.annotations[0] + '»' : '';
11590 var interfaceLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(interfaceLabelText, node.labelStyle, true, true));
11591 var interfaceBBox = interfaceLabel.getBBox();
11592
11593 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11594 var div = interfaceLabel.children[0];
11595 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel);
11596 interfaceBBox = div.getBoundingClientRect();
11597 dv.attr('width', interfaceBBox.width);
11598 dv.attr('height', interfaceBBox.height);
11599 }
11600
11601 if (node.classData.annotations[0]) {
11602 maxHeight += interfaceBBox.height + rowPadding;
11603 maxWidth += interfaceBBox.width;
11604 }
11605
11606 var classTitleString = node.classData.id;
11607
11608 if (node.classData.type !== undefined && node.classData.type !== '') {
11609 if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
11610 classTitleString += '&lt;' + node.classData.type + '&gt;';
11611 } else {
11612 classTitleString += '<' + node.classData.type + '>';
11613 }
11614 }
11615
11616 var classTitleLabel = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(classTitleString, node.labelStyle, true, true));
11617 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('class', 'classTitle');
11618 var classTitleBBox = classTitleLabel.getBBox();
11619
11620 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11621 var _div2 = classTitleLabel.children[0];
11622
11623 var _dv2 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel);
11624
11625 classTitleBBox = _div2.getBoundingClientRect();
11626
11627 _dv2.attr('width', classTitleBBox.width);
11628
11629 _dv2.attr('height', classTitleBBox.height);
11630 }
11631
11632 maxHeight += classTitleBBox.height + rowPadding;
11633
11634 if (classTitleBBox.width > maxWidth) {
11635 maxWidth = classTitleBBox.width;
11636 }
11637
11638 var classAttributes = [];
11639 node.classData.members.forEach(function (str) {
11640 var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
11641 var parsedText = parsedInfo.displayText;
11642
11643 if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
11644 parsedText = parsedText.replace(/</g, '&lt;').replace(/>/g, '&gt;');
11645 }
11646
11647 var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(parsedText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
11648 var bbox = lbl.getBBox();
11649
11650 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11651 var _div3 = lbl.children[0];
11652
11653 var _dv3 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
11654
11655 bbox = _div3.getBoundingClientRect();
11656
11657 _dv3.attr('width', bbox.width);
11658
11659 _dv3.attr('height', bbox.height);
11660 }
11661
11662 if (bbox.width > maxWidth) {
11663 maxWidth = bbox.width;
11664 }
11665
11666 maxHeight += bbox.height + rowPadding;
11667 classAttributes.push(lbl);
11668 });
11669 maxHeight += lineHeight;
11670 var classMethods = [];
11671 node.classData.methods.forEach(function (str) {
11672 var parsedInfo = (0,_diagrams_class_svgDraw__WEBPACK_IMPORTED_MODULE_7__.parseMember)(str);
11673 var displayText = parsedInfo.displayText;
11674
11675 if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
11676 displayText = displayText.replace(/</g, '&lt;').replace(/>/g, '&gt;');
11677 }
11678
11679 var lbl = labelContainer.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_4__["default"])(displayText, parsedInfo.cssStyle ? parsedInfo.cssStyle : node.labelStyle, true, true));
11680 var bbox = lbl.getBBox();
11681
11682 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
11683 var _div4 = lbl.children[0];
11684
11685 var _dv4 = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl);
11686
11687 bbox = _div4.getBoundingClientRect();
11688
11689 _dv4.attr('width', bbox.width);
11690
11691 _dv4.attr('height', bbox.height);
11692 }
11693
11694 if (bbox.width > maxWidth) {
11695 maxWidth = bbox.width;
11696 }
11697
11698 maxHeight += bbox.height + rowPadding;
11699 classMethods.push(lbl);
11700 });
11701 maxHeight += lineHeight; // 2. Position the labels
11702 // position the interface label
11703
11704 if (hasInterface) {
11705 var _diffX = (maxWidth - interfaceBBox.width) / 2;
11706
11707 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(interfaceLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + _diffX) + ', ' + -1 * maxHeight / 2 + ')');
11708 verticalPos = interfaceBBox.height + rowPadding;
11709 } // Positin the class title label
11710
11711
11712 var diffX = (maxWidth - classTitleBBox.width) / 2;
11713 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(classTitleLabel).attr('transform', 'translate( ' + (-1 * maxWidth / 2 + diffX) + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
11714 verticalPos += classTitleBBox.height + rowPadding;
11715 topLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
11716 verticalPos += lineHeight;
11717 classAttributes.forEach(function (lbl) {
11718 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos + lineHeight / 2) + ')');
11719 verticalPos += classTitleBBox.height + rowPadding;
11720 });
11721 verticalPos += lineHeight;
11722 bottomLine.attr('class', 'divider').attr('x1', -maxWidth / 2 - halfPadding).attr('x2', maxWidth / 2 + halfPadding).attr('y1', -maxHeight / 2 - halfPadding + lineHeight + verticalPos).attr('y2', -maxHeight / 2 - halfPadding + lineHeight + verticalPos);
11723 verticalPos += lineHeight;
11724 classMethods.forEach(function (lbl) {
11725 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(lbl).attr('transform', 'translate( ' + -maxWidth / 2 + ', ' + (-1 * maxHeight / 2 + verticalPos) + ')');
11726 verticalPos += classTitleBBox.height + rowPadding;
11727 }); //
11728 // let bbox;
11729 // if (evaluate(getConfig().flowchart.htmlLabels)) {
11730 // const div = interfaceLabel.children[0];
11731 // const dv = select(interfaceLabel);
11732 // bbox = div.getBoundingClientRect();
11733 // dv.attr('width', bbox.width);
11734 // dv.attr('height', bbox.height);
11735 // }
11736 // bbox = labelContainer.getBBox();
11737 // log.info('Text 2', text2);
11738 // const textRows = text2.slice(1, text2.length);
11739 // let titleBox = text.getBBox();
11740 // const descr = label
11741 // .node()
11742 // .appendChild(createLabel(textRows.join('<br/>'), node.labelStyle, true, true));
11743 // if (evaluate(getConfig().flowchart.htmlLabels)) {
11744 // const div = descr.children[0];
11745 // const dv = select(descr);
11746 // bbox = div.getBoundingClientRect();
11747 // dv.attr('width', bbox.width);
11748 // dv.attr('height', bbox.height);
11749 // }
11750 // // bbox = label.getBBox();
11751 // // log.info(descr);
11752 // select(descr).attr(
11753 // 'transform',
11754 // 'translate( ' +
11755 // // (titleBox.width - bbox.width) / 2 +
11756 // (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) +
11757 // ', ' +
11758 // (titleBox.height + halfPadding + 5) +
11759 // ')'
11760 // );
11761 // select(text).attr(
11762 // 'transform',
11763 // 'translate( ' +
11764 // // (titleBox.width - bbox.width) / 2 +
11765 // (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) +
11766 // ', ' +
11767 // 0 +
11768 // ')'
11769 // );
11770 // // Get the size of the label
11771 // // Bounding box for title and text
11772 // bbox = label.node().getBBox();
11773 // // Center the label
11774 // label.attr(
11775 // 'transform',
11776 // 'translate(' + -bbox.width / 2 + ', ' + (-bbox.height / 2 - halfPadding + 3) + ')'
11777 // );
11778
11779 rect.attr('class', 'outer title-state').attr('x', -maxWidth / 2 - halfPadding).attr('y', -(maxHeight / 2) - halfPadding).attr('width', maxWidth + node.padding).attr('height', maxHeight + node.padding); // innerLine
11780 // .attr('class', 'divider')
11781 // .attr('x1', -bbox.width / 2 - halfPadding)
11782 // .attr('x2', bbox.width / 2 + halfPadding)
11783 // .attr('y1', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding)
11784 // .attr('y2', -bbox.height / 2 - halfPadding + titleBox.height + halfPadding);
11785
11786 (0,_shapes_util__WEBPACK_IMPORTED_MODULE_1__.updateNodeBounds)(node, rect);
11787
11788 node.intersect = function (point) {
11789 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_3__["default"].rect(node, point);
11790 };
11791
11792 return shapeSvg;
11793};
11794
11795var shapes = {
11796 question: question,
11797 rect: rect,
11798 rectWithTitle: rectWithTitle,
11799 choice: choice,
11800 circle: circle,
11801 stadium: stadium,
11802 hexagon: hexagon,
11803 rect_left_inv_arrow: rect_left_inv_arrow,
11804 lean_right: lean_right,
11805 lean_left: lean_left,
11806 trapezoid: trapezoid,
11807 inv_trapezoid: inv_trapezoid,
11808 rect_right_inv_arrow: rect_right_inv_arrow,
11809 cylinder: cylinder,
11810 start: start,
11811 end: end,
11812 note: _shapes_note__WEBPACK_IMPORTED_MODULE_8__["default"],
11813 subroutine: subroutine,
11814 fork: forkJoin,
11815 join: forkJoin,
11816 class_box: class_box
11817};
11818var nodeElems = {};
11819var insertNode = function insertNode(elem, node, dir) {
11820 var newEl;
11821 var el; // Add link when appropriate
11822
11823 if (node.link) {
11824 newEl = elem.insert('svg:a').attr('xlink:href', node.link).attr('target', node.linkTarget || '_blank');
11825 el = shapes[node.shape](newEl, node, dir);
11826 } else {
11827 el = shapes[node.shape](elem, node, dir);
11828 newEl = el;
11829 }
11830
11831 if (node.tooltip) {
11832 el.attr('title', node.tooltip);
11833 }
11834
11835 if (node.class) {
11836 el.attr('class', 'node default ' + node.class);
11837 }
11838
11839 nodeElems[node.id] = newEl;
11840
11841 if (node.haveCallback) {
11842 nodeElems[node.id].attr('class', nodeElems[node.id].attr('class') + ' clickable');
11843 }
11844};
11845var setNodeElem = function setNodeElem(elem, node) {
11846 nodeElems[node.id] = elem;
11847};
11848var clear = function clear() {
11849 nodeElems = {};
11850};
11851var positionNode = function positionNode(node) {
11852 var el = nodeElems[node.id];
11853 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Transforming node', node.diff, node, 'translate(' + (node.x - node.width / 2 - 5) + ', ' + node.width / 2 + ')');
11854 var padding = 8;
11855 var diff = node.diff || 0;
11856
11857 if (node.clusterNode) {
11858 el.attr('transform', 'translate(' + (node.x + diff - node.width / 2) + ', ' + (node.y - node.height / 2 - padding) + ')');
11859 } else {
11860 el.attr('transform', 'translate(' + node.x + ', ' + node.y + ')');
11861 }
11862
11863 return diff;
11864};
11865
11866/***/ }),
11867
11868/***/ "./src/dagre-wrapper/shapes/note.js":
11869/*!******************************************!*\
11870 !*** ./src/dagre-wrapper/shapes/note.js ***!
11871 \******************************************/
11872/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
11873
11874"use strict";
11875__webpack_require__.r(__webpack_exports__);
11876/* harmony export */ __webpack_require__.d(__webpack_exports__, {
11877/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11878/* harmony export */ });
11879/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util */ "./src/dagre-wrapper/shapes/util.js");
11880/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
11881/* harmony import */ var _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../intersect/index.js */ "./src/dagre-wrapper/intersect/index.js");
11882
11883 // eslint-disable-line
11884
11885
11886
11887var note = function note(parent, node) {
11888 var _labelHelper = (0,_util__WEBPACK_IMPORTED_MODULE_0__.labelHelper)(parent, node, 'node ' + node.classes, true),
11889 shapeSvg = _labelHelper.shapeSvg,
11890 bbox = _labelHelper.bbox,
11891 halfPadding = _labelHelper.halfPadding;
11892
11893 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Classes = ', node.classes); // add the rect
11894
11895 var rect = shapeSvg.insert('rect', ':first-child');
11896 rect.attr('rx', node.rx).attr('ry', node.ry).attr('x', -bbox.width / 2 - halfPadding).attr('y', -bbox.height / 2 - halfPadding).attr('width', bbox.width + node.padding).attr('height', bbox.height + node.padding);
11897 (0,_util__WEBPACK_IMPORTED_MODULE_0__.updateNodeBounds)(node, rect);
11898
11899 node.intersect = function (point) {
11900 return _intersect_index_js__WEBPACK_IMPORTED_MODULE_2__["default"].rect(node, point);
11901 };
11902
11903 return shapeSvg;
11904};
11905
11906/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (note);
11907
11908/***/ }),
11909
11910/***/ "./src/dagre-wrapper/shapes/util.js":
11911/*!******************************************!*\
11912 !*** ./src/dagre-wrapper/shapes/util.js ***!
11913 \******************************************/
11914/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
11915
11916"use strict";
11917__webpack_require__.r(__webpack_exports__);
11918/* harmony export */ __webpack_require__.d(__webpack_exports__, {
11919/* harmony export */ "labelHelper": () => (/* binding */ labelHelper),
11920/* harmony export */ "updateNodeBounds": () => (/* binding */ updateNodeBounds),
11921/* harmony export */ "insertPolygonShape": () => (/* binding */ insertPolygonShape)
11922/* harmony export */ });
11923/* harmony import */ var _createLabel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../createLabel */ "./src/dagre-wrapper/createLabel.js");
11924/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
11925/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
11926/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
11927/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
11928/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../diagrams/common/common */ "./src/diagrams/common/common.js");
11929
11930
11931
11932
11933
11934var labelHelper = function labelHelper(parent, node, _classes, isNode) {
11935 var classes;
11936
11937 if (!_classes) {
11938 classes = 'node default';
11939 } else {
11940 classes = _classes;
11941 } // Add outer g element
11942
11943
11944 var shapeSvg = parent.insert('g').attr('class', classes).attr('id', node.domId || node.id); // Create the label and insert it after the rect
11945
11946 var label = shapeSvg.insert('g').attr('class', 'label').attr('style', node.labelStyle);
11947 var text = label.node().appendChild((0,_createLabel__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)((0,_mermaidAPI__WEBPACK_IMPORTED_MODULE_3__.decodeEntities)(node.labelText), (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)()), node.labelStyle, false, isNode)); // Get the size of the label
11948
11949 var bbox = text.getBBox();
11950
11951 if ((0,_diagrams_common_common__WEBPACK_IMPORTED_MODULE_2__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().flowchart.htmlLabels)) {
11952 var div = text.children[0];
11953 var dv = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(text);
11954 bbox = div.getBoundingClientRect();
11955 dv.attr('width', bbox.width);
11956 dv.attr('height', bbox.height);
11957 }
11958
11959 var halfPadding = node.padding / 2; // Center the label
11960
11961 label.attr('transform', 'translate(' + -bbox.width / 2 + ', ' + -bbox.height / 2 + ')');
11962 return {
11963 shapeSvg: shapeSvg,
11964 bbox: bbox,
11965 halfPadding: halfPadding,
11966 label: label
11967 };
11968};
11969var updateNodeBounds = function updateNodeBounds(node, element) {
11970 var bbox = element.node().getBBox();
11971 node.width = bbox.width;
11972 node.height = bbox.height;
11973};
11974function insertPolygonShape(parent, w, h, points) {
11975 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
11976 return d.x + ',' + d.y;
11977 }).join(' ')).attr('class', 'label-container').attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
11978}
11979
11980/***/ }),
11981
11982/***/ "./src/defaultConfig.js":
11983/*!******************************!*\
11984 !*** ./src/defaultConfig.js ***!
11985 \******************************/
11986/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
11987
11988"use strict";
11989__webpack_require__.r(__webpack_exports__);
11990/* harmony export */ __webpack_require__.d(__webpack_exports__, {
11991/* harmony export */ "configKeys": () => (/* binding */ configKeys),
11992/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
11993/* harmony export */ });
11994/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
11995function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
11996
11997function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11998
11999function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
12000
12001function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12002
12003function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12004
12005function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12006
12007function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
12008
12009
12010/**
12011 * **Configuration methods in Mermaid version 8.6.0 have been updated, to learn more[[click here](8.6.0_docs.md)].**
12012 *
12013 * ## **What follows are config instructions for older versions**
12014 *
12015 * These are the default options which can be overridden with the initialization call like so:
12016 *
12017 * **Example 1:**
12018 * <pre>
12019 * mermaid.initialize({
12020 * flowchart:{
12021 * htmlLabels: false
12022 * }
12023 * });
12024 * </pre>
12025 *
12026 * **Example 2:**
12027 * <pre>
12028 * &lt;script>
12029 * var config = {
12030 * startOnLoad:true,
12031 * flowchart:{
12032 * useMaxWidth:true,
12033 * htmlLabels:true,
12034 * curve:'cardinal',
12035 * },
12036 *
12037 * securityLevel:'loose',
12038 * };
12039 * mermaid.initialize(config);
12040 * &lt;/script>
12041 * </pre>
12042 * A summary of all options and their defaults is found [here](#mermaidapi-configuration-defaults). A description of each option follows below.
12043 *
12044 * @name Configuration
12045 */
12046
12047var config = {
12048 /**
12049 * theme , the CSS style sheet
12050 *
12051 * | Parameter | Description | Type | Required | Values |
12052 * | --- | --- | --- | --- | --- |
12053 * | theme | Built in Themes | string | Optional | 'default', 'forest', 'dark', 'neutral', 'null'|
12054 *
12055 * **Notes:** To disable any pre-defined mermaid theme, use "null".
12056 *
12057 * <pre>
12058 * "theme": "forest",
12059 * "themeCSS": ".node rect { fill: red; }"
12060 * </pre>
12061 */
12062 theme: 'default',
12063 themeVariables: _themes__WEBPACK_IMPORTED_MODULE_0__["default"]["default"].getThemeVariables(),
12064 themeCSS: undefined,
12065
12066 /* **maxTextSize** - The maximum allowed size of the users text diamgram */
12067 maxTextSize: 50000,
12068
12069 /**
12070 * | Parameter | Description | Type | Required | Values |
12071 * | --- | --- | --- | --- | --- |
12072 * | fontFamily | specifies the font to be used in the rendered diagrams| string | Required | Any Possible CSS FontFamily |
12073 *
12074 * **Notes:**
12075 * Default value: '"trebuchet ms", verdana, arial, sans-serif;'.
12076 */
12077 fontFamily: '"trebuchet ms", verdana, arial, sans-serif;',
12078
12079 /**
12080 * | Parameter | Description | Type | Required | Values |
12081 * | --- | --- | --- | --- | --- |
12082 * | logLevel |This option decides the amount of logging to be used.| string \| number | Required | 1, 2, 3, 4, 5 |
12083 *
12084 *
12085 * **Notes:**
12086 *
12087 * - debug: 1
12088 * - info: 2
12089 * - warn: 3
12090 * - error: 4
12091 * - fatal: 5 (default)
12092 */
12093 logLevel: 5,
12094
12095 /**
12096 * | Parameter | Description | Type | Required | Values |
12097 * | --- | --- | --- | --- | --- |
12098 * | securitylevel | Level of trust for parsed diagram|string | Required | 'strict', 'loose', 'antiscript' |
12099 *
12100 * **Notes**:
12101 *
12102 * - **strict**: (**default**) tags in text are encoded, click functionality is disabled
12103 * - **loose**: tags in text are allowed, click functionality is enabled
12104 * - **antiscript**: html tags in text are allowed, (only script element is removed), click functionality is enabled
12105 */
12106 securityLevel: 'strict',
12107
12108 /**
12109 * | Parameter | Description | Type | Required | Values |
12110 * | --- | --- | --- | --- | --- |
12111 * | startOnLoad | Dictates whether mermaid starts on Page load | boolean | Required | true, false |
12112 *
12113 * **Notes:** Default value: true
12114 */
12115 startOnLoad: true,
12116
12117 /**
12118 * | Parameter | Description |Type | Required |Values|
12119 * | --- | --- | --- | --- | --- |
12120 * | arrowMarkerAbsolute | Controls whether or arrow markers in html code are absolute paths or anchors | boolean | Required | true, false |
12121 *
12122 *
12123 * **Notes**:
12124 *
12125 * This matters if you are using base tag settings.
12126 *
12127 * Default value: false
12128 */
12129 arrowMarkerAbsolute: false,
12130
12131 /**
12132 * This option controls which currentConfig keys are considered _secure_ and can only be changed via
12133 * call to mermaidAPI.initialize. Calls to mermaidAPI.reinitialize cannot make changes to
12134 * the `secure` keys in the current currentConfig. This prevents malicious graph directives from
12135 * overriding a site's default security.
12136 * **Notes**:
12137 *
12138 * Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
12139 */
12140 secure: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize'],
12141
12142 /**
12143 * This option controls if the generated ids of nodes in the SVG are generated randomly or based on a seed.
12144 * If set to false, the IDs are generated based on the current date and thus are not deterministic. This is the default behaviour.
12145 *
12146 * **Notes**:
12147 *
12148 * This matters if your files are checked into sourcecontrol e.g. git and should not change unless content is changed.
12149 *
12150 * Default value: false
12151 */
12152 deterministicIds: false,
12153
12154 /**
12155 * This option is the optional seed for deterministic ids. if set to undefined but deterministicIds is true, a simple number iterator is used.
12156 * You can set this attribute to base the seed on a static string.
12157 */
12158 deterministicIDSeed: undefined,
12159
12160 /**
12161 * The object containing configurations specific for flowcharts
12162 */
12163 flowchart: {
12164 /**
12165 * | Parameter | Description | Type | Required | Values |
12166 * | --- | --- | --- | --- | --- |
12167 * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
12168 *
12169 * **Notes:**
12170 *
12171 * The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
12172 *
12173 * Default value: 8
12174 */
12175 diagramPadding: 8,
12176
12177 /**
12178 * | Parameter | Description | Type | Required | Values |
12179 * | --- | --- | --- | --- | --- |
12180 * | htmlLabels | Flag for setting whether or not a html tag should be used for rendering labels on the edges. | boolean| Required | true, false |
12181 *
12182 * **Notes:** Default value: true.
12183 */
12184 htmlLabels: true,
12185
12186 /**
12187 * | Parameter | Description | Type | Required | Values |
12188 * | --- | --- | --- | --- | --- |
12189 * | nodeSpacing | Defines the spacing between nodes on the same level | Integer | Required | Any positive Number |
12190 *
12191 * **Notes:**
12192 *
12193 * Pertains to horizontal spacing for TB (top to bottom) or BT (bottom to top) graphs, and the vertical spacing for LR as well as RL graphs.**
12194 *
12195 * Default value: 50
12196 */
12197 nodeSpacing: 50,
12198
12199 /**
12200 * | Parameter | Description | Type | Required | Values |
12201 * | --- | --- | --- | --- | --- |
12202 * | rankSpacing | Defines the spacing between nodes on different levels | Integer | Required | Any Positive Number |
12203 *
12204 * **Notes**:
12205 *
12206 * pertains to vertical spacing for TB (top to bottom) or BT (bottom to top), and the horizontal spacing for LR as well as RL graphs.
12207 *
12208 * Default value 50
12209 */
12210 rankSpacing: 50,
12211
12212 /**
12213 * | Parameter | Description | Type | Required | Values |
12214 * | --- | --- | --- | --- | --- |
12215 * | curve | Defines how mermaid renders curves for flowcharts. | string | Required | 'basis', 'linear', 'cardinal'|
12216 *
12217 * **Notes:**
12218 *
12219 * Default Value: 'basis'
12220 */
12221 curve: 'basis',
12222 // Only used in new experimental rendering
12223 // represents the padding between the labels and the shape
12224 padding: 15,
12225
12226 /**
12227 * | Parameter | Description | Type | Required | Values|
12228 * | --- | --- | --- | --- | --- |
12229 * | useMaxWidth | See notes | boolean | 4 | true, false |
12230 *
12231 * **Notes:**
12232 *
12233 * When this flag is set the height and width is set to 100% and is then scaling with the
12234 * available space if not the absolute space required is used.
12235 *
12236 * Default value: true
12237 */
12238 useMaxWidth: true,
12239
12240 /**
12241 * | Parameter | Description | Type | Required | Values|
12242 * | --- | --- | --- | --- | --- |
12243 * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
12244 *
12245 * **Notes:**
12246 *
12247 * Decides which rendering engine that is to be used for the rendering. Legal values are:
12248 * * dagre-d3
12249 * * dagre-wrapper - wrapper for dagre implemented in mermaid
12250 *
12251 * Default value: 'dagre-d3'
12252 */
12253 defaultRenderer: 'dagre-d3'
12254 },
12255
12256 /**
12257 * The object containing configurations specific for sequence diagrams
12258 */
12259 sequence: {
12260 /**
12261 * | Parameter | Description | Type | Required | Values |
12262 * | --- | --- | --- | --- | --- |
12263 * | activationWidth | Width of the activation rect | Integer | Required | Any Positive Value |
12264 *
12265 *
12266 * **Notes:** Default value :10
12267 */
12268 activationWidth: 10,
12269
12270 /**
12271 * | Parameter | Description | Type | Required | Values |
12272 * | --- | --- | --- | --- | --- |
12273 * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
12274 *
12275 * **Notes:** Default value: 50
12276 */
12277 diagramMarginX: 50,
12278
12279 /**
12280 *| Parameter | Description | Type | Required | Values |
12281 *| --- | --- | --- | --- | --- |
12282 *| diagramMarginY | Margin to the over and under the sequence diagram | Integer | Required | Any Positive Value |
12283 *
12284 * **Notes:** Default value: 10
12285 */
12286 diagramMarginY: 10,
12287
12288 /**
12289 * | Parameter | Description | Type | Required | Values |
12290 * | --- | --- | --- | --- | --- |
12291 * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
12292 *
12293 * **Notes:**
12294 * Default value: 50
12295 */
12296 actorMargin: 50,
12297
12298 /**
12299 * | Parameter | Description | Type | Required | Values |
12300 * | --- | --- | --- | --- | --- |
12301 * | width | Width of actor boxes | Integer | Required | Any Positive Value |
12302 *
12303 * **Notes:**
12304 * Default value: 150
12305 */
12306 width: 150,
12307
12308 /**
12309 * | Parameter | Description | Type | Required | Values |
12310 * | --- | --- | --- | --- | --- |
12311 * | height | Height of actor boxes | Integer | Required | Any Positive Value|
12312 *
12313 * **Notes:**
12314 * Default value: 65
12315 */
12316 height: 65,
12317
12318 /**
12319 * | Parameter | Description | Type | Required | Values |
12320 * | --- | --- | --- | --- | --- |
12321 * | boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
12322 *
12323 * **Notes:**
12324 * Default value: 10
12325 */
12326 boxMargin: 10,
12327
12328 /**
12329 * | Parameter | Description | Type | Required | Values |
12330 * | --- | --- | --- | --- | --- |
12331 * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
12332 *
12333 * **Notes:**
12334 * Default value: 5
12335 */
12336 boxTextMargin: 5,
12337
12338 /**
12339 * | Parameter | Description | Type | Required | Values |
12340 * | --- | --- | --- | --- | --- |
12341 * | noteMargin | margin around notes | Integer | Required | Any Positive Value |
12342 *
12343 * **Notes:**
12344 * Default value: 10
12345 */
12346 noteMargin: 10,
12347
12348 /**
12349 * | Parameter | Description | Type | Required | Values |
12350 * | --- | --- | --- | --- | --- |
12351 * | messageMargin | Space between messages | Integer | Required | Any Positive Value |
12352 *
12353 * **Notes:**
12354 * Default value: 35
12355 */
12356 messageMargin: 35,
12357
12358 /**
12359 * | Parameter | Description | Type | Required | Values |
12360 * | --- | --- | --- | --- | --- |
12361 * | messageAlign | Multiline message alignment | string | Required | 'left', 'center', 'right' |
12362 *
12363 * **Notes:**
12364 * Default value: 'center'
12365 */
12366 messageAlign: 'center',
12367
12368 /**
12369 * | Parameter | Description | Type | Required | Values |
12370 * | --- | --- | --- | --- | --- |
12371 * | mirrorActors | Mirror actors under diagram | boolean | Required | true, false |
12372 *
12373 * **Notes:**
12374 * Default value: true
12375 */
12376 mirrorActors: true,
12377
12378 /**
12379 *| Parameter | Description |Type | Required | Values|
12380 *| --- | --- | --- | --- | --- |
12381 *| forceMenus | forces actor popup menus to always be visible (to support E2E testing). | Boolean| Required | True, False |
12382 *
12383 * **Notes:**
12384 *
12385 * Default value: false.
12386 */
12387 forceMenus: false,
12388
12389 /**
12390 * | Parameter | Description | Type | Required | Values |
12391 * | --- | --- | --- | --- | --- |
12392 * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | Required | Any Positive Value |
12393 *
12394 * **Notes:**
12395 *
12396 * Depending on css styling this might need adjustment.
12397 *
12398 * Default value: 1
12399 */
12400 bottomMarginAdj: 1,
12401
12402 /**
12403 * | Parameter | Description | Type | Required | Values |
12404 * | --- | --- | --- | --- | --- |
12405 * | useMaxWidth | See Notes | boolean | Required | true, false |
12406 *
12407 * **Notes:**
12408 * When this flag is set to true, the height and width is set to 100% and is then scaling with the
12409 * available space. If set to false, the absolute space required is used.
12410 *
12411 * Default value: true
12412 */
12413 useMaxWidth: true,
12414
12415 /**
12416 * | Parameter | Description | Type | Required | Values |
12417 * | --- | --- | --- | --- | --- |
12418 * | rightAngles | display curve arrows as right angles | boolean | Required | true, false |
12419 *
12420 * **Notes:**
12421 *
12422 * This will display arrows that start and begin at the same node as right angles, rather than a curve
12423 *
12424 * Default value: false
12425 */
12426 rightAngles: false,
12427
12428 /**
12429 * | Parameter | Description | Type | Required | Values |
12430 * | --- | --- | --- | --- | --- |
12431 * | showSequenceNumbers | This will show the node numbers | boolean | Required | true, false |
12432 *
12433 * **Notes:**
12434 * Default value: false
12435 */
12436 showSequenceNumbers: false,
12437
12438 /**
12439 * | Parameter | Description | Type | Required | Values |
12440 * | --- | --- | --- | --- | --- |
12441 * | actorFontSize| This sets the font size of the actor's description | Integer | Require | Any Positive Value |
12442 *
12443 ***Notes:**
12444 ***Default value 14**..
12445 */
12446 actorFontSize: 14,
12447
12448 /**
12449 * | Parameter | Description | Type | Required | Values |
12450 * | --- | --- | --- | --- | --- |
12451 * | actorFontFamily |This sets the font family of the actor's description | string | Required | Any Possible CSS FontFamily |
12452 *
12453 * **Notes:**
12454 * Default value: "'Open-Sans", "sans-serif"'
12455 */
12456 actorFontFamily: '"Open-Sans", "sans-serif"',
12457
12458 /**
12459 * This sets the font weight of the actor's description
12460 *
12461 * **Notes:**
12462 * Default value: 400.
12463 */
12464 actorFontWeight: 400,
12465
12466 /**
12467 * | Parameter | Description | Type | Required | Values |
12468 * | --- | --- | --- | --- | --- |
12469 * | noteFontSize | This sets the font size of actor-attached notes | Integer | Required | Any Positive Value |
12470 *
12471 * **Notes:**
12472 * Default value: 14
12473 */
12474 noteFontSize: 14,
12475
12476 /**
12477 * | Parameter | Description | Type | Required | Values |
12478 * | --- | --- | --- | --- | --- |
12479 * | noteFontFamily| This sets the font family of actor-attached notes. | string | Required | Any Possible CSS FontFamily |
12480 *
12481 * **Notes:**
12482 * Default value: ''"trebuchet ms", verdana, arial, sans-serif'
12483 */
12484 noteFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
12485
12486 /**
12487 * This sets the font weight of the note's description
12488 *
12489 * **Notes:**
12490 * Default value: 400
12491 */
12492 noteFontWeight: 400,
12493
12494 /**
12495 * | Parameter | Description | Type | Required | Values |
12496 * | --- | --- | --- | --- | --- |
12497 * | noteAlign | This sets the text alignment of actor-attached notes | string | required | 'left', 'center', 'right'|
12498 *
12499 * **Notes:**
12500 * Default value: 'center'
12501 */
12502 noteAlign: 'center',
12503
12504 /**
12505 * | Parameter | Description | Type | Required | Values |
12506 * | --- | --- | --- | --- | --- |
12507 * | messageFontSize | This sets the font size of actor messages | Integer | Required | Any Positive Number |
12508 *
12509 * **Notes:**
12510 * Default value: 16
12511 */
12512 messageFontSize: 16,
12513
12514 /**
12515 * | Parameter | Description | Type | Required | Values |
12516 * | --- | --- | --- | --- | --- |
12517 * | messageFontFamily | This sets the font family of actor messages | string | Required | Any Possible CSS FontFamily |
12518 *
12519 * **Notes:**
12520 * Default value: '"trebuchet ms", verdana, arial, sans-serif'
12521 */
12522 messageFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
12523
12524 /**
12525 * This sets the font weight of the message's description
12526 *
12527 * **Notes:**
12528 * Default value: 400.
12529 */
12530 messageFontWeight: 400,
12531
12532 /**
12533 * This sets the auto-wrap state for the diagram
12534 *
12535 * **Notes:**
12536 * Default value: false.
12537 */
12538 wrap: false,
12539
12540 /**
12541 * This sets the auto-wrap padding for the diagram (sides only)
12542 *
12543 * **Notes:**
12544 * Default value: 0.
12545 */
12546 wrapPadding: 10,
12547
12548 /**
12549 * This sets the width of the loop-box (loop, alt, opt, par)
12550 *
12551 * **Notes:**
12552 * Default value: 50.
12553 */
12554 labelBoxWidth: 50,
12555
12556 /**
12557 * This sets the height of the loop-box (loop, alt, opt, par)
12558 *
12559 * **Notes:**
12560 * Default value: 20.
12561 */
12562 labelBoxHeight: 20,
12563 messageFont: function messageFont() {
12564 return {
12565 fontFamily: this.messageFontFamily,
12566 fontSize: this.messageFontSize,
12567 fontWeight: this.messageFontWeight
12568 };
12569 },
12570 noteFont: function noteFont() {
12571 return {
12572 fontFamily: this.noteFontFamily,
12573 fontSize: this.noteFontSize,
12574 fontWeight: this.noteFontWeight
12575 };
12576 },
12577 actorFont: function actorFont() {
12578 return {
12579 fontFamily: this.actorFontFamily,
12580 fontSize: this.actorFontSize,
12581 fontWeight: this.actorFontWeight
12582 };
12583 }
12584 },
12585
12586 /**
12587 * The object containing configurations specific for gantt diagrams
12588 */
12589 gantt: {
12590 /**
12591 * ### titleTopMargin
12592 *
12593 * | Parameter | Description | Type | Required | Values |
12594 * | --- | --- | --- | --- | --- |
12595 * | titleTopMargin | Margin top for the text over the gantt diagram | Integer | Required | Any Positive Value |
12596 *
12597 * **Notes:**
12598 * Default value: 25
12599 */
12600 titleTopMargin: 25,
12601
12602 /**
12603 * | Parameter | Description | Type | Required | Values |
12604 * | --- | --- | --- | --- | --- |
12605 * | barHeight | The height of the bars in the graph | Integer | Required | Any Positive Value |
12606 *
12607 * **Notes:**
12608 * Default value: 20
12609 */
12610 barHeight: 20,
12611
12612 /**
12613 * | Parameter | Description | Type | Required | Values |
12614 * | --- | --- | --- | --- | --- |
12615 * | barGap | The margin between the different activities in the gantt diagram | Integer | Optional | Any Positive Value |
12616 *
12617 * **Notes:**
12618 * Default value: 4
12619 */
12620 barGap: 4,
12621
12622 /**
12623 * | Parameter | Description | Type | Required | Values|
12624 * | --- | --- | --- | --- | --- |
12625 * | topPadding | Margin between title and gantt diagram and between axis and gantt diagram. | Integer | Required | Any Positive Value |
12626 *
12627 * **Notes:**
12628 * Default value: 50
12629 */
12630 topPadding: 50,
12631
12632 /**
12633 * | Parameter | Description | Type | Required | Values|
12634 * | --- | --- | --- | --- | --- |
12635 * | rightPadding | The space allocated for the section name to the right of the activities | Integer | Required | Any Positive Value |
12636 *
12637 * **Notes:**
12638 * Default value: 75
12639 */
12640 rightPadding: 75,
12641
12642 /**
12643 * | Parameter | Description | Type | Required | Values|
12644 * | --- | --- | --- | --- | --- |
12645 * | leftPadding | The space allocated for the section name to the left of the activities | Integer | Required | Any Positive Value |
12646 *
12647 * **Notes:**
12648 * Default value: 75
12649 */
12650 leftPadding: 75,
12651
12652 /**
12653 * | Parameter | Description | Type | Required | Values|
12654 * | --- | --- | --- | --- | --- |
12655 * | gridLineStartPadding | Vertical starting position of the grid lines | Integer | Required | Any Positive Value |
12656 *
12657 * **Notes:**
12658 * Default value: 35
12659 */
12660 gridLineStartPadding: 35,
12661
12662 /**
12663 * | Parameter | Description | Type | Required | Values|
12664 * | --- | --- | --- | --- | --- |
12665 * | fontSize | Font size | Integer | Required | Any Positive Value |
12666 *
12667 * **Notes:**
12668 * Default value: 11
12669 */
12670 fontSize: 11,
12671
12672 /**
12673 * | Parameter | Description | Type | Required | Values|
12674 * | --- | --- | --- | --- | --- |
12675 * | sectionFontSize | Font size for sections| Integer | Required | Any Positive Value |
12676 *
12677 * **Notes:**
12678 * Default value: 11
12679 */
12680 sectionFontSize: 11,
12681
12682 /**
12683 * | Parameter | Description | Type | Required | Values|
12684 * | --- | --- | --- | --- | --- |
12685 * | numberSectionStyles | The number of alternating section styles | Integer | 4 | Any Positive Value |
12686 *
12687 * **Notes:**
12688 * Default value: 4
12689 */
12690 numberSectionStyles: 4,
12691
12692 /**
12693 * | Parameter | Description | Type | Required | Values |
12694 * | --- | --- | --- | --- | --- |
12695 * | axisFormat | Datetime format of the axis | 3 | Required | Date in yy-mm-dd |
12696 *
12697 * **Notes:**
12698 *
12699 * This might need adjustment to match your locale and preferences
12700 *
12701 * Default value: '%Y-%m-%d'.
12702 */
12703 axisFormat: '%Y-%m-%d',
12704
12705 /**
12706 * | Parameter | Description | Type | Required | Values |
12707 * | --- | --- | --- | --- | --- |
12708 * | useMaxWidth | See notes | boolean | 4 | true, false |
12709 *
12710 * **Notes:**
12711 *
12712 * When this flag is set the height and width is set to 100% and is then scaling with the
12713 * available space if not the absolute space required is used.
12714 *
12715 * Default value: true
12716 */
12717 useMaxWidth: true,
12718
12719 /**
12720 *| Parameter | Description |Type | Required | Values|
12721 *| --- | --- | --- | --- | --- |
12722 *| topAxis | See notes | Boolean | 4 | True, False |
12723 *
12724 ***Notes:** when this flag is set date labels will be added to the
12725 top of the chart
12726 *
12727 ***Default value false**.
12728 */
12729 topAxis: false,
12730 useWidth: undefined
12731 },
12732
12733 /**
12734 * The object containing configurations specific for journey diagrams
12735 */
12736 journey: {
12737 /**
12738 * | Parameter | Description | Type | Required | Values |
12739 * | --- | --- | --- | --- | --- |
12740 * | diagramMarginX | Margin to the right and left of the sequence diagram | Integer | Required | Any Positive Value |
12741 *
12742 * **Notes:**
12743 * Default value: 50
12744 */
12745 diagramMarginX: 50,
12746
12747 /**
12748 * | Parameter | Description | Type | Required | Values |
12749 * | --- | --- | --- | --- | --- |
12750 * | diagramMarginY | Margin to the over and under the sequence diagram. | Integer | Required | Any Positive Value |
12751 *
12752 * **Notes:**
12753 * Default value: 10
12754 */
12755 diagramMarginY: 10,
12756
12757 /**
12758 * | Parameter | Description | Type | Required | Values |
12759 * | --- | --- | --- | --- | --- |
12760 * | actorMargin | Margin between actors | Integer | Required | Any Positive Value |
12761 *
12762 * **Notes:**
12763 * Default value: 50
12764 */
12765 leftMargin: 150,
12766
12767 /**
12768 * | Parameter | Description | Type | Required | Values |
12769 * | --- | --- | --- | --- | --- |
12770 * | width | Width of actor boxes | Integer | Required | Any Positive Value |
12771 *
12772 * **Notes:**
12773 * Default value: 150
12774 */
12775 width: 150,
12776
12777 /**
12778 * | Parameter | Description | Type | Required | Values |
12779 * | --- | --- | --- | --- | --- |
12780 * | height | Height of actor boxes | Integer | Required | Any Positive Value |
12781 *
12782 * **Notes:**
12783 * Default value: 65
12784 */
12785 height: 50,
12786
12787 /**
12788 *| Parameter | Description |Type | Required | Values|
12789 *| --- | --- | --- | --- | --- |
12790 *| boxMargin | Margin around loop boxes | Integer | Required | Any Positive Value |
12791 *
12792 * **Notes:**
12793 * Default value: 10
12794 */
12795 boxMargin: 10,
12796
12797 /**
12798 * | Parameter | Description | Type | Required | Values |
12799 * | --- | --- | --- | --- | --- |
12800 * | boxTextMargin | Margin around the text in loop/alt/opt boxes | Integer | Required | Any Positive Value |
12801 *
12802 * **Notes:**
12803 * Default value: 5
12804 */
12805 boxTextMargin: 5,
12806
12807 /**
12808 * | Parameter | Description | Type | Required | Values |
12809 * | --- | --- | --- | --- | --- |
12810 * | noteMargin | Margin around notes | Integer | Required | Any Positive Value |
12811 *
12812 * **Notes:**
12813 * Default value: 10
12814 */
12815 noteMargin: 10,
12816
12817 /**
12818 * | Parameter | Description | Type | Required | Values |
12819 * | --- | --- | --- | --- | --- |
12820 * | messageMargin |Space between messages. | Integer | Required | Any Positive Value |
12821 *
12822 * **Notes:**
12823 *
12824 * Space between messages.
12825 *
12826 * Default value: 35
12827 */
12828 messageMargin: 35,
12829
12830 /**
12831 * | Parameter | Description | Type | Required | Values |
12832 * | --- | --- | --- | --- | --- |
12833 * | messageAlign | Multiline message alignment | 3 | 4 | 'left', 'center', 'right' |
12834 *
12835 * **Notes:**
12836 * Default value: 'center'
12837 */
12838 messageAlign: 'center',
12839
12840 /**
12841 * | Parameter | Description | Type | Required | Values |
12842 * | --- | --- | --- | --- | --- |
12843 * | bottomMarginAdj | Prolongs the edge of the diagram downwards | Integer | 4 | Any Positive Value |
12844 *
12845 * **Notes:**
12846 *
12847 * Depending on css styling this might need adjustment.
12848 *
12849 * Default value: 1
12850 */
12851 bottomMarginAdj: 1,
12852
12853 /**
12854 * | Parameter | Description | Type | Required | Values |
12855 * | --- | --- | --- | --- | --- |
12856 * | useMaxWidth | See notes | boolean | 4 | true, false |
12857 *
12858 * **Notes:**
12859 *
12860 * When this flag is set the height and width is set to 100% and is then scaling with the
12861 * available space if not the absolute space required is used.
12862 *
12863 * Default value: true
12864 */
12865 useMaxWidth: true,
12866
12867 /**
12868 * | Parameter | Description | Type | Required | Values |
12869 * | --- | --- | --- | --- | --- |
12870 * | rightAngles | Curved Arrows become Right Angles | 3 | 4 | true, false |
12871 *
12872 * **Notes:**
12873 *
12874 * This will display arrows that start and begin at the same node as right angles, rather than a curves
12875 *
12876 * Default value: false
12877 */
12878 rightAngles: false,
12879 taskFontSize: 14,
12880 taskFontFamily: '"Open-Sans", "sans-serif"',
12881 taskMargin: 50,
12882 // width of activation box
12883 activationWidth: 10,
12884 // text placement as: tspan | fo | old only text as before
12885 textPlacement: 'fo',
12886 actorColours: ['#8FBC8F', '#7CFC00', '#00FFFF', '#20B2AA', '#B0E0E6', '#FFFFE0'],
12887 sectionFills: ['#191970', '#8B008B', '#4B0082', '#2F4F4F', '#800000', '#8B4513', '#00008B'],
12888 sectionColours: ['#fff']
12889 },
12890 class: {
12891 arrowMarkerAbsolute: false,
12892
12893 /**
12894 * | Parameter | Description | Type | Required | Values |
12895 * | --- | --- | --- | --- | --- |
12896 * | useMaxWidth | See notes | boolean | 4 | true, false |
12897 *
12898 * **Notes:**
12899 *
12900 * When this flag is set the height and width is set to 100% and is then scaling with the
12901 * available space if not the absolute space required is used.
12902 *
12903 * Default value: true
12904 */
12905 useMaxWidth: true,
12906
12907 /**
12908 * | Parameter | Description | Type | Required | Values|
12909 * | --- | --- | --- | --- | --- |
12910 * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
12911 *
12912 * **Notes:**
12913 *
12914 * Decides which rendering engine that is to be used for the rendering. Legal values are:
12915 * * dagre-d3
12916 * * dagre-wrapper - wrapper for dagre implemented in mermaid
12917 *
12918 * Default value: 'dagre-d3'
12919 */
12920 defaultRenderer: 'dagre-wrapper'
12921 },
12922 git: {
12923 arrowMarkerAbsolute: false,
12924 useWidth: undefined,
12925
12926 /**
12927 * | Parameter | Description | Type | Required | Values |
12928 * | --- | --- | --- | --- | --- |
12929 * | useMaxWidth | See notes | boolean | 4 | true, false |
12930 *
12931 * **Notes:**
12932 *
12933 * When this flag is set the height and width is set to 100% and is then scaling with the
12934 * available space if not the absolute space required is used.
12935 *
12936 * Default value: true
12937 */
12938 useMaxWidth: true
12939 },
12940 state: {
12941 dividerMargin: 10,
12942 sizeUnit: 5,
12943 padding: 8,
12944 textHeight: 10,
12945 titleShift: -15,
12946 noteMargin: 10,
12947 forkWidth: 70,
12948 forkHeight: 7,
12949 // Used
12950 miniPadding: 2,
12951 // Font size factor, this is used to guess the width of the edges labels before rendering by dagre
12952 // layout. This might need updating if/when switching font
12953 fontSizeFactor: 5.02,
12954 fontSize: 24,
12955 labelHeight: 16,
12956 edgeLengthFactor: '20',
12957 compositTitleSize: 35,
12958 radius: 5,
12959
12960 /**
12961 * | Parameter | Description | Type | Required | Values |
12962 * | --- | --- | --- | --- | --- |
12963 * | useMaxWidth | See notes | boolean | 4 | true, false |
12964 *
12965 * **Notes:**
12966 *
12967 * When this flag is set the height and width is set to 100% and is then scaling with the
12968 * available space if not the absolute space required is used.
12969 *
12970 * Default value: true
12971 */
12972 useMaxWidth: true,
12973
12974 /**
12975 * | Parameter | Description | Type | Required | Values|
12976 * | --- | --- | --- | --- | --- |
12977 * | defaultRenderer | See notes | boolean | 4 | dagre-d3, dagre-wrapper |
12978 *
12979 * **Notes:**
12980 *
12981 * Decides which rendering engine that is to be used for the rendering. Legal values are:
12982 * * dagre-d3
12983 * * dagre-wrapper - wrapper for dagre implemented in mermaid
12984 *
12985 * Default value: 'dagre-d3'
12986 */
12987 defaultRenderer: 'dagre-wrapper'
12988 },
12989
12990 /**
12991 * The object containing configurations specific for entity relationship diagrams
12992 */
12993 er: {
12994 /**
12995 * | Parameter | Description | Type | Required | Values |
12996 * | --- | --- | --- | --- | --- |
12997 * | diagramPadding | Amount of padding around the diagram as a whole | Integer | Required | Any Positive Value |
12998 *
12999 * **Notes:**
13000 *
13001 * The amount of padding around the diagram as a whole so that embedded diagrams have margins, expressed in pixels
13002 *
13003 * Default value: 20
13004 */
13005 diagramPadding: 20,
13006
13007 /**
13008 * | Parameter | Description | Type | Required | Values |
13009 * | --- | --- | --- | --- | --- |
13010 * | layoutDirection | Directional bias for layout of entities. | string | Required | "TB", "BT", "LR", "RL" |
13011 *
13012 * **Notes:**
13013 *
13014 * 'TB' for Top-Bottom, 'BT'for Bottom-Top, 'LR' for Left-Right, or 'RL' for Right to Left.
13015 *
13016 * T = top, B = bottom, L = left, and R = right.
13017 *
13018 * Default value: 'TB'
13019 */
13020 layoutDirection: 'TB',
13021
13022 /**
13023 * | Parameter | Description | Type | Required | Values |
13024 * | --- | --- | --- | --- | --- |
13025 * | minEntityWidth | The minimum width of an entity box | Integer | Required | Any Positive Value |
13026 *
13027 * **Notes:**
13028 * Expressed in pixels.
13029 * Default value: 100
13030 */
13031 minEntityWidth: 100,
13032
13033 /**
13034 * | Parameter | Description | Type | Required | Values |
13035 * | --- | --- | --- | --- | --- |
13036 * | minEntityHeight| The minimum height of an entity box | Integer | 4 | Any Positive Value |
13037 *
13038 * **Notes:**
13039 * Expressed in pixels
13040 * Default value: 75
13041 */
13042 minEntityHeight: 75,
13043
13044 /**
13045 * | Parameter | Description | Type | Required | Values |
13046 * | --- | --- | --- | --- | --- |
13047 * | entityPadding | Minimum internal padding betweentext in box and box borders | Integer | 4 | Any Positive Value |
13048 *
13049 * **Notes:**
13050 *
13051 * The minimum internal padding betweentext in an entity box and the enclosing box borders, expressed in pixels.
13052 *
13053 * Default value: 15
13054 */
13055 entityPadding: 15,
13056
13057 /**
13058 * | Parameter | Description | Type | Required | Values |
13059 * | --- | --- | --- | --- | --- |
13060 * | stroke | Stroke color of box edges and lines | string | 4 | Any recognized color |
13061 *
13062 * **Notes:**
13063 * Default value: 'gray'
13064 */
13065 stroke: 'gray',
13066
13067 /**
13068 * | Parameter | Description | Type | Required | Values |
13069 * | --- | --- | --- | --- | --- |
13070 * | fill | Fill color of entity boxes | string | 4 | Any recognized color |
13071 *
13072 * **Notes:**
13073 * Default value: 'honeydew'
13074 */
13075 fill: 'honeydew',
13076
13077 /**
13078 * | Parameter | Description | Type | Required | Values |
13079 * | --- | --- | --- | --- | --- |
13080 * | fontSize | Font Size in pixels | Integer | | Any Positive Value |
13081 *
13082 * **Notes:**
13083 *
13084 * Font size (expressed as an integer representing a number of pixels)
13085 * Default value: 12
13086 */
13087 fontSize: 12,
13088
13089 /**
13090 * | Parameter | Description | Type | Required | Values |
13091 * | --- | --- | --- | --- | --- |
13092 * | useMaxWidth | See Notes | boolean | Required | true, false |
13093 *
13094 * **Notes:**
13095 *
13096 * When this flag is set to true, the diagram width is locked to 100% and
13097 * scaled based on available space. If set to false, the diagram reserves its
13098 * absolute width.
13099 *
13100 * Default value: true
13101 */
13102 useMaxWidth: true
13103 },
13104
13105 /**
13106 * The object containing configurations specific for pie diagrams
13107 */
13108 pie: {
13109 useWidth: undefined,
13110
13111 /**
13112 * | Parameter | Description | Type | Required | Values |
13113 * | --- | --- | --- | --- | --- |
13114 * | useMaxWidth | See Notes | boolean | Required | true, false |
13115 *
13116 * **Notes:**
13117 *
13118 * When this flag is set to true, the diagram width is locked to 100% and
13119 * scaled based on available space. If set to false, the diagram reserves its
13120 * absolute width.
13121 *
13122 * Default value: true
13123 */
13124 useMaxWidth: true
13125 },
13126
13127 /**
13128 * The object containing configurations specific for req diagrams
13129 */
13130 requirement: {
13131 useWidth: undefined,
13132
13133 /**
13134 * | Parameter | Description | Type | Required | Values |
13135 * | --- | --- | --- | --- | --- |
13136 * | useMaxWidth | See Notes | boolean | Required | true, false |
13137 *
13138 * **Notes:**
13139 *
13140 * When this flag is set to true, the diagram width is locked to 100% and
13141 * scaled based on available space. If set to false, the diagram reserves its
13142 * absolute width.
13143 *
13144 * Default value: true
13145 */
13146 useMaxWidth: true,
13147 rect_fill: '#f9f9f9',
13148 text_color: '#333',
13149 rect_border_size: '0.5px',
13150 rect_border_color: '#bbb',
13151 rect_min_width: 200,
13152 rect_min_height: 200,
13153 fontSize: 14,
13154 rect_padding: 10,
13155 line_height: 20
13156 }
13157};
13158config.class.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
13159config.git.arrowMarkerAbsolute = config.arrowMarkerAbsolute;
13160
13161var keyify = function keyify(obj) {
13162 var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
13163 return Object.keys(obj).reduce(function (res, el) {
13164 if (Array.isArray(obj[el])) {
13165 return res;
13166 } else if (_typeof(obj[el]) === 'object' && obj[el] !== null) {
13167 return [].concat(_toConsumableArray(res), [prefix + el], _toConsumableArray(keyify(obj[el], '')));
13168 }
13169
13170 return [].concat(_toConsumableArray(res), [prefix + el]);
13171 }, []);
13172};
13173
13174var configKeys = keyify(config, '');
13175/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (config);
13176
13177/***/ }),
13178
13179/***/ "./src/diagrams/class/classDb.js":
13180/*!***************************************!*\
13181 !*** ./src/diagrams/class/classDb.js ***!
13182 \***************************************/
13183/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
13184
13185"use strict";
13186__webpack_require__.r(__webpack_exports__);
13187/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13188/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
13189/* harmony export */ "addClass": () => (/* binding */ addClass),
13190/* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
13191/* harmony export */ "clear": () => (/* binding */ clear),
13192/* harmony export */ "getClass": () => (/* binding */ getClass),
13193/* harmony export */ "getClasses": () => (/* binding */ getClasses),
13194/* harmony export */ "getRelations": () => (/* binding */ getRelations),
13195/* harmony export */ "addRelation": () => (/* binding */ addRelation),
13196/* harmony export */ "addAnnotation": () => (/* binding */ addAnnotation),
13197/* harmony export */ "addMember": () => (/* binding */ addMember),
13198/* harmony export */ "addMembers": () => (/* binding */ addMembers),
13199/* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
13200/* harmony export */ "setCssClass": () => (/* binding */ setCssClass),
13201/* harmony export */ "setLink": () => (/* binding */ setLink),
13202/* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
13203/* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
13204/* harmony export */ "lineType": () => (/* binding */ lineType),
13205/* harmony export */ "relationType": () => (/* binding */ relationType),
13206/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13207/* harmony export */ });
13208/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
13209/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
13210/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
13211/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
13212/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
13213/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
13214/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
13215function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
13216
13217function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13218
13219function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13220
13221function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
13222
13223function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13224
13225function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13226
13227
13228
13229
13230
13231
13232
13233var MERMAID_DOM_ID_PREFIX = 'classid-';
13234var relations = [];
13235var classes = {};
13236var classCounter = 0;
13237var funs = [];
13238var parseDirective = function parseDirective(statement, context, type) {
13239 _mermaidAPI__WEBPACK_IMPORTED_MODULE_1__["default"].parseDirective(this, statement, context, type);
13240};
13241
13242var splitClassNameAndType = function splitClassNameAndType(id) {
13243 var genericType = '';
13244 var className = id;
13245
13246 if (id.indexOf('~') > 0) {
13247 var split = id.split('~');
13248 className = split[0];
13249 genericType = _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].sanitizeText(split[1], _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
13250 }
13251
13252 return {
13253 className: className,
13254 type: genericType
13255 };
13256};
13257/**
13258 * Function called by parser when a node definition has been found.
13259 * @param id
13260 * @public
13261 */
13262
13263
13264var addClass = function addClass(id) {
13265 var classId = splitClassNameAndType(id); // Only add class if not exists
13266
13267 if (typeof classes[classId.className] !== 'undefined') return;
13268 classes[classId.className] = {
13269 id: classId.className,
13270 type: classId.type,
13271 cssClasses: [],
13272 methods: [],
13273 members: [],
13274 annotations: [],
13275 domId: MERMAID_DOM_ID_PREFIX + classId.className + '-' + classCounter
13276 };
13277 classCounter++;
13278};
13279/**
13280 * Function to lookup domId from id in the graph definition.
13281 * @param id
13282 * @public
13283 */
13284
13285var lookUpDomId = function lookUpDomId(id) {
13286 var classKeys = Object.keys(classes);
13287
13288 for (var i = 0; i < classKeys.length; i++) {
13289 if (classes[classKeys[i]].id === id) {
13290 return classes[classKeys[i]].domId;
13291 }
13292 }
13293};
13294var clear = function clear() {
13295 relations = [];
13296 classes = {};
13297 funs = [];
13298 funs.push(setupToolTips);
13299};
13300var getClass = function getClass(id) {
13301 return classes[id];
13302};
13303var getClasses = function getClasses() {
13304 return classes;
13305};
13306var getRelations = function getRelations() {
13307 return relations;
13308};
13309var addRelation = function addRelation(relation) {
13310 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Adding relation: ' + JSON.stringify(relation));
13311 addClass(relation.id1);
13312 addClass(relation.id2);
13313 relation.id1 = splitClassNameAndType(relation.id1).className;
13314 relation.id2 = splitClassNameAndType(relation.id2).className;
13315 relations.push(relation);
13316};
13317/**
13318 * Adds an annotation to the specified class
13319 * Annotations mark special properties of the given type (like 'interface' or 'service')
13320 * @param className The class name
13321 * @param annotation The name of the annotation without any brackets
13322 * @public
13323 */
13324
13325var addAnnotation = function addAnnotation(className, annotation) {
13326 var validatedClassName = splitClassNameAndType(className).className;
13327 classes[validatedClassName].annotations.push(annotation);
13328};
13329/**
13330 * Adds a member to the specified class
13331 * @param className The class name
13332 * @param member The full name of the member.
13333 * If the member is enclosed in <<brackets>> it is treated as an annotation
13334 * If the member is ending with a closing bracket ) it is treated as a method
13335 * Otherwise the member will be treated as a normal property
13336 * @public
13337 */
13338
13339var addMember = function addMember(className, member) {
13340 var validatedClassName = splitClassNameAndType(className).className;
13341 var theClass = classes[validatedClassName];
13342
13343 if (typeof member === 'string') {
13344 // Member can contain white spaces, we trim them out
13345 var memberString = member.trim();
13346
13347 if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
13348 // Remove leading and trailing brackets
13349 theClass.annotations.push(memberString.substring(2, memberString.length - 2));
13350 } else if (memberString.indexOf(')') > 0) {
13351 theClass.methods.push(memberString);
13352 } else if (memberString) {
13353 theClass.members.push(memberString);
13354 }
13355 }
13356};
13357var addMembers = function addMembers(className, members) {
13358 if (Array.isArray(members)) {
13359 members.reverse();
13360 members.forEach(function (member) {
13361 return addMember(className, member);
13362 });
13363 }
13364};
13365var cleanupLabel = function cleanupLabel(label) {
13366 if (label.substring(0, 1) === ':') {
13367 return label.substr(1).trim();
13368 } else {
13369 return label.trim();
13370 }
13371};
13372/**
13373 * Called by parser when a special node is found, e.g. a clickable element.
13374 * @param ids Comma separated list of ids
13375 * @param className Class to add
13376 */
13377
13378var setCssClass = function setCssClass(ids, className) {
13379 ids.split(',').forEach(function (_id) {
13380 var id = _id;
13381 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
13382
13383 if (typeof classes[id] !== 'undefined') {
13384 classes[id].cssClasses.push(className);
13385 }
13386 });
13387};
13388/**
13389 * Called by parser when a tooltip is found, e.g. a clickable element.
13390 * @param ids Comma separated list of ids
13391 * @param tooltip Tooltip to add
13392 */
13393
13394var setTooltip = function setTooltip(ids, tooltip) {
13395 var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
13396 ids.split(',').forEach(function (id) {
13397 if (typeof tooltip !== 'undefined') {
13398 classes[id].tooltip = _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].sanitizeText(tooltip, config);
13399 }
13400 });
13401};
13402/**
13403 * Called by parser when a link is found. Adds the URL to the vertex data.
13404 * @param ids Comma separated list of ids
13405 * @param linkStr URL to create a link for
13406 * @param target Target of the link, _blank by default as originally defined in the svgDraw.js file
13407 */
13408
13409
13410var setLink = function setLink(ids, linkStr, target) {
13411 var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
13412 ids.split(',').forEach(function (_id) {
13413 var id = _id;
13414 if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
13415
13416 if (typeof classes[id] !== 'undefined') {
13417 classes[id].link = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].formatUrl(linkStr, config);
13418
13419 if (typeof target === 'string') {
13420 classes[id].linkTarget = target;
13421 } else {
13422 classes[id].linkTarget = '_blank';
13423 }
13424 }
13425 });
13426 setCssClass(ids, 'clickable');
13427};
13428/**
13429 * Called by parser when a click definition is found. Registers an event handler.
13430 * @param ids Comma separated list of ids
13431 * @param functionName Function to be called on click
13432 * @param functionArgs Function args the function should be called with
13433 */
13434
13435var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
13436 ids.split(',').forEach(function (id) {
13437 setClickFunc(id, functionName, functionArgs);
13438 classes[id].haveCallback = true;
13439 });
13440 setCssClass(ids, 'clickable');
13441};
13442
13443var setClickFunc = function setClickFunc(domId, functionName, functionArgs) {
13444 var config = _config__WEBPACK_IMPORTED_MODULE_3__.getConfig();
13445 var id = domId;
13446 var elemId = lookUpDomId(id);
13447
13448 if (config.securityLevel !== 'loose') {
13449 return;
13450 }
13451
13452 if (typeof functionName === 'undefined') {
13453 return;
13454 }
13455
13456 if (typeof classes[id] !== 'undefined') {
13457 var argList = [];
13458
13459 if (typeof functionArgs === 'string') {
13460 /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
13461 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
13462
13463 for (var i = 0; i < argList.length; i++) {
13464 var item = argList[i].trim();
13465 /* Removes all double quotes at the start and end of an argument */
13466
13467 /* This preserves all starting and ending whitespace inside */
13468
13469 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
13470 item = item.substr(1, item.length - 2);
13471 }
13472
13473 argList[i] = item;
13474 }
13475 }
13476 /* if no arguments passed into callback, default to passing in id */
13477
13478
13479 if (argList.length === 0) {
13480 argList.push(elemId);
13481 }
13482
13483 funs.push(function () {
13484 var elem = document.querySelector("[id=\"".concat(elemId, "\"]"));
13485
13486 if (elem !== null) {
13487 elem.addEventListener('click', function () {
13488 _utils__WEBPACK_IMPORTED_MODULE_5__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_5__["default"], [functionName].concat(_toConsumableArray(argList)));
13489 }, false);
13490 }
13491 });
13492 }
13493};
13494
13495var bindFunctions = function bindFunctions(element) {
13496 funs.forEach(function (fun) {
13497 fun(element);
13498 });
13499};
13500var lineType = {
13501 LINE: 0,
13502 DOTTED_LINE: 1
13503};
13504var relationType = {
13505 AGGREGATION: 0,
13506 EXTENSION: 1,
13507 COMPOSITION: 2,
13508 DEPENDENCY: 3
13509};
13510
13511var setupToolTips = function setupToolTips(element) {
13512 var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
13513
13514 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
13515 tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
13516 }
13517
13518 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
13519 var nodes = svg.selectAll('g.node');
13520 nodes.on('mouseover', function () {
13521 var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
13522 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
13523
13524 if (title === null) {
13525 return;
13526 }
13527
13528 var rect = this.getBoundingClientRect();
13529 tooltipElem.transition().duration(200).style('opacity', '.9');
13530 tooltipElem.html(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
13531 el.classed('hover', true);
13532 }).on('mouseout', function () {
13533 tooltipElem.transition().duration(500).style('opacity', 0);
13534 var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
13535 el.classed('hover', false);
13536 });
13537};
13538
13539funs.push(setupToolTips);
13540var direction = 'TB';
13541
13542var getDirection = function getDirection() {
13543 return direction;
13544};
13545
13546var setDirection = function setDirection(dir) {
13547 direction = dir;
13548};
13549
13550/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
13551 parseDirective: parseDirective,
13552 getConfig: function getConfig() {
13553 return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().class;
13554 },
13555 addClass: addClass,
13556 bindFunctions: bindFunctions,
13557 clear: clear,
13558 getClass: getClass,
13559 getClasses: getClasses,
13560 addAnnotation: addAnnotation,
13561 getRelations: getRelations,
13562 addRelation: addRelation,
13563 getDirection: getDirection,
13564 setDirection: setDirection,
13565 addMember: addMember,
13566 addMembers: addMembers,
13567 cleanupLabel: cleanupLabel,
13568 lineType: lineType,
13569 relationType: relationType,
13570 setClickEvent: setClickEvent,
13571 setCssClass: setCssClass,
13572 setLink: setLink,
13573 setTooltip: setTooltip,
13574 lookUpDomId: lookUpDomId
13575});
13576
13577/***/ }),
13578
13579/***/ "./src/diagrams/class/classRenderer-v2.js":
13580/*!************************************************!*\
13581 !*** ./src/diagrams/class/classRenderer-v2.js ***!
13582 \************************************************/
13583/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
13584
13585"use strict";
13586__webpack_require__.r(__webpack_exports__);
13587/* harmony export */ __webpack_require__.d(__webpack_exports__, {
13588/* harmony export */ "addClasses": () => (/* binding */ addClasses),
13589/* harmony export */ "addRelations": () => (/* binding */ addRelations),
13590/* harmony export */ "setConf": () => (/* binding */ setConf),
13591/* harmony export */ "drawOld": () => (/* binding */ drawOld),
13592/* harmony export */ "draw": () => (/* binding */ draw),
13593/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
13594/* harmony export */ });
13595/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
13596/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
13597/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
13598/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
13599/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
13600/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
13601/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
13602/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
13603/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
13604/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__);
13605/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
13606/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
13607/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
13608/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
13609/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
13610
13611
13612
13613
13614
13615
13616
13617
13618 // import addHtmlLabel from 'dagre-d3/lib/label/add-html-label.js';
13619
13620
13621
13622
13623_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
13624var idCache = {};
13625var padding = 20;
13626var conf = {
13627 dividerMargin: 10,
13628 padding: 5,
13629 textHeight: 10
13630};
13631/**
13632 * Function that adds the vertices found during parsing to the graph to be rendered.
13633 * @param {Object<string, { cssClasses: Array<string>; text: string; id: string; type: string; domId: string; }>} classes Object containing the vertices.
13634 * @param {SVGGElement} g The graph that is to be drawn.
13635 */
13636
13637var addClasses = function addClasses(classes, g) {
13638 // const svg = select(`[id="${svgId}"]`);
13639 var keys = Object.keys(classes);
13640 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('keys:', keys);
13641 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(classes); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
13642
13643 keys.forEach(function (id) {
13644 var vertex = classes[id];
13645 /**
13646 * Variable for storing the classes for the vertex
13647 * @type {string}
13648 */
13649
13650 var cssClassStr = '';
13651
13652 if (vertex.cssClasses.length > 0) {
13653 cssClassStr = cssClassStr + ' ' + vertex.cssClasses.join(' ');
13654 } // if (vertex.classes.length > 0) {
13655 // classStr = vertex.classes.join(' ');
13656 // }
13657
13658
13659 var styles = {
13660 labelStyle: ''
13661 }; //getStylesFromArray(vertex.styles);
13662 // Use vertex id as text in the box if no text is provided by the graph definition
13663
13664 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
13665 // let vertexNode;
13666 // if (evaluate(getConfig().flowchart.htmlLabels)) {
13667 // const node = {
13668 // label: vertexText.replace(
13669 // /fa[lrsb]?:fa-[\w-]+/g,
13670 // s => `<i class='${s.replace(':', ' ')}'></i>`
13671 // )
13672 // };
13673 // vertexNode = addHtmlLabel(svg, node).node();
13674 // vertexNode.parentNode.removeChild(vertexNode);
13675 // } else {
13676 // const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
13677 // svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
13678 // const rows = vertexText.split(common.lineBreakRegex);
13679 // for (let j = 0; j < rows.length; j++) {
13680 // const tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
13681 // tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
13682 // tspan.setAttribute('dy', '1em');
13683 // tspan.setAttribute('x', '1');
13684 // tspan.textContent = rows[j];
13685 // svgLabel.appendChild(tspan);
13686 // }
13687 // vertexNode = svgLabel;
13688 // }
13689
13690 var radious = 0;
13691 var _shape = ''; // Set the shape based parameters
13692
13693 switch (vertex.type) {
13694 case 'class':
13695 _shape = 'class_box';
13696 break;
13697
13698 default:
13699 _shape = 'class_box';
13700 } // Add the node
13701
13702
13703 g.setNode(vertex.id, {
13704 labelStyle: styles.labelStyle,
13705 shape: _shape,
13706 labelText: vertexText,
13707 classData: vertex,
13708 rx: radious,
13709 ry: radious,
13710 class: cssClassStr,
13711 style: styles.style,
13712 id: vertex.id,
13713 domId: vertex.domId,
13714 haveCallback: vertex.haveCallback,
13715 link: vertex.link,
13716 width: vertex.type === 'group' ? 500 : undefined,
13717 type: vertex.type,
13718 padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding
13719 });
13720 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('setNode', {
13721 labelStyle: styles.labelStyle,
13722 shape: _shape,
13723 labelText: vertexText,
13724 rx: radious,
13725 ry: radious,
13726 class: cssClassStr,
13727 style: styles.style,
13728 id: vertex.id,
13729 width: vertex.type === 'group' ? 500 : undefined,
13730 type: vertex.type,
13731 padding: (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.padding
13732 });
13733 });
13734};
13735/**
13736 * Add edges to graph based on parsed graph defninition
13737 * @param {Object} edges The edges to add to the graph
13738 * @param {Object} g The graph object
13739 */
13740
13741var addRelations = function addRelations(relations, g) {
13742 var cnt = 0;
13743 var defaultStyle;
13744 var defaultLabelStyle; // if (typeof relations.defaultStyle !== 'undefined') {
13745 // const defaultStyles = getStylesFromArray(relations.defaultStyle);
13746 // defaultStyle = defaultStyles.style;
13747 // defaultLabelStyle = defaultStyles.labelStyle;
13748 // }
13749
13750 relations.forEach(function (edge) {
13751 cnt++;
13752 var edgeData = {}; //Set relationship style and line type
13753
13754 edgeData.classes = 'relation';
13755 edgeData.pattern = edge.relation.lineType == 1 ? 'dashed' : 'solid';
13756 edgeData.id = 'id' + cnt; // Set link type for rendering
13757
13758 if (edge.type === 'arrow_open') {
13759 edgeData.arrowhead = 'none';
13760 } else {
13761 edgeData.arrowhead = 'normal';
13762 }
13763
13764 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(edgeData, edge); //Set edge extra labels
13765 //edgeData.startLabelLeft = edge.relationTitle1;
13766
13767 edgeData.startLabelRight = edge.relationTitle1 === 'none' ? '' : edge.relationTitle1;
13768 edgeData.endLabelLeft = edge.relationTitle2 === 'none' ? '' : edge.relationTitle2; //edgeData.endLabelRight = edge.relationTitle2;
13769 //Set relation arrow types
13770
13771 edgeData.arrowTypeStart = getArrowMarker(edge.relation.type1);
13772 edgeData.arrowTypeEnd = getArrowMarker(edge.relation.type2);
13773 var style = '';
13774 var labelStyle = '';
13775
13776 if (typeof edge.style !== 'undefined') {
13777 var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.getStylesFromArray)(edge.style);
13778 style = styles.style;
13779 labelStyle = styles.labelStyle;
13780 } else {
13781 style = 'fill:none';
13782
13783 if (typeof defaultStyle !== 'undefined') {
13784 style = defaultStyle;
13785 }
13786
13787 if (typeof defaultLabelStyle !== 'undefined') {
13788 labelStyle = defaultLabelStyle;
13789 }
13790 }
13791
13792 edgeData.style = style;
13793 edgeData.labelStyle = labelStyle;
13794
13795 if (typeof edge.interpolate !== 'undefined') {
13796 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
13797 } else if (typeof relations.defaultInterpolate !== 'undefined') {
13798 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(relations.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
13799 } else {
13800 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_7__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_0__.curveLinear);
13801 }
13802
13803 edge.text = edge.title;
13804
13805 if (typeof edge.text === 'undefined') {
13806 if (typeof edge.style !== 'undefined') {
13807 edgeData.arrowheadStyle = 'fill: #333';
13808 }
13809 } else {
13810 edgeData.arrowheadStyle = 'fill: #333';
13811 edgeData.labelpos = 'c';
13812
13813 if ((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels) {
13814 // eslint-disable-line
13815 edgeData.labelType = 'html';
13816 edgeData.label = '<span class="edgeLabel">' + edge.text + '</span>';
13817 } else {
13818 edgeData.labelType = 'text';
13819 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_8__["default"].lineBreakRegex, '\n');
13820
13821 if (typeof edge.style === 'undefined') {
13822 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
13823 }
13824
13825 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
13826 }
13827 } // Add the edge to the graph
13828
13829
13830 g.setEdge(edge.id1, edge.id2, edgeData, cnt);
13831 });
13832};
13833/**
13834 * Gets the ID with the same label as in the cache
13835 * @param {string} label The label to look for
13836 * @returns {string} The resulting ID
13837 */
13838
13839var getGraphId = function getGraphId(label) {
13840 var foundEntry = Object.entries(idCache).find(function (entry) {
13841 return entry[1].label === label;
13842 });
13843
13844 if (foundEntry) {
13845 return foundEntry[0];
13846 }
13847};
13848/**
13849 * Merges the value of `conf` with the passed `cnf`
13850 * @param {Object} cnf Config to merge
13851 */
13852
13853
13854var setConf = function setConf(cnf) {
13855 var keys = Object.keys(cnf);
13856 keys.forEach(function (key) {
13857 conf[key] = cnf[key];
13858 });
13859};
13860/**
13861 * Draws a flowchart in the tag with id: id based on the graph definition in text.
13862 * @param {string} text
13863 * @param {string} id
13864 */
13865
13866var drawOld = function drawOld(text, id) {
13867 idCache = {};
13868 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
13869 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
13870 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
13871
13872 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']")); // insertMarkers(diagram);
13873 // Layout graph, Create a new directed graph
13874
13875 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
13876 multigraph: true
13877 }); // Set an object for the graph label
13878
13879 g.setGraph({
13880 isMultiGraph: true
13881 }); // Default to assigning a new object as a label for each new edge.
13882
13883 g.setDefaultEdgeLabel(function () {
13884 return {};
13885 });
13886 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
13887 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('classes:');
13888 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(classes);
13889 var keys = Object.keys(classes);
13890
13891 for (var i = 0; i < keys.length; i++) {
13892 var classDef = classes[keys[i]];
13893 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_9__["default"].drawClass(diagram, classDef, conf);
13894 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
13895 // metadata about the node. In this case we're going to add labels to each of
13896 // our nodes.
13897
13898 g.setNode(node.id, node);
13899 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Org height: ' + node.height);
13900 }
13901
13902 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
13903 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('relations:', relations);
13904 relations.forEach(function (relation) {
13905 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
13906 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
13907 relation: relation
13908 }, relation.title || 'DEFAULT');
13909 });
13910 dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
13911 g.nodes().forEach(function (v) {
13912 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
13913 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
13914 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + (0,_classDb__WEBPACK_IMPORTED_MODULE_4__.lookUpDomId)(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
13915 }
13916 });
13917 g.edges().forEach(function (e) {
13918 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
13919 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
13920 _svgDraw__WEBPACK_IMPORTED_MODULE_9__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
13921 }
13922 });
13923 var svgBounds = diagram.node().getBBox();
13924 var width = svgBounds.width + padding * 2;
13925 var height = svgBounds.height + padding * 2;
13926 (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
13927
13928 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
13929 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("viewBox ".concat(vBox));
13930 diagram.attr('viewBox', vBox);
13931};
13932var draw = function draw(text, id) {
13933 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Drawing class');
13934 _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear(); // const parser = classDb.parser;
13935 // parser.yy = classDb;
13936 // Parse the graph definition
13937 // try {
13938
13939 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text); // } catch (err) {
13940 // log.debug('Parsing failed');
13941 // }
13942 // Fetch the default direction, use TD if none was found
13943 //let dir = 'TD';
13944
13945 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart;
13946 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('config:', conf);
13947 var nodeSpacing = conf.nodeSpacing || 50;
13948 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
13949
13950 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
13951 multigraph: true,
13952 compound: true
13953 }).setGraph({
13954 rankdir: _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getDirection(),
13955 nodesep: nodeSpacing,
13956 ranksep: rankSpacing,
13957 marginx: 8,
13958 marginy: 8
13959 }).setDefaultEdgeLabel(function () {
13960 return {};
13961 }); // let subG;
13962 // const subGraphs = flowDb.getSubGraphs();
13963 // log.info('Subgraphs - ', subGraphs);
13964 // for (let i = subGraphs.length - 1; i >= 0; i--) {
13965 // subG = subGraphs[i];
13966 // log.info('Subgraph - ', subG);
13967 // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
13968 // }
13969 // Fetch the verices/nodes and edges/links from the parsed graph definition
13970
13971 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
13972 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
13973 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info(relations); // let i = 0;
13974 // for (i = subGraphs.length - 1; i >= 0; i--) {
13975 // subG = subGraphs[i];
13976 // selectAll('cluster').append('text');
13977 // for (let j = 0; j < subG.nodes.length; j++) {
13978 // g.setParent(subG.nodes[j], subG.id);
13979 // }
13980 // }
13981
13982 addClasses(classes, g, id);
13983 addRelations(relations, g); // Add custom shapes
13984 // flowChartShapes.addToRenderV2(addShape);
13985 // Set up an SVG group so that we can translate the final graph.
13986
13987 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]"));
13988 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
13989
13990 var element = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id + ' g');
13991 (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_10__.render)(element, g, ['aggregation', 'extension', 'composition', 'dependency'], 'classDiagram', id); // element.selectAll('g.node').attr('title', function() {
13992 // return flowDb.getTooltip(this.id);
13993 // });
13994
13995 var padding = 8;
13996 var svgBounds = svg.node().getBBox();
13997 var width = svgBounds.width + padding * 2;
13998 var height = svgBounds.height + padding * 2;
13999 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
14000 (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
14001 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
14002 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
14003 // flowDb.indexNodes('subGraph' + i);
14004 // Add label rects for non html labels
14005
14006 if (!conf.htmlLabels) {
14007 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
14008
14009 for (var k = 0; k < labels.length; k++) {
14010 var label = labels[k]; // Get dimensions of label
14011
14012 var dim = label.getBBox();
14013 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
14014 rect.setAttribute('rx', 0);
14015 rect.setAttribute('ry', 0);
14016 rect.setAttribute('width', dim.width);
14017 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
14018
14019 label.insertBefore(rect, label.firstChild);
14020 }
14021 } // If node has a link, wrap it in an anchor SVG object.
14022 // const keys = Object.keys(classes);
14023 // keys.forEach(function(key) {
14024 // const vertex = classes[key];
14025 // if (vertex.link) {
14026 // const node = select('#' + id + ' [id="' + key + '"]');
14027 // if (node) {
14028 // const link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
14029 // link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
14030 // link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
14031 // link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
14032 // const linkNode = node.insert(function() {
14033 // return link;
14034 // }, ':first-child');
14035 // const shape = node.select('.label-container');
14036 // if (shape) {
14037 // linkNode.append(function() {
14038 // return shape.node();
14039 // });
14040 // }
14041 // const label = node.select('.label');
14042 // if (label) {
14043 // linkNode.append(function() {
14044 // return label.node();
14045 // });
14046 // }
14047 // }
14048 // }
14049 // });
14050
14051};
14052/**
14053 * Gets the arrow marker for a type index
14054 * @param {number} type The type to look for
14055 * @returns {"aggregation" | "extension" | "composition" | "dependency"} The arrow marker
14056 */
14057
14058function getArrowMarker(type) {
14059 var marker;
14060
14061 switch (type) {
14062 case 0:
14063 marker = 'aggregation';
14064 break;
14065
14066 case 1:
14067 marker = 'extension';
14068 break;
14069
14070 case 2:
14071 marker = 'composition';
14072 break;
14073
14074 case 3:
14075 marker = 'dependency';
14076 break;
14077
14078 default:
14079 marker = 'none';
14080 }
14081
14082 return marker;
14083}
14084
14085/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
14086 setConf: setConf,
14087 draw: draw
14088});
14089
14090/***/ }),
14091
14092/***/ "./src/diagrams/class/classRenderer.js":
14093/*!*********************************************!*\
14094 !*** ./src/diagrams/class/classRenderer.js ***!
14095 \*********************************************/
14096/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14097
14098"use strict";
14099__webpack_require__.r(__webpack_exports__);
14100/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14101/* harmony export */ "setConf": () => (/* binding */ setConf),
14102/* harmony export */ "draw": () => (/* binding */ draw),
14103/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14104/* harmony export */ });
14105/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
14106/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
14107/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
14108/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
14109/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
14110/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
14111/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14112/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
14113/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
14114/* harmony import */ var _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__);
14115/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/class/svgDraw.js");
14116/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
14117
14118
14119
14120
14121
14122
14123
14124
14125_parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"];
14126var idCache = {};
14127var padding = 20;
14128var conf = {
14129 dividerMargin: 10,
14130 padding: 5,
14131 textHeight: 10
14132};
14133/**
14134 * Gets the ID with the same label as in the cache
14135 * @param {string} label The label to look for
14136 * @returns {string} The resulting ID
14137 */
14138
14139var getGraphId = function getGraphId(label) {
14140 var foundEntry = Object.entries(idCache).find(function (entry) {
14141 return entry[1].label === label;
14142 });
14143
14144 if (foundEntry) {
14145 return foundEntry[0];
14146 }
14147};
14148/**
14149 * Setup arrow head and define the marker. The result is appended to the svg.
14150 * @param {SVGSVGElement} elem The SVG element to append to
14151 */
14152
14153
14154var insertMarkers = function insertMarkers(elem) {
14155 elem.append('defs').append('marker').attr('id', 'extensionStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 1,7 L18,13 V 1 Z');
14156 elem.append('defs').append('marker').attr('id', 'extensionEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 1,1 V 13 L18,7 Z'); // this is actual shape for arrowhead
14157
14158 elem.append('defs').append('marker').attr('id', 'compositionStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
14159 elem.append('defs').append('marker').attr('id', 'compositionEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
14160 elem.append('defs').append('marker').attr('id', 'aggregationStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
14161 elem.append('defs').append('marker').attr('id', 'aggregationEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L1,7 L9,1 Z');
14162 elem.append('defs').append('marker').attr('id', 'dependencyStart').attr('class', 'extension').attr('refX', 0).attr('refY', 7).attr('markerWidth', 190).attr('markerHeight', 240).attr('orient', 'auto').append('path').attr('d', 'M 5,7 L9,13 L1,7 L9,1 Z');
14163 elem.append('defs').append('marker').attr('id', 'dependencyEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
14164};
14165/**
14166 * Merges the value of `conf` with the passed `cnf`
14167 * @param {Object} cnf Config to merge
14168 */
14169
14170
14171var setConf = function setConf(cnf) {
14172 var keys = Object.keys(cnf);
14173 keys.forEach(function (key) {
14174 conf[key] = cnf[key];
14175 });
14176};
14177/**
14178 * Draws a flowchart in the tag with id: id based on the graph definition in text.
14179 * @param {string} text
14180 * @param {string} id
14181 */
14182
14183var draw = function draw(text, id) {
14184 idCache = {};
14185 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
14186 _parser_classDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
14187 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
14188
14189 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
14190 diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
14191 insertMarkers(diagram); // Layout graph, Create a new directed graph
14192
14193 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
14194 multigraph: true
14195 }); // Set an object for the graph label
14196
14197 g.setGraph({
14198 isMultiGraph: true
14199 }); // Default to assigning a new object as a label for each new edge.
14200
14201 g.setDefaultEdgeLabel(function () {
14202 return {};
14203 });
14204 var classes = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getClasses();
14205 var keys = Object.keys(classes);
14206
14207 for (var i = 0; i < keys.length; i++) {
14208 var classDef = classes[keys[i]];
14209 var node = _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawClass(diagram, classDef, conf);
14210 idCache[node.id] = node; // Add nodes to the graph. The first argument is the node id. The second is
14211 // metadata about the node. In this case we're going to add labels to each of
14212 // our nodes.
14213
14214 g.setNode(node.id, node);
14215 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Org height: ' + node.height);
14216 }
14217
14218 var relations = _classDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
14219 relations.forEach(function (relation) {
14220 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('tjoho' + getGraphId(relation.id1) + getGraphId(relation.id2) + JSON.stringify(relation));
14221 g.setEdge(getGraphId(relation.id1), getGraphId(relation.id2), {
14222 relation: relation
14223 }, relation.title || 'DEFAULT');
14224 });
14225 dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
14226 g.nodes().forEach(function (v) {
14227 if (typeof v !== 'undefined' && typeof g.node(v) !== 'undefined') {
14228 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Node ' + v + ': ' + JSON.stringify(g.node(v)));
14229 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + (0,_classDb__WEBPACK_IMPORTED_MODULE_4__.lookUpDomId)(v)).attr('transform', 'translate(' + (g.node(v).x - g.node(v).width / 2) + ',' + (g.node(v).y - g.node(v).height / 2) + ' )');
14230 }
14231 });
14232 g.edges().forEach(function (e) {
14233 if (typeof e !== 'undefined' && typeof g.edge(e) !== 'undefined') {
14234 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(g.edge(e)));
14235 _svgDraw__WEBPACK_IMPORTED_MODULE_6__["default"].drawEdge(diagram, g.edge(e), g.edge(e).relation, conf);
14236 }
14237 });
14238 var svgBounds = diagram.node().getBBox();
14239 var width = svgBounds.width + padding * 2;
14240 var height = svgBounds.height + padding * 2;
14241 (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
14242
14243 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
14244 _logger__WEBPACK_IMPORTED_MODULE_5__.log.debug("viewBox ".concat(vBox));
14245 diagram.attr('viewBox', vBox);
14246};
14247/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
14248 setConf: setConf,
14249 draw: draw
14250});
14251
14252/***/ }),
14253
14254/***/ "./src/diagrams/class/styles.js":
14255/*!**************************************!*\
14256 !*** ./src/diagrams/class/styles.js ***!
14257 \**************************************/
14258/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14259
14260"use strict";
14261__webpack_require__.r(__webpack_exports__);
14262/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14263/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14264/* harmony export */ });
14265var getStyles = function getStyles(options) {
14266 return "g.classGroup text {\n fill: ".concat(options.nodeBorder, ";\n fill: ").concat(options.classText, ";\n stroke: none;\n font-family: ").concat(options.fontFamily, ";\n font-size: 10px;\n\n .title {\n font-weight: bolder;\n }\n\n}\n\n.nodeLabel, .edgeLabel {\n color: ").concat(options.classText, ";\n}\n.edgeLabel .label rect {\n fill: ").concat(options.mainBkg, ";\n}\n.label text {\n fill: ").concat(options.classText, ";\n}\n.edgeLabel .label span {\n background: ").concat(options.mainBkg, ";\n}\n\n.classTitle {\n font-weight: bolder;\n}\n.node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n\n.divider {\n stroke: ").concat(options.nodeBorder, ";\n stroke: 1;\n}\n\ng.clickable {\n cursor: pointer;\n}\n\ng.classGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.classGroup line {\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1;\n}\n\n.classLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.classLabel .label {\n fill: ").concat(options.nodeBorder, ";\n font-size: 10px;\n}\n\n.relation {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.dashed-line{\n stroke-dasharray: 3;\n}\n\n#compositionStart, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#compositionEnd, .composition {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#dependencyStart, .dependency {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionStart, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#extensionEnd, .extension {\n fill: ").concat(options.lineColor, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationStart, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n#aggregationEnd, .aggregation {\n fill: ").concat(options.mainBkg, " !important;\n stroke: ").concat(options.lineColor, " !important;\n stroke-width: 1;\n}\n\n.edgeTerminals {\n font-size: 11px;\n}\n\n");
14267};
14268
14269/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
14270
14271/***/ }),
14272
14273/***/ "./src/diagrams/class/svgDraw.js":
14274/*!***************************************!*\
14275 !*** ./src/diagrams/class/svgDraw.js ***!
14276 \***************************************/
14277/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14278
14279"use strict";
14280__webpack_require__.r(__webpack_exports__);
14281/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14282/* harmony export */ "drawEdge": () => (/* binding */ drawEdge),
14283/* harmony export */ "drawClass": () => (/* binding */ drawClass),
14284/* harmony export */ "parseMember": () => (/* binding */ parseMember),
14285/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14286/* harmony export */ });
14287/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
14288/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
14289/* harmony import */ var _classDb__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./classDb */ "./src/diagrams/class/classDb.js");
14290/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
14291/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14292
14293
14294
14295
14296var edgeCount = 0;
14297var drawEdge = function drawEdge(elem, path, relation, conf) {
14298 var getRelationType = function getRelationType(type) {
14299 switch (type) {
14300 case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.AGGREGATION:
14301 return 'aggregation';
14302
14303 case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.EXTENSION:
14304 return 'extension';
14305
14306 case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.COMPOSITION:
14307 return 'composition';
14308
14309 case _classDb__WEBPACK_IMPORTED_MODULE_1__.relationType.DEPENDENCY:
14310 return 'dependency';
14311 }
14312 };
14313
14314 path.points = path.points.filter(function (p) {
14315 return !Number.isNaN(p.y);
14316 }); // The data for our line
14317
14318 var lineData = path.points; // This is the accessor function we talked about above
14319
14320 var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
14321 return d.x;
14322 }).y(function (d) {
14323 return d.y;
14324 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
14325 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'relation');
14326 var url = '';
14327
14328 if (conf.arrowMarkerAbsolute) {
14329 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
14330 url = url.replace(/\(/g, '\\(');
14331 url = url.replace(/\)/g, '\\)');
14332 }
14333
14334 if (relation.relation.lineType == 1) {
14335 svgPath.attr('class', 'relation dashed-line');
14336 }
14337
14338 if (relation.relation.type1 !== 'none') {
14339 svgPath.attr('marker-start', 'url(' + url + '#' + getRelationType(relation.relation.type1) + 'Start' + ')');
14340 }
14341
14342 if (relation.relation.type2 !== 'none') {
14343 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(relation.relation.type2) + 'End' + ')');
14344 }
14345
14346 var x, y;
14347 var l = path.points.length; // Calculate Label position
14348
14349 var labelPosition = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcLabelPosition(path.points);
14350 x = labelPosition.x;
14351 y = labelPosition.y;
14352 var p1_card_x, p1_card_y;
14353 var p2_card_x, p2_card_y;
14354
14355 if (l % 2 !== 0 && l > 1) {
14356 var cardinality_1_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type1 !== 'none', path.points, path.points[0]);
14357 var cardinality_2_point = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].calcCardinalityPosition(relation.relation.type2 !== 'none', path.points, path.points[l - 1]);
14358 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_1_point ' + JSON.stringify(cardinality_1_point));
14359 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('cardinality_2_point ' + JSON.stringify(cardinality_2_point));
14360 p1_card_x = cardinality_1_point.x;
14361 p1_card_y = cardinality_1_point.y;
14362 p2_card_x = cardinality_2_point.x;
14363 p2_card_y = cardinality_2_point.y;
14364 }
14365
14366 if (typeof relation.title !== 'undefined') {
14367 var g = elem.append('g').attr('class', 'classLabel');
14368 var label = g.append('text').attr('class', 'label').attr('x', x).attr('y', y).attr('fill', 'red').attr('text-anchor', 'middle').text(relation.title);
14369 window.label = label;
14370 var bounds = label.node().getBBox();
14371 g.insert('rect', ':first-child').attr('class', 'box').attr('x', bounds.x - conf.padding / 2).attr('y', bounds.y - conf.padding / 2).attr('width', bounds.width + conf.padding).attr('height', bounds.height + conf.padding);
14372 }
14373
14374 _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering relation ' + JSON.stringify(relation));
14375
14376 if (typeof relation.relationTitle1 !== 'undefined' && relation.relationTitle1 !== 'none') {
14377 var _g = elem.append('g').attr('class', 'cardinality');
14378
14379 _g.append('text').attr('class', 'type1').attr('x', p1_card_x).attr('y', p1_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle1);
14380 }
14381
14382 if (typeof relation.relationTitle2 !== 'undefined' && relation.relationTitle2 !== 'none') {
14383 var _g2 = elem.append('g').attr('class', 'cardinality');
14384
14385 _g2.append('text').attr('class', 'type2').attr('x', p2_card_x).attr('y', p2_card_y).attr('fill', 'black').attr('font-size', '6').text(relation.relationTitle2);
14386 }
14387
14388 edgeCount++;
14389};
14390/**
14391 * Renders a class diagram
14392 * @param {SVGSVGElement} elem The element to draw it into
14393 * @todo Add more information in the JSDOC here
14394 */
14395
14396var drawClass = function drawClass(elem, classDef, conf) {
14397 _logger__WEBPACK_IMPORTED_MODULE_3__.log.info('Rendering class ' + classDef);
14398 var id = classDef.id;
14399 var classInfo = {
14400 id: id,
14401 label: classDef.id,
14402 width: 0,
14403 height: 0
14404 }; // add class group
14405
14406 var g = elem.append('g').attr('id', (0,_classDb__WEBPACK_IMPORTED_MODULE_1__.lookUpDomId)(id)).attr('class', 'classGroup'); // add title
14407
14408 var title;
14409
14410 if (classDef.link) {
14411 title = g.append('svg:a').attr('xlink:href', classDef.link).attr('target', classDef.linkTarget).append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
14412 } else {
14413 title = g.append('text').attr('y', conf.textHeight + conf.padding).attr('x', 0);
14414 } // add annotations
14415
14416
14417 var isFirst = true;
14418 classDef.annotations.forEach(function (member) {
14419 var titleText2 = title.append('tspan').text('«' + member + '»');
14420 if (!isFirst) titleText2.attr('dy', conf.textHeight);
14421 isFirst = false;
14422 });
14423 var classTitleString = classDef.id;
14424
14425 if (classDef.type !== undefined && classDef.type !== '') {
14426 classTitleString += '<' + classDef.type + '>';
14427 }
14428
14429 var classTitle = title.append('tspan').text(classTitleString).attr('class', 'title'); // If class has annotations the title needs to have an offset of the text height
14430
14431 if (!isFirst) classTitle.attr('dy', conf.textHeight);
14432 var titleHeight = title.node().getBBox().height;
14433 var membersLine = g.append('line') // text label for the x axis
14434 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin / 2).attr('y2', conf.padding + titleHeight + conf.dividerMargin / 2);
14435 var members = g.append('text') // text label for the x axis
14436 .attr('x', conf.padding).attr('y', titleHeight + conf.dividerMargin + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
14437 isFirst = true;
14438 classDef.members.forEach(function (member) {
14439 addTspan(members, member, isFirst, conf);
14440 isFirst = false;
14441 });
14442 var membersBox = members.node().getBBox();
14443 var methodsLine = g.append('line') // text label for the x axis
14444 .attr('x1', 0).attr('y1', conf.padding + titleHeight + conf.dividerMargin + membersBox.height).attr('y2', conf.padding + titleHeight + conf.dividerMargin + membersBox.height);
14445 var methods = g.append('text') // text label for the x axis
14446 .attr('x', conf.padding).attr('y', titleHeight + 2 * conf.dividerMargin + membersBox.height + conf.textHeight).attr('fill', 'white').attr('class', 'classText');
14447 isFirst = true;
14448 classDef.methods.forEach(function (method) {
14449 addTspan(methods, method, isFirst, conf);
14450 isFirst = false;
14451 });
14452 var classBox = g.node().getBBox();
14453 var cssClassStr = ' ';
14454
14455 if (classDef.cssClasses.length > 0) {
14456 cssClassStr = cssClassStr + classDef.cssClasses.join(' ');
14457 }
14458
14459 var rect = g.insert('rect', ':first-child').attr('x', 0).attr('y', 0).attr('width', classBox.width + 2 * conf.padding).attr('height', classBox.height + conf.padding + 0.5 * conf.dividerMargin).attr('class', cssClassStr);
14460 var rectWidth = rect.node().getBBox().width; // Center title
14461 // We subtract the width of each text element from the class box width and divide it by 2
14462
14463 title.node().childNodes.forEach(function (x) {
14464 x.setAttribute('x', (rectWidth - x.getBBox().width) / 2);
14465 });
14466
14467 if (classDef.tooltip) {
14468 title.insert('title').text(classDef.tooltip);
14469 }
14470
14471 membersLine.attr('x2', rectWidth);
14472 methodsLine.attr('x2', rectWidth);
14473 classInfo.width = rectWidth;
14474 classInfo.height = classBox.height + conf.padding + 0.5 * conf.dividerMargin;
14475 return classInfo;
14476};
14477var parseMember = function parseMember(text) {
14478 var fieldRegEx = /^(\+|-|~|#)?(\w+)(~\w+~|\[\])?\s+(\w+) *(\*|\$)?$/;
14479 var methodRegEx = /^([+|\-|~|#])?(\w+) *\( *(.*)\) *(\*|\$)? *(\w*[~|[\]]*\s*\w*~?)$/;
14480 var fieldMatch = text.match(fieldRegEx);
14481 var methodMatch = text.match(methodRegEx);
14482
14483 if (fieldMatch && !methodMatch) {
14484 return buildFieldDisplay(fieldMatch);
14485 } else if (methodMatch) {
14486 return buildMethodDisplay(methodMatch);
14487 } else {
14488 return buildLegacyDisplay(text);
14489 }
14490};
14491
14492var buildFieldDisplay = function buildFieldDisplay(parsedText) {
14493 var cssStyle = '';
14494 var displayText = '';
14495
14496 try {
14497 var visibility = parsedText[1] ? parsedText[1].trim() : '';
14498 var fieldType = parsedText[2] ? parsedText[2].trim() : '';
14499 var genericType = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
14500 var fieldName = parsedText[4] ? parsedText[4].trim() : '';
14501 var classifier = parsedText[5] ? parsedText[5].trim() : '';
14502 displayText = visibility + fieldType + genericType + ' ' + fieldName;
14503 cssStyle = parseClassifier(classifier);
14504 } catch (err) {
14505 displayText = parsedText;
14506 }
14507
14508 return {
14509 displayText: displayText,
14510 cssStyle: cssStyle
14511 };
14512};
14513
14514var buildMethodDisplay = function buildMethodDisplay(parsedText) {
14515 var cssStyle = '';
14516 var displayText = '';
14517
14518 try {
14519 var visibility = parsedText[1] ? parsedText[1].trim() : '';
14520 var methodName = parsedText[2] ? parsedText[2].trim() : '';
14521 var parameters = parsedText[3] ? parseGenericTypes(parsedText[3].trim()) : '';
14522 var classifier = parsedText[4] ? parsedText[4].trim() : '';
14523 var returnType = parsedText[5] ? ' : ' + parseGenericTypes(parsedText[5]).trim() : '';
14524 displayText = visibility + methodName + '(' + parameters + ')' + returnType;
14525 cssStyle = parseClassifier(classifier);
14526 } catch (err) {
14527 displayText = parsedText;
14528 }
14529
14530 return {
14531 displayText: displayText,
14532 cssStyle: cssStyle
14533 };
14534};
14535
14536var buildLegacyDisplay = function buildLegacyDisplay(text) {
14537 // if for some reason we dont have any match, use old format to parse text
14538 var displayText = '';
14539 var cssStyle = '';
14540 var memberText = '';
14541 var returnType = '';
14542 var methodStart = text.indexOf('(');
14543 var methodEnd = text.indexOf(')');
14544
14545 if (methodStart > 1 && methodEnd > methodStart && methodEnd <= text.length) {
14546 var visibility = '';
14547 var methodName = '';
14548 var firstChar = text.substring(0, 1);
14549
14550 if (firstChar.match(/\w/)) {
14551 methodName = text.substring(0, methodStart).trim();
14552 } else {
14553 if (firstChar.match(/\+|-|~|#/)) {
14554 visibility = firstChar;
14555 }
14556
14557 methodName = text.substring(1, methodStart).trim();
14558 }
14559
14560 var parameters = text.substring(methodStart + 1, methodEnd);
14561 var classifier = text.substring(methodEnd + 1, 1);
14562 cssStyle = parseClassifier(classifier);
14563 displayText = visibility + methodName + '(' + parseGenericTypes(parameters.trim()) + ')';
14564
14565 if (methodEnd < memberText.length) {
14566 returnType = text.substring(methodEnd + 2).trim();
14567
14568 if (returnType !== '') {
14569 returnType = ' : ' + parseGenericTypes(returnType);
14570 }
14571 }
14572 } else {
14573 // finally - if all else fails, just send the text back as written (other than parsing for generic types)
14574 displayText = parseGenericTypes(text);
14575 }
14576
14577 return {
14578 displayText: displayText,
14579 cssStyle: cssStyle
14580 };
14581};
14582/**
14583 * Adds a <tspan> for a member in a diagram
14584 * @param {SVGElement} textEl The element to append to
14585 * @param {string} txt The member
14586 * @param {boolean} isFirst
14587 * @param {{ padding: string; textHeight: string; }} conf The configuration for the member
14588 */
14589
14590
14591var addTspan = function addTspan(textEl, txt, isFirst, conf) {
14592 var member = parseMember(txt);
14593 var tSpan = textEl.append('tspan').attr('x', conf.padding).text(member.displayText);
14594
14595 if (member.cssStyle !== '') {
14596 tSpan.attr('style', member.cssStyle);
14597 }
14598
14599 if (!isFirst) {
14600 tSpan.attr('dy', conf.textHeight);
14601 }
14602};
14603/**
14604 * Makes generics in typescript syntax
14605 * @example <caption>Array of array of strings in typescript syntax</caption>
14606 * // returns "Array<Array<string>>"
14607 * parseGenericTypes("Array~Array~string~~");
14608 * @param {string} text The text to convert
14609 * @returns {string} The converted string
14610 */
14611
14612
14613var parseGenericTypes = function parseGenericTypes(text) {
14614 var cleanedText = text;
14615
14616 if (text.indexOf('~') != -1) {
14617 cleanedText = cleanedText.replace('~', '<');
14618 cleanedText = cleanedText.replace('~', '>');
14619 return parseGenericTypes(cleanedText);
14620 } else {
14621 return cleanedText;
14622 }
14623};
14624/**
14625 * Gives the styles for a classifier
14626 * @param {"+" | "-" | "#" | "~" | "*" | "$"} classifier The classifier string
14627 * @returns {string} Styling for the classifier
14628 */
14629
14630
14631var parseClassifier = function parseClassifier(classifier) {
14632 switch (classifier) {
14633 case '*':
14634 return 'font-style:italic;';
14635
14636 case '$':
14637 return 'text-decoration:underline;';
14638
14639 default:
14640 return '';
14641 }
14642};
14643
14644/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
14645 drawClass: drawClass,
14646 drawEdge: drawEdge,
14647 parseMember: parseMember
14648});
14649
14650/***/ }),
14651
14652/***/ "./src/diagrams/common/common.js":
14653/*!***************************************!*\
14654 !*** ./src/diagrams/common/common.js ***!
14655 \***************************************/
14656/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14657
14658"use strict";
14659__webpack_require__.r(__webpack_exports__);
14660/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14661/* harmony export */ "getRows": () => (/* binding */ getRows),
14662/* harmony export */ "removeScript": () => (/* binding */ removeScript),
14663/* harmony export */ "sanitizeText": () => (/* binding */ sanitizeText),
14664/* harmony export */ "sanitizeTextOrArray": () => (/* binding */ sanitizeTextOrArray),
14665/* harmony export */ "lineBreakRegex": () => (/* binding */ lineBreakRegex),
14666/* harmony export */ "hasBreaks": () => (/* binding */ hasBreaks),
14667/* harmony export */ "splitBreaks": () => (/* binding */ splitBreaks),
14668/* harmony export */ "evaluate": () => (/* binding */ evaluate),
14669/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14670/* harmony export */ });
14671/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ "dompurify");
14672/* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__);
14673
14674/**
14675 * Gets the number of lines in a string
14676 * @param {string | undefined} s The string to check the lines for
14677 * @returns {number} The number of lines in that string
14678 */
14679
14680var getRows = function getRows(s) {
14681 if (!s) return 1;
14682 var str = breakToPlaceholder(s);
14683 str = str.replace(/\\n/g, '#br#');
14684 return str.split('#br#');
14685};
14686/**
14687 * Removes script tags from a text
14688 * @param {string} txt The text to sanitize
14689 * @returns {string} The safer text
14690 */
14691
14692var removeScript = function removeScript(txt) {
14693 var rs = '';
14694 var idx = 0;
14695
14696 while (idx >= 0) {
14697 idx = txt.indexOf('<script');
14698
14699 if (idx >= 0) {
14700 rs += txt.substr(0, idx);
14701 txt = txt.substr(idx + 1);
14702 idx = txt.indexOf('</script>');
14703
14704 if (idx >= 0) {
14705 idx += 9;
14706 txt = txt.substr(idx);
14707 }
14708 } else {
14709 rs += txt;
14710 idx = -1;
14711 break;
14712 }
14713 }
14714
14715 rs = rs.replace(/script>/gi, '#');
14716 rs = rs.replace(/script>/gi, '#');
14717 rs = rs.replace(/javascript:/gi, '#');
14718 rs = rs.replace(/onerror=/gi, 'onerror:');
14719 rs = rs.replace(/<iframe/gi, '');
14720 return rs;
14721};
14722
14723var sanitizeMore = function sanitizeMore(text, config) {
14724 var txt = text;
14725 var htmlLabels = true;
14726
14727 if (config.flowchart && (config.flowchart.htmlLabels === false || config.flowchart.htmlLabels === 'false')) {
14728 htmlLabels = false;
14729 }
14730
14731 if (htmlLabels) {
14732 var level = config.securityLevel;
14733
14734 if (level === 'antiscript') {
14735 txt = removeScript(txt);
14736 } else if (level !== 'loose') {
14737 // eslint-disable-line
14738 txt = breakToPlaceholder(txt);
14739 txt = txt.replace(/</g, '&lt;').replace(/>/g, '&gt;');
14740 txt = txt.replace(/=/g, '&equals;');
14741 txt = placeholderToBreak(txt);
14742 }
14743 }
14744
14745 return txt;
14746};
14747
14748var sanitizeText = function sanitizeText(text, config) {
14749 if (!text) return text;
14750 var txt = dompurify__WEBPACK_IMPORTED_MODULE_0___default().sanitize(sanitizeMore(text, config));
14751 return txt;
14752};
14753var sanitizeTextOrArray = function sanitizeTextOrArray(a, config) {
14754 if (typeof a === 'string') return sanitizeText(a, config);
14755
14756 var f = function f(x) {
14757 return sanitizeText(x, config);
14758 };
14759
14760 return a.flat().map(f);
14761};
14762var lineBreakRegex = /<br\s*\/?>/gi;
14763/**
14764 * Whether or not a text has any linebreaks
14765 * @param {string} text The text to test
14766 * @returns {boolean} Whether or not the text has breaks
14767 */
14768
14769var hasBreaks = function hasBreaks(text) {
14770 return lineBreakRegex.test(text);
14771};
14772/**
14773 * Splits on <br> tags
14774 * @param {string} text Text to split
14775 * @returns {Array<string>} List of lines as strings
14776 */
14777
14778var splitBreaks = function splitBreaks(text) {
14779 return text.split(lineBreakRegex);
14780};
14781/**
14782 * Converts placeholders to linebreaks in HTML
14783 * @param {string} s HTML with placeholders
14784 * @returns {string} HTML with breaks instead of placeholders
14785 */
14786
14787var placeholderToBreak = function placeholderToBreak(s) {
14788 return s.replace(/#br#/g, '<br/>');
14789};
14790/**
14791 * Opposite of `placeholderToBreak`, converts breaks to placeholders
14792 * @param {string} s HTML string
14793 * @returns {string} String with placeholders
14794 */
14795
14796
14797var breakToPlaceholder = function breakToPlaceholder(s) {
14798 return s.replace(lineBreakRegex, '#br#');
14799};
14800/**
14801 * Gets the current URL
14802 * @param {boolean} useAbsolute Whether to return the absolute URL or not
14803 * @returns {string} The current URL
14804 */
14805
14806
14807var getUrl = function getUrl(useAbsolute) {
14808 var url = '';
14809
14810 if (useAbsolute) {
14811 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
14812 url = url.replace(/\(/g, '\\(');
14813 url = url.replace(/\)/g, '\\)');
14814 }
14815
14816 return url;
14817};
14818/**
14819 * Converts a string/boolean into a boolean
14820 * @param {string | boolean} val String or boolean to convert
14821 * @returns {boolean} The result from the input
14822 */
14823
14824
14825var evaluate = function evaluate(val) {
14826 return val === 'false' || val === false ? false : true;
14827};
14828/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
14829 getRows: getRows,
14830 sanitizeText: sanitizeText,
14831 sanitizeTextOrArray: sanitizeTextOrArray,
14832 hasBreaks: hasBreaks,
14833 splitBreaks: splitBreaks,
14834 lineBreakRegex: lineBreakRegex,
14835 removeScript: removeScript,
14836 getUrl: getUrl,
14837 evaluate: evaluate
14838});
14839
14840/***/ }),
14841
14842/***/ "./src/diagrams/er/erDb.js":
14843/*!*********************************!*\
14844 !*** ./src/diagrams/er/erDb.js ***!
14845 \*********************************/
14846/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14847
14848"use strict";
14849__webpack_require__.r(__webpack_exports__);
14850/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14851/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
14852/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14853/* harmony export */ });
14854/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
14855/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
14856/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
14857/**
14858 *
14859 */
14860
14861
14862
14863var entities = {};
14864var relationships = [];
14865var title = '';
14866var Cardinality = {
14867 ZERO_OR_ONE: 'ZERO_OR_ONE',
14868 ZERO_OR_MORE: 'ZERO_OR_MORE',
14869 ONE_OR_MORE: 'ONE_OR_MORE',
14870 ONLY_ONE: 'ONLY_ONE'
14871};
14872var Identification = {
14873 NON_IDENTIFYING: 'NON_IDENTIFYING',
14874 IDENTIFYING: 'IDENTIFYING'
14875};
14876var parseDirective = function parseDirective(statement, context, type) {
14877 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
14878};
14879
14880var addEntity = function addEntity(name) {
14881 if (typeof entities[name] === 'undefined') {
14882 entities[name] = {
14883 attributes: []
14884 };
14885 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Added new entity :', name);
14886 }
14887
14888 return entities[name];
14889};
14890
14891var getEntities = function getEntities() {
14892 return entities;
14893};
14894
14895var addAttributes = function addAttributes(entityName, attribs) {
14896 var entity = addEntity(entityName); // May do nothing (if entity has already been added)
14897 // Process attribs in reverse order due to effect of recursive construction (last attribute is first)
14898
14899 var i;
14900
14901 for (i = attribs.length - 1; i >= 0; i--) {
14902 entity.attributes.push(attribs[i]);
14903 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added attribute ', attribs[i].attributeName);
14904 }
14905};
14906/**
14907 * Add a relationship
14908 * @param entA The first entity in the relationship
14909 * @param rolA The role played by the first entity in relation to the second
14910 * @param entB The second entity in the relationship
14911 * @param rSpec The details of the relationship between the two entities
14912 */
14913
14914
14915var addRelationship = function addRelationship(entA, rolA, entB, rSpec) {
14916 var rel = {
14917 entityA: entA,
14918 roleA: rolA,
14919 entityB: entB,
14920 relSpec: rSpec
14921 };
14922 relationships.push(rel);
14923 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added new relationship :', rel);
14924};
14925
14926var getRelationships = function getRelationships() {
14927 return relationships;
14928}; // Keep this - TODO: revisit...allow the diagram to have a title
14929
14930
14931var setTitle = function setTitle(txt) {
14932 title = txt;
14933};
14934
14935var getTitle = function getTitle() {
14936 return title;
14937};
14938
14939var clear = function clear() {
14940 entities = {};
14941 relationships = [];
14942 title = '';
14943};
14944
14945/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
14946 Cardinality: Cardinality,
14947 Identification: Identification,
14948 parseDirective: parseDirective,
14949 getConfig: function getConfig() {
14950 return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().er;
14951 },
14952 addEntity: addEntity,
14953 addAttributes: addAttributes,
14954 getEntities: getEntities,
14955 addRelationship: addRelationship,
14956 getRelationships: getRelationships,
14957 clear: clear,
14958 setTitle: setTitle,
14959 getTitle: getTitle
14960});
14961
14962/***/ }),
14963
14964/***/ "./src/diagrams/er/erMarkers.js":
14965/*!**************************************!*\
14966 !*** ./src/diagrams/er/erMarkers.js ***!
14967 \**************************************/
14968/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
14969
14970"use strict";
14971__webpack_require__.r(__webpack_exports__);
14972/* harmony export */ __webpack_require__.d(__webpack_exports__, {
14973/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
14974/* harmony export */ });
14975var ERMarkers = {
14976 ONLY_ONE_START: 'ONLY_ONE_START',
14977 ONLY_ONE_END: 'ONLY_ONE_END',
14978 ZERO_OR_ONE_START: 'ZERO_OR_ONE_START',
14979 ZERO_OR_ONE_END: 'ZERO_OR_ONE_END',
14980 ONE_OR_MORE_START: 'ONE_OR_MORE_START',
14981 ONE_OR_MORE_END: 'ONE_OR_MORE_END',
14982 ZERO_OR_MORE_START: 'ZERO_OR_MORE_START',
14983 ZERO_OR_MORE_END: 'ZERO_OR_MORE_END'
14984};
14985/**
14986 * Put the markers into the svg DOM for later use with edge paths
14987 */
14988
14989var insertMarkers = function insertMarkers(elem, conf) {
14990 var marker;
14991 elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18 M15,0 L15,18');
14992 elem.append('defs').append('marker').attr('id', ERMarkers.ONLY_ONE_END).attr('refX', 18).attr('refY', 9).attr('markerWidth', 18).attr('markerHeight', 18).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,0 L3,18 M9,0 L9,18');
14993 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_START).attr('refX', 0).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
14994 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 21).attr('cy', 9).attr('r', 6);
14995 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M9,0 L9,18');
14996 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_ONE_END).attr('refX', 30).attr('refY', 9).attr('markerWidth', 30).attr('markerHeight', 18).attr('orient', 'auto');
14997 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 9).attr('r', 6);
14998 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,0 L21,18');
14999 elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27');
15000 elem.append('defs').append('marker').attr('id', ERMarkers.ONE_OR_MORE_END).attr('refX', 27).attr('refY', 18).attr('markerWidth', 45).attr('markerHeight', 36).attr('orient', 'auto').append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18');
15001 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_START).attr('refX', 18).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
15002 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 48).attr('cy', 18).attr('r', 6);
15003 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M0,18 Q18,0 36,18 Q18,36 0,18');
15004 marker = elem.append('defs').append('marker').attr('id', ERMarkers.ZERO_OR_MORE_END).attr('refX', 39).attr('refY', 18).attr('markerWidth', 57).attr('markerHeight', 36).attr('orient', 'auto');
15005 marker.append('circle').attr('stroke', conf.stroke).attr('fill', 'white').attr('cx', 9).attr('cy', 18).attr('r', 6);
15006 marker.append('path').attr('stroke', conf.stroke).attr('fill', 'none').attr('d', 'M21,18 Q39,0 57,18 Q39,36 21,18');
15007 return;
15008};
15009
15010/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
15011 ERMarkers: ERMarkers,
15012 insertMarkers: insertMarkers
15013});
15014
15015/***/ }),
15016
15017/***/ "./src/diagrams/er/erRenderer.js":
15018/*!***************************************!*\
15019 !*** ./src/diagrams/er/erRenderer.js ***!
15020 \***************************************/
15021/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15022
15023"use strict";
15024__webpack_require__.r(__webpack_exports__);
15025/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15026/* harmony export */ "setConf": () => (/* binding */ setConf),
15027/* harmony export */ "draw": () => (/* binding */ draw),
15028/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
15029/* harmony export */ });
15030/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
15031/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
15032/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
15033/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
15034/* harmony import */ var _erDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./erDb */ "./src/diagrams/er/erDb.js");
15035/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
15036/* harmony import */ var _parser_erDiagram__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_parser_erDiagram__WEBPACK_IMPORTED_MODULE_7__);
15037/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre */ "dagre");
15038/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_2__);
15039/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
15040/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
15041/* harmony import */ var _erMarkers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./erMarkers */ "./src/diagrams/er/erMarkers.js");
15042/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052var conf = {};
15053/**
15054 * Allows the top-level API module to inject config specific to this renderer,
15055 * storing it in the local conf object. Note that generic config still needs to be
15056 * retrieved using getConfig() imported from the config module
15057 */
15058
15059var setConf = function setConf(cnf) {
15060 var keys = Object.keys(cnf);
15061
15062 for (var i = 0; i < keys.length; i++) {
15063 conf[keys[i]] = cnf[keys[i]];
15064 }
15065};
15066/**
15067 * Draw attributes for an entity
15068 * @param groupNode the svg group node for the entity
15069 * @param entityTextNode the svg node for the entity label text
15070 * @param attributes an array of attributes defined for the entity (each attribute has a type and a name)
15071 * @return the bounding box of the entity, after attributes have been added
15072 */
15073
15074var drawAttributes = function drawAttributes(groupNode, entityTextNode, attributes) {
15075 var heightPadding = conf.entityPadding / 3; // Padding internal to attribute boxes
15076
15077 var widthPadding = conf.entityPadding / 3; // Ditto
15078
15079 var attrFontSize = conf.fontSize * 0.85;
15080 var labelBBox = entityTextNode.node().getBBox();
15081 var attributeNodes = []; // Intermediate storage for attribute nodes created so that we can do a second pass
15082
15083 var hasKeyType = false;
15084 var hasComment = false;
15085 var maxWidth = 0;
15086 var maxTypeWidth = 0;
15087 var maxNameWidth = 0;
15088 var maxKeyWidth = 0;
15089 var maxCommentWidth = 0;
15090 var cumulativeHeight = labelBBox.height + heightPadding * 2;
15091 var attrNum = 1;
15092 attributes.forEach(function (item) {
15093 var attrPrefix = "".concat(entityTextNode.node().id, "-attr-").concat(attrNum);
15094 var nodeWidth = 0;
15095 var nodeHeight = 0; // Add a text node for the attribute type
15096
15097 var typeNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-type")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeType); // Add a text node for the attribute name
15098
15099 var nameNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-name")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeName);
15100 var attributeNode = {};
15101 attributeNode.tn = typeNode;
15102 attributeNode.nn = nameNode;
15103 var typeBBox = typeNode.node().getBBox();
15104 var nameBBox = nameNode.node().getBBox();
15105 maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
15106 maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
15107 nodeWidth += typeBBox.width;
15108 nodeWidth += nameBBox.width;
15109 nodeHeight = Math.max(typeBBox.height, nameBBox.height);
15110
15111 if (hasKeyType || item.attributeKeyType !== undefined) {
15112 var keyTypeNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-name")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeKeyType || '');
15113 attributeNode.kn = keyTypeNode;
15114 var keyTypeBBox = keyTypeNode.node().getBBox();
15115 nodeWidth += keyTypeBBox.width;
15116 maxKeyWidth = Math.max(maxKeyWidth, nodeWidth);
15117 nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
15118 hasKeyType = true;
15119 }
15120
15121 if (hasComment || item.attributeComment !== undefined) {
15122 var commentNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', "".concat(attrPrefix, "-name")).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'left').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + attrFontSize + 'px').text(item.attributeComment || '');
15123 attributeNode.cn = commentNode;
15124 var commentNodeBBox = commentNode.node().getBBox();
15125 nodeWidth += commentNodeBBox.width;
15126 maxCommentWidth = Math.max(nodeWidth, nameBBox.width);
15127 nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
15128 hasComment = true;
15129 }
15130
15131 attributeNode.height = nodeHeight; // Keep a reference to the nodes so that we can iterate through them later
15132
15133 attributeNodes.push(attributeNode);
15134 maxWidth = Math.max(maxWidth, nodeWidth);
15135 cumulativeHeight += nodeHeight + heightPadding * 2;
15136 attrNum += 1;
15137 }); // Calculate the new bounding box of the overall entity, now that attributes have been added
15138
15139 var bBox = {
15140 width: Math.max(conf.minEntityWidth, Math.max(labelBBox.width + conf.entityPadding * 2, maxWidth + widthPadding * 4)),
15141 height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
15142 }; // There might be some spare width for padding out attributes if the entity name is very long
15143
15144 var spareWidth = Math.max(0, bBox.width - maxWidth - widthPadding * 4);
15145
15146 if (attributes.length > 0) {
15147 // Position the entity label near the top of the entity bounding box
15148 entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + (heightPadding + labelBBox.height / 2) + ')'); // Add rectangular boxes for the attribute types/names
15149
15150 var heightOffset = labelBBox.height + heightPadding * 2; // Start at the bottom of the entity label
15151
15152 var attribStyle = 'attributeBoxOdd'; // We will flip the style on alternate rows to achieve a banded effect
15153
15154 attributeNodes.forEach(function (attributeNode) {
15155 // Calculate the alignment y co-ordinate for the type/name of the attribute
15156 var alignY = heightOffset + heightPadding + attributeNode.height / 2; // Position the type of the attribute
15157
15158 attributeNode.tn.attr('transform', 'translate(' + widthPadding + ',' + alignY + ')'); // Insert a rectangle for the type
15159
15160 var typeRect = groupNode.insert('rect', '#' + attributeNode.tn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', 0).attr('y', heightOffset).attr('width', maxTypeWidth * 2 + spareWidth / 2).attr('height', attributeNode.tn.node().getBBox().height + heightPadding * 2); // Position the name of the attribute
15161
15162 attributeNode.nn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
15163
15164 groupNode.insert('rect', '#' + attributeNode.nn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxNameWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.nn.node().getBBox().height + heightPadding * 2);
15165
15166 if (hasKeyType) {
15167 // Position the name of the attribute
15168 attributeNode.kn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
15169
15170 groupNode.insert('rect', '#' + attributeNode.kn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxKeyWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.kn.node().getBBox().height + heightPadding * 2);
15171 }
15172
15173 if (hasComment) {
15174 // Position the name of the attribute
15175 attributeNode.cn.attr('transform', 'translate(' + (parseFloat(typeRect.attr('width')) + widthPadding) + ',' + alignY + ')'); // Insert a rectangle for the name
15176
15177 groupNode.insert('rect', '#' + attributeNode.cn.node().id).attr('class', "er ".concat(attribStyle)).attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', "".concat(typeRect.attr('x') + typeRect.attr('width'))).attr('y', heightOffset).attr('width', maxCommentWidth + widthPadding * 2 + spareWidth / 2).attr('height', attributeNode.cn.node().getBBox().height + heightPadding * 2);
15178 } // Increment the height offset to move to the next row
15179
15180
15181 heightOffset += attributeNode.height + heightPadding * 2; // Flip the attribute style for row banding
15182
15183 attribStyle = attribStyle == 'attributeBoxOdd' ? 'attributeBoxEven' : 'attributeBoxOdd';
15184 });
15185 } else {
15186 // Ensure the entity box is a decent size without any attributes
15187 bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight); // Position the entity label in the middle of the box
15188
15189 entityTextNode.attr('transform', 'translate(' + bBox.width / 2 + ',' + bBox.height / 2 + ')');
15190 }
15191
15192 return bBox;
15193};
15194/**
15195 * Use D3 to construct the svg elements for the entities
15196 * @param svgNode the svg node that contains the diagram
15197 * @param entities The entities to be drawn
15198 * @param graph The graph that contains the vertex and edge definitions post-layout
15199 * @return The first entity that was inserted
15200 */
15201
15202
15203var drawEntities = function drawEntities(svgNode, entities, graph) {
15204 var keys = Object.keys(entities);
15205 var firstOne;
15206 keys.forEach(function (id) {
15207 // Create a group for each entity
15208 var groupNode = svgNode.append('g').attr('id', id);
15209 firstOne = firstOne === undefined ? id : firstOne; // Label the entity - this is done first so that we can get the bounding box
15210 // which then determines the size of the rectangle
15211
15212 var textId = 'entity-' + id;
15213 var textNode = groupNode.append('text').attr('class', 'er entityLabel').attr('id', textId).attr('x', 0).attr('y', 0).attr('dominant-baseline', 'middle').attr('text-anchor', 'middle').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(id);
15214
15215 var _drawAttributes = drawAttributes(groupNode, textNode, entities[id].attributes),
15216 entityWidth = _drawAttributes.width,
15217 entityHeight = _drawAttributes.height; // Draw the rectangle - insert it before the text so that the text is not obscured
15218
15219
15220 var rectNode = groupNode.insert('rect', '#' + textId).attr('class', 'er entityBox').attr('fill', conf.fill).attr('fill-opacity', '100%').attr('stroke', conf.stroke).attr('x', 0).attr('y', 0).attr('width', entityWidth).attr('height', entityHeight);
15221 var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
15222
15223 graph.setNode(id, {
15224 width: rectBBox.width,
15225 height: rectBBox.height,
15226 shape: 'rect',
15227 id: id
15228 });
15229 });
15230 return firstOne;
15231}; // drawEntities
15232
15233
15234var adjustEntities = function adjustEntities(svgNode, graph) {
15235 graph.nodes().forEach(function (v) {
15236 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
15237 svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
15238 }
15239 });
15240 return;
15241};
15242
15243var getEdgeName = function getEdgeName(rel) {
15244 return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, '');
15245};
15246/**
15247 * Add each relationship to the graph
15248 * @param relationships the relationships to be added
15249 * @param g the graph
15250 * @return {Array} The array of relationships
15251 */
15252
15253
15254var addRelationships = function addRelationships(relationships, g) {
15255 relationships.forEach(function (r) {
15256 g.setEdge(r.entityA, r.entityB, {
15257 relationship: r
15258 }, getEdgeName(r));
15259 });
15260 return relationships;
15261}; // addRelationships
15262
15263
15264var relCnt = 0;
15265/**
15266 * Draw a relationship using edge information from the graph
15267 * @param svg the svg node
15268 * @param rel the relationship to draw in the svg
15269 * @param g the graph containing the edge information
15270 * @param insert the insertion point in the svg DOM (because relationships have markers that need to sit 'behind' opaque entity boxes)
15271 */
15272
15273var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
15274 relCnt++; // Find the edge relating to this relationship
15275
15276 var edge = g.edge(rel.entityA, rel.entityB, getEdgeName(rel)); // Get a function that will generate the line path
15277
15278 var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_1__.line)().x(function (d) {
15279 return d.x;
15280 }).y(function (d) {
15281 return d.y;
15282 }).curve(d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis); // Insert the line at the right place
15283
15284 var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('stroke', conf.stroke).attr('fill', 'none'); // ...and with dashes if necessary
15285
15286 if (rel.relSpec.relType === _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Identification.NON_IDENTIFYING) {
15287 svgPath.attr('stroke-dasharray', '8,8');
15288 } // TODO: Understand this better
15289
15290
15291 var url = '';
15292
15293 if (conf.arrowMarkerAbsolute) {
15294 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
15295 url = url.replace(/\(/g, '\\(');
15296 url = url.replace(/\)/g, '\\)');
15297 } // Decide which start and end markers it needs. It may be possible to be more concise here
15298 // by reversing a start marker to make an end marker...but this will do for now
15299 // Note that the 'A' entity's marker is at the end of the relationship and the 'B' entity's marker is at the start
15300
15301
15302 switch (rel.relSpec.cardA) {
15303 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_ONE:
15304 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_ONE_END + ')');
15305 break;
15306
15307 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_MORE:
15308 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_MORE_END + ')');
15309 break;
15310
15311 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONE_OR_MORE:
15312 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONE_OR_MORE_END + ')');
15313 break;
15314
15315 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONLY_ONE:
15316 svgPath.attr('marker-end', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONLY_ONE_END + ')');
15317 break;
15318 }
15319
15320 switch (rel.relSpec.cardB) {
15321 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_ONE:
15322 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_ONE_START + ')');
15323 break;
15324
15325 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ZERO_OR_MORE:
15326 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ZERO_OR_MORE_START + ')');
15327 break;
15328
15329 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONE_OR_MORE:
15330 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONE_OR_MORE_START + ')');
15331 break;
15332
15333 case _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].Cardinality.ONLY_ONE:
15334 svgPath.attr('marker-start', 'url(' + url + '#' + _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ERMarkers.ONLY_ONE_START + ')');
15335 break;
15336 } // Now label the relationship
15337 // Find the half-way point
15338
15339
15340 var len = svgPath.node().getTotalLength();
15341 var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
15342
15343 var labelId = 'rel' + relCnt;
15344 var labelNode = svg.append('text').attr('class', 'er relationshipLabel').attr('id', labelId).attr('x', labelPoint.x).attr('y', labelPoint.y).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle').attr('style', 'font-family: ' + (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().fontFamily + '; font-size: ' + conf.fontSize + 'px').text(rel.roleA); // Figure out how big the opaque 'container' rectangle needs to be
15345
15346 var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
15347
15348 svg.insert('rect', '#' + labelId).attr('class', 'er relationshipLabelBox').attr('x', labelPoint.x - labelBBox.width / 2).attr('y', labelPoint.y - labelBBox.height / 2).attr('width', labelBBox.width).attr('height', labelBBox.height).attr('fill', 'white').attr('fill-opacity', '85%');
15349 return;
15350};
15351/**
15352 * Draw en E-R diagram in the tag with id: id based on the text definition of the diagram
15353 * @param text the text of the diagram
15354 * @param id the unique id of the DOM node that contains the diagram
15355 */
15356
15357
15358var draw = function draw(text, id) {
15359 _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Drawing ER diagram');
15360 _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].clear();
15361 var parser = (_parser_erDiagram__WEBPACK_IMPORTED_MODULE_7___default().parser);
15362 parser.yy = _erDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // Parse the text to populate erDb
15363
15364 try {
15365 parser.parse(text);
15366 } catch (err) {
15367 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Parsing failed');
15368 } // Get a reference to the svg node that contains the text
15369
15370
15371 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id='".concat(id, "']")); // Add cardinality marker definitions to the svg
15372
15373 _erMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].insertMarkers(svg, conf); // Now we have to construct the diagram in a specific way:
15374 // ---
15375 // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
15376 // 2. Make sure they are all added to the graph
15377 // 3. Add all the edges (relationships) to the graph aswell
15378 // 4. Let dagre do its magic to layout the graph. This assigns:
15379 // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
15380 // - the path co-ordinates for each edge
15381 // But it has no impact on the svg child nodes - the diagram remains with every entity rooted at 0,0
15382 // 5. Now assign a transform to each entity in the svg node so that it gets drawn in the correct place, as determined by
15383 // its centre point, which is obtained from the graph, and it's width and height
15384 // 6. And finally, create all the edges in the svg node using information from the graph
15385 // ---
15386 // Create the graph
15387
15388 var g; // TODO: Explore directed vs undirected graphs, and how the layout is affected
15389 // An E-R diagram could be said to be undirected, but there is merit in setting
15390 // the direction from parent to child in a one-to-many as this influences graphlib to
15391 // put the parent above the child (does it?), which is intuitive. Most relationships
15392 // in ER diagrams are one-to-many.
15393
15394 g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
15395 multigraph: true,
15396 directed: true,
15397 compound: false
15398 }).setGraph({
15399 rankdir: conf.layoutDirection,
15400 marginx: 20,
15401 marginy: 20,
15402 nodesep: 100,
15403 edgesep: 100,
15404 ranksep: 100
15405 }).setDefaultEdgeLabel(function () {
15406 return {};
15407 }); // Draw the entities (at 0,0), returning the first svg node that got
15408 // inserted - this represents the insertion point for relationship paths
15409
15410 var firstEntity = drawEntities(svg, _erDb__WEBPACK_IMPORTED_MODULE_4__["default"].getEntities(), g); // TODO: externalise the addition of entities to the graph - it's a bit 'buried' in the above
15411 // Add all the relationships to the graph
15412
15413 var relationships = addRelationships(_erDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelationships(), g);
15414 dagre__WEBPACK_IMPORTED_MODULE_2___default().layout(g); // Node and edge positions will be updated
15415 // Adjust the positions of the entities so that they adhere to the layout
15416
15417 adjustEntities(svg, g); // Draw the relationships
15418
15419 relationships.forEach(function (rel) {
15420 drawRelationshipFromLayout(svg, rel, g, firstEntity);
15421 });
15422 var padding = conf.diagramPadding;
15423 var svgBounds = svg.node().getBBox();
15424 var width = svgBounds.width + padding * 2;
15425 var height = svgBounds.height + padding * 2;
15426 (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
15427 svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
15428}; // draw
15429
15430/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
15431 setConf: setConf,
15432 draw: draw
15433});
15434
15435/***/ }),
15436
15437/***/ "./src/diagrams/er/styles.js":
15438/*!***********************************!*\
15439 !*** ./src/diagrams/er/styles.js ***!
15440 \***********************************/
15441/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15442
15443"use strict";
15444__webpack_require__.r(__webpack_exports__);
15445/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15446/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
15447/* harmony export */ });
15448var getStyles = function getStyles(options) {
15449 return "\n .entityBox {\n fill: ".concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .attributeBoxOdd {\n fill: #ffffff;\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .attributeBoxEven {\n fill: #f2f2f2;\n stroke: ").concat(options.nodeBorder, ";\n }\n\n .relationshipLabelBox {\n fill: ").concat(options.tertiaryColor, ";\n opacity: 0.7;\n background-color: ").concat(options.tertiaryColor, ";\n rect {\n opacity: 0.5;\n }\n }\n\n .relationshipLine {\n stroke: ").concat(options.lineColor, ";\n }\n");
15450};
15451
15452/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
15453
15454/***/ }),
15455
15456/***/ "./src/diagrams/flowchart/flowChartShapes.js":
15457/*!***************************************************!*\
15458 !*** ./src/diagrams/flowchart/flowChartShapes.js ***!
15459 \***************************************************/
15460/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15461
15462"use strict";
15463__webpack_require__.r(__webpack_exports__);
15464/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15465/* harmony export */ "addToRender": () => (/* binding */ addToRender),
15466/* harmony export */ "addToRenderV2": () => (/* binding */ addToRenderV2),
15467/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
15468/* harmony export */ });
15469/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
15470/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_0__);
15471
15472
15473function question(parent, bbox, node) {
15474 var w = bbox.width;
15475 var h = bbox.height;
15476 var s = (w + h) * 0.9;
15477 var points = [{
15478 x: s / 2,
15479 y: 0
15480 }, {
15481 x: s,
15482 y: -s / 2
15483 }, {
15484 x: s / 2,
15485 y: -s
15486 }, {
15487 x: 0,
15488 y: -s / 2
15489 }];
15490 var shapeSvg = insertPolygonShape(parent, s, s, points);
15491
15492 node.intersect = function (point) {
15493 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15494 };
15495
15496 return shapeSvg;
15497}
15498
15499function hexagon(parent, bbox, node) {
15500 var f = 4;
15501 var h = bbox.height;
15502 var m = h / f;
15503 var w = bbox.width + 2 * m;
15504 var points = [{
15505 x: m,
15506 y: 0
15507 }, {
15508 x: w - m,
15509 y: 0
15510 }, {
15511 x: w,
15512 y: -h / 2
15513 }, {
15514 x: w - m,
15515 y: -h
15516 }, {
15517 x: m,
15518 y: -h
15519 }, {
15520 x: 0,
15521 y: -h / 2
15522 }];
15523 var shapeSvg = insertPolygonShape(parent, w, h, points);
15524
15525 node.intersect = function (point) {
15526 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15527 };
15528
15529 return shapeSvg;
15530}
15531
15532function rect_left_inv_arrow(parent, bbox, node) {
15533 var w = bbox.width;
15534 var h = bbox.height;
15535 var points = [{
15536 x: -h / 2,
15537 y: 0
15538 }, {
15539 x: w,
15540 y: 0
15541 }, {
15542 x: w,
15543 y: -h
15544 }, {
15545 x: -h / 2,
15546 y: -h
15547 }, {
15548 x: 0,
15549 y: -h / 2
15550 }];
15551 var shapeSvg = insertPolygonShape(parent, w, h, points);
15552
15553 node.intersect = function (point) {
15554 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15555 };
15556
15557 return shapeSvg;
15558}
15559
15560function lean_right(parent, bbox, node) {
15561 var w = bbox.width;
15562 var h = bbox.height;
15563 var points = [{
15564 x: -2 * h / 6,
15565 y: 0
15566 }, {
15567 x: w - h / 6,
15568 y: 0
15569 }, {
15570 x: w + 2 * h / 6,
15571 y: -h
15572 }, {
15573 x: h / 6,
15574 y: -h
15575 }];
15576 var shapeSvg = insertPolygonShape(parent, w, h, points);
15577
15578 node.intersect = function (point) {
15579 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15580 };
15581
15582 return shapeSvg;
15583}
15584
15585function lean_left(parent, bbox, node) {
15586 var w = bbox.width;
15587 var h = bbox.height;
15588 var points = [{
15589 x: 2 * h / 6,
15590 y: 0
15591 }, {
15592 x: w + h / 6,
15593 y: 0
15594 }, {
15595 x: w - 2 * h / 6,
15596 y: -h
15597 }, {
15598 x: -h / 6,
15599 y: -h
15600 }];
15601 var shapeSvg = insertPolygonShape(parent, w, h, points);
15602
15603 node.intersect = function (point) {
15604 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15605 };
15606
15607 return shapeSvg;
15608}
15609
15610function trapezoid(parent, bbox, node) {
15611 var w = bbox.width;
15612 var h = bbox.height;
15613 var points = [{
15614 x: -2 * h / 6,
15615 y: 0
15616 }, {
15617 x: w + 2 * h / 6,
15618 y: 0
15619 }, {
15620 x: w - h / 6,
15621 y: -h
15622 }, {
15623 x: h / 6,
15624 y: -h
15625 }];
15626 var shapeSvg = insertPolygonShape(parent, w, h, points);
15627
15628 node.intersect = function (point) {
15629 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15630 };
15631
15632 return shapeSvg;
15633}
15634
15635function inv_trapezoid(parent, bbox, node) {
15636 var w = bbox.width;
15637 var h = bbox.height;
15638 var points = [{
15639 x: h / 6,
15640 y: 0
15641 }, {
15642 x: w - h / 6,
15643 y: 0
15644 }, {
15645 x: w + 2 * h / 6,
15646 y: -h
15647 }, {
15648 x: -2 * h / 6,
15649 y: -h
15650 }];
15651 var shapeSvg = insertPolygonShape(parent, w, h, points);
15652
15653 node.intersect = function (point) {
15654 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15655 };
15656
15657 return shapeSvg;
15658}
15659
15660function rect_right_inv_arrow(parent, bbox, node) {
15661 var w = bbox.width;
15662 var h = bbox.height;
15663 var points = [{
15664 x: 0,
15665 y: 0
15666 }, {
15667 x: w + h / 2,
15668 y: 0
15669 }, {
15670 x: w,
15671 y: -h / 2
15672 }, {
15673 x: w + h / 2,
15674 y: -h
15675 }, {
15676 x: 0,
15677 y: -h
15678 }];
15679 var shapeSvg = insertPolygonShape(parent, w, h, points);
15680
15681 node.intersect = function (point) {
15682 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15683 };
15684
15685 return shapeSvg;
15686}
15687
15688function stadium(parent, bbox, node) {
15689 var h = bbox.height;
15690 var w = bbox.width + h / 4;
15691 var shapeSvg = parent.insert('rect', ':first-child').attr('rx', h / 2).attr('ry', h / 2).attr('x', -w / 2).attr('y', -h / 2).attr('width', w).attr('height', h);
15692
15693 node.intersect = function (point) {
15694 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
15695 };
15696
15697 return shapeSvg;
15698}
15699
15700function subroutine(parent, bbox, node) {
15701 var w = bbox.width;
15702 var h = bbox.height;
15703 var points = [{
15704 x: 0,
15705 y: 0
15706 }, {
15707 x: w,
15708 y: 0
15709 }, {
15710 x: w,
15711 y: -h
15712 }, {
15713 x: 0,
15714 y: -h
15715 }, {
15716 x: 0,
15717 y: 0
15718 }, {
15719 x: -8,
15720 y: 0
15721 }, {
15722 x: w + 8,
15723 y: 0
15724 }, {
15725 x: w + 8,
15726 y: -h
15727 }, {
15728 x: -8,
15729 y: -h
15730 }, {
15731 x: -8,
15732 y: 0
15733 }];
15734 var shapeSvg = insertPolygonShape(parent, w, h, points);
15735
15736 node.intersect = function (point) {
15737 return dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.polygon(node, points, point);
15738 };
15739
15740 return shapeSvg;
15741}
15742
15743function cylinder(parent, bbox, node) {
15744 var w = bbox.width;
15745 var rx = w / 2;
15746 var ry = rx / (2.5 + w / 50);
15747 var h = bbox.height + ry;
15748 var shape = 'M 0,' + ry + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 a ' + rx + ',' + ry + ' 0,0,0 ' + -w + ' 0 l 0,' + h + ' a ' + rx + ',' + ry + ' 0,0,0 ' + w + ' 0 l 0,' + -h;
15749 var shapeSvg = parent.attr('label-offset-y', ry).insert('path', ':first-child').attr('d', shape).attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');
15750
15751 node.intersect = function (point) {
15752 var pos = dagre_d3__WEBPACK_IMPORTED_MODULE_0___default().intersect.rect(node, point);
15753 var x = pos.x - node.x;
15754
15755 if (rx != 0 && (Math.abs(x) < node.width / 2 || Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry)) {
15756 // ellipsis equation: x*x / a*a + y*y / b*b = 1
15757 // solve for y to get adjustion value for pos.y
15758 var y = ry * ry * (1 - x * x / (rx * rx));
15759 if (y != 0) y = Math.sqrt(y);
15760 y = ry - y;
15761 if (point.y - node.y > 0) y = -y;
15762 pos.y += y;
15763 }
15764
15765 return pos;
15766 };
15767
15768 return shapeSvg;
15769}
15770
15771function addToRender(render) {
15772 render.shapes().question = question;
15773 render.shapes().hexagon = hexagon;
15774 render.shapes().stadium = stadium;
15775 render.shapes().subroutine = subroutine;
15776 render.shapes().cylinder = cylinder; // Add custom shape for box with inverted arrow on left side
15777
15778 render.shapes().rect_left_inv_arrow = rect_left_inv_arrow; // Add custom shape for box with inverted arrow on left side
15779
15780 render.shapes().lean_right = lean_right; // Add custom shape for box with inverted arrow on left side
15781
15782 render.shapes().lean_left = lean_left; // Add custom shape for box with inverted arrow on left side
15783
15784 render.shapes().trapezoid = trapezoid; // Add custom shape for box with inverted arrow on left side
15785
15786 render.shapes().inv_trapezoid = inv_trapezoid; // Add custom shape for box with inverted arrow on right side
15787
15788 render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;
15789}
15790function addToRenderV2(addShape) {
15791 addShape({
15792 question: question
15793 });
15794 addShape({
15795 hexagon: hexagon
15796 });
15797 addShape({
15798 stadium: stadium
15799 });
15800 addShape({
15801 subroutine: subroutine
15802 });
15803 addShape({
15804 cylinder: cylinder
15805 }); // Add custom shape for box with inverted arrow on left side
15806
15807 addShape({
15808 rect_left_inv_arrow: rect_left_inv_arrow
15809 }); // Add custom shape for box with inverted arrow on left side
15810
15811 addShape({
15812 lean_right: lean_right
15813 }); // Add custom shape for box with inverted arrow on left side
15814
15815 addShape({
15816 lean_left: lean_left
15817 }); // Add custom shape for box with inverted arrow on left side
15818
15819 addShape({
15820 trapezoid: trapezoid
15821 }); // Add custom shape for box with inverted arrow on left side
15822
15823 addShape({
15824 inv_trapezoid: inv_trapezoid
15825 }); // Add custom shape for box with inverted arrow on right side
15826
15827 addShape({
15828 rect_right_inv_arrow: rect_right_inv_arrow
15829 });
15830}
15831
15832function insertPolygonShape(parent, w, h, points) {
15833 return parent.insert('polygon', ':first-child').attr('points', points.map(function (d) {
15834 return d.x + ',' + d.y;
15835 }).join(' ')).attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');
15836}
15837
15838/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
15839 addToRender: addToRender,
15840 addToRenderV2: addToRenderV2
15841});
15842
15843/***/ }),
15844
15845/***/ "./src/diagrams/flowchart/flowDb.js":
15846/*!******************************************!*\
15847 !*** ./src/diagrams/flowchart/flowDb.js ***!
15848 \******************************************/
15849/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
15850
15851"use strict";
15852__webpack_require__.r(__webpack_exports__);
15853/* harmony export */ __webpack_require__.d(__webpack_exports__, {
15854/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
15855/* harmony export */ "lookUpDomId": () => (/* binding */ lookUpDomId),
15856/* harmony export */ "addVertex": () => (/* binding */ addVertex),
15857/* harmony export */ "addSingleLink": () => (/* binding */ addSingleLink),
15858/* harmony export */ "addLink": () => (/* binding */ addLink),
15859/* harmony export */ "updateLinkInterpolate": () => (/* binding */ updateLinkInterpolate),
15860/* harmony export */ "updateLink": () => (/* binding */ updateLink),
15861/* harmony export */ "addClass": () => (/* binding */ addClass),
15862/* harmony export */ "setDirection": () => (/* binding */ setDirection),
15863/* harmony export */ "setClass": () => (/* binding */ setClass),
15864/* harmony export */ "setLink": () => (/* binding */ setLink),
15865/* harmony export */ "getTooltip": () => (/* binding */ getTooltip),
15866/* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
15867/* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
15868/* harmony export */ "getDirection": () => (/* binding */ getDirection),
15869/* harmony export */ "getVertices": () => (/* binding */ getVertices),
15870/* harmony export */ "getEdges": () => (/* binding */ getEdges),
15871/* harmony export */ "getClasses": () => (/* binding */ getClasses),
15872/* harmony export */ "clear": () => (/* binding */ clear),
15873/* harmony export */ "setGen": () => (/* binding */ setGen),
15874/* harmony export */ "defaultStyle": () => (/* binding */ defaultStyle),
15875/* harmony export */ "addSubGraph": () => (/* binding */ addSubGraph),
15876/* harmony export */ "getDepthFirstPos": () => (/* binding */ getDepthFirstPos),
15877/* harmony export */ "indexNodes": () => (/* binding */ indexNodes),
15878/* harmony export */ "getSubGraphs": () => (/* binding */ getSubGraphs),
15879/* harmony export */ "firstGraph": () => (/* binding */ firstGraph),
15880/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
15881/* harmony export */ });
15882/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
15883/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
15884/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
15885/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
15886/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
15887/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
15888/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
15889function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
15890
15891function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15892
15893function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15894
15895function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
15896
15897function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
15898
15899function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15900
15901function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
15902
15903
15904
15905
15906
15907
15908
15909var MERMAID_DOM_ID_PREFIX = 'flowchart-';
15910var vertexCounter = 0;
15911var config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
15912var vertices = {};
15913var edges = [];
15914var classes = [];
15915var subGraphs = [];
15916var subGraphLookup = {};
15917var tooltips = {};
15918var subCount = 0;
15919var firstGraphFlag = true;
15920var direction;
15921var version; // As in graph
15922// Functions to be run after graph rendering
15923
15924var funs = [];
15925var parseDirective = function parseDirective(statement, context, type) {
15926 _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
15927};
15928/**
15929 * Function to lookup domId from id in the graph definition.
15930 * @param id
15931 * @public
15932 */
15933
15934var lookUpDomId = function lookUpDomId(id) {
15935 var veritceKeys = Object.keys(vertices);
15936
15937 for (var i = 0; i < veritceKeys.length; i++) {
15938 if (vertices[veritceKeys[i]].id === id) {
15939 return vertices[veritceKeys[i]].domId;
15940 }
15941 }
15942
15943 return id;
15944};
15945/**
15946 * Function called by parser when a node definition has been found
15947 * @param id
15948 * @param text
15949 * @param type
15950 * @param style
15951 * @param classes
15952 */
15953
15954var addVertex = function addVertex(_id, text, type, style, classes, dir) {
15955 var txt;
15956 var id = _id;
15957
15958 if (typeof id === 'undefined') {
15959 return;
15960 }
15961
15962 if (id.trim().length === 0) {
15963 return;
15964 } // if (id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
15965
15966
15967 if (typeof vertices[id] === 'undefined') {
15968 vertices[id] = {
15969 id: id,
15970 domId: MERMAID_DOM_ID_PREFIX + id + '-' + vertexCounter,
15971 styles: [],
15972 classes: []
15973 };
15974 }
15975
15976 vertexCounter++;
15977
15978 if (typeof text !== 'undefined') {
15979 config = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
15980 txt = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(text.trim(), config); // strip quotes if string starts and ends with a quote
15981
15982 if (txt[0] === '"' && txt[txt.length - 1] === '"') {
15983 txt = txt.substring(1, txt.length - 1);
15984 }
15985
15986 vertices[id].text = txt;
15987 } else {
15988 if (typeof vertices[id].text === 'undefined') {
15989 vertices[id].text = _id;
15990 }
15991 }
15992
15993 if (typeof type !== 'undefined') {
15994 vertices[id].type = type;
15995 }
15996
15997 if (typeof style !== 'undefined') {
15998 if (style !== null) {
15999 style.forEach(function (s) {
16000 vertices[id].styles.push(s);
16001 });
16002 }
16003 }
16004
16005 if (typeof classes !== 'undefined') {
16006 if (classes !== null) {
16007 classes.forEach(function (s) {
16008 vertices[id].classes.push(s);
16009 });
16010 }
16011 }
16012
16013 if (typeof dir !== 'undefined') {
16014 vertices[id].dir = dir;
16015 }
16016};
16017/**
16018 * Function called by parser when a link/edge definition has been found
16019 * @param start
16020 * @param end
16021 * @param type
16022 * @param linktext
16023 */
16024
16025var addSingleLink = function addSingleLink(_start, _end, type, linktext) {
16026 var start = _start;
16027 var end = _end; // if (start[0].match(/\d/)) start = MERMAID_DOM_ID_PREFIX + start;
16028 // if (end[0].match(/\d/)) end = MERMAID_DOM_ID_PREFIX + end;
16029 // log.info('Got edge...', start, end);
16030
16031 var edge = {
16032 start: start,
16033 end: end,
16034 type: undefined,
16035 text: ''
16036 };
16037 linktext = type.text;
16038
16039 if (typeof linktext !== 'undefined') {
16040 edge.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(linktext.trim(), config); // strip quotes if string starts and exnds with a quote
16041
16042 if (edge.text[0] === '"' && edge.text[edge.text.length - 1] === '"') {
16043 edge.text = edge.text.substring(1, edge.text.length - 1);
16044 }
16045 }
16046
16047 if (typeof type !== 'undefined') {
16048 edge.type = type.type;
16049 edge.stroke = type.stroke;
16050 edge.length = type.length;
16051 }
16052
16053 edges.push(edge);
16054};
16055var addLink = function addLink(_start, _end, type, linktext) {
16056 var i, j;
16057
16058 for (i = 0; i < _start.length; i++) {
16059 for (j = 0; j < _end.length; j++) {
16060 addSingleLink(_start[i], _end[j], type, linktext);
16061 }
16062 }
16063};
16064/**
16065 * Updates a link's line interpolation algorithm
16066 * @param pos
16067 * @param interpolate
16068 */
16069
16070var updateLinkInterpolate = function updateLinkInterpolate(positions, interp) {
16071 positions.forEach(function (pos) {
16072 if (pos === 'default') {
16073 edges.defaultInterpolate = interp;
16074 } else {
16075 edges[pos].interpolate = interp;
16076 }
16077 });
16078};
16079/**
16080 * Updates a link with a style
16081 * @param pos
16082 * @param style
16083 */
16084
16085var updateLink = function updateLink(positions, style) {
16086 positions.forEach(function (pos) {
16087 if (pos === 'default') {
16088 edges.defaultStyle = style;
16089 } else {
16090 if (_utils__WEBPACK_IMPORTED_MODULE_4__["default"].isSubstringInArray('fill', style) === -1) {
16091 style.push('fill:none');
16092 }
16093
16094 edges[pos].style = style;
16095 }
16096 });
16097};
16098var addClass = function addClass(id, style) {
16099 if (typeof classes[id] === 'undefined') {
16100 classes[id] = {
16101 id: id,
16102 styles: [],
16103 textStyles: []
16104 };
16105 }
16106
16107 if (typeof style !== 'undefined') {
16108 if (style !== null) {
16109 style.forEach(function (s) {
16110 if (s.match('color')) {
16111 var newStyle1 = s.replace('fill', 'bgFill');
16112 var newStyle2 = newStyle1.replace('color', 'fill');
16113 classes[id].textStyles.push(newStyle2);
16114 }
16115
16116 classes[id].styles.push(s);
16117 });
16118 }
16119 }
16120};
16121/**
16122 * Called by parser when a graph definition is found, stores the direction of the chart.
16123 * @param dir
16124 */
16125
16126var setDirection = function setDirection(dir) {
16127 direction = dir;
16128
16129 if (direction.match(/.*</)) {
16130 direction = 'RL';
16131 }
16132
16133 if (direction.match(/.*\^/)) {
16134 direction = 'BT';
16135 }
16136
16137 if (direction.match(/.*>/)) {
16138 direction = 'LR';
16139 }
16140
16141 if (direction.match(/.*v/)) {
16142 direction = 'TB';
16143 }
16144};
16145/**
16146 * Called by parser when a special node is found, e.g. a clickable element.
16147 * @param ids Comma separated list of ids
16148 * @param className Class to add
16149 */
16150
16151var setClass = function setClass(ids, className) {
16152 ids.split(',').forEach(function (_id) {
16153 // let id = version === 'gen-2' ? lookUpDomId(_id) : _id;
16154 var id = _id; // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
16155
16156 if (typeof vertices[id] !== 'undefined') {
16157 vertices[id].classes.push(className);
16158 }
16159
16160 if (typeof subGraphLookup[id] !== 'undefined') {
16161 subGraphLookup[id].classes.push(className);
16162 }
16163 });
16164};
16165
16166var setTooltip = function setTooltip(ids, tooltip) {
16167 ids.split(',').forEach(function (id) {
16168 if (typeof tooltip !== 'undefined') {
16169 tooltips[version === 'gen-1' ? lookUpDomId(id) : id] = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(tooltip, config);
16170 }
16171 });
16172};
16173
16174var setClickFun = function setClickFun(id, functionName, functionArgs) {
16175 var domId = lookUpDomId(id); // if (_id[0].match(/\d/)) id = MERMAID_DOM_ID_PREFIX + id;
16176
16177 if (_config__WEBPACK_IMPORTED_MODULE_1__.getConfig().securityLevel !== 'loose') {
16178 return;
16179 }
16180
16181 if (typeof functionName === 'undefined') {
16182 return;
16183 }
16184
16185 var argList = [];
16186
16187 if (typeof functionArgs === 'string') {
16188 /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
16189 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
16190
16191 for (var i = 0; i < argList.length; i++) {
16192 var item = argList[i].trim();
16193 /* Removes all double quotes at the start and end of an argument */
16194
16195 /* This preserves all starting and ending whitespace inside */
16196
16197 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
16198 item = item.substr(1, item.length - 2);
16199 }
16200
16201 argList[i] = item;
16202 }
16203 }
16204 /* if no arguments passed into callback, default to passing in id */
16205
16206
16207 if (argList.length === 0) {
16208 argList.push(id);
16209 }
16210
16211 if (typeof vertices[id] !== 'undefined') {
16212 vertices[id].haveCallback = true;
16213 funs.push(function () {
16214 var elem = document.querySelector("[id=\"".concat(domId, "\"]"));
16215
16216 if (elem !== null) {
16217 elem.addEventListener('click', function () {
16218 _utils__WEBPACK_IMPORTED_MODULE_4__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_4__["default"], [functionName].concat(_toConsumableArray(argList)));
16219 }, false);
16220 }
16221 });
16222 }
16223};
16224/**
16225 * Called by parser when a link is found. Adds the URL to the vertex data.
16226 * @param ids Comma separated list of ids
16227 * @param linkStr URL to create a link for
16228 */
16229
16230
16231var setLink = function setLink(ids, linkStr, target) {
16232 ids.split(',').forEach(function (id) {
16233 if (typeof vertices[id] !== 'undefined') {
16234 vertices[id].link = _utils__WEBPACK_IMPORTED_MODULE_4__["default"].formatUrl(linkStr, config);
16235 vertices[id].linkTarget = target;
16236 }
16237 });
16238 setClass(ids, 'clickable');
16239};
16240var getTooltip = function getTooltip(id) {
16241 return tooltips[id];
16242};
16243/**
16244 * Called by parser when a click definition is found. Registers an event handler.
16245 * @param ids Comma separated list of ids
16246 * @param functionName Function to be called on click
16247 * @param tooltip Tooltip for the clickable element
16248 */
16249
16250var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
16251 ids.split(',').forEach(function (id) {
16252 setClickFun(id, functionName, functionArgs);
16253 });
16254 setClass(ids, 'clickable');
16255};
16256var bindFunctions = function bindFunctions(element) {
16257 funs.forEach(function (fun) {
16258 fun(element);
16259 });
16260};
16261var getDirection = function getDirection() {
16262 return direction.trim();
16263};
16264/**
16265 * Retrieval function for fetching the found nodes after parsing has completed.
16266 * @returns {{}|*|vertices}
16267 */
16268
16269var getVertices = function getVertices() {
16270 return vertices;
16271};
16272/**
16273 * Retrieval function for fetching the found links after parsing has completed.
16274 * @returns {{}|*|edges}
16275 */
16276
16277var getEdges = function getEdges() {
16278 return edges;
16279};
16280/**
16281 * Retrieval function for fetching the found class definitions after parsing has completed.
16282 * @returns {{}|*|classes}
16283 */
16284
16285var getClasses = function getClasses() {
16286 return classes;
16287};
16288
16289var setupToolTips = function setupToolTips(element) {
16290 var tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('.mermaidTooltip');
16291
16292 if ((tooltipElem._groups || tooltipElem)[0][0] === null) {
16293 tooltipElem = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('class', 'mermaidTooltip').style('opacity', 0);
16294 }
16295
16296 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(element).select('svg');
16297 var nodes = svg.selectAll('g.node');
16298 nodes.on('mouseover', function () {
16299 var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
16300 var title = el.attr('title'); // Dont try to draw a tooltip if no data is provided
16301
16302 if (title === null) {
16303 return;
16304 }
16305
16306 var rect = this.getBoundingClientRect();
16307 tooltipElem.transition().duration(200).style('opacity', '.9');
16308 tooltipElem.html(el.attr('title')).style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px').style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
16309 el.classed('hover', true);
16310 }).on('mouseout', function () {
16311 tooltipElem.transition().duration(500).style('opacity', 0);
16312 var el = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(this);
16313 el.classed('hover', false);
16314 });
16315};
16316
16317funs.push(setupToolTips);
16318/**
16319 * Clears the internal graph db so that a new graph can be parsed.
16320 */
16321
16322var clear = function clear(ver) {
16323 vertices = {};
16324 classes = {};
16325 edges = [];
16326 funs = [];
16327 funs.push(setupToolTips);
16328 subGraphs = [];
16329 subGraphLookup = {};
16330 subCount = 0;
16331 tooltips = [];
16332 firstGraphFlag = true;
16333 version = ver || 'gen-1';
16334};
16335var setGen = function setGen(ver) {
16336 version = ver || 'gen-1';
16337};
16338/**
16339 *
16340 * @returns {string}
16341 */
16342
16343var defaultStyle = function defaultStyle() {
16344 return 'fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;';
16345};
16346/**
16347 * Clears the internal graph db so that a new graph can be parsed.
16348 */
16349
16350var addSubGraph = function addSubGraph(_id, list, _title) {
16351 // console.log('addSubGraph', _id, list, _title);
16352 var id = _id.trim();
16353
16354 var title = _title;
16355
16356 if (_id === _title && _title.match(/\s/)) {
16357 id = undefined;
16358 }
16359
16360 function uniq(a) {
16361 var prims = {
16362 boolean: {},
16363 number: {},
16364 string: {}
16365 };
16366 var objs = [];
16367 var dir; // = unbdefined; direction.trim();
16368
16369 var nodeList = a.filter(function (item) {
16370 var type = _typeof(item);
16371
16372 if (item.stmt && item.stmt === 'dir') {
16373 dir = item.value;
16374 return false;
16375 }
16376
16377 if (item.trim() === '') {
16378 return false;
16379 }
16380
16381 if (type in prims) {
16382 return prims[type].hasOwnProperty(item) ? false : prims[type][item] = true; // eslint-disable-line
16383 } else {
16384 return objs.indexOf(item) >= 0 ? false : objs.push(item);
16385 }
16386 });
16387 return {
16388 nodeList: nodeList,
16389 dir: dir
16390 };
16391 }
16392
16393 var nodeList = [];
16394
16395 var _uniq = uniq(nodeList.concat.apply(nodeList, list)),
16396 nl = _uniq.nodeList,
16397 dir = _uniq.dir;
16398
16399 nodeList = nl;
16400
16401 if (version === 'gen-1') {
16402 _logger__WEBPACK_IMPORTED_MODULE_5__.log.warn('LOOKING UP');
16403
16404 for (var i = 0; i < nodeList.length; i++) {
16405 nodeList[i] = lookUpDomId(nodeList[i]);
16406 }
16407 }
16408
16409 id = id || 'subGraph' + subCount; // if (id[0].match(/\d/)) id = lookUpDomId(id);
16410
16411 title = title || '';
16412 title = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, config);
16413 subCount = subCount + 1;
16414 var subGraph = {
16415 id: id,
16416 nodes: nodeList,
16417 title: title.trim(),
16418 classes: [],
16419 dir: dir
16420 };
16421 _logger__WEBPACK_IMPORTED_MODULE_5__.log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
16422 /**
16423 * Deletes an id from all subgraphs
16424 */
16425 // const del = _id => {
16426 // subGraphs.forEach(sg => {
16427 // const pos = sg.nodes.indexOf(_id);
16428 // if (pos >= 0) {
16429 // sg.nodes.splice(pos, 1);
16430 // }
16431 // });
16432 // };
16433 // // Removes the members of this subgraph from any other subgraphs, a node only belong to one subgraph
16434 // subGraph.nodes.forEach(_id => del(_id));
16435 // Remove the members in the new subgraph if they already belong to another subgraph
16436
16437 subGraph.nodes = makeUniq(subGraph, subGraphs).nodes;
16438 subGraphs.push(subGraph);
16439 subGraphLookup[id] = subGraph;
16440 return id;
16441};
16442
16443var getPosForId = function getPosForId(id) {
16444 for (var i = 0; i < subGraphs.length; i++) {
16445 if (subGraphs[i].id === id) {
16446 return i;
16447 }
16448 }
16449
16450 return -1;
16451};
16452
16453var secCount = -1;
16454var posCrossRef = [];
16455
16456var indexNodes2 = function indexNodes2(id, pos) {
16457 var nodes = subGraphs[pos].nodes;
16458 secCount = secCount + 1;
16459
16460 if (secCount > 2000) {
16461 return;
16462 }
16463
16464 posCrossRef[secCount] = pos; // Check if match
16465
16466 if (subGraphs[pos].id === id) {
16467 return {
16468 result: true,
16469 count: 0
16470 };
16471 }
16472
16473 var count = 0;
16474 var posCount = 1;
16475
16476 while (count < nodes.length) {
16477 var childPos = getPosForId(nodes[count]); // Ignore regular nodes (pos will be -1)
16478
16479 if (childPos >= 0) {
16480 var res = indexNodes2(id, childPos);
16481
16482 if (res.result) {
16483 return {
16484 result: true,
16485 count: posCount + res.count
16486 };
16487 } else {
16488 posCount = posCount + res.count;
16489 }
16490 }
16491
16492 count = count + 1;
16493 }
16494
16495 return {
16496 result: false,
16497 count: posCount
16498 };
16499};
16500
16501var getDepthFirstPos = function getDepthFirstPos(pos) {
16502 return posCrossRef[pos];
16503};
16504var indexNodes = function indexNodes() {
16505 secCount = -1;
16506
16507 if (subGraphs.length > 0) {
16508 indexNodes2('none', subGraphs.length - 1, 0);
16509 }
16510};
16511var getSubGraphs = function getSubGraphs() {
16512 return subGraphs;
16513};
16514var firstGraph = function firstGraph() {
16515 if (firstGraphFlag) {
16516 firstGraphFlag = false;
16517 return true;
16518 }
16519
16520 return false;
16521};
16522
16523var destructStartLink = function destructStartLink(_str) {
16524 var str = _str.trim();
16525
16526 var type = 'arrow_open';
16527
16528 switch (str[0]) {
16529 case '<':
16530 type = 'arrow_point';
16531 str = str.slice(1);
16532 break;
16533
16534 case 'x':
16535 type = 'arrow_cross';
16536 str = str.slice(1);
16537 break;
16538
16539 case 'o':
16540 type = 'arrow_circle';
16541 str = str.slice(1);
16542 break;
16543 }
16544
16545 var stroke = 'normal';
16546
16547 if (str.indexOf('=') !== -1) {
16548 stroke = 'thick';
16549 }
16550
16551 if (str.indexOf('.') !== -1) {
16552 stroke = 'dotted';
16553 }
16554
16555 return {
16556 type: type,
16557 stroke: stroke
16558 };
16559};
16560
16561var countChar = function countChar(char, str) {
16562 var length = str.length;
16563 var count = 0;
16564
16565 for (var i = 0; i < length; ++i) {
16566 if (str[i] === char) {
16567 ++count;
16568 }
16569 }
16570
16571 return count;
16572};
16573
16574var destructEndLink = function destructEndLink(_str) {
16575 var str = _str.trim();
16576
16577 var line = str.slice(0, -1);
16578 var type = 'arrow_open';
16579
16580 switch (str.slice(-1)) {
16581 case 'x':
16582 type = 'arrow_cross';
16583
16584 if (str[0] === 'x') {
16585 type = 'double_' + type;
16586 line = line.slice(1);
16587 }
16588
16589 break;
16590
16591 case '>':
16592 type = 'arrow_point';
16593
16594 if (str[0] === '<') {
16595 type = 'double_' + type;
16596 line = line.slice(1);
16597 }
16598
16599 break;
16600
16601 case 'o':
16602 type = 'arrow_circle';
16603
16604 if (str[0] === 'o') {
16605 type = 'double_' + type;
16606 line = line.slice(1);
16607 }
16608
16609 break;
16610 }
16611
16612 var stroke = 'normal';
16613 var length = line.length - 1;
16614
16615 if (line[0] === '=') {
16616 stroke = 'thick';
16617 }
16618
16619 var dots = countChar('.', line);
16620
16621 if (dots) {
16622 stroke = 'dotted';
16623 length = dots;
16624 }
16625
16626 return {
16627 type: type,
16628 stroke: stroke,
16629 length: length
16630 };
16631};
16632
16633var destructLink = function destructLink(_str, _startStr) {
16634 var info = destructEndLink(_str);
16635 var startInfo;
16636
16637 if (_startStr) {
16638 startInfo = destructStartLink(_startStr);
16639
16640 if (startInfo.stroke !== info.stroke) {
16641 return {
16642 type: 'INVALID',
16643 stroke: 'INVALID'
16644 };
16645 }
16646
16647 if (startInfo.type === 'arrow_open') {
16648 // -- xyz --> - take arrow type from ending
16649 startInfo.type = info.type;
16650 } else {
16651 // x-- xyz --> - not supported
16652 if (startInfo.type !== info.type) return {
16653 type: 'INVALID',
16654 stroke: 'INVALID'
16655 };
16656 startInfo.type = 'double_' + startInfo.type;
16657 }
16658
16659 if (startInfo.type === 'double_arrow') {
16660 startInfo.type = 'double_arrow_point';
16661 }
16662
16663 startInfo.length = info.length;
16664 return startInfo;
16665 }
16666
16667 return info;
16668}; // Todo optimizer this by caching existing nodes
16669
16670
16671var exists = function exists(allSgs, _id) {
16672 var res = false;
16673 allSgs.forEach(function (sg) {
16674 var pos = sg.nodes.indexOf(_id);
16675
16676 if (pos >= 0) {
16677 res = true;
16678 }
16679 });
16680 return res;
16681};
16682/**
16683 * Deletes an id from all subgraphs
16684 */
16685
16686
16687var makeUniq = function makeUniq(sg, allSubgraphs) {
16688 var res = [];
16689 sg.nodes.forEach(function (_id, pos) {
16690 if (!exists(allSubgraphs, _id)) {
16691 res.push(sg.nodes[pos]);
16692 }
16693 });
16694 return {
16695 nodes: res
16696 };
16697};
16698
16699/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
16700 parseDirective: parseDirective,
16701 defaultConfig: function defaultConfig() {
16702 return _config__WEBPACK_IMPORTED_MODULE_1__.defaultConfig.flowchart;
16703 },
16704 addVertex: addVertex,
16705 lookUpDomId: lookUpDomId,
16706 addLink: addLink,
16707 updateLinkInterpolate: updateLinkInterpolate,
16708 updateLink: updateLink,
16709 addClass: addClass,
16710 setDirection: setDirection,
16711 setClass: setClass,
16712 setTooltip: setTooltip,
16713 getTooltip: getTooltip,
16714 setClickEvent: setClickEvent,
16715 setLink: setLink,
16716 bindFunctions: bindFunctions,
16717 getDirection: getDirection,
16718 getVertices: getVertices,
16719 getEdges: getEdges,
16720 getClasses: getClasses,
16721 clear: clear,
16722 setGen: setGen,
16723 defaultStyle: defaultStyle,
16724 addSubGraph: addSubGraph,
16725 getDepthFirstPos: getDepthFirstPos,
16726 indexNodes: indexNodes,
16727 getSubGraphs: getSubGraphs,
16728 destructLink: destructLink,
16729 lex: {
16730 firstGraph: firstGraph
16731 },
16732 exists: exists,
16733 makeUniq: makeUniq
16734});
16735
16736/***/ }),
16737
16738/***/ "./src/diagrams/flowchart/flowRenderer-v2.js":
16739/*!***************************************************!*\
16740 !*** ./src/diagrams/flowchart/flowRenderer-v2.js ***!
16741 \***************************************************/
16742/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
16743
16744"use strict";
16745__webpack_require__.r(__webpack_exports__);
16746/* harmony export */ __webpack_require__.d(__webpack_exports__, {
16747/* harmony export */ "setConf": () => (/* binding */ setConf),
16748/* harmony export */ "addVertices": () => (/* binding */ addVertices),
16749/* harmony export */ "addEdges": () => (/* binding */ addEdges),
16750/* harmony export */ "getClasses": () => (/* binding */ getClasses),
16751/* harmony export */ "draw": () => (/* binding */ draw),
16752/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
16753/* harmony export */ });
16754/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
16755/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
16756/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
16757/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
16758/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
16759/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
16760/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_8__);
16761/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
16762/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
16763/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
16764/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2__);
16765/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
16766/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
16767/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778var conf = {};
16779var setConf = function setConf(cnf) {
16780 var keys = Object.keys(cnf);
16781
16782 for (var i = 0; i < keys.length; i++) {
16783 conf[keys[i]] = cnf[keys[i]];
16784 }
16785};
16786/**
16787 * Function that adds the vertices found during parsing to the graph to be rendered.
16788 * @param vert Object containing the vertices.
16789 * @param g The graph that is to be drawn.
16790 */
16791
16792var addVertices = function addVertices(vert, g, svgId) {
16793 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(svgId, "\"]"));
16794 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
16795
16796 keys.forEach(function (id) {
16797 var vertex = vert[id];
16798 /**
16799 * Variable for storing the classes for the vertex
16800 * @type {string}
16801 */
16802
16803 var classStr = 'default';
16804
16805 if (vertex.classes.length > 0) {
16806 classStr = vertex.classes.join(' ');
16807 }
16808
16809 var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
16810
16811 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
16812
16813 var vertexNode;
16814
16815 if ((0,_common_common__WEBPACK_IMPORTED_MODULE_4__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.htmlLabels)) {
16816 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
16817 var node = {
16818 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
16819 return "<i class='".concat(s.replace(':', ' '), "'></i>");
16820 })
16821 };
16822 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_2___default()(svg, node).node();
16823 vertexNode.parentNode.removeChild(vertexNode);
16824 } else {
16825 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
16826 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
16827 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex);
16828
16829 for (var j = 0; j < rows.length; j++) {
16830 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
16831 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
16832 tspan.setAttribute('dy', '1em');
16833 tspan.setAttribute('x', '1');
16834 tspan.textContent = rows[j];
16835 svgLabel.appendChild(tspan);
16836 }
16837
16838 vertexNode = svgLabel;
16839 }
16840
16841 var radious = 0;
16842 var _shape = ''; // Set the shape based parameters
16843
16844 switch (vertex.type) {
16845 case 'round':
16846 radious = 5;
16847 _shape = 'rect';
16848 break;
16849
16850 case 'square':
16851 _shape = 'rect';
16852 break;
16853
16854 case 'diamond':
16855 _shape = 'question';
16856 break;
16857
16858 case 'hexagon':
16859 _shape = 'hexagon';
16860 break;
16861
16862 case 'odd':
16863 _shape = 'rect_left_inv_arrow';
16864 break;
16865
16866 case 'lean_right':
16867 _shape = 'lean_right';
16868 break;
16869
16870 case 'lean_left':
16871 _shape = 'lean_left';
16872 break;
16873
16874 case 'trapezoid':
16875 _shape = 'trapezoid';
16876 break;
16877
16878 case 'inv_trapezoid':
16879 _shape = 'inv_trapezoid';
16880 break;
16881
16882 case 'odd_right':
16883 _shape = 'rect_left_inv_arrow';
16884 break;
16885
16886 case 'circle':
16887 _shape = 'circle';
16888 break;
16889
16890 case 'ellipse':
16891 _shape = 'ellipse';
16892 break;
16893
16894 case 'stadium':
16895 _shape = 'stadium';
16896 break;
16897
16898 case 'subroutine':
16899 _shape = 'subroutine';
16900 break;
16901
16902 case 'cylinder':
16903 _shape = 'cylinder';
16904 break;
16905
16906 case 'group':
16907 _shape = 'rect';
16908 break;
16909
16910 default:
16911 _shape = 'rect';
16912 } // Add the node
16913
16914
16915 g.setNode(vertex.id, {
16916 labelStyle: styles.labelStyle,
16917 shape: _shape,
16918 labelText: vertexText,
16919 rx: radious,
16920 ry: radious,
16921 class: classStr,
16922 style: styles.style,
16923 id: vertex.id,
16924 link: vertex.link,
16925 linkTarget: vertex.linkTarget,
16926 tooltip: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getTooltip(vertex.id) || '',
16927 domId: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].lookUpDomId(vertex.id),
16928 haveCallback: vertex.haveCallback,
16929 width: vertex.type === 'group' ? 500 : undefined,
16930 dir: vertex.dir,
16931 type: vertex.type,
16932 padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
16933 });
16934 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('setNode', {
16935 labelStyle: styles.labelStyle,
16936 shape: _shape,
16937 labelText: vertexText,
16938 rx: radious,
16939 ry: radious,
16940 class: classStr,
16941 style: styles.style,
16942 id: vertex.id,
16943 domId: _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].lookUpDomId(vertex.id),
16944 width: vertex.type === 'group' ? 500 : undefined,
16945 type: vertex.type,
16946 dir: vertex.dir,
16947 padding: (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart.padding
16948 });
16949 });
16950};
16951/**
16952 * Add edges to graph based on parsed graph defninition
16953 * @param {Object} edges The edges to add to the graph
16954 * @param {Object} g The graph object
16955 */
16956
16957var addEdges = function addEdges(edges, g) {
16958 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 edges = ', edges);
16959 var cnt = 0;
16960 var linkIdCnt = {};
16961 var defaultStyle;
16962 var defaultLabelStyle;
16963
16964 if (typeof edges.defaultStyle !== 'undefined') {
16965 var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edges.defaultStyle);
16966 defaultStyle = defaultStyles.style;
16967 defaultLabelStyle = defaultStyles.labelStyle;
16968 }
16969
16970 edges.forEach(function (edge) {
16971 cnt++; // Identify Link
16972
16973 var linkIdBase = 'L-' + edge.start + '-' + edge.end; // count the links from+to the same node to give unique id
16974
16975 if (typeof linkIdCnt[linkIdBase] === 'undefined') {
16976 linkIdCnt[linkIdBase] = 0;
16977 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
16978 } else {
16979 linkIdCnt[linkIdBase]++;
16980 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new entry', linkIdBase, linkIdCnt[linkIdBase]);
16981 }
16982
16983 var linkId = linkIdBase + '-' + linkIdCnt[linkIdBase];
16984 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('abc78 new link id to be used is', linkIdBase, linkId, linkIdCnt[linkIdBase]);
16985 var linkNameStart = 'LS-' + edge.start;
16986 var linkNameEnd = 'LE-' + edge.end;
16987 var edgeData = {
16988 style: '',
16989 labelStyle: ''
16990 };
16991 edgeData.minlen = edge.length || 1; //edgeData.id = 'id' + cnt;
16992 // Set link type for rendering
16993
16994 if (edge.type === 'arrow_open') {
16995 edgeData.arrowhead = 'none';
16996 } else {
16997 edgeData.arrowhead = 'normal';
16998 } // Check of arrow types, placed here in order not to break old rendering
16999
17000
17001 edgeData.arrowTypeStart = 'arrow_open';
17002 edgeData.arrowTypeEnd = 'arrow_open';
17003 /* eslint-disable no-fallthrough */
17004
17005 switch (edge.type) {
17006 case 'double_arrow_cross':
17007 edgeData.arrowTypeStart = 'arrow_cross';
17008
17009 case 'arrow_cross':
17010 edgeData.arrowTypeEnd = 'arrow_cross';
17011 break;
17012
17013 case 'double_arrow_point':
17014 edgeData.arrowTypeStart = 'arrow_point';
17015
17016 case 'arrow_point':
17017 edgeData.arrowTypeEnd = 'arrow_point';
17018 break;
17019
17020 case 'double_arrow_circle':
17021 edgeData.arrowTypeStart = 'arrow_circle';
17022
17023 case 'arrow_circle':
17024 edgeData.arrowTypeEnd = 'arrow_circle';
17025 break;
17026 }
17027
17028 var style = '';
17029 var labelStyle = '';
17030
17031 switch (edge.stroke) {
17032 case 'normal':
17033 style = 'fill:none;';
17034
17035 if (typeof defaultStyle !== 'undefined') {
17036 style = defaultStyle;
17037 }
17038
17039 if (typeof defaultLabelStyle !== 'undefined') {
17040 labelStyle = defaultLabelStyle;
17041 }
17042
17043 edgeData.thickness = 'normal';
17044 edgeData.pattern = 'solid';
17045 break;
17046
17047 case 'dotted':
17048 edgeData.thickness = 'normal';
17049 edgeData.pattern = 'dotted';
17050 edgeData.style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
17051 break;
17052
17053 case 'thick':
17054 edgeData.thickness = 'thick';
17055 edgeData.pattern = 'solid';
17056 edgeData.style = 'stroke-width: 3.5px;fill:none;';
17057 break;
17058 }
17059
17060 if (typeof edge.style !== 'undefined') {
17061 var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.getStylesFromArray)(edge.style);
17062 style = styles.style;
17063 labelStyle = styles.labelStyle;
17064 }
17065
17066 edgeData.style = edgeData.style += style;
17067 edgeData.labelStyle = edgeData.labelStyle += labelStyle;
17068
17069 if (typeof edge.interpolate !== 'undefined') {
17070 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17071 } else if (typeof edges.defaultInterpolate !== 'undefined') {
17072 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17073 } else {
17074 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_3__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17075 }
17076
17077 if (typeof edge.text === 'undefined') {
17078 if (typeof edge.style !== 'undefined') {
17079 edgeData.arrowheadStyle = 'fill: #333';
17080 }
17081 } else {
17082 edgeData.arrowheadStyle = 'fill: #333';
17083 edgeData.labelpos = 'c';
17084 } // if (evaluate(getConfig().flowchart.htmlLabels) && false) {
17085 // // eslint-disable-line
17086 // edgeData.labelType = 'html';
17087 // edgeData.label = `<span id="L-${linkId}" class="edgeLabel L-${linkNameStart}' L-${linkNameEnd}">${edge.text}</span>`;
17088 // } else {
17089
17090
17091 edgeData.labelType = 'text';
17092 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_4__["default"].lineBreakRegex, '\n');
17093
17094 if (typeof edge.style === 'undefined') {
17095 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none;';
17096 }
17097
17098 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:'); // }
17099
17100 edgeData.id = linkId;
17101 edgeData.classes = 'flowchart-link ' + linkNameStart + ' ' + linkNameEnd; // Add the edge to the graph
17102
17103 g.setEdge(edge.start, edge.end, edgeData, cnt);
17104 });
17105};
17106/**
17107 * Returns the all the styles from classDef statements in the graph definition.
17108 * @returns {object} classDef styles
17109 */
17110
17111var getClasses = function getClasses(text) {
17112 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Extracting classes');
17113 _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].clear();
17114 var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_8___default().parser);
17115 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"];
17116
17117 try {
17118 // Parse the graph definition
17119 parser.parse(text);
17120 } catch (e) {
17121 return;
17122 }
17123
17124 return _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getClasses();
17125};
17126/**
17127 * Draws a flowchart in the tag with id: id based on the graph definition in text.
17128 * @param text
17129 * @param id
17130 */
17131
17132var draw = function draw(text, id) {
17133 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing flowchart');
17134 _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].clear();
17135 _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].setGen('gen-2');
17136 var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_8___default().parser);
17137 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"]; // Parse the graph definition
17138 // try {
17139
17140 parser.parse(text); // } catch (err) {
17141 // log.debug('Parsing failed');
17142 // }
17143 // Fetch the default direction, use TD if none was found
17144
17145 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getDirection();
17146
17147 if (typeof dir === 'undefined') {
17148 dir = 'TD';
17149 }
17150
17151 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().flowchart;
17152 var nodeSpacing = conf.nodeSpacing || 50;
17153 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
17154
17155 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
17156 multigraph: true,
17157 compound: true
17158 }).setGraph({
17159 rankdir: dir,
17160 nodesep: nodeSpacing,
17161 ranksep: rankSpacing,
17162 marginx: 8,
17163 marginy: 8
17164 }).setDefaultEdgeLabel(function () {
17165 return {};
17166 });
17167 var subG;
17168 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getSubGraphs();
17169 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Subgraphs - ', subGraphs);
17170
17171 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
17172 subG = subGraphs[_i];
17173 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Subgraph - ', subG);
17174 _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes, subG.dir);
17175 } // Fetch the verices/nodes and edges/links from the parsed graph definition
17176
17177
17178 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getVertices();
17179 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].getEdges();
17180 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info(edges);
17181 var i = 0;
17182
17183 for (i = subGraphs.length - 1; i >= 0; i--) {
17184 // for (let i = 0; i < subGraphs.length; i++) {
17185 subG = subGraphs[i];
17186 (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
17187
17188 for (var j = 0; j < subG.nodes.length; j++) {
17189 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Setting up subgraphs', subG.nodes[j], subG.id);
17190 g.setParent(subG.nodes[j], subG.id);
17191 }
17192 }
17193
17194 addVertices(vert, g, id);
17195 addEdges(edges, g); // Add custom shapes
17196 // flowChartShapes.addToRenderV2(addShape);
17197 // Set up an SVG group so that we can translate the final graph.
17198
17199 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]"));
17200 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink'); // Run the renderer. This is what draws the final graph.
17201
17202 var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
17203 (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_9__.render)(element, g, ['point', 'circle', 'cross'], 'flowchart', id);
17204 var padding = conf.diagramPadding;
17205 var svgBounds = svg.node().getBBox();
17206 var width = svgBounds.width + padding * 2;
17207 var height = svgBounds.height + padding * 2;
17208 _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("new ViewBox 0 0 ".concat(width, " ").concat(height), "translate(".concat(padding - g._label.marginx, ", ").concat(padding - g._label.marginy, ")"));
17209 (0,_utils__WEBPACK_IMPORTED_MODULE_3__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
17210 svg.attr('viewBox', "0 0 ".concat(width, " ").concat(height));
17211 svg.select('g').attr('transform', "translate(".concat(padding - g._label.marginx, ", ").concat(padding - svgBounds.y, ")")); // Index nodes
17212
17213 _flowDb__WEBPACK_IMPORTED_MODULE_6__["default"].indexNodes('subGraph' + i); // Add label rects for non html labels
17214
17215 if (!conf.htmlLabels) {
17216 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
17217
17218 for (var k = 0; k < labels.length; k++) {
17219 var label = labels[k]; // Get dimensions of label
17220
17221 var dim = label.getBBox();
17222 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
17223 rect.setAttribute('rx', 0);
17224 rect.setAttribute('ry', 0);
17225 rect.setAttribute('width', dim.width);
17226 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
17227
17228 label.insertBefore(rect, label.firstChild);
17229 }
17230 } // If node has a link, wrap it in an anchor SVG object.
17231
17232
17233 var keys = Object.keys(vert);
17234 keys.forEach(function (key) {
17235 var vertex = vert[key];
17236
17237 if (vertex.link) {
17238 var node = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' [id="' + key + '"]');
17239
17240 if (node) {
17241 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
17242 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
17243 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
17244 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
17245
17246 if (vertex.linkTarget) {
17247 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
17248 }
17249
17250 var linkNode = node.insert(function () {
17251 return link;
17252 }, ':first-child');
17253 var shape = node.select('.label-container');
17254
17255 if (shape) {
17256 linkNode.append(function () {
17257 return shape.node();
17258 });
17259 }
17260
17261 var _label = node.select('.label');
17262
17263 if (_label) {
17264 linkNode.append(function () {
17265 return _label.node();
17266 });
17267 }
17268 }
17269 }
17270 });
17271};
17272/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
17273 setConf: setConf,
17274 addVertices: addVertices,
17275 addEdges: addEdges,
17276 getClasses: getClasses,
17277 draw: draw
17278});
17279
17280/***/ }),
17281
17282/***/ "./src/diagrams/flowchart/flowRenderer.js":
17283/*!************************************************!*\
17284 !*** ./src/diagrams/flowchart/flowRenderer.js ***!
17285 \************************************************/
17286/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17287
17288"use strict";
17289__webpack_require__.r(__webpack_exports__);
17290/* harmony export */ __webpack_require__.d(__webpack_exports__, {
17291/* harmony export */ "setConf": () => (/* binding */ setConf),
17292/* harmony export */ "addVertices": () => (/* binding */ addVertices),
17293/* harmony export */ "addEdges": () => (/* binding */ addEdges),
17294/* harmony export */ "getClasses": () => (/* binding */ getClasses),
17295/* harmony export */ "draw": () => (/* binding */ draw),
17296/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
17297/* harmony export */ });
17298/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
17299/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
17300/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
17301/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
17302/* harmony import */ var _flowDb__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./flowDb */ "./src/diagrams/flowchart/flowDb.js");
17303/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
17304/* harmony import */ var _parser_flow__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_parser_flow__WEBPACK_IMPORTED_MODULE_9__);
17305/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
17306/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! dagre-d3 */ "dagre-d3");
17307/* harmony import */ var dagre_d3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(dagre_d3__WEBPACK_IMPORTED_MODULE_2__);
17308/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dagre-d3/lib/label/add-html-label.js */ "dagre-d3/lib/label/add-html-label.js");
17309/* harmony import */ var dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3__);
17310/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
17311/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
17312/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
17313/* harmony import */ var _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./flowChartShapes */ "./src/diagrams/flowchart/flowChartShapes.js");
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325var conf = {};
17326var setConf = function setConf(cnf) {
17327 var keys = Object.keys(cnf);
17328
17329 for (var i = 0; i < keys.length; i++) {
17330 conf[keys[i]] = cnf[keys[i]];
17331 }
17332};
17333/**
17334 * Function that adds the vertices found in the graph definition to the graph to be rendered.
17335 * @param vert Object containing the vertices.
17336 * @param g The graph that is to be drawn.
17337 */
17338
17339var addVertices = function addVertices(vert, g, svgId) {
17340 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(svgId, "\"]"));
17341 var keys = Object.keys(vert); // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition
17342
17343 keys.forEach(function (id) {
17344 var vertex = vert[id];
17345 /**
17346 * Variable for storing the classes for the vertex
17347 * @type {string}
17348 */
17349
17350 var classStr = 'default';
17351
17352 if (vertex.classes.length > 0) {
17353 classStr = vertex.classes.join(' ');
17354 }
17355
17356 var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(vertex.styles); // Use vertex id as text in the box if no text is provided by the graph definition
17357
17358 var vertexText = vertex.text !== undefined ? vertex.text : vertex.id; // We create a SVG label, either by delegating to addHtmlLabel or manually
17359
17360 var vertexNode;
17361
17362 if ((0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
17363 // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?
17364 var node = {
17365 label: vertexText.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
17366 return "<i class='".concat(s.replace(':', ' '), "'></i>");
17367 })
17368 };
17369 vertexNode = dagre_d3_lib_label_add_html_label_js__WEBPACK_IMPORTED_MODULE_3___default()(svg, node).node();
17370 vertexNode.parentNode.removeChild(vertexNode);
17371 } else {
17372 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
17373 svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));
17374 var rows = vertexText.split(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex);
17375
17376 for (var j = 0; j < rows.length; j++) {
17377 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
17378 tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');
17379 tspan.setAttribute('dy', '1em');
17380 tspan.setAttribute('x', '1');
17381 tspan.textContent = rows[j];
17382 svgLabel.appendChild(tspan);
17383 }
17384
17385 vertexNode = svgLabel;
17386 }
17387
17388 var radious = 0;
17389 var _shape = ''; // Set the shape based parameters
17390
17391 switch (vertex.type) {
17392 case 'round':
17393 radious = 5;
17394 _shape = 'rect';
17395 break;
17396
17397 case 'square':
17398 _shape = 'rect';
17399 break;
17400
17401 case 'diamond':
17402 _shape = 'question';
17403 break;
17404
17405 case 'hexagon':
17406 _shape = 'hexagon';
17407 break;
17408
17409 case 'odd':
17410 _shape = 'rect_left_inv_arrow';
17411 break;
17412
17413 case 'lean_right':
17414 _shape = 'lean_right';
17415 break;
17416
17417 case 'lean_left':
17418 _shape = 'lean_left';
17419 break;
17420
17421 case 'trapezoid':
17422 _shape = 'trapezoid';
17423 break;
17424
17425 case 'inv_trapezoid':
17426 _shape = 'inv_trapezoid';
17427 break;
17428
17429 case 'odd_right':
17430 _shape = 'rect_left_inv_arrow';
17431 break;
17432
17433 case 'circle':
17434 _shape = 'circle';
17435 break;
17436
17437 case 'ellipse':
17438 _shape = 'ellipse';
17439 break;
17440
17441 case 'stadium':
17442 _shape = 'stadium';
17443 break;
17444
17445 case 'subroutine':
17446 _shape = 'subroutine';
17447 break;
17448
17449 case 'cylinder':
17450 _shape = 'cylinder';
17451 break;
17452
17453 case 'group':
17454 _shape = 'rect';
17455 break;
17456
17457 default:
17458 _shape = 'rect';
17459 } // Add the node
17460
17461
17462 _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Adding node', vertex.id, vertex.domId);
17463 g.setNode(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(vertex.id), {
17464 labelType: 'svg',
17465 labelStyle: styles.labelStyle,
17466 shape: _shape,
17467 label: vertexNode,
17468 rx: radious,
17469 ry: radious,
17470 class: classStr,
17471 style: styles.style,
17472 id: _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(vertex.id)
17473 });
17474 });
17475};
17476/**
17477 * Add edges to graph based on parsed graph defninition
17478 * @param {Object} edges The edges to add to the graph
17479 * @param {Object} g The graph object
17480 */
17481
17482var addEdges = function addEdges(edges, g) {
17483 var cnt = 0;
17484 var defaultStyle;
17485 var defaultLabelStyle;
17486
17487 if (typeof edges.defaultStyle !== 'undefined') {
17488 var defaultStyles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(edges.defaultStyle);
17489 defaultStyle = defaultStyles.style;
17490 defaultLabelStyle = defaultStyles.labelStyle;
17491 }
17492
17493 edges.forEach(function (edge) {
17494 cnt++; // Identify Link
17495
17496 var linkId = 'L-' + edge.start + '-' + edge.end;
17497 var linkNameStart = 'LS-' + edge.start;
17498 var linkNameEnd = 'LE-' + edge.end;
17499 var edgeData = {}; // Set link type for rendering
17500
17501 if (edge.type === 'arrow_open') {
17502 edgeData.arrowhead = 'none';
17503 } else {
17504 edgeData.arrowhead = 'normal';
17505 }
17506
17507 var style = '';
17508 var labelStyle = '';
17509
17510 if (typeof edge.style !== 'undefined') {
17511 var styles = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.getStylesFromArray)(edge.style);
17512 style = styles.style;
17513 labelStyle = styles.labelStyle;
17514 } else {
17515 switch (edge.stroke) {
17516 case 'normal':
17517 style = 'fill:none';
17518
17519 if (typeof defaultStyle !== 'undefined') {
17520 style = defaultStyle;
17521 }
17522
17523 if (typeof defaultLabelStyle !== 'undefined') {
17524 labelStyle = defaultLabelStyle;
17525 }
17526
17527 break;
17528
17529 case 'dotted':
17530 style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';
17531 break;
17532
17533 case 'thick':
17534 style = ' stroke-width: 3.5px;fill:none';
17535 break;
17536 }
17537 }
17538
17539 edgeData.style = style;
17540 edgeData.labelStyle = labelStyle;
17541
17542 if (typeof edge.interpolate !== 'undefined') {
17543 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(edge.interpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17544 } else if (typeof edges.defaultInterpolate !== 'undefined') {
17545 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(edges.defaultInterpolate, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17546 } else {
17547 edgeData.curve = (0,_utils__WEBPACK_IMPORTED_MODULE_4__.interpolateToCurve)(conf.curve, d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear);
17548 }
17549
17550 if (typeof edge.text === 'undefined') {
17551 if (typeof edge.style !== 'undefined') {
17552 edgeData.arrowheadStyle = 'fill: #333';
17553 }
17554 } else {
17555 edgeData.arrowheadStyle = 'fill: #333';
17556 edgeData.labelpos = 'c';
17557
17558 if ((0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)((0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart.htmlLabels)) {
17559 edgeData.labelType = 'html';
17560 edgeData.label = "<span id=\"L-".concat(linkId, "\" class=\"edgeLabel L-").concat(linkNameStart, "' L-").concat(linkNameEnd, "\">").concat(edge.text.replace(/fa[lrsb]?:fa-[\w-]+/g, function (s) {
17561 return "<i class='".concat(s.replace(':', ' '), "'></i>");
17562 }), "</span>");
17563 } else {
17564 edgeData.labelType = 'text';
17565 edgeData.label = edge.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_5__["default"].lineBreakRegex, '\n');
17566
17567 if (typeof edge.style === 'undefined') {
17568 edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';
17569 }
17570
17571 edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');
17572 }
17573 }
17574
17575 edgeData.id = linkId;
17576 edgeData.class = linkNameStart + ' ' + linkNameEnd;
17577 edgeData.minlen = edge.length || 1; // Add the edge to the graph
17578
17579 g.setEdge(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(edge.start), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(edge.end), edgeData, cnt);
17580 });
17581};
17582/**
17583 * Returns the all the styles from classDef statements in the graph definition.
17584 * @returns {object} classDef styles
17585 */
17586
17587var getClasses = function getClasses(text) {
17588 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Extracting classes');
17589 _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
17590
17591 try {
17592 var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_9___default().parser);
17593 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"]; // Parse the graph definition
17594
17595 parser.parse(text);
17596 return _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getClasses();
17597 } catch (e) {
17598 return;
17599 }
17600};
17601/**
17602 * Draws a flowchart in the tag with id: id based on the graph definition in text.
17603 * @param text
17604 * @param id
17605 */
17606
17607var draw = function draw(text, id) {
17608 _logger__WEBPACK_IMPORTED_MODULE_7__.log.info('Drawing flowchart');
17609 _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].clear();
17610 _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].setGen('gen-1');
17611 var parser = (_parser_flow__WEBPACK_IMPORTED_MODULE_9___default().parser);
17612 parser.yy = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"]; // Parse the graph definition
17613 // try {
17614
17615 parser.parse(text); // } catch (err) {
17616 // log.debug('Parsing failed');
17617 // }
17618 // Fetch the default direction, use TD if none was found
17619
17620 var dir = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getDirection();
17621
17622 if (typeof dir === 'undefined') {
17623 dir = 'TD';
17624 }
17625
17626 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().flowchart;
17627 var nodeSpacing = conf.nodeSpacing || 50;
17628 var rankSpacing = conf.rankSpacing || 50; // Create the input mermaid.graph
17629
17630 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
17631 multigraph: true,
17632 compound: true
17633 }).setGraph({
17634 rankdir: dir,
17635 nodesep: nodeSpacing,
17636 ranksep: rankSpacing,
17637 marginx: 8,
17638 marginy: 8
17639 }).setDefaultEdgeLabel(function () {
17640 return {};
17641 });
17642 var subG;
17643 var subGraphs = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getSubGraphs();
17644
17645 for (var _i = subGraphs.length - 1; _i >= 0; _i--) {
17646 subG = subGraphs[_i];
17647 _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
17648 } // Fetch the verices/nodes and edges/links from the parsed graph definition
17649
17650
17651 var vert = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getVertices();
17652 _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Get vertices', vert);
17653 var edges = _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getEdges();
17654 var i = 0;
17655
17656 for (i = subGraphs.length - 1; i >= 0; i--) {
17657 subG = subGraphs[i];
17658 (0,d3__WEBPACK_IMPORTED_MODULE_1__.selectAll)('cluster').append('text');
17659
17660 for (var j = 0; j < subG.nodes.length; j++) {
17661 _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn('Setting subgraph', subG.nodes[j], _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id));
17662 g.setParent(_flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.nodes[j]), _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id));
17663 }
17664 }
17665
17666 addVertices(vert, g, id);
17667 addEdges(edges, g); // Create the renderer
17668
17669 var Render = (dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().render);
17670 var render = new Render(); // Add custom shapes
17671
17672 _flowChartShapes__WEBPACK_IMPORTED_MODULE_10__["default"].addToRender(render); // Add our custom arrow - an empty arrowhead
17673
17674 render.arrows().none = function normal(parent, id, edge, type) {
17675 var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
17676 var path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');
17677 dagre_d3__WEBPACK_IMPORTED_MODULE_2___default().util.applyStyle(path, edge[type + 'Style']);
17678 }; // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.
17679
17680
17681 render.arrows().normal = function normal(parent, id) {
17682 var marker = parent.append('marker').attr('id', id).attr('viewBox', '0 0 10 10').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'strokeWidth').attr('markerWidth', 8).attr('markerHeight', 6).attr('orient', 'auto');
17683 marker.append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z').attr('class', 'arrowheadPath').style('stroke-width', 1).style('stroke-dasharray', '1,0');
17684 }; // Set up an SVG group so that we can translate the final graph.
17685
17686
17687 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]"));
17688 svg.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
17689 _logger__WEBPACK_IMPORTED_MODULE_7__.log.warn(g); // Run the renderer. This is what draws the final graph.
17690
17691 var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
17692 render(element, g);
17693 element.selectAll('g.node').attr('title', function () {
17694 return _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].getTooltip(this.id);
17695 });
17696 var padding = conf.diagramPadding;
17697 var svgBounds = svg.node().getBBox();
17698 var width = svgBounds.width + padding * 2;
17699 var height = svgBounds.height + padding * 2;
17700 (0,_utils__WEBPACK_IMPORTED_MODULE_4__.configureSvgSize)(svg, height, width, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
17701
17702 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
17703 _logger__WEBPACK_IMPORTED_MODULE_7__.log.debug("viewBox ".concat(vBox));
17704 svg.attr('viewBox', vBox); // Index nodes
17705
17706 _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].indexNodes('subGraph' + i); // reposition labels
17707
17708 for (i = 0; i < subGraphs.length; i++) {
17709 subG = subGraphs[i];
17710
17711 if (subG.title !== 'undefined') {
17712 var clusterRects = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id) + '"] rect');
17713 var clusterEl = document.querySelectorAll('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(subG.id) + '"]');
17714 var xPos = clusterRects[0].x.baseVal.value;
17715 var yPos = clusterRects[0].y.baseVal.value;
17716 var _width = clusterRects[0].width.baseVal.value;
17717 var cluster = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)(clusterEl[0]);
17718 var te = cluster.select('.label');
17719 te.attr('transform', "translate(".concat(xPos + _width / 2, ", ").concat(yPos + 14, ")"));
17720 te.attr('id', id + 'Text');
17721
17722 for (var _j = 0; _j < subG.classes.length; _j++) {
17723 clusterEl[0].classList.add(subG.classes[_j]);
17724 }
17725 }
17726 } // Add label rects for non html labels
17727
17728
17729 if (!(0,_common_common__WEBPACK_IMPORTED_MODULE_5__.evaluate)(conf.htmlLabels) || true) {
17730 // eslint-disable-line
17731 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
17732
17733 for (var k = 0; k < labels.length; k++) {
17734 var label = labels[k]; // Get dimensions of label
17735
17736 var dim = label.getBBox();
17737 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
17738 rect.setAttribute('rx', 0);
17739 rect.setAttribute('ry', 0);
17740 rect.setAttribute('width', dim.width);
17741 rect.setAttribute('height', dim.height); // rect.setAttribute('style', 'fill:#e8e8e8;');
17742
17743 label.insertBefore(rect, label.firstChild);
17744 }
17745 } // If node has a link, wrap it in an anchor SVG object.
17746
17747
17748 var keys = Object.keys(vert);
17749 keys.forEach(function (key) {
17750 var vertex = vert[key];
17751
17752 if (vertex.link) {
17753 var node = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' [id="' + _flowDb__WEBPACK_IMPORTED_MODULE_8__["default"].lookUpDomId(key) + '"]');
17754
17755 if (node) {
17756 var link = document.createElementNS('http://www.w3.org/2000/svg', 'a');
17757 link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));
17758 link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);
17759 link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');
17760
17761 if (vertex.linkTarget) {
17762 link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);
17763 }
17764
17765 var linkNode = node.insert(function () {
17766 return link;
17767 }, ':first-child');
17768 var shape = node.select('.label-container');
17769
17770 if (shape) {
17771 linkNode.append(function () {
17772 return shape.node();
17773 });
17774 }
17775
17776 var _label = node.select('.label');
17777
17778 if (_label) {
17779 linkNode.append(function () {
17780 return _label.node();
17781 });
17782 }
17783 }
17784 }
17785 });
17786};
17787/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
17788 setConf: setConf,
17789 addVertices: addVertices,
17790 addEdges: addEdges,
17791 getClasses: getClasses,
17792 draw: draw
17793});
17794
17795/***/ }),
17796
17797/***/ "./src/diagrams/flowchart/styles.js":
17798/*!******************************************!*\
17799 !*** ./src/diagrams/flowchart/styles.js ***!
17800 \******************************************/
17801/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17802
17803"use strict";
17804__webpack_require__.r(__webpack_exports__);
17805/* harmony export */ __webpack_require__.d(__webpack_exports__, {
17806/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
17807/* harmony export */ });
17808/**
17809 * Returns the styles given options
17810 * @param {{ fontFamily: string; nodeTextColor: string; textColor: string; titleColor: string; mainBkg: string; nodeBorder: string; arrowheadColor: string; lineColor: string; edgeLabelBackground: string; clusterBkg: string; clusterBorder: string; tertiaryColor: string; border2: string; }} options The options for the styles
17811 * @returns {string} The resulting styles
17812 */
17813var getStyles = function getStyles(options) {
17814 return ".label {\n font-family: ".concat(options.fontFamily, ";\n color: ").concat(options.nodeTextColor || options.textColor, ";\n }\n .cluster-label text {\n fill: ").concat(options.titleColor, ";\n }\n .cluster-label span {\n color: ").concat(options.titleColor, ";\n }\n\n .label text,span {\n fill: ").concat(options.nodeTextColor || options.textColor, ";\n color: ").concat(options.nodeTextColor || options.textColor, ";\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n background-color: ").concat(options.edgeLabelBackground, ";\n fill: ").concat(options.edgeLabelBackground, ";\n }\n text-align: center;\n }\n\n .cluster rect {\n fill: ").concat(options.clusterBkg, ";\n stroke: ").concat(options.clusterBorder, ";\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n .cluster span {\n color: ").concat(options.titleColor, ";\n }\n /* .cluster div {\n color: ").concat(options.titleColor, ";\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ").concat(options.fontFamily, ";\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n");
17815};
17816
17817/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
17818
17819/***/ }),
17820
17821/***/ "./src/diagrams/gantt/ganttDb.js":
17822/*!***************************************!*\
17823 !*** ./src/diagrams/gantt/ganttDb.js ***!
17824 \***************************************/
17825/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
17826
17827"use strict";
17828__webpack_require__.r(__webpack_exports__);
17829/* harmony export */ __webpack_require__.d(__webpack_exports__, {
17830/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
17831/* harmony export */ "clear": () => (/* binding */ clear),
17832/* harmony export */ "setAxisFormat": () => (/* binding */ setAxisFormat),
17833/* harmony export */ "getAxisFormat": () => (/* binding */ getAxisFormat),
17834/* harmony export */ "setTodayMarker": () => (/* binding */ setTodayMarker),
17835/* harmony export */ "getTodayMarker": () => (/* binding */ getTodayMarker),
17836/* harmony export */ "setDateFormat": () => (/* binding */ setDateFormat),
17837/* harmony export */ "enableInclusiveEndDates": () => (/* binding */ enableInclusiveEndDates),
17838/* harmony export */ "endDatesAreInclusive": () => (/* binding */ endDatesAreInclusive),
17839/* harmony export */ "enableTopAxis": () => (/* binding */ enableTopAxis),
17840/* harmony export */ "topAxisEnabled": () => (/* binding */ topAxisEnabled),
17841/* harmony export */ "getDateFormat": () => (/* binding */ getDateFormat),
17842/* harmony export */ "setIncludes": () => (/* binding */ setIncludes),
17843/* harmony export */ "getIncludes": () => (/* binding */ getIncludes),
17844/* harmony export */ "setExcludes": () => (/* binding */ setExcludes),
17845/* harmony export */ "getExcludes": () => (/* binding */ getExcludes),
17846/* harmony export */ "setTitle": () => (/* binding */ setTitle),
17847/* harmony export */ "getTitle": () => (/* binding */ getTitle),
17848/* harmony export */ "addSection": () => (/* binding */ addSection),
17849/* harmony export */ "getSections": () => (/* binding */ getSections),
17850/* harmony export */ "getTasks": () => (/* binding */ getTasks),
17851/* harmony export */ "isInvalidDate": () => (/* binding */ isInvalidDate),
17852/* harmony export */ "addTask": () => (/* binding */ addTask),
17853/* harmony export */ "findTaskById": () => (/* binding */ findTaskById),
17854/* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
17855/* harmony export */ "setLink": () => (/* binding */ setLink),
17856/* harmony export */ "setClass": () => (/* binding */ setClass),
17857/* harmony export */ "setClickEvent": () => (/* binding */ setClickEvent),
17858/* harmony export */ "bindFunctions": () => (/* binding */ bindFunctions),
17859/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
17860/* harmony export */ });
17861/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
17862/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
17863/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
17864/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__);
17865/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
17866/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
17867/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
17868/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
17869function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
17870
17871function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17872
17873function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17874
17875function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
17876
17877function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
17878
17879function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
17880
17881
17882
17883
17884
17885
17886
17887var dateFormat = '';
17888var axisFormat = '';
17889var todayMarker = '';
17890var includes = [];
17891var excludes = [];
17892var title = '';
17893var sections = [];
17894var tasks = [];
17895var currentSection = '';
17896var tags = ['active', 'done', 'crit', 'milestone'];
17897var funs = [];
17898var inclusiveEndDates = false;
17899var topAxis = false; // The serial order of the task in the script
17900
17901var lastOrder = 0;
17902var parseDirective = function parseDirective(statement, context, type) {
17903 _mermaidAPI__WEBPACK_IMPORTED_MODULE_2__["default"].parseDirective(this, statement, context, type);
17904};
17905var clear = function clear() {
17906 sections = [];
17907 tasks = [];
17908 currentSection = '';
17909 funs = [];
17910 title = '';
17911 taskCnt = 0;
17912 lastTask = undefined;
17913 lastTaskID = undefined;
17914 rawTasks = [];
17915 dateFormat = '';
17916 axisFormat = '';
17917 todayMarker = '';
17918 includes = [];
17919 excludes = [];
17920 inclusiveEndDates = false;
17921 topAxis = false;
17922 lastOrder = 0;
17923};
17924var setAxisFormat = function setAxisFormat(txt) {
17925 axisFormat = txt;
17926};
17927var getAxisFormat = function getAxisFormat() {
17928 return axisFormat;
17929};
17930var setTodayMarker = function setTodayMarker(txt) {
17931 todayMarker = txt;
17932};
17933var getTodayMarker = function getTodayMarker() {
17934 return todayMarker;
17935};
17936var setDateFormat = function setDateFormat(txt) {
17937 dateFormat = txt;
17938};
17939var enableInclusiveEndDates = function enableInclusiveEndDates() {
17940 inclusiveEndDates = true;
17941};
17942var endDatesAreInclusive = function endDatesAreInclusive() {
17943 return inclusiveEndDates;
17944};
17945var enableTopAxis = function enableTopAxis() {
17946 topAxis = true;
17947};
17948var topAxisEnabled = function topAxisEnabled() {
17949 return topAxis;
17950};
17951var getDateFormat = function getDateFormat() {
17952 return dateFormat;
17953};
17954var setIncludes = function setIncludes(txt) {
17955 includes = txt.toLowerCase().split(/[\s,]+/);
17956};
17957var getIncludes = function getIncludes() {
17958 return includes;
17959};
17960var setExcludes = function setExcludes(txt) {
17961 excludes = txt.toLowerCase().split(/[\s,]+/);
17962};
17963var getExcludes = function getExcludes() {
17964 return excludes;
17965};
17966var setTitle = function setTitle(txt) {
17967 title = txt;
17968};
17969var getTitle = function getTitle() {
17970 return title;
17971};
17972var addSection = function addSection(txt) {
17973 currentSection = txt;
17974 sections.push(txt);
17975};
17976var getSections = function getSections() {
17977 return sections;
17978};
17979var getTasks = function getTasks() {
17980 var allItemsPricessed = compileTasks();
17981 var maxDepth = 10;
17982 var iterationCount = 0;
17983
17984 while (!allItemsPricessed && iterationCount < maxDepth) {
17985 allItemsPricessed = compileTasks();
17986 iterationCount++;
17987 }
17988
17989 tasks = rawTasks;
17990 return tasks;
17991};
17992var isInvalidDate = function isInvalidDate(date, dateFormat, excludes, includes) {
17993 if (includes.indexOf(date.format(dateFormat.trim())) >= 0) {
17994 return false;
17995 }
17996
17997 if (date.isoWeekday() >= 6 && excludes.indexOf('weekends') >= 0) {
17998 return true;
17999 }
18000
18001 if (excludes.indexOf(date.format('dddd').toLowerCase()) >= 0) {
18002 return true;
18003 }
18004
18005 return excludes.indexOf(date.format(dateFormat.trim())) >= 0;
18006};
18007
18008var checkTaskDates = function checkTaskDates(task, dateFormat, excludes, includes) {
18009 if (!excludes.length || task.manualEndTime) return;
18010 var startTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.startTime, dateFormat, true);
18011 startTime.add(1, 'd');
18012 var endTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(task.endTime, dateFormat, true);
18013 var renderEndTime = fixTaskDates(startTime, endTime, dateFormat, excludes, includes);
18014 task.endTime = endTime.toDate();
18015 task.renderEndTime = renderEndTime;
18016};
18017
18018var fixTaskDates = function fixTaskDates(startTime, endTime, dateFormat, excludes, includes) {
18019 var invalid = false;
18020 var renderEndTime = null;
18021
18022 while (startTime <= endTime) {
18023 if (!invalid) {
18024 renderEndTime = endTime.toDate();
18025 }
18026
18027 invalid = isInvalidDate(startTime, dateFormat, excludes, includes);
18028
18029 if (invalid) {
18030 endTime.add(1, 'd');
18031 }
18032
18033 startTime.add(1, 'd');
18034 }
18035
18036 return renderEndTime;
18037};
18038
18039var getStartDate = function getStartDate(prevTime, dateFormat, str) {
18040 str = str.trim(); // Test for after
18041
18042 var re = /^after\s+([\d\w- ]+)/;
18043 var afterStatement = re.exec(str.trim());
18044
18045 if (afterStatement !== null) {
18046 // check all after ids and take the latest
18047 var latestEndingTask = null;
18048 afterStatement[1].split(' ').forEach(function (id) {
18049 var task = findTaskById(id);
18050
18051 if (typeof task !== 'undefined') {
18052 if (!latestEndingTask) {
18053 latestEndingTask = task;
18054 } else {
18055 if (task.endTime > latestEndingTask.endTime) {
18056 latestEndingTask = task;
18057 }
18058 }
18059 }
18060 });
18061
18062 if (!latestEndingTask) {
18063 var dt = new Date();
18064 dt.setHours(0, 0, 0, 0);
18065 return dt;
18066 } else {
18067 return latestEndingTask.endTime;
18068 }
18069 } // Check for actual date set
18070
18071
18072 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
18073
18074 if (mDate.isValid()) {
18075 return mDate.toDate();
18076 } else {
18077 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Invalid date:' + str);
18078 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('With date format:' + dateFormat.trim());
18079 } // Default date - now
18080
18081
18082 return new Date();
18083};
18084
18085var durationToDate = function durationToDate(durationStatement, relativeTime) {
18086 if (durationStatement !== null) {
18087 switch (durationStatement[2]) {
18088 case 's':
18089 relativeTime.add(durationStatement[1], 'seconds');
18090 break;
18091
18092 case 'm':
18093 relativeTime.add(durationStatement[1], 'minutes');
18094 break;
18095
18096 case 'h':
18097 relativeTime.add(durationStatement[1], 'hours');
18098 break;
18099
18100 case 'd':
18101 relativeTime.add(durationStatement[1], 'days');
18102 break;
18103
18104 case 'w':
18105 relativeTime.add(durationStatement[1], 'weeks');
18106 break;
18107 }
18108 } // Default date - now
18109
18110
18111 return relativeTime.toDate();
18112};
18113
18114var getEndDate = function getEndDate(prevTime, dateFormat, str, inclusive) {
18115 inclusive = inclusive || false;
18116 str = str.trim(); // Check for actual date
18117
18118 var mDate = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(str, dateFormat.trim(), true);
18119
18120 if (mDate.isValid()) {
18121 if (inclusive) {
18122 mDate.add(1, 'd');
18123 }
18124
18125 return mDate.toDate();
18126 }
18127
18128 return durationToDate(/^([\d]+)([wdhms])/.exec(str.trim()), moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(prevTime));
18129};
18130
18131var taskCnt = 0;
18132
18133var parseId = function parseId(idStr) {
18134 if (typeof idStr === 'undefined') {
18135 taskCnt = taskCnt + 1;
18136 return 'task' + taskCnt;
18137 }
18138
18139 return idStr;
18140}; // id, startDate, endDate
18141// id, startDate, length
18142// id, after x, endDate
18143// id, after x, length
18144// startDate, endDate
18145// startDate, length
18146// after x, endDate
18147// after x, length
18148// endDate
18149// length
18150
18151
18152var compileData = function compileData(prevTask, dataStr) {
18153 var ds;
18154
18155 if (dataStr.substr(0, 1) === ':') {
18156 ds = dataStr.substr(1, dataStr.length);
18157 } else {
18158 ds = dataStr;
18159 }
18160
18161 var data = ds.split(',');
18162 var task = {}; // Get tags like active, done, crit and milestone
18163
18164 getTaskTags(data, task, tags);
18165
18166 for (var i = 0; i < data.length; i++) {
18167 data[i] = data[i].trim();
18168 }
18169
18170 var endTimeData = '';
18171
18172 switch (data.length) {
18173 case 1:
18174 task.id = parseId();
18175 task.startTime = prevTask.endTime;
18176 endTimeData = data[0];
18177 break;
18178
18179 case 2:
18180 task.id = parseId();
18181 task.startTime = getStartDate(undefined, dateFormat, data[0]);
18182 endTimeData = data[1];
18183 break;
18184
18185 case 3:
18186 task.id = parseId(data[0]);
18187 task.startTime = getStartDate(undefined, dateFormat, data[1]);
18188 endTimeData = data[2];
18189 break;
18190
18191 default:
18192 }
18193
18194 if (endTimeData) {
18195 task.endTime = getEndDate(task.startTime, dateFormat, endTimeData, inclusiveEndDates);
18196 task.manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(endTimeData, 'YYYY-MM-DD', true).isValid();
18197 checkTaskDates(task, dateFormat, excludes, includes);
18198 }
18199
18200 return task;
18201};
18202
18203var parseData = function parseData(prevTaskId, dataStr) {
18204 var ds;
18205
18206 if (dataStr.substr(0, 1) === ':') {
18207 ds = dataStr.substr(1, dataStr.length);
18208 } else {
18209 ds = dataStr;
18210 }
18211
18212 var data = ds.split(',');
18213 var task = {}; // Get tags like active, done, crit and milestone
18214
18215 getTaskTags(data, task, tags);
18216
18217 for (var i = 0; i < data.length; i++) {
18218 data[i] = data[i].trim();
18219 }
18220
18221 switch (data.length) {
18222 case 1:
18223 task.id = parseId();
18224 task.startTime = {
18225 type: 'prevTaskEnd',
18226 id: prevTaskId
18227 };
18228 task.endTime = {
18229 data: data[0]
18230 };
18231 break;
18232
18233 case 2:
18234 task.id = parseId();
18235 task.startTime = {
18236 type: 'getStartDate',
18237 startData: data[0]
18238 };
18239 task.endTime = {
18240 data: data[1]
18241 };
18242 break;
18243
18244 case 3:
18245 task.id = parseId(data[0]);
18246 task.startTime = {
18247 type: 'getStartDate',
18248 startData: data[1]
18249 };
18250 task.endTime = {
18251 data: data[2]
18252 };
18253 break;
18254
18255 default:
18256 }
18257
18258 return task;
18259};
18260
18261var lastTask;
18262var lastTaskID;
18263var rawTasks = [];
18264var taskDb = {};
18265var addTask = function addTask(descr, data) {
18266 var rawTask = {
18267 section: currentSection,
18268 type: currentSection,
18269 processed: false,
18270 manualEndTime: false,
18271 renderEndTime: null,
18272 raw: {
18273 data: data
18274 },
18275 task: descr,
18276 classes: []
18277 };
18278 var taskInfo = parseData(lastTaskID, data);
18279 rawTask.raw.startTime = taskInfo.startTime;
18280 rawTask.raw.endTime = taskInfo.endTime;
18281 rawTask.id = taskInfo.id;
18282 rawTask.prevTaskId = lastTaskID;
18283 rawTask.active = taskInfo.active;
18284 rawTask.done = taskInfo.done;
18285 rawTask.crit = taskInfo.crit;
18286 rawTask.milestone = taskInfo.milestone;
18287 rawTask.order = lastOrder;
18288 lastOrder++;
18289 var pos = rawTasks.push(rawTask);
18290 lastTaskID = rawTask.id; // Store cross ref
18291
18292 taskDb[rawTask.id] = pos - 1;
18293};
18294var findTaskById = function findTaskById(id) {
18295 var pos = taskDb[id];
18296 return rawTasks[pos];
18297};
18298var addTaskOrg = function addTaskOrg(descr, data) {
18299 var newTask = {
18300 section: currentSection,
18301 type: currentSection,
18302 description: descr,
18303 task: descr,
18304 classes: []
18305 };
18306 var taskInfo = compileData(lastTask, data);
18307 newTask.startTime = taskInfo.startTime;
18308 newTask.endTime = taskInfo.endTime;
18309 newTask.id = taskInfo.id;
18310 newTask.active = taskInfo.active;
18311 newTask.done = taskInfo.done;
18312 newTask.crit = taskInfo.crit;
18313 newTask.milestone = taskInfo.milestone;
18314 lastTask = newTask;
18315 tasks.push(newTask);
18316};
18317
18318var compileTasks = function compileTasks() {
18319 var compileTask = function compileTask(pos) {
18320 var task = rawTasks[pos];
18321 var startTime = '';
18322
18323 switch (rawTasks[pos].raw.startTime.type) {
18324 case 'prevTaskEnd':
18325 {
18326 var prevTask = findTaskById(task.prevTaskId);
18327 task.startTime = prevTask.endTime;
18328 break;
18329 }
18330
18331 case 'getStartDate':
18332 startTime = getStartDate(undefined, dateFormat, rawTasks[pos].raw.startTime.startData);
18333
18334 if (startTime) {
18335 rawTasks[pos].startTime = startTime;
18336 }
18337
18338 break;
18339 }
18340
18341 if (rawTasks[pos].startTime) {
18342 rawTasks[pos].endTime = getEndDate(rawTasks[pos].startTime, dateFormat, rawTasks[pos].raw.endTime.data, inclusiveEndDates);
18343
18344 if (rawTasks[pos].endTime) {
18345 rawTasks[pos].processed = true;
18346 rawTasks[pos].manualEndTime = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(rawTasks[pos].raw.endTime.data, 'YYYY-MM-DD', true).isValid();
18347 checkTaskDates(rawTasks[pos], dateFormat, excludes, includes);
18348 }
18349 }
18350
18351 return rawTasks[pos].processed;
18352 };
18353
18354 var allProcessed = true;
18355
18356 for (var i = 0; i < rawTasks.length; i++) {
18357 compileTask(i);
18358 allProcessed = allProcessed && rawTasks[i].processed;
18359 }
18360
18361 return allProcessed;
18362};
18363/**
18364 * Called by parser when a link is found. Adds the URL to the vertex data.
18365 * @param ids Comma separated list of ids
18366 * @param linkStr URL to create a link for
18367 */
18368
18369
18370var setLink = function setLink(ids, _linkStr) {
18371 var linkStr = _linkStr;
18372
18373 if (_config__WEBPACK_IMPORTED_MODULE_4__.getConfig().securityLevel !== 'loose') {
18374 linkStr = (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_1__.sanitizeUrl)(_linkStr);
18375 }
18376
18377 ids.split(',').forEach(function (id) {
18378 var rawTask = findTaskById(id);
18379
18380 if (typeof rawTask !== 'undefined') {
18381 pushFun(id, function () {
18382 window.open(linkStr, '_self');
18383 });
18384 }
18385 });
18386 setClass(ids, 'clickable');
18387};
18388/**
18389 * Called by parser when a special node is found, e.g. a clickable element.
18390 * @param ids Comma separated list of ids
18391 * @param className Class to add
18392 */
18393
18394var setClass = function setClass(ids, className) {
18395 ids.split(',').forEach(function (id) {
18396 var rawTask = findTaskById(id);
18397
18398 if (typeof rawTask !== 'undefined') {
18399 rawTask.classes.push(className);
18400 }
18401 });
18402};
18403
18404var setClickFun = function setClickFun(id, functionName, functionArgs) {
18405 if (_config__WEBPACK_IMPORTED_MODULE_4__.getConfig().securityLevel !== 'loose') {
18406 return;
18407 }
18408
18409 if (typeof functionName === 'undefined') {
18410 return;
18411 }
18412
18413 var argList = [];
18414
18415 if (typeof functionArgs === 'string') {
18416 /* Splits functionArgs by ',', ignoring all ',' in double quoted strings */
18417 argList = functionArgs.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
18418
18419 for (var i = 0; i < argList.length; i++) {
18420 var item = argList[i].trim();
18421 /* Removes all double quotes at the start and end of an argument */
18422
18423 /* This preserves all starting and ending whitespace inside */
18424
18425 if (item.charAt(0) === '"' && item.charAt(item.length - 1) === '"') {
18426 item = item.substr(1, item.length - 2);
18427 }
18428
18429 argList[i] = item;
18430 }
18431 }
18432 /* if no arguments passed into callback, default to passing in id */
18433
18434
18435 if (argList.length === 0) {
18436 argList.push(id);
18437 }
18438
18439 var rawTask = findTaskById(id);
18440
18441 if (typeof rawTask !== 'undefined') {
18442 pushFun(id, function () {
18443 _utils__WEBPACK_IMPORTED_MODULE_5__["default"].runFunc.apply(_utils__WEBPACK_IMPORTED_MODULE_5__["default"], [functionName].concat(_toConsumableArray(argList)));
18444 });
18445 }
18446};
18447/**
18448 * The callbackFunction is executed in a click event bound to the task with the specified id or the task's assigned text
18449 * @param id The task's id
18450 * @param callbackFunction A function to be executed when clicked on the task or the task's text
18451 */
18452
18453
18454var pushFun = function pushFun(id, callbackFunction) {
18455 funs.push(function () {
18456 // const elem = d3.select(element).select(`[id="${id}"]`)
18457 var elem = document.querySelector("[id=\"".concat(id, "\"]"));
18458
18459 if (elem !== null) {
18460 elem.addEventListener('click', function () {
18461 callbackFunction();
18462 });
18463 }
18464 });
18465 funs.push(function () {
18466 // const elem = d3.select(element).select(`[id="${id}-text"]`)
18467 var elem = document.querySelector("[id=\"".concat(id, "-text\"]"));
18468
18469 if (elem !== null) {
18470 elem.addEventListener('click', function () {
18471 callbackFunction();
18472 });
18473 }
18474 });
18475};
18476/**
18477 * Called by parser when a click definition is found. Registers an event handler.
18478 * @param ids Comma separated list of ids
18479 * @param functionName Function to be called on click
18480 * @param functionArgs Function args the function should be called with
18481 */
18482
18483
18484var setClickEvent = function setClickEvent(ids, functionName, functionArgs) {
18485 ids.split(',').forEach(function (id) {
18486 setClickFun(id, functionName, functionArgs);
18487 });
18488 setClass(ids, 'clickable');
18489};
18490/**
18491 * Binds all functions previously added to fun (specified through click) to the element
18492 * @param element
18493 */
18494
18495var bindFunctions = function bindFunctions(element) {
18496 funs.forEach(function (fun) {
18497 fun(element);
18498 });
18499};
18500/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
18501 parseDirective: parseDirective,
18502 getConfig: function getConfig() {
18503 return _config__WEBPACK_IMPORTED_MODULE_4__.getConfig().gantt;
18504 },
18505 clear: clear,
18506 setDateFormat: setDateFormat,
18507 getDateFormat: getDateFormat,
18508 enableInclusiveEndDates: enableInclusiveEndDates,
18509 endDatesAreInclusive: endDatesAreInclusive,
18510 enableTopAxis: enableTopAxis,
18511 topAxisEnabled: topAxisEnabled,
18512 setAxisFormat: setAxisFormat,
18513 getAxisFormat: getAxisFormat,
18514 setTodayMarker: setTodayMarker,
18515 getTodayMarker: getTodayMarker,
18516 setTitle: setTitle,
18517 getTitle: getTitle,
18518 addSection: addSection,
18519 getSections: getSections,
18520 getTasks: getTasks,
18521 addTask: addTask,
18522 findTaskById: findTaskById,
18523 addTaskOrg: addTaskOrg,
18524 setIncludes: setIncludes,
18525 getIncludes: getIncludes,
18526 setExcludes: setExcludes,
18527 getExcludes: getExcludes,
18528 setClickEvent: setClickEvent,
18529 setLink: setLink,
18530 bindFunctions: bindFunctions,
18531 durationToDate: durationToDate,
18532 isInvalidDate: isInvalidDate
18533});
18534
18535function getTaskTags(data, task, tags) {
18536 var matchFound = true;
18537
18538 while (matchFound) {
18539 matchFound = false;
18540 tags.forEach(function (t) {
18541 var pattern = '^\\s*' + t + '\\s*$';
18542 var regex = new RegExp(pattern);
18543
18544 if (data[0].match(regex)) {
18545 task[t] = true;
18546 data.shift(1);
18547 matchFound = true;
18548 }
18549 });
18550 }
18551}
18552
18553/***/ }),
18554
18555/***/ "./src/diagrams/gantt/ganttRenderer.js":
18556/*!*********************************************!*\
18557 !*** ./src/diagrams/gantt/ganttRenderer.js ***!
18558 \*********************************************/
18559/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
18560
18561"use strict";
18562__webpack_require__.r(__webpack_exports__);
18563/* harmony export */ __webpack_require__.d(__webpack_exports__, {
18564/* harmony export */ "setConf": () => (/* binding */ setConf),
18565/* harmony export */ "draw": () => (/* binding */ draw),
18566/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
18567/* harmony export */ });
18568/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
18569/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
18570/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
18571/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
18572/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
18573/* harmony import */ var _parser_gantt__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_gantt__WEBPACK_IMPORTED_MODULE_2__);
18574/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
18575/* harmony import */ var _ganttDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ganttDb */ "./src/diagrams/gantt/ganttDb.js");
18576/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
18577/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
18578
18579
18580
18581
18582
18583
18584
18585_parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"];
18586var setConf = function setConf() {// const keys = Object.keys(cnf);
18587 // keys.forEach(function(key) {
18588 // conf[key] = cnf[key];
18589 // });
18590};
18591var w;
18592var draw = function draw(text, id) {
18593 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_4__.getConfig)().gantt;
18594 _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.clear();
18595 _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.parse(text);
18596 var elem = document.getElementById(id);
18597 w = elem.parentElement.offsetWidth;
18598
18599 if (typeof w === 'undefined') {
18600 w = 1200;
18601 }
18602
18603 if (typeof conf.useWidth !== 'undefined') {
18604 w = conf.useWidth;
18605 }
18606
18607 var taskArray = _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getTasks(); // Set height based on number of tasks
18608
18609 var h = taskArray.length * (conf.barHeight + conf.barGap) + 2 * conf.topPadding; // Set viewBox
18610
18611 elem.setAttribute('viewBox', '0 0 ' + w + ' ' + h);
18612 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]")); // Set timescale
18613
18614 var timeScale = (0,d3__WEBPACK_IMPORTED_MODULE_1__.scaleTime)().domain([(0,d3__WEBPACK_IMPORTED_MODULE_1__.min)(taskArray, function (d) {
18615 return d.startTime;
18616 }), (0,d3__WEBPACK_IMPORTED_MODULE_1__.max)(taskArray, function (d) {
18617 return d.endTime;
18618 })]).rangeRound([0, w - conf.leftPadding - conf.rightPadding]);
18619 var categories = [];
18620
18621 for (var i = 0; i < taskArray.length; i++) {
18622 categories.push(taskArray[i].type);
18623 }
18624
18625 var catsUnfiltered = categories; // for vert labels
18626
18627 categories = checkUnique(categories);
18628
18629 function taskCompare(a, b) {
18630 var taskA = a.startTime;
18631 var taskB = b.startTime;
18632 var result = 0;
18633
18634 if (taskA > taskB) {
18635 result = 1;
18636 } else if (taskA < taskB) {
18637 result = -1;
18638 }
18639
18640 return result;
18641 } // Sort the task array using the above taskCompare() so that
18642 // tasks are created based on their order of startTime
18643
18644
18645 taskArray.sort(taskCompare);
18646 makeGant(taskArray, w, h);
18647 (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(svg, h, w, conf.useMaxWidth);
18648 svg.append('text').text(_parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getTitle()).attr('x', w / 2).attr('y', conf.titleTopMargin).attr('class', 'titleText');
18649
18650 function makeGant(tasks, pageWidth, pageHeight) {
18651 var barHeight = conf.barHeight;
18652 var gap = barHeight + conf.barGap;
18653 var topPadding = conf.topPadding;
18654 var leftPadding = conf.leftPadding;
18655 var colorScale = (0,d3__WEBPACK_IMPORTED_MODULE_1__.scaleLinear)().domain([0, categories.length]).range(['#00B9FA', '#F95002']).interpolate(d3__WEBPACK_IMPORTED_MODULE_1__.interpolateHcl);
18656 drawExcludeDays(gap, topPadding, leftPadding, pageWidth, pageHeight, tasks, _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getExcludes(), _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getIncludes());
18657 makeGrid(leftPadding, topPadding, pageWidth, pageHeight);
18658 drawRects(tasks, gap, topPadding, leftPadding, barHeight, colorScale, pageWidth, pageHeight);
18659 vertLabels(gap, topPadding, leftPadding, barHeight, colorScale);
18660 drawToday(leftPadding, topPadding, pageWidth, pageHeight);
18661 }
18662
18663 function drawRects(theArray, theGap, theTopPad, theSidePad, theBarHeight, theColorScale, w) {
18664 // Draw background rects covering the entire width of the graph, these form the section rows.
18665 svg.append('g').selectAll('rect').data(theArray).enter().append('rect').attr('x', 0).attr('y', function (d, i) {
18666 // Ignore the incoming i value and use our order instead
18667 i = d.order;
18668 return i * theGap + theTopPad - 2;
18669 }).attr('width', function () {
18670 return w - conf.rightPadding / 2;
18671 }).attr('height', theGap).attr('class', function (d) {
18672 for (var _i = 0; _i < categories.length; _i++) {
18673 if (d.type === categories[_i]) {
18674 return 'section section' + _i % conf.numberSectionStyles;
18675 }
18676 }
18677
18678 return 'section section0';
18679 }); // Draw the rects representing the tasks
18680
18681 var rectangles = svg.append('g').selectAll('rect').data(theArray).enter();
18682 rectangles.append('rect').attr('id', function (d) {
18683 return d.id;
18684 }).attr('rx', 3).attr('ry', 3).attr('x', function (d) {
18685 if (d.milestone) {
18686 return timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
18687 }
18688
18689 return timeScale(d.startTime) + theSidePad;
18690 }).attr('y', function (d, i) {
18691 // Ignore the incoming i value and use our order instead
18692 i = d.order;
18693 return i * theGap + theTopPad;
18694 }).attr('width', function (d) {
18695 if (d.milestone) {
18696 return theBarHeight;
18697 }
18698
18699 return timeScale(d.renderEndTime || d.endTime) - timeScale(d.startTime);
18700 }).attr('height', theBarHeight).attr('transform-origin', function (d, i) {
18701 // Ignore the incoming i value and use our order instead
18702 i = d.order;
18703 return (timeScale(d.startTime) + theSidePad + 0.5 * (timeScale(d.endTime) - timeScale(d.startTime))).toString() + 'px ' + (i * theGap + theTopPad + 0.5 * theBarHeight).toString() + 'px';
18704 }).attr('class', function (d) {
18705 var res = 'task';
18706 var classStr = '';
18707
18708 if (d.classes.length > 0) {
18709 classStr = d.classes.join(' ');
18710 }
18711
18712 var secNum = 0;
18713
18714 for (var _i2 = 0; _i2 < categories.length; _i2++) {
18715 if (d.type === categories[_i2]) {
18716 secNum = _i2 % conf.numberSectionStyles;
18717 }
18718 }
18719
18720 var taskClass = '';
18721
18722 if (d.active) {
18723 if (d.crit) {
18724 taskClass += ' activeCrit';
18725 } else {
18726 taskClass = ' active';
18727 }
18728 } else if (d.done) {
18729 if (d.crit) {
18730 taskClass = ' doneCrit';
18731 } else {
18732 taskClass = ' done';
18733 }
18734 } else {
18735 if (d.crit) {
18736 taskClass += ' crit';
18737 }
18738 }
18739
18740 if (taskClass.length === 0) {
18741 taskClass = ' task';
18742 }
18743
18744 if (d.milestone) {
18745 taskClass = ' milestone ' + taskClass;
18746 }
18747
18748 taskClass += secNum;
18749 taskClass += ' ' + classStr;
18750 return res + taskClass;
18751 }); // Append task labels
18752
18753 rectangles.append('text').attr('id', function (d) {
18754 return d.id + '-text';
18755 }).text(function (d) {
18756 return d.task;
18757 }).attr('font-size', conf.fontSize).attr('x', function (d) {
18758 var startX = timeScale(d.startTime);
18759 var endX = timeScale(d.renderEndTime || d.endTime);
18760
18761 if (d.milestone) {
18762 startX += 0.5 * (timeScale(d.endTime) - timeScale(d.startTime)) - 0.5 * theBarHeight;
18763 }
18764
18765 if (d.milestone) {
18766 endX = startX + theBarHeight;
18767 }
18768
18769 var textWidth = this.getBBox().width; // Check id text width > width of rectangle
18770
18771 if (textWidth > endX - startX) {
18772 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
18773 return startX + theSidePad - 5;
18774 } else {
18775 return endX + theSidePad + 5;
18776 }
18777 } else {
18778 return (endX - startX) / 2 + startX + theSidePad;
18779 }
18780 }).attr('y', function (d, i) {
18781 // Ignore the incoming i value and use our order instead
18782 i = d.order;
18783 return i * theGap + conf.barHeight / 2 + (conf.fontSize / 2 - 2) + theTopPad;
18784 }).attr('text-height', theBarHeight).attr('class', function (d) {
18785 var startX = timeScale(d.startTime);
18786 var endX = timeScale(d.endTime);
18787
18788 if (d.milestone) {
18789 endX = startX + theBarHeight;
18790 }
18791
18792 var textWidth = this.getBBox().width;
18793 var classStr = '';
18794
18795 if (d.classes.length > 0) {
18796 classStr = d.classes.join(' ');
18797 }
18798
18799 var secNum = 0;
18800
18801 for (var _i3 = 0; _i3 < categories.length; _i3++) {
18802 if (d.type === categories[_i3]) {
18803 secNum = _i3 % conf.numberSectionStyles;
18804 }
18805 }
18806
18807 var taskType = '';
18808
18809 if (d.active) {
18810 if (d.crit) {
18811 taskType = 'activeCritText' + secNum;
18812 } else {
18813 taskType = 'activeText' + secNum;
18814 }
18815 }
18816
18817 if (d.done) {
18818 if (d.crit) {
18819 taskType = taskType + ' doneCritText' + secNum;
18820 } else {
18821 taskType = taskType + ' doneText' + secNum;
18822 }
18823 } else {
18824 if (d.crit) {
18825 taskType = taskType + ' critText' + secNum;
18826 }
18827 }
18828
18829 if (d.milestone) {
18830 taskType += ' milestoneText';
18831 } // Check id text width > width of rectangle
18832
18833
18834 if (textWidth > endX - startX) {
18835 if (endX + textWidth + 1.5 * conf.leftPadding > w) {
18836 return classStr + ' taskTextOutsideLeft taskTextOutside' + secNum + ' ' + taskType;
18837 } else {
18838 return classStr + ' taskTextOutsideRight taskTextOutside' + secNum + ' ' + taskType + ' width-' + textWidth;
18839 }
18840 } else {
18841 return classStr + ' taskText taskText' + secNum + ' ' + taskType + ' width-' + textWidth;
18842 }
18843 });
18844 }
18845
18846 function drawExcludeDays(theGap, theTopPad, theSidePad, w, h, tasks, excludes, includes) {
18847 var minTime = tasks.reduce(function (min, _ref) {
18848 var startTime = _ref.startTime;
18849 return min ? Math.min(min, startTime) : startTime;
18850 }, 0);
18851 var maxTime = tasks.reduce(function (max, _ref2) {
18852 var endTime = _ref2.endTime;
18853 return max ? Math.max(max, endTime) : endTime;
18854 }, 0);
18855 var dateFormat = _parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getDateFormat();
18856 if (!minTime || !maxTime) return;
18857 var excludeRanges = [];
18858 var range = null;
18859 var d = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()(minTime);
18860
18861 while (d.valueOf() <= maxTime) {
18862 if (_parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.isInvalidDate(d, dateFormat, excludes, includes)) {
18863 if (!range) {
18864 range = {
18865 start: d.clone(),
18866 end: d.clone()
18867 };
18868 } else {
18869 range.end = d.clone();
18870 }
18871 } else {
18872 if (range) {
18873 excludeRanges.push(range);
18874 range = null;
18875 }
18876 }
18877
18878 d.add(1, 'd');
18879 }
18880
18881 var rectangles = svg.append('g').selectAll('rect').data(excludeRanges).enter();
18882 rectangles.append('rect').attr('id', function (d) {
18883 return 'exclude-' + d.start.format('YYYY-MM-DD');
18884 }).attr('x', function (d) {
18885 return timeScale(d.start) + theSidePad;
18886 }).attr('y', conf.gridLineStartPadding).attr('width', function (d) {
18887 var renderEnd = d.end.clone().add(1, 'day');
18888 return timeScale(renderEnd) - timeScale(d.start);
18889 }).attr('height', h - theTopPad - conf.gridLineStartPadding).attr('transform-origin', function (d, i) {
18890 return (timeScale(d.start) + theSidePad + 0.5 * (timeScale(d.end) - timeScale(d.start))).toString() + 'px ' + (i * theGap + 0.5 * h).toString() + 'px';
18891 }).attr('class', 'exclude-range');
18892 }
18893
18894 function makeGrid(theSidePad, theTopPad, w, h) {
18895 var bottomXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_1__.axisBottom)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_1__.timeFormat)(_parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
18896 svg.append('g').attr('class', 'grid').attr('transform', 'translate(' + theSidePad + ', ' + (h - 50) + ')').call(bottomXAxis).selectAll('text').style('text-anchor', 'middle').attr('fill', '#000').attr('stroke', 'none').attr('font-size', 10).attr('dy', '1em');
18897
18898 if (_ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"].topAxisEnabled() || conf.topAxis) {
18899 var topXAxis = (0,d3__WEBPACK_IMPORTED_MODULE_1__.axisTop)(timeScale).tickSize(-h + theTopPad + conf.gridLineStartPadding).tickFormat((0,d3__WEBPACK_IMPORTED_MODULE_1__.timeFormat)(_parser_gantt__WEBPACK_IMPORTED_MODULE_2__.parser.yy.getAxisFormat() || conf.axisFormat || '%Y-%m-%d'));
18900 svg.append('g').attr('class', 'grid').attr('transform', 'translate(' + theSidePad + ', ' + theTopPad + ')').call(topXAxis).selectAll('text').style('text-anchor', 'middle').attr('fill', '#000').attr('stroke', 'none').attr('font-size', 10); // .attr('dy', '1em');
18901 }
18902 }
18903
18904 function vertLabels(theGap, theTopPad) {
18905 var numOccurances = [];
18906 var prevGap = 0;
18907
18908 for (var _i4 = 0; _i4 < categories.length; _i4++) {
18909 numOccurances[_i4] = [categories[_i4], getCount(categories[_i4], catsUnfiltered)];
18910 }
18911
18912 svg.append('g') // without doing this, impossible to put grid lines behind text
18913 .selectAll('text').data(numOccurances).enter().append(function (d) {
18914 var rows = d[0].split(_common_common__WEBPACK_IMPORTED_MODULE_6__["default"].lineBreakRegex);
18915 var dy = -(rows.length - 1) / 2;
18916 var svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
18917 svgLabel.setAttribute('dy', dy + 'em');
18918
18919 for (var j = 0; j < rows.length; j++) {
18920 var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
18921 tspan.setAttribute('alignment-baseline', 'central');
18922 tspan.setAttribute('x', '10');
18923 if (j > 0) tspan.setAttribute('dy', '1em');
18924 tspan.textContent = rows[j];
18925 svgLabel.appendChild(tspan);
18926 }
18927
18928 return svgLabel;
18929 }).attr('x', 10).attr('y', function (d, i) {
18930 if (i > 0) {
18931 for (var j = 0; j < i; j++) {
18932 prevGap += numOccurances[i - 1][1];
18933 return d[1] * theGap / 2 + prevGap * theGap + theTopPad;
18934 }
18935 } else {
18936 return d[1] * theGap / 2 + theTopPad;
18937 }
18938 }).attr('font-size', conf.sectionFontSize).attr('font-size', conf.sectionFontSize).attr('class', function (d) {
18939 for (var _i5 = 0; _i5 < categories.length; _i5++) {
18940 if (d[0] === categories[_i5]) {
18941 return 'sectionTitle sectionTitle' + _i5 % conf.numberSectionStyles;
18942 }
18943 }
18944
18945 return 'sectionTitle';
18946 });
18947 }
18948
18949 function drawToday(theSidePad, theTopPad, w, h) {
18950 var todayMarker = _ganttDb__WEBPACK_IMPORTED_MODULE_3__["default"].getTodayMarker();
18951
18952 if (todayMarker === 'off') {
18953 return;
18954 }
18955
18956 var todayG = svg.append('g').attr('class', 'today');
18957 var today = new Date();
18958 var todayLine = todayG.append('line');
18959 todayLine.attr('x1', timeScale(today) + theSidePad).attr('x2', timeScale(today) + theSidePad).attr('y1', conf.titleTopMargin).attr('y2', h - conf.titleTopMargin).attr('class', 'today');
18960
18961 if (todayMarker !== '') {
18962 todayLine.attr('style', todayMarker.replace(/,/g, ';'));
18963 }
18964 } // from this stackexchange question: http://stackoverflow.com/questions/1890203/unique-for-arrays-in-javascript
18965
18966
18967 function checkUnique(arr) {
18968 var hash = {};
18969 var result = [];
18970
18971 for (var _i6 = 0, l = arr.length; _i6 < l; ++_i6) {
18972 if (!Object.prototype.hasOwnProperty.call(hash, arr[_i6])) {
18973 // eslint-disable-line
18974 // it works with objects! in FF, at least
18975 hash[arr[_i6]] = true;
18976 result.push(arr[_i6]);
18977 }
18978 }
18979
18980 return result;
18981 } // from this stackexchange question: http://stackoverflow.com/questions/14227981/count-how-many-strings-in-an-array-have-duplicates-in-the-same-array
18982
18983
18984 function getCounts(arr) {
18985 var i = arr.length; // const to loop over
18986
18987 var obj = {}; // obj to store results
18988
18989 while (i) {
18990 obj[arr[--i]] = (obj[arr[i]] || 0) + 1; // count occurrences
18991 }
18992
18993 return obj;
18994 } // get specific from everything
18995
18996
18997 function getCount(word, arr) {
18998 return getCounts(arr)[word] || 0;
18999 }
19000};
19001/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19002 setConf: setConf,
19003 draw: draw
19004});
19005
19006/***/ }),
19007
19008/***/ "./src/diagrams/gantt/styles.js":
19009/*!**************************************!*\
19010 !*** ./src/diagrams/gantt/styles.js ***!
19011 \**************************************/
19012/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19013
19014"use strict";
19015__webpack_require__.r(__webpack_exports__);
19016/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19017/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19018/* harmony export */ });
19019var getStyles = function getStyles(options) {
19020 return "\n .mermaid-main-font {\n font-family: \"trebuchet ms\", verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n .exclude-range {\n fill: ".concat(options.excludeBkgColor, ";\n }\n\n .section {\n stroke: none;\n opacity: 0.2;\n }\n\n .section0 {\n fill: ").concat(options.sectionBkgColor, ";\n }\n\n .section2 {\n fill: ").concat(options.sectionBkgColor2, ";\n }\n\n .section1,\n .section3 {\n fill: ").concat(options.altSectionBkgColor, ";\n opacity: 0.2;\n }\n\n .sectionTitle0 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle1 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle2 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle3 {\n fill: ").concat(options.titleColor, ";\n }\n\n .sectionTitle {\n text-anchor: start;\n // font-size: ").concat(options.ganttFontSize, ";\n // text-height: 14px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n\n /* Grid and axis */\n\n .grid .tick {\n stroke: ").concat(options.gridColor, ";\n opacity: 0.8;\n shape-rendering: crispEdges;\n text {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.textColor, ";\n }\n }\n\n .grid path {\n stroke-width: 0;\n }\n\n\n /* Today line */\n\n .today {\n fill: none;\n stroke: ").concat(options.todayLineColor, ";\n stroke-width: 2px;\n }\n\n\n /* Task styling */\n\n /* Default task */\n\n .task {\n stroke-width: 2;\n }\n\n .taskText {\n text-anchor: middle;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n\n // .taskText:not([font-size]) {\n // font-size: ").concat(options.ganttFontSize, ";\n // }\n\n .taskTextOutsideRight {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: start;\n // font-size: ").concat(options.ganttFontSize, ";\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n\n }\n\n .taskTextOutsideLeft {\n fill: ").concat(options.taskTextDarkColor, ";\n text-anchor: end;\n // font-size: ").concat(options.ganttFontSize, ";\n }\n\n /* Special case clickable */\n .task.clickable {\n cursor: pointer;\n }\n .taskText.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideLeft.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n .taskTextOutsideRight.clickable {\n cursor: pointer;\n fill: ").concat(options.taskTextClickableColor, " !important;\n font-weight: bold;\n }\n\n /* Specific task settings for the sections*/\n\n .taskText0,\n .taskText1,\n .taskText2,\n .taskText3 {\n fill: ").concat(options.taskTextColor, ";\n }\n\n .task0,\n .task1,\n .task2,\n .task3 {\n fill: ").concat(options.taskBkgColor, ";\n stroke: ").concat(options.taskBorderColor, ";\n }\n\n .taskTextOutside0,\n .taskTextOutside2\n {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n .taskTextOutside1,\n .taskTextOutside3 {\n fill: ").concat(options.taskTextOutsideColor, ";\n }\n\n\n /* Active task */\n\n .active0,\n .active1,\n .active2,\n .active3 {\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke: ").concat(options.activeTaskBorderColor, ";\n }\n\n .activeText0,\n .activeText1,\n .activeText2,\n .activeText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Completed task */\n\n .done0,\n .done1,\n .done2,\n .done3 {\n stroke: ").concat(options.doneTaskBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneText0,\n .doneText1,\n .doneText2,\n .doneText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n\n /* Tasks on the critical line */\n\n .crit0,\n .crit1,\n .crit2,\n .crit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.critBkgColor, ";\n stroke-width: 2;\n }\n\n .activeCrit0,\n .activeCrit1,\n .activeCrit2,\n .activeCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.activeTaskBkgColor, ";\n stroke-width: 2;\n }\n\n .doneCrit0,\n .doneCrit1,\n .doneCrit2,\n .doneCrit3 {\n stroke: ").concat(options.critBorderColor, ";\n fill: ").concat(options.doneTaskBkgColor, ";\n stroke-width: 2;\n cursor: pointer;\n shape-rendering: crispEdges;\n }\n\n .milestone {\n transform: rotate(45deg) scale(0.8,0.8);\n }\n\n .milestoneText {\n font-style: italic;\n }\n .doneCritText0,\n .doneCritText1,\n .doneCritText2,\n .doneCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .activeCritText0,\n .activeCritText1,\n .activeCritText2,\n .activeCritText3 {\n fill: ").concat(options.taskTextDarkColor, " !important;\n }\n\n .titleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ").concat(options.textColor, " ;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n");
19021};
19022
19023/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
19024
19025/***/ }),
19026
19027/***/ "./src/diagrams/git/gitGraphAst.js":
19028/*!*****************************************!*\
19029 !*** ./src/diagrams/git/gitGraphAst.js ***!
19030 \*****************************************/
19031/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19032
19033"use strict";
19034__webpack_require__.r(__webpack_exports__);
19035/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19036/* harmony export */ "setDirection": () => (/* binding */ setDirection),
19037/* harmony export */ "setOptions": () => (/* binding */ setOptions),
19038/* harmony export */ "getOptions": () => (/* binding */ getOptions),
19039/* harmony export */ "commit": () => (/* binding */ commit),
19040/* harmony export */ "branch": () => (/* binding */ branch),
19041/* harmony export */ "merge": () => (/* binding */ merge),
19042/* harmony export */ "checkout": () => (/* binding */ checkout),
19043/* harmony export */ "reset": () => (/* binding */ reset),
19044/* harmony export */ "prettyPrint": () => (/* binding */ prettyPrint),
19045/* harmony export */ "clear": () => (/* binding */ clear),
19046/* harmony export */ "getBranchesAsObjArray": () => (/* binding */ getBranchesAsObjArray),
19047/* harmony export */ "getBranches": () => (/* binding */ getBranches),
19048/* harmony export */ "getCommits": () => (/* binding */ getCommits),
19049/* harmony export */ "getCommitsArray": () => (/* binding */ getCommitsArray),
19050/* harmony export */ "getCurrentBranch": () => (/* binding */ getCurrentBranch),
19051/* harmony export */ "getDirection": () => (/* binding */ getDirection),
19052/* harmony export */ "getHead": () => (/* binding */ getHead),
19053/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19054/* harmony export */ });
19055/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19056/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19057
19058
19059var commits = {};
19060var head = null;
19061var branches = {
19062 master: head
19063};
19064var curBranch = 'master';
19065var direction = 'LR';
19066var seq = 0;
19067
19068function getId() {
19069 return (0,_utils__WEBPACK_IMPORTED_MODULE_0__.random)({
19070 length: 7
19071 });
19072}
19073
19074function isfastforwardable(currentCommit, otherCommit) {
19075 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Entering isfastforwardable:', currentCommit.id, otherCommit.id);
19076
19077 while (currentCommit.seq <= otherCommit.seq && currentCommit !== otherCommit) {
19078 // only if other branch has more commits
19079 if (otherCommit.parent == null) break;
19080
19081 if (Array.isArray(otherCommit.parent)) {
19082 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('In merge commit:', otherCommit.parent);
19083 return isfastforwardable(currentCommit, commits[otherCommit.parent[0]]) || isfastforwardable(currentCommit, commits[otherCommit.parent[1]]);
19084 } else {
19085 otherCommit = commits[otherCommit.parent];
19086 }
19087 }
19088
19089 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(currentCommit.id, otherCommit.id);
19090 return currentCommit.id === otherCommit.id;
19091}
19092
19093function isReachableFrom(currentCommit, otherCommit) {
19094 var currentSeq = currentCommit.seq;
19095 var otherSeq = otherCommit.seq;
19096 if (currentSeq > otherSeq) return isfastforwardable(otherCommit, currentCommit);
19097 return false;
19098}
19099
19100function uniqBy(list, fn) {
19101 var recordMap = Object.create(null);
19102 return list.reduce(function (out, item) {
19103 var key = fn(item);
19104
19105 if (!recordMap[key]) {
19106 recordMap[key] = true;
19107 out.push(item);
19108 }
19109
19110 return out;
19111 }, []);
19112}
19113
19114var setDirection = function setDirection(dir) {
19115 direction = dir;
19116};
19117var options = {};
19118var setOptions = function setOptions(rawOptString) {
19119 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('options str', rawOptString);
19120 rawOptString = rawOptString && rawOptString.trim();
19121 rawOptString = rawOptString || '{}';
19122
19123 try {
19124 options = JSON.parse(rawOptString);
19125 } catch (e) {
19126 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing gitGraph options', e.message);
19127 }
19128};
19129var getOptions = function getOptions() {
19130 return options;
19131};
19132var commit = function commit(msg) {
19133 var commit = {
19134 id: getId(),
19135 message: msg,
19136 seq: seq++,
19137 parent: head == null ? null : head.id
19138 };
19139 head = commit;
19140 commits[commit.id] = commit;
19141 branches[curBranch] = commit.id;
19142 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in pushCommit ' + commit.id);
19143};
19144var branch = function branch(name) {
19145 branches[name] = head != null ? head.id : null;
19146 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in createBranch');
19147};
19148var merge = function merge(otherBranch) {
19149 var currentCommit = commits[branches[curBranch]];
19150 var otherCommit = commits[branches[otherBranch]];
19151
19152 if (isReachableFrom(currentCommit, otherCommit)) {
19153 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Already merged');
19154 return;
19155 }
19156
19157 if (isfastforwardable(currentCommit, otherCommit)) {
19158 branches[curBranch] = branches[otherBranch];
19159 head = commits[branches[curBranch]];
19160 } else {
19161 // create merge commit
19162 var _commit = {
19163 id: getId(),
19164 message: 'merged branch ' + otherBranch + ' into ' + curBranch,
19165 seq: seq++,
19166 parent: [head == null ? null : head.id, branches[otherBranch]]
19167 };
19168 head = _commit;
19169 commits[_commit.id] = _commit;
19170 branches[curBranch] = _commit.id;
19171 }
19172
19173 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(branches);
19174 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in mergeBranch');
19175};
19176var checkout = function checkout(branch) {
19177 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in checkout');
19178 curBranch = branch;
19179 var id = branches[curBranch];
19180 head = commits[id];
19181};
19182var reset = function reset(commitRef) {
19183 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('in reset', commitRef);
19184 var ref = commitRef.split(':')[0];
19185 var parentCount = parseInt(commitRef.split(':')[1]);
19186 var commit = ref === 'HEAD' ? head : commits[branches[ref]];
19187 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(commit, parentCount);
19188
19189 while (parentCount > 0) {
19190 commit = commits[commit.parent];
19191 parentCount--;
19192
19193 if (!commit) {
19194 var err = 'Critical error - unique parent commit not found during reset';
19195 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(err);
19196 throw err;
19197 }
19198 }
19199
19200 head = commit;
19201 branches[curBranch] = commit.id;
19202};
19203
19204function upsert(arr, key, newval) {
19205 var index = arr.indexOf(key);
19206
19207 if (index === -1) {
19208 arr.push(newval);
19209 } else {
19210 arr.splice(index, 1, newval);
19211 }
19212}
19213
19214function prettyPrintCommitHistory(commitArr) {
19215 var commit = commitArr.reduce(function (out, commit) {
19216 if (out.seq > commit.seq) return out;
19217 return commit;
19218 }, commitArr[0]);
19219 var line = '';
19220 commitArr.forEach(function (c) {
19221 if (c === commit) {
19222 line += '\t*';
19223 } else {
19224 line += '\t|';
19225 }
19226 });
19227 var label = [line, commit.id, commit.seq];
19228
19229 for (var _branch in branches) {
19230 if (branches[_branch] === commit.id) label.push(_branch);
19231 }
19232
19233 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(label.join(' '));
19234
19235 if (Array.isArray(commit.parent)) {
19236 var newCommit = commits[commit.parent[0]];
19237 upsert(commitArr, commit, newCommit);
19238 commitArr.push(commits[commit.parent[1]]);
19239 } else if (commit.parent == null) {
19240 return;
19241 } else {
19242 var nextCommit = commits[commit.parent];
19243 upsert(commitArr, commit, nextCommit);
19244 }
19245
19246 commitArr = uniqBy(commitArr, function (c) {
19247 return c.id;
19248 });
19249 prettyPrintCommitHistory(commitArr);
19250}
19251
19252var prettyPrint = function prettyPrint() {
19253 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(commits);
19254 var node = getCommitsArray()[0];
19255 prettyPrintCommitHistory([node]);
19256};
19257var clear = function clear() {
19258 commits = {};
19259 head = null;
19260 branches = {
19261 master: head
19262 };
19263 curBranch = 'master';
19264 seq = 0;
19265};
19266var getBranchesAsObjArray = function getBranchesAsObjArray() {
19267 var branchArr = [];
19268
19269 for (var _branch2 in branches) {
19270 branchArr.push({
19271 name: _branch2,
19272 commit: commits[branches[_branch2]]
19273 });
19274 }
19275
19276 return branchArr;
19277};
19278var getBranches = function getBranches() {
19279 return branches;
19280};
19281var getCommits = function getCommits() {
19282 return commits;
19283};
19284var getCommitsArray = function getCommitsArray() {
19285 var commitArr = Object.keys(commits).map(function (key) {
19286 return commits[key];
19287 });
19288 commitArr.forEach(function (o) {
19289 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug(o.id);
19290 });
19291 commitArr.sort(function (a, b) {
19292 return b.seq - a.seq;
19293 });
19294 return commitArr;
19295};
19296var getCurrentBranch = function getCurrentBranch() {
19297 return curBranch;
19298};
19299var getDirection = function getDirection() {
19300 return direction;
19301};
19302var getHead = function getHead() {
19303 return head;
19304};
19305/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19306 setDirection: setDirection,
19307 setOptions: setOptions,
19308 getOptions: getOptions,
19309 commit: commit,
19310 branch: branch,
19311 merge: merge,
19312 checkout: checkout,
19313 reset: reset,
19314 prettyPrint: prettyPrint,
19315 clear: clear,
19316 getBranchesAsObjArray: getBranchesAsObjArray,
19317 getBranches: getBranches,
19318 getCommits: getCommits,
19319 getCommitsArray: getCommitsArray,
19320 getCurrentBranch: getCurrentBranch,
19321 getDirection: getDirection,
19322 getHead: getHead
19323});
19324
19325/***/ }),
19326
19327/***/ "./src/diagrams/git/gitGraphRenderer.js":
19328/*!**********************************************!*\
19329 !*** ./src/diagrams/git/gitGraphRenderer.js ***!
19330 \**********************************************/
19331/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19332
19333"use strict";
19334__webpack_require__.r(__webpack_exports__);
19335/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19336/* harmony export */ "setConf": () => (/* binding */ setConf),
19337/* harmony export */ "draw": () => (/* binding */ draw),
19338/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19339/* harmony export */ });
19340/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
19341/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
19342/* harmony import */ var _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
19343/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
19344/* harmony import */ var _parser_gitGraph__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_gitGraph__WEBPACK_IMPORTED_MODULE_3__);
19345/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19346/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19347
19348
19349
19350
19351
19352var allCommitsDict = {};
19353var branchNum;
19354var config = {
19355 nodeSpacing: 150,
19356 nodeFillColor: 'yellow',
19357 nodeStrokeWidth: 2,
19358 nodeStrokeColor: 'grey',
19359 lineStrokeWidth: 4,
19360 branchOffset: 50,
19361 lineColor: 'grey',
19362 leftMargin: 50,
19363 branchColors: ['#442f74', '#983351', '#609732', '#AA9A39'],
19364 nodeRadius: 10,
19365 nodeLabel: {
19366 width: 75,
19367 height: 100,
19368 x: -25,
19369 y: 0
19370 }
19371};
19372var apiConfig = {};
19373var setConf = function setConf(c) {
19374 apiConfig = c;
19375};
19376
19377function svgCreateDefs(svg) {
19378 svg.append('defs').append('g').attr('id', 'def-commit').append('circle').attr('r', config.nodeRadius).attr('cx', 0).attr('cy', 0);
19379 svg.select('#def-commit').append('foreignObject').attr('width', config.nodeLabel.width).attr('height', config.nodeLabel.height).attr('x', config.nodeLabel.x).attr('y', config.nodeLabel.y).attr('class', 'node-label').attr('requiredFeatures', 'http://www.w3.org/TR/SVG11/feature#Extensibility').append('p').html('');
19380}
19381
19382function svgDrawLine(svg, points, colorIdx, interpolate) {
19383 var curve = (0,_utils__WEBPACK_IMPORTED_MODULE_1__.interpolateToCurve)(interpolate, d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
19384 var color = config.branchColors[colorIdx % config.branchColors.length];
19385 var lineGen = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
19386 return Math.round(d.x);
19387 }).y(function (d) {
19388 return Math.round(d.y);
19389 }).curve(curve);
19390 svg.append('svg:path').attr('d', lineGen(points)).style('stroke', color).style('stroke-width', config.lineStrokeWidth).style('fill', 'none');
19391} // Pass in the element and its pre-transform coords
19392
19393
19394function getElementCoords(element, coords) {
19395 coords = coords || element.node().getBBox();
19396 var ctm = element.node().getCTM();
19397 var xn = ctm.e + coords.x * ctm.a;
19398 var yn = ctm.f + coords.y * ctm.d;
19399 return {
19400 left: xn,
19401 top: yn,
19402 width: coords.width,
19403 height: coords.height
19404 };
19405}
19406
19407function svgDrawLineForCommits(svg, fromId, toId, direction, color) {
19408 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('svgDrawLineForCommits: ', fromId, toId);
19409 var fromBbox = getElementCoords(svg.select('#node-' + fromId + ' circle'));
19410 var toBbox = getElementCoords(svg.select('#node-' + toId + ' circle'));
19411
19412 switch (direction) {
19413 case 'LR':
19414 // (toBbox)
19415 // +--------
19416 // + (fromBbox)
19417 if (fromBbox.left - toBbox.left > config.nodeSpacing) {
19418 var lineStart = {
19419 x: fromBbox.left - config.nodeSpacing,
19420 y: toBbox.top + toBbox.height / 2
19421 };
19422 var lineEnd = {
19423 x: toBbox.left + toBbox.width,
19424 y: toBbox.top + toBbox.height / 2
19425 };
19426 svgDrawLine(svg, [lineStart, lineEnd], color, 'linear');
19427 svgDrawLine(svg, [{
19428 x: fromBbox.left,
19429 y: fromBbox.top + fromBbox.height / 2
19430 }, {
19431 x: fromBbox.left - config.nodeSpacing / 2,
19432 y: fromBbox.top + fromBbox.height / 2
19433 }, {
19434 x: fromBbox.left - config.nodeSpacing / 2,
19435 y: lineStart.y
19436 }, lineStart], color);
19437 } else {
19438 svgDrawLine(svg, [{
19439 x: fromBbox.left,
19440 y: fromBbox.top + fromBbox.height / 2
19441 }, {
19442 x: fromBbox.left - config.nodeSpacing / 2,
19443 y: fromBbox.top + fromBbox.height / 2
19444 }, {
19445 x: fromBbox.left - config.nodeSpacing / 2,
19446 y: toBbox.top + toBbox.height / 2
19447 }, {
19448 x: toBbox.left + toBbox.width,
19449 y: toBbox.top + toBbox.height / 2
19450 }], color);
19451 }
19452
19453 break;
19454
19455 case 'BT':
19456 // + (fromBbox)
19457 // |
19458 // |
19459 // + (toBbox)
19460 if (toBbox.top - fromBbox.top > config.nodeSpacing) {
19461 var _lineStart = {
19462 x: toBbox.left + toBbox.width / 2,
19463 y: fromBbox.top + fromBbox.height + config.nodeSpacing
19464 };
19465 var _lineEnd = {
19466 x: toBbox.left + toBbox.width / 2,
19467 y: toBbox.top
19468 };
19469 svgDrawLine(svg, [_lineStart, _lineEnd], color, 'linear');
19470 svgDrawLine(svg, [{
19471 x: fromBbox.left + fromBbox.width / 2,
19472 y: fromBbox.top + fromBbox.height
19473 }, {
19474 x: fromBbox.left + fromBbox.width / 2,
19475 y: fromBbox.top + fromBbox.height + config.nodeSpacing / 2
19476 }, {
19477 x: toBbox.left + toBbox.width / 2,
19478 y: _lineStart.y - config.nodeSpacing / 2
19479 }, _lineStart], color);
19480 } else {
19481 svgDrawLine(svg, [{
19482 x: fromBbox.left + fromBbox.width / 2,
19483 y: fromBbox.top + fromBbox.height
19484 }, {
19485 x: fromBbox.left + fromBbox.width / 2,
19486 y: fromBbox.top + config.nodeSpacing / 2
19487 }, {
19488 x: toBbox.left + toBbox.width / 2,
19489 y: toBbox.top - config.nodeSpacing / 2
19490 }, {
19491 x: toBbox.left + toBbox.width / 2,
19492 y: toBbox.top
19493 }], color);
19494 }
19495
19496 break;
19497 }
19498}
19499
19500function cloneNode(svg, selector) {
19501 return svg.select(selector).node().cloneNode(true);
19502}
19503
19504function renderCommitHistory(svg, commitid, branches, direction) {
19505 var commit;
19506 var numCommits = Object.keys(allCommitsDict).length;
19507
19508 if (typeof commitid === 'string') {
19509 do {
19510 commit = allCommitsDict[commitid];
19511 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('in renderCommitHistory', commit.id, commit.seq);
19512
19513 if (svg.select('#node-' + commitid).size() > 0) {
19514 return;
19515 }
19516
19517 svg.append(function () {
19518 return cloneNode(svg, '#def-commit');
19519 }).attr('class', 'commit').attr('id', function () {
19520 return 'node-' + commit.id;
19521 }).attr('transform', function () {
19522 switch (direction) {
19523 case 'LR':
19524 return 'translate(' + (commit.seq * config.nodeSpacing + config.leftMargin) + ', ' + branchNum * config.branchOffset + ')';
19525
19526 case 'BT':
19527 return 'translate(' + (branchNum * config.branchOffset + config.leftMargin) + ', ' + (numCommits - commit.seq) * config.nodeSpacing + ')';
19528 }
19529 }).attr('fill', config.nodeFillColor).attr('stroke', config.nodeStrokeColor).attr('stroke-width', config.nodeStrokeWidth);
19530 var branch = void 0;
19531
19532 for (var branchName in branches) {
19533 if (branches[branchName].commit === commit) {
19534 branch = branches[branchName];
19535 break;
19536 }
19537 }
19538
19539 if (branch) {
19540 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('found branch ', branch.name);
19541 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'branch-label').text(branch.name + ', ');
19542 }
19543
19544 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-id').text(commit.id);
19545
19546 if (commit.message !== '' && direction === 'BT') {
19547 svg.select('#node-' + commit.id + ' p').append('xhtml:span').attr('class', 'commit-msg').text(', ' + commit.message);
19548 }
19549
19550 commitid = commit.parent;
19551 } while (commitid && allCommitsDict[commitid]);
19552 }
19553
19554 if (Array.isArray(commitid)) {
19555 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('found merge commmit', commitid);
19556 renderCommitHistory(svg, commitid[0], branches, direction);
19557 branchNum++;
19558 renderCommitHistory(svg, commitid[1], branches, direction);
19559 branchNum--;
19560 }
19561}
19562
19563function renderLines(svg, commit, direction, branchColor) {
19564 branchColor = branchColor || 0;
19565
19566 while (commit.seq > 0 && !commit.lineDrawn) {
19567 if (typeof commit.parent === 'string') {
19568 svgDrawLineForCommits(svg, commit.id, commit.parent, direction, branchColor);
19569 commit.lineDrawn = true;
19570 commit = allCommitsDict[commit.parent];
19571 } else if (Array.isArray(commit.parent)) {
19572 svgDrawLineForCommits(svg, commit.id, commit.parent[0], direction, branchColor);
19573 svgDrawLineForCommits(svg, commit.id, commit.parent[1], direction, branchColor + 1);
19574 renderLines(svg, allCommitsDict[commit.parent[1]], direction, branchColor + 1);
19575 commit.lineDrawn = true;
19576 commit = allCommitsDict[commit.parent[0]];
19577 }
19578 }
19579}
19580
19581var draw = function draw(txt, id, ver) {
19582 try {
19583 var parser = (_parser_gitGraph__WEBPACK_IMPORTED_MODULE_3___default().parser);
19584 parser.yy = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"];
19585 parser.yy.clear();
19586 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('in gitgraph renderer', txt + '\n', 'id:', id, ver); // Parse the graph definition
19587
19588 parser.parse(txt + '\n');
19589 config = Object.assign(config, apiConfig, _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getOptions());
19590 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('effective options', config);
19591 var direction = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getDirection();
19592 allCommitsDict = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getCommits();
19593 var branches = _gitGraphAst__WEBPACK_IMPORTED_MODULE_4__["default"].getBranchesAsObjArray();
19594
19595 if (direction === 'BT') {
19596 config.nodeLabel.x = branches.length * config.branchOffset;
19597 config.nodeLabel.width = '100%';
19598 config.nodeLabel.y = -1 * 2 * config.nodeRadius;
19599 }
19600
19601 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]"));
19602 svgCreateDefs(svg);
19603 branchNum = 1;
19604
19605 for (var branch in branches) {
19606 var v = branches[branch];
19607 renderCommitHistory(svg, v.commit.id, branches, direction);
19608 renderLines(svg, v.commit, direction);
19609 branchNum++;
19610 }
19611
19612 svg.attr('height', function () {
19613 if (direction === 'BT') return Object.keys(allCommitsDict).length * config.nodeSpacing;
19614 return (branches.length + 1) * config.branchOffset;
19615 });
19616 } catch (e) {
19617 _logger__WEBPACK_IMPORTED_MODULE_2__.log.error('Error while rendering gitgraph');
19618 _logger__WEBPACK_IMPORTED_MODULE_2__.log.error(e.message);
19619 }
19620};
19621/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19622 setConf: setConf,
19623 draw: draw
19624});
19625
19626/***/ }),
19627
19628/***/ "./src/diagrams/git/styles.js":
19629/*!************************************!*\
19630 !*** ./src/diagrams/git/styles.js ***!
19631 \************************************/
19632/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19633
19634"use strict";
19635__webpack_require__.r(__webpack_exports__);
19636/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19637/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19638/* harmony export */ });
19639var getStyles = function getStyles() {
19640 return "\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n";
19641};
19642
19643/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
19644
19645/***/ }),
19646
19647/***/ "./src/diagrams/info/infoDb.js":
19648/*!*************************************!*\
19649 !*** ./src/diagrams/info/infoDb.js ***!
19650 \*************************************/
19651/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19652
19653"use strict";
19654__webpack_require__.r(__webpack_exports__);
19655/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19656/* harmony export */ "setMessage": () => (/* binding */ setMessage),
19657/* harmony export */ "getMessage": () => (/* binding */ getMessage),
19658/* harmony export */ "setInfo": () => (/* binding */ setInfo),
19659/* harmony export */ "getInfo": () => (/* binding */ getInfo),
19660/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19661/* harmony export */ });
19662/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19663/**
19664 * Created by knut on 15-01-14.
19665 */
19666
19667var message = '';
19668var info = false;
19669var setMessage = function setMessage(txt) {
19670 _logger__WEBPACK_IMPORTED_MODULE_0__.log.debug('Setting message to: ' + txt);
19671 message = txt;
19672};
19673var getMessage = function getMessage() {
19674 return message;
19675};
19676var setInfo = function setInfo(inf) {
19677 info = inf;
19678};
19679var getInfo = function getInfo() {
19680 return info;
19681}; // export const parseError = (err, hash) => {
19682// global.mermaidAPI.parseError(err, hash)
19683// }
19684
19685/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19686 setMessage: setMessage,
19687 getMessage: getMessage,
19688 setInfo: setInfo,
19689 getInfo: getInfo // parseError
19690
19691});
19692
19693/***/ }),
19694
19695/***/ "./src/diagrams/info/infoRenderer.js":
19696/*!*******************************************!*\
19697 !*** ./src/diagrams/info/infoRenderer.js ***!
19698 \*******************************************/
19699/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19700
19701"use strict";
19702__webpack_require__.r(__webpack_exports__);
19703/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19704/* harmony export */ "setConf": () => (/* binding */ setConf),
19705/* harmony export */ "draw": () => (/* binding */ draw),
19706/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19707/* harmony export */ });
19708/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
19709/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
19710/* harmony import */ var _infoDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./infoDb */ "./src/diagrams/info/infoDb.js");
19711/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/info */ "./src/diagrams/info/parser/info.jison");
19712/* harmony import */ var _parser_info__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_info__WEBPACK_IMPORTED_MODULE_1__);
19713/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19714/**
19715 * Created by knut on 14-12-11.
19716 */
19717
19718
19719
19720
19721var conf = {};
19722var setConf = function setConf(cnf) {
19723 var keys = Object.keys(cnf);
19724 keys.forEach(function (key) {
19725 conf[key] = cnf[key];
19726 });
19727};
19728/**
19729 * Draws a an info picture in the tag with id: id based on the graph definition in text.
19730 * @param text
19731 * @param id
19732 */
19733
19734var draw = function draw(txt, id, ver) {
19735 try {
19736 var parser = (_parser_info__WEBPACK_IMPORTED_MODULE_1___default().parser);
19737 parser.yy = _infoDb__WEBPACK_IMPORTED_MODULE_2__["default"];
19738 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Renering info diagram\n' + txt); // Parse the graph definition
19739
19740 parser.parse(txt);
19741 _logger__WEBPACK_IMPORTED_MODULE_3__.log.debug('Parsed info diagram'); // Fetch the default direction, use TD if none was found
19742
19743 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
19744 var g = svg.append('g');
19745 g.append('text') // text label for the x axis
19746 .attr('x', 100).attr('y', 40).attr('class', 'version').attr('font-size', '32px').style('text-anchor', 'middle').text('v ' + ver);
19747 svg.attr('height', 100);
19748 svg.attr('width', 400); // svg.attr('viewBox', '0 0 300 150');
19749 } catch (e) {
19750 _logger__WEBPACK_IMPORTED_MODULE_3__.log.error('Error while rendering info diagram');
19751 _logger__WEBPACK_IMPORTED_MODULE_3__.log.error(e.message);
19752 }
19753};
19754/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19755 setConf: setConf,
19756 draw: draw
19757});
19758
19759/***/ }),
19760
19761/***/ "./src/diagrams/info/styles.js":
19762/*!*************************************!*\
19763 !*** ./src/diagrams/info/styles.js ***!
19764 \*************************************/
19765/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19766
19767"use strict";
19768__webpack_require__.r(__webpack_exports__);
19769/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19770/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19771/* harmony export */ });
19772var getStyles = function getStyles() {
19773 return "";
19774};
19775
19776/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
19777
19778/***/ }),
19779
19780/***/ "./src/diagrams/pie/pieDb.js":
19781/*!***********************************!*\
19782 !*** ./src/diagrams/pie/pieDb.js ***!
19783 \***********************************/
19784/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19785
19786"use strict";
19787__webpack_require__.r(__webpack_exports__);
19788/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19789/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
19790/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19791/* harmony export */ });
19792/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19793/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
19794/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
19795/**
19796 *
19797 */
19798
19799
19800
19801var sections = {};
19802var title = '';
19803var showData = false;
19804var parseDirective = function parseDirective(statement, context, type) {
19805 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
19806};
19807
19808var addSection = function addSection(id, value) {
19809 if (typeof sections[id] === 'undefined') {
19810 sections[id] = value;
19811 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Added new section :', id);
19812 }
19813};
19814
19815var getSections = function getSections() {
19816 return sections;
19817};
19818
19819var setTitle = function setTitle(txt) {
19820 title = txt;
19821};
19822
19823var setShowData = function setShowData(toggle) {
19824 showData = toggle;
19825};
19826
19827var getShowData = function getShowData() {
19828 return showData;
19829};
19830
19831var getTitle = function getTitle() {
19832 return title;
19833};
19834
19835var cleanupValue = function cleanupValue(value) {
19836 if (value.substring(0, 1) === ':') {
19837 value = value.substring(1).trim();
19838 return Number(value.trim());
19839 } else {
19840 return Number(value.trim());
19841 }
19842};
19843
19844var clear = function clear() {
19845 sections = {};
19846 title = '';
19847 showData = false;
19848}; // export const parseError = (err, hash) => {
19849// global.mermaidAPI.parseError(err, hash)
19850// }
19851
19852
19853/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19854 parseDirective: parseDirective,
19855 getConfig: function getConfig() {
19856 return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().pie;
19857 },
19858 addSection: addSection,
19859 getSections: getSections,
19860 cleanupValue: cleanupValue,
19861 clear: clear,
19862 setTitle: setTitle,
19863 getTitle: getTitle,
19864 setShowData: setShowData,
19865 getShowData: getShowData // parseError
19866
19867});
19868
19869/***/ }),
19870
19871/***/ "./src/diagrams/pie/pieRenderer.js":
19872/*!*****************************************!*\
19873 !*** ./src/diagrams/pie/pieRenderer.js ***!
19874 \*****************************************/
19875/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
19876
19877"use strict";
19878__webpack_require__.r(__webpack_exports__);
19879/* harmony export */ __webpack_require__.d(__webpack_exports__, {
19880/* harmony export */ "draw": () => (/* binding */ draw),
19881/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
19882/* harmony export */ });
19883/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
19884/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
19885/* harmony import */ var _pieDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pieDb */ "./src/diagrams/pie/pieDb.js");
19886/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./parser/pie */ "./src/diagrams/pie/parser/pie.jison");
19887/* harmony import */ var _parser_pie__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_parser_pie__WEBPACK_IMPORTED_MODULE_2__);
19888/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
19889/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
19890/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
19891/**
19892 * Created by AshishJ on 11-09-2019.
19893 */
19894
19895
19896
19897
19898
19899
19900var conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
19901/**
19902 * Draws a Pie Chart with the data given in text.
19903 * @param text
19904 * @param id
19905 */
19906
19907var width;
19908var height = 450;
19909var draw = function draw(txt, id) {
19910 try {
19911 conf = _config__WEBPACK_IMPORTED_MODULE_1__.getConfig();
19912 var parser = (_parser_pie__WEBPACK_IMPORTED_MODULE_2___default().parser);
19913 parser.yy = _pieDb__WEBPACK_IMPORTED_MODULE_3__["default"];
19914 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Rendering info diagram\n' + txt); // Parse the Pie Chart definition
19915
19916 parser.yy.clear();
19917 parser.parse(txt);
19918 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Parsed info diagram');
19919 var elem = document.getElementById(id);
19920 width = elem.parentElement.offsetWidth;
19921
19922 if (typeof width === 'undefined') {
19923 width = 1200;
19924 }
19925
19926 if (typeof conf.useWidth !== 'undefined') {
19927 width = conf.useWidth;
19928 }
19929
19930 if (typeof conf.pie.useWidth !== 'undefined') {
19931 width = conf.pie.useWidth;
19932 }
19933
19934 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
19935 (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.pie.useMaxWidth); // Set viewBox
19936
19937 elem.setAttribute('viewBox', '0 0 ' + width + ' ' + height); // Fetch the default direction, use TD if none was found
19938
19939 var margin = 40;
19940 var legendRectSize = 18;
19941 var legendSpacing = 4;
19942 var radius = Math.min(width, height) / 2 - margin;
19943 var svg = diagram.append('g').attr('transform', 'translate(' + width / 2 + ',' + height / 2 + ')');
19944 var data = _pieDb__WEBPACK_IMPORTED_MODULE_3__["default"].getSections();
19945 var sum = 0;
19946 Object.keys(data).forEach(function (key) {
19947 sum += data[key];
19948 });
19949 var themeVariables = conf.themeVariables;
19950 var myGeneratedColors = [themeVariables.pie1, themeVariables.pie2, themeVariables.pie3, themeVariables.pie4, themeVariables.pie5, themeVariables.pie6, themeVariables.pie7, themeVariables.pie8, themeVariables.pie9, themeVariables.pie10, themeVariables.pie11, themeVariables.pie12]; // Set the color scale
19951
19952 var color = (0,d3__WEBPACK_IMPORTED_MODULE_0__.scaleOrdinal)().range(myGeneratedColors); // Compute the position of each group on the pie:
19953
19954 var pie = (0,d3__WEBPACK_IMPORTED_MODULE_0__.pie)().value(function (d) {
19955 return d[1];
19956 });
19957 var dataReady = pie(Object.entries(data)); // Shape helper to build arcs:
19958
19959 var arcGenerator = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().innerRadius(0).outerRadius(radius); // Build the pie chart: each part of the pie is a path that we build using the arc function.
19960
19961 svg.selectAll('mySlices').data(dataReady).enter().append('path').attr('d', arcGenerator).attr('fill', function (d) {
19962 return color(d.data[0]);
19963 }).attr('class', 'pieCircle'); // Now add the percentage.
19964 // Use the centroid method to get the best coordinates.
19965
19966 svg.selectAll('mySlices').data(dataReady).enter().append('text').text(function (d) {
19967 return (d.data[1] / sum * 100).toFixed(0) + '%';
19968 }).attr('transform', function (d) {
19969 return 'translate(' + arcGenerator.centroid(d) + ')';
19970 }).style('text-anchor', 'middle').attr('class', 'slice');
19971 svg.append('text').text(parser.yy.getTitle()).attr('x', 0).attr('y', -(height - 50) / 2).attr('class', 'pieTitleText'); // Add the legends/annotations for each section
19972
19973 var legend = svg.selectAll('.legend').data(color.domain()).enter().append('g').attr('class', 'legend').attr('transform', function (d, i) {
19974 var height = legendRectSize + legendSpacing;
19975 var offset = height * color.domain().length / 2;
19976 var horz = 12 * legendRectSize;
19977 var vert = i * height - offset;
19978 return 'translate(' + horz + ',' + vert + ')';
19979 });
19980 legend.append('rect').attr('width', legendRectSize).attr('height', legendRectSize).style('fill', color).style('stroke', color);
19981 legend.data(dataReady).append('text').attr('x', legendRectSize + legendSpacing).attr('y', legendRectSize - legendSpacing).text(function (d) {
19982 if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
19983 return d.data[0] + ' [' + d.data[1] + ']';
19984 } else {
19985 return d.data[0];
19986 }
19987 });
19988 } catch (e) {
19989 _logger__WEBPACK_IMPORTED_MODULE_4__.log.error('Error while rendering info diagram');
19990 _logger__WEBPACK_IMPORTED_MODULE_4__.log.error(e);
19991 }
19992};
19993/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
19994 draw: draw
19995});
19996
19997/***/ }),
19998
19999/***/ "./src/diagrams/pie/styles.js":
20000/*!************************************!*\
20001 !*** ./src/diagrams/pie/styles.js ***!
20002 \************************************/
20003/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20004
20005"use strict";
20006__webpack_require__.r(__webpack_exports__);
20007/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20008/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20009/* harmony export */ });
20010var getStyles = function getStyles(options) {
20011 return "\n .pieCircle{\n stroke: ".concat(options.pieStrokeColor, ";\n stroke-width : ").concat(options.pieStrokeWidth, ";\n opacity : ").concat(options.pieOpacity, ";\n }\n .pieTitleText {\n text-anchor: middle;\n font-size: ").concat(options.pieTitleTextSize, ";\n fill: ").concat(options.pieTitleTextColor, ";\n font-family: ").concat(options.fontFamily, ";\n }\n .slice {\n font-family: ").concat(options.fontFamily, ";\n fill: ").concat(options.pieSectionTextColor, ";\n font-size:").concat(options.pieSectionTextSize, ";\n // fill: white;\n }\n .legend text {\n fill: ").concat(options.pieLegendTextColor, ";\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.pieLegendTextSize, ";\n }\n");
20012};
20013
20014/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
20015
20016/***/ }),
20017
20018/***/ "./src/diagrams/requirement/requirementDb.js":
20019/*!***************************************************!*\
20020 !*** ./src/diagrams/requirement/requirementDb.js ***!
20021 \***************************************************/
20022/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20023
20024"use strict";
20025__webpack_require__.r(__webpack_exports__);
20026/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20027/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
20028/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20029/* harmony export */ });
20030/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20031/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20032/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
20033
20034
20035
20036var relations = [];
20037var latestRequirement = {};
20038var requirements = {};
20039var latestElement = {};
20040var elements = {};
20041var RequirementType = {
20042 REQUIREMENT: 'Requirement',
20043 FUNCTIONAL_REQUIREMENT: 'Functional Requirement',
20044 INTERFACE_REQUIREMENT: 'Interface Requirement',
20045 PERFORMANCE_REQUIREMENT: 'Performance Requirement',
20046 PHYSICAL_REQUIREMENT: 'Physical Requirement',
20047 DESIGN_CONSTRAINT: 'Design Constraint'
20048};
20049var RiskLevel = {
20050 LOW_RISK: 'Low',
20051 MED_RISK: 'Medium',
20052 HIGH_RISK: 'High'
20053};
20054var VerifyType = {
20055 VERIFY_ANALYSIS: 'Analysis',
20056 VERIFY_DEMONSTRATION: 'Demonstration',
20057 VERIFY_INSPECTION: 'Inspection',
20058 VERIFY_TEST: 'Test'
20059};
20060var Relationships = {
20061 CONTAINS: 'contains',
20062 COPIES: 'copies',
20063 DERIVES: 'derives',
20064 SATISFIES: 'satisfies',
20065 VERIFIES: 'verifies',
20066 REFINES: 'refines',
20067 TRACES: 'traces'
20068};
20069var parseDirective = function parseDirective(statement, context, type) {
20070 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
20071};
20072
20073var addRequirement = function addRequirement(name, type) {
20074 if (typeof requirements[name] === 'undefined') {
20075 requirements[name] = {
20076 name: name,
20077 type: type,
20078 id: latestRequirement.id,
20079 text: latestRequirement.text,
20080 risk: latestRequirement.risk,
20081 verifyMethod: latestRequirement.verifyMethod
20082 };
20083 }
20084
20085 latestRequirement = {};
20086 return requirements[name];
20087};
20088
20089var getRequirements = function getRequirements() {
20090 return requirements;
20091};
20092
20093var setNewReqId = function setNewReqId(id) {
20094 if (typeof latestRequirement != 'undefined') {
20095 latestRequirement.id = id;
20096 }
20097};
20098
20099var setNewReqText = function setNewReqText(text) {
20100 if (typeof latestRequirement != 'undefined') {
20101 latestRequirement.text = text;
20102 }
20103};
20104
20105var setNewReqRisk = function setNewReqRisk(risk) {
20106 if (typeof latestRequirement != 'undefined') {
20107 latestRequirement.risk = risk;
20108 }
20109};
20110
20111var setNewReqVerifyMethod = function setNewReqVerifyMethod(verifyMethod) {
20112 if (typeof latestRequirement != 'undefined') {
20113 latestRequirement.verifyMethod = verifyMethod;
20114 }
20115};
20116
20117var addElement = function addElement(name) {
20118 if (typeof elements[name] === 'undefined') {
20119 elements[name] = {
20120 name: name,
20121 type: latestElement.type,
20122 docRef: latestElement.docRef
20123 };
20124 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Added new requirement: ', name);
20125 }
20126
20127 latestElement = {};
20128 return elements[name];
20129};
20130
20131var getElements = function getElements() {
20132 return elements;
20133};
20134
20135var setNewElementType = function setNewElementType(type) {
20136 if (typeof latestElement != 'undefined') {
20137 latestElement.type = type;
20138 }
20139};
20140
20141var setNewElementDocRef = function setNewElementDocRef(docRef) {
20142 if (typeof latestElement != 'undefined') {
20143 latestElement.docRef = docRef;
20144 }
20145};
20146
20147var addRelationship = function addRelationship(type, src, dst) {
20148 relations.push({
20149 type: type,
20150 src: src,
20151 dst: dst
20152 });
20153};
20154
20155var getRelationships = function getRelationships() {
20156 return relations;
20157};
20158
20159var clear = function clear() {
20160 relations = [];
20161 latestRequirement = {};
20162 requirements = {};
20163 latestElement = {};
20164 elements = {};
20165};
20166
20167/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
20168 RequirementType: RequirementType,
20169 RiskLevel: RiskLevel,
20170 VerifyType: VerifyType,
20171 Relationships: Relationships,
20172 parseDirective: parseDirective,
20173 getConfig: function getConfig() {
20174 return _config__WEBPACK_IMPORTED_MODULE_2__.getConfig().req;
20175 },
20176 addRequirement: addRequirement,
20177 getRequirements: getRequirements,
20178 setNewReqId: setNewReqId,
20179 setNewReqText: setNewReqText,
20180 setNewReqRisk: setNewReqRisk,
20181 setNewReqVerifyMethod: setNewReqVerifyMethod,
20182 addElement: addElement,
20183 getElements: getElements,
20184 setNewElementType: setNewElementType,
20185 setNewElementDocRef: setNewElementDocRef,
20186 addRelationship: addRelationship,
20187 getRelationships: getRelationships,
20188 clear: clear
20189});
20190
20191/***/ }),
20192
20193/***/ "./src/diagrams/requirement/requirementMarkers.js":
20194/*!********************************************************!*\
20195 !*** ./src/diagrams/requirement/requirementMarkers.js ***!
20196 \********************************************************/
20197/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20198
20199"use strict";
20200__webpack_require__.r(__webpack_exports__);
20201/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20202/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20203/* harmony export */ });
20204var ReqMarkers = {
20205 CONTAINS: 'contains',
20206 ARROW: 'arrow'
20207};
20208
20209var insertLineEndings = function insertLineEndings(parentNode, conf) {
20210 var containsNode = parentNode.append('defs').append('marker').attr('id', ReqMarkers.CONTAINS + '_line_ending').attr('refX', 0).attr('refY', conf.line_height / 2).attr('markerWidth', conf.line_height).attr('markerHeight', conf.line_height).attr('orient', 'auto').append('g');
20211 containsNode.append('circle').attr('cx', conf.line_height / 2).attr('cy', conf.line_height / 2).attr('r', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
20212 // .attr('stroke-width', 1)
20213 .attr('fill', 'none');
20214 containsNode.append('line').attr('x1', 0).attr('x2', conf.line_height).attr('y1', conf.line_height / 2).attr('y2', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
20215 .attr('stroke-width', 1);
20216 containsNode.append('line').attr('y1', 0).attr('y2', conf.line_height).attr('x1', conf.line_height / 2).attr('x2', conf.line_height / 2) // .attr('stroke', conf.rect_border_color)
20217 .attr('stroke-width', 1);
20218 parentNode.append('defs').append('marker').attr('id', ReqMarkers.ARROW + '_line_ending').attr('refX', conf.line_height).attr('refY', 0.5 * conf.line_height).attr('markerWidth', conf.line_height).attr('markerHeight', conf.line_height).attr('orient', 'auto').append('path').attr('d', "M0,0\n L".concat(conf.line_height, ",").concat(conf.line_height / 2, "\n M").concat(conf.line_height, ",").concat(conf.line_height / 2, "\n L0,").concat(conf.line_height)).attr('stroke-width', 1); // .attr('stroke', conf.rect_border_color);
20219};
20220
20221/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
20222 ReqMarkers: ReqMarkers,
20223 insertLineEndings: insertLineEndings
20224});
20225
20226/***/ }),
20227
20228/***/ "./src/diagrams/requirement/requirementRenderer.js":
20229/*!*********************************************************!*\
20230 !*** ./src/diagrams/requirement/requirementRenderer.js ***!
20231 \*********************************************************/
20232/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20233
20234"use strict";
20235__webpack_require__.r(__webpack_exports__);
20236/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20237/* harmony export */ "setConf": () => (/* binding */ setConf),
20238/* harmony export */ "drawReqs": () => (/* binding */ drawReqs),
20239/* harmony export */ "drawElements": () => (/* binding */ drawElements),
20240/* harmony export */ "draw": () => (/* binding */ draw),
20241/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20242/* harmony export */ });
20243/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
20244/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
20245/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
20246/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
20247/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
20248/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
20249/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20250/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
20251/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
20252/* harmony import */ var _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./parser/requirementDiagram */ "./src/diagrams/requirement/parser/requirementDiagram.jison");
20253/* harmony import */ var _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__);
20254/* harmony import */ var _requirementDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./requirementDb */ "./src/diagrams/requirement/requirementDb.js");
20255/* harmony import */ var _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./requirementMarkers */ "./src/diagrams/requirement/requirementMarkers.js");
20256
20257
20258 // import * as configApi from '../../config';
20259
20260
20261
20262
20263
20264
20265
20266var conf = {};
20267var relCnt = 0;
20268var setConf = function setConf(cnf) {
20269 if (typeof cnf === 'undefined') {
20270 return;
20271 }
20272
20273 var keys = Object.keys(cnf);
20274
20275 for (var i = 0; i < keys.length; i++) {
20276 conf[keys[i]] = cnf[keys[i]];
20277 }
20278};
20279
20280var newRectNode = function newRectNode(parentNode, id) {
20281 return parentNode.insert('rect', '#' + id).attr('class', 'req reqBox').attr('x', 0).attr('y', 0).attr('width', conf.rect_min_width + 'px').attr('height', conf.rect_min_height + 'px');
20282};
20283
20284var newTitleNode = function newTitleNode(parentNode, id, txts) {
20285 var x = conf.rect_min_width / 2;
20286 var title = parentNode.append('text').attr('class', 'req reqLabel reqTitle').attr('id', id).attr('x', x).attr('y', conf.rect_padding).attr('dominant-baseline', 'hanging'); // .attr(
20287 // 'style',
20288 // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
20289 // )
20290
20291 var i = 0;
20292 txts.forEach(function (textStr) {
20293 if (i == 0) {
20294 title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', 0).text(textStr);
20295 } else {
20296 title.append('tspan').attr('text-anchor', 'middle').attr('x', conf.rect_min_width / 2).attr('dy', conf.line_height * 0.75).text(textStr);
20297 }
20298
20299 i++;
20300 });
20301 var yPadding = 1.5 * conf.rect_padding;
20302 var linePadding = i * conf.line_height * 0.75;
20303 var totalY = yPadding + linePadding;
20304 parentNode.append('line').attr('class', 'req-title-line').attr('x1', '0').attr('x2', conf.rect_min_width).attr('y1', totalY).attr('y2', totalY);
20305 return {
20306 titleNode: title,
20307 y: totalY
20308 };
20309};
20310
20311var newBodyNode = function newBodyNode(parentNode, id, txts, yStart) {
20312 var body = parentNode.append('text').attr('class', 'req reqLabel').attr('id', id).attr('x', conf.rect_padding).attr('y', yStart).attr('dominant-baseline', 'hanging'); // .attr(
20313 // 'style',
20314 // 'font-family: ' + configApi.getConfig().fontFamily + '; font-size: ' + conf.fontSize + 'px'
20315 // );
20316
20317 var currentRow = 0;
20318 var charLimit = 30;
20319 var wrappedTxts = [];
20320 txts.forEach(function (textStr) {
20321 var currentTextLen = textStr.length;
20322
20323 while (currentTextLen > charLimit && currentRow < 3) {
20324 var firstPart = textStr.substring(0, charLimit);
20325 textStr = textStr.substring(charLimit, textStr.length);
20326 currentTextLen = textStr.length;
20327 wrappedTxts[wrappedTxts.length] = firstPart;
20328 currentRow++;
20329 }
20330
20331 if (currentRow == 3) {
20332 var lastStr = wrappedTxts[wrappedTxts.length - 1];
20333 wrappedTxts[wrappedTxts.length - 1] = lastStr.substring(0, lastStr.length - 4) + '...';
20334 } else {
20335 wrappedTxts[wrappedTxts.length] = textStr;
20336 }
20337
20338 currentRow = 0;
20339 });
20340 wrappedTxts.forEach(function (textStr) {
20341 body.append('tspan').attr('x', conf.rect_padding).attr('dy', conf.line_height).text(textStr);
20342 });
20343 return body;
20344};
20345
20346var addEdgeLabel = function addEdgeLabel(parentNode, svgPath, conf, txt) {
20347 // Find the half-way point
20348 var len = svgPath.node().getTotalLength();
20349 var labelPoint = svgPath.node().getPointAtLength(len * 0.5); // Append a text node containing the label
20350
20351 var labelId = 'rel' + relCnt;
20352 relCnt++;
20353 var labelNode = parentNode.append('text').attr('class', 'req relationshipLabel').attr('id', labelId).attr('x', labelPoint.x).attr('y', labelPoint.y).attr('text-anchor', 'middle').attr('dominant-baseline', 'middle') // .attr('style', 'font-family: ' + conf.fontFamily + '; font-size: ' + conf.fontSize + 'px')
20354 .text(txt); // Figure out how big the opaque 'container' rectangle needs to be
20355
20356 var labelBBox = labelNode.node().getBBox(); // Insert the opaque rectangle before the text label
20357
20358 parentNode.insert('rect', '#' + labelId).attr('class', 'req reqLabelBox').attr('x', labelPoint.x - labelBBox.width / 2).attr('y', labelPoint.y - labelBBox.height / 2).attr('width', labelBBox.width).attr('height', labelBBox.height).attr('fill', 'white').attr('fill-opacity', '85%');
20359};
20360
20361var drawRelationshipFromLayout = function drawRelationshipFromLayout(svg, rel, g, insert) {
20362 // Find the edge relating to this relationship
20363 var edge = g.edge(elementString(rel.src), elementString(rel.dst)); // Get a function that will generate the line path
20364
20365 var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
20366 return d.x;
20367 }).y(function (d) {
20368 return d.y;
20369 }); // Insert the line at the right place
20370
20371 var svgPath = svg.insert('path', '#' + insert).attr('class', 'er relationshipLine').attr('d', lineFunction(edge.points)).attr('fill', 'none');
20372
20373 if (rel.type == _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].Relationships.CONTAINS) {
20374 svgPath.attr('marker-start', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + rel.type + '_line_ending' + ')');
20375 } else {
20376 svgPath.attr('stroke-dasharray', '10,7');
20377 svgPath.attr('marker-end', 'url(' + _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].getUrl(conf.arrowMarkerAbsolute) + '#' + _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].ReqMarkers.ARROW + '_line_ending' + ')');
20378 }
20379
20380 addEdgeLabel(svg, svgPath, conf, "<<".concat(rel.type, ">>"));
20381 return;
20382};
20383
20384var drawReqs = function drawReqs(reqs, graph, svgNode) {
20385 Object.keys(reqs).forEach(function (reqName) {
20386 var req = reqs[reqName];
20387 reqName = elementString(reqName);
20388 _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Added new requirement: ', reqName);
20389 var groupNode = svgNode.append('g').attr('id', reqName);
20390 var textId = 'req-' + reqName;
20391 var rectNode = newRectNode(groupNode, textId);
20392 var nodes = [];
20393 var titleNodeInfo = newTitleNode(groupNode, reqName + '_title', ["<<".concat(req.type, ">>"), "".concat(req.name)]);
20394 nodes.push(titleNodeInfo.titleNode);
20395 var bodyNode = newBodyNode(groupNode, reqName + '_body', ["Id: ".concat(req.id), "Text: ".concat(req.text), "Risk: ".concat(req.risk), "Verification: ".concat(req.verifyMethod)], titleNodeInfo.y);
20396 nodes.push(bodyNode);
20397 var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
20398
20399 graph.setNode(reqName, {
20400 width: rectBBox.width,
20401 height: rectBBox.height,
20402 shape: 'rect',
20403 id: reqName
20404 });
20405 });
20406};
20407var drawElements = function drawElements(els, graph, svgNode) {
20408 Object.keys(els).forEach(function (elName) {
20409 var el = els[elName];
20410 var id = elementString(elName);
20411 var groupNode = svgNode.append('g').attr('id', id);
20412 var textId = 'element-' + id;
20413 var rectNode = newRectNode(groupNode, textId);
20414 var nodes = [];
20415 var titleNodeInfo = newTitleNode(groupNode, textId + '_title', ["<<Element>>", "".concat(elName)]);
20416 nodes.push(titleNodeInfo.titleNode);
20417 var bodyNode = newBodyNode(groupNode, textId + '_body', ["Type: ".concat(el.type || 'Not Specified'), "Doc Ref: ".concat(el.docRef || 'None')], titleNodeInfo.y);
20418 nodes.push(bodyNode);
20419 var rectBBox = rectNode.node().getBBox(); // Add the entity to the graph
20420
20421 graph.setNode(id, {
20422 width: rectBBox.width,
20423 height: rectBBox.height,
20424 shape: 'rect',
20425 id: id
20426 });
20427 });
20428};
20429
20430var addRelationships = function addRelationships(relationships, g) {
20431 relationships.forEach(function (r) {
20432 var src = elementString(r.src);
20433 var dst = elementString(r.dst);
20434 g.setEdge(src, dst, {
20435 relationship: r
20436 });
20437 });
20438 return relationships;
20439};
20440
20441var adjustEntities = function adjustEntities(svgNode, graph) {
20442 graph.nodes().forEach(function (v) {
20443 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
20444 svgNode.select('#' + v);
20445 svgNode.select('#' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y - graph.node(v).height / 2) + ' )');
20446 }
20447 });
20448 return;
20449};
20450
20451var elementString = function elementString(str) {
20452 return str.replace(/\s/g, '').replace(/\./g, '_');
20453};
20454
20455var draw = function draw(text, id) {
20456 _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.yy = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"];
20457 _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.yy.clear();
20458 _parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_7__.parser.parse(text);
20459 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
20460 _requirementMarkers__WEBPACK_IMPORTED_MODULE_5__["default"].insertLineEndings(svg, conf);
20461 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
20462 multigraph: false,
20463 compound: false,
20464 directed: true
20465 }).setGraph({
20466 rankdir: conf.layoutDirection,
20467 marginx: 20,
20468 marginy: 20,
20469 nodesep: 100,
20470 edgesep: 100,
20471 ranksep: 100
20472 }).setDefaultEdgeLabel(function () {
20473 return {};
20474 });
20475 var requirements = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRequirements();
20476 var elements = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getElements();
20477 var relationships = _requirementDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRelationships();
20478 drawReqs(requirements, g, svg);
20479 drawElements(elements, g, svg);
20480 addRelationships(relationships, g);
20481 dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(g);
20482 adjustEntities(svg, g);
20483 relationships.forEach(function (rel) {
20484 drawRelationshipFromLayout(svg, rel, g, id);
20485 }); // svg.attr('height', '500px');
20486
20487 var padding = conf.rect_padding;
20488 var svgBounds = svg.node().getBBox();
20489 var width = svgBounds.width + padding * 2;
20490 var height = svgBounds.height + padding * 2;
20491 (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width, conf.useMaxWidth);
20492 svg.attr('viewBox', "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height));
20493};
20494/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
20495 setConf: setConf,
20496 draw: draw
20497});
20498
20499/***/ }),
20500
20501/***/ "./src/diagrams/requirement/styles.js":
20502/*!********************************************!*\
20503 !*** ./src/diagrams/requirement/styles.js ***!
20504 \********************************************/
20505/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20506
20507"use strict";
20508__webpack_require__.r(__webpack_exports__);
20509/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20510/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20511/* harmony export */ });
20512var getStyles = function getStyles(options) {
20513 return "\n\n marker {\n fill: ".concat(options.relationColor, ";\n stroke: ").concat(options.relationColor, ";\n }\n\n marker.cross {\n stroke: ").concat(options.lineColor, ";\n }\n\n svg {\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n }\n\n .reqBox {\n fill: ").concat(options.requirementBackground, ";\n fill-opacity: 100%;\n stroke: ").concat(options.requirementBorderColor, ";\n stroke-width: ").concat(options.requirementBorderSize, ";\n }\n \n .reqTitle, .reqLabel{\n fill: ").concat(options.requirementTextColor, ";\n }\n .reqLabelBox {\n fill: ").concat(options.relationLabelBackground, ";\n fill-opacity: 100%;\n }\n\n .req-title-line {\n stroke: ").concat(options.requirementBorderColor, ";\n stroke-width: ").concat(options.requirementBorderSize, ";\n }\n .relationshipLine {\n stroke: ").concat(options.relationColor, ";\n stroke-width: 1;\n }\n .relationshipLabel {\n fill: ").concat(options.relationLabelColor, ";\n }\n\n");
20514}; // fill', conf.rect_fill)
20515
20516
20517/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
20518
20519/***/ }),
20520
20521/***/ "./src/diagrams/sequence/sequenceDb.js":
20522/*!*********************************************!*\
20523 !*** ./src/diagrams/sequence/sequenceDb.js ***!
20524 \*********************************************/
20525/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
20526
20527"use strict";
20528__webpack_require__.r(__webpack_exports__);
20529/* harmony export */ __webpack_require__.d(__webpack_exports__, {
20530/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
20531/* harmony export */ "addActor": () => (/* binding */ addActor),
20532/* harmony export */ "addMessage": () => (/* binding */ addMessage),
20533/* harmony export */ "addSignal": () => (/* binding */ addSignal),
20534/* harmony export */ "getMessages": () => (/* binding */ getMessages),
20535/* harmony export */ "getActors": () => (/* binding */ getActors),
20536/* harmony export */ "getActor": () => (/* binding */ getActor),
20537/* harmony export */ "getActorKeys": () => (/* binding */ getActorKeys),
20538/* harmony export */ "getTitle": () => (/* binding */ getTitle),
20539/* harmony export */ "getTitleWrapped": () => (/* binding */ getTitleWrapped),
20540/* harmony export */ "enableSequenceNumbers": () => (/* binding */ enableSequenceNumbers),
20541/* harmony export */ "showSequenceNumbers": () => (/* binding */ showSequenceNumbers),
20542/* harmony export */ "setWrap": () => (/* binding */ setWrap),
20543/* harmony export */ "autoWrap": () => (/* binding */ autoWrap),
20544/* harmony export */ "clear": () => (/* binding */ clear),
20545/* harmony export */ "parseMessage": () => (/* binding */ parseMessage),
20546/* harmony export */ "LINETYPE": () => (/* binding */ LINETYPE),
20547/* harmony export */ "ARROWTYPE": () => (/* binding */ ARROWTYPE),
20548/* harmony export */ "PLACEMENT": () => (/* binding */ PLACEMENT),
20549/* harmony export */ "addNote": () => (/* binding */ addNote),
20550/* harmony export */ "addLinks": () => (/* binding */ addLinks),
20551/* harmony export */ "addALink": () => (/* binding */ addALink),
20552/* harmony export */ "addProperties": () => (/* binding */ addProperties),
20553/* harmony export */ "addDetails": () => (/* binding */ addDetails),
20554/* harmony export */ "getActorProperty": () => (/* binding */ getActorProperty),
20555/* harmony export */ "setTitle": () => (/* binding */ setTitle),
20556/* harmony export */ "apply": () => (/* binding */ apply),
20557/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
20558/* harmony export */ });
20559/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
20560/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
20561/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
20562/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
20563
20564
20565
20566
20567var prevActor = undefined;
20568var actors = {};
20569var messages = [];
20570var notes = [];
20571var title = '';
20572var titleWrapped = false;
20573var sequenceNumbersEnabled = false;
20574var wrapEnabled = false;
20575var parseDirective = function parseDirective(statement, context, type) {
20576 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
20577};
20578var addActor = function addActor(id, name, description, type) {
20579 // Don't allow description nulling
20580 var old = actors[id];
20581 if (old && name === old.name && description == null) return; // Don't allow null descriptions, either
20582
20583 if (description == null || description.text == null) {
20584 description = {
20585 text: name,
20586 wrap: null,
20587 type: type
20588 };
20589 }
20590
20591 if (type == null || description.text == null) {
20592 description = {
20593 text: name,
20594 wrap: null,
20595 type: type
20596 };
20597 }
20598
20599 actors[id] = {
20600 name: name,
20601 description: description.text,
20602 wrap: description.wrap === undefined && autoWrap() || !!description.wrap,
20603 prevActor: prevActor,
20604 links: {},
20605 properties: {},
20606 actorCnt: null,
20607 rectData: null,
20608 type: type || 'participant'
20609 };
20610
20611 if (prevActor && actors[prevActor]) {
20612 actors[prevActor].nextActor = id;
20613 }
20614
20615 prevActor = id;
20616};
20617
20618var activationCount = function activationCount(part) {
20619 var i;
20620 var count = 0;
20621
20622 for (i = 0; i < messages.length; i++) {
20623 if (messages[i].type === LINETYPE.ACTIVE_START) {
20624 if (messages[i].from.actor === part) {
20625 count++;
20626 }
20627 }
20628
20629 if (messages[i].type === LINETYPE.ACTIVE_END) {
20630 if (messages[i].from.actor === part) {
20631 count--;
20632 }
20633 }
20634 }
20635
20636 return count;
20637};
20638
20639var addMessage = function addMessage(idFrom, idTo, message, answer) {
20640 messages.push({
20641 from: idFrom,
20642 to: idTo,
20643 message: message.text,
20644 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
20645 answer: answer
20646 });
20647};
20648var addSignal = function addSignal(idFrom, idTo) {
20649 var message = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
20650 text: undefined,
20651 wrap: undefined
20652 };
20653 var messageType = arguments.length > 3 ? arguments[3] : undefined;
20654
20655 if (messageType === LINETYPE.ACTIVE_END) {
20656 var cnt = activationCount(idFrom.actor);
20657
20658 if (cnt < 1) {
20659 // Bail out as there is an activation signal from an inactive participant
20660 var error = new Error('Trying to inactivate an inactive participant (' + idFrom.actor + ')');
20661 error.hash = {
20662 text: '->>-',
20663 token: '->>-',
20664 line: '1',
20665 loc: {
20666 first_line: 1,
20667 last_line: 1,
20668 first_column: 1,
20669 last_column: 1
20670 },
20671 expected: ["'ACTIVE_PARTICIPANT'"]
20672 };
20673 throw error;
20674 }
20675 }
20676
20677 messages.push({
20678 from: idFrom,
20679 to: idTo,
20680 message: message.text,
20681 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
20682 type: messageType
20683 });
20684 return true;
20685};
20686var getMessages = function getMessages() {
20687 return messages;
20688};
20689var getActors = function getActors() {
20690 return actors;
20691};
20692var getActor = function getActor(id) {
20693 return actors[id];
20694};
20695var getActorKeys = function getActorKeys() {
20696 return Object.keys(actors);
20697};
20698var getTitle = function getTitle() {
20699 return title;
20700};
20701var getTitleWrapped = function getTitleWrapped() {
20702 return titleWrapped;
20703};
20704var enableSequenceNumbers = function enableSequenceNumbers() {
20705 sequenceNumbersEnabled = true;
20706};
20707var showSequenceNumbers = function showSequenceNumbers() {
20708 return sequenceNumbersEnabled;
20709};
20710var setWrap = function setWrap(wrapSetting) {
20711 wrapEnabled = wrapSetting;
20712};
20713var autoWrap = function autoWrap() {
20714 return wrapEnabled;
20715};
20716var clear = function clear() {
20717 actors = {};
20718 messages = [];
20719};
20720var parseMessage = function parseMessage(str) {
20721 var _str = str.trim();
20722
20723 var message = {
20724 text: _str.replace(/^[:]?(?:no)?wrap:/, '').trim(),
20725 wrap: _str.match(/^[:]?wrap:/) !== null ? true : _str.match(/^[:]?nowrap:/) !== null ? false : undefined
20726 };
20727 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('parseMessage:', message);
20728 return message;
20729};
20730var LINETYPE = {
20731 SOLID: 0,
20732 DOTTED: 1,
20733 NOTE: 2,
20734 SOLID_CROSS: 3,
20735 DOTTED_CROSS: 4,
20736 SOLID_OPEN: 5,
20737 DOTTED_OPEN: 6,
20738 LOOP_START: 10,
20739 LOOP_END: 11,
20740 ALT_START: 12,
20741 ALT_ELSE: 13,
20742 ALT_END: 14,
20743 OPT_START: 15,
20744 OPT_END: 16,
20745 ACTIVE_START: 17,
20746 ACTIVE_END: 18,
20747 PAR_START: 19,
20748 PAR_AND: 20,
20749 PAR_END: 21,
20750 RECT_START: 22,
20751 RECT_END: 23,
20752 SOLID_POINT: 24,
20753 DOTTED_POINT: 25
20754};
20755var ARROWTYPE = {
20756 FILLED: 0,
20757 OPEN: 1
20758};
20759var PLACEMENT = {
20760 LEFTOF: 0,
20761 RIGHTOF: 1,
20762 OVER: 2
20763};
20764var addNote = function addNote(actor, placement, message) {
20765 var note = {
20766 actor: actor,
20767 placement: placement,
20768 message: message.text,
20769 wrap: message.wrap === undefined && autoWrap() || !!message.wrap
20770 }; // Coerce actor into a [to, from, ...] array
20771
20772 var actors = [].concat(actor, actor);
20773 notes.push(note);
20774 messages.push({
20775 from: actors[0],
20776 to: actors[1],
20777 message: message.text,
20778 wrap: message.wrap === undefined && autoWrap() || !!message.wrap,
20779 type: LINETYPE.NOTE,
20780 placement: placement
20781 });
20782};
20783var addLinks = function addLinks(actorId, text) {
20784 // find the actor
20785 var actor = getActor(actorId); // JSON.parse the text
20786
20787 try {
20788 var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
20789 sanitizedText = sanitizedText.replace(/&amp;/g, '&');
20790 sanitizedText = sanitizedText.replace(/&equals;/g, '=');
20791 var links = JSON.parse(sanitizedText); // add the deserialized text to the actor's links field.
20792
20793 insertLinks(actor, links);
20794 } catch (e) {
20795 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor link text', e);
20796 }
20797};
20798var addALink = function addALink(actorId, text) {
20799 // find the actor
20800 var actor = getActor(actorId);
20801
20802 try {
20803 var links = {};
20804 var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
20805 var sep = sanitizedText.indexOf('@');
20806 sanitizedText = sanitizedText.replace(/&amp;/g, '&');
20807 sanitizedText = sanitizedText.replace(/&equals;/g, '=');
20808 var label = sanitizedText.slice(0, sep - 1).trim();
20809 var link = sanitizedText.slice(sep + 1).trim();
20810 links[label] = link; // add the deserialized text to the actor's links field.
20811
20812 insertLinks(actor, links);
20813 } catch (e) {
20814 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor link text', e);
20815 }
20816};
20817
20818function insertLinks(actor, links) {
20819 if (actor.links == null) {
20820 actor.links = links;
20821 } else {
20822 for (var key in links) {
20823 actor.links[key] = links[key];
20824 }
20825 }
20826}
20827
20828var addProperties = function addProperties(actorId, text) {
20829 // find the actor
20830 var actor = getActor(actorId); // JSON.parse the text
20831
20832 try {
20833 var sanitizedText = (0,_common_common__WEBPACK_IMPORTED_MODULE_2__.sanitizeText)(text.text, _config__WEBPACK_IMPORTED_MODULE_3__.getConfig());
20834 var properties = JSON.parse(sanitizedText); // add the deserialized text to the actor's property field.
20835
20836 insertProperties(actor, properties);
20837 } catch (e) {
20838 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor properties text', e);
20839 }
20840};
20841
20842function insertProperties(actor, properties) {
20843 if (actor.properties == null) {
20844 actor.properties = properties;
20845 } else {
20846 for (var key in properties) {
20847 actor.properties[key] = properties[key];
20848 }
20849 }
20850}
20851
20852var addDetails = function addDetails(actorId, text) {
20853 // find the actor
20854 var actor = getActor(actorId);
20855 var elem = document.getElementById(text.text); // JSON.parse the text
20856
20857 try {
20858 var _text = elem.innerHTML;
20859 var details = JSON.parse(_text); // add the deserialized text to the actor's property field.
20860
20861 if (details['properties']) {
20862 insertProperties(actor, details['properties']);
20863 }
20864
20865 if (details['links']) {
20866 insertLinks(actor, details['links']);
20867 }
20868 } catch (e) {
20869 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('error while parsing actor details text', e);
20870 }
20871};
20872var getActorProperty = function getActorProperty(actor, key) {
20873 if (typeof actor !== 'undefined' && typeof actor.properties !== 'undefined') {
20874 return actor.properties[key];
20875 }
20876
20877 return undefined;
20878};
20879var setTitle = function setTitle(titleWrap) {
20880 title = titleWrap.text;
20881 titleWrapped = titleWrap.wrap === undefined && autoWrap() || !!titleWrap.wrap;
20882};
20883var apply = function apply(param) {
20884 if (param instanceof Array) {
20885 param.forEach(function (item) {
20886 apply(item);
20887 });
20888 } else {
20889 switch (param.type) {
20890 case 'addParticipant':
20891 addActor(param.actor, param.actor, param.description, 'participant');
20892 break;
20893
20894 case 'addActor':
20895 addActor(param.actor, param.actor, param.description, 'actor');
20896 break;
20897
20898 case 'activeStart':
20899 addSignal(param.actor, undefined, undefined, param.signalType);
20900 break;
20901
20902 case 'activeEnd':
20903 addSignal(param.actor, undefined, undefined, param.signalType);
20904 break;
20905
20906 case 'addNote':
20907 addNote(param.actor, param.placement, param.text);
20908 break;
20909
20910 case 'addLinks':
20911 addLinks(param.actor, param.text);
20912 break;
20913
20914 case 'addALink':
20915 addALink(param.actor, param.text);
20916 break;
20917
20918 case 'addProperties':
20919 addProperties(param.actor, param.text);
20920 break;
20921
20922 case 'addDetails':
20923 addDetails(param.actor, param.text);
20924 break;
20925
20926 case 'addMessage':
20927 addSignal(param.from, param.to, param.msg, param.signalType);
20928 break;
20929
20930 case 'loopStart':
20931 addSignal(undefined, undefined, param.loopText, param.signalType);
20932 break;
20933
20934 case 'loopEnd':
20935 addSignal(undefined, undefined, undefined, param.signalType);
20936 break;
20937
20938 case 'rectStart':
20939 addSignal(undefined, undefined, param.color, param.signalType);
20940 break;
20941
20942 case 'rectEnd':
20943 addSignal(undefined, undefined, undefined, param.signalType);
20944 break;
20945
20946 case 'optStart':
20947 addSignal(undefined, undefined, param.optText, param.signalType);
20948 break;
20949
20950 case 'optEnd':
20951 addSignal(undefined, undefined, undefined, param.signalType);
20952 break;
20953
20954 case 'altStart':
20955 addSignal(undefined, undefined, param.altText, param.signalType);
20956 break;
20957
20958 case 'else':
20959 addSignal(undefined, undefined, param.altText, param.signalType);
20960 break;
20961
20962 case 'altEnd':
20963 addSignal(undefined, undefined, undefined, param.signalType);
20964 break;
20965
20966 case 'setTitle':
20967 setTitle(param.text);
20968 break;
20969
20970 case 'parStart':
20971 addSignal(undefined, undefined, param.parText, param.signalType);
20972 break;
20973
20974 case 'and':
20975 addSignal(undefined, undefined, param.parText, param.signalType);
20976 break;
20977
20978 case 'parEnd':
20979 addSignal(undefined, undefined, undefined, param.signalType);
20980 break;
20981 }
20982 }
20983};
20984/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
20985 addActor: addActor,
20986 addMessage: addMessage,
20987 addSignal: addSignal,
20988 addLinks: addLinks,
20989 addDetails: addDetails,
20990 addProperties: addProperties,
20991 autoWrap: autoWrap,
20992 setWrap: setWrap,
20993 enableSequenceNumbers: enableSequenceNumbers,
20994 showSequenceNumbers: showSequenceNumbers,
20995 getMessages: getMessages,
20996 getActors: getActors,
20997 getActor: getActor,
20998 getActorKeys: getActorKeys,
20999 getActorProperty: getActorProperty,
21000 getTitle: getTitle,
21001 parseDirective: parseDirective,
21002 getConfig: function getConfig() {
21003 return _config__WEBPACK_IMPORTED_MODULE_3__.getConfig().sequence;
21004 },
21005 getTitleWrapped: getTitleWrapped,
21006 clear: clear,
21007 parseMessage: parseMessage,
21008 LINETYPE: LINETYPE,
21009 ARROWTYPE: ARROWTYPE,
21010 PLACEMENT: PLACEMENT,
21011 addNote: addNote,
21012 setTitle: setTitle,
21013 apply: apply
21014});
21015
21016/***/ }),
21017
21018/***/ "./src/diagrams/sequence/sequenceRenderer.js":
21019/*!***************************************************!*\
21020 !*** ./src/diagrams/sequence/sequenceRenderer.js ***!
21021 \***************************************************/
21022/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
21023
21024"use strict";
21025__webpack_require__.r(__webpack_exports__);
21026/* harmony export */ __webpack_require__.d(__webpack_exports__, {
21027/* harmony export */ "bounds": () => (/* binding */ bounds),
21028/* harmony export */ "drawActors": () => (/* binding */ drawActors),
21029/* harmony export */ "drawActorsPopup": () => (/* binding */ drawActorsPopup),
21030/* harmony export */ "setConf": () => (/* binding */ setConf),
21031/* harmony export */ "draw": () => (/* binding */ draw),
21032/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
21033/* harmony export */ });
21034/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
21035/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
21036/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/sequence/svgDraw.js");
21037/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
21038/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
21039/* harmony import */ var _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__);
21040/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
21041/* harmony import */ var _sequenceDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
21042/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../config */ "./src/config.js");
21043/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
21044
21045
21046
21047
21048
21049
21050
21051
21052_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _sequenceDb__WEBPACK_IMPORTED_MODULE_2__["default"];
21053var conf = {};
21054var bounds = {
21055 data: {
21056 startx: undefined,
21057 stopx: undefined,
21058 starty: undefined,
21059 stopy: undefined
21060 },
21061 verticalPos: 0,
21062 sequenceItems: [],
21063 activations: [],
21064 models: {
21065 getHeight: function getHeight() {
21066 return Math.max.apply(null, this.actors.length === 0 ? [0] : this.actors.map(function (actor) {
21067 return actor.height || 0;
21068 })) + (this.loops.length === 0 ? 0 : this.loops.map(function (it) {
21069 return it.height || 0;
21070 }).reduce(function (acc, h) {
21071 return acc + h;
21072 })) + (this.messages.length === 0 ? 0 : this.messages.map(function (it) {
21073 return it.height || 0;
21074 }).reduce(function (acc, h) {
21075 return acc + h;
21076 })) + (this.notes.length === 0 ? 0 : this.notes.map(function (it) {
21077 return it.height || 0;
21078 }).reduce(function (acc, h) {
21079 return acc + h;
21080 }));
21081 },
21082 clear: function clear() {
21083 this.actors = [];
21084 this.loops = [];
21085 this.messages = [];
21086 this.notes = [];
21087 },
21088 addActor: function addActor(actorModel) {
21089 this.actors.push(actorModel);
21090 },
21091 addLoop: function addLoop(loopModel) {
21092 this.loops.push(loopModel);
21093 },
21094 addMessage: function addMessage(msgModel) {
21095 this.messages.push(msgModel);
21096 },
21097 addNote: function addNote(noteModel) {
21098 this.notes.push(noteModel);
21099 },
21100 lastActor: function lastActor() {
21101 return this.actors[this.actors.length - 1];
21102 },
21103 lastLoop: function lastLoop() {
21104 return this.loops[this.loops.length - 1];
21105 },
21106 lastMessage: function lastMessage() {
21107 return this.messages[this.messages.length - 1];
21108 },
21109 lastNote: function lastNote() {
21110 return this.notes[this.notes.length - 1];
21111 },
21112 actors: [],
21113 loops: [],
21114 messages: [],
21115 notes: []
21116 },
21117 init: function init() {
21118 this.sequenceItems = [];
21119 this.activations = [];
21120 this.models.clear();
21121 this.data = {
21122 startx: undefined,
21123 stopx: undefined,
21124 starty: undefined,
21125 stopy: undefined
21126 };
21127 this.verticalPos = 0;
21128 setConf(_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getConfig());
21129 },
21130 updateVal: function updateVal(obj, key, val, fun) {
21131 if (typeof obj[key] === 'undefined') {
21132 obj[key] = val;
21133 } else {
21134 obj[key] = fun(val, obj[key]);
21135 }
21136 },
21137 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
21138 var _self = this;
21139
21140 var cnt = 0;
21141
21142 function updateFn(type) {
21143 return function updateItemBounds(item) {
21144 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
21145
21146 var n = _self.sequenceItems.length - cnt + 1;
21147
21148 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
21149
21150 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
21151
21152 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
21153
21154 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
21155
21156 if (!(type === 'activation')) {
21157 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
21158
21159 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
21160
21161 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
21162
21163 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
21164 }
21165 };
21166 }
21167
21168 this.sequenceItems.forEach(updateFn());
21169 this.activations.forEach(updateFn('activation'));
21170 },
21171 insert: function insert(startx, starty, stopx, stopy) {
21172 var _startx = Math.min(startx, stopx);
21173
21174 var _stopx = Math.max(startx, stopx);
21175
21176 var _starty = Math.min(starty, stopy);
21177
21178 var _stopy = Math.max(starty, stopy);
21179
21180 this.updateVal(bounds.data, 'startx', _startx, Math.min);
21181 this.updateVal(bounds.data, 'starty', _starty, Math.min);
21182 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
21183 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
21184 this.updateBounds(_startx, _starty, _stopx, _stopy);
21185 },
21186 newActivation: function newActivation(message, diagram, actors) {
21187 var actorRect = actors[message.from.actor];
21188 var stackedSize = actorActivations(message.from.actor).length || 0;
21189 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
21190 this.activations.push({
21191 startx: x,
21192 starty: this.verticalPos + 2,
21193 stopx: x + conf.activationWidth,
21194 stopy: undefined,
21195 actor: message.from.actor,
21196 anchored: _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].anchorElement(diagram)
21197 });
21198 },
21199 endActivation: function endActivation(message) {
21200 // find most recent activation for given actor
21201 var lastActorActivationIdx = this.activations.map(function (activation) {
21202 return activation.actor;
21203 }).lastIndexOf(message.from.actor);
21204 return this.activations.splice(lastActorActivationIdx, 1)[0];
21205 },
21206 createLoop: function createLoop() {
21207 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
21208 message: undefined,
21209 wrap: false,
21210 width: undefined
21211 };
21212 var fill = arguments.length > 1 ? arguments[1] : undefined;
21213 return {
21214 startx: undefined,
21215 starty: this.verticalPos,
21216 stopx: undefined,
21217 stopy: undefined,
21218 title: title.message,
21219 wrap: title.wrap,
21220 width: title.width,
21221 height: 0,
21222 fill: fill
21223 };
21224 },
21225 newLoop: function newLoop() {
21226 var title = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
21227 message: undefined,
21228 wrap: false,
21229 width: undefined
21230 };
21231 var fill = arguments.length > 1 ? arguments[1] : undefined;
21232 this.sequenceItems.push(this.createLoop(title, fill));
21233 },
21234 endLoop: function endLoop() {
21235 return this.sequenceItems.pop();
21236 },
21237 addSectionToLoop: function addSectionToLoop(message) {
21238 var loop = this.sequenceItems.pop();
21239 loop.sections = loop.sections || [];
21240 loop.sectionTitles = loop.sectionTitles || [];
21241 loop.sections.push({
21242 y: bounds.getVerticalPos(),
21243 height: 0
21244 });
21245 loop.sectionTitles.push(message);
21246 this.sequenceItems.push(loop);
21247 },
21248 bumpVerticalPos: function bumpVerticalPos(bump) {
21249 this.verticalPos = this.verticalPos + bump;
21250 this.data.stopy = this.verticalPos;
21251 },
21252 getVerticalPos: function getVerticalPos() {
21253 return this.verticalPos;
21254 },
21255 getBounds: function getBounds() {
21256 return {
21257 bounds: this.data,
21258 models: this.models
21259 };
21260 }
21261};
21262/**
21263 * Draws an note in the diagram with the attached line
21264 * @param elem - The diagram to draw to.
21265 * @param noteModel:{x: number, y: number, message: string, width: number} - startx: x axis start position, verticalPos: y axis position, messsage: the message to be shown, width: Set this with a custom width to override the default configured width.
21266 */
21267
21268var drawNote = function drawNote(elem, noteModel) {
21269 bounds.bumpVerticalPos(conf.boxMargin);
21270 noteModel.height = conf.boxMargin;
21271 noteModel.starty = bounds.getVerticalPos();
21272 var rect = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getNoteRect();
21273 rect.x = noteModel.startx;
21274 rect.y = noteModel.starty;
21275 rect.width = noteModel.width || conf.width;
21276 rect.class = 'note';
21277 var g = elem.append('g');
21278 var rectElem = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawRect(g, rect);
21279 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getTextObj();
21280 textObj.x = noteModel.startx;
21281 textObj.y = noteModel.starty;
21282 textObj.width = rect.width;
21283 textObj.dy = '1em';
21284 textObj.text = noteModel.message;
21285 textObj.class = 'noteText';
21286 textObj.fontFamily = conf.noteFontFamily;
21287 textObj.fontSize = conf.noteFontSize;
21288 textObj.fontWeight = conf.noteFontWeight;
21289 textObj.anchor = conf.noteAlign;
21290 textObj.textMargin = conf.noteMargin;
21291 textObj.valign = conf.noteAlign;
21292 var textElem = (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.drawText)(g, textObj);
21293 var textHeight = Math.round(textElem.map(function (te) {
21294 return (te._groups || te)[0][0].getBBox().height;
21295 }).reduce(function (acc, curr) {
21296 return acc + curr;
21297 }));
21298 rectElem.attr('height', textHeight + 2 * conf.noteMargin);
21299 noteModel.height += textHeight + 2 * conf.noteMargin;
21300 bounds.bumpVerticalPos(textHeight + 2 * conf.noteMargin);
21301 noteModel.stopy = noteModel.starty + textHeight + 2 * conf.noteMargin;
21302 noteModel.stopx = noteModel.startx + rect.width;
21303 bounds.insert(noteModel.startx, noteModel.starty, noteModel.stopx, noteModel.stopy);
21304 bounds.models.addNote(noteModel);
21305};
21306
21307var messageFont = function messageFont(cnf) {
21308 return {
21309 fontFamily: cnf.messageFontFamily,
21310 fontSize: cnf.messageFontSize,
21311 fontWeight: cnf.messageFontWeight
21312 };
21313};
21314
21315var noteFont = function noteFont(cnf) {
21316 return {
21317 fontFamily: cnf.noteFontFamily,
21318 fontSize: cnf.noteFontSize,
21319 fontWeight: cnf.noteFontWeight
21320 };
21321};
21322
21323var actorFont = function actorFont(cnf) {
21324 return {
21325 fontFamily: cnf.actorFontFamily,
21326 fontSize: cnf.actorFontSize,
21327 fontWeight: cnf.actorFontWeight
21328 };
21329};
21330/**
21331 * Draws a message
21332 * @param g - the parent of the message element
21333 * @param msgModel - the model containing fields describing a message
21334 */
21335
21336
21337var drawMessage = function drawMessage(g, msgModel) {
21338 bounds.bumpVerticalPos(10);
21339 var startx = msgModel.startx,
21340 stopx = msgModel.stopx,
21341 starty = msgModel.starty,
21342 message = msgModel.message,
21343 type = msgModel.type,
21344 sequenceIndex = msgModel.sequenceIndex;
21345 var lines = _common_common__WEBPACK_IMPORTED_MODULE_4__["default"].splitBreaks(message).length;
21346 var textDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(message, messageFont(conf));
21347 var lineHeight = textDims.height / lines;
21348 msgModel.height += lineHeight;
21349 bounds.bumpVerticalPos(lineHeight);
21350 var textObj = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].getTextObj();
21351 textObj.x = startx;
21352 textObj.y = starty + 10;
21353 textObj.width = stopx - startx;
21354 textObj.class = 'messageText';
21355 textObj.dy = '1em';
21356 textObj.text = message;
21357 textObj.fontFamily = conf.messageFontFamily;
21358 textObj.fontSize = conf.messageFontSize;
21359 textObj.fontWeight = conf.messageFontWeight;
21360 textObj.anchor = conf.messageAlign;
21361 textObj.valign = conf.messageAlign;
21362 textObj.textMargin = conf.wrapPadding;
21363 textObj.tspan = false;
21364 (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.drawText)(g, textObj);
21365 var totalOffset = textDims.height - 10;
21366 var textWidth = textDims.width;
21367 var line, lineStarty;
21368
21369 if (startx === stopx) {
21370 lineStarty = bounds.getVerticalPos() + totalOffset;
21371
21372 if (conf.rightAngles) {
21373 line = g.append('path').attr('d', "M ".concat(startx, ",").concat(lineStarty, " H ").concat(startx + Math.max(conf.width / 2, textWidth / 2), " V ").concat(lineStarty + 25, " H ").concat(startx));
21374 } else {
21375 totalOffset += conf.boxMargin;
21376 lineStarty = bounds.getVerticalPos() + totalOffset;
21377 line = g.append('path').attr('d', 'M ' + startx + ',' + lineStarty + ' C ' + (startx + 60) + ',' + (lineStarty - 10) + ' ' + (startx + 60) + ',' + (lineStarty + 30) + ' ' + startx + ',' + (lineStarty + 20));
21378 }
21379
21380 totalOffset += 30;
21381 var dx = Math.max(textWidth / 2, conf.width / 2);
21382 bounds.insert(startx - dx, bounds.getVerticalPos() - 10 + totalOffset, stopx + dx, bounds.getVerticalPos() + 30 + totalOffset);
21383 } else {
21384 totalOffset += conf.boxMargin;
21385 lineStarty = bounds.getVerticalPos() + totalOffset;
21386 line = g.append('line');
21387 line.attr('x1', startx);
21388 line.attr('y1', lineStarty);
21389 line.attr('x2', stopx);
21390 line.attr('y2', lineStarty);
21391 bounds.insert(startx, lineStarty - 10, stopx, lineStarty);
21392 } // Make an SVG Container
21393 // Draw the line
21394
21395
21396 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN) {
21397 line.style('stroke-dasharray', '3, 3');
21398 line.attr('class', 'messageLine1');
21399 } else {
21400 line.attr('class', 'messageLine0');
21401 }
21402
21403 var url = '';
21404
21405 if (conf.arrowMarkerAbsolute) {
21406 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
21407 url = url.replace(/\(/g, '\\(');
21408 url = url.replace(/\)/g, '\\)');
21409 }
21410
21411 line.attr('stroke-width', 2);
21412 line.attr('stroke', 'none'); // handled by theme/css anyway
21413
21414 line.style('fill', 'none'); // remove any fill colour
21415
21416 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED) {
21417 line.attr('marker-end', 'url(' + url + '#arrowhead)');
21418 }
21419
21420 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT) {
21421 line.attr('marker-end', 'url(' + url + '#filled-head)');
21422 }
21423
21424 if (type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS || type === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS) {
21425 line.attr('marker-end', 'url(' + url + '#crosshead)');
21426 } // add node number
21427
21428
21429 if (_sequenceDb__WEBPACK_IMPORTED_MODULE_2__["default"].showSequenceNumbers() || conf.showSequenceNumbers) {
21430 line.attr('marker-start', 'url(' + url + '#sequencenumber)');
21431 g.append('text').attr('x', startx).attr('y', lineStarty + 4).attr('font-family', 'sans-serif').attr('font-size', '12px').attr('text-anchor', 'middle').attr('textLength', '16px').attr('class', 'sequenceNumber').text(sequenceIndex);
21432 }
21433
21434 bounds.bumpVerticalPos(totalOffset);
21435 msgModel.height += totalOffset;
21436 msgModel.stopy = msgModel.starty + msgModel.height;
21437 bounds.insert(msgModel.fromBounds, msgModel.starty, msgModel.toBounds, msgModel.stopy);
21438};
21439
21440var drawActors = function drawActors(diagram, actors, actorKeys, verticalPos) {
21441 // Draw the actors
21442 var prevWidth = 0;
21443 var prevMargin = 0;
21444 var maxHeight = 0;
21445
21446 for (var i = 0; i < actorKeys.length; i++) {
21447 var actor = actors[actorKeys[i]]; // Add some rendering data to the object
21448
21449 actor.width = actor.width || conf.width;
21450 actor.height = Math.max(actor.height || conf.height, conf.height);
21451 actor.margin = actor.margin || conf.actorMargin;
21452 actor.x = prevWidth + prevMargin;
21453 actor.y = verticalPos; // Draw the box with the attached line
21454
21455 var height = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawActor(diagram, actor, conf);
21456 maxHeight = Math.max(maxHeight, height);
21457 bounds.insert(actor.x, verticalPos, actor.x + actor.width, actor.height);
21458 prevWidth += actor.width;
21459 prevMargin += actor.margin;
21460 bounds.models.addActor(actor);
21461 } // Add a margin between the actor boxes and the first arrow
21462
21463
21464 bounds.bumpVerticalPos(maxHeight);
21465};
21466var drawActorsPopup = function drawActorsPopup(diagram, actors, actorKeys) {
21467 var maxHeight = 0;
21468 var maxWidth = 0;
21469
21470 for (var i = 0; i < actorKeys.length; i++) {
21471 var actor = actors[actorKeys[i]];
21472 var minMenuWidth = getRequiredPopupWidth(actor);
21473 var menuDimensions = _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawPopup(diagram, actor, minMenuWidth, conf, conf.forceMenus);
21474
21475 if (menuDimensions.height > maxHeight) {
21476 maxHeight = menuDimensions.height;
21477 }
21478
21479 if (menuDimensions.width + actor.x > maxWidth) {
21480 maxWidth = menuDimensions.width + actor.x;
21481 }
21482 }
21483
21484 return {
21485 maxHeight: maxHeight,
21486 maxWidth: maxWidth
21487 };
21488};
21489var setConf = function setConf(cnf) {
21490 (0,_utils__WEBPACK_IMPORTED_MODULE_5__.assignWithDepth)(conf, cnf);
21491
21492 if (cnf.fontFamily) {
21493 conf.actorFontFamily = conf.noteFontFamily = conf.messageFontFamily = cnf.fontFamily;
21494 }
21495
21496 if (cnf.fontSize) {
21497 conf.actorFontSize = conf.noteFontSize = conf.messageFontSize = cnf.fontSize;
21498 }
21499
21500 if (cnf.fontWeight) {
21501 conf.actorFontWeight = conf.noteFontWeight = conf.messageFontWeight = cnf.fontWeight;
21502 }
21503};
21504
21505var actorActivations = function actorActivations(actor) {
21506 return bounds.activations.filter(function (activation) {
21507 return activation.actor === actor;
21508 });
21509};
21510
21511var activationBounds = function activationBounds(actor, actors) {
21512 // handle multiple stacked activations for same actor
21513 var actorObj = actors[actor];
21514 var activations = actorActivations(actor);
21515 var left = activations.reduce(function (acc, activation) {
21516 return Math.min(acc, activation.startx);
21517 }, actorObj.x + actorObj.width / 2);
21518 var right = activations.reduce(function (acc, activation) {
21519 return Math.max(acc, activation.stopx);
21520 }, actorObj.x + actorObj.width / 2);
21521 return [left, right];
21522};
21523
21524function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoopFn) {
21525 bounds.bumpVerticalPos(preMargin);
21526 var heightAdjust = postMargin;
21527
21528 if (msg.id && msg.message && loopWidths[msg.id]) {
21529 var loopWidth = loopWidths[msg.id].width;
21530 var textConf = messageFont(conf);
21531 msg.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel("[".concat(msg.message, "]"), loopWidth - 2 * conf.wrapPadding, textConf);
21532 msg.width = loopWidth;
21533 msg.wrap = true; // const lines = common.splitBreaks(msg.message).length;
21534
21535 var textDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(msg.message, textConf);
21536 var totalOffset = Math.max(textDims.height, conf.labelBoxHeight);
21537 heightAdjust = postMargin + totalOffset;
21538 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("".concat(totalOffset, " - ").concat(msg.message));
21539 }
21540
21541 addLoopFn(msg);
21542 bounds.bumpVerticalPos(heightAdjust);
21543}
21544/**
21545 * Draws a sequenceDiagram in the tag with id: id based on the graph definition in text.
21546 * @param text
21547 * @param id
21548 */
21549
21550
21551var draw = function draw(text, id) {
21552 conf = _config__WEBPACK_IMPORTED_MODULE_7__.getConfig().sequence;
21553 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear();
21554 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.setWrap(conf.wrap);
21555 _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text + '\n');
21556 bounds.init();
21557 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("C:".concat(JSON.stringify(conf, null, 2)));
21558 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")); // Fetch data from the parsing
21559
21560 var actors = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActors();
21561 var actorKeys = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActorKeys();
21562 var messages = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getMessages();
21563 var title = _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle();
21564 var maxMessageWidthPerActor = getMaxMessageWidthPerActor(actors, messages);
21565 conf.height = calculateActorMargins(actors, maxMessageWidthPerActor);
21566 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertComputerIcon(diagram);
21567 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertDatabaseIcon(diagram);
21568 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertClockIcon(diagram);
21569 drawActors(diagram, actors, actorKeys, 0);
21570 var loopWidths = calculateLoopBounds(messages, actors, maxMessageWidthPerActor); // The arrow head definition is attached to the svg once
21571
21572 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowHead(diagram);
21573 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowCrossHead(diagram);
21574 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertArrowFilledHead(diagram);
21575 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].insertSequenceNumber(diagram);
21576
21577 function activeEnd(msg, verticalPos) {
21578 var activationData = bounds.endActivation(msg);
21579
21580 if (activationData.starty + 18 > verticalPos) {
21581 activationData.starty = verticalPos - 6;
21582 verticalPos += 12;
21583 }
21584
21585 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length);
21586 bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos);
21587 } // Draw the messages/signals
21588
21589
21590 var sequenceIndex = 1;
21591 messages.forEach(function (msg) {
21592 var loopModel, noteModel, msgModel;
21593
21594 switch (msg.type) {
21595 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.NOTE:
21596 noteModel = msg.noteModel;
21597 drawNote(diagram, noteModel);
21598 break;
21599
21600 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_START:
21601 bounds.newActivation(msg, diagram, actors);
21602 break;
21603
21604 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_END:
21605 activeEnd(msg, bounds.getVerticalPos());
21606 break;
21607
21608 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_START:
21609 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
21610 return bounds.newLoop(message);
21611 });
21612 break;
21613
21614 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_END:
21615 loopModel = bounds.endLoop();
21616 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'loop', conf);
21617 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
21618 bounds.models.addLoop(loopModel);
21619 break;
21620
21621 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.RECT_START:
21622 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin, function (message) {
21623 return bounds.newLoop(undefined, message.message);
21624 });
21625 break;
21626
21627 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.RECT_END:
21628 loopModel = bounds.endLoop();
21629 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawBackgroundRect(diagram, loopModel);
21630 bounds.models.addLoop(loopModel);
21631 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
21632 break;
21633
21634 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_START:
21635 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
21636 return bounds.newLoop(message);
21637 });
21638 break;
21639
21640 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_END:
21641 loopModel = bounds.endLoop();
21642 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'opt', conf);
21643 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
21644 bounds.models.addLoop(loopModel);
21645 break;
21646
21647 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_START:
21648 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
21649 return bounds.newLoop(message);
21650 });
21651 break;
21652
21653 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_ELSE:
21654 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
21655 return bounds.addSectionToLoop(message);
21656 });
21657 break;
21658
21659 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_END:
21660 loopModel = bounds.endLoop();
21661 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'alt', conf);
21662 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
21663 bounds.models.addLoop(loopModel);
21664 break;
21665
21666 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_START:
21667 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin, conf.boxMargin + conf.boxTextMargin, function (message) {
21668 return bounds.newLoop(message);
21669 });
21670 break;
21671
21672 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_AND:
21673 adjustLoopHeightForWrap(loopWidths, msg, conf.boxMargin + conf.boxTextMargin, conf.boxMargin, function (message) {
21674 return bounds.addSectionToLoop(message);
21675 });
21676 break;
21677
21678 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_END:
21679 loopModel = bounds.endLoop();
21680 _svgDraw__WEBPACK_IMPORTED_MODULE_3__["default"].drawLoop(diagram, loopModel, 'par', conf);
21681 bounds.bumpVerticalPos(loopModel.stopy - bounds.getVerticalPos());
21682 bounds.models.addLoop(loopModel);
21683 break;
21684
21685 default:
21686 try {
21687 // lastMsg = msg
21688 msgModel = msg.msgModel;
21689 msgModel.starty = bounds.getVerticalPos();
21690 msgModel.sequenceIndex = sequenceIndex;
21691 drawMessage(diagram, msgModel);
21692 bounds.models.addMessage(msgModel);
21693 } catch (e) {
21694 _logger__WEBPACK_IMPORTED_MODULE_6__.log.error('error while drawing message', e);
21695 }
21696
21697 } // Increment sequence counter if msg.type is a line (and not another event like activation or note, etc)
21698
21699
21700 if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT].includes(msg.type)) {
21701 sequenceIndex++;
21702 }
21703 });
21704
21705 if (conf.mirrorActors) {
21706 // Draw actors below diagram
21707 bounds.bumpVerticalPos(conf.boxMargin * 2);
21708 drawActors(diagram, actors, actorKeys, bounds.getVerticalPos());
21709 bounds.bumpVerticalPos(conf.boxMargin);
21710 (0,_svgDraw__WEBPACK_IMPORTED_MODULE_3__.fixLifeLineHeights)(diagram, bounds.getVerticalPos());
21711 } // only draw popups for the top row of actors.
21712
21713
21714 var requiredBoxSize = drawActorsPopup(diagram, actors, actorKeys);
21715
21716 var _bounds$getBounds = bounds.getBounds(),
21717 box = _bounds$getBounds.bounds; // Adjust line height of actor lines now that the height of the diagram is known
21718
21719
21720 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('For line height fix Querying: #' + id + ' .actor-line');
21721 var actorLines = (0,d3__WEBPACK_IMPORTED_MODULE_0__.selectAll)('#' + id + ' .actor-line');
21722 actorLines.attr('y2', box.stopy); // Make sure the height of the diagram supports long menus.
21723
21724 var boxHeight = box.stopy - box.starty;
21725
21726 if (boxHeight < requiredBoxSize.maxHeight) {
21727 boxHeight = requiredBoxSize.maxHeight;
21728 }
21729
21730 var height = boxHeight + 2 * conf.diagramMarginY;
21731
21732 if (conf.mirrorActors) {
21733 height = height - conf.boxMargin + conf.bottomMarginAdj;
21734 } // Make sure the width of the diagram supports wide menus.
21735
21736
21737 var boxWidth = box.stopx - box.startx;
21738
21739 if (boxWidth < requiredBoxSize.maxWidth) {
21740 boxWidth = requiredBoxSize.maxWidth;
21741 }
21742
21743 var width = boxWidth + 2 * conf.diagramMarginX;
21744
21745 if (title) {
21746 diagram.append('text').text(title).attr('x', (box.stopx - box.startx) / 2 - 2 * conf.diagramMarginX).attr('y', -25);
21747 }
21748
21749 (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.useMaxWidth);
21750 var extraVertForTitle = title ? 40 : 0;
21751 diagram.attr('viewBox', box.startx - conf.diagramMarginX + ' -' + (conf.diagramMarginY + extraVertForTitle) + ' ' + width + ' ' + (height + extraVertForTitle));
21752 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("models:", bounds.models);
21753};
21754/**
21755 * Retrieves the max message width of each actor, supports signals (messages, loops)
21756 * and notes.
21757 *
21758 * It will enumerate each given message, and will determine its text width, in relation
21759 * to the actor it originates from, and destined to.
21760 *
21761 * @param actors - The actors map
21762 * @param messages - A list of message objects to iterate
21763 */
21764
21765var getMaxMessageWidthPerActor = function getMaxMessageWidthPerActor(actors, messages) {
21766 var maxMessageWidthPerActor = {};
21767 messages.forEach(function (msg) {
21768 if (actors[msg.to] && actors[msg.from]) {
21769 var actor = actors[msg.to]; // If this is the first actor, and the message is left of it, no need to calculate the margin
21770
21771 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF && !actor.prevActor) {
21772 return;
21773 } // If this is the last actor, and the message is right of it, no need to calculate the margin
21774
21775
21776 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF && !actor.nextActor) {
21777 return;
21778 }
21779
21780 var isNote = msg.placement !== undefined;
21781 var isMessage = !isNote;
21782 var textFont = isNote ? noteFont(conf) : messageFont(conf);
21783 var wrappedMessage = msg.wrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, conf.width - 2 * conf.wrapPadding, textFont) : msg.message;
21784 var messageDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(wrappedMessage, textFont);
21785 var messageWidth = messageDimensions.width + 2 * conf.wrapPadding;
21786 /*
21787 * The following scenarios should be supported:
21788 *
21789 * - There's a message (non-note) between fromActor and toActor
21790 * - If fromActor is on the right and toActor is on the left, we should
21791 * define the toActor's margin
21792 * - If fromActor is on the left and toActor is on the right, we should
21793 * define the fromActor's margin
21794 * - There's a note, in which case fromActor == toActor
21795 * - If the note is to the left of the actor, we should define the previous actor
21796 * margin
21797 * - If the note is on the actor, we should define both the previous and next actor
21798 * margins, each being the half of the note size
21799 * - If the note is on the right of the actor, we should define the current actor
21800 * margin
21801 */
21802
21803 if (isMessage && msg.from === actor.nextActor) {
21804 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth);
21805 } else if (isMessage && msg.from === actor.prevActor) {
21806 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
21807 } else if (isMessage && msg.from === msg.to) {
21808 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
21809 maxMessageWidthPerActor[msg.to] = Math.max(maxMessageWidthPerActor[msg.to] || 0, messageWidth / 2);
21810 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF) {
21811 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth);
21812 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF) {
21813 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth);
21814 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.OVER) {
21815 if (actor.prevActor) {
21816 maxMessageWidthPerActor[actor.prevActor] = Math.max(maxMessageWidthPerActor[actor.prevActor] || 0, messageWidth / 2);
21817 }
21818
21819 if (actor.nextActor) {
21820 maxMessageWidthPerActor[msg.from] = Math.max(maxMessageWidthPerActor[msg.from] || 0, messageWidth / 2);
21821 }
21822 }
21823 }
21824 });
21825 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('maxMessageWidthPerActor:', maxMessageWidthPerActor);
21826 return maxMessageWidthPerActor;
21827};
21828
21829var getRequiredPopupWidth = function getRequiredPopupWidth(actor) {
21830 var requiredPopupWidth = 0;
21831 var textFont = actorFont(conf);
21832
21833 for (var key in actor.links) {
21834 var labelDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(key, textFont);
21835 var labelWidth = labelDimensions.width + 2 * conf.wrapPadding + 2 * conf.boxMargin;
21836
21837 if (requiredPopupWidth < labelWidth) {
21838 requiredPopupWidth = labelWidth;
21839 }
21840 }
21841
21842 return requiredPopupWidth;
21843};
21844/**
21845 * This will calculate the optimal margin for each given actor, for a given
21846 * actor->messageWidth map.
21847 *
21848 * An actor's margin is determined by the width of the actor, the width of the
21849 * largest message that originates from it, and the configured conf.actorMargin.
21850 *
21851 * @param actors - The actors map to calculate margins for
21852 * @param actorToMessageWidth - A map of actor key -> max message width it holds
21853 */
21854
21855
21856var calculateActorMargins = function calculateActorMargins(actors, actorToMessageWidth) {
21857 var maxHeight = 0;
21858 Object.keys(actors).forEach(function (prop) {
21859 var actor = actors[prop];
21860
21861 if (actor.wrap) {
21862 actor.description = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(actor.description, conf.width - 2 * conf.wrapPadding, actorFont(conf));
21863 }
21864
21865 var actDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(actor.description, actorFont(conf));
21866 actor.width = actor.wrap ? conf.width : Math.max(conf.width, actDims.width + 2 * conf.wrapPadding);
21867 actor.height = actor.wrap ? Math.max(actDims.height, conf.height) : conf.height;
21868 maxHeight = Math.max(maxHeight, actor.height);
21869 });
21870
21871 for (var actorKey in actorToMessageWidth) {
21872 var actor = actors[actorKey];
21873
21874 if (!actor) {
21875 continue;
21876 }
21877
21878 var nextActor = actors[actor.nextActor]; // No need to space out an actor that doesn't have a next link
21879
21880 if (!nextActor) {
21881 continue;
21882 }
21883
21884 var messageWidth = actorToMessageWidth[actorKey];
21885 var actorWidth = messageWidth + conf.actorMargin - actor.width / 2 - nextActor.width / 2;
21886 actor.margin = Math.max(actorWidth, conf.actorMargin);
21887 }
21888
21889 return Math.max(maxHeight, conf.height);
21890};
21891
21892var buildNoteModel = function buildNoteModel(msg, actors) {
21893 var startx = actors[msg.from].x;
21894 var stopx = actors[msg.to].x;
21895 var shouldWrap = msg.wrap && msg.message;
21896 var textDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, conf.width, noteFont(conf)) : msg.message, noteFont(conf));
21897 var noteModel = {
21898 width: shouldWrap ? conf.width : Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin),
21899 height: 0,
21900 startx: actors[msg.from].x,
21901 stopx: 0,
21902 starty: 0,
21903 stopy: 0,
21904 message: msg.message
21905 };
21906
21907 if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.RIGHTOF) {
21908 noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
21909 noteModel.startx = startx + (actors[msg.from].width + conf.actorMargin) / 2;
21910 } else if (msg.placement === _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.PLACEMENT.LEFTOF) {
21911 noteModel.width = shouldWrap ? Math.max(conf.width, textDimensions.width + 2 * conf.noteMargin) : Math.max(actors[msg.from].width / 2 + actors[msg.to].width / 2, textDimensions.width + 2 * conf.noteMargin);
21912 noteModel.startx = startx - noteModel.width + (actors[msg.from].width - conf.actorMargin) / 2;
21913 } else if (msg.to === msg.from) {
21914 textDimensions = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(shouldWrap ? _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, Math.max(conf.width, actors[msg.from].width), noteFont(conf)) : msg.message, noteFont(conf));
21915 noteModel.width = shouldWrap ? Math.max(conf.width, actors[msg.from].width) : Math.max(actors[msg.from].width, conf.width, textDimensions.width + 2 * conf.noteMargin);
21916 noteModel.startx = startx + (actors[msg.from].width - noteModel.width) / 2;
21917 } else {
21918 noteModel.width = Math.abs(startx + actors[msg.from].width / 2 - (stopx + actors[msg.to].width / 2)) + conf.actorMargin;
21919 noteModel.startx = startx < stopx ? startx + actors[msg.from].width / 2 - conf.actorMargin / 2 : stopx + actors[msg.to].width / 2 - conf.actorMargin / 2;
21920 }
21921
21922 if (shouldWrap) {
21923 noteModel.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, noteModel.width - 2 * conf.wrapPadding, noteFont(conf));
21924 }
21925
21926 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug("NM:[".concat(noteModel.startx, ",").concat(noteModel.stopx, ",").concat(noteModel.starty, ",").concat(noteModel.stopy, ":").concat(noteModel.width, ",").concat(noteModel.height, "=").concat(msg.message, "]"));
21927 return noteModel;
21928};
21929
21930var buildMessageModel = function buildMessageModel(msg, actors) {
21931 var process = false;
21932
21933 if ([_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_OPEN, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_CROSS, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.SOLID_POINT, _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.DOTTED_POINT].includes(msg.type)) {
21934 process = true;
21935 }
21936
21937 if (!process) {
21938 return {};
21939 }
21940
21941 var fromBounds = activationBounds(msg.from, actors);
21942 var toBounds = activationBounds(msg.to, actors);
21943 var fromIdx = fromBounds[0] <= toBounds[0] ? 1 : 0;
21944 var toIdx = fromBounds[0] < toBounds[0] ? 0 : 1;
21945 var allBounds = fromBounds.concat(toBounds);
21946 var boundedWidth = Math.abs(toBounds[toIdx] - fromBounds[fromIdx]);
21947
21948 if (msg.wrap && msg.message) {
21949 msg.message = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].wrapLabel(msg.message, Math.max(boundedWidth + 2 * conf.wrapPadding, conf.width), messageFont(conf));
21950 }
21951
21952 var msgDims = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calculateTextDimensions(msg.message, messageFont(conf));
21953 return {
21954 width: Math.max(msg.wrap ? 0 : msgDims.width + 2 * conf.wrapPadding, boundedWidth + 2 * conf.wrapPadding, conf.width),
21955 height: 0,
21956 startx: fromBounds[fromIdx],
21957 stopx: toBounds[toIdx],
21958 starty: 0,
21959 stopy: 0,
21960 message: msg.message,
21961 type: msg.type,
21962 wrap: msg.wrap,
21963 fromBounds: Math.min.apply(null, allBounds),
21964 toBounds: Math.max.apply(null, allBounds)
21965 };
21966};
21967
21968var calculateLoopBounds = function calculateLoopBounds(messages, actors) {
21969 var loops = {};
21970 var stack = [];
21971 var current, noteModel, msgModel;
21972 messages.forEach(function (msg) {
21973 msg.id = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].random({
21974 length: 10
21975 });
21976
21977 switch (msg.type) {
21978 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_START:
21979 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_START:
21980 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_START:
21981 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_START:
21982 stack.push({
21983 id: msg.id,
21984 msg: msg.message,
21985 from: Number.MAX_SAFE_INTEGER,
21986 to: Number.MIN_SAFE_INTEGER,
21987 width: 0
21988 });
21989 break;
21990
21991 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_ELSE:
21992 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_AND:
21993 if (msg.message) {
21994 current = stack.pop();
21995 loops[current.id] = current;
21996 loops[msg.id] = current;
21997 stack.push(current);
21998 }
21999
22000 break;
22001
22002 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.LOOP_END:
22003 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ALT_END:
22004 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.OPT_END:
22005 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.PAR_END:
22006 current = stack.pop();
22007 loops[current.id] = current;
22008 break;
22009
22010 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_START:
22011 {
22012 var actorRect = actors[msg.from ? msg.from.actor : msg.to.actor];
22013 var stackedSize = actorActivations(msg.from ? msg.from.actor : msg.to.actor).length;
22014 var x = actorRect.x + actorRect.width / 2 + (stackedSize - 1) * conf.activationWidth / 2;
22015 var toAdd = {
22016 startx: x,
22017 stopx: x + conf.activationWidth,
22018 actor: msg.from.actor,
22019 enabled: true
22020 };
22021 bounds.activations.push(toAdd);
22022 }
22023 break;
22024
22025 case _parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_1__.parser.yy.LINETYPE.ACTIVE_END:
22026 {
22027 var lastActorActivationIdx = bounds.activations.map(function (a) {
22028 return a.actor;
22029 }).lastIndexOf(msg.from.actor);
22030 delete bounds.activations.splice(lastActorActivationIdx, 1)[0];
22031 }
22032 break;
22033 }
22034
22035 var isNote = msg.placement !== undefined;
22036
22037 if (isNote) {
22038 noteModel = buildNoteModel(msg, actors);
22039 msg.noteModel = noteModel;
22040 stack.forEach(function (stk) {
22041 current = stk;
22042 current.from = Math.min(current.from, noteModel.startx);
22043 current.to = Math.max(current.to, noteModel.startx + noteModel.width);
22044 current.width = Math.max(current.width, Math.abs(current.from - current.to)) - conf.labelBoxWidth;
22045 });
22046 } else {
22047 msgModel = buildMessageModel(msg, actors);
22048 msg.msgModel = msgModel;
22049
22050 if (msgModel.startx && msgModel.stopx && stack.length > 0) {
22051 stack.forEach(function (stk) {
22052 current = stk;
22053
22054 if (msgModel.startx === msgModel.stopx) {
22055 var from = actors[msg.from];
22056 var to = actors[msg.to];
22057 current.from = Math.min(from.x - msgModel.width / 2, from.x - from.width / 2, current.from);
22058 current.to = Math.max(to.x + msgModel.width / 2, to.x + from.width / 2, current.to);
22059 current.width = Math.max(current.width, Math.abs(current.to - current.from)) - conf.labelBoxWidth;
22060 } else {
22061 current.from = Math.min(msgModel.startx, current.from);
22062 current.to = Math.max(msgModel.stopx, current.to);
22063 current.width = Math.max(current.width, msgModel.width) - conf.labelBoxWidth;
22064 }
22065 });
22066 }
22067 }
22068 });
22069 bounds.activations = [];
22070 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Loop type widths:', loops);
22071 return loops;
22072};
22073
22074/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
22075 bounds: bounds,
22076 drawActors: drawActors,
22077 drawActorsPopup: drawActorsPopup,
22078 setConf: setConf,
22079 draw: draw
22080});
22081
22082/***/ }),
22083
22084/***/ "./src/diagrams/sequence/styles.js":
22085/*!*****************************************!*\
22086 !*** ./src/diagrams/sequence/styles.js ***!
22087 \*****************************************/
22088/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22089
22090"use strict";
22091__webpack_require__.r(__webpack_exports__);
22092/* harmony export */ __webpack_require__.d(__webpack_exports__, {
22093/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22094/* harmony export */ });
22095var getStyles = function getStyles(options) {
22096 return ".actor {\n stroke: ".concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n }\n\n text.actor > tspan {\n fill: ").concat(options.actorTextColor, ";\n stroke: none;\n }\n\n .actor-line {\n stroke: ").concat(options.actorLineColor, ";\n }\n\n .messageLine0 {\n stroke-width: 1.5;\n stroke-dasharray: none;\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageLine1 {\n stroke-width: 1.5;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.signalColor, ";\n }\n\n #arrowhead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .sequenceNumber {\n fill: ").concat(options.sequenceNumberColor, ";\n }\n\n #sequencenumber {\n fill: ").concat(options.signalColor, ";\n }\n\n #crosshead path {\n fill: ").concat(options.signalColor, ";\n stroke: ").concat(options.signalColor, ";\n }\n\n .messageText {\n fill: ").concat(options.signalTextColor, ";\n stroke: ").concat(options.signalTextColor, ";\n }\n\n .labelBox {\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBkgColor, ";\n }\n\n .labelText, .labelText > tspan {\n fill: ").concat(options.labelTextColor, ";\n stroke: none;\n }\n\n .loopText, .loopText > tspan {\n fill: ").concat(options.loopTextColor, ";\n stroke: none;\n }\n\n .loopLine {\n stroke-width: 2px;\n stroke-dasharray: 2, 2;\n stroke: ").concat(options.labelBoxBorderColor, ";\n fill: ").concat(options.labelBoxBorderColor, ";\n }\n\n .note {\n //stroke: #decc93;\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n }\n\n .noteText, .noteText > tspan {\n fill: ").concat(options.noteTextColor, ";\n stroke: none;\n }\n\n .activation0 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation1 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .activation2 {\n fill: ").concat(options.activationBkgColor, ";\n stroke: ").concat(options.activationBorderColor, ";\n }\n\n .actorPopupMenu {\n position: absolute;\n }\n\n .actorPopupMenuPanel {\n position: absolute;\n fill: ").concat(options.actorBkg, ";\n box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));\n}\n .actor-man line {\n stroke: ").concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n }\n .actor-man circle, line {\n stroke: ").concat(options.actorBorder, ";\n fill: ").concat(options.actorBkg, ";\n stroke-width: 2px;\n }\n");
22097};
22098
22099/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
22100
22101/***/ }),
22102
22103/***/ "./src/diagrams/sequence/svgDraw.js":
22104/*!******************************************!*\
22105 !*** ./src/diagrams/sequence/svgDraw.js ***!
22106 \******************************************/
22107/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22108
22109"use strict";
22110__webpack_require__.r(__webpack_exports__);
22111/* harmony export */ __webpack_require__.d(__webpack_exports__, {
22112/* harmony export */ "drawRect": () => (/* binding */ drawRect),
22113/* harmony export */ "drawPopup": () => (/* binding */ drawPopup),
22114/* harmony export */ "drawImage": () => (/* binding */ drawImage),
22115/* harmony export */ "drawEmbeddedImage": () => (/* binding */ drawEmbeddedImage),
22116/* harmony export */ "popupMenu": () => (/* binding */ popupMenu),
22117/* harmony export */ "popdownMenu": () => (/* binding */ popdownMenu),
22118/* harmony export */ "drawText": () => (/* binding */ drawText),
22119/* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
22120/* harmony export */ "fixLifeLineHeights": () => (/* binding */ fixLifeLineHeights),
22121/* harmony export */ "drawActor": () => (/* binding */ drawActor),
22122/* harmony export */ "anchorElement": () => (/* binding */ anchorElement),
22123/* harmony export */ "drawActivation": () => (/* binding */ drawActivation),
22124/* harmony export */ "drawLoop": () => (/* binding */ drawLoop),
22125/* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
22126/* harmony export */ "insertDatabaseIcon": () => (/* binding */ insertDatabaseIcon),
22127/* harmony export */ "insertComputerIcon": () => (/* binding */ insertComputerIcon),
22128/* harmony export */ "insertClockIcon": () => (/* binding */ insertClockIcon),
22129/* harmony export */ "insertArrowHead": () => (/* binding */ insertArrowHead),
22130/* harmony export */ "insertArrowFilledHead": () => (/* binding */ insertArrowFilledHead),
22131/* harmony export */ "insertSequenceNumber": () => (/* binding */ insertSequenceNumber),
22132/* harmony export */ "insertArrowCrossHead": () => (/* binding */ insertArrowCrossHead),
22133/* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
22134/* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
22135/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22136/* harmony export */ });
22137/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
22138/* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../interactionDb */ "./src/interactionDb.js");
22139
22140
22141var drawRect = function drawRect(elem, rectData) {
22142 var rectElem = elem.append('rect');
22143 rectElem.attr('x', rectData.x);
22144 rectElem.attr('y', rectData.y);
22145 rectElem.attr('fill', rectData.fill);
22146 rectElem.attr('stroke', rectData.stroke);
22147 rectElem.attr('width', rectData.width);
22148 rectElem.attr('height', rectData.height);
22149 rectElem.attr('rx', rectData.rx);
22150 rectElem.attr('ry', rectData.ry);
22151
22152 if (typeof rectData.class !== 'undefined') {
22153 rectElem.attr('class', rectData.class);
22154 }
22155
22156 return rectElem;
22157};
22158
22159var sanitizeUrl = function sanitizeUrl(s) {
22160 return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/javascript:/g, '');
22161};
22162
22163var addPopupInteraction = function addPopupInteraction(id, actorCnt) {
22164 (0,_interactionDb__WEBPACK_IMPORTED_MODULE_0__.addFunction)(function () {
22165 var arr = document.querySelectorAll(id);
22166 arr[0].addEventListener('mouseover', function () {
22167 popupMenuUpFunc('actor' + actorCnt + '_popup');
22168 });
22169 arr[0].addEventListener('mouseout', function () {
22170 popupMenuDownFunc('actor' + actorCnt + '_popup');
22171 });
22172 });
22173};
22174
22175var drawPopup = function drawPopup(elem, actor, minMenuWidth, textAttrs, forceMenus) {
22176 if (actor.links === undefined || actor.links === null || Object.keys(actor.links).length === 0) {
22177 return {
22178 height: 0,
22179 width: 0
22180 };
22181 }
22182
22183 var links = actor.links;
22184 var actorCnt = actor.actorCnt;
22185 var rectData = actor.rectData;
22186 var displayValue = 'none';
22187
22188 if (forceMenus) {
22189 displayValue = 'block !important';
22190 }
22191
22192 var g = elem.append('g');
22193 g.attr('id', 'actor' + actorCnt + '_popup');
22194 g.attr('class', 'actorPopupMenu');
22195 g.attr('display', displayValue);
22196 addPopupInteraction('#actor' + actorCnt + '_popup', actorCnt);
22197 var actorClass = '';
22198
22199 if (typeof rectData.class !== 'undefined') {
22200 actorClass = ' ' + rectData.class;
22201 }
22202
22203 var menuWidth = rectData.width > minMenuWidth ? rectData.width : minMenuWidth;
22204 var rectElem = g.append('rect');
22205 rectElem.attr('class', 'actorPopupMenuPanel' + actorClass);
22206 rectElem.attr('x', rectData.x);
22207 rectElem.attr('y', rectData.height);
22208 rectElem.attr('fill', rectData.fill);
22209 rectElem.attr('stroke', rectData.stroke);
22210 rectElem.attr('width', menuWidth);
22211 rectElem.attr('height', rectData.height);
22212 rectElem.attr('rx', rectData.rx);
22213 rectElem.attr('ry', rectData.ry);
22214
22215 if (links != null) {
22216 var linkY = 20;
22217
22218 for (var key in links) {
22219 var linkElem = g.append('a');
22220 var sanitizedLink = sanitizeUrl(links[key]);
22221 linkElem.attr('xlink:href', sanitizedLink);
22222 linkElem.attr('target', '_blank');
22223
22224 _drawMenuItemTextCandidateFunc(textAttrs)(key, linkElem, rectData.x + 10, rectData.height + linkY, menuWidth, 20, {
22225 class: 'actor'
22226 }, textAttrs);
22227
22228 linkY += 30;
22229 }
22230 }
22231
22232 rectElem.attr('height', linkY);
22233 return {
22234 height: rectData.height + linkY,
22235 width: menuWidth
22236 };
22237};
22238var drawImage = function drawImage(elem, x, y, link) {
22239 var imageElem = elem.append('image');
22240 imageElem.attr('x', x);
22241 imageElem.attr('y', y);
22242 var sanitizedLink = sanitizeUrl(link);
22243 imageElem.attr('xlink:href', sanitizedLink);
22244};
22245var drawEmbeddedImage = function drawEmbeddedImage(elem, x, y, link) {
22246 var imageElem = elem.append('use');
22247 imageElem.attr('x', x);
22248 imageElem.attr('y', y);
22249 var sanitizedLink = sanitizeUrl(link);
22250 imageElem.attr('xlink:href', '#' + sanitizedLink);
22251};
22252var popupMenu = function popupMenu(popid) {
22253 return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'block'; }";
22254};
22255var popdownMenu = function popdownMenu(popid) {
22256 return "var pu = document.getElementById('" + popid + "'); if (pu != null) { pu.style.display = 'none'; }";
22257};
22258
22259var popupMenuUpFunc = function popupMenuUpFunc(popupId) {
22260 var pu = document.getElementById(popupId);
22261
22262 if (pu != null) {
22263 pu.style.display = 'block';
22264 }
22265};
22266
22267var popupMenuDownFunc = function popupMenuDownFunc(popupId) {
22268 var pu = document.getElementById(popupId);
22269
22270 if (pu != null) {
22271 pu.style.display = 'none';
22272 }
22273};
22274
22275var drawText = function drawText(elem, textData) {
22276 var prevTextHeight = 0,
22277 textHeight = 0;
22278 var lines = textData.text.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
22279 var textElems = [];
22280 var dy = 0;
22281
22282 var yfunc = function yfunc() {
22283 return textData.y;
22284 };
22285
22286 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
22287 switch (textData.valign) {
22288 case 'top':
22289 case 'start':
22290 yfunc = function yfunc() {
22291 return Math.round(textData.y + textData.textMargin);
22292 };
22293
22294 break;
22295
22296 case 'middle':
22297 case 'center':
22298 yfunc = function yfunc() {
22299 return Math.round(textData.y + (prevTextHeight + textHeight + textData.textMargin) / 2);
22300 };
22301
22302 break;
22303
22304 case 'bottom':
22305 case 'end':
22306 yfunc = function yfunc() {
22307 return Math.round(textData.y + (prevTextHeight + textHeight + 2 * textData.textMargin) - textData.textMargin);
22308 };
22309
22310 break;
22311 }
22312 }
22313
22314 if (typeof textData.anchor !== 'undefined' && typeof textData.textMargin !== 'undefined' && typeof textData.width !== 'undefined') {
22315 switch (textData.anchor) {
22316 case 'left':
22317 case 'start':
22318 textData.x = Math.round(textData.x + textData.textMargin);
22319 textData.anchor = 'start';
22320 textData.dominantBaseline = 'text-after-edge';
22321 textData.alignmentBaseline = 'middle';
22322 break;
22323
22324 case 'middle':
22325 case 'center':
22326 textData.x = Math.round(textData.x + textData.width / 2);
22327 textData.anchor = 'middle';
22328 textData.dominantBaseline = 'middle';
22329 textData.alignmentBaseline = 'middle';
22330 break;
22331
22332 case 'right':
22333 case 'end':
22334 textData.x = Math.round(textData.x + textData.width - textData.textMargin);
22335 textData.anchor = 'end';
22336 textData.dominantBaseline = 'text-before-edge';
22337 textData.alignmentBaseline = 'middle';
22338 break;
22339 }
22340 }
22341
22342 for (var i = 0; i < lines.length; i++) {
22343 var line = lines[i];
22344
22345 if (typeof textData.textMargin !== 'undefined' && textData.textMargin === 0 && typeof textData.fontSize !== 'undefined') {
22346 dy = i * textData.fontSize;
22347 }
22348
22349 var textElem = elem.append('text');
22350 textElem.attr('x', textData.x);
22351 textElem.attr('y', yfunc());
22352
22353 if (typeof textData.anchor !== 'undefined') {
22354 textElem.attr('text-anchor', textData.anchor).attr('dominant-baseline', textData.dominantBaseline).attr('alignment-baseline', textData.alignmentBaseline);
22355 }
22356
22357 if (typeof textData.fontFamily !== 'undefined') {
22358 textElem.style('font-family', textData.fontFamily);
22359 }
22360
22361 if (typeof textData.fontSize !== 'undefined') {
22362 textElem.style('font-size', textData.fontSize);
22363 }
22364
22365 if (typeof textData.fontWeight !== 'undefined') {
22366 textElem.style('font-weight', textData.fontWeight);
22367 }
22368
22369 if (typeof textData.fill !== 'undefined') {
22370 textElem.attr('fill', textData.fill);
22371 }
22372
22373 if (typeof textData.class !== 'undefined') {
22374 textElem.attr('class', textData.class);
22375 }
22376
22377 if (typeof textData.dy !== 'undefined') {
22378 textElem.attr('dy', textData.dy);
22379 } else if (dy !== 0) {
22380 textElem.attr('dy', dy);
22381 }
22382
22383 if (textData.tspan) {
22384 var span = textElem.append('tspan');
22385 span.attr('x', textData.x);
22386
22387 if (typeof textData.fill !== 'undefined') {
22388 span.attr('fill', textData.fill);
22389 }
22390
22391 span.text(line);
22392 } else {
22393 textElem.text(line);
22394 }
22395
22396 if (typeof textData.valign !== 'undefined' && typeof textData.textMargin !== 'undefined' && textData.textMargin > 0) {
22397 textHeight += (textElem._groups || textElem)[0][0].getBBox().height;
22398 prevTextHeight = textHeight;
22399 }
22400
22401 textElems.push(textElem);
22402 }
22403
22404 return textElems;
22405};
22406var drawLabel = function drawLabel(elem, txtObject) {
22407 function genPoints(x, y, width, height, cut) {
22408 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
22409 }
22410
22411 var polygon = elem.append('polygon');
22412 polygon.attr('points', genPoints(txtObject.x, txtObject.y, txtObject.width, txtObject.height, 7));
22413 polygon.attr('class', 'labelBox');
22414 txtObject.y = txtObject.y + txtObject.height / 2;
22415 drawText(elem, txtObject);
22416 return polygon;
22417};
22418var actorCnt = -1;
22419var fixLifeLineHeights = function fixLifeLineHeights(diagram, bounds) {
22420 if (!diagram.selectAll) return;
22421 diagram.selectAll('.actor-line').attr('class', '200').attr('y2', bounds - 55);
22422};
22423/**
22424 * Draws an actor in the diagram with the attached line
22425 * @param elem - The diagram we'll draw to.
22426 * @param actor - The actor to draw.
22427 * @param conf - drawText implementation discriminator object
22428 */
22429
22430var drawActorTypeParticipant = function drawActorTypeParticipant(elem, actor, conf) {
22431 var center = actor.x + actor.width / 2;
22432 var boxpluslineGroup = elem.append('g');
22433 var g = boxpluslineGroup;
22434
22435 if (actor.y === 0) {
22436 actorCnt++;
22437 g.append('line').attr('id', 'actor' + actorCnt).attr('x1', center).attr('y1', 5).attr('x2', center).attr('y2', 2000).attr('class', 'actor-line').attr('stroke-width', '0.5px').attr('stroke', '#999');
22438 g = boxpluslineGroup.append('g');
22439 actor.actorCnt = actorCnt;
22440
22441 if (actor.links != null) {
22442 g.attr('id', 'root-' + actorCnt);
22443 addPopupInteraction('#root-' + actorCnt, actorCnt);
22444 }
22445 }
22446
22447 var rect = getNoteRect();
22448 var cssclass = 'actor';
22449
22450 if (actor.properties != null && actor.properties['class']) {
22451 cssclass = actor.properties['class'];
22452 } else {
22453 rect.fill = '#eaeaea';
22454 }
22455
22456 rect.x = actor.x;
22457 rect.y = actor.y;
22458 rect.width = actor.width;
22459 rect.height = actor.height;
22460 rect.class = cssclass;
22461 rect.rx = 3;
22462 rect.ry = 3;
22463 var rectElem = drawRect(g, rect);
22464 actor.rectData = rect;
22465
22466 if (actor.properties != null && actor.properties['icon']) {
22467 var iconSrc = actor.properties['icon'].trim();
22468
22469 if (iconSrc.charAt(0) === '@') {
22470 drawEmbeddedImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc.substr(1));
22471 } else {
22472 drawImage(g, rect.x + rect.width - 20, rect.y + 10, iconSrc);
22473 }
22474 }
22475
22476 _drawTextCandidateFunc(conf)(actor.description, g, rect.x, rect.y, rect.width, rect.height, {
22477 class: 'actor'
22478 }, conf);
22479
22480 var height = actor.height;
22481
22482 if (rectElem.node) {
22483 var bounds = rectElem.node().getBBox();
22484 actor.height = bounds.height;
22485 height = bounds.height;
22486 }
22487
22488 return height;
22489};
22490
22491var drawActorTypeActor = function drawActorTypeActor(elem, actor, conf) {
22492 var center = actor.x + actor.width / 2;
22493
22494 if (actor.y === 0) {
22495 actorCnt++;
22496 elem.append('line').attr('id', 'actor' + actorCnt).attr('x1', center).attr('y1', 80).attr('x2', center).attr('y2', 2000).attr('class', 'actor-line').attr('stroke-width', '0.5px').attr('stroke', '#999');
22497 }
22498
22499 var actElem = elem.append('g');
22500 actElem.attr('class', 'actor-man');
22501 var rect = getNoteRect();
22502 rect.x = actor.x;
22503 rect.y = actor.y;
22504 rect.fill = '#eaeaea';
22505 rect.width = actor.width;
22506 rect.height = actor.height;
22507 rect.class = 'actor';
22508 rect.rx = 3;
22509 rect.ry = 3; // drawRect(actElem, rect);
22510
22511 actElem.append('line').attr('id', 'actor-man-torso' + actorCnt).attr('x1', center).attr('y1', actor.y + 25).attr('x2', center).attr('y2', actor.y + 45);
22512 actElem.append('line').attr('id', 'actor-man-arms' + actorCnt).attr('x1', center - 18).attr('y1', actor.y + 33).attr('x2', center + 18).attr('y2', actor.y + 33);
22513 actElem.append('line').attr('x1', center - 18).attr('y1', actor.y + 60).attr('x2', center).attr('y2', actor.y + 45);
22514 actElem.append('line').attr('x1', center).attr('y1', actor.y + 45).attr('x2', center + 16).attr('y2', actor.y + 60);
22515 var circle = actElem.append('circle');
22516 circle.attr('cx', actor.x + actor.width / 2);
22517 circle.attr('cy', actor.y + 10);
22518 circle.attr('r', 15);
22519 circle.attr('width', actor.width);
22520 circle.attr('height', actor.height);
22521 var bounds = actElem.node().getBBox();
22522 actor.height = bounds.height;
22523
22524 _drawTextCandidateFunc(conf)(actor.description, actElem, rect.x, rect.y + 35, rect.width, rect.height, {
22525 class: 'actor'
22526 }, conf);
22527
22528 return actor.height;
22529};
22530
22531var drawActor = function drawActor(elem, actor, conf) {
22532 switch (actor.type) {
22533 case 'actor':
22534 return drawActorTypeActor(elem, actor, conf);
22535
22536 case 'participant':
22537 return drawActorTypeParticipant(elem, actor, conf);
22538 }
22539};
22540var anchorElement = function anchorElement(elem) {
22541 return elem.append('g');
22542};
22543/**
22544 * Draws an activation in the diagram
22545 * @param elem - element to append activation rect.
22546 * @param bounds - activation box bounds.
22547 * @param verticalPos - precise y cooridnate of bottom activation box edge.
22548 * @param conf - sequence diagram config object.
22549 * @param actorActivations - number of activations on the actor.
22550 */
22551
22552var drawActivation = function drawActivation(elem, bounds, verticalPos, conf, actorActivations) {
22553 var rect = getNoteRect();
22554 var g = bounds.anchored;
22555 rect.x = bounds.startx;
22556 rect.y = bounds.starty;
22557 rect.class = 'activation' + actorActivations % 3; // Will evaluate to 0, 1 or 2
22558
22559 rect.width = bounds.stopx - bounds.startx;
22560 rect.height = verticalPos - bounds.starty;
22561 drawRect(g, rect);
22562};
22563/**
22564 * Draws a loop in the diagram
22565 * @param elem - elemenet to append the loop to.
22566 * @param loopModel - loopModel of the given loop.
22567 * @param labelText - Text within the loop.
22568 * @param conf - diagrom configuration
22569 */
22570
22571var drawLoop = function drawLoop(elem, loopModel, labelText, conf) {
22572 var boxMargin = conf.boxMargin,
22573 boxTextMargin = conf.boxTextMargin,
22574 labelBoxHeight = conf.labelBoxHeight,
22575 labelBoxWidth = conf.labelBoxWidth,
22576 fontFamily = conf.messageFontFamily,
22577 fontSize = conf.messageFontSize,
22578 fontWeight = conf.messageFontWeight;
22579 var g = elem.append('g');
22580
22581 var drawLoopLine = function drawLoopLine(startx, starty, stopx, stopy) {
22582 return g.append('line').attr('x1', startx).attr('y1', starty).attr('x2', stopx).attr('y2', stopy).attr('class', 'loopLine');
22583 };
22584
22585 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.stopx, loopModel.starty);
22586 drawLoopLine(loopModel.stopx, loopModel.starty, loopModel.stopx, loopModel.stopy);
22587 drawLoopLine(loopModel.startx, loopModel.stopy, loopModel.stopx, loopModel.stopy);
22588 drawLoopLine(loopModel.startx, loopModel.starty, loopModel.startx, loopModel.stopy);
22589
22590 if (typeof loopModel.sections !== 'undefined') {
22591 loopModel.sections.forEach(function (item) {
22592 drawLoopLine(loopModel.startx, item.y, loopModel.stopx, item.y).style('stroke-dasharray', '3, 3');
22593 });
22594 }
22595
22596 var txt = getTextObj();
22597 txt.text = labelText;
22598 txt.x = loopModel.startx;
22599 txt.y = loopModel.starty;
22600 txt.fontFamily = fontFamily;
22601 txt.fontSize = fontSize;
22602 txt.fontWeight = fontWeight;
22603 txt.anchor = 'middle';
22604 txt.valign = 'middle';
22605 txt.tspan = false;
22606 txt.width = labelBoxWidth || 50;
22607 txt.height = labelBoxHeight || 20;
22608 txt.textMargin = boxTextMargin;
22609 txt.class = 'labelText';
22610 drawLabel(g, txt);
22611 txt = getTextObj();
22612 txt.text = loopModel.title;
22613 txt.x = loopModel.startx + labelBoxWidth / 2 + (loopModel.stopx - loopModel.startx) / 2;
22614 txt.y = loopModel.starty + boxMargin + boxTextMargin;
22615 txt.anchor = 'middle';
22616 txt.valign = 'middle';
22617 txt.textMargin = boxTextMargin;
22618 txt.class = 'loopText';
22619 txt.fontFamily = fontFamily;
22620 txt.fontSize = fontSize;
22621 txt.fontWeight = fontWeight;
22622 txt.wrap = true;
22623 var textElem = drawText(g, txt);
22624
22625 if (typeof loopModel.sectionTitles !== 'undefined') {
22626 loopModel.sectionTitles.forEach(function (item, idx) {
22627 if (item.message) {
22628 txt.text = item.message;
22629 txt.x = loopModel.startx + (loopModel.stopx - loopModel.startx) / 2;
22630 txt.y = loopModel.sections[idx].y + boxMargin + boxTextMargin;
22631 txt.class = 'loopText';
22632 txt.anchor = 'middle';
22633 txt.valign = 'middle';
22634 txt.tspan = false;
22635 txt.fontFamily = fontFamily;
22636 txt.fontSize = fontSize;
22637 txt.fontWeight = fontWeight;
22638 txt.wrap = loopModel.wrap;
22639 textElem = drawText(g, txt);
22640 var sectionHeight = Math.round(textElem.map(function (te) {
22641 return (te._groups || te)[0][0].getBBox().height;
22642 }).reduce(function (acc, curr) {
22643 return acc + curr;
22644 }));
22645 loopModel.sections[idx].height += sectionHeight - (boxMargin + boxTextMargin);
22646 }
22647 });
22648 }
22649
22650 loopModel.height = Math.round(loopModel.stopy - loopModel.starty);
22651 return g;
22652};
22653/**
22654 * Draws a background rectangle
22655 * @param elem diagram (reference for bounds)
22656 * @param bounds shape of the rectangle
22657 */
22658
22659var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
22660 var rectElem = drawRect(elem, {
22661 x: bounds.startx,
22662 y: bounds.starty,
22663 width: bounds.stopx - bounds.startx,
22664 height: bounds.stopy - bounds.starty,
22665 fill: bounds.fill,
22666 class: 'rect'
22667 });
22668 rectElem.lower();
22669};
22670var insertDatabaseIcon = function insertDatabaseIcon(elem) {
22671 elem.append('defs').append('symbol').attr('id', 'database').attr('fill-rule', 'evenodd').attr('clip-rule', 'evenodd').append('path').attr('transform', 'scale(.5)').attr('d', 'M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z');
22672};
22673var insertComputerIcon = function insertComputerIcon(elem) {
22674 elem.append('defs').append('symbol').attr('id', 'computer').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z');
22675};
22676var insertClockIcon = function insertClockIcon(elem) {
22677 elem.append('defs').append('symbol').attr('id', 'clock').attr('width', '24').attr('height', '24').append('path').attr('transform', 'scale(.5)').attr('d', 'M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z');
22678};
22679/**
22680 * Setup arrow head and define the marker. The result is appended to the svg.
22681 */
22682
22683var insertArrowHead = function insertArrowHead(elem) {
22684 elem.append('defs').append('marker').attr('id', 'arrowhead').attr('refX', 9).attr('refY', 5).attr('markerUnits', 'userSpaceOnUse').attr('markerWidth', 12).attr('markerHeight', 12).attr('orient', 'auto').append('path').attr('d', 'M 0 0 L 10 5 L 0 10 z'); // this is actual shape for arrowhead
22685};
22686/**
22687 * Setup arrow head and define the marker. The result is appended to the svg.
22688 */
22689
22690var insertArrowFilledHead = function insertArrowFilledHead(elem) {
22691 elem.append('defs').append('marker').attr('id', 'filled-head').attr('refX', 18).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 18,7 L9,13 L14,7 L9,1 Z');
22692};
22693/**
22694 * Setup node number. The result is appended to the svg.
22695 */
22696
22697var insertSequenceNumber = function insertSequenceNumber(elem) {
22698 elem.append('defs').append('marker').attr('id', 'sequencenumber').attr('refX', 15).attr('refY', 15).attr('markerWidth', 60).attr('markerHeight', 40).attr('orient', 'auto').append('circle').attr('cx', 15).attr('cy', 15).attr('r', 6); // .style("fill", '#f00');
22699};
22700/**
22701 * Setup arrow head and define the marker. The result is appended to the svg.
22702 */
22703
22704var insertArrowCrossHead = function insertArrowCrossHead(elem) {
22705 var defs = elem.append('defs');
22706 var marker = defs.append('marker').attr('id', 'crosshead').attr('markerWidth', 15).attr('markerHeight', 8).attr('orient', 'auto').attr('refX', 16).attr('refY', 4); // The arrow
22707
22708 marker.append('path').attr('fill', 'black').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 9,2 V 6 L16,4 Z'); // The cross
22709
22710 marker.append('path').attr('fill', 'none').attr('stroke', '#000000').style('stroke-dasharray', '0, 0').attr('stroke-width', '1px').attr('d', 'M 0,1 L 6,7 M 6,1 L 0,7'); // this is actual shape for arrowhead
22711};
22712var getTextObj = function getTextObj() {
22713 return {
22714 x: 0,
22715 y: 0,
22716 fill: undefined,
22717 anchor: undefined,
22718 style: '#666',
22719 width: undefined,
22720 height: undefined,
22721 textMargin: 0,
22722 rx: 0,
22723 ry: 0,
22724 tspan: true,
22725 valign: undefined
22726 };
22727};
22728var getNoteRect = function getNoteRect() {
22729 return {
22730 x: 0,
22731 y: 0,
22732 fill: '#EDF2AE',
22733 stroke: '#666',
22734 width: 100,
22735 anchor: 'start',
22736 height: 100,
22737 rx: 0,
22738 ry: 0
22739 };
22740};
22741
22742var _drawTextCandidateFunc = function () {
22743 function byText(content, g, x, y, width, height, textAttrs) {
22744 var text = g.append('text').attr('x', x + width / 2).attr('y', y + height / 2 + 5).style('text-anchor', 'middle').text(content);
22745
22746 _setTextAttrs(text, textAttrs);
22747 }
22748
22749 function byTspan(content, g, x, y, width, height, textAttrs, conf) {
22750 var actorFontSize = conf.actorFontSize,
22751 actorFontFamily = conf.actorFontFamily,
22752 actorFontWeight = conf.actorFontWeight;
22753 var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
22754
22755 for (var i = 0; i < lines.length; i++) {
22756 var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
22757 var text = g.append('text').attr('x', x + width / 2).attr('y', y).style('text-anchor', 'middle').style('font-size', actorFontSize).style('font-weight', actorFontWeight).style('font-family', actorFontFamily);
22758 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
22759 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
22760
22761 _setTextAttrs(text, textAttrs);
22762 }
22763 }
22764
22765 function byFo(content, g, x, y, width, height, textAttrs, conf) {
22766 var s = g.append('switch');
22767 var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
22768 var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
22769 text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
22770 byTspan(content, s, x, y, width, height, textAttrs, conf);
22771
22772 _setTextAttrs(text, textAttrs);
22773 }
22774
22775 function _setTextAttrs(toText, fromTextAttrsDict) {
22776 for (var key in fromTextAttrsDict) {
22777 if (fromTextAttrsDict.hasOwnProperty(key)) {
22778 // eslint-disable-line
22779 toText.attr(key, fromTextAttrsDict[key]);
22780 }
22781 }
22782 }
22783
22784 return function (conf) {
22785 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
22786 };
22787}();
22788
22789var _drawMenuItemTextCandidateFunc = function () {
22790 function byText(content, g, x, y, width, height, textAttrs) {
22791 var text = g.append('text').attr('x', x).attr('y', y).style('text-anchor', 'start').text(content);
22792
22793 _setTextAttrs(text, textAttrs);
22794 }
22795
22796 function byTspan(content, g, x, y, width, height, textAttrs, conf) {
22797 var actorFontSize = conf.actorFontSize,
22798 actorFontFamily = conf.actorFontFamily,
22799 actorFontWeight = conf.actorFontWeight;
22800 var lines = content.split(_common_common__WEBPACK_IMPORTED_MODULE_1__["default"].lineBreakRegex);
22801
22802 for (var i = 0; i < lines.length; i++) {
22803 var dy = i * actorFontSize - actorFontSize * (lines.length - 1) / 2;
22804 var text = g.append('text').attr('x', x).attr('y', y).style('text-anchor', 'start').style('font-size', actorFontSize).style('font-weight', actorFontWeight).style('font-family', actorFontFamily);
22805 text.append('tspan').attr('x', x).attr('dy', dy).text(lines[i]);
22806 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
22807
22808 _setTextAttrs(text, textAttrs);
22809 }
22810 }
22811
22812 function byFo(content, g, x, y, width, height, textAttrs, conf) {
22813 var s = g.append('switch');
22814 var f = s.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height);
22815 var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
22816 text.append('div').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle').text(content);
22817 byTspan(content, s, x, y, width, height, textAttrs, conf);
22818
22819 _setTextAttrs(text, textAttrs);
22820 }
22821
22822 function _setTextAttrs(toText, fromTextAttrsDict) {
22823 for (var key in fromTextAttrsDict) {
22824 if (fromTextAttrsDict.hasOwnProperty(key)) {
22825 // eslint-disable-line
22826 toText.attr(key, fromTextAttrsDict[key]);
22827 }
22828 }
22829 }
22830
22831 return function (conf) {
22832 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
22833 };
22834}();
22835
22836/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
22837 drawRect: drawRect,
22838 drawText: drawText,
22839 drawLabel: drawLabel,
22840 drawActor: drawActor,
22841 drawPopup: drawPopup,
22842 drawImage: drawImage,
22843 drawEmbeddedImage: drawEmbeddedImage,
22844 anchorElement: anchorElement,
22845 drawActivation: drawActivation,
22846 drawLoop: drawLoop,
22847 drawBackgroundRect: drawBackgroundRect,
22848 insertArrowHead: insertArrowHead,
22849 insertArrowFilledHead: insertArrowFilledHead,
22850 insertSequenceNumber: insertSequenceNumber,
22851 insertArrowCrossHead: insertArrowCrossHead,
22852 insertDatabaseIcon: insertDatabaseIcon,
22853 insertComputerIcon: insertComputerIcon,
22854 insertClockIcon: insertClockIcon,
22855 getTextObj: getTextObj,
22856 getNoteRect: getNoteRect,
22857 popupMenu: popupMenu,
22858 popdownMenu: popdownMenu,
22859 fixLifeLineHeights: fixLifeLineHeights
22860});
22861
22862/***/ }),
22863
22864/***/ "./src/diagrams/state/id-cache.js":
22865/*!****************************************!*\
22866 !*** ./src/diagrams/state/id-cache.js ***!
22867 \****************************************/
22868/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22869
22870"use strict";
22871__webpack_require__.r(__webpack_exports__);
22872/* harmony export */ __webpack_require__.d(__webpack_exports__, {
22873/* harmony export */ "set": () => (/* binding */ set),
22874/* harmony export */ "get": () => (/* binding */ get),
22875/* harmony export */ "keys": () => (/* binding */ keys),
22876/* harmony export */ "size": () => (/* binding */ size),
22877/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
22878/* harmony export */ });
22879var idCache = {};
22880var set = function set(key, val) {
22881 idCache[key] = val;
22882};
22883var get = function get(k) {
22884 return idCache[k];
22885};
22886var keys = function keys() {
22887 return Object.keys(idCache);
22888};
22889var size = function size() {
22890 return keys().length;
22891};
22892/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
22893 get: get,
22894 set: set,
22895 keys: keys,
22896 size: size
22897});
22898
22899/***/ }),
22900
22901/***/ "./src/diagrams/state/shapes.js":
22902/*!**************************************!*\
22903 !*** ./src/diagrams/state/shapes.js ***!
22904 \**************************************/
22905/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
22906
22907"use strict";
22908__webpack_require__.r(__webpack_exports__);
22909/* harmony export */ __webpack_require__.d(__webpack_exports__, {
22910/* harmony export */ "drawStartState": () => (/* binding */ drawStartState),
22911/* harmony export */ "drawDivider": () => (/* binding */ drawDivider),
22912/* harmony export */ "drawSimpleState": () => (/* binding */ drawSimpleState),
22913/* harmony export */ "drawDescrState": () => (/* binding */ drawDescrState),
22914/* harmony export */ "addTitleAndBox": () => (/* binding */ addTitleAndBox),
22915/* harmony export */ "drawText": () => (/* binding */ drawText),
22916/* harmony export */ "drawNote": () => (/* binding */ drawNote),
22917/* harmony export */ "drawState": () => (/* binding */ drawState),
22918/* harmony export */ "drawEdge": () => (/* binding */ drawEdge)
22919/* harmony export */ });
22920/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
22921/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
22922/* harmony import */ var _id_cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./id-cache.js */ "./src/diagrams/state/id-cache.js");
22923/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
22924/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
22925/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
22926/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
22927/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
22928function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
22929
22930function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
22931
22932function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
22933
22934
22935
22936
22937
22938
22939
22940 // let conf;
22941
22942/**
22943 * Draws a start state as a black circle
22944 */
22945
22946var drawStartState = function drawStartState(g) {
22947 return g.append('circle') // .style('stroke', 'black')
22948 // .style('fill', 'black')
22949 .attr('class', 'start-state').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit);
22950};
22951/**
22952 * Draws a start state as a black circle
22953 */
22954
22955var drawDivider = function drawDivider(g) {
22956 return g.append('line').style('stroke', 'grey').style('stroke-dasharray', '3').attr('x1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('class', 'divider').attr('x2', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight * 2).attr('y1', 0).attr('y2', 0);
22957};
22958/**
22959 * Draws a an end state as a black circle
22960 */
22961
22962var drawSimpleState = function drawSimpleState(g, stateDef) {
22963 var state = g.append('text').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.id);
22964 var classBox = state.node().getBBox();
22965 g.insert('rect', ':first-child').attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', classBox.width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', classBox.height + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
22966 return state;
22967};
22968/**
22969 * Draws a state with descriptions
22970 * @param {*} g
22971 * @param {*} stateDef
22972 */
22973
22974var drawDescrState = function drawDescrState(g, stateDef) {
22975 var addTspan = function addTspan(textEl, txt, isFirst) {
22976 var tSpan = textEl.append('tspan').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).text(txt);
22977
22978 if (!isFirst) {
22979 tSpan.attr('dy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight);
22980 }
22981 };
22982
22983 var title = g.append('text').attr('x', 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + 1.3 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.descriptions[0]);
22984 var titleBox = title.node().getBBox();
22985 var titleHeight = titleBox.height;
22986 var description = g.append('text') // text label for the x axis
22987 .attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding * 0.4 + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('class', 'state-description');
22988 var isFirst = true;
22989 var isSecond = true;
22990 stateDef.descriptions.forEach(function (descr) {
22991 if (!isFirst) {
22992 addTspan(description, descr, isSecond);
22993 isSecond = false;
22994 }
22995
22996 isFirst = false;
22997 });
22998 var descrLine = g.append('line') // text label for the x axis
22999 .attr('x1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y1', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin / 2).attr('y2', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + titleHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.dividerMargin / 2).attr('class', 'descr-divider');
23000 var descrBox = description.node().getBBox();
23001 var width = Math.max(descrBox.width, titleBox.width);
23002 descrLine.attr('x2', width + 3 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding); // const classBox = title.node().getBBox();
23003
23004 g.insert('rect', ':first-child').attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', descrBox.height + titleHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
23005 return g;
23006};
23007/**
23008 * Adds the creates a box around the existing content and adds a
23009 * panel for the id on top of the content.
23010 */
23011
23012/**
23013 * Function that creates an title row and a frame around a substate for a composit state diagram.
23014 * The function returns a new d3 svg object with updated width and height properties;
23015 * @param {*} g The d3 svg object for the substate to framed
23016 * @param {*} stateDef The info about the
23017 */
23018
23019var addTitleAndBox = function addTitleAndBox(g, stateDef, altBkg) {
23020 var pad = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
23021 var dblPad = 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
23022 var orgBox = g.node().getBBox();
23023 var orgWidth = orgBox.width;
23024 var orgX = orgBox.x;
23025 var title = g.append('text').attr('x', 0).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift).attr('font-size', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.fontSize).attr('class', 'state-title').text(stateDef.id);
23026 var titleBox = title.node().getBBox();
23027 var titleWidth = titleBox.width + dblPad;
23028 var width = Math.max(titleWidth, orgWidth); // + dblPad;
23029
23030 if (width === orgWidth) {
23031 width = width + dblPad;
23032 }
23033
23034 var startX; // const lineY = 1 - getConfig().state.textHeight;
23035 // const descrLine = g
23036 // .append('line') // text label for the x axis
23037 // .attr('x1', 0)
23038 // .attr('y1', lineY)
23039 // .attr('y2', lineY)
23040 // .attr('class', 'descr-divider');
23041
23042 var graphBox = g.node().getBBox(); // descrLine.attr('x2', graphBox.width + getConfig().state.padding);
23043
23044 if (stateDef.doc) {// cnsole.warn(
23045 // stateDef.id,
23046 // 'orgX: ',
23047 // orgX,
23048 // 'width: ',
23049 // width,
23050 // 'titleWidth: ',
23051 // titleWidth,
23052 // 'orgWidth: ',
23053 // orgWidth,
23054 // 'width',
23055 // width
23056 // );
23057 }
23058
23059 startX = orgX - pad;
23060
23061 if (titleWidth > orgWidth) {
23062 startX = (orgWidth - width) / 2 + pad;
23063 }
23064
23065 if (Math.abs(orgX - graphBox.x) < pad) {
23066 if (titleWidth > orgWidth) {
23067 startX = orgX - (titleWidth - orgWidth) / 2;
23068 }
23069 }
23070
23071 var lineY = 1 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight; // White color
23072
23073 g.insert('rect', ':first-child').attr('x', startX).attr('y', lineY).attr('class', altBkg ? 'alt-composit' : 'composit').attr('width', width).attr('height', graphBox.height + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift + 1).attr('rx', '0');
23074 title.attr('x', startX + pad);
23075 if (titleWidth <= orgWidth) title.attr('x', orgX + (width - dblPad) / 2 - titleWidth / 2 + pad); // Title background
23076
23077 g.insert('rect', ':first-child').attr('x', startX).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width) // Just needs to be higher then the descr line, will be clipped by the white color box
23078 .attr('height', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight * 3).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius); // Full background
23079
23080 g.insert('rect', ':first-child').attr('x', startX).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.titleShift - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('width', width).attr('height', graphBox.height + 3 + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.textHeight).attr('rx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.radius);
23081 return g;
23082};
23083
23084var drawEndState = function drawEndState(g) {
23085 g.append('circle') // .style('stroke', 'black')
23086 // .style('fill', 'white')
23087 .attr('class', 'end-state-outer').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.miniPadding);
23088 return g.append('circle') // .style('stroke', 'black')
23089 // .style('fill', 'black')
23090 .attr('class', 'end-state-inner').attr('r', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit).attr('cx', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + 2).attr('cy', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.sizeUnit + 2);
23091};
23092
23093var drawForkJoinState = function drawForkJoinState(g, stateDef) {
23094 var width = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkWidth;
23095 var height = (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.forkHeight;
23096
23097 if (stateDef.parentId) {
23098 var tmp = width;
23099 width = height;
23100 height = tmp;
23101 }
23102
23103 return g.append('rect').style('stroke', 'black').style('fill', 'black').attr('width', width).attr('height', height).attr('x', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
23104};
23105
23106var drawText = function drawText(elem, textData) {
23107 // Remove and ignore br:s
23108 var nText = textData.text.replace(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex, ' ');
23109 var textElem = elem.append('text');
23110 textElem.attr('x', textData.x);
23111 textElem.attr('y', textData.y);
23112 textElem.style('text-anchor', textData.anchor);
23113 textElem.attr('fill', textData.fill);
23114
23115 if (typeof textData.class !== 'undefined') {
23116 textElem.attr('class', textData.class);
23117 }
23118
23119 var span = textElem.append('tspan');
23120 span.attr('x', textData.x + textData.textMargin * 2);
23121 span.attr('fill', textData.fill);
23122 span.text(nText);
23123 return textElem;
23124};
23125
23126var _drawLongText = function _drawLongText(_text, x, y, g) {
23127 var textHeight = 0;
23128 var textElem = g.append('text');
23129 textElem.style('text-anchor', 'start');
23130 textElem.attr('class', 'noteText');
23131
23132 var text = _text.replace(/\r\n/g, '<br/>');
23133
23134 text = text.replace(/\n/g, '<br/>');
23135 var lines = text.split(_common_common__WEBPACK_IMPORTED_MODULE_2__["default"].lineBreakRegex);
23136 var tHeight = 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin;
23137
23138 var _iterator = _createForOfIteratorHelper(lines),
23139 _step;
23140
23141 try {
23142 for (_iterator.s(); !(_step = _iterator.n()).done;) {
23143 var _line = _step.value;
23144
23145 var txt = _line.trim();
23146
23147 if (txt.length > 0) {
23148 var span = textElem.append('tspan');
23149 span.text(txt);
23150
23151 if (tHeight === 0) {
23152 var textBounds = span.node().getBBox();
23153 tHeight += textBounds.height;
23154 }
23155
23156 textHeight += tHeight;
23157 span.attr('x', x + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
23158 span.attr('y', y + textHeight + 1.25 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
23159 }
23160 }
23161 } catch (err) {
23162 _iterator.e(err);
23163 } finally {
23164 _iterator.f();
23165 }
23166
23167 return {
23168 textWidth: textElem.node().getBBox().width,
23169 textHeight: textHeight
23170 };
23171};
23172/**
23173 * Draws a note to the diagram
23174 * @param text - The text of the given note.
23175 * @param g - The element the note is attached to.
23176 */
23177
23178
23179var drawNote = function drawNote(text, g) {
23180 g.attr('class', 'state-note');
23181 var note = g.append('rect').attr('x', 0).attr('y', (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
23182 var rectElem = g.append('g');
23183
23184 var _drawLongText2 = _drawLongText(text, 0, 0, rectElem),
23185 textWidth = _drawLongText2.textWidth,
23186 textHeight = _drawLongText2.textHeight;
23187
23188 note.attr('height', textHeight + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin);
23189 note.attr('width', textWidth + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.noteMargin * 2);
23190 return note;
23191};
23192/**
23193 * Starting point for drawing a state. The function finds out the specifics
23194 * about the state and renders with approprtiate function.
23195 * @param {*} elem
23196 * @param {*} stateDef
23197 */
23198
23199var drawState = function drawState(elem, stateDef) {
23200 var id = stateDef.id;
23201 var stateInfo = {
23202 id: id,
23203 label: stateDef.id,
23204 width: 0,
23205 height: 0
23206 };
23207 var g = elem.append('g').attr('id', id).attr('class', 'stateGroup');
23208 if (stateDef.type === 'start') drawStartState(g);
23209 if (stateDef.type === 'end') drawEndState(g);
23210 if (stateDef.type === 'fork' || stateDef.type === 'join') drawForkJoinState(g, stateDef);
23211 if (stateDef.type === 'note') drawNote(stateDef.note.text, g);
23212 if (stateDef.type === 'divider') drawDivider(g);
23213 if (stateDef.type === 'default' && stateDef.descriptions.length === 0) drawSimpleState(g, stateDef);
23214 if (stateDef.type === 'default' && stateDef.descriptions.length > 0) drawDescrState(g, stateDef);
23215 var stateBox = g.node().getBBox();
23216 stateInfo.width = stateBox.width + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
23217 stateInfo.height = stateBox.height + 2 * (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding;
23218 _id_cache_js__WEBPACK_IMPORTED_MODULE_3__["default"].set(id, stateInfo); // stateCnt++;
23219
23220 return stateInfo;
23221};
23222var edgeCount = 0;
23223var drawEdge = function drawEdge(elem, path, relation) {
23224 var getRelationType = function getRelationType(type) {
23225 switch (type) {
23226 case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.AGGREGATION:
23227 return 'aggregation';
23228
23229 case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.EXTENSION:
23230 return 'extension';
23231
23232 case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.COMPOSITION:
23233 return 'composition';
23234
23235 case _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY:
23236 return 'dependency';
23237 }
23238 };
23239
23240 path.points = path.points.filter(function (p) {
23241 return !Number.isNaN(p.y);
23242 }); // The data for our line
23243
23244 var lineData = path.points; // This is the accessor function we talked about above
23245
23246 var lineFunction = (0,d3__WEBPACK_IMPORTED_MODULE_0__.line)().x(function (d) {
23247 return d.x;
23248 }).y(function (d) {
23249 return d.y;
23250 }).curve(d3__WEBPACK_IMPORTED_MODULE_0__.curveBasis);
23251 var svgPath = elem.append('path').attr('d', lineFunction(lineData)).attr('id', 'edge' + edgeCount).attr('class', 'transition');
23252 var url = '';
23253
23254 if ((0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.arrowMarkerAbsolute) {
23255 url = window.location.protocol + '//' + window.location.host + window.location.pathname + window.location.search;
23256 url = url.replace(/\(/g, '\\(');
23257 url = url.replace(/\)/g, '\\)');
23258 }
23259
23260 svgPath.attr('marker-end', 'url(' + url + '#' + getRelationType(_stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].relationType.DEPENDENCY) + 'End' + ')');
23261
23262 if (typeof relation.title !== 'undefined') {
23263 var label = elem.append('g').attr('class', 'stateLabel');
23264
23265 var _utils$calcLabelPosit = _utils__WEBPACK_IMPORTED_MODULE_5__["default"].calcLabelPosition(path.points),
23266 x = _utils$calcLabelPosit.x,
23267 y = _utils$calcLabelPosit.y;
23268
23269 var rows = _common_common__WEBPACK_IMPORTED_MODULE_2__["default"].getRows(relation.title);
23270 var titleHeight = 0;
23271 var titleRows = [];
23272 var maxWidth = 0;
23273 var minX = 0;
23274
23275 for (var i = 0; i <= rows.length; i++) {
23276 var title = label.append('text').attr('text-anchor', 'middle').text(rows[i]).attr('x', x).attr('y', y + titleHeight);
23277 var boundstmp = title.node().getBBox();
23278 maxWidth = Math.max(maxWidth, boundstmp.width);
23279 minX = Math.min(minX, boundstmp.x);
23280 _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(boundstmp.x, x, y + titleHeight);
23281
23282 if (titleHeight === 0) {
23283 var titleBox = title.node().getBBox();
23284 titleHeight = titleBox.height;
23285 _logger__WEBPACK_IMPORTED_MODULE_6__.log.info('Title height', titleHeight, y);
23286 }
23287
23288 titleRows.push(title);
23289 }
23290
23291 var boxHeight = titleHeight * rows.length;
23292
23293 if (rows.length > 1) {
23294 var heightAdj = (rows.length - 1) * titleHeight * 0.5;
23295 titleRows.forEach(function (title, i) {
23296 return title.attr('y', y + i * titleHeight - heightAdj);
23297 });
23298 boxHeight = titleHeight * rows.length;
23299 }
23300
23301 var bounds = label.node().getBBox();
23302 label.insert('rect', ':first-child').attr('class', 'box').attr('x', x - maxWidth / 2 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding / 2).attr('y', y - boxHeight / 2 - (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding / 2 - 3.5).attr('width', maxWidth + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding).attr('height', boxHeight + (0,_config__WEBPACK_IMPORTED_MODULE_1__.getConfig)().state.padding);
23303 _logger__WEBPACK_IMPORTED_MODULE_6__.log.info(bounds); //label.attr('transform', '0 -' + (bounds.y / 2));
23304 // Debug points
23305 // path.points.forEach(point => {
23306 // g.append('circle')
23307 // .style('stroke', 'red')
23308 // .style('fill', 'red')
23309 // .attr('r', 1)
23310 // .attr('cx', point.x)
23311 // .attr('cy', point.y);
23312 // });
23313 // g.append('circle')
23314 // .style('stroke', 'blue')
23315 // .style('fill', 'blue')
23316 // .attr('r', 1)
23317 // .attr('cx', x)
23318 // .attr('cy', y);
23319 }
23320
23321 edgeCount++;
23322};
23323
23324/***/ }),
23325
23326/***/ "./src/diagrams/state/stateDb.js":
23327/*!***************************************!*\
23328 !*** ./src/diagrams/state/stateDb.js ***!
23329 \***************************************/
23330/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23331
23332"use strict";
23333__webpack_require__.r(__webpack_exports__);
23334/* harmony export */ __webpack_require__.d(__webpack_exports__, {
23335/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
23336/* harmony export */ "addState": () => (/* binding */ addState),
23337/* harmony export */ "clear": () => (/* binding */ clear),
23338/* harmony export */ "getState": () => (/* binding */ getState),
23339/* harmony export */ "getStates": () => (/* binding */ getStates),
23340/* harmony export */ "logDocuments": () => (/* binding */ logDocuments),
23341/* harmony export */ "getRelations": () => (/* binding */ getRelations),
23342/* harmony export */ "addRelation": () => (/* binding */ addRelation),
23343/* harmony export */ "cleanupLabel": () => (/* binding */ cleanupLabel),
23344/* harmony export */ "lineType": () => (/* binding */ lineType),
23345/* harmony export */ "relationType": () => (/* binding */ relationType),
23346/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23347/* harmony export */ });
23348/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
23349/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
23350/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
23351/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
23352/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../config */ "./src/config.js");
23353function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
23354
23355
23356
23357
23358
23359
23360
23361var clone = function clone(o) {
23362 return JSON.parse(JSON.stringify(o));
23363};
23364
23365var rootDoc = [];
23366var parseDirective = function parseDirective(statement, context, type) {
23367 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
23368};
23369
23370var setRootDoc = function setRootDoc(o) {
23371 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Setting root doc', o); // rootDoc = { id: 'root', doc: o };
23372
23373 rootDoc = o;
23374};
23375
23376var getRootDoc = function getRootDoc() {
23377 return rootDoc;
23378};
23379
23380var docTranslator = function docTranslator(parent, node, first) {
23381 if (node.stmt === 'relation') {
23382 docTranslator(parent, node.state1, true);
23383 docTranslator(parent, node.state2, false);
23384 } else {
23385 if (node.stmt === 'state') {
23386 if (node.id === '[*]') {
23387 node.id = first ? parent.id + '_start' : parent.id + '_end';
23388 node.start = first;
23389 }
23390 }
23391
23392 if (node.doc) {
23393 var doc = []; // Check for concurrency
23394
23395 var i = 0;
23396 var currentDoc = [];
23397
23398 for (i = 0; i < node.doc.length; i++) {
23399 if (node.doc[i].type === 'divider') {
23400 // debugger;
23401 var newNode = clone(node.doc[i]);
23402 newNode.doc = clone(currentDoc);
23403 doc.push(newNode);
23404 currentDoc = [];
23405 } else {
23406 currentDoc.push(node.doc[i]);
23407 }
23408 } // If any divider was encountered
23409
23410
23411 if (doc.length > 0 && currentDoc.length > 0) {
23412 var _newNode = {
23413 stmt: 'state',
23414 id: (0,_utils__WEBPACK_IMPORTED_MODULE_2__.generateId)(),
23415 type: 'divider',
23416 doc: clone(currentDoc)
23417 };
23418 doc.push(clone(_newNode));
23419 node.doc = doc;
23420 }
23421
23422 node.doc.forEach(function (docNode) {
23423 return docTranslator(node, docNode, true);
23424 });
23425 }
23426 }
23427};
23428
23429var getRootDocV2 = function getRootDocV2() {
23430 docTranslator({
23431 id: 'root'
23432 }, {
23433 id: 'root',
23434 doc: rootDoc
23435 }, true);
23436 return {
23437 id: 'root',
23438 doc: rootDoc
23439 }; // Here
23440};
23441
23442var extract = function extract(_doc) {
23443 // const res = { states: [], relations: [] };
23444 var doc;
23445
23446 if (_doc.doc) {
23447 doc = _doc.doc;
23448 } else {
23449 doc = _doc;
23450 } // let doc = root.doc;
23451 // if (!doc) {
23452 // doc = root;
23453 // }
23454
23455
23456 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info(doc);
23457 clear();
23458 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Extract', doc);
23459 doc.forEach(function (item) {
23460 if (item.stmt === 'state') {
23461 addState(item.id, item.type, item.doc, item.description, item.note);
23462 }
23463
23464 if (item.stmt === 'relation') {
23465 addRelation(item.state1.id, item.state2.id, item.description);
23466 }
23467 });
23468};
23469
23470var newDoc = function newDoc() {
23471 return {
23472 relations: [],
23473 states: {},
23474 documents: {}
23475 };
23476};
23477
23478var documents = {
23479 root: newDoc()
23480};
23481var currentDocument = documents.root;
23482var startCnt = 0;
23483var endCnt = 0; // eslint-disable-line
23484// let stateCnt = 0;
23485
23486/**
23487 * Function called by parser when a node definition has been found.
23488 * @param id
23489 * @param text
23490 * @param type
23491 * @param style
23492 */
23493
23494var addState = function addState(id, type, doc, descr, note) {
23495 if (typeof currentDocument.states[id] === 'undefined') {
23496 currentDocument.states[id] = {
23497 id: id,
23498 descriptions: [],
23499 type: type,
23500 doc: doc,
23501 note: note
23502 };
23503 } else {
23504 if (!currentDocument.states[id].doc) {
23505 currentDocument.states[id].doc = doc;
23506 }
23507
23508 if (!currentDocument.states[id].type) {
23509 currentDocument.states[id].type = type;
23510 }
23511 }
23512
23513 if (descr) {
23514 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Adding state ', id, descr);
23515 if (typeof descr === 'string') addDescription(id, descr.trim());
23516
23517 if (_typeof(descr) === 'object') {
23518 descr.forEach(function (des) {
23519 return addDescription(id, des.trim());
23520 });
23521 }
23522 }
23523
23524 if (note) {
23525 currentDocument.states[id].note = note;
23526 currentDocument.states[id].note.text = _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(currentDocument.states[id].note.text, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig());
23527 }
23528};
23529var clear = function clear() {
23530 documents = {
23531 root: newDoc()
23532 };
23533 currentDocument = documents.root;
23534 currentDocument = documents.root;
23535 startCnt = 0;
23536 endCnt = 0; // eslint-disable-line
23537
23538 classes = [];
23539};
23540var getState = function getState(id) {
23541 return currentDocument.states[id];
23542};
23543var getStates = function getStates() {
23544 return currentDocument.states;
23545};
23546var logDocuments = function logDocuments() {
23547 _logger__WEBPACK_IMPORTED_MODULE_1__.log.info('Documents = ', documents);
23548};
23549var getRelations = function getRelations() {
23550 return currentDocument.relations;
23551};
23552var addRelation = function addRelation(_id1, _id2, title) {
23553 var id1 = _id1;
23554 var id2 = _id2;
23555 var type1 = 'default';
23556 var type2 = 'default';
23557
23558 if (_id1 === '[*]') {
23559 startCnt++;
23560 id1 = 'start' + startCnt;
23561 type1 = 'start';
23562 }
23563
23564 if (_id2 === '[*]') {
23565 endCnt++;
23566 id2 = 'end' + startCnt;
23567 type2 = 'end';
23568 }
23569
23570 addState(id1, type1);
23571 addState(id2, type2);
23572 currentDocument.relations.push({
23573 id1: id1,
23574 id2: id2,
23575 title: _common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(title, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig())
23576 });
23577};
23578
23579var addDescription = function addDescription(id, _descr) {
23580 var theState = currentDocument.states[id];
23581 var descr = _descr;
23582
23583 if (descr[0] === ':') {
23584 descr = descr.substr(1).trim();
23585 }
23586
23587 theState.descriptions.push(_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].sanitizeText(descr, _config__WEBPACK_IMPORTED_MODULE_4__.getConfig()));
23588};
23589
23590var cleanupLabel = function cleanupLabel(label) {
23591 if (label.substring(0, 1) === ':') {
23592 return label.substr(2).trim();
23593 } else {
23594 return label.trim();
23595 }
23596};
23597var lineType = {
23598 LINE: 0,
23599 DOTTED_LINE: 1
23600};
23601var dividerCnt = 0;
23602
23603var getDividerId = function getDividerId() {
23604 dividerCnt++;
23605 return 'divider-id-' + dividerCnt;
23606};
23607
23608var classes = [];
23609
23610var getClasses = function getClasses() {
23611 return classes;
23612};
23613
23614var direction = 'TB';
23615
23616var getDirection = function getDirection() {
23617 return direction;
23618};
23619
23620var setDirection = function setDirection(dir) {
23621 direction = dir;
23622};
23623
23624var relationType = {
23625 AGGREGATION: 0,
23626 EXTENSION: 1,
23627 COMPOSITION: 2,
23628 DEPENDENCY: 3
23629};
23630
23631var trimColon = function trimColon(str) {
23632 return str && str[0] === ':' ? str.substr(1).trim() : str.trim();
23633};
23634
23635/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
23636 parseDirective: parseDirective,
23637 getConfig: function getConfig() {
23638 return _config__WEBPACK_IMPORTED_MODULE_4__.getConfig().state;
23639 },
23640 addState: addState,
23641 clear: clear,
23642 getState: getState,
23643 getStates: getStates,
23644 getRelations: getRelations,
23645 getClasses: getClasses,
23646 getDirection: getDirection,
23647 addRelation: addRelation,
23648 getDividerId: getDividerId,
23649 setDirection: setDirection,
23650 // addDescription,
23651 cleanupLabel: cleanupLabel,
23652 lineType: lineType,
23653 relationType: relationType,
23654 logDocuments: logDocuments,
23655 getRootDoc: getRootDoc,
23656 setRootDoc: setRootDoc,
23657 getRootDocV2: getRootDocV2,
23658 extract: extract,
23659 trimColon: trimColon
23660});
23661
23662/***/ }),
23663
23664/***/ "./src/diagrams/state/stateRenderer-v2.js":
23665/*!************************************************!*\
23666 !*** ./src/diagrams/state/stateRenderer-v2.js ***!
23667 \************************************************/
23668/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
23669
23670"use strict";
23671__webpack_require__.r(__webpack_exports__);
23672/* harmony export */ __webpack_require__.d(__webpack_exports__, {
23673/* harmony export */ "setConf": () => (/* binding */ setConf),
23674/* harmony export */ "getClasses": () => (/* binding */ getClasses),
23675/* harmony export */ "draw": () => (/* binding */ draw),
23676/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
23677/* harmony export */ });
23678/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! graphlib */ "graphlib");
23679/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_0__);
23680/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
23681/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
23682/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
23683/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
23684/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4__);
23685/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../config */ "./src/config.js");
23686/* harmony import */ var _dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../dagre-wrapper/index.js */ "./src/dagre-wrapper/index.js");
23687/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
23688/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
23689/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
23690
23691
23692
23693
23694
23695
23696
23697
23698
23699var conf = {};
23700var setConf = function setConf(cnf) {
23701 var keys = Object.keys(cnf);
23702
23703 for (var i = 0; i < keys.length; i++) {
23704 conf[keys[i]] = cnf[keys[i]];
23705 }
23706};
23707var nodeDb = {};
23708/**
23709 * Returns the all the styles from classDef statements in the graph definition.
23710 * @returns {object} classDef styles
23711 */
23712
23713var getClasses = function getClasses(text) {
23714 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Extracting classes');
23715 _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
23716 var parser = (_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default().parser);
23717 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"]; // Parse the graph definition
23718
23719 parser.parse(text);
23720 return _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getClasses();
23721};
23722
23723var setupNode = function setupNode(g, parent, node, altFlag) {
23724 // Add the node
23725 if (node.id !== 'root') {
23726 var shape = 'rect';
23727
23728 if (node.start === true) {
23729 shape = 'start';
23730 }
23731
23732 if (node.start === false) {
23733 shape = 'end';
23734 }
23735
23736 if (node.type !== 'default') {
23737 shape = node.type;
23738 }
23739
23740 if (!nodeDb[node.id]) {
23741 nodeDb[node.id] = {
23742 id: node.id,
23743 shape: shape,
23744 description: _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].sanitizeText(node.id, (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)()),
23745 classes: 'statediagram-state'
23746 };
23747 } // Build of the array of description strings accordinging
23748
23749
23750 if (node.description) {
23751 if (Array.isArray(nodeDb[node.id].description)) {
23752 // There already is an array of strings,add to it
23753 nodeDb[node.id].shape = 'rectWithTitle';
23754 nodeDb[node.id].description.push(node.description);
23755 } else {
23756 if (nodeDb[node.id].description.length > 0) {
23757 // if there is a description already transformit to an array
23758 nodeDb[node.id].shape = 'rectWithTitle';
23759
23760 if (nodeDb[node.id].description === node.id) {
23761 // If the previous description was the is, remove it
23762 nodeDb[node.id].description = [node.description];
23763 } else {
23764 nodeDb[node.id].description = [nodeDb[node.id].description, node.description];
23765 }
23766 } else {
23767 nodeDb[node.id].shape = 'rect';
23768 nodeDb[node.id].description = node.description;
23769 }
23770 }
23771
23772 nodeDb[node.id].description = _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].sanitizeTextOrArray(nodeDb[node.id].description, (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)());
23773 } // Save data for description and group so that for instance a statement without description overwrites
23774 // one with description
23775 // group
23776
23777
23778 if (!nodeDb[node.id].type && node.doc) {
23779 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Setting cluster for ', node.id, getDir(node));
23780 nodeDb[node.id].type = 'group';
23781 nodeDb[node.id].dir = getDir(node);
23782 nodeDb[node.id].shape = node.type === 'divider' ? 'divider' : 'roundedWithTitle';
23783 nodeDb[node.id].classes = nodeDb[node.id].classes + ' ' + (altFlag ? 'statediagram-cluster statediagram-cluster-alt' : 'statediagram-cluster');
23784 }
23785
23786 var nodeData = {
23787 labelStyle: '',
23788 shape: nodeDb[node.id].shape,
23789 labelText: nodeDb[node.id].description,
23790 // typeof nodeDb[node.id].description === 'object'
23791 // ? nodeDb[node.id].description[0]
23792 // : nodeDb[node.id].description,
23793 classes: nodeDb[node.id].classes,
23794 //classStr,
23795 style: '',
23796 //styles.style,
23797 id: node.id,
23798 dir: nodeDb[node.id].dir,
23799 domId: 'state-' + node.id + '-' + cnt,
23800 type: nodeDb[node.id].type,
23801 padding: 15 //getConfig().flowchart.padding
23802
23803 };
23804
23805 if (node.note) {
23806 // Todo: set random id
23807 var noteData = {
23808 labelStyle: '',
23809 shape: 'note',
23810 labelText: node.note.text,
23811 classes: 'statediagram-note',
23812 //classStr,
23813 style: '',
23814 //styles.style,
23815 id: node.id + '----note-' + cnt,
23816 domId: 'state-' + node.id + '----note-' + cnt,
23817 type: nodeDb[node.id].type,
23818 padding: 15 //getConfig().flowchart.padding
23819
23820 };
23821 var groupData = {
23822 labelStyle: '',
23823 shape: 'noteGroup',
23824 labelText: node.note.text,
23825 classes: nodeDb[node.id].classes,
23826 //classStr,
23827 style: '',
23828 //styles.style,
23829 id: node.id + '----parent',
23830 domId: 'state-' + node.id + '----parent-' + cnt,
23831 type: 'group',
23832 padding: 0 //getConfig().flowchart.padding
23833
23834 };
23835 cnt++;
23836 g.setNode(node.id + '----parent', groupData);
23837 g.setNode(noteData.id, noteData);
23838 g.setNode(node.id, nodeData);
23839 g.setParent(node.id, node.id + '----parent');
23840 g.setParent(noteData.id, node.id + '----parent');
23841 var from = node.id;
23842 var to = noteData.id;
23843
23844 if (node.note.position === 'left of') {
23845 from = noteData.id;
23846 to = node.id;
23847 }
23848
23849 g.setEdge(from, to, {
23850 arrowhead: 'none',
23851 arrowType: '',
23852 style: 'fill:none',
23853 labelStyle: '',
23854 classes: 'transition note-edge',
23855 arrowheadStyle: 'fill: #333',
23856 labelpos: 'c',
23857 labelType: 'text',
23858 thickness: 'normal'
23859 });
23860 } else {
23861 g.setNode(node.id, nodeData);
23862 }
23863 }
23864
23865 if (parent) {
23866 if (parent.id !== 'root') {
23867 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Setting node ', node.id, ' to be child of its parent ', parent.id);
23868 g.setParent(node.id, parent.id);
23869 }
23870 }
23871
23872 if (node.doc) {
23873 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('Adding nodes children ');
23874 setupDoc(g, node, node.doc, !altFlag);
23875 }
23876};
23877
23878var cnt = 0;
23879
23880var setupDoc = function setupDoc(g, parent, doc, altFlag) {
23881 // cnt = 0;
23882 _logger__WEBPACK_IMPORTED_MODULE_2__.log.trace('items', doc);
23883 doc.forEach(function (item) {
23884 if (item.stmt === 'state' || item.stmt === 'default') {
23885 setupNode(g, parent, item, altFlag);
23886 } else if (item.stmt === 'relation') {
23887 setupNode(g, parent, item.state1, altFlag);
23888 setupNode(g, parent, item.state2, altFlag);
23889 var edgeData = {
23890 id: 'edge' + cnt,
23891 arrowhead: 'normal',
23892 arrowTypeEnd: 'arrow_barb',
23893 style: 'fill:none',
23894 labelStyle: '',
23895 label: _common_common__WEBPACK_IMPORTED_MODULE_5__["default"].sanitizeText(item.description, (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)()),
23896 arrowheadStyle: 'fill: #333',
23897 labelpos: 'c',
23898 labelType: 'text',
23899 thickness: 'normal',
23900 classes: 'transition'
23901 };
23902 var startId = item.state1.id;
23903 var endId = item.state2.id;
23904 g.setEdge(startId, endId, edgeData, cnt);
23905 cnt++;
23906 }
23907 });
23908};
23909
23910var getDir = function getDir(nodes, defaultDir) {
23911 var dir = defaultDir || 'TB';
23912
23913 if (nodes.doc) {
23914 for (var i = 0; i < nodes.doc.length; i++) {
23915 var node = nodes.doc[i];
23916
23917 if (node.stmt === 'dir') {
23918 dir = node.value;
23919 }
23920 }
23921 }
23922
23923 return dir;
23924};
23925/**
23926 * Draws a flowchart in the tag with id: id based on the graph definition in text.
23927 * @param text
23928 * @param id
23929 */
23930
23931
23932var draw = function draw(text, id) {
23933 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('Drawing state diagram (v2)', id);
23934 _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].clear();
23935 nodeDb = {};
23936 var parser = (_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_4___default().parser);
23937 parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"]; // Parse the graph definition
23938
23939 parser.parse(text); // Fetch the default direction, use TD if none was found
23940
23941 var dir = _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getDirection();
23942
23943 if (typeof dir === 'undefined') {
23944 dir = 'LR';
23945 }
23946
23947 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_6__.getConfig)().state;
23948 var nodeSpacing = conf.nodeSpacing || 50;
23949 var rankSpacing = conf.rankSpacing || 50;
23950 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2());
23951 _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].extract(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2());
23952 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2()); // Create the input mermaid.graph
23953
23954 var g = new (graphlib__WEBPACK_IMPORTED_MODULE_0___default().Graph)({
23955 multigraph: true,
23956 compound: true
23957 }).setGraph({
23958 rankdir: getDir(_stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2()),
23959 nodesep: nodeSpacing,
23960 ranksep: rankSpacing,
23961 marginx: 8,
23962 marginy: 8
23963 }).setDefaultEdgeLabel(function () {
23964 return {};
23965 });
23966 setupNode(g, undefined, _stateDb__WEBPACK_IMPORTED_MODULE_3__["default"].getRootDocV2(), true); // Set up an SVG group so that we can translate the final graph.
23967
23968 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)("[id=\"".concat(id, "\"]")); // Run the renderer. This is what draws the final graph.
23969
23970 var element = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('#' + id + ' g');
23971 (0,_dagre_wrapper_index_js__WEBPACK_IMPORTED_MODULE_7__.render)(element, g, ['barb'], 'statediagram', id);
23972 var padding = 8;
23973 var bounds = svg.node().getBBox();
23974 var width = bounds.width + padding * 2;
23975 var height = bounds.height + padding * 2; // Zoom in a bit
23976
23977 svg.attr('class', 'statediagram');
23978 var svgBounds = svg.node().getBBox();
23979 (0,_utils__WEBPACK_IMPORTED_MODULE_8__.configureSvgSize)(svg, height, width * 1.75, conf.useMaxWidth); // Ensure the viewBox includes the whole svgBounds area with extra space for padding
23980
23981 var vBox = "".concat(svgBounds.x - padding, " ").concat(svgBounds.y - padding, " ").concat(width, " ").concat(height);
23982 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("viewBox ".concat(vBox));
23983 svg.attr('viewBox', vBox); // Add label rects for non html labels
23984 // if (!evaluate(conf.htmlLabels) || true) {
23985
23986 var labels = document.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
23987
23988 for (var k = 0; k < labels.length; k++) {
23989 var label = labels[k]; // Get dimensions of label
23990
23991 var dim = label.getBBox();
23992 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
23993 rect.setAttribute('rx', 0);
23994 rect.setAttribute('ry', 0);
23995 rect.setAttribute('width', dim.width);
23996 rect.setAttribute('height', dim.height);
23997 label.insertBefore(rect, label.firstChild); // }
23998 }
23999};
24000/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
24001 setConf: setConf,
24002 getClasses: getClasses,
24003 draw: draw
24004});
24005
24006/***/ }),
24007
24008/***/ "./src/diagrams/state/stateRenderer.js":
24009/*!*********************************************!*\
24010 !*** ./src/diagrams/state/stateRenderer.js ***!
24011 \*********************************************/
24012/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24013
24014"use strict";
24015__webpack_require__.r(__webpack_exports__);
24016/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24017/* harmony export */ "setConf": () => (/* binding */ setConf),
24018/* harmony export */ "draw": () => (/* binding */ draw),
24019/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24020/* harmony export */ });
24021/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
24022/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
24023/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! dagre */ "dagre");
24024/* harmony import */ var dagre__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(dagre__WEBPACK_IMPORTED_MODULE_1__);
24025/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! graphlib */ "graphlib");
24026/* harmony import */ var graphlib__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(graphlib__WEBPACK_IMPORTED_MODULE_2__);
24027/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../logger */ "./src/logger.js");
24028/* harmony import */ var _stateDb__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./stateDb */ "./src/diagrams/state/stateDb.js");
24029/* harmony import */ var _common_common__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../common/common */ "./src/diagrams/common/common.js");
24030/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
24031/* harmony import */ var _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__);
24032/* harmony import */ var _shapes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./shapes */ "./src/diagrams/state/shapes.js");
24033/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../config */ "./src/config.js");
24034/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
24035
24036
24037
24038
24039
24040
24041 // import idCache from './id-cache';
24042
24043
24044
24045
24046_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"]; // TODO Move conf object to main conf in mermaidAPI
24047
24048var conf;
24049var transformationLog = {};
24050var setConf = function setConf() {}; // Todo optimize
24051
24052/**
24053 * Setup arrow head and define the marker. The result is appended to the svg.
24054 */
24055
24056var insertMarkers = function insertMarkers(elem) {
24057 elem.append('defs').append('marker').attr('id', 'dependencyEnd').attr('refX', 19).attr('refY', 7).attr('markerWidth', 20).attr('markerHeight', 28).attr('orient', 'auto').append('path').attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
24058};
24059/**
24060 * Draws a flowchart in the tag with id: id based on the graph definition in text.
24061 * @param text
24062 * @param id
24063 */
24064
24065
24066var draw = function draw(text, id) {
24067 conf = (0,_config__WEBPACK_IMPORTED_MODULE_5__.getConfig)().state;
24068 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.yy.clear();
24069 _parser_stateDiagram__WEBPACK_IMPORTED_MODULE_3__.parser.parse(text);
24070 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Rendering diagram ' + text); // Fetch the default direction, use TD if none was found
24071
24072 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id='".concat(id, "']"));
24073 insertMarkers(diagram); // Layout graph, Create a new directed graph
24074
24075 var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
24076 multigraph: true,
24077 compound: true,
24078 // acyclicer: 'greedy',
24079 rankdir: 'RL' // ranksep: '20'
24080
24081 }); // Default to assigning a new object as a label for each new edge.
24082
24083 graph.setDefaultEdgeLabel(function () {
24084 return {};
24085 });
24086 var rootDoc = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRootDoc();
24087 renderDoc(rootDoc, diagram, undefined, false);
24088 var padding = conf.padding;
24089 var bounds = diagram.node().getBBox();
24090 var width = bounds.width + padding * 2;
24091 var height = bounds.height + padding * 2; // zoom in a bit
24092
24093 var svgWidth = width * 1.75;
24094 (0,_utils__WEBPACK_IMPORTED_MODULE_7__.configureSvgSize)(diagram, height, svgWidth, conf.useMaxWidth);
24095 diagram.attr('viewBox', "".concat(bounds.x - conf.padding, " ").concat(bounds.y - conf.padding, " ") + width + ' ' + height);
24096};
24097
24098var getLabelWidth = function getLabelWidth(text) {
24099 return text ? text.length * conf.fontSizeFactor : 1;
24100};
24101
24102var renderDoc = function renderDoc(doc, diagram, parentId, altBkg) {
24103 // // Layout graph, Create a new directed graph
24104 var graph = new (graphlib__WEBPACK_IMPORTED_MODULE_2___default().Graph)({
24105 compound: true,
24106 multigraph: true
24107 });
24108 var i;
24109 var edgeFreeDoc = true;
24110
24111 for (i = 0; i < doc.length; i++) {
24112 if (doc[i].stmt === 'relation') {
24113 edgeFreeDoc = false;
24114 break;
24115 }
24116 } // Set an object for the graph label
24117
24118
24119 if (parentId) graph.setGraph({
24120 rankdir: 'LR',
24121 multigraph: true,
24122 compound: true,
24123 // acyclicer: 'greedy',
24124 ranker: 'tight-tree',
24125 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
24126 nodeSep: edgeFreeDoc ? 1 : 50,
24127 isMultiGraph: true // ranksep: 5,
24128 // nodesep: 1
24129
24130 });else {
24131 graph.setGraph({
24132 rankdir: 'TB',
24133 multigraph: true,
24134 compound: true,
24135 // isCompound: true,
24136 // acyclicer: 'greedy',
24137 // ranker: 'longest-path'
24138 ranksep: edgeFreeDoc ? 1 : conf.edgeLengthFactor,
24139 nodeSep: edgeFreeDoc ? 1 : 50,
24140 ranker: 'tight-tree',
24141 // ranker: 'network-simplex'
24142 isMultiGraph: true
24143 });
24144 } // Default to assigning a new object as a label for each new edge.
24145
24146 graph.setDefaultEdgeLabel(function () {
24147 return {};
24148 });
24149 _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].extract(doc);
24150 var states = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getStates();
24151 var relations = _stateDb__WEBPACK_IMPORTED_MODULE_4__["default"].getRelations();
24152 var keys = Object.keys(states);
24153 var first = true;
24154
24155 for (var _i = 0; _i < keys.length; _i++) {
24156 var stateDef = states[keys[_i]];
24157
24158 if (parentId) {
24159 stateDef.parentId = parentId;
24160 }
24161
24162 var node = void 0;
24163
24164 if (stateDef.doc) {
24165 var sub = diagram.append('g').attr('id', stateDef.id).attr('class', 'stateGroup');
24166 node = renderDoc(stateDef.doc, sub, stateDef.id, !altBkg);
24167
24168 if (first) {
24169 // first = false;
24170 sub = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.addTitleAndBox)(sub, stateDef, altBkg);
24171 var boxBounds = sub.node().getBBox();
24172 node.width = boxBounds.width;
24173 node.height = boxBounds.height + conf.padding / 2;
24174 transformationLog[stateDef.id] = {
24175 y: conf.compositTitleSize
24176 };
24177 } else {
24178 // sub = addIdAndBox(sub, stateDef);
24179 var _boxBounds = sub.node().getBBox();
24180
24181 node.width = _boxBounds.width;
24182 node.height = _boxBounds.height; // transformationLog[stateDef.id] = { y: conf.compositTitleSize };
24183 }
24184 } else {
24185 node = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawState)(diagram, stateDef, graph);
24186 }
24187
24188 if (stateDef.note) {
24189 // Draw note note
24190 var noteDef = {
24191 descriptions: [],
24192 id: stateDef.id + '-note',
24193 note: stateDef.note,
24194 type: 'note'
24195 };
24196 var note = (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawState)(diagram, noteDef, graph); // graph.setNode(node.id, node);
24197
24198 if (stateDef.note.position === 'left of') {
24199 graph.setNode(node.id + '-note', note);
24200 graph.setNode(node.id, node);
24201 } else {
24202 graph.setNode(node.id, node);
24203 graph.setNode(node.id + '-note', note);
24204 } // graph.setNode(node.id);
24205
24206
24207 graph.setParent(node.id, node.id + '-group');
24208 graph.setParent(node.id + '-note', node.id + '-group');
24209 } else {
24210 // Add nodes to the graph. The first argument is the node id. The second is
24211 // metadata about the node. In this case we're going to add labels to each of
24212 // our nodes.
24213 graph.setNode(node.id, node);
24214 }
24215 }
24216
24217 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Count=', graph.nodeCount(), graph);
24218 var cnt = 0;
24219 relations.forEach(function (relation) {
24220 cnt++;
24221 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Setting edge', relation);
24222 graph.setEdge(relation.id1, relation.id2, {
24223 relation: relation,
24224 width: getLabelWidth(relation.title),
24225 height: conf.labelHeight * _common_common__WEBPACK_IMPORTED_MODULE_9__["default"].getRows(relation.title).length,
24226 labelpos: 'c'
24227 }, 'id' + cnt);
24228 });
24229 dagre__WEBPACK_IMPORTED_MODULE_1___default().layout(graph);
24230 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Graph after layout', graph.nodes());
24231 var svgElem = diagram.node();
24232 graph.nodes().forEach(function (v) {
24233 if (typeof v !== 'undefined' && typeof graph.node(v) !== 'undefined') {
24234 _logger__WEBPACK_IMPORTED_MODULE_6__.log.warn('Node ' + v + ': ' + JSON.stringify(graph.node(v)));
24235 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + svgElem.id + ' #' + v).attr('transform', 'translate(' + (graph.node(v).x - graph.node(v).width / 2) + ',' + (graph.node(v).y + (transformationLog[v] ? transformationLog[v].y : 0) - graph.node(v).height / 2) + ' )');
24236 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + svgElem.id + ' #' + v).attr('data-x-shift', graph.node(v).x - graph.node(v).width / 2);
24237 var dividers = document.querySelectorAll('#' + svgElem.id + ' #' + v + ' .divider');
24238 dividers.forEach(function (divider) {
24239 var parent = divider.parentElement;
24240 var pWidth = 0;
24241 var pShift = 0;
24242
24243 if (parent) {
24244 if (parent.parentElement) pWidth = parent.parentElement.getBBox().width;
24245 pShift = parseInt(parent.getAttribute('data-x-shift'), 10);
24246
24247 if (Number.isNaN(pShift)) {
24248 pShift = 0;
24249 }
24250 }
24251
24252 divider.setAttribute('x1', 0 - pShift + 8);
24253 divider.setAttribute('x2', pWidth - pShift - 8);
24254 });
24255 } else {
24256 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('No Node ' + v + ': ' + JSON.stringify(graph.node(v)));
24257 }
24258 });
24259 var stateBox = svgElem.getBBox();
24260 graph.edges().forEach(function (e) {
24261 if (typeof e !== 'undefined' && typeof graph.edge(e) !== 'undefined') {
24262 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(graph.edge(e)));
24263 (0,_shapes__WEBPACK_IMPORTED_MODULE_8__.drawEdge)(diagram, graph.edge(e), graph.edge(e).relation);
24264 }
24265 });
24266 stateBox = svgElem.getBBox();
24267 var stateInfo = {
24268 id: parentId ? parentId : 'root',
24269 label: parentId ? parentId : 'root',
24270 width: 0,
24271 height: 0
24272 };
24273 stateInfo.width = stateBox.width + 2 * conf.padding;
24274 stateInfo.height = stateBox.height + 2 * conf.padding;
24275 _logger__WEBPACK_IMPORTED_MODULE_6__.log.debug('Doc rendered', stateInfo, graph);
24276 return stateInfo;
24277};
24278
24279/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
24280 setConf: setConf,
24281 draw: draw
24282});
24283
24284/***/ }),
24285
24286/***/ "./src/diagrams/state/styles.js":
24287/*!**************************************!*\
24288 !*** ./src/diagrams/state/styles.js ***!
24289 \**************************************/
24290/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24291
24292"use strict";
24293__webpack_require__.r(__webpack_exports__);
24294/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24295/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24296/* harmony export */ });
24297var getStyles = function getStyles(options) {
24298 return "\ndefs #statediagram-barbEnd {\n fill: ".concat(options.transitionColor, ";\n stroke: ").concat(options.transitionColor, ";\n }\ng.stateGroup text {\n fill: ").concat(options.nodeBorder, ";\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ").concat(options.textColor, ";\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ").concat(options.stateLabelColor, ";\n}\n\ng.stateGroup rect {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n}\n\ng.stateGroup line {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n\n.transition {\n stroke: ").concat(options.transitionColor, ";\n stroke-width: 1;\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ").concat(options.background, ";\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ").concat(options.noteBorderColor, ";\n fill: ").concat(options.noteBkgColor, ";\n\n text {\n fill: ").concat(options.noteTextColor, ";\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ").concat(options.mainBkg, ";\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ").concat(options.labelBackgroundColor, ";\n opacity: 0.5;\n}\n.edgeLabel .label text {\n fill: ").concat(options.transitionLabelColor || options.tertiaryTextColor, ";\n}\n.label div .edgeLabel {\n color: ").concat(options.transitionLabelColor || options.tertiaryTextColor, ";\n}\n\n.stateLabel text {\n fill: ").concat(options.stateLabelColor, ";\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ").concat(options.specialStateColor, ";\n stroke: ").concat(options.specialStateColor, ";\n}\n\n.node .fork-join {\n fill: ").concat(options.specialStateColor, ";\n stroke: ").concat(options.specialStateColor, ";\n}\n\n.node circle.state-end {\n fill: ").concat(options.innerEndBackground, ";\n stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ").concat(options.compositeBackground || options.background, ";\n // stroke: ").concat(options.background, ";\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ").concat(options.stateBkg || options.mainBkg, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n stroke-width: 1px;\n}\n.node polygon {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";;\n stroke-width: 1px;\n}\n#statediagram-barbEnd {\n fill: ").concat(options.lineColor, ";\n}\n\n.statediagram-cluster rect {\n fill: ").concat(options.compositeTitleBackground, ";\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n stroke-width: 1px;\n}\n\n.cluster-label, .nodeLabel {\n color: ").concat(options.stateLabelColor, ";\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ").concat(options.stateBorder || options.nodeBorder, ";\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ").concat(options.compositeBackground || options.background, ";\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ").concat(options.altBackground ? options.altBackground : '#efefef', ";\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ").concat(options.altBackground ? options.altBackground : '#efefef', ";\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ").concat(options.noteBkgColor, ";\n stroke: ").concat(options.noteBorderColor, ";\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ").concat(options.noteTextColor, ";\n}\n\n.statediagram-note .nodeLabel {\n color: ").concat(options.noteTextColor, ";\n}\n.statediagram .edgeLabel {\n color: red; // ").concat(options.noteTextColor, ";\n}\n\n#dependencyStart, #dependencyEnd {\n fill: ").concat(options.lineColor, ";\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1;\n}\n");
24299};
24300
24301/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
24302
24303/***/ }),
24304
24305/***/ "./src/diagrams/user-journey/journeyDb.js":
24306/*!************************************************!*\
24307 !*** ./src/diagrams/user-journey/journeyDb.js ***!
24308 \************************************************/
24309/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24310
24311"use strict";
24312__webpack_require__.r(__webpack_exports__);
24313/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24314/* harmony export */ "parseDirective": () => (/* binding */ parseDirective),
24315/* harmony export */ "clear": () => (/* binding */ clear),
24316/* harmony export */ "setTitle": () => (/* binding */ setTitle),
24317/* harmony export */ "getTitle": () => (/* binding */ getTitle),
24318/* harmony export */ "addSection": () => (/* binding */ addSection),
24319/* harmony export */ "getSections": () => (/* binding */ getSections),
24320/* harmony export */ "getTasks": () => (/* binding */ getTasks),
24321/* harmony export */ "addTask": () => (/* binding */ addTask),
24322/* harmony export */ "addTaskOrg": () => (/* binding */ addTaskOrg),
24323/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24324/* harmony export */ });
24325/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../mermaidAPI */ "./src/mermaidAPI.js");
24326/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../config */ "./src/config.js");
24327function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
24328
24329function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24330
24331function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
24332
24333function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
24334
24335function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
24336
24337function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24338
24339
24340
24341var title = '';
24342var currentSection = '';
24343var sections = [];
24344var tasks = [];
24345var rawTasks = [];
24346var parseDirective = function parseDirective(statement, context, type) {
24347 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parseDirective(this, statement, context, type);
24348};
24349var clear = function clear() {
24350 sections.length = 0;
24351 tasks.length = 0;
24352 currentSection = '';
24353 title = '';
24354 rawTasks.length = 0;
24355};
24356var setTitle = function setTitle(txt) {
24357 title = txt;
24358};
24359var getTitle = function getTitle() {
24360 return title;
24361};
24362var addSection = function addSection(txt) {
24363 currentSection = txt;
24364 sections.push(txt);
24365};
24366var getSections = function getSections() {
24367 return sections;
24368};
24369var getTasks = function getTasks() {
24370 var allItemsProcessed = compileTasks();
24371 var maxDepth = 100;
24372 var iterationCount = 0;
24373
24374 while (!allItemsProcessed && iterationCount < maxDepth) {
24375 allItemsProcessed = compileTasks();
24376 iterationCount++;
24377 }
24378
24379 tasks.push.apply(tasks, rawTasks);
24380 return tasks;
24381};
24382
24383var updateActors = function updateActors() {
24384 var tempActors = [];
24385 tasks.forEach(function (task) {
24386 if (task.people) {
24387 tempActors.push.apply(tempActors, _toConsumableArray(task.people));
24388 }
24389 });
24390 var unique = new Set(tempActors);
24391 return _toConsumableArray(unique).sort();
24392};
24393
24394var addTask = function addTask(descr, taskData) {
24395 var pieces = taskData.substr(1).split(':');
24396 var score = 0;
24397 var peeps = [];
24398
24399 if (pieces.length === 1) {
24400 score = Number(pieces[0]);
24401 peeps = [];
24402 } else {
24403 score = Number(pieces[0]);
24404 peeps = pieces[1].split(',');
24405 }
24406
24407 var peopleList = peeps.map(function (s) {
24408 return s.trim();
24409 });
24410 var rawTask = {
24411 section: currentSection,
24412 type: currentSection,
24413 people: peopleList,
24414 task: descr,
24415 score: score
24416 };
24417 rawTasks.push(rawTask);
24418};
24419var addTaskOrg = function addTaskOrg(descr) {
24420 var newTask = {
24421 section: currentSection,
24422 type: currentSection,
24423 description: descr,
24424 task: descr,
24425 classes: []
24426 };
24427 tasks.push(newTask);
24428};
24429
24430var compileTasks = function compileTasks() {
24431 var compileTask = function compileTask(pos) {
24432 return rawTasks[pos].processed;
24433 };
24434
24435 var allProcessed = true;
24436
24437 for (var i = 0; i < rawTasks.length; i++) {
24438 compileTask(i);
24439 allProcessed = allProcessed && rawTasks[i].processed;
24440 }
24441
24442 return allProcessed;
24443};
24444
24445var getActors = function getActors() {
24446 return updateActors();
24447};
24448
24449/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
24450 parseDirective: parseDirective,
24451 getConfig: function getConfig() {
24452 return _config__WEBPACK_IMPORTED_MODULE_1__.getConfig().journey;
24453 },
24454 clear: clear,
24455 setTitle: setTitle,
24456 getTitle: getTitle,
24457 addSection: addSection,
24458 getSections: getSections,
24459 getTasks: getTasks,
24460 addTask: addTask,
24461 addTaskOrg: addTaskOrg,
24462 getActors: getActors
24463});
24464
24465/***/ }),
24466
24467/***/ "./src/diagrams/user-journey/journeyRenderer.js":
24468/*!******************************************************!*\
24469 !*** ./src/diagrams/user-journey/journeyRenderer.js ***!
24470 \******************************************************/
24471/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24472
24473"use strict";
24474__webpack_require__.r(__webpack_exports__);
24475/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24476/* harmony export */ "setConf": () => (/* binding */ setConf),
24477/* harmony export */ "draw": () => (/* binding */ draw),
24478/* harmony export */ "bounds": () => (/* binding */ bounds),
24479/* harmony export */ "drawTasks": () => (/* binding */ drawTasks),
24480/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24481/* harmony export */ });
24482/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
24483/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
24484/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
24485/* harmony import */ var _parser_journey__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_parser_journey__WEBPACK_IMPORTED_MODULE_1__);
24486/* harmony import */ var _journeyDb__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
24487/* harmony import */ var _svgDraw__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./svgDraw */ "./src/diagrams/user-journey/svgDraw.js");
24488/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../config */ "./src/config.js");
24489/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../utils */ "./src/utils.js");
24490
24491
24492
24493
24494
24495
24496_parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy = _journeyDb__WEBPACK_IMPORTED_MODULE_2__["default"];
24497var setConf = function setConf(cnf) {
24498 var keys = Object.keys(cnf);
24499 keys.forEach(function (key) {
24500 conf[key] = cnf[key];
24501 });
24502};
24503var actors = {};
24504
24505function drawActorLegend(diagram) {
24506 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey; // Draw the actors
24507
24508 var yPos = 60;
24509 Object.keys(actors).forEach(function (person) {
24510 var colour = actors[person].color;
24511 var circleData = {
24512 cx: 20,
24513 cy: yPos,
24514 r: 7,
24515 fill: colour,
24516 stroke: '#000',
24517 pos: actors[person].position
24518 };
24519 _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawCircle(diagram, circleData);
24520 var labelData = {
24521 x: 40,
24522 y: yPos + 7,
24523 fill: '#666',
24524 text: person,
24525 textMargin: conf.boxTextMargin | 5
24526 };
24527 _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawText(diagram, labelData);
24528 yPos += 20;
24529 });
24530}
24531
24532var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
24533var LEFT_MARGIN = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey.leftMargin;
24534var draw = function draw(text, id) {
24535 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
24536 _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.clear();
24537 _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.parse(text + '\n');
24538 bounds.init();
24539 var diagram = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
24540 diagram.attr('xmlns:xlink', 'http://www.w3.org/1999/xlink');
24541 _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].initGraphics(diagram);
24542 var tasks = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTasks();
24543 var title = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getTitle();
24544 var actorNames = _parser_journey__WEBPACK_IMPORTED_MODULE_1__.parser.yy.getActors();
24545
24546 for (var member in actors) {
24547 delete actors[member];
24548 }
24549
24550 var actorPos = 0;
24551 actorNames.forEach(function (actorName) {
24552 actors[actorName] = {
24553 color: conf.actorColours[actorPos % conf.actorColours.length],
24554 position: actorPos
24555 };
24556 actorPos++;
24557 });
24558 drawActorLegend(diagram);
24559 bounds.insert(0, 0, LEFT_MARGIN, Object.keys(actors).length * 50);
24560 drawTasks(diagram, tasks, 0);
24561 var box = bounds.getBounds();
24562
24563 if (title) {
24564 diagram.append('text').text(title).attr('x', LEFT_MARGIN).attr('font-size', '4ex').attr('font-weight', 'bold').attr('y', 25);
24565 }
24566
24567 var height = box.stopy - box.starty + 2 * conf.diagramMarginY;
24568 var width = LEFT_MARGIN + box.stopx + 2 * conf.diagramMarginX;
24569 (0,_utils__WEBPACK_IMPORTED_MODULE_5__.configureSvgSize)(diagram, height, width, conf.useMaxWidth); // Draw activity line
24570
24571 diagram.append('line').attr('x1', LEFT_MARGIN).attr('y1', conf.height * 4) // One section head + one task + margins
24572 .attr('x2', width - LEFT_MARGIN - 4) // Subtract stroke width so arrow point is retained
24573 .attr('y2', conf.height * 4).attr('stroke-width', 4).attr('stroke', 'black').attr('marker-end', 'url(#arrowhead)');
24574 var extraVertForTitle = title ? 70 : 0;
24575 diagram.attr('viewBox', "".concat(box.startx, " -25 ").concat(width, " ").concat(height + extraVertForTitle));
24576 diagram.attr('preserveAspectRatio', 'xMinYMin meet');
24577 diagram.attr('height', height + extraVertForTitle + 25);
24578};
24579var bounds = {
24580 data: {
24581 startx: undefined,
24582 stopx: undefined,
24583 starty: undefined,
24584 stopy: undefined
24585 },
24586 verticalPos: 0,
24587 sequenceItems: [],
24588 init: function init() {
24589 this.sequenceItems = [];
24590 this.data = {
24591 startx: undefined,
24592 stopx: undefined,
24593 starty: undefined,
24594 stopy: undefined
24595 };
24596 this.verticalPos = 0;
24597 },
24598 updateVal: function updateVal(obj, key, val, fun) {
24599 if (typeof obj[key] === 'undefined') {
24600 obj[key] = val;
24601 } else {
24602 obj[key] = fun(val, obj[key]);
24603 }
24604 },
24605 updateBounds: function updateBounds(startx, starty, stopx, stopy) {
24606 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
24607
24608 var _self = this;
24609
24610 var cnt = 0;
24611
24612 function updateFn(type) {
24613 return function updateItemBounds(item) {
24614 cnt++; // The loop sequenceItems is a stack so the biggest margins in the beginning of the sequenceItems
24615
24616 var n = _self.sequenceItems.length - cnt + 1;
24617
24618 _self.updateVal(item, 'starty', starty - n * conf.boxMargin, Math.min);
24619
24620 _self.updateVal(item, 'stopy', stopy + n * conf.boxMargin, Math.max);
24621
24622 _self.updateVal(bounds.data, 'startx', startx - n * conf.boxMargin, Math.min);
24623
24624 _self.updateVal(bounds.data, 'stopx', stopx + n * conf.boxMargin, Math.max);
24625
24626 if (!(type === 'activation')) {
24627 _self.updateVal(item, 'startx', startx - n * conf.boxMargin, Math.min);
24628
24629 _self.updateVal(item, 'stopx', stopx + n * conf.boxMargin, Math.max);
24630
24631 _self.updateVal(bounds.data, 'starty', starty - n * conf.boxMargin, Math.min);
24632
24633 _self.updateVal(bounds.data, 'stopy', stopy + n * conf.boxMargin, Math.max);
24634 }
24635 };
24636 }
24637
24638 this.sequenceItems.forEach(updateFn());
24639 },
24640 insert: function insert(startx, starty, stopx, stopy) {
24641 var _startx = Math.min(startx, stopx);
24642
24643 var _stopx = Math.max(startx, stopx);
24644
24645 var _starty = Math.min(starty, stopy);
24646
24647 var _stopy = Math.max(starty, stopy);
24648
24649 this.updateVal(bounds.data, 'startx', _startx, Math.min);
24650 this.updateVal(bounds.data, 'starty', _starty, Math.min);
24651 this.updateVal(bounds.data, 'stopx', _stopx, Math.max);
24652 this.updateVal(bounds.data, 'stopy', _stopy, Math.max);
24653 this.updateBounds(_startx, _starty, _stopx, _stopy);
24654 },
24655 bumpVerticalPos: function bumpVerticalPos(bump) {
24656 this.verticalPos = this.verticalPos + bump;
24657 this.data.stopy = this.verticalPos;
24658 },
24659 getVerticalPos: function getVerticalPos() {
24660 return this.verticalPos;
24661 },
24662 getBounds: function getBounds() {
24663 return this.data;
24664 }
24665};
24666var fills = conf.sectionFills;
24667var textColours = conf.sectionColours;
24668var drawTasks = function drawTasks(diagram, tasks, verticalPos) {
24669 var conf = (0,_config__WEBPACK_IMPORTED_MODULE_3__.getConfig)().journey;
24670 var lastSection = '';
24671 var sectionVHeight = conf.height * 2 + conf.diagramMarginY;
24672 var taskPos = verticalPos + sectionVHeight;
24673 var sectionNumber = 0;
24674 var fill = '#CCC';
24675 var colour = 'black';
24676 var num = 0; // Draw the tasks
24677
24678 for (var i = 0; i < tasks.length; i++) {
24679 var task = tasks[i];
24680
24681 if (lastSection !== task.section) {
24682 fill = fills[sectionNumber % fills.length];
24683 num = sectionNumber % fills.length;
24684 colour = textColours[sectionNumber % textColours.length];
24685 var section = {
24686 x: i * conf.taskMargin + i * conf.width + LEFT_MARGIN,
24687 y: 50,
24688 text: task.section,
24689 fill: fill,
24690 num: num,
24691 colour: colour
24692 };
24693 _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawSection(diagram, section, conf);
24694 lastSection = task.section;
24695 sectionNumber++;
24696 } // Collect the actors involved in the task
24697
24698
24699 var taskActors = task.people.reduce(function (acc, actorName) {
24700 if (actors[actorName]) {
24701 acc[actorName] = actors[actorName];
24702 }
24703
24704 return acc;
24705 }, {}); // Add some rendering data to the object
24706
24707 task.x = i * conf.taskMargin + i * conf.width + LEFT_MARGIN;
24708 task.y = taskPos;
24709 task.width = conf.diagramMarginX;
24710 task.height = conf.diagramMarginY;
24711 task.colour = colour;
24712 task.fill = fill;
24713 task.num = num;
24714 task.actors = taskActors; // Draw the box with the attached line
24715
24716 _svgDraw__WEBPACK_IMPORTED_MODULE_4__["default"].drawTask(diagram, task, conf);
24717 bounds.insert(task.x, task.y, task.x + task.width + conf.taskMargin, 300 + 5 * 30); // stopy is the length of the descenders.
24718 }
24719};
24720/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
24721 setConf: setConf,
24722 draw: draw
24723});
24724
24725/***/ }),
24726
24727/***/ "./src/diagrams/user-journey/styles.js":
24728/*!*********************************************!*\
24729 !*** ./src/diagrams/user-journey/styles.js ***!
24730 \*********************************************/
24731/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24732
24733"use strict";
24734__webpack_require__.r(__webpack_exports__);
24735/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24736/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24737/* harmony export */ });
24738var getStyles = function getStyles(options) {
24739 return ".label {\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n color: ".concat(options.textColor, ";\n }\n .mouth {\n stroke: #666;\n }\n\n line {\n stroke: ").concat(options.textColor, "\n }\n\n .legend {\n fill: ").concat(options.textColor, ";\n }\n\n .label text {\n fill: #333;\n }\n .label {\n color: ").concat(options.textColor, "\n }\n\n .face {\n ").concat(options.faceColor ? "fill: ".concat(options.faceColor) : 'fill: #FFF8DC', ";\n stroke: #999;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ").concat(options.mainBkg, ";\n stroke: ").concat(options.nodeBorder, ";\n stroke-width: 1px;\n }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ").concat(options.arrowheadColor, ";\n }\n\n .edgePath .path {\n stroke: ").concat(options.lineColor, ";\n stroke-width: 1.5px;\n }\n\n .flowchart-link {\n stroke: ").concat(options.lineColor, ";\n fill: none;\n }\n\n .edgeLabel {\n background-color: ").concat(options.edgeLabelBackground, ";\n rect {\n opacity: 0.5;\n }\n text-align: center;\n }\n\n .cluster rect {\n }\n\n .cluster text {\n fill: ").concat(options.titleColor, ";\n }\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n font-size: 12px;\n background: ").concat(options.tertiaryColor, ";\n border: 1px solid ").concat(options.border2, ";\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .task-type-0, .section-type-0 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType0) : '', ";\n }\n .task-type-1, .section-type-1 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType1) : '', ";\n }\n .task-type-2, .section-type-2 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType2) : '', ";\n }\n .task-type-3, .section-type-3 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType3) : '', ";\n }\n .task-type-4, .section-type-4 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType4) : '', ";\n }\n .task-type-5, .section-type-5 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType5) : '', ";\n }\n .task-type-6, .section-type-6 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType6) : '', ";\n }\n .task-type-7, .section-type-7 {\n ").concat(options.fillType0 ? "fill: ".concat(options.fillType7) : '', ";\n }\n\n .actor-0 {\n ").concat(options.actor0 ? "fill: ".concat(options.actor0) : '', ";\n }\n .actor-1 {\n ").concat(options.actor1 ? "fill: ".concat(options.actor1) : '', ";\n }\n .actor-2 {\n ").concat(options.actor2 ? "fill: ".concat(options.actor2) : '', ";\n }\n .actor-3 {\n ").concat(options.actor3 ? "fill: ".concat(options.actor3) : '', ";\n }\n .actor-4 {\n ").concat(options.actor4 ? "fill: ".concat(options.actor4) : '', ";\n }\n .actor-5 {\n ").concat(options.actor5 ? "fill: ".concat(options.actor5) : '', ";\n }\n\n }\n");
24740};
24741
24742/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
24743
24744/***/ }),
24745
24746/***/ "./src/diagrams/user-journey/svgDraw.js":
24747/*!**********************************************!*\
24748 !*** ./src/diagrams/user-journey/svgDraw.js ***!
24749 \**********************************************/
24750/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
24751
24752"use strict";
24753__webpack_require__.r(__webpack_exports__);
24754/* harmony export */ __webpack_require__.d(__webpack_exports__, {
24755/* harmony export */ "drawRect": () => (/* binding */ drawRect),
24756/* harmony export */ "drawFace": () => (/* binding */ drawFace),
24757/* harmony export */ "drawCircle": () => (/* binding */ drawCircle),
24758/* harmony export */ "drawText": () => (/* binding */ drawText),
24759/* harmony export */ "drawLabel": () => (/* binding */ drawLabel),
24760/* harmony export */ "drawSection": () => (/* binding */ drawSection),
24761/* harmony export */ "drawTask": () => (/* binding */ drawTask),
24762/* harmony export */ "drawBackgroundRect": () => (/* binding */ drawBackgroundRect),
24763/* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
24764/* harmony export */ "getNoteRect": () => (/* binding */ getNoteRect),
24765/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
24766/* harmony export */ });
24767/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
24768/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
24769
24770var drawRect = function drawRect(elem, rectData) {
24771 var rectElem = elem.append('rect');
24772 rectElem.attr('x', rectData.x);
24773 rectElem.attr('y', rectData.y);
24774 rectElem.attr('fill', rectData.fill);
24775 rectElem.attr('stroke', rectData.stroke);
24776 rectElem.attr('width', rectData.width);
24777 rectElem.attr('height', rectData.height);
24778 rectElem.attr('rx', rectData.rx);
24779 rectElem.attr('ry', rectData.ry);
24780
24781 if (typeof rectData.class !== 'undefined') {
24782 rectElem.attr('class', rectData.class);
24783 }
24784
24785 return rectElem;
24786};
24787var drawFace = function drawFace(element, faceData) {
24788 var radius = 15;
24789 var 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');
24790 var face = element.append('g'); //left eye
24791
24792 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'); //right eye
24793
24794 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');
24795
24796 function smile(face) {
24797 var arc = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
24798
24799 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 2) + ')');
24800 }
24801
24802 function sad(face) {
24803 var arc = (0,d3__WEBPACK_IMPORTED_MODULE_0__.arc)().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(radius / 2).outerRadius(radius / 2.2); //mouth
24804
24805 face.append('path').attr('class', 'mouth').attr('d', arc).attr('transform', 'translate(' + faceData.cx + ',' + (faceData.cy + 7) + ')');
24806 }
24807
24808 function ambivalent(face) {
24809 face.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');
24810 }
24811
24812 if (faceData.score > 3) {
24813 smile(face);
24814 } else if (faceData.score < 3) {
24815 sad(face);
24816 } else {
24817 ambivalent(face);
24818 }
24819
24820 return circleElement;
24821};
24822var drawCircle = function drawCircle(element, circleData) {
24823 var circleElement = element.append('circle');
24824 circleElement.attr('cx', circleData.cx);
24825 circleElement.attr('cy', circleData.cy);
24826 circleElement.attr('class', 'actor-' + circleData.pos);
24827 circleElement.attr('fill', circleData.fill);
24828 circleElement.attr('stroke', circleData.stroke);
24829 circleElement.attr('r', circleData.r);
24830
24831 if (typeof circleElement.class !== 'undefined') {
24832 circleElement.attr('class', circleElement.class);
24833 }
24834
24835 if (typeof circleData.title !== 'undefined') {
24836 circleElement.append('title').text(circleData.title);
24837 }
24838
24839 return circleElement;
24840};
24841var drawText = function drawText(elem, textData) {
24842 // Remove and ignore br:s
24843 var nText = textData.text.replace(/<br\s*\/?>/gi, ' ');
24844 var textElem = elem.append('text');
24845 textElem.attr('x', textData.x);
24846 textElem.attr('y', textData.y);
24847 textElem.attr('class', 'legend');
24848 textElem.style('text-anchor', textData.anchor);
24849
24850 if (typeof textData.class !== 'undefined') {
24851 textElem.attr('class', textData.class);
24852 }
24853
24854 var span = textElem.append('tspan');
24855 span.attr('x', textData.x + textData.textMargin * 2);
24856 span.text(nText);
24857 return textElem;
24858};
24859var drawLabel = function drawLabel(elem, txtObject) {
24860 function genPoints(x, y, width, height, cut) {
24861 return x + ',' + y + ' ' + (x + width) + ',' + y + ' ' + (x + width) + ',' + (y + height - cut) + ' ' + (x + width - cut * 1.2) + ',' + (y + height) + ' ' + x + ',' + (y + height);
24862 }
24863
24864 var polygon = elem.append('polygon');
24865 polygon.attr('points', genPoints(txtObject.x, txtObject.y, 50, 20, 7));
24866 polygon.attr('class', 'labelBox');
24867 txtObject.y = txtObject.y + txtObject.labelMargin;
24868 txtObject.x = txtObject.x + 0.5 * txtObject.labelMargin;
24869 drawText(elem, txtObject);
24870};
24871var drawSection = function drawSection(elem, section, conf) {
24872 var g = elem.append('g');
24873 var rect = getNoteRect();
24874 rect.x = section.x;
24875 rect.y = section.y;
24876 rect.fill = section.fill;
24877 rect.width = conf.width;
24878 rect.height = conf.height;
24879 rect.class = 'journey-section section-type-' + section.num;
24880 rect.rx = 3;
24881 rect.ry = 3;
24882 drawRect(g, rect);
24883
24884 _drawTextCandidateFunc(conf)(section.text, g, rect.x, rect.y, rect.width, rect.height, {
24885 class: 'journey-section section-type-' + section.num
24886 }, conf, section.colour);
24887};
24888var taskCount = -1;
24889/**
24890 * Draws an actor in the diagram with the attaced line
24891 * @param elem The HTML element
24892 * @param task The task to render
24893 * @param conf The global configuration
24894 */
24895
24896var drawTask = function drawTask(elem, task, conf) {
24897 var center = task.x + conf.width / 2;
24898 var g = elem.append('g');
24899 taskCount++;
24900 var maxHeight = 300 + 5 * 30;
24901 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');
24902 drawFace(g, {
24903 cx: center,
24904 cy: 300 + (5 - task.score) * 30,
24905 score: task.score
24906 });
24907 var rect = getNoteRect();
24908 rect.x = task.x;
24909 rect.y = task.y;
24910 rect.fill = task.fill;
24911 rect.width = conf.width;
24912 rect.height = conf.height;
24913 rect.class = 'task task-type-' + task.num;
24914 rect.rx = 3;
24915 rect.ry = 3;
24916 drawRect(g, rect);
24917 var xPos = task.x + 14;
24918 task.people.forEach(function (person) {
24919 var colour = task.actors[person].color;
24920 var circle = {
24921 cx: xPos,
24922 cy: task.y,
24923 r: 7,
24924 fill: colour,
24925 stroke: '#000',
24926 title: person,
24927 pos: task.actors[person].position
24928 };
24929 drawCircle(g, circle);
24930 xPos += 10;
24931 });
24932
24933 _drawTextCandidateFunc(conf)(task.task, g, rect.x, rect.y, rect.width, rect.height, {
24934 class: 'task'
24935 }, conf, task.colour);
24936};
24937/**
24938 * Draws a background rectangle
24939 * @param elem The html element
24940 * @param bounds The bounds of the drawing
24941 */
24942
24943var drawBackgroundRect = function drawBackgroundRect(elem, bounds) {
24944 var rectElem = drawRect(elem, {
24945 x: bounds.startx,
24946 y: bounds.starty,
24947 width: bounds.stopx - bounds.startx,
24948 height: bounds.stopy - bounds.starty,
24949 fill: bounds.fill,
24950 class: 'rect'
24951 });
24952 rectElem.lower();
24953};
24954var getTextObj = function getTextObj() {
24955 return {
24956 x: 0,
24957 y: 0,
24958 fill: undefined,
24959 'text-anchor': 'start',
24960 width: 100,
24961 height: 100,
24962 textMargin: 0,
24963 rx: 0,
24964 ry: 0
24965 };
24966};
24967var getNoteRect = function getNoteRect() {
24968 return {
24969 x: 0,
24970 y: 0,
24971 width: 100,
24972 anchor: 'start',
24973 height: 100,
24974 rx: 0,
24975 ry: 0
24976 };
24977};
24978
24979var _drawTextCandidateFunc = function () {
24980 function byText(content, g, x, y, width, height, textAttrs, colour) {
24981 var 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);
24982
24983 _setTextAttrs(text, textAttrs);
24984 }
24985
24986 function byTspan(content, g, x, y, width, height, textAttrs, conf, colour) {
24987 var taskFontSize = conf.taskFontSize,
24988 taskFontFamily = conf.taskFontFamily;
24989 var lines = content.split(/<br\s*\/?>/gi);
24990
24991 for (var i = 0; i < lines.length; i++) {
24992 var dy = i * taskFontSize - taskFontSize * (lines.length - 1) / 2;
24993 var 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);
24994 text.append('tspan').attr('x', x + width / 2).attr('dy', dy).text(lines[i]);
24995 text.attr('y', y + height / 2.0).attr('dominant-baseline', 'central').attr('alignment-baseline', 'central');
24996
24997 _setTextAttrs(text, textAttrs);
24998 }
24999 }
25000
25001 function byFo(content, g, x, y, width, height, textAttrs, conf) {
25002 var body = g.append('switch');
25003 var f = body.append('foreignObject').attr('x', x).attr('y', y).attr('width', width).attr('height', height).attr('position', 'fixed');
25004 var text = f.append('xhtml:div').style('display', 'table').style('height', '100%').style('width', '100%');
25005 text.append('div').attr('class', 'label').style('display', 'table-cell').style('text-align', 'center').style('vertical-align', 'middle') // .style('color', colour)
25006 .text(content);
25007 byTspan(content, body, x, y, width, height, textAttrs, conf);
25008
25009 _setTextAttrs(text, textAttrs);
25010 }
25011
25012 function _setTextAttrs(toText, fromTextAttrsDict) {
25013 for (var key in fromTextAttrsDict) {
25014 if (key in fromTextAttrsDict) {
25015 // eslint-disable-line
25016 // noinspection JSUnfilteredForInLoop
25017 toText.attr(key, fromTextAttrsDict[key]);
25018 }
25019 }
25020 }
25021
25022 return function (conf) {
25023 return conf.textPlacement === 'fo' ? byFo : conf.textPlacement === 'old' ? byText : byTspan;
25024 };
25025}();
25026
25027var initGraphics = function initGraphics(graphics) {
25028 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'); // this is actual shape for arrowhead
25029};
25030
25031/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
25032 drawRect: drawRect,
25033 drawCircle: drawCircle,
25034 drawSection: drawSection,
25035 drawText: drawText,
25036 drawLabel: drawLabel,
25037 drawTask: drawTask,
25038 drawBackgroundRect: drawBackgroundRect,
25039 getTextObj: getTextObj,
25040 getNoteRect: getNoteRect,
25041 initGraphics: initGraphics
25042});
25043
25044/***/ }),
25045
25046/***/ "./src/errorRenderer.js":
25047/*!******************************!*\
25048 !*** ./src/errorRenderer.js ***!
25049 \******************************/
25050/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25051
25052"use strict";
25053__webpack_require__.r(__webpack_exports__);
25054/* harmony export */ __webpack_require__.d(__webpack_exports__, {
25055/* harmony export */ "setConf": () => (/* binding */ setConf),
25056/* harmony export */ "draw": () => (/* binding */ draw),
25057/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25058/* harmony export */ });
25059/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
25060/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
25061/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
25062/**
25063 * Created by knut on 14-12-11.
25064 */
25065
25066
25067var conf = {};
25068/**
25069 * Merges the value of `conf` with the passed `cnf`
25070 * @param {Object} cnf Config to merge
25071 */
25072
25073var setConf = function setConf(cnf) {
25074 var keys = Object.keys(cnf);
25075 keys.forEach(function (key) {
25076 conf[key] = cnf[key];
25077 });
25078};
25079/**
25080 * Draws a an info picture in the tag with id: id based on the graph definition in text.
25081 * @param id The text for the error
25082 * @param ver The version
25083 */
25084
25085var draw = function draw(id, ver) {
25086 try {
25087 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Renering svg for syntax error\n');
25088 var svg = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#' + id);
25089 var g = svg.append('g');
25090 g.append('path').attr('class', 'error-icon').attr('d', 'm411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z');
25091 g.append('path').attr('class', 'error-icon').attr('d', 'm459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z');
25092 g.append('path').attr('class', 'error-icon').attr('d', 'm340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z');
25093 g.append('path').attr('class', 'error-icon').attr('d', 'm400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z');
25094 g.append('path').attr('class', 'error-icon').attr('d', 'm496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z');
25095 g.append('path').attr('class', 'error-icon').attr('d', 'm436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z');
25096 g.append('text') // text label for the x axis
25097 .attr('class', 'error-text').attr('x', 1240).attr('y', 250).attr('font-size', '150px').style('text-anchor', 'middle').text('Syntax error in graph');
25098 g.append('text') // text label for the x axis
25099 .attr('class', 'error-text').attr('x', 1050).attr('y', 400).attr('font-size', '100px').style('text-anchor', 'middle').text('mermaid version ' + ver);
25100 svg.attr('height', 100);
25101 svg.attr('width', 400);
25102 svg.attr('viewBox', '768 0 512 512');
25103 } catch (e) {
25104 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error('Error while rendering info diagram');
25105 _logger__WEBPACK_IMPORTED_MODULE_1__.log.error(e.message);
25106 }
25107};
25108/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
25109 setConf: setConf,
25110 draw: draw
25111});
25112
25113/***/ }),
25114
25115/***/ "./src/interactionDb.js":
25116/*!******************************!*\
25117 !*** ./src/interactionDb.js ***!
25118 \******************************/
25119/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25120
25121"use strict";
25122__webpack_require__.r(__webpack_exports__);
25123/* harmony export */ __webpack_require__.d(__webpack_exports__, {
25124/* harmony export */ "addFunction": () => (/* binding */ addFunction),
25125/* harmony export */ "attachFunctions": () => (/* binding */ attachFunctions)
25126/* harmony export */ });
25127var interactionFunctions = [];
25128var addFunction = function addFunction(func) {
25129 interactionFunctions.push(func);
25130};
25131var attachFunctions = function attachFunctions() {
25132 interactionFunctions.forEach(function (f) {
25133 f();
25134 });
25135 interactionFunctions = [];
25136};
25137
25138/***/ }),
25139
25140/***/ "./src/logger.js":
25141/*!***********************!*\
25142 !*** ./src/logger.js ***!
25143 \***********************/
25144/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25145
25146"use strict";
25147__webpack_require__.r(__webpack_exports__);
25148/* harmony export */ __webpack_require__.d(__webpack_exports__, {
25149/* harmony export */ "LEVELS": () => (/* binding */ LEVELS),
25150/* harmony export */ "log": () => (/* binding */ log),
25151/* harmony export */ "setLogLevel": () => (/* binding */ setLogLevel)
25152/* harmony export */ });
25153/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! moment-mini */ "moment-mini");
25154/* harmony import */ var moment_mini__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(moment_mini__WEBPACK_IMPORTED_MODULE_0__);
25155
25156/**
25157 * @typedef {"debug" | "info" | "warn" | "error" | "fatal"} LogLevel A log level
25158 */
25159
25160/**
25161 * @type {Object<LogLevel, number>}
25162 */
25163
25164var LEVELS = {
25165 debug: 1,
25166 info: 2,
25167 warn: 3,
25168 error: 4,
25169 fatal: 5
25170};
25171var log = {
25172 debug: function debug() {},
25173 info: function info() {},
25174 warn: function warn() {},
25175 error: function error() {},
25176 fatal: function fatal() {}
25177};
25178/**
25179 * Sets a log level
25180 * @param {LogLevel} [level="fatal"] The level to set the logging to
25181 */
25182
25183var setLogLevel = function setLogLevel() {
25184 var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'fatal';
25185
25186 if (isNaN(level)) {
25187 level = level.toLowerCase();
25188
25189 if (LEVELS[level] !== undefined) {
25190 level = LEVELS[level];
25191 }
25192 }
25193
25194 log.trace = function () {};
25195
25196 log.debug = function () {};
25197
25198 log.info = function () {};
25199
25200 log.warn = function () {};
25201
25202 log.error = function () {};
25203
25204 log.fatal = function () {};
25205
25206 if (level <= LEVELS.fatal) {
25207 log.fatal = console.error ? console.error.bind(console, format('FATAL'), 'color: orange') : console.log.bind(console, '\x1b[35m', format('FATAL'));
25208 }
25209
25210 if (level <= LEVELS.error) {
25211 log.error = console.error ? console.error.bind(console, format('ERROR'), 'color: orange') : console.log.bind(console, '\x1b[31m', format('ERROR'));
25212 }
25213
25214 if (level <= LEVELS.warn) {
25215 log.warn = console.warn ? console.warn.bind(console, format('WARN'), 'color: orange') : console.log.bind(console, "\x1B[33m", format('WARN'));
25216 }
25217
25218 if (level <= LEVELS.info) {
25219 log.info = console.info // ? console.info.bind(console, '\x1b[34m', format('INFO'), 'color: blue')
25220 ? console.info.bind(console, format('INFO'), 'color: lightblue') : console.log.bind(console, '\x1b[34m', format('INFO'));
25221 }
25222
25223 if (level <= LEVELS.debug) {
25224 log.debug = console.debug ? console.debug.bind(console, format('DEBUG'), 'color: lightgreen') : console.log.bind(console, '\x1b[32m', format('DEBUG'));
25225 }
25226};
25227/**
25228 * Returns a format with the timestamp and the log level
25229 * @param {LogLevel} level The level for the log format
25230 * @returns {string} The format with the timestamp and log level
25231 */
25232
25233var format = function format(level) {
25234 var time = moment_mini__WEBPACK_IMPORTED_MODULE_0___default()().format('ss.SSS');
25235 return "%c".concat(time, " : ").concat(level, " : ");
25236};
25237
25238/***/ }),
25239
25240/***/ "./src/mermaid.js":
25241/*!************************!*\
25242 !*** ./src/mermaid.js ***!
25243 \************************/
25244/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25245
25246"use strict";
25247__webpack_require__.r(__webpack_exports__);
25248/* harmony export */ __webpack_require__.d(__webpack_exports__, {
25249/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25250/* harmony export */ });
25251/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
25252/* harmony import */ var _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mermaidAPI */ "./src/mermaidAPI.js");
25253/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
25254/**
25255 * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid functionality and to render
25256 * the diagrams to svg code.
25257 */
25258
25259
25260
25261/**
25262 * ## init
25263 * Function that goes through the document to find the chart definitions in there and render them.
25264 *
25265 * The function tags the processed attributes with the attribute data-processed and ignores found elements with the
25266 * attribute already set. This way the init function can be triggered several times.
25267 *
25268 * Optionally, `init` can accept in the second argument one of the following:
25269 * - a DOM Node
25270 * - an array of DOM nodes (as would come from a jQuery selector)
25271 * - a W3C selector, a la `.mermaid`
25272 *
25273 * ```mermaid
25274 * graph LR;
25275 * a(Find elements)-->b{Processed}
25276 * b-->|Yes|c(Leave element)
25277 * b-->|No |d(Transform)
25278 * ```
25279 * Renders the mermaid diagrams
25280 * @param nodes a css selector or an array of nodes
25281 */
25282
25283var init = function init() {
25284 var _this = this;
25285
25286 var conf = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig(); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
25287
25288 var nodes;
25289
25290 if (arguments.length >= 2) {
25291 /*! sequence config was passed as #1 */
25292 if (typeof arguments[0] !== 'undefined') {
25293 mermaid.sequenceConfig = arguments[0];
25294 }
25295
25296 nodes = arguments[1];
25297 } else {
25298 nodes = arguments[0];
25299 } // if last argument is a function this is the callback function
25300
25301
25302 var callback;
25303
25304 if (typeof arguments[arguments.length - 1] === 'function') {
25305 callback = arguments[arguments.length - 1];
25306 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Callback function found');
25307 } else {
25308 if (typeof conf.mermaid !== 'undefined') {
25309 if (typeof conf.mermaid.callback === 'function') {
25310 callback = conf.mermaid.callback;
25311 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Callback function found');
25312 } else {
25313 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('No Callback function found');
25314 }
25315 }
25316 }
25317
25318 nodes = nodes === undefined ? document.querySelectorAll('.mermaid') : typeof nodes === 'string' ? document.querySelectorAll(nodes) : nodes instanceof window.Node ? [nodes] : nodes; // Last case - sequence config was passed pick next
25319
25320 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Start On Load before: ' + mermaid.startOnLoad);
25321
25322 if (typeof mermaid.startOnLoad !== 'undefined') {
25323 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Start On Load inner: ' + mermaid.startOnLoad);
25324 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].updateSiteConfig({
25325 startOnLoad: mermaid.startOnLoad
25326 });
25327 }
25328
25329 if (typeof mermaid.ganttConfig !== 'undefined') {
25330 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].updateSiteConfig({
25331 gantt: mermaid.ganttConfig
25332 });
25333 }
25334
25335 var idGeneratior = new _utils__WEBPACK_IMPORTED_MODULE_2__["default"].initIdGeneratior(conf.deterministicIds, conf.deterministicIDSeed);
25336 var txt;
25337
25338 var _loop = function _loop(i) {
25339 var element = nodes[i];
25340 /*! Check if previously processed */
25341
25342 if (!element.getAttribute('data-processed')) {
25343 element.setAttribute('data-processed', true);
25344 } else {
25345 return "continue";
25346 }
25347
25348 var id = "mermaid-".concat(idGeneratior.next()); // Fetch the graph definition including tags
25349
25350 txt = element.innerHTML; // transforms the html to pure text
25351
25352 txt = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].entityDecode(txt).trim().replace(/<br\s*\/?>/gi, '<br/>');
25353 var init = _utils__WEBPACK_IMPORTED_MODULE_2__["default"].detectInit(txt);
25354
25355 if (init) {
25356 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('Detected early reinit: ', init);
25357 }
25358
25359 try {
25360 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].render(id, txt, function (svgCode, bindFunctions) {
25361 element.innerHTML = svgCode;
25362
25363 if (typeof callback !== 'undefined') {
25364 callback(id);
25365 }
25366
25367 if (bindFunctions) bindFunctions(element);
25368 }, element);
25369 } catch (e) {
25370 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn('Syntax Error rendering');
25371 _logger__WEBPACK_IMPORTED_MODULE_1__.log.warn(e);
25372
25373 if (_this.parseError) {
25374 _this.parseError(e);
25375 }
25376 }
25377 };
25378
25379 for (var i = 0; i < nodes.length; i++) {
25380 var _ret = _loop(i);
25381
25382 if (_ret === "continue") continue;
25383 }
25384};
25385
25386var initialize = function initialize(config) {
25387 // mermaidAPI.reset();
25388 if (typeof config.mermaid !== 'undefined') {
25389 if (typeof config.mermaid.startOnLoad !== 'undefined') {
25390 mermaid.startOnLoad = config.mermaid.startOnLoad;
25391 }
25392
25393 if (typeof config.mermaid.htmlLabels !== 'undefined') {
25394 mermaid.htmlLabels = config.mermaid.htmlLabels === 'false' || config.mermaid.htmlLabels === false ? false : true;
25395 }
25396 }
25397
25398 _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].initialize(config); // mermaidAPI.reset();
25399};
25400/**
25401 * ##contentLoaded
25402 * Callback function that is called when page is loaded. This functions fetches configuration for mermaid rendering and
25403 * calls init for rendering the mermaid diagrams on the page.
25404 */
25405
25406
25407var contentLoaded = function contentLoaded() {
25408 var config;
25409
25410 if (mermaid.startOnLoad) {
25411 // No config found, do check API config
25412 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig();
25413
25414 if (config.startOnLoad) {
25415 mermaid.init();
25416 }
25417 } else {
25418 if (typeof mermaid.startOnLoad === 'undefined') {
25419 _logger__WEBPACK_IMPORTED_MODULE_1__.log.debug('In start, no config');
25420 config = _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].getConfig();
25421
25422 if (config.startOnLoad) {
25423 mermaid.init();
25424 }
25425 }
25426 }
25427};
25428
25429if (typeof document !== 'undefined') {
25430 /*!
25431 * Wait for document loaded before starting the execution
25432 */
25433 window.addEventListener('load', function () {
25434 contentLoaded();
25435 }, false);
25436}
25437
25438var mermaid = {
25439 startOnLoad: true,
25440 htmlLabels: true,
25441 mermaidAPI: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"],
25442 parse: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].parse,
25443 render: _mermaidAPI__WEBPACK_IMPORTED_MODULE_0__["default"].render,
25444 init: init,
25445 initialize: initialize,
25446 contentLoaded: contentLoaded
25447};
25448/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaid);
25449
25450/***/ }),
25451
25452/***/ "./src/mermaidAPI.js":
25453/*!***************************!*\
25454 !*** ./src/mermaidAPI.js ***!
25455 \***************************/
25456/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
25457
25458"use strict";
25459__webpack_require__.r(__webpack_exports__);
25460/* harmony export */ __webpack_require__.d(__webpack_exports__, {
25461/* harmony export */ "encodeEntities": () => (/* binding */ encodeEntities),
25462/* harmony export */ "decodeEntities": () => (/* binding */ decodeEntities),
25463/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
25464/* harmony export */ });
25465/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! d3 */ "d3");
25466/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_0__);
25467/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! stylis */ "stylis");
25468/* harmony import */ var stylis__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(stylis__WEBPACK_IMPORTED_MODULE_1__);
25469/* harmony import */ var _package_json__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../package.json */ "./package.json");
25470/* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./config */ "./src/config.js");
25471/* harmony import */ var _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./diagrams/class/classDb */ "./src/diagrams/class/classDb.js");
25472/* harmony import */ var _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./diagrams/class/classRenderer */ "./src/diagrams/class/classRenderer.js");
25473/* harmony import */ var _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./diagrams/class/classRenderer-v2 */ "./src/diagrams/class/classRenderer-v2.js");
25474/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./diagrams/class/parser/classDiagram */ "./src/diagrams/class/parser/classDiagram.jison");
25475/* harmony import */ var _diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13__);
25476/* harmony import */ var _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./diagrams/er/erDb */ "./src/diagrams/er/erDb.js");
25477/* harmony import */ var _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./diagrams/er/erRenderer */ "./src/diagrams/er/erRenderer.js");
25478/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./diagrams/er/parser/erDiagram */ "./src/diagrams/er/parser/erDiagram.jison");
25479/* harmony import */ var _diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21__);
25480/* harmony import */ var _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/flowchart/flowDb */ "./src/diagrams/flowchart/flowDb.js");
25481/* harmony import */ var _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer */ "./src/diagrams/flowchart/flowRenderer.js");
25482/* harmony import */ var _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./diagrams/flowchart/flowRenderer-v2 */ "./src/diagrams/flowchart/flowRenderer-v2.js");
25483/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/flowchart/parser/flow */ "./src/diagrams/flowchart/parser/flow.jison");
25484/* harmony import */ var _diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8__);
25485/* harmony import */ var _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./diagrams/gantt/ganttDb */ "./src/diagrams/gantt/ganttDb.js");
25486/* harmony import */ var _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./diagrams/gantt/ganttRenderer */ "./src/diagrams/gantt/ganttRenderer.js");
25487/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./diagrams/gantt/parser/gantt */ "./src/diagrams/gantt/parser/gantt.jison");
25488/* harmony import */ var _diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11__);
25489/* harmony import */ var _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/git/gitGraphAst */ "./src/diagrams/git/gitGraphAst.js");
25490/* harmony import */ var _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./diagrams/git/gitGraphRenderer */ "./src/diagrams/git/gitGraphRenderer.js");
25491/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/parser/gitGraph */ "./src/diagrams/git/parser/gitGraph.jison");
25492/* harmony import */ var _diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5__);
25493/* harmony import */ var _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./diagrams/info/infoDb */ "./src/diagrams/info/infoDb.js");
25494/* harmony import */ var _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./diagrams/info/infoRenderer */ "./src/diagrams/info/infoRenderer.js");
25495/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./diagrams/info/parser/info */ "./src/diagrams/info/parser/info.jison");
25496/* harmony import */ var _diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17__);
25497/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./diagrams/pie/parser/pie */ "./src/diagrams/pie/parser/pie.jison");
25498/* harmony import */ var _diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19__);
25499/* harmony import */ var _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./diagrams/pie/pieDb */ "./src/diagrams/pie/pieDb.js");
25500/* harmony import */ var _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./diagrams/pie/pieRenderer */ "./src/diagrams/pie/pieRenderer.js");
25501/* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./diagrams/requirement/parser/requirementDiagram */ "./src/diagrams/requirement/parser/requirementDiagram.jison");
25502/* harmony import */ var _diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25__);
25503/* harmony import */ var _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./diagrams/requirement/requirementDb */ "./src/diagrams/requirement/requirementDb.js");
25504/* harmony import */ var _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./diagrams/requirement/requirementRenderer */ "./src/diagrams/requirement/requirementRenderer.js");
25505/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/sequence/parser/sequenceDiagram */ "./src/diagrams/sequence/parser/sequenceDiagram.jison");
25506/* harmony import */ var _diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9__);
25507/* harmony import */ var _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/sequence/sequenceDb */ "./src/diagrams/sequence/sequenceDb.js");
25508/* harmony import */ var _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./diagrams/sequence/sequenceRenderer */ "./src/diagrams/sequence/sequenceRenderer.js");
25509/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./diagrams/state/parser/stateDiagram */ "./src/diagrams/state/parser/stateDiagram.jison");
25510/* harmony import */ var _diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15__);
25511/* harmony import */ var _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./diagrams/state/stateDb */ "./src/diagrams/state/stateDb.js");
25512/* harmony import */ var _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./diagrams/state/stateRenderer */ "./src/diagrams/state/stateRenderer.js");
25513/* harmony import */ var _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./diagrams/state/stateRenderer-v2 */ "./src/diagrams/state/stateRenderer-v2.js");
25514/* harmony import */ var _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./diagrams/user-journey/journeyDb */ "./src/diagrams/user-journey/journeyDb.js");
25515/* harmony import */ var _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./diagrams/user-journey/journeyRenderer */ "./src/diagrams/user-journey/journeyRenderer.js");
25516/* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./diagrams/user-journey/parser/journey */ "./src/diagrams/user-journey/parser/journey.jison");
25517/* harmony import */ var _diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23__);
25518/* harmony import */ var _errorRenderer__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./errorRenderer */ "./src/errorRenderer.js");
25519/* harmony import */ var _interactionDb__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./interactionDb */ "./src/interactionDb.js");
25520/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
25521/* harmony import */ var _styles__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./styles */ "./src/styles.js");
25522/* harmony import */ var _themes__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./themes */ "./src/themes/index.js");
25523/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ "./src/utils.js");
25524function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
25525
25526/**
25527 *Edit this Page[![N|Solid](img/GitHub-Mark-32px.png)](https://github.com/mermaid-js/mermaid/blob/develop/src/mermaidAPI.js)
25528 *
25529 *This is the API to be used when optionally handling the integration with the web page, instead of using the default integration provided by mermaid.js.
25530 *
25531 *
25532 * The core of this api is the [**render**](Setup.md?id=render) function which, given a graph
25533 * definition as text, renders the graph/diagram and returns an svg element for the graph.
25534 *
25535 * It is is then up to the user of the API to make use of the svg, either insert it somewhere in the page or do something completely different.
25536 *
25537 * In addition to the render function, a number of behavioral configuration options are available.
25538 *
25539 * @name mermaidAPI
25540 */
25541
25542
25543
25544
25545
25546
25547
25548
25549
25550
25551
25552
25553
25554
25555
25556
25557
25558
25559
25560
25561
25562
25563
25564
25565
25566
25567
25568
25569
25570
25571
25572
25573
25574
25575
25576
25577
25578
25579
25580
25581
25582 // import * as configApi from './config';
25583// // , {
25584// // setConfig,
25585// // configApi.getConfig,
25586// // configApi.updateSiteConfig,
25587// // configApi.setSiteConfig,
25588// // configApi.getSiteConfig,
25589// // configApi.defaultConfig
25590// // }
25591
25592
25593
25594
25595
25596
25597function parse(text) {
25598 var cnf = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig();
25599 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(text, cnf);
25600
25601 if (graphInit) {
25602 reinitialize(graphInit);
25603 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('reinit ', graphInit);
25604 }
25605
25606 var graphType = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectType(text, cnf);
25607 var parser;
25608 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Type ' + graphType);
25609
25610 switch (graphType) {
25611 case 'git':
25612 parser = (_diagrams_git_parser_gitGraph__WEBPACK_IMPORTED_MODULE_5___default());
25613 parser.parser.yy = _diagrams_git_gitGraphAst__WEBPACK_IMPORTED_MODULE_6__["default"];
25614 break;
25615
25616 case 'flowchart':
25617 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].clear();
25618 parser = (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default());
25619 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"];
25620 break;
25621
25622 case 'flowchart-v2':
25623 _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].clear();
25624 parser = (_diagrams_flowchart_parser_flow__WEBPACK_IMPORTED_MODULE_8___default());
25625 parser.parser.yy = _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"];
25626 break;
25627
25628 case 'sequence':
25629 parser = (_diagrams_sequence_parser_sequenceDiagram__WEBPACK_IMPORTED_MODULE_9___default());
25630 parser.parser.yy = _diagrams_sequence_sequenceDb__WEBPACK_IMPORTED_MODULE_10__["default"];
25631 break;
25632
25633 case 'gantt':
25634 parser = (_diagrams_gantt_parser_gantt__WEBPACK_IMPORTED_MODULE_11___default());
25635 parser.parser.yy = _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__["default"];
25636 break;
25637
25638 case 'class':
25639 parser = (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default());
25640 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"];
25641 break;
25642
25643 case 'classDiagram':
25644 parser = (_diagrams_class_parser_classDiagram__WEBPACK_IMPORTED_MODULE_13___default());
25645 parser.parser.yy = _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"];
25646 break;
25647
25648 case 'state':
25649 parser = (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default());
25650 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__["default"];
25651 break;
25652
25653 case 'stateDiagram':
25654 parser = (_diagrams_state_parser_stateDiagram__WEBPACK_IMPORTED_MODULE_15___default());
25655 parser.parser.yy = _diagrams_state_stateDb__WEBPACK_IMPORTED_MODULE_16__["default"];
25656 break;
25657
25658 case 'info':
25659 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('info info info');
25660 parser = (_diagrams_info_parser_info__WEBPACK_IMPORTED_MODULE_17___default());
25661 parser.parser.yy = _diagrams_info_infoDb__WEBPACK_IMPORTED_MODULE_18__["default"];
25662 break;
25663
25664 case 'pie':
25665 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('pie');
25666 parser = (_diagrams_pie_parser_pie__WEBPACK_IMPORTED_MODULE_19___default());
25667 parser.parser.yy = _diagrams_pie_pieDb__WEBPACK_IMPORTED_MODULE_20__["default"];
25668 break;
25669
25670 case 'er':
25671 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('er');
25672 parser = (_diagrams_er_parser_erDiagram__WEBPACK_IMPORTED_MODULE_21___default());
25673 parser.parser.yy = _diagrams_er_erDb__WEBPACK_IMPORTED_MODULE_22__["default"];
25674 break;
25675
25676 case 'journey':
25677 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('Journey');
25678 parser = (_diagrams_user_journey_parser_journey__WEBPACK_IMPORTED_MODULE_23___default());
25679 parser.parser.yy = _diagrams_user_journey_journeyDb__WEBPACK_IMPORTED_MODULE_24__["default"];
25680 break;
25681
25682 case 'requirement':
25683 case 'requirementDiagram':
25684 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('RequirementDiagram');
25685 parser = (_diagrams_requirement_parser_requirementDiagram__WEBPACK_IMPORTED_MODULE_25___default());
25686 parser.parser.yy = _diagrams_requirement_requirementDb__WEBPACK_IMPORTED_MODULE_26__["default"];
25687 break;
25688 }
25689
25690 parser.parser.yy.graphType = graphType;
25691
25692 parser.parser.yy.parseError = function (str, hash) {
25693 var error = {
25694 str: str,
25695 hash: hash
25696 };
25697 throw error;
25698 };
25699
25700 parser.parse(text);
25701 return parser;
25702}
25703
25704var encodeEntities = function encodeEntities(text) {
25705 var txt = text;
25706 txt = txt.replace(/style.*:\S*#.*;/g, function (s) {
25707 var innerTxt = s.substring(0, s.length - 1);
25708 return innerTxt;
25709 });
25710 txt = txt.replace(/classDef.*:\S*#.*;/g, function (s) {
25711 var innerTxt = s.substring(0, s.length - 1);
25712 return innerTxt;
25713 });
25714 txt = txt.replace(/#\w+;/g, function (s) {
25715 var innerTxt = s.substring(1, s.length - 1);
25716 var isInt = /^\+?\d+$/.test(innerTxt);
25717
25718 if (isInt) {
25719 return 'fl°°' + innerTxt + '¶ß';
25720 } else {
25721 return 'fl°' + innerTxt + '¶ß';
25722 }
25723 });
25724 return txt;
25725};
25726var decodeEntities = function decodeEntities(text) {
25727 var txt = text;
25728 txt = txt.replace(/fl°°/g, function () {
25729 return '&#';
25730 });
25731 txt = txt.replace(/fl°/g, function () {
25732 return '&';
25733 });
25734 txt = txt.replace(/¶ß/g, function () {
25735 return ';';
25736 });
25737 return txt;
25738};
25739/**
25740 * Function that renders an svg with a graph from a chart definition. Usage example below.
25741 *
25742 * ```javascript
25743 * mermaidAPI.initialize({
25744 * startOnLoad:true
25745 * });
25746 * $(function(){
25747 * const graphDefinition = 'graph TB\na-->b';
25748 * const cb = function(svgGraph){
25749 * console.log(svgGraph);
25750 * };
25751 * mermaidAPI.render('id1',graphDefinition,cb);
25752 * });
25753 *```
25754 * @param id the id of the element to be rendered
25755 * @param _txt the graph definition
25756 * @param cb callback which is called after rendering is finished with the svg code as inparam.
25757 * @param container selector to element in which a div with the graph temporarily will be inserted. In one is
25758 * provided a hidden div will be inserted in the body of the page instead. The element will be removed when rendering is
25759 * completed.
25760 */
25761
25762var render = function render(id, _txt, cb, container) {
25763 _config__WEBPACK_IMPORTED_MODULE_2__.reset();
25764 var txt = _txt;
25765 var graphInit = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectInit(txt);
25766
25767 if (graphInit) {
25768 _config__WEBPACK_IMPORTED_MODULE_2__.addDirective(graphInit);
25769 } // else {
25770 // configApi.reset();
25771 // const siteConfig = configApi.getSiteConfig();
25772 // configApi.addDirective(siteConfig);
25773 // }
25774 // console.warn('Render fetching config');
25775
25776
25777 var cnf = _config__WEBPACK_IMPORTED_MODULE_2__.getConfig(); // Check the maximum allowed text size
25778
25779 if (_txt.length > cnf.maxTextSize) {
25780 txt = 'graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa';
25781 }
25782
25783 if (typeof container !== 'undefined') {
25784 container.innerHTML = '';
25785 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)(container).append('div').attr('id', 'd' + id).attr('style', 'font-family: ' + cnf.fontFamily).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
25786 } else {
25787 var existingSvg = document.getElementById(id);
25788
25789 if (existingSvg) {
25790 existingSvg.remove();
25791 }
25792
25793 var _element = document.querySelector('#' + 'd' + id);
25794
25795 if (_element) {
25796 _element.remove();
25797 }
25798
25799 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('body').append('div').attr('id', 'd' + id).append('svg').attr('id', id).attr('width', '100%').attr('xmlns', 'http://www.w3.org/2000/svg').append('g');
25800 }
25801
25802 window.txt = txt;
25803 txt = encodeEntities(txt);
25804 var element = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node();
25805 var graphType = _utils__WEBPACK_IMPORTED_MODULE_3__["default"].detectType(txt, cnf); // insert inline style into svg
25806
25807 var svg = element.firstChild;
25808 var firstChild = svg.firstChild;
25809 var userStyles = ''; // user provided theme CSS
25810
25811 if (cnf.themeCSS !== undefined) {
25812 userStyles += "\n".concat(cnf.themeCSS);
25813 } // user provided theme CSS
25814
25815
25816 if (cnf.fontFamily !== undefined) {
25817 userStyles += "\n:root { --mermaid-font-family: ".concat(cnf.fontFamily, "}");
25818 } // user provided theme CSS
25819
25820
25821 if (cnf.altFontFamily !== undefined) {
25822 userStyles += "\n:root { --mermaid-alt-font-family: ".concat(cnf.altFontFamily, "}");
25823 } // classDef
25824
25825
25826 if (graphType === 'flowchart' || graphType === 'flowchart-v2' || graphType === 'graph') {
25827 var classes = _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].getClasses(txt);
25828 var htmlLabels = cnf.htmlLabels || cnf.flowchart.htmlLabels;
25829
25830 for (var className in classes) {
25831 if (htmlLabels) {
25832 userStyles += "\n.".concat(className, " > * { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25833 userStyles += "\n.".concat(className, " span { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25834 } else {
25835 userStyles += "\n.".concat(className, " path { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25836 userStyles += "\n.".concat(className, " rect { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25837 userStyles += "\n.".concat(className, " polygon { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25838 userStyles += "\n.".concat(className, " ellipse { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25839 userStyles += "\n.".concat(className, " circle { ").concat(classes[className].styles.join(' !important; '), " !important; }");
25840
25841 if (classes[className].textStyles) {
25842 userStyles += "\n.".concat(className, " tspan { ").concat(classes[className].textStyles.join(' !important; '), " !important; }");
25843 }
25844 }
25845 }
25846 } // log.warn(cnf.themeVariables);
25847
25848
25849 var stylis = function stylis(selector, styles) {
25850 return (0,stylis__WEBPACK_IMPORTED_MODULE_1__.serialize)((0,stylis__WEBPACK_IMPORTED_MODULE_1__.compile)("".concat(selector, "{").concat(styles, "}")), stylis__WEBPACK_IMPORTED_MODULE_1__.stringify);
25851 };
25852
25853 var rules = stylis("#".concat(id), (0,_styles__WEBPACK_IMPORTED_MODULE_28__["default"])(graphType, userStyles, cnf.themeVariables));
25854 var style1 = document.createElement('style');
25855 style1.innerHTML = "#".concat(id, " ") + rules;
25856 svg.insertBefore(style1, firstChild); // Verify that the generated svgs are ok before removing this
25857 // const style2 = document.createElement('style');
25858 // const cs = window.getComputedStyle(svg);
25859 // style2.innerHTML = `#d${id} * {
25860 // color: ${cs.color};
25861 // // font: ${cs.font};
25862 // // font-family: Arial;
25863 // // font-size: 24px;
25864 // }`;
25865 // svg.insertBefore(style2, firstChild);
25866
25867 try {
25868 switch (graphType) {
25869 case 'git':
25870 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25871 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].setConf(cnf.git);
25872 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].draw(txt, id, false);
25873 break;
25874
25875 case 'flowchart':
25876 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25877 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(cnf.flowchart);
25878 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].draw(txt, id, false);
25879 break;
25880
25881 case 'flowchart-v2':
25882 cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25883 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(cnf.flowchart);
25884 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].draw(txt, id, false);
25885 break;
25886
25887 case 'sequence':
25888 cnf.sequence.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25889
25890 if (cnf.sequenceDiagram) {
25891 // backwards compatibility
25892 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(Object.assign(cnf.sequence, cnf.sequenceDiagram));
25893 console.error('`mermaid config.sequenceDiagram` has been renamed to `config.sequence`. Please update your mermaid config.');
25894 } else {
25895 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(cnf.sequence);
25896 }
25897
25898 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].draw(txt, id);
25899 break;
25900
25901 case 'gantt':
25902 cnf.gantt.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25903 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].setConf(cnf.gantt);
25904 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].draw(txt, id);
25905 break;
25906
25907 case 'class':
25908 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25909 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].setConf(cnf.class);
25910 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].draw(txt, id);
25911 break;
25912
25913 case 'classDiagram':
25914 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25915 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__["default"].setConf(cnf.class);
25916 _diagrams_class_classRenderer_v2__WEBPACK_IMPORTED_MODULE_34__["default"].draw(txt, id);
25917 break;
25918
25919 case 'state':
25920 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25921 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(cnf.state);
25922 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].draw(txt, id);
25923 break;
25924
25925 case 'stateDiagram':
25926 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25927 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].setConf(cnf.state);
25928 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].draw(txt, id);
25929 break;
25930
25931 case 'info':
25932 cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25933 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf(cnf.class);
25934 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25935 break;
25936
25937 case 'pie':
25938 //cnf.class.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;
25939 //pieRenderer.setConf(cnf.pie);
25940 _diagrams_pie_pieRenderer__WEBPACK_IMPORTED_MODULE_39__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25941 break;
25942
25943 case 'er':
25944 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].setConf(cnf.er);
25945 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25946 break;
25947
25948 case 'journey':
25949 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].setConf(cnf.journey);
25950 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25951 break;
25952
25953 case 'requirement':
25954 _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].setConf(cnf.requirement);
25955 _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].draw(txt, id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25956 break;
25957 }
25958 } catch (e) {
25959 // errorRenderer.setConf(cnf.class);
25960 _errorRenderer__WEBPACK_IMPORTED_MODULE_43__["default"].draw(id, _package_json__WEBPACK_IMPORTED_MODULE_38__.version);
25961 throw e;
25962 }
25963
25964 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)("[id=\"".concat(id, "\"]")).selectAll('foreignobject > *').attr('xmlns', 'http://www.w3.org/1999/xhtml'); // if (cnf.arrowMarkerAbsolute) {
25965 // url =
25966 // window.location.protocol +
25967 // '//' +
25968 // window.location.host +
25969 // window.location.pathname +
25970 // window.location.search;
25971 // url = url.replace(/\(/g, '\\(');
25972 // url = url.replace(/\)/g, '\\)');
25973 // }
25974 // Fix for when the base tag is used
25975
25976 var svgCode = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node().innerHTML;
25977 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('cnf.arrowMarkerAbsolute', cnf.arrowMarkerAbsolute);
25978
25979 if (!cnf.arrowMarkerAbsolute || cnf.arrowMarkerAbsolute === 'false') {
25980 svgCode = svgCode.replace(/marker-end="url\(.*?#/g, 'marker-end="url(#', 'g');
25981 }
25982
25983 svgCode = decodeEntities(svgCode); // Fix for when the br tag is used
25984
25985 svgCode = svgCode.replace(/<br>/g, '<br/>');
25986
25987 if (typeof cb !== 'undefined') {
25988 switch (graphType) {
25989 case 'flowchart':
25990 case 'flowchart-v2':
25991 cb(svgCode, _diagrams_flowchart_flowDb__WEBPACK_IMPORTED_MODULE_7__["default"].bindFunctions);
25992 break;
25993
25994 case 'gantt':
25995 cb(svgCode, _diagrams_gantt_ganttDb__WEBPACK_IMPORTED_MODULE_12__["default"].bindFunctions);
25996 break;
25997
25998 case 'class':
25999 case 'classDiagram':
26000 cb(svgCode, _diagrams_class_classDb__WEBPACK_IMPORTED_MODULE_14__["default"].bindFunctions);
26001 break;
26002
26003 default:
26004 cb(svgCode);
26005 }
26006 } else {
26007 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('CB = undefined!');
26008 }
26009
26010 (0,_interactionDb__WEBPACK_IMPORTED_MODULE_44__.attachFunctions)();
26011 var node = (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node();
26012
26013 if (node !== null && typeof node.remove === 'function') {
26014 (0,d3__WEBPACK_IMPORTED_MODULE_0__.select)('#d' + id).node().remove();
26015 }
26016
26017 return svgCode;
26018};
26019
26020var currentDirective = {};
26021
26022var parseDirective = function parseDirective(p, statement, context, type) {
26023 try {
26024 if (statement !== undefined) {
26025 statement = statement.trim();
26026
26027 switch (context) {
26028 case 'open_directive':
26029 currentDirective = {};
26030 break;
26031
26032 case 'type_directive':
26033 currentDirective.type = statement.toLowerCase();
26034 break;
26035
26036 case 'arg_directive':
26037 currentDirective.args = JSON.parse(statement);
26038 break;
26039
26040 case 'close_directive':
26041 handleDirective(p, currentDirective, type);
26042 currentDirective = null;
26043 break;
26044 }
26045 }
26046 } catch (error) {
26047 _logger__WEBPACK_IMPORTED_MODULE_4__.log.error("Error while rendering sequenceDiagram directive: ".concat(statement, " jison context: ").concat(context));
26048 _logger__WEBPACK_IMPORTED_MODULE_4__.log.error(error.message);
26049 }
26050};
26051
26052var handleDirective = function handleDirective(p, directive, type) {
26053 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug("Directive type=".concat(directive.type, " with args:"), directive.args);
26054
26055 switch (directive.type) {
26056 case 'init':
26057 case 'initialize':
26058 {
26059 ['config'].forEach(function (prop) {
26060 if (typeof directive.args[prop] !== 'undefined') {
26061 if (type === 'flowchart-v2') {
26062 type = 'flowchart';
26063 }
26064
26065 directive.args[type] = directive.args[prop];
26066 delete directive.args[prop];
26067 }
26068 });
26069 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective', directive.args);
26070 (0,_utils__WEBPACK_IMPORTED_MODULE_3__.directiveSanitizer)(directive.args);
26071 _logger__WEBPACK_IMPORTED_MODULE_4__.log.debug('sanitize in handleDirective (done)', directive.args);
26072 reinitialize(directive.args);
26073 _config__WEBPACK_IMPORTED_MODULE_2__.addDirective(directive.args);
26074 break;
26075 }
26076
26077 case 'wrap':
26078 case 'nowrap':
26079 if (p && p['setWrap']) {
26080 p.setWrap(directive.type === 'wrap');
26081 }
26082
26083 break;
26084
26085 default:
26086 _logger__WEBPACK_IMPORTED_MODULE_4__.log.warn("Unhandled directive: source: '%%{".concat(directive.type, ": ").concat(JSON.stringify(directive.args ? directive.args : {}), "}%%"), directive);
26087 break;
26088 }
26089};
26090
26091function updateRendererConfigs(conf) {
26092 // Todo remove, all diagrams should get config on demoand from the config object, no need for this
26093 _diagrams_git_gitGraphRenderer__WEBPACK_IMPORTED_MODULE_29__["default"].setConf(conf.git);
26094 _diagrams_flowchart_flowRenderer__WEBPACK_IMPORTED_MODULE_27__["default"].setConf(conf.flowchart);
26095 _diagrams_flowchart_flowRenderer_v2__WEBPACK_IMPORTED_MODULE_30__["default"].setConf(conf.flowchart);
26096
26097 if (typeof conf['sequenceDiagram'] !== 'undefined') {
26098 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf((0,_utils__WEBPACK_IMPORTED_MODULE_3__.assignWithDepth)(conf.sequence, conf['sequenceDiagram']));
26099 }
26100
26101 _diagrams_sequence_sequenceRenderer__WEBPACK_IMPORTED_MODULE_31__["default"].setConf(conf.sequence);
26102 _diagrams_gantt_ganttRenderer__WEBPACK_IMPORTED_MODULE_32__["default"].setConf(conf.gantt);
26103 _diagrams_class_classRenderer__WEBPACK_IMPORTED_MODULE_33__["default"].setConf(conf.class);
26104 _diagrams_state_stateRenderer__WEBPACK_IMPORTED_MODULE_35__["default"].setConf(conf.state);
26105 _diagrams_state_stateRenderer_v2__WEBPACK_IMPORTED_MODULE_36__["default"].setConf(conf.state);
26106 _diagrams_info_infoRenderer__WEBPACK_IMPORTED_MODULE_37__["default"].setConf(conf.class); // pieRenderer.setConf(conf.class);
26107
26108 _diagrams_er_erRenderer__WEBPACK_IMPORTED_MODULE_40__["default"].setConf(conf.er);
26109 _diagrams_user_journey_journeyRenderer__WEBPACK_IMPORTED_MODULE_41__["default"].setConf(conf.journey);
26110 _diagrams_requirement_requirementRenderer__WEBPACK_IMPORTED_MODULE_42__["default"].setConf(conf.requirement);
26111 _errorRenderer__WEBPACK_IMPORTED_MODULE_43__["default"].setConf(conf.class);
26112}
26113
26114function reinitialize() {// `mermaidAPI.reinitialize: v${pkg.version}`,
26115 // JSON.stringify(options),
26116 // options.themeVariables.primaryColor;
26117 // // if (options.theme && theme[options.theme]) {
26118 // // options.themeVariables = theme[options.theme].getThemeVariables(options.themeVariables);
26119 // // }
26120 // // Set default options
26121 // const config =
26122 // typeof options === 'object' ? configApi.setConfig(options) : configApi.getSiteConfig();
26123 // updateRendererConfigs(config);
26124 // setLogLevel(config.logLevel);
26125 // log.debug('mermaidAPI.reinitialize: ', config);
26126}
26127
26128function initialize(options) {
26129 // console.warn(`mermaidAPI.initialize: v${pkg.version} `, options);
26130 // Handle legacy location of font-family configuration
26131 if (options && options.fontFamily) {
26132 if (!options.themeVariables) {
26133 options.themeVariables = {
26134 fontFamily: options.fontFamily
26135 };
26136 } else {
26137 if (!options.themeVariables.fontFamily) {
26138 options.themeVariables = {
26139 fontFamily: options.fontFamily
26140 };
26141 }
26142 }
26143 } // Set default options
26144
26145
26146 _config__WEBPACK_IMPORTED_MODULE_2__.saveConfigFromInitilize(options);
26147
26148 if (options && options.theme && _themes__WEBPACK_IMPORTED_MODULE_45__["default"][options.theme]) {
26149 // Todo merge with user options
26150 options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_45__["default"][options.theme].getThemeVariables(options.themeVariables);
26151 } else {
26152 if (options) options.themeVariables = _themes__WEBPACK_IMPORTED_MODULE_45__["default"]["default"].getThemeVariables(options.themeVariables);
26153 }
26154
26155 var config = _typeof(options) === 'object' ? _config__WEBPACK_IMPORTED_MODULE_2__.setSiteConfig(options) : _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig();
26156 updateRendererConfigs(config);
26157 (0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(config.logLevel); // log.debug('mermaidAPI.initialize: ', config);
26158}
26159
26160var mermaidAPI = Object.freeze({
26161 render: render,
26162 parse: parse,
26163 parseDirective: parseDirective,
26164 initialize: initialize,
26165 reinitialize: reinitialize,
26166 getConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getConfig,
26167 setConfig: _config__WEBPACK_IMPORTED_MODULE_2__.setConfig,
26168 getSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.getSiteConfig,
26169 updateSiteConfig: _config__WEBPACK_IMPORTED_MODULE_2__.updateSiteConfig,
26170 reset: function reset() {
26171 // console.warn('reset');
26172 _config__WEBPACK_IMPORTED_MODULE_2__.reset(); // const siteConfig = configApi.getSiteConfig();
26173 // updateRendererConfigs(siteConfig);
26174 },
26175 globalReset: function globalReset() {
26176 _config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig);
26177 updateRendererConfigs(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
26178 },
26179 defaultConfig: _config__WEBPACK_IMPORTED_MODULE_2__.defaultConfig
26180});
26181(0,_logger__WEBPACK_IMPORTED_MODULE_4__.setLogLevel)(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig().logLevel);
26182_config__WEBPACK_IMPORTED_MODULE_2__.reset(_config__WEBPACK_IMPORTED_MODULE_2__.getConfig());
26183/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (mermaidAPI);
26184/**
26185 * ## mermaidAPI configuration defaults
26186 *
26187 * ```html
26188 * <script>
26189 * var config = {
26190 * theme:'default',
26191 * logLevel:'fatal',
26192 * securityLevel:'strict',
26193 * startOnLoad:true,
26194 * arrowMarkerAbsolute:false,
26195 *
26196 * er:{
26197 * diagramPadding:20,
26198 * layoutDirection:'TB',
26199 * minEntityWidth:100,
26200 * minEntityHeight:75,
26201 * entityPadding:15,
26202 * stroke:'gray',
26203 * fill:'honeydew',
26204 * fontSize:12,
26205 * useMaxWidth:true,
26206 * },
26207 * flowchart:{
26208 * diagramPadding:8,
26209 * htmlLabels:true,
26210 * curve:'basis',
26211 * },
26212 * sequence:{
26213 * diagramMarginX:50,
26214 * diagramMarginY:10,
26215 * actorMargin:50,
26216 * width:150,
26217 * height:65,
26218 * boxMargin:10,
26219 * boxTextMargin:5,
26220 * noteMargin:10,
26221 * messageMargin:35,
26222 * messageAlign:'center',
26223 * mirrorActors:true,
26224 * bottomMarginAdj:1,
26225 * useMaxWidth:true,
26226 * rightAngles:false,
26227 * showSequenceNumbers:false,
26228 * },
26229 * gantt:{
26230 * titleTopMargin:25,
26231 * barHeight:20,
26232 * barGap:4,
26233 * topPadding:50,
26234 * leftPadding:75,
26235 * gridLineStartPadding:35,
26236 * fontSize:11,
26237 * fontFamily:'"Open-Sans", "sans-serif"',
26238 * numberSectionStyles:4,
26239 * axisFormat:'%Y-%m-%d',
26240 * topAxis:false,
26241 * }
26242 * };
26243 * mermaid.initialize(config);
26244 * </script>
26245 * ```
26246 */
26247
26248/***/ }),
26249
26250/***/ "./src/styles.js":
26251/*!***********************!*\
26252 !*** ./src/styles.js ***!
26253 \***********************/
26254/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
26255
26256"use strict";
26257__webpack_require__.r(__webpack_exports__);
26258/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26259/* harmony export */ "calcThemeVariables": () => (/* binding */ calcThemeVariables),
26260/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
26261/* harmony export */ });
26262/* harmony import */ var _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/class/styles */ "./src/diagrams/class/styles.js");
26263/* harmony import */ var _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./diagrams/er/styles */ "./src/diagrams/er/styles.js");
26264/* harmony import */ var _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./diagrams/flowchart/styles */ "./src/diagrams/flowchart/styles.js");
26265/* harmony import */ var _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./diagrams/gantt/styles */ "./src/diagrams/gantt/styles.js");
26266/* harmony import */ var _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./diagrams/git/styles */ "./src/diagrams/git/styles.js");
26267/* harmony import */ var _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./diagrams/info/styles */ "./src/diagrams/info/styles.js");
26268/* harmony import */ var _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./diagrams/pie/styles */ "./src/diagrams/pie/styles.js");
26269/* harmony import */ var _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./diagrams/requirement/styles */ "./src/diagrams/requirement/styles.js");
26270/* harmony import */ var _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./diagrams/sequence/styles */ "./src/diagrams/sequence/styles.js");
26271/* harmony import */ var _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./diagrams/state/styles */ "./src/diagrams/state/styles.js");
26272/* harmony import */ var _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./diagrams/user-journey/styles */ "./src/diagrams/user-journey/styles.js");
26273
26274
26275
26276
26277
26278
26279
26280
26281
26282
26283
26284var themes = {
26285 flowchart: _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
26286 'flowchart-v2': _diagrams_flowchart_styles__WEBPACK_IMPORTED_MODULE_0__["default"],
26287 sequence: _diagrams_sequence_styles__WEBPACK_IMPORTED_MODULE_1__["default"],
26288 gantt: _diagrams_gantt_styles__WEBPACK_IMPORTED_MODULE_2__["default"],
26289 classDiagram: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
26290 'classDiagram-v2': _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
26291 class: _diagrams_class_styles__WEBPACK_IMPORTED_MODULE_3__["default"],
26292 stateDiagram: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
26293 state: _diagrams_state_styles__WEBPACK_IMPORTED_MODULE_4__["default"],
26294 git: _diagrams_git_styles__WEBPACK_IMPORTED_MODULE_5__["default"],
26295 info: _diagrams_info_styles__WEBPACK_IMPORTED_MODULE_6__["default"],
26296 pie: _diagrams_pie_styles__WEBPACK_IMPORTED_MODULE_7__["default"],
26297 er: _diagrams_er_styles__WEBPACK_IMPORTED_MODULE_8__["default"],
26298 journey: _diagrams_user_journey_styles__WEBPACK_IMPORTED_MODULE_9__["default"],
26299 requirement: _diagrams_requirement_styles__WEBPACK_IMPORTED_MODULE_10__["default"]
26300};
26301var calcThemeVariables = function calcThemeVariables(theme, userOverRides) {
26302 return theme.calcColors(userOverRides);
26303};
26304
26305var getStyles = function getStyles(type, userStyles, options) {
26306 //console.warn('options in styles: ', options);
26307 return " {\n font-family: ".concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n fill: ").concat(options.textColor, "\n }\n\n /* Classes common for multiple diagrams */\n\n .error-icon {\n fill: ").concat(options.errorBkgColor, ";\n }\n .error-text {\n fill: ").concat(options.errorTextColor, ";\n stroke: ").concat(options.errorTextColor, ";\n }\n\n .edge-thickness-normal {\n stroke-width: 2px;\n }\n .edge-thickness-thick {\n stroke-width: 3.5px\n }\n .edge-pattern-solid {\n stroke-dasharray: 0;\n }\n\n .edge-pattern-dashed{\n stroke-dasharray: 3;\n }\n .edge-pattern-dotted {\n stroke-dasharray: 2;\n }\n\n .marker {\n fill: ").concat(options.lineColor, ";\n stroke: ").concat(options.lineColor, ";\n }\n .marker.cross {\n stroke: ").concat(options.lineColor, ";\n }\n\n svg {\n font-family: ").concat(options.fontFamily, ";\n font-size: ").concat(options.fontSize, ";\n }\n\n ").concat(themes[type](options), "\n\n ").concat(userStyles, "\n");
26308};
26309
26310/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getStyles);
26311
26312/***/ }),
26313
26314/***/ "./src/themes/index.js":
26315/*!*****************************!*\
26316 !*** ./src/themes/index.js ***!
26317 \*****************************/
26318/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
26319
26320"use strict";
26321__webpack_require__.r(__webpack_exports__);
26322/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26323/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
26324/* harmony export */ });
26325/* harmony import */ var _theme_base__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./theme-base */ "./src/themes/theme-base.js");
26326/* harmony import */ var _theme_dark__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-dark */ "./src/themes/theme-dark.js");
26327/* harmony import */ var _theme_default__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./theme-default */ "./src/themes/theme-default.js");
26328/* harmony import */ var _theme_forest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./theme-forest */ "./src/themes/theme-forest.js");
26329/* harmony import */ var _theme_neutral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./theme-neutral */ "./src/themes/theme-neutral.js");
26330
26331
26332
26333
26334
26335/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
26336 base: {
26337 getThemeVariables: _theme_base__WEBPACK_IMPORTED_MODULE_0__.getThemeVariables
26338 },
26339 dark: {
26340 getThemeVariables: _theme_dark__WEBPACK_IMPORTED_MODULE_1__.getThemeVariables
26341 },
26342 default: {
26343 getThemeVariables: _theme_default__WEBPACK_IMPORTED_MODULE_2__.getThemeVariables
26344 },
26345 forest: {
26346 getThemeVariables: _theme_forest__WEBPACK_IMPORTED_MODULE_3__.getThemeVariables
26347 },
26348 neutral: {
26349 getThemeVariables: _theme_neutral__WEBPACK_IMPORTED_MODULE_4__.getThemeVariables
26350 }
26351});
26352
26353/***/ }),
26354
26355/***/ "./src/themes/theme-base.js":
26356/*!**********************************!*\
26357 !*** ./src/themes/theme-base.js ***!
26358 \**********************************/
26359/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
26360
26361"use strict";
26362__webpack_require__.r(__webpack_exports__);
26363/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26364/* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
26365/* harmony export */ });
26366/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
26367/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
26368/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
26369function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26370
26371function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26372
26373function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
26374
26375function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26376
26377
26378
26379
26380var Theme = /*#__PURE__*/function () {
26381 function Theme() {
26382 _classCallCheck(this, Theme);
26383
26384 /** # Base variables */
26385
26386 /** * background - used to know what the background color is of the diagram. This is used for deducing colors for istance line color. Defaulr value is #f4f4f4. */
26387 this.background = '#f4f4f4';
26388 this.darkMode = false; // this.background = '#0c0c0c';
26389 // this.darkMode = true;
26390
26391 this.primaryColor = '#fff4dd'; // this.background = '#0c0c0c';
26392 // this.primaryColor = '#1f1f00';
26393
26394 this.noteBkgColor = '#fff5ad';
26395 this.noteTextColor = '#333'; // dark
26396 // this.primaryColor = '#034694';
26397 // this.primaryColor = '#f2ee7e';
26398 // this.primaryColor = '#9f33be';
26399 // this.primaryColor = '#f0fff0';
26400 // this.primaryColor = '#fa255e';
26401 // this.primaryColor = '#ECECFF';
26402 // this.secondaryColor = '#c39ea0';
26403 // this.tertiaryColor = '#f8e5e5';
26404 // this.secondaryColor = '#dfdfde';
26405 // this.tertiaryColor = '#CCCCFF';
26406
26407 this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
26408 this.fontSize = '16px'; // this.updateColors();
26409 }
26410
26411 _createClass(Theme, [{
26412 key: "updateColors",
26413 value: function updateColors() {
26414 // The || is to make sure that if the variable has been defiend by a user override that value is to be used
26415
26416 /* Main */
26417 this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#ddd' : '#333'); // invert(this.primaryColor);
26418
26419 this.secondaryColor = this.secondaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26420 h: -120
26421 });
26422 this.tertiaryColor = this.tertiaryColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26423 h: 180,
26424 l: 5
26425 });
26426 this.primaryBorderColor = this.primaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
26427 this.secondaryBorderColor = this.secondaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
26428 this.tertiaryBorderColor = this.tertiaryBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
26429 this.noteBorderColor = this.noteBorderColor || (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.noteBkgColor, this.darkMode);
26430 this.noteBkgColor = this.noteBkgColor || '#fff5ad';
26431 this.noteTextColor = this.noteTextColor || '#333';
26432 this.secondaryTextColor = this.secondaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
26433 this.tertiaryTextColor = this.tertiaryTextColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
26434 this.lineColor = this.lineColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
26435 this.textColor = this.textColor || this.primaryTextColor;
26436 /* Flowchart variables */
26437
26438 this.nodeBkg = this.nodeBkg || this.primaryColor;
26439 this.mainBkg = this.mainBkg || this.primaryColor;
26440 this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
26441 this.clusterBkg = this.clusterBkg || this.tertiaryColor;
26442 this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
26443 this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
26444 this.titleColor = this.titleColor || this.tertiaryTextColor;
26445 this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
26446 this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
26447 /* Sequence Diagram variables */
26448 // this.actorBorder = lighten(this.border1, 0.5);
26449
26450 this.actorBorder = this.actorBorder || this.primaryBorderColor;
26451 this.actorBkg = this.actorBkg || this.mainBkg;
26452 this.actorTextColor = this.actorTextColor || this.primaryTextColor;
26453 this.actorLineColor = this.actorLineColor || 'grey';
26454 this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
26455 this.signalColor = this.signalColor || this.textColor;
26456 this.signalTextColor = this.signalTextColor || this.textColor;
26457 this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
26458 this.labelTextColor = this.labelTextColor || this.actorTextColor;
26459 this.loopTextColor = this.loopTextColor || this.actorTextColor;
26460 this.activationBorderColor = this.activationBorderColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 10);
26461 this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
26462 this.sequenceNumberColor = this.sequenceNumberColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.lineColor);
26463 /* Gantt chart variables */
26464
26465 this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
26466 this.altSectionBkgColor = this.altSectionBkgColor || 'white';
26467 this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
26468 this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
26469 this.excludeBkgColor = this.excludeBkgColor || '#eeeeee';
26470 this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
26471 this.taskBkgColor = this.taskBkgColor || this.primaryColor;
26472 this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
26473 this.activeTaskBkgColor = this.activeTaskBkgColor || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 23);
26474 this.gridColor = this.gridColor || 'lightgrey';
26475 this.doneTaskBkgColor = this.doneTaskBkgColor || 'lightgrey';
26476 this.doneTaskBorderColor = this.doneTaskBorderColor || 'grey';
26477 this.critBorderColor = this.critBorderColor || '#ff8888';
26478 this.critBkgColor = this.critBkgColor || 'red';
26479 this.todayLineColor = this.todayLineColor || 'red';
26480 this.taskTextColor = this.taskTextColor || this.textColor;
26481 this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
26482 this.taskTextLightColor = this.taskTextLightColor || this.textColor;
26483 this.taskTextColor = this.taskTextColor || this.primaryTextColor;
26484 this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
26485 this.taskTextClickableColor = this.taskTextClickableColor || '#003163';
26486 /* state colors */
26487
26488 this.transitionColor = this.transitionColor || this.lineColor;
26489 this.transitionLabelColor = this.transitionLabelColor || this.textColor;
26490 /* The color of the text tables of the tstates*/
26491
26492 this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
26493 this.stateBkg = this.stateBkg || this.mainBkg;
26494 this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
26495 this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
26496 this.altBackground = this.altBackground || this.tertiaryColor;
26497 this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
26498 this.compositeBorder = this.compositeBorder || this.nodeBorder;
26499 this.innerEndBackground = this.nodeBorder;
26500 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
26501 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
26502 this.transitionColor = this.transitionColor || this.lineColor;
26503 this.specialStateColor = this.lineColor;
26504 /* class */
26505
26506 this.classText = this.classText || this.textColor;
26507 /* user-journey */
26508
26509 this.fillType0 = this.fillType0 || this.primaryColor;
26510 this.fillType1 = this.fillType1 || this.secondaryColor;
26511 this.fillType2 = this.fillType2 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26512 h: 64
26513 });
26514 this.fillType3 = this.fillType3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26515 h: 64
26516 });
26517 this.fillType4 = this.fillType4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26518 h: -64
26519 });
26520 this.fillType5 = this.fillType5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26521 h: -64
26522 });
26523 this.fillType6 = this.fillType6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26524 h: 128
26525 });
26526 this.fillType7 = this.fillType7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26527 h: 128
26528 });
26529 /* pie */
26530
26531 this.pie1 = this.pie1 || this.primaryColor;
26532 this.pie2 = this.pie2 || this.secondaryColor;
26533 this.pie3 = this.pie3 || this.tertiaryColor;
26534 this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26535 l: -10
26536 });
26537 this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26538 l: -10
26539 });
26540 this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
26541 l: -10
26542 });
26543 this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26544 h: +60,
26545 l: -10
26546 });
26547 this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26548 h: -60,
26549 l: -10
26550 });
26551 this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26552 h: 120,
26553 l: 0
26554 });
26555 this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26556 h: +60,
26557 l: -20
26558 });
26559 this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26560 h: -60,
26561 l: -20
26562 });
26563 this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26564 h: 120,
26565 l: -10
26566 });
26567 this.pieTitleTextSize = this.pieTitleTextSize || '25px';
26568 this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
26569 this.pieSectionTextSize = this.pieSectionTextSize || '17px';
26570 this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
26571 this.pieLegendTextSize = this.pieLegendTextSize || '17px';
26572 this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
26573 this.pieStrokeColor = this.pieStrokeColor || 'black';
26574 this.pieStrokeWidth = this.pieStrokeWidth || '2px';
26575 this.pieOpacity = this.pieOpacity || '0.7';
26576 /* requirement-diagram */
26577
26578 this.requirementBackground = this.requirementBackground || this.primaryColor;
26579 this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
26580 this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
26581 this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
26582 this.relationColor = this.relationColor || this.lineColor;
26583 this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
26584 this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
26585 }
26586 }, {
26587 key: "calculate",
26588 value: function calculate(overrides) {
26589 var _this = this;
26590
26591 if (_typeof(overrides) !== 'object') {
26592 // Calculate colors form base colors
26593 this.updateColors();
26594 return;
26595 }
26596
26597 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
26598
26599 keys.forEach(function (k) {
26600 _this[k] = overrides[k];
26601 }); // Calculate colors form base colors
26602
26603 this.updateColors(); // Copy values from overrides again in case of an override of derived value
26604
26605 keys.forEach(function (k) {
26606 _this[k] = overrides[k];
26607 });
26608 }
26609 }]);
26610
26611 return Theme;
26612}();
26613
26614var getThemeVariables = function getThemeVariables(userOverrides) {
26615 var theme = new Theme();
26616 theme.calculate(userOverrides);
26617 return theme;
26618};
26619
26620/***/ }),
26621
26622/***/ "./src/themes/theme-dark.js":
26623/*!**********************************!*\
26624 !*** ./src/themes/theme-dark.js ***!
26625 \**********************************/
26626/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
26627
26628"use strict";
26629__webpack_require__.r(__webpack_exports__);
26630/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26631/* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
26632/* harmony export */ });
26633/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
26634/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
26635/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
26636function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26637
26638function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26639
26640function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
26641
26642function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26643
26644
26645
26646
26647var Theme = /*#__PURE__*/function () {
26648 function Theme() {
26649 _classCallCheck(this, Theme);
26650
26651 this.background = '#333';
26652 this.primaryColor = '#1f2020';
26653 this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.primaryColor, 16);
26654 this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26655 h: -160
26656 });
26657 this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
26658 this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
26659 this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
26660 this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
26661 this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
26662 this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
26663 this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
26664 this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
26665 this.mainBkg = '#1f2020';
26666 this.secondBkg = 'calculated';
26667 this.mainContrastColor = 'lightgrey';
26668 this.darkTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)((0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)('#323D47'), 10);
26669 this.lineColor = 'calculated';
26670 this.border1 = '#81B1DB';
26671 this.border2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 0.25);
26672 this.arrowheadColor = 'calculated';
26673 this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
26674 this.fontSize = '16px';
26675 this.labelBackground = '#181818';
26676 this.textColor = '#ccc';
26677 /* Flowchart variables */
26678
26679 this.nodeBkg = 'calculated';
26680 this.nodeBorder = 'calculated';
26681 this.clusterBkg = 'calculated';
26682 this.clusterBorder = 'calculated';
26683 this.defaultLinkColor = 'calculated';
26684 this.titleColor = '#F9FFFE';
26685 this.edgeLabelBackground = 'calculated';
26686 /* Sequence Diagram variables */
26687
26688 this.actorBorder = 'calculated';
26689 this.actorBkg = 'calculated';
26690 this.actorTextColor = 'calculated';
26691 this.actorLineColor = 'calculated';
26692 this.signalColor = 'calculated';
26693 this.signalTextColor = 'calculated';
26694 this.labelBoxBkgColor = 'calculated';
26695 this.labelBoxBorderColor = 'calculated';
26696 this.labelTextColor = 'calculated';
26697 this.loopTextColor = 'calculated';
26698 this.noteBorderColor = 'calculated';
26699 this.noteBkgColor = '#fff5ad';
26700 this.noteTextColor = 'calculated';
26701 this.activationBorderColor = 'calculated';
26702 this.activationBkgColor = 'calculated';
26703 this.sequenceNumberColor = 'black';
26704 /* Gantt chart variables */
26705
26706 this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)('#EAE8D9', 30);
26707 this.altSectionBkgColor = 'calculated';
26708 this.sectionBkgColor2 = '#EAE8D9';
26709 this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 70);
26710 this.taskBkgColor = 'calculated';
26711 this.taskTextColor = 'calculated';
26712 this.taskTextLightColor = 'calculated';
26713 this.taskTextOutsideColor = 'calculated';
26714 this.taskTextClickableColor = '#003163';
26715 this.activeTaskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(255, 255, 255, 50);
26716 this.activeTaskBkgColor = '#81B1DB';
26717 this.gridColor = 'calculated';
26718 this.doneTaskBkgColor = 'calculated';
26719 this.doneTaskBorderColor = 'grey';
26720 this.critBorderColor = '#E83737';
26721 this.critBkgColor = '#E83737';
26722 this.taskTextDarkColor = 'calculated';
26723 this.todayLineColor = '#DB5757';
26724 /* state colors */
26725
26726 this.labelColor = 'calculated';
26727 this.errorBkgColor = '#a44141';
26728 this.errorTextColor = '#ddd';
26729 }
26730
26731 _createClass(Theme, [{
26732 key: "updateColors",
26733 value: function updateColors() {
26734 this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 16);
26735 this.lineColor = this.mainContrastColor;
26736 this.arrowheadColor = this.mainContrastColor;
26737 /* Flowchart variables */
26738
26739 this.nodeBkg = this.mainBkg;
26740 this.nodeBorder = this.border1;
26741 this.clusterBkg = this.secondBkg;
26742 this.clusterBorder = this.border2;
26743 this.defaultLinkColor = this.lineColor;
26744 this.edgeLabelBackground = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.labelBackground, 25);
26745 /* Sequence Diagram variables */
26746
26747 this.actorBorder = this.border1;
26748 this.actorBkg = this.mainBkg;
26749 this.actorTextColor = this.mainContrastColor;
26750 this.actorLineColor = this.mainContrastColor;
26751 this.signalColor = this.mainContrastColor;
26752 this.signalTextColor = this.mainContrastColor;
26753 this.labelBoxBkgColor = this.actorBkg;
26754 this.labelBoxBorderColor = this.actorBorder;
26755 this.labelTextColor = this.mainContrastColor;
26756 this.loopTextColor = this.mainContrastColor;
26757 this.noteBorderColor = this.secondaryBorderColor;
26758 this.noteBkgColor = this.secondBkg;
26759 this.noteTextColor = this.secondaryTextColor;
26760 this.activationBorderColor = this.border1;
26761 this.activationBkgColor = this.secondBkg;
26762 /* Gantt chart variables */
26763
26764 this.altSectionBkgColor = this.background;
26765 this.taskBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.mainBkg, 23);
26766 this.taskTextColor = this.darkTextColor;
26767 this.taskTextLightColor = this.mainContrastColor;
26768 this.taskTextOutsideColor = this.taskTextLightColor;
26769 this.gridColor = this.mainContrastColor;
26770 this.doneTaskBkgColor = this.mainContrastColor;
26771 this.taskTextDarkColor = this.darkTextColor;
26772 /* state colors */
26773
26774 this.transitionColor = this.transitionColor || this.lineColor;
26775 this.transitionLabelColor = this.transitionLabelColor || this.textColor;
26776 this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
26777 this.stateBkg = this.stateBkg || this.mainBkg;
26778 this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
26779 this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
26780 this.altBackground = this.altBackground || '#555';
26781 this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
26782 this.compositeBorder = this.compositeBorder || this.nodeBorder;
26783 this.innerEndBackground = this.primaryBorderColor;
26784 this.specialStateColor = '#f4f4f4'; // this.lineColor;
26785
26786 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
26787 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
26788 this.fillType0 = this.primaryColor;
26789 this.fillType1 = this.secondaryColor;
26790 this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26791 h: 64
26792 });
26793 this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26794 h: 64
26795 });
26796 this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26797 h: -64
26798 });
26799 this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26800 h: -64
26801 });
26802 this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26803 h: 128
26804 });
26805 this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
26806 h: 128
26807 });
26808 /* pie */
26809
26810 this.pie1 = this.pie1 || '#0b0000';
26811 this.pie2 = this.pie2 || '#4d1037';
26812 this.pie3 = this.pie3 || '#3f5258';
26813 this.pie4 = this.pie4 || '#4f2f1b';
26814 this.pie5 = this.pie5 || '#6e0a0a';
26815 this.pie6 = this.pie6 || '#3b0048';
26816 this.pie7 = this.pie7 || '#995a01';
26817 this.pie8 = this.pie8 || '#154706';
26818 this.pie9 = this.pie9 || '#161722';
26819 this.pie10 = this.pie10 || '#00296f';
26820 this.pie11 = this.pie11 || '#01629c';
26821 this.pie12 = this.pie12 || '#010029';
26822 this.pieTitleTextSize = this.pieTitleTextSize || '25px';
26823 this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
26824 this.pieSectionTextSize = this.pieSectionTextSize || '17px';
26825 this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
26826 this.pieLegendTextSize = this.pieLegendTextSize || '17px';
26827 this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
26828 this.pieStrokeColor = this.pieStrokeColor || 'black';
26829 this.pieStrokeWidth = this.pieStrokeWidth || '2px';
26830 this.pieOpacity = this.pieOpacity || '0.7';
26831 /* class */
26832
26833 this.classText = this.primaryTextColor;
26834 /* requirement-diagram */
26835
26836 this.requirementBackground = this.requirementBackground || this.primaryColor;
26837 this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
26838 this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
26839 this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
26840 this.relationColor = this.relationColor || this.lineColor;
26841 this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.secondaryColor, 30) : this.secondaryColor);
26842 this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
26843 }
26844 }, {
26845 key: "calculate",
26846 value: function calculate(overrides) {
26847 var _this = this;
26848
26849 if (_typeof(overrides) !== 'object') {
26850 // Calculate colors form base colors
26851 this.updateColors();
26852 return;
26853 }
26854
26855 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
26856
26857 keys.forEach(function (k) {
26858 _this[k] = overrides[k];
26859 }); // Calculate colors form base colors
26860
26861 this.updateColors(); // Copy values from overrides again in case of an override of derived value
26862
26863 keys.forEach(function (k) {
26864 _this[k] = overrides[k];
26865 });
26866 }
26867 }]);
26868
26869 return Theme;
26870}();
26871
26872var getThemeVariables = function getThemeVariables(userOverrides) {
26873 var theme = new Theme();
26874 theme.calculate(userOverrides);
26875 return theme;
26876};
26877
26878/***/ }),
26879
26880/***/ "./src/themes/theme-default.js":
26881/*!*************************************!*\
26882 !*** ./src/themes/theme-default.js ***!
26883 \*************************************/
26884/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
26885
26886"use strict";
26887__webpack_require__.r(__webpack_exports__);
26888/* harmony export */ __webpack_require__.d(__webpack_exports__, {
26889/* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
26890/* harmony export */ });
26891/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
26892/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
26893/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
26894function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
26895
26896function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
26897
26898function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
26899
26900function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
26901
26902
26903
26904
26905var Theme = /*#__PURE__*/function () {
26906 function Theme() {
26907 _classCallCheck(this, Theme);
26908
26909 /* Base variables */
26910 this.background = '#f4f4f4';
26911 this.primaryColor = '#ECECFF';
26912 this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26913 h: 120
26914 });
26915 this.secondaryColor = '#ffffde';
26916 this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
26917 h: -160
26918 });
26919 this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
26920 this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
26921 this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
26922
26923 this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
26924 this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
26925 this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
26926 this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
26927 this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
26928 this.background = 'white';
26929 this.mainBkg = '#ECECFF';
26930 this.secondBkg = '#ffffde';
26931 this.lineColor = '#333333';
26932 this.border1 = '#9370DB';
26933 this.border2 = '#aaaa33';
26934 this.arrowheadColor = '#333333';
26935 this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
26936 this.fontSize = '16px';
26937 this.labelBackground = '#e8e8e8';
26938 this.textColor = '#333';
26939 /* Flowchart variables */
26940
26941 this.nodeBkg = 'calculated';
26942 this.nodeBorder = 'calculated';
26943 this.clusterBkg = 'calculated';
26944 this.clusterBorder = 'calculated';
26945 this.defaultLinkColor = 'calculated';
26946 this.titleColor = 'calculated';
26947 this.edgeLabelBackground = 'calculated';
26948 /* Sequence Diagram variables */
26949
26950 this.actorBorder = 'calculated';
26951 this.actorBkg = 'calculated';
26952 this.actorTextColor = 'black';
26953 this.actorLineColor = 'grey';
26954 this.signalColor = 'calculated';
26955 this.signalTextColor = 'calculated';
26956 this.labelBoxBkgColor = 'calculated';
26957 this.labelBoxBorderColor = 'calculated';
26958 this.labelTextColor = 'calculated';
26959 this.loopTextColor = 'calculated';
26960 this.noteBorderColor = 'calculated';
26961 this.noteBkgColor = '#fff5ad';
26962 this.noteTextColor = 'calculated';
26963 this.activationBorderColor = '#666';
26964 this.activationBkgColor = '#f4f4f4';
26965 this.sequenceNumberColor = 'white';
26966 /* Gantt chart variables */
26967
26968 this.sectionBkgColor = 'calculated';
26969 this.altSectionBkgColor = 'calculated';
26970 this.sectionBkgColor2 = 'calculated';
26971 this.excludeBkgColor = '#eeeeee';
26972 this.taskBorderColor = 'calculated';
26973 this.taskBkgColor = 'calculated';
26974 this.taskTextLightColor = 'calculated';
26975 this.taskTextColor = this.taskTextLightColor;
26976 this.taskTextDarkColor = 'calculated';
26977 this.taskTextOutsideColor = this.taskTextDarkColor;
26978 this.taskTextClickableColor = 'calculated';
26979 this.activeTaskBorderColor = 'calculated';
26980 this.activeTaskBkgColor = 'calculated';
26981 this.gridColor = 'calculated';
26982 this.doneTaskBkgColor = 'calculated';
26983 this.doneTaskBorderColor = 'calculated';
26984 this.critBorderColor = 'calculated';
26985 this.critBkgColor = 'calculated';
26986 this.todayLineColor = 'calculated';
26987 this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.rgba)(102, 102, 255, 0.49);
26988 this.altSectionBkgColor = 'white';
26989 this.sectionBkgColor2 = '#fff400';
26990 this.taskBorderColor = '#534fbc';
26991 this.taskBkgColor = '#8a90dd';
26992 this.taskTextLightColor = 'white';
26993 this.taskTextColor = 'calculated';
26994 this.taskTextDarkColor = 'black';
26995 this.taskTextOutsideColor = 'calculated';
26996 this.taskTextClickableColor = '#003163';
26997 this.activeTaskBorderColor = '#534fbc';
26998 this.activeTaskBkgColor = '#bfc7ff';
26999 this.gridColor = 'lightgrey';
27000 this.doneTaskBkgColor = 'lightgrey';
27001 this.doneTaskBorderColor = 'grey';
27002 this.critBorderColor = '#ff8888';
27003 this.critBkgColor = 'red';
27004 this.todayLineColor = 'red';
27005 /* state colors */
27006
27007 this.labelColor = 'black';
27008 this.errorBkgColor = '#552222';
27009 this.errorTextColor = '#552222';
27010 this.updateColors();
27011 }
27012
27013 _createClass(Theme, [{
27014 key: "updateColors",
27015 value: function updateColors() {
27016 /* Flowchart variables */
27017 this.nodeBkg = this.mainBkg;
27018 this.nodeBorder = this.border1; // border 1
27019
27020 this.clusterBkg = this.secondBkg;
27021 this.clusterBorder = this.border2;
27022 this.defaultLinkColor = this.lineColor;
27023 this.titleColor = this.textColor;
27024 this.edgeLabelBackground = this.labelBackground;
27025 /* Sequence Diagram variables */
27026 // this.actorBorder = lighten(this.border1, 0.5);
27027
27028 this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
27029 this.actorBkg = this.mainBkg;
27030 this.labelBoxBkgColor = this.actorBkg;
27031 this.signalColor = this.textColor;
27032 this.signalTextColor = this.textColor;
27033 this.labelBoxBorderColor = this.actorBorder;
27034 this.labelTextColor = this.actorTextColor;
27035 this.loopTextColor = this.actorTextColor;
27036 this.noteBorderColor = this.border2;
27037 this.noteTextColor = this.actorTextColor;
27038 /* Gantt chart variables */
27039
27040 this.taskTextColor = this.taskTextLightColor;
27041 this.taskTextOutsideColor = this.taskTextDarkColor;
27042 /* state colors */
27043
27044 this.transitionColor = this.transitionColor || this.lineColor;
27045 this.transitionLabelColor = this.transitionLabelColor || this.textColor;
27046 this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
27047 this.stateBkg = this.stateBkg || this.mainBkg;
27048 this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
27049 this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
27050 this.altBackground = this.altBackground || '#f0f0f0';
27051 this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
27052 this.compositeBorder = this.compositeBorder || this.nodeBorder;
27053 this.innerEndBackground = this.nodeBorder;
27054 this.specialStateColor = this.lineColor;
27055 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
27056 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
27057 this.transitionColor = this.transitionColor || this.lineColor;
27058 /* class */
27059
27060 this.classText = this.primaryTextColor;
27061 /* journey */
27062
27063 this.fillType0 = this.primaryColor;
27064 this.fillType1 = this.secondaryColor;
27065 this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27066 h: 64
27067 });
27068 this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27069 h: 64
27070 });
27071 this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27072 h: -64
27073 });
27074 this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27075 h: -64
27076 });
27077 this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27078 h: 128
27079 });
27080 this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27081 h: 128
27082 });
27083 /* pie */
27084
27085 this.pie1 = this.pie1 || this.primaryColor;
27086 this.pie2 = this.pie2 || this.secondaryColor;
27087 this.pie3 = this.pie3 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
27088 l: -40
27089 });
27090 this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27091 l: -10
27092 });
27093 this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27094 l: -30
27095 });
27096 this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
27097 l: -20
27098 });
27099 this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27100 h: +60,
27101 l: -20
27102 });
27103 this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27104 h: -60,
27105 l: -40
27106 });
27107 this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27108 h: 120,
27109 l: -40
27110 });
27111 this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27112 h: +60,
27113 l: -40
27114 });
27115 this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27116 h: -90,
27117 l: -40
27118 });
27119 this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27120 h: 120,
27121 l: -30
27122 });
27123 this.pieTitleTextSize = this.pieTitleTextSize || '25px';
27124 this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
27125 this.pieSectionTextSize = this.pieSectionTextSize || '17px';
27126 this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
27127 this.pieLegendTextSize = this.pieLegendTextSize || '17px';
27128 this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
27129 this.pieStrokeColor = this.pieStrokeColor || 'black';
27130 this.pieStrokeWidth = this.pieStrokeWidth || '2px';
27131 this.pieOpacity = this.pieOpacity || '0.7';
27132 /* requirement-diagram */
27133
27134 this.requirementBackground = this.requirementBackground || this.primaryColor;
27135 this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
27136 this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
27137 this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
27138 this.relationColor = this.relationColor || this.lineColor;
27139 this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
27140 this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
27141 }
27142 }, {
27143 key: "calculate",
27144 value: function calculate(overrides) {
27145 var _this = this;
27146
27147 if (_typeof(overrides) !== 'object') {
27148 // Calculate colors form base colors
27149 this.updateColors();
27150 return;
27151 }
27152
27153 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
27154
27155 keys.forEach(function (k) {
27156 _this[k] = overrides[k];
27157 }); // Calculate colors form base colors
27158
27159 this.updateColors(); // Copy values from overrides again in case of an override of derived value
27160
27161 keys.forEach(function (k) {
27162 _this[k] = overrides[k];
27163 });
27164 }
27165 }]);
27166
27167 return Theme;
27168}();
27169
27170var getThemeVariables = function getThemeVariables(userOverrides) {
27171 var theme = new Theme();
27172 theme.calculate(userOverrides);
27173 return theme;
27174};
27175
27176/***/ }),
27177
27178/***/ "./src/themes/theme-forest.js":
27179/*!************************************!*\
27180 !*** ./src/themes/theme-forest.js ***!
27181 \************************************/
27182/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
27183
27184"use strict";
27185__webpack_require__.r(__webpack_exports__);
27186/* harmony export */ __webpack_require__.d(__webpack_exports__, {
27187/* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
27188/* harmony export */ });
27189/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
27190/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
27191/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
27192function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
27193
27194function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27195
27196function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27197
27198function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27199
27200
27201
27202
27203var Theme = /*#__PURE__*/function () {
27204 function Theme() {
27205 _classCallCheck(this, Theme);
27206
27207 /* Base vales */
27208 this.background = '#f4f4f4';
27209 this.primaryColor = '#cde498';
27210 this.secondaryColor = '#cdffb2';
27211 this.background = 'white';
27212 this.mainBkg = '#cde498';
27213 this.secondBkg = '#cdffb2';
27214 this.lineColor = 'green';
27215 this.border1 = '#13540c';
27216 this.border2 = '#6eaa49';
27217 this.arrowheadColor = 'green';
27218 this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
27219 this.fontSize = '16px';
27220 this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)('#cde498', 10);
27221 this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
27222 this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
27223 this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode);
27224 this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
27225 this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
27226 this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
27227 this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
27228 this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
27229 /* Flowchart variables */
27230
27231 this.nodeBkg = 'calculated';
27232 this.nodeBorder = 'calculated';
27233 this.clusterBkg = 'calculated';
27234 this.clusterBorder = 'calculated';
27235 this.defaultLinkColor = 'calculated';
27236 this.titleColor = '#333';
27237 this.edgeLabelBackground = '#e8e8e8';
27238 /* Sequence Diagram variables */
27239
27240 this.actorBorder = 'calculated';
27241 this.actorBkg = 'calculated';
27242 this.actorTextColor = 'black';
27243 this.actorLineColor = 'grey';
27244 this.signalColor = '#333';
27245 this.signalTextColor = '#333';
27246 this.labelBoxBkgColor = 'calculated';
27247 this.labelBoxBorderColor = '#326932';
27248 this.labelTextColor = 'calculated';
27249 this.loopTextColor = 'calculated';
27250 this.noteBorderColor = 'calculated';
27251 this.noteBkgColor = '#fff5ad';
27252 this.noteTextColor = 'calculated';
27253 this.activationBorderColor = '#666';
27254 this.activationBkgColor = '#f4f4f4';
27255 this.sequenceNumberColor = 'white';
27256 /* Gantt chart variables */
27257
27258 this.sectionBkgColor = '#6eaa49';
27259 this.altSectionBkgColor = 'white';
27260 this.sectionBkgColor2 = '#6eaa49';
27261 this.excludeBkgColor = '#eeeeee';
27262 this.taskBorderColor = 'calculated';
27263 this.taskBkgColor = '#487e3a';
27264 this.taskTextLightColor = 'white';
27265 this.taskTextColor = 'calculated';
27266 this.taskTextDarkColor = 'black';
27267 this.taskTextOutsideColor = 'calculated';
27268 this.taskTextClickableColor = '#003163';
27269 this.activeTaskBorderColor = 'calculated';
27270 this.activeTaskBkgColor = 'calculated';
27271 this.gridColor = 'lightgrey';
27272 this.doneTaskBkgColor = 'lightgrey';
27273 this.doneTaskBorderColor = 'grey';
27274 this.critBorderColor = '#ff8888';
27275 this.critBkgColor = 'red';
27276 this.todayLineColor = 'red';
27277 /* state colors */
27278
27279 this.labelColor = 'black';
27280 this.errorBkgColor = '#552222';
27281 this.errorTextColor = '#552222';
27282 }
27283
27284 _createClass(Theme, [{
27285 key: "updateColors",
27286 value: function updateColors() {
27287 /* Flowchart variables */
27288 this.nodeBkg = this.mainBkg;
27289 this.nodeBorder = this.border1;
27290 this.clusterBkg = this.secondBkg;
27291 this.clusterBorder = this.border2;
27292 this.defaultLinkColor = this.lineColor;
27293 /* Sequence Diagram variables */
27294
27295 this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.mainBkg, 20);
27296 this.actorBkg = this.mainBkg;
27297 this.labelBoxBkgColor = this.actorBkg;
27298 this.labelTextColor = this.actorTextColor;
27299 this.loopTextColor = this.actorTextColor;
27300 this.noteBorderColor = this.border2;
27301 this.noteTextColor = this.actorTextColor;
27302 /* Gantt chart variables */
27303
27304 this.taskBorderColor = this.border1;
27305 this.taskTextColor = this.taskTextLightColor;
27306 this.taskTextOutsideColor = this.taskTextDarkColor;
27307 this.activeTaskBorderColor = this.taskBorderColor;
27308 this.activeTaskBkgColor = this.mainBkg;
27309 /* state colors */
27310
27311 this.transitionColor = this.transitionColor || this.lineColor;
27312 this.transitionLabelColor = this.transitionLabelColor || this.textColor;
27313 this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
27314 this.stateBkg = this.stateBkg || this.mainBkg;
27315 this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
27316 this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
27317 this.altBackground = this.altBackground || '#f0f0f0';
27318 this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
27319 this.compositeBorder = this.compositeBorder || this.nodeBorder;
27320 this.innerEndBackground = this.primaryBorderColor;
27321 this.specialStateColor = this.lineColor;
27322 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
27323 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
27324 this.transitionColor = this.transitionColor || this.lineColor;
27325 /* class */
27326
27327 this.classText = this.primaryTextColor;
27328 /* journey */
27329
27330 this.fillType0 = this.primaryColor;
27331 this.fillType1 = this.secondaryColor;
27332 this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27333 h: 64
27334 });
27335 this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27336 h: 64
27337 });
27338 this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27339 h: -64
27340 });
27341 this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27342 h: -64
27343 });
27344 this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27345 h: 128
27346 });
27347 this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27348 h: 128
27349 });
27350 /* pie */
27351
27352 this.pie1 = this.pie1 || this.primaryColor;
27353 this.pie2 = this.pie2 || this.secondaryColor;
27354 this.pie3 = this.pie3 || this.tertiaryColor;
27355 this.pie4 = this.pie4 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27356 l: -30
27357 });
27358 this.pie5 = this.pie5 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27359 l: -30
27360 });
27361 this.pie6 = this.pie6 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.tertiaryColor, {
27362 h: +40,
27363 l: -40
27364 });
27365 this.pie7 = this.pie7 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27366 h: +60,
27367 l: -10
27368 });
27369 this.pie8 = this.pie8 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27370 h: -60,
27371 l: -10
27372 });
27373 this.pie9 = this.pie9 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27374 h: 120,
27375 l: 0
27376 });
27377 this.pie10 = this.pie10 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27378 h: +60,
27379 l: -50
27380 });
27381 this.pie11 = this.pie11 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27382 h: -60,
27383 l: -50
27384 });
27385 this.pie12 = this.pie12 || (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27386 h: 120,
27387 l: -50
27388 });
27389 this.pieTitleTextSize = this.pieTitleTextSize || '25px';
27390 this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
27391 this.pieSectionTextSize = this.pieSectionTextSize || '17px';
27392 this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
27393 this.pieLegendTextSize = this.pieLegendTextSize || '17px';
27394 this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
27395 this.pieStrokeColor = this.pieStrokeColor || 'black';
27396 this.pieStrokeWidth = this.pieStrokeWidth || '2px';
27397 this.pieOpacity = this.pieOpacity || '0.7';
27398 /* requirement-diagram */
27399
27400 this.requirementBackground = this.requirementBackground || this.primaryColor;
27401 this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
27402 this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
27403 this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
27404 this.relationColor = this.relationColor || this.lineColor;
27405 this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
27406 this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
27407 }
27408 }, {
27409 key: "calculate",
27410 value: function calculate(overrides) {
27411 var _this = this;
27412
27413 if (_typeof(overrides) !== 'object') {
27414 // Calculate colors form base colors
27415 this.updateColors();
27416 return;
27417 }
27418
27419 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
27420
27421 keys.forEach(function (k) {
27422 _this[k] = overrides[k];
27423 }); // Calculate colors form base colors
27424
27425 this.updateColors(); // Copy values from overrides again in case of an override of derived value
27426
27427 keys.forEach(function (k) {
27428 _this[k] = overrides[k];
27429 });
27430 }
27431 }]);
27432
27433 return Theme;
27434}();
27435
27436var getThemeVariables = function getThemeVariables(userOverrides) {
27437 var theme = new Theme();
27438 theme.calculate(userOverrides);
27439 return theme;
27440};
27441
27442/***/ }),
27443
27444/***/ "./src/themes/theme-helpers.js":
27445/*!*************************************!*\
27446 !*** ./src/themes/theme-helpers.js ***!
27447 \*************************************/
27448/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
27449
27450"use strict";
27451__webpack_require__.r(__webpack_exports__);
27452/* harmony export */ __webpack_require__.d(__webpack_exports__, {
27453/* harmony export */ "mkBorder": () => (/* binding */ mkBorder)
27454/* harmony export */ });
27455/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
27456/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
27457
27458var mkBorder = function mkBorder(col, darkMode) {
27459 return darkMode ? (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
27460 s: -40,
27461 l: 10
27462 }) : (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(col, {
27463 s: -40,
27464 l: -10
27465 });
27466};
27467
27468/***/ }),
27469
27470/***/ "./src/themes/theme-neutral.js":
27471/*!*************************************!*\
27472 !*** ./src/themes/theme-neutral.js ***!
27473 \*************************************/
27474/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
27475
27476"use strict";
27477__webpack_require__.r(__webpack_exports__);
27478/* harmony export */ __webpack_require__.d(__webpack_exports__, {
27479/* harmony export */ "getThemeVariables": () => (/* binding */ getThemeVariables)
27480/* harmony export */ });
27481/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! khroma */ "khroma");
27482/* harmony import */ var khroma__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(khroma__WEBPACK_IMPORTED_MODULE_0__);
27483/* harmony import */ var _theme_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./theme-helpers */ "./src/themes/theme-helpers.js");
27484function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
27485
27486function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27487
27488function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27489
27490function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27491
27492
27493 // const Color = require ( 'khroma/dist/color' ).default
27494// Color.format.hex.stringify(Color.parse('hsl(210, 66.6666666667%, 95%)')); // => "#EAF2FB"
27495
27496var Theme = /*#__PURE__*/function () {
27497 function Theme() {
27498 _classCallCheck(this, Theme);
27499
27500 this.primaryColor = '#eee';
27501 this.contrast = '#707070';
27502 this.secondaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
27503 this.background = '#ffffff'; // this.secondaryColor = adjust(this.primaryColor, { h: 120 });
27504
27505 this.tertiaryColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27506 h: -160
27507 });
27508 this.primaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.primaryColor, this.darkMode);
27509 this.secondaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.secondaryColor, this.darkMode);
27510 this.tertiaryBorderColor = (0,_theme_helpers__WEBPACK_IMPORTED_MODULE_1__.mkBorder)(this.tertiaryColor, this.darkMode); // this.noteBorderColor = mkBorder(this.noteBkgColor, this.darkMode);
27511
27512 this.primaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.primaryColor);
27513 this.secondaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.secondaryColor);
27514 this.tertiaryTextColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.tertiaryColor);
27515 this.lineColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background);
27516 this.textColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.invert)(this.background); // this.altBackground = lighten(this.contrast, 55);
27517
27518 this.mainBkg = '#eee';
27519 this.secondBkg = 'calculated';
27520 this.lineColor = '#666';
27521 this.border1 = '#999';
27522 this.border2 = 'calculated';
27523 this.note = '#ffa';
27524 this.text = '#333';
27525 this.critical = '#d42';
27526 this.done = '#bbb';
27527 this.arrowheadColor = '#333333';
27528 this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
27529 this.fontSize = '16px';
27530 /* Flowchart variables */
27531
27532 this.nodeBkg = 'calculated';
27533 this.nodeBorder = 'calculated';
27534 this.clusterBkg = 'calculated';
27535 this.clusterBorder = 'calculated';
27536 this.defaultLinkColor = 'calculated';
27537 this.titleColor = 'calculated';
27538 this.edgeLabelBackground = 'white';
27539 /* Sequence Diagram variables */
27540
27541 this.actorBorder = 'calculated';
27542 this.actorBkg = 'calculated';
27543 this.actorTextColor = 'calculated';
27544 this.actorLineColor = 'calculated';
27545 this.signalColor = 'calculated';
27546 this.signalTextColor = 'calculated';
27547 this.labelBoxBkgColor = 'calculated';
27548 this.labelBoxBorderColor = 'calculated';
27549 this.labelTextColor = 'calculated';
27550 this.loopTextColor = 'calculated';
27551 this.noteBorderColor = 'calculated';
27552 this.noteBkgColor = 'calculated';
27553 this.noteTextColor = 'calculated';
27554 this.activationBorderColor = '#666';
27555 this.activationBkgColor = '#f4f4f4';
27556 this.sequenceNumberColor = 'white';
27557 /* Gantt chart variables */
27558
27559 this.sectionBkgColor = 'calculated';
27560 this.altSectionBkgColor = 'white';
27561 this.sectionBkgColor2 = 'calculated';
27562 this.excludeBkgColor = '#eeeeee';
27563 this.taskBorderColor = 'calculated';
27564 this.taskBkgColor = 'calculated';
27565 this.taskTextLightColor = 'white';
27566 this.taskTextColor = 'calculated';
27567 this.taskTextDarkColor = 'calculated';
27568 this.taskTextOutsideColor = 'calculated';
27569 this.taskTextClickableColor = '#003163';
27570 this.activeTaskBorderColor = 'calculated';
27571 this.activeTaskBkgColor = 'calculated';
27572 this.gridColor = 'calculated';
27573 this.doneTaskBkgColor = 'calculated';
27574 this.doneTaskBorderColor = 'calculated';
27575 this.critBkgColor = 'calculated';
27576 this.critBorderColor = 'calculated';
27577 this.todayLineColor = 'calculated';
27578 /* state colors */
27579
27580 this.labelColor = 'black';
27581 this.errorBkgColor = '#552222';
27582 this.errorTextColor = '#552222';
27583 }
27584
27585 _createClass(Theme, [{
27586 key: "updateColors",
27587 value: function updateColors() {
27588 this.secondBkg = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 55);
27589 this.border2 = this.contrast;
27590 /* Flowchart variables */
27591
27592 this.nodeBkg = this.mainBkg;
27593 this.nodeBorder = this.border1;
27594 this.clusterBkg = this.secondBkg;
27595 this.clusterBorder = this.border2;
27596 this.defaultLinkColor = this.lineColor;
27597 this.titleColor = this.text;
27598 /* Sequence Diagram variables */
27599
27600 this.actorBorder = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 23);
27601 this.actorBkg = this.mainBkg;
27602 this.actorTextColor = this.text;
27603 this.actorLineColor = this.lineColor;
27604 this.signalColor = this.text;
27605 this.signalTextColor = this.text;
27606 this.labelBoxBkgColor = this.actorBkg;
27607 this.labelBoxBorderColor = this.actorBorder;
27608 this.labelTextColor = this.text;
27609 this.loopTextColor = this.text;
27610 this.noteBorderColor = '#999';
27611 this.noteBkgColor = '#666';
27612 this.noteTextColor = '#fff';
27613 /* Gantt chart variables */
27614
27615 this.sectionBkgColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
27616 this.sectionBkgColor2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.contrast, 30);
27617 this.taskBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.contrast, 10);
27618 this.taskBkgColor = this.contrast;
27619 this.taskTextColor = this.taskTextLightColor;
27620 this.taskTextDarkColor = this.text;
27621 this.taskTextOutsideColor = this.taskTextDarkColor;
27622 this.activeTaskBorderColor = this.taskBorderColor;
27623 this.activeTaskBkgColor = this.mainBkg;
27624 this.gridColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.lighten)(this.border1, 30);
27625 this.doneTaskBkgColor = this.done;
27626 this.doneTaskBorderColor = this.lineColor;
27627 this.critBkgColor = this.critical;
27628 this.critBorderColor = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.darken)(this.critBkgColor, 10);
27629 this.todayLineColor = this.critBkgColor;
27630 /* state colors */
27631
27632 this.transitionColor = this.transitionColor || '#000';
27633 this.transitionLabelColor = this.transitionLabelColor || this.textColor;
27634 this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
27635 this.stateBkg = this.stateBkg || this.mainBkg;
27636 this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
27637 this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
27638 this.altBackground = this.altBackground || '#f4f4f4';
27639 this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
27640 this.stateBorder = this.stateBorder || '#000';
27641 this.innerEndBackground = this.primaryBorderColor;
27642 this.specialStateColor = '#222';
27643 this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
27644 this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
27645 /* class */
27646
27647 this.classText = this.primaryTextColor;
27648 /* journey */
27649
27650 this.fillType0 = this.primaryColor;
27651 this.fillType1 = this.secondaryColor;
27652 this.fillType2 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27653 h: 64
27654 });
27655 this.fillType3 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27656 h: 64
27657 });
27658 this.fillType4 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27659 h: -64
27660 });
27661 this.fillType5 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27662 h: -64
27663 });
27664 this.fillType6 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.primaryColor, {
27665 h: 128
27666 });
27667 this.fillType7 = (0,khroma__WEBPACK_IMPORTED_MODULE_0__.adjust)(this.secondaryColor, {
27668 h: 128
27669 }); // /* pie */
27670
27671 this.pie1 = this.pie1 || '#F4F4F4';
27672 this.pie2 = this.pie2 || '#555';
27673 this.pie3 = this.pie3 || '#BBB';
27674 this.pie4 = this.pie4 || '#777';
27675 this.pie5 = this.pie5 || '#999';
27676 this.pie6 = this.pie6 || '#DDD';
27677 this.pie7 = this.pie7 || '#FFF';
27678 this.pie8 = this.pie8 || '#DDD';
27679 this.pie9 = this.pie9 || '#BBB';
27680 this.pie10 = this.pie10 || '#999';
27681 this.pie11 = this.pie11 || '#777';
27682 this.pie12 = this.pie12 || '#555';
27683 this.pieTitleTextSize = this.pieTitleTextSize || '25px';
27684 this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
27685 this.pieSectionTextSize = this.pieSectionTextSize || '17px';
27686 this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
27687 this.pieLegendTextSize = this.pieLegendTextSize || '17px';
27688 this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
27689 this.pieStrokeColor = this.pieStrokeColor || 'black';
27690 this.pieStrokeWidth = this.pieStrokeWidth || '2px';
27691 this.pieOpacity = this.pieOpacity || '0.7'; // this.pie1 = this.pie1 || '#212529';
27692 // this.pie2 = this.pie2 || '#343A40';
27693 // this.pie3 = this.pie3 || '#495057';
27694 // this.pie4 = this.pie4 || '#6C757D';
27695 // this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });
27696 // this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });
27697 // this.pie7 = this.pie7 || adjust(this.primaryColor, { h: +60, l: -10 });
27698 // this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
27699 // this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
27700 // this.pie10 = this.pie10 || adjust(this.primaryColor, { h: +60, l: -20 });
27701 // this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });
27702 // this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });
27703
27704 /* requirement-diagram */
27705
27706 this.requirementBackground = this.requirementBackground || this.primaryColor;
27707 this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
27708 this.requirementBorderSize = this.requirementBorderSize || this.primaryBorderColor;
27709 this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
27710 this.relationColor = this.relationColor || this.lineColor;
27711 this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
27712 this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
27713 }
27714 }, {
27715 key: "calculate",
27716 value: function calculate(overrides) {
27717 var _this = this;
27718
27719 if (_typeof(overrides) !== 'object') {
27720 // Calculate colors form base colors
27721 this.updateColors();
27722 return;
27723 }
27724
27725 var keys = Object.keys(overrides); // Copy values from overrides, this is mainly for base colors
27726
27727 keys.forEach(function (k) {
27728 _this[k] = overrides[k];
27729 }); // Calculate colors form base colors
27730
27731 this.updateColors(); // Copy values from overrides again in case of an override of derived value
27732
27733 keys.forEach(function (k) {
27734 _this[k] = overrides[k];
27735 });
27736 }
27737 }]);
27738
27739 return Theme;
27740}();
27741
27742var getThemeVariables = function getThemeVariables(userOverrides) {
27743 var theme = new Theme();
27744 theme.calculate(userOverrides);
27745 return theme;
27746};
27747
27748/***/ }),
27749
27750/***/ "./src/utils.js":
27751/*!**********************!*\
27752 !*** ./src/utils.js ***!
27753 \**********************/
27754/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
27755
27756"use strict";
27757__webpack_require__.r(__webpack_exports__);
27758/* harmony export */ __webpack_require__.d(__webpack_exports__, {
27759/* harmony export */ "detectInit": () => (/* binding */ detectInit),
27760/* harmony export */ "detectDirective": () => (/* binding */ detectDirective),
27761/* harmony export */ "detectType": () => (/* binding */ detectType),
27762/* harmony export */ "isSubstringInArray": () => (/* binding */ isSubstringInArray),
27763/* harmony export */ "interpolateToCurve": () => (/* binding */ interpolateToCurve),
27764/* harmony export */ "formatUrl": () => (/* binding */ formatUrl),
27765/* harmony export */ "runFunc": () => (/* binding */ runFunc),
27766/* harmony export */ "getStylesFromArray": () => (/* binding */ getStylesFromArray),
27767/* harmony export */ "generateId": () => (/* binding */ generateId),
27768/* harmony export */ "random": () => (/* binding */ random),
27769/* harmony export */ "assignWithDepth": () => (/* binding */ assignWithDepth),
27770/* harmony export */ "getTextObj": () => (/* binding */ getTextObj),
27771/* harmony export */ "drawSimpleText": () => (/* binding */ drawSimpleText),
27772/* harmony export */ "wrapLabel": () => (/* binding */ wrapLabel),
27773/* harmony export */ "calculateTextHeight": () => (/* binding */ calculateTextHeight),
27774/* harmony export */ "calculateTextWidth": () => (/* binding */ calculateTextWidth),
27775/* harmony export */ "calculateTextDimensions": () => (/* binding */ calculateTextDimensions),
27776/* harmony export */ "calculateSvgSizeAttrs": () => (/* binding */ calculateSvgSizeAttrs),
27777/* harmony export */ "configureSvgSize": () => (/* binding */ configureSvgSize),
27778/* harmony export */ "initIdGeneratior": () => (/* binding */ initIdGeneratior),
27779/* harmony export */ "entityDecode": () => (/* binding */ entityDecode),
27780/* harmony export */ "directiveSanitizer": () => (/* binding */ directiveSanitizer),
27781/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
27782/* harmony export */ });
27783/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @braintree/sanitize-url */ "@braintree/sanitize-url");
27784/* harmony import */ var _braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__);
27785/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! d3 */ "d3");
27786/* harmony import */ var d3__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(d3__WEBPACK_IMPORTED_MODULE_1__);
27787/* harmony import */ var _diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./diagrams/common/common */ "./src/diagrams/common/common.js");
27788/* harmony import */ var _defaultConfig__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultConfig */ "./src/defaultConfig.js");
27789/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./logger */ "./src/logger.js");
27790var _this = undefined;
27791
27792function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27793
27794function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
27795
27796function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
27797
27798function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
27799
27800function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
27801
27802function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
27803
27804function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27805
27806function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
27807
27808function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
27809
27810function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
27811
27812function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27813
27814
27815
27816
27817
27818 // Effectively an enum of the supported curve types, accessible by name
27819
27820var d3CurveTypes = {
27821 curveBasis: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasis,
27822 curveBasisClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisClosed,
27823 curveBasisOpen: d3__WEBPACK_IMPORTED_MODULE_1__.curveBasisOpen,
27824 curveLinear: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinear,
27825 curveLinearClosed: d3__WEBPACK_IMPORTED_MODULE_1__.curveLinearClosed,
27826 curveMonotoneX: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneX,
27827 curveMonotoneY: d3__WEBPACK_IMPORTED_MODULE_1__.curveMonotoneY,
27828 curveNatural: d3__WEBPACK_IMPORTED_MODULE_1__.curveNatural,
27829 curveStep: d3__WEBPACK_IMPORTED_MODULE_1__.curveStep,
27830 curveStepAfter: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepAfter,
27831 curveStepBefore: d3__WEBPACK_IMPORTED_MODULE_1__.curveStepBefore
27832};
27833var directive = /[%]{2}[{]\s*(?:(?:(\w+)\s*:|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
27834var directiveWithoutOpen = /\s*(?:(?:(\w+)(?=:):|(\w+))\s*(?:(?:(\w+))|((?:(?![}][%]{2}).|\r?\n)*))?\s*)(?:[}][%]{2})?/gi;
27835var anyComment = /\s*%%.*\n/gm;
27836/**
27837 * @function detectInit
27838 * Detects the init config object from the text
27839 * ```mermaid
27840 * %%{init: {"theme": "debug", "logLevel": 1 }}%%
27841 * graph LR
27842 * a-->b
27843 * b-->c
27844 * c-->d
27845 * d-->e
27846 * e-->f
27847 * f-->g
27848 * g-->h
27849 * ```
27850 * or
27851 * ```mermaid
27852 * %%{initialize: {"theme": "dark", logLevel: "debug" }}%%
27853 * graph LR
27854 * a-->b
27855 * b-->c
27856 * c-->d
27857 * d-->e
27858 * e-->f
27859 * f-->g
27860 * g-->h
27861 * ```
27862 *
27863 * @param {string} text The text defining the graph
27864 * @returns {object} the json object representing the init passed to mermaid.initialize()
27865 */
27866
27867var detectInit = function detectInit(text, cnf) {
27868 var inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
27869 var results = {};
27870
27871 if (Array.isArray(inits)) {
27872 var args = inits.map(function (init) {
27873 return init.args;
27874 });
27875 directiveSanitizer(args);
27876 results = assignWithDepth(results, _toConsumableArray(args));
27877 } else {
27878 results = inits.args;
27879 }
27880
27881 if (results) {
27882 var type = detectType(text, cnf);
27883 ['config'].forEach(function (prop) {
27884 if (typeof results[prop] !== 'undefined') {
27885 if (type === 'flowchart-v2') {
27886 type = 'flowchart';
27887 }
27888
27889 results[type] = results[prop];
27890 delete results[prop];
27891 }
27892 });
27893 } // Todo: refactor this, these results are never used
27894
27895
27896 return results;
27897};
27898/**
27899 * @function detectDirective
27900 * Detects the directive from the text. Text can be single line or multiline. If type is null or omitted
27901 * the first directive encountered in text will be returned
27902 * ```mermaid
27903 * graph LR
27904 * %%{somedirective}%%
27905 * a-->b
27906 * b-->c
27907 * c-->d
27908 * d-->e
27909 * e-->f
27910 * f-->g
27911 * g-->h
27912 * ```
27913 *
27914 * @param {string} text The text defining the graph
27915 * @param {string|RegExp} type The directive to return (default: null)
27916 * @returns {object | Array} An object or Array representing the directive(s): { type: string, args: object|null } matched by the input type
27917 * if a single directive was found, that directive object will be returned.
27918 */
27919
27920var detectDirective = function detectDirective(text) {
27921 var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
27922
27923 try {
27924 var commentWithoutDirectives = new RegExp("[%]{2}(?![{]".concat(directiveWithoutOpen.source, ")(?=[}][%]{2}).*\n"), 'ig');
27925 text = text.trim().replace(commentWithoutDirectives, '').replace(/'/gm, '"');
27926 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug("Detecting diagram directive".concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
27927 var match,
27928 result = [];
27929
27930 while ((match = directive.exec(text)) !== null) {
27931 // This is necessary to avoid infinite loops with zero-width matches
27932 if (match.index === directive.lastIndex) {
27933 directive.lastIndex++;
27934 }
27935
27936 if (match && !type || type && match[1] && match[1].match(type) || type && match[2] && match[2].match(type)) {
27937 var _type = match[1] ? match[1] : match[2];
27938
27939 var args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
27940 result.push({
27941 type: _type,
27942 args: args
27943 });
27944 }
27945 }
27946
27947 if (result.length === 0) {
27948 result.push({
27949 type: text,
27950 args: null
27951 });
27952 }
27953
27954 return result.length === 1 ? result[0] : result;
27955 } catch (error) {
27956 _logger__WEBPACK_IMPORTED_MODULE_2__.log.error("ERROR: ".concat(error.message, " - Unable to parse directive\n ").concat(type !== null ? ' type:' + type : '', " based on the text:").concat(text));
27957 return {
27958 type: null,
27959 args: null
27960 };
27961 }
27962};
27963/**
27964 * @function detectType
27965 * Detects the type of the graph text. Takes into consideration the possible existence of an %%init
27966 * directive
27967 * ```mermaid
27968 * %%{initialize: {"startOnLoad": true, logLevel: "fatal" }}%%
27969 * graph LR
27970 * a-->b
27971 * b-->c
27972 * c-->d
27973 * d-->e
27974 * e-->f
27975 * f-->g
27976 * g-->h
27977 * ```
27978 *
27979 * @param {string} text The text defining the graph
27980 * @param {{ class: { defaultRenderer: string } | undefined; state: { defaultRenderer: string } | undefined; flowchart: { defaultRenderer: string } | undefined; }} [cnf]
27981 * @returns {string} A graph definition key
27982 */
27983
27984var detectType = function detectType(text, cnf) {
27985 text = text.replace(directive, '').replace(anyComment, '\n');
27986
27987 if (text.match(/^\s*sequenceDiagram/)) {
27988 return 'sequence';
27989 }
27990
27991 if (text.match(/^\s*gantt/)) {
27992 return 'gantt';
27993 }
27994
27995 if (text.match(/^\s*classDiagram-v2/)) {
27996 return 'classDiagram';
27997 }
27998
27999 if (text.match(/^\s*classDiagram/)) {
28000 if (cnf && cnf.class && cnf.class.defaultRenderer === 'dagre-wrapper') return 'classDiagram';
28001 return 'class';
28002 }
28003
28004 if (text.match(/^\s*stateDiagram-v2/)) {
28005 return 'stateDiagram';
28006 }
28007
28008 if (text.match(/^\s*stateDiagram/)) {
28009 if (cnf && cnf.class && cnf.state.defaultRenderer === 'dagre-wrapper') return 'stateDiagram';
28010 return 'state';
28011 }
28012
28013 if (text.match(/^\s*gitGraph/)) {
28014 return 'git';
28015 }
28016
28017 if (text.match(/^\s*flowchart/)) {
28018 return 'flowchart-v2';
28019 }
28020
28021 if (text.match(/^\s*info/)) {
28022 return 'info';
28023 }
28024
28025 if (text.match(/^\s*pie/)) {
28026 return 'pie';
28027 }
28028
28029 if (text.match(/^\s*erDiagram/)) {
28030 return 'er';
28031 }
28032
28033 if (text.match(/^\s*journey/)) {
28034 return 'journey';
28035 }
28036
28037 if (text.match(/^\s*requirement/) || text.match(/^\s*requirementDiagram/)) {
28038 return 'requirement';
28039 }
28040
28041 if (cnf && cnf.flowchart && cnf.flowchart.defaultRenderer === 'dagre-wrapper') return 'flowchart-v2';
28042 return 'flowchart';
28043};
28044/**
28045 * Caches results of functions based on input
28046 * @param {Function} fn Function to run
28047 * @param {Function} resolver Function that resolves to an ID given arguments the `fn` takes
28048 * @returns {Function} An optimized caching function
28049 */
28050
28051var memoize = function memoize(fn, resolver) {
28052 var cache = {};
28053 return function () {
28054 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
28055 args[_key] = arguments[_key];
28056 }
28057
28058 var n = resolver ? resolver.apply(_this, args) : args[0];
28059
28060 if (n in cache) {
28061 return cache[n];
28062 } else {
28063 var result = fn.apply(void 0, args);
28064 cache[n] = result;
28065 return result;
28066 }
28067 };
28068};
28069/**
28070 * @function isSubstringInArray
28071 * Detects whether a substring in present in a given array
28072 * @param {string} str The substring to detect
28073 * @param {array} arr The array to search
28074 * @returns {number} the array index containing the substring or -1 if not present
28075 **/
28076
28077
28078var isSubstringInArray = function isSubstringInArray(str, arr) {
28079 for (var i = 0; i < arr.length; i++) {
28080 if (arr[i].match(str)) return i;
28081 }
28082
28083 return -1;
28084};
28085/**
28086 * Returns a d3 curve given a curve name
28087 * @param {string | undefined} interpolate The interpolation name
28088 * @param {*} defaultCurve The default curve to return
28089 * @returns {import('d3-shape').CurveFactory} The curve factory to use
28090 */
28091
28092var interpolateToCurve = function interpolateToCurve(interpolate, defaultCurve) {
28093 if (!interpolate) {
28094 return defaultCurve;
28095 }
28096
28097 var curveName = "curve".concat(interpolate.charAt(0).toUpperCase() + interpolate.slice(1));
28098 return d3CurveTypes[curveName] || defaultCurve;
28099};
28100/**
28101 * Formats a URL string
28102 * @param {string} linkStr String of the URL
28103 * @param {{ securityLevel: string; }} config Configuration passed to MermaidJS
28104 * @returns {string | undefined} The formatted URL
28105 */
28106
28107var formatUrl = function formatUrl(linkStr, config) {
28108 var url = linkStr.trim();
28109
28110 if (url) {
28111 if (config.securityLevel !== 'loose') {
28112 return (0,_braintree_sanitize_url__WEBPACK_IMPORTED_MODULE_0__.sanitizeUrl)(url);
28113 }
28114
28115 return url;
28116 }
28117};
28118/**
28119 * Runs a function
28120 * @param {string} functionName A dot seperated path to the function relative to the `window`
28121 * @param {...any} params Parameters to pass to the function
28122 */
28123
28124var runFunc = function runFunc(functionName) {
28125 var _obj;
28126
28127 var arrPaths = functionName.split('.');
28128 var len = arrPaths.length - 1;
28129 var fnName = arrPaths[len];
28130 var obj = window;
28131
28132 for (var i = 0; i < len; i++) {
28133 obj = obj[arrPaths[i]];
28134 if (!obj) return;
28135 }
28136
28137 for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
28138 params[_key2 - 1] = arguments[_key2];
28139 }
28140
28141 (_obj = obj)[fnName].apply(_obj, params);
28142};
28143/**
28144 * @typedef {Object} Point A (x, y) point
28145 * @property {number} x The x value
28146 * @property {number} y The y value
28147 */
28148
28149/**
28150 * Finds the distance between two points using the Distance Formula
28151 * @param {Point} p1 The first point
28152 * @param {Point} p2 The second point
28153 * @returns {number} The distance
28154 */
28155
28156var distance = function distance(p1, p2) {
28157 return p1 && p2 ? Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2)) : 0;
28158};
28159/**
28160 * @todo Give this a description
28161 * @param {Array<Point>} points List of points
28162 * @returns {Point}
28163 */
28164
28165
28166var traverseEdge = function traverseEdge(points) {
28167 var prevPoint;
28168 var totalDistance = 0;
28169 points.forEach(function (point) {
28170 totalDistance += distance(point, prevPoint);
28171 prevPoint = point;
28172 }); // Traverse half of total distance along points
28173
28174 var remainingDistance = totalDistance / 2;
28175 var center = undefined;
28176 prevPoint = undefined;
28177 points.forEach(function (point) {
28178 if (prevPoint && !center) {
28179 var vectorDistance = distance(point, prevPoint);
28180
28181 if (vectorDistance < remainingDistance) {
28182 remainingDistance -= vectorDistance;
28183 } else {
28184 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
28185 // Calculate the coordinates
28186 var distanceRatio = remainingDistance / vectorDistance;
28187 if (distanceRatio <= 0) center = prevPoint;
28188 if (distanceRatio >= 1) center = {
28189 x: point.x,
28190 y: point.y
28191 };
28192
28193 if (distanceRatio > 0 && distanceRatio < 1) {
28194 center = {
28195 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
28196 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
28197 };
28198 }
28199 }
28200 }
28201
28202 prevPoint = point;
28203 });
28204 return center;
28205};
28206/**
28207 * Alias for `traverseEdge`
28208 * @param {Point[]} points List of points
28209 * @returns {Point} Return result of `transverseEdge`
28210 */
28211
28212
28213var calcLabelPosition = function calcLabelPosition(points) {
28214 return traverseEdge(points);
28215};
28216
28217var calcCardinalityPosition = function calcCardinalityPosition(isRelationTypePresent, points, initialPosition) {
28218 var prevPoint;
28219 var totalDistance = 0; // eslint-disable-line
28220
28221 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points);
28222
28223 if (points[0] !== initialPosition) {
28224 points = points.reverse();
28225 }
28226
28227 points.forEach(function (point) {
28228 totalDistance += distance(point, prevPoint);
28229 prevPoint = point;
28230 }); // Traverse only 25 total distance along points to find cardinality point
28231
28232 var distanceToCardinalityPoint = 25;
28233 var remainingDistance = distanceToCardinalityPoint;
28234 var center;
28235 prevPoint = undefined;
28236 points.forEach(function (point) {
28237 if (prevPoint && !center) {
28238 var vectorDistance = distance(point, prevPoint);
28239
28240 if (vectorDistance < remainingDistance) {
28241 remainingDistance -= vectorDistance;
28242 } else {
28243 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
28244 // Calculate the coordinates
28245 var distanceRatio = remainingDistance / vectorDistance;
28246 if (distanceRatio <= 0) center = prevPoint;
28247 if (distanceRatio >= 1) center = {
28248 x: point.x,
28249 y: point.y
28250 };
28251
28252 if (distanceRatio > 0 && distanceRatio < 1) {
28253 center = {
28254 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
28255 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
28256 };
28257 }
28258 }
28259 }
28260
28261 prevPoint = point;
28262 }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
28263
28264 var d = isRelationTypePresent ? 10 : 5; //Calculate Angle for x and y axis
28265
28266 var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
28267 var cardinalityPosition = {
28268 x: 0,
28269 y: 0
28270 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
28271
28272 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
28273 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
28274 return cardinalityPosition;
28275};
28276/**
28277 * position ['start_left', 'start_right', 'end_left', 'end_right']
28278 */
28279
28280
28281var calcTerminalLabelPosition = function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
28282 // Todo looking to faster cloning method
28283 var points = JSON.parse(JSON.stringify(_points));
28284 var prevPoint;
28285 var totalDistance = 0; // eslint-disable-line
28286
28287 _logger__WEBPACK_IMPORTED_MODULE_2__.log.info('our points', points);
28288
28289 if (position !== 'start_left' && position !== 'start_right') {
28290 points = points.reverse();
28291 }
28292
28293 points.forEach(function (point) {
28294 totalDistance += distance(point, prevPoint);
28295 prevPoint = point;
28296 }); // Traverse only 25 total distance along points to find cardinality point
28297
28298 var distanceToCardinalityPoint = 25 + terminalMarkerSize;
28299 var remainingDistance = distanceToCardinalityPoint;
28300 var center;
28301 prevPoint = undefined;
28302 points.forEach(function (point) {
28303 if (prevPoint && !center) {
28304 var vectorDistance = distance(point, prevPoint);
28305
28306 if (vectorDistance < remainingDistance) {
28307 remainingDistance -= vectorDistance;
28308 } else {
28309 // The point is remainingDistance from prevPoint in the vector between prevPoint and point
28310 // Calculate the coordinates
28311 var distanceRatio = remainingDistance / vectorDistance;
28312 if (distanceRatio <= 0) center = prevPoint;
28313 if (distanceRatio >= 1) center = {
28314 x: point.x,
28315 y: point.y
28316 };
28317
28318 if (distanceRatio > 0 && distanceRatio < 1) {
28319 center = {
28320 x: (1 - distanceRatio) * prevPoint.x + distanceRatio * point.x,
28321 y: (1 - distanceRatio) * prevPoint.y + distanceRatio * point.y
28322 };
28323 }
28324 }
28325 }
28326
28327 prevPoint = point;
28328 }); // if relation is present (Arrows will be added), change cardinality point off-set distance (d)
28329
28330 var d = 10 + terminalMarkerSize * 0.5; //Calculate Angle for x and y axis
28331
28332 var angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
28333 var cardinalityPosition = {
28334 x: 0,
28335 y: 0
28336 }; //Calculation cardinality position using angle, center point on the line/curve but pendicular and with offset-distance
28337
28338 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
28339 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
28340
28341 if (position === 'start_left') {
28342 cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
28343 cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
28344 }
28345
28346 if (position === 'end_right') {
28347 cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
28348 cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
28349 }
28350
28351 if (position === 'end_left') {
28352 cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
28353 cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
28354 }
28355
28356 return cardinalityPosition;
28357};
28358/**
28359 * Gets styles from an array of declarations
28360 * @param {Array<string>} arr Declarations
28361 * @returns {{ style: string; labelStyle: string; }} The styles grouped as strings
28362 */
28363
28364
28365var getStylesFromArray = function getStylesFromArray(arr) {
28366 var style = '';
28367 var labelStyle = '';
28368
28369 for (var i = 0; i < arr.length; i++) {
28370 if (typeof arr[i] !== 'undefined') {
28371 // add text properties to label style definition
28372 if (arr[i].startsWith('color:') || arr[i].startsWith('text-align:')) {
28373 labelStyle = labelStyle + arr[i] + ';';
28374 } else {
28375 style = style + arr[i] + ';';
28376 }
28377 }
28378 }
28379
28380 return {
28381 style: style,
28382 labelStyle: labelStyle
28383 };
28384};
28385var cnt = 0;
28386var generateId = function generateId() {
28387 cnt++;
28388 return 'id-' + Math.random().toString(36).substr(2, 12) + '-' + cnt;
28389};
28390
28391function makeid(length) {
28392 var result = '';
28393 var characters = '0123456789abcdef';
28394 var charactersLength = characters.length;
28395
28396 for (var i = 0; i < length; i++) {
28397 result += characters.charAt(Math.floor(Math.random() * charactersLength));
28398 }
28399
28400 return result;
28401}
28402
28403var random = function random(options) {
28404 return makeid(options.length);
28405};
28406/**
28407 * @function assignWithDepth
28408 * Extends the functionality of {@link ObjectConstructor.assign} with the ability to merge arbitrary-depth objects
28409 * For each key in src with path `k` (recursively) performs an Object.assign(dst[`k`], src[`k`]) with
28410 * a slight change from the typical handling of undefined for dst[`k`]: instead of raising an error,
28411 * dst[`k`] is auto-initialized to {} and effectively merged with src[`k`]
28412 * <p>
28413 * Additionally, dissimilar types will not clobber unless the config.clobber parameter === true. Example:
28414 * ```
28415 * let config_0 = { foo: { bar: 'bar' }, bar: 'foo' };
28416 * let config_1 = { foo: 'foo', bar: 'bar' };
28417 * let result = assignWithDepth(config_0, config_1);
28418 * console.log(result);
28419 * //-> result: { foo: { bar: 'bar' }, bar: 'bar' }
28420 * ```
28421 * <p>
28422 * Traditional Object.assign would have clobbered foo in config_0 with foo in config_1.
28423 * <p>
28424 * If src is a destructured array of objects and dst is not an array, assignWithDepth will apply each element of src to dst
28425 * in order.
28426 * @param {any} dst - the destination of the merge
28427 * @param {any} src - the source object(s) to merge into destination
28428 * @param {{ depth: number, clobber: boolean }} [config={ depth: 2, clobber: false }] - depth: depth to traverse within src and dst for merging -
28429 * clobber: should dissimilar types clobber (default: { depth: 2, clobber: false })
28430 * @returns {*}
28431 */
28432
28433var assignWithDepth = function assignWithDepth(dst, src, config) {
28434 var _Object$assign = Object.assign({
28435 depth: 2,
28436 clobber: false
28437 }, config),
28438 depth = _Object$assign.depth,
28439 clobber = _Object$assign.clobber;
28440
28441 if (Array.isArray(src) && !Array.isArray(dst)) {
28442 src.forEach(function (s) {
28443 return assignWithDepth(dst, s, config);
28444 });
28445 return dst;
28446 } else if (Array.isArray(src) && Array.isArray(dst)) {
28447 src.forEach(function (s) {
28448 if (dst.indexOf(s) === -1) {
28449 dst.push(s);
28450 }
28451 });
28452 return dst;
28453 }
28454
28455 if (typeof dst === 'undefined' || depth <= 0) {
28456 if (dst !== undefined && dst !== null && _typeof(dst) === 'object' && _typeof(src) === 'object') {
28457 return Object.assign(dst, src);
28458 } else {
28459 return src;
28460 }
28461 }
28462
28463 if (typeof src !== 'undefined' && _typeof(dst) === 'object' && _typeof(src) === 'object') {
28464 Object.keys(src).forEach(function (key) {
28465 if (_typeof(src[key]) === 'object' && (dst[key] === undefined || _typeof(dst[key]) === 'object')) {
28466 if (dst[key] === undefined) {
28467 dst[key] = Array.isArray(src[key]) ? [] : {};
28468 }
28469
28470 dst[key] = assignWithDepth(dst[key], src[key], {
28471 depth: depth - 1,
28472 clobber: clobber
28473 });
28474 } else if (clobber || _typeof(dst[key]) !== 'object' && _typeof(src[key]) !== 'object') {
28475 dst[key] = src[key];
28476 }
28477 });
28478 }
28479
28480 return dst;
28481};
28482var getTextObj = function getTextObj() {
28483 return {
28484 x: 0,
28485 y: 0,
28486 fill: undefined,
28487 anchor: 'start',
28488 style: '#666',
28489 width: 100,
28490 height: 100,
28491 textMargin: 0,
28492 rx: 0,
28493 ry: 0,
28494 valign: undefined
28495 };
28496};
28497/**
28498 * Adds text to an element
28499 * @param {SVGElement} elem Element to add text to
28500 * @param {{ text: string; x: number; y: number; anchor: "start" | "middle" | "end"; fontFamily: string; fontSize: string | number; fontWeight: string | number; fill: string; class: string | undefined; textMargin: number; }} textData
28501 * @returns {SVGTextElement} Text element with given styling and content
28502 */
28503
28504var drawSimpleText = function drawSimpleText(elem, textData) {
28505 // Remove and ignore br:s
28506 var nText = textData.text.replace(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex, ' ');
28507 var textElem = elem.append('text');
28508 textElem.attr('x', textData.x);
28509 textElem.attr('y', textData.y);
28510 textElem.style('text-anchor', textData.anchor);
28511 textElem.style('font-family', textData.fontFamily);
28512 textElem.style('font-size', textData.fontSize);
28513 textElem.style('font-weight', textData.fontWeight);
28514 textElem.attr('fill', textData.fill);
28515
28516 if (typeof textData.class !== 'undefined') {
28517 textElem.attr('class', textData.class);
28518 }
28519
28520 var span = textElem.append('tspan');
28521 span.attr('x', textData.x + textData.textMargin * 2);
28522 span.attr('fill', textData.fill);
28523 span.text(nText);
28524 return textElem;
28525};
28526var wrapLabel = memoize(function (label, maxWidth, config) {
28527 if (!label) {
28528 return label;
28529 }
28530
28531 config = Object.assign({
28532 fontSize: 12,
28533 fontWeight: 400,
28534 fontFamily: 'Arial',
28535 joinWith: '<br/>'
28536 }, config);
28537
28538 if (_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex.test(label)) {
28539 return label;
28540 }
28541
28542 var words = label.split(' ');
28543 var completedLines = [];
28544 var nextLine = '';
28545 words.forEach(function (word, index) {
28546 var wordLength = calculateTextWidth("".concat(word, " "), config);
28547 var nextLineLength = calculateTextWidth(nextLine, config);
28548
28549 if (wordLength > maxWidth) {
28550 var _breakString = breakString(word, maxWidth, '-', config),
28551 hyphenatedStrings = _breakString.hyphenatedStrings,
28552 remainingWord = _breakString.remainingWord;
28553
28554 completedLines.push.apply(completedLines, [nextLine].concat(_toConsumableArray(hyphenatedStrings)));
28555 nextLine = remainingWord;
28556 } else if (nextLineLength + wordLength >= maxWidth) {
28557 completedLines.push(nextLine);
28558 nextLine = word;
28559 } else {
28560 nextLine = [nextLine, word].filter(Boolean).join(' ');
28561 }
28562
28563 var currentWord = index + 1;
28564 var isLastWord = currentWord === words.length;
28565
28566 if (isLastWord) {
28567 completedLines.push(nextLine);
28568 }
28569 });
28570 return completedLines.filter(function (line) {
28571 return line !== '';
28572 }).join(config.joinWith);
28573}, function (label, maxWidth, config) {
28574 return "".concat(label, "-").concat(maxWidth, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily, "-").concat(config.joinWith);
28575});
28576var breakString = memoize(function (word, maxWidth) {
28577 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
28578 var config = arguments.length > 3 ? arguments[3] : undefined;
28579 config = Object.assign({
28580 fontSize: 12,
28581 fontWeight: 400,
28582 fontFamily: 'Arial',
28583 margin: 0
28584 }, config);
28585 var characters = word.split('');
28586 var lines = [];
28587 var currentLine = '';
28588 characters.forEach(function (character, index) {
28589 var nextLine = "".concat(currentLine).concat(character);
28590 var lineWidth = calculateTextWidth(nextLine, config);
28591
28592 if (lineWidth >= maxWidth) {
28593 var currentCharacter = index + 1;
28594 var isLastLine = characters.length === currentCharacter;
28595 var hyphenatedNextLine = "".concat(nextLine).concat(hyphenCharacter);
28596 lines.push(isLastLine ? nextLine : hyphenatedNextLine);
28597 currentLine = '';
28598 } else {
28599 currentLine = nextLine;
28600 }
28601 });
28602 return {
28603 hyphenatedStrings: lines,
28604 remainingWord: currentLine
28605 };
28606}, function (word, maxWidth) {
28607 var hyphenCharacter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
28608 var config = arguments.length > 3 ? arguments[3] : undefined;
28609 return "".concat(word, "-").concat(maxWidth, "-").concat(hyphenCharacter, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
28610});
28611/**
28612 * This calculates the text's height, taking into account the wrap breaks and
28613 * both the statically configured height, width, and the length of the text (in pixels).
28614 *
28615 * If the wrapped text text has greater height, we extend the height, so it's
28616 * value won't overflow.
28617 *
28618 * @return - The height for the given text
28619 * @param text the text to measure
28620 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
28621 */
28622
28623var calculateTextHeight = function calculateTextHeight(text, config) {
28624 config = Object.assign({
28625 fontSize: 12,
28626 fontWeight: 400,
28627 fontFamily: 'Arial',
28628 margin: 15
28629 }, config);
28630 return calculateTextDimensions(text, config).height;
28631};
28632/**
28633 * This calculates the width of the given text, font size and family.
28634 *
28635 * @return - The width for the given text
28636 * @param text - The text to calculate the width of
28637 * @param config - the config for fontSize, fontFamily, and fontWeight all impacting the resulting size
28638 */
28639
28640var calculateTextWidth = function calculateTextWidth(text, config) {
28641 config = Object.assign({
28642 fontSize: 12,
28643 fontWeight: 400,
28644 fontFamily: 'Arial'
28645 }, config);
28646 return calculateTextDimensions(text, config).width;
28647};
28648/**
28649 * This calculates the dimensions of the given text, font size, font family, font weight, and margins.
28650 *
28651 * @return - The width for the given text
28652 * @param text - The text to calculate the width of
28653 * @param config - the config for fontSize, fontFamily, fontWeight, and margin all impacting the resulting size
28654 */
28655
28656var calculateTextDimensions = memoize(function (text, config) {
28657 config = Object.assign({
28658 fontSize: 12,
28659 fontWeight: 400,
28660 fontFamily: 'Arial'
28661 }, config);
28662 var _config = config,
28663 fontSize = _config.fontSize,
28664 fontFamily = _config.fontFamily,
28665 fontWeight = _config.fontWeight;
28666
28667 if (!text) {
28668 return {
28669 width: 0,
28670 height: 0
28671 };
28672 } // We can't really know if the user supplied font family will render on the user agent;
28673 // thus, we'll take the max width between the user supplied font family, and a default
28674 // of sans-serif.
28675
28676
28677 var fontFamilies = ['sans-serif', fontFamily];
28678 var lines = text.split(_diagrams_common_common__WEBPACK_IMPORTED_MODULE_3__["default"].lineBreakRegex);
28679 var dims = [];
28680 var body = (0,d3__WEBPACK_IMPORTED_MODULE_1__.select)('body'); // We don't want to leak DOM elements - if a removal operation isn't available
28681 // for any reason, do not continue.
28682
28683 if (!body.remove) {
28684 return {
28685 width: 0,
28686 height: 0,
28687 lineHeight: 0
28688 };
28689 }
28690
28691 var g = body.append('svg');
28692
28693 for (var _i = 0, _fontFamilies = fontFamilies; _i < _fontFamilies.length; _i++) {
28694 var _fontFamily = _fontFamilies[_i];
28695 var cheight = 0;
28696 var dim = {
28697 width: 0,
28698 height: 0,
28699 lineHeight: 0
28700 };
28701
28702 var _iterator = _createForOfIteratorHelper(lines),
28703 _step;
28704
28705 try {
28706 for (_iterator.s(); !(_step = _iterator.n()).done;) {
28707 var line = _step.value;
28708 var textObj = getTextObj();
28709 textObj.text = line;
28710 var textElem = drawSimpleText(g, textObj).style('font-size', fontSize).style('font-weight', fontWeight).style('font-family', _fontFamily);
28711 var bBox = (textElem._groups || textElem)[0][0].getBBox();
28712 dim.width = Math.round(Math.max(dim.width, bBox.width));
28713 cheight = Math.round(bBox.height);
28714 dim.height += cheight;
28715 dim.lineHeight = Math.round(Math.max(dim.lineHeight, cheight));
28716 }
28717 } catch (err) {
28718 _iterator.e(err);
28719 } finally {
28720 _iterator.f();
28721 }
28722
28723 dims.push(dim);
28724 }
28725
28726 g.remove();
28727 var index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
28728 return dims[index];
28729}, function (text, config) {
28730 return "".concat(text, "-").concat(config.fontSize, "-").concat(config.fontWeight, "-").concat(config.fontFamily);
28731});
28732/**
28733 * Applys d3 attributes
28734 * @param {*} d3Elem d3 Element to apply the attributes onto
28735 * @param {Array<[string, string]>} attrs Object.keys equivalent format of key to value mapping of attributes
28736 */
28737
28738var d3Attrs = function d3Attrs(d3Elem, attrs) {
28739 var _iterator2 = _createForOfIteratorHelper(attrs),
28740 _step2;
28741
28742 try {
28743 for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
28744 var attr = _step2.value;
28745 d3Elem.attr(attr[0], attr[1]);
28746 }
28747 } catch (err) {
28748 _iterator2.e(err);
28749 } finally {
28750 _iterator2.f();
28751 }
28752};
28753/**
28754 * Gives attributes for an SVG's size given arguments
28755 * @param {number} height The height of the SVG
28756 * @param {number} width The width of the SVG
28757 * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%
28758 * @returns {Map<'height' | 'width' | 'style', string>} Attributes for the SVG
28759 */
28760
28761
28762var calculateSvgSizeAttrs = function calculateSvgSizeAttrs(height, width, useMaxWidth) {
28763 var attrs = new Map();
28764 attrs.set('height', height);
28765
28766 if (useMaxWidth) {
28767 attrs.set('width', '100%');
28768 attrs.set('style', "max-width: ".concat(width, "px;"));
28769 } else {
28770 attrs.set('width', width);
28771 }
28772
28773 return attrs;
28774};
28775/**
28776 * Applies attributes from `calculateSvgSizeAttrs`
28777 * @param {SVGSVGElement} svgElem The SVG Element to configure
28778 * @param {number} height The height of the SVG
28779 * @param {number} width The width of the SVG
28780 * @param {boolean} useMaxWidth Whether or not to use max-width and set width to 100%
28781 */
28782
28783var configureSvgSize = function configureSvgSize(svgElem, height, width, useMaxWidth) {
28784 var attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
28785 d3Attrs(svgElem, attrs);
28786};
28787var initIdGeneratior = /*#__PURE__*/function () {
28788 function iterator(deterministic, seed) {
28789 _classCallCheck(this, iterator);
28790
28791 this.deterministic = deterministic;
28792 this.seed = seed;
28793 this.count = seed ? seed.length : 0;
28794 }
28795
28796 _createClass(iterator, [{
28797 key: "next",
28798 value: function next() {
28799 if (!this.deterministic) return Date.now();
28800 return this.count++;
28801 }
28802 }]);
28803
28804 return iterator;
28805}();
28806var decoder;
28807/**
28808 * Decodes HTML, source: {@link https://github.com/shrpne/entity-decode/blob/v2.0.1/browser.js}
28809 * @param {string} html HTML as a string
28810 * @returns Unescaped HTML
28811 */
28812
28813var entityDecode = function entityDecode(html) {
28814 decoder = decoder || document.createElement('div'); // Escape HTML before decoding for HTML Entities
28815
28816 html = escape(html).replace(/%26/g, '&').replace(/%23/g, '#').replace(/%3B/g, ';'); // decoding
28817
28818 decoder.innerHTML = html;
28819 return unescape(decoder.textContent);
28820};
28821/**
28822 * Sanitizes directive objects
28823 * @param {Object} args Directive's JSON
28824 */
28825
28826var directiveSanitizer = function directiveSanitizer(args) {
28827 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('directiveSanitizer called with', args);
28828
28829 if (_typeof(args) === 'object') {
28830 // check for array
28831 if (args.length) {
28832 args.forEach(function (arg) {
28833 return directiveSanitizer(arg);
28834 });
28835 } else {
28836 // This is an object
28837 Object.keys(args).forEach(function (key) {
28838 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('Checking key', key);
28839
28840 if (key.indexOf('__') === 0) {
28841 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting __ option', key);
28842 delete args[key];
28843 }
28844
28845 if (key.indexOf('proto') >= 0) {
28846 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting proto option', key);
28847 delete args[key];
28848 }
28849
28850 if (key.indexOf('constr') >= 0) {
28851 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting constr option', key);
28852 delete args[key];
28853 }
28854
28855 if (_defaultConfig__WEBPACK_IMPORTED_MODULE_4__.configKeys.indexOf(key) < 0) {
28856 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting option', key);
28857 delete args[key];
28858 } else {
28859 if (_typeof(args[key]) === 'object') {
28860 _logger__WEBPACK_IMPORTED_MODULE_2__.log.debug('sanitize deleting object', key);
28861 directiveSanitizer(args[key]);
28862 }
28863 }
28864 });
28865 }
28866 }
28867};
28868/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
28869 assignWithDepth: assignWithDepth,
28870 wrapLabel: wrapLabel,
28871 calculateTextHeight: calculateTextHeight,
28872 calculateTextWidth: calculateTextWidth,
28873 calculateTextDimensions: calculateTextDimensions,
28874 calculateSvgSizeAttrs: calculateSvgSizeAttrs,
28875 configureSvgSize: configureSvgSize,
28876 detectInit: detectInit,
28877 detectDirective: detectDirective,
28878 detectType: detectType,
28879 isSubstringInArray: isSubstringInArray,
28880 interpolateToCurve: interpolateToCurve,
28881 calcLabelPosition: calcLabelPosition,
28882 calcCardinalityPosition: calcCardinalityPosition,
28883 calcTerminalLabelPosition: calcTerminalLabelPosition,
28884 formatUrl: formatUrl,
28885 getStylesFromArray: getStylesFromArray,
28886 generateId: generateId,
28887 random: random,
28888 memoize: memoize,
28889 runFunc: runFunc,
28890 entityDecode: entityDecode,
28891 initIdGeneratior: initIdGeneratior,
28892 directiveSanitizer: directiveSanitizer
28893});
28894
28895/***/ }),
28896
28897/***/ "./node_modules/path-browserify/index.js":
28898/*!***********************************************!*\
28899 !*** ./node_modules/path-browserify/index.js ***!
28900 \***********************************************/
28901/***/ ((module) => {
28902
28903"use strict";
28904// 'path' module extracted from Node.js v8.11.1 (only the posix part)
28905// transplited with Babel
28906
28907// Copyright Joyent, Inc. and other Node contributors.
28908//
28909// Permission is hereby granted, free of charge, to any person obtaining a
28910// copy of this software and associated documentation files (the
28911// "Software"), to deal in the Software without restriction, including
28912// without limitation the rights to use, copy, modify, merge, publish,
28913// distribute, sublicense, and/or sell copies of the Software, and to permit
28914// persons to whom the Software is furnished to do so, subject to the
28915// following conditions:
28916//
28917// The above copyright notice and this permission notice shall be included
28918// in all copies or substantial portions of the Software.
28919//
28920// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
28921// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28922// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
28923// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
28924// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
28925// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
28926// USE OR OTHER DEALINGS IN THE SOFTWARE.
28927
28928
28929
28930function assertPath(path) {
28931 if (typeof path !== 'string') {
28932 throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
28933 }
28934}
28935
28936// Resolves . and .. elements in a path with directory names
28937function normalizeStringPosix(path, allowAboveRoot) {
28938 var res = '';
28939 var lastSegmentLength = 0;
28940 var lastSlash = -1;
28941 var dots = 0;
28942 var code;
28943 for (var i = 0; i <= path.length; ++i) {
28944 if (i < path.length)
28945 code = path.charCodeAt(i);
28946 else if (code === 47 /*/*/)
28947 break;
28948 else
28949 code = 47 /*/*/;
28950 if (code === 47 /*/*/) {
28951 if (lastSlash === i - 1 || dots === 1) {
28952 // NOOP
28953 } else if (lastSlash !== i - 1 && dots === 2) {
28954 if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 /*.*/ || res.charCodeAt(res.length - 2) !== 46 /*.*/) {
28955 if (res.length > 2) {
28956 var lastSlashIndex = res.lastIndexOf('/');
28957 if (lastSlashIndex !== res.length - 1) {
28958 if (lastSlashIndex === -1) {
28959 res = '';
28960 lastSegmentLength = 0;
28961 } else {
28962 res = res.slice(0, lastSlashIndex);
28963 lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
28964 }
28965 lastSlash = i;
28966 dots = 0;
28967 continue;
28968 }
28969 } else if (res.length === 2 || res.length === 1) {
28970 res = '';
28971 lastSegmentLength = 0;
28972 lastSlash = i;
28973 dots = 0;
28974 continue;
28975 }
28976 }
28977 if (allowAboveRoot) {
28978 if (res.length > 0)
28979 res += '/..';
28980 else
28981 res = '..';
28982 lastSegmentLength = 2;
28983 }
28984 } else {
28985 if (res.length > 0)
28986 res += '/' + path.slice(lastSlash + 1, i);
28987 else
28988 res = path.slice(lastSlash + 1, i);
28989 lastSegmentLength = i - lastSlash - 1;
28990 }
28991 lastSlash = i;
28992 dots = 0;
28993 } else if (code === 46 /*.*/ && dots !== -1) {
28994 ++dots;
28995 } else {
28996 dots = -1;
28997 }
28998 }
28999 return res;
29000}
29001
29002function _format(sep, pathObject) {
29003 var dir = pathObject.dir || pathObject.root;
29004 var base = pathObject.base || (pathObject.name || '') + (pathObject.ext || '');
29005 if (!dir) {
29006 return base;
29007 }
29008 if (dir === pathObject.root) {
29009 return dir + base;
29010 }
29011 return dir + sep + base;
29012}
29013
29014var posix = {
29015 // path.resolve([from ...], to)
29016 resolve: function resolve() {
29017 var resolvedPath = '';
29018 var resolvedAbsolute = false;
29019 var cwd;
29020
29021 for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
29022 var path;
29023 if (i >= 0)
29024 path = arguments[i];
29025 else {
29026 if (cwd === undefined)
29027 cwd = process.cwd();
29028 path = cwd;
29029 }
29030
29031 assertPath(path);
29032
29033 // Skip empty entries
29034 if (path.length === 0) {
29035 continue;
29036 }
29037
29038 resolvedPath = path + '/' + resolvedPath;
29039 resolvedAbsolute = path.charCodeAt(0) === 47 /*/*/;
29040 }
29041
29042 // At this point the path should be resolved to a full absolute path, but
29043 // handle relative paths to be safe (might happen when process.cwd() fails)
29044
29045 // Normalize the path
29046 resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
29047
29048 if (resolvedAbsolute) {
29049 if (resolvedPath.length > 0)
29050 return '/' + resolvedPath;
29051 else
29052 return '/';
29053 } else if (resolvedPath.length > 0) {
29054 return resolvedPath;
29055 } else {
29056 return '.';
29057 }
29058 },
29059
29060 normalize: function normalize(path) {
29061 assertPath(path);
29062
29063 if (path.length === 0) return '.';
29064
29065 var isAbsolute = path.charCodeAt(0) === 47 /*/*/;
29066 var trailingSeparator = path.charCodeAt(path.length - 1) === 47 /*/*/;
29067
29068 // Normalize the path
29069 path = normalizeStringPosix(path, !isAbsolute);
29070
29071 if (path.length === 0 && !isAbsolute) path = '.';
29072 if (path.length > 0 && trailingSeparator) path += '/';
29073
29074 if (isAbsolute) return '/' + path;
29075 return path;
29076 },
29077
29078 isAbsolute: function isAbsolute(path) {
29079 assertPath(path);
29080 return path.length > 0 && path.charCodeAt(0) === 47 /*/*/;
29081 },
29082
29083 join: function join() {
29084 if (arguments.length === 0)
29085 return '.';
29086 var joined;
29087 for (var i = 0; i < arguments.length; ++i) {
29088 var arg = arguments[i];
29089 assertPath(arg);
29090 if (arg.length > 0) {
29091 if (joined === undefined)
29092 joined = arg;
29093 else
29094 joined += '/' + arg;
29095 }
29096 }
29097 if (joined === undefined)
29098 return '.';
29099 return posix.normalize(joined);
29100 },
29101
29102 relative: function relative(from, to) {
29103 assertPath(from);
29104 assertPath(to);
29105
29106 if (from === to) return '';
29107
29108 from = posix.resolve(from);
29109 to = posix.resolve(to);
29110
29111 if (from === to) return '';
29112
29113 // Trim any leading backslashes
29114 var fromStart = 1;
29115 for (; fromStart < from.length; ++fromStart) {
29116 if (from.charCodeAt(fromStart) !== 47 /*/*/)
29117 break;
29118 }
29119 var fromEnd = from.length;
29120 var fromLen = fromEnd - fromStart;
29121
29122 // Trim any leading backslashes
29123 var toStart = 1;
29124 for (; toStart < to.length; ++toStart) {
29125 if (to.charCodeAt(toStart) !== 47 /*/*/)
29126 break;
29127 }
29128 var toEnd = to.length;
29129 var toLen = toEnd - toStart;
29130
29131 // Compare paths to find the longest common path from root
29132 var length = fromLen < toLen ? fromLen : toLen;
29133 var lastCommonSep = -1;
29134 var i = 0;
29135 for (; i <= length; ++i) {
29136 if (i === length) {
29137 if (toLen > length) {
29138 if (to.charCodeAt(toStart + i) === 47 /*/*/) {
29139 // We get here if `from` is the exact base path for `to`.
29140 // For example: from='/foo/bar'; to='/foo/bar/baz'
29141 return to.slice(toStart + i + 1);
29142 } else if (i === 0) {
29143 // We get here if `from` is the root
29144 // For example: from='/'; to='/foo'
29145 return to.slice(toStart + i);
29146 }
29147 } else if (fromLen > length) {
29148 if (from.charCodeAt(fromStart + i) === 47 /*/*/) {
29149 // We get here if `to` is the exact base path for `from`.
29150 // For example: from='/foo/bar/baz'; to='/foo/bar'
29151 lastCommonSep = i;
29152 } else if (i === 0) {
29153 // We get here if `to` is the root.
29154 // For example: from='/foo'; to='/'
29155 lastCommonSep = 0;
29156 }
29157 }
29158 break;
29159 }
29160 var fromCode = from.charCodeAt(fromStart + i);
29161 var toCode = to.charCodeAt(toStart + i);
29162 if (fromCode !== toCode)
29163 break;
29164 else if (fromCode === 47 /*/*/)
29165 lastCommonSep = i;
29166 }
29167
29168 var out = '';
29169 // Generate the relative path based on the path difference between `to`
29170 // and `from`
29171 for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
29172 if (i === fromEnd || from.charCodeAt(i) === 47 /*/*/) {
29173 if (out.length === 0)
29174 out += '..';
29175 else
29176 out += '/..';
29177 }
29178 }
29179
29180 // Lastly, append the rest of the destination (`to`) path that comes after
29181 // the common path parts
29182 if (out.length > 0)
29183 return out + to.slice(toStart + lastCommonSep);
29184 else {
29185 toStart += lastCommonSep;
29186 if (to.charCodeAt(toStart) === 47 /*/*/)
29187 ++toStart;
29188 return to.slice(toStart);
29189 }
29190 },
29191
29192 _makeLong: function _makeLong(path) {
29193 return path;
29194 },
29195
29196 dirname: function dirname(path) {
29197 assertPath(path);
29198 if (path.length === 0) return '.';
29199 var code = path.charCodeAt(0);
29200 var hasRoot = code === 47 /*/*/;
29201 var end = -1;
29202 var matchedSlash = true;
29203 for (var i = path.length - 1; i >= 1; --i) {
29204 code = path.charCodeAt(i);
29205 if (code === 47 /*/*/) {
29206 if (!matchedSlash) {
29207 end = i;
29208 break;
29209 }
29210 } else {
29211 // We saw the first non-path separator
29212 matchedSlash = false;
29213 }
29214 }
29215
29216 if (end === -1) return hasRoot ? '/' : '.';
29217 if (hasRoot && end === 1) return '//';
29218 return path.slice(0, end);
29219 },
29220
29221 basename: function basename(path, ext) {
29222 if (ext !== undefined && typeof ext !== 'string') throw new TypeError('"ext" argument must be a string');
29223 assertPath(path);
29224
29225 var start = 0;
29226 var end = -1;
29227 var matchedSlash = true;
29228 var i;
29229
29230 if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
29231 if (ext.length === path.length && ext === path) return '';
29232 var extIdx = ext.length - 1;
29233 var firstNonSlashEnd = -1;
29234 for (i = path.length - 1; i >= 0; --i) {
29235 var code = path.charCodeAt(i);
29236 if (code === 47 /*/*/) {
29237 // If we reached a path separator that was not part of a set of path
29238 // separators at the end of the string, stop now
29239 if (!matchedSlash) {
29240 start = i + 1;
29241 break;
29242 }
29243 } else {
29244 if (firstNonSlashEnd === -1) {
29245 // We saw the first non-path separator, remember this index in case
29246 // we need it if the extension ends up not matching
29247 matchedSlash = false;
29248 firstNonSlashEnd = i + 1;
29249 }
29250 if (extIdx >= 0) {
29251 // Try to match the explicit extension
29252 if (code === ext.charCodeAt(extIdx)) {
29253 if (--extIdx === -1) {
29254 // We matched the extension, so mark this as the end of our path
29255 // component
29256 end = i;
29257 }
29258 } else {
29259 // Extension does not match, so our result is the entire path
29260 // component
29261 extIdx = -1;
29262 end = firstNonSlashEnd;
29263 }
29264 }
29265 }
29266 }
29267
29268 if (start === end) end = firstNonSlashEnd;else if (end === -1) end = path.length;
29269 return path.slice(start, end);
29270 } else {
29271 for (i = path.length - 1; i >= 0; --i) {
29272 if (path.charCodeAt(i) === 47 /*/*/) {
29273 // If we reached a path separator that was not part of a set of path
29274 // separators at the end of the string, stop now
29275 if (!matchedSlash) {
29276 start = i + 1;
29277 break;
29278 }
29279 } else if (end === -1) {
29280 // We saw the first non-path separator, mark this as the end of our
29281 // path component
29282 matchedSlash = false;
29283 end = i + 1;
29284 }
29285 }
29286
29287 if (end === -1) return '';
29288 return path.slice(start, end);
29289 }
29290 },
29291
29292 extname: function extname(path) {
29293 assertPath(path);
29294 var startDot = -1;
29295 var startPart = 0;
29296 var end = -1;
29297 var matchedSlash = true;
29298 // Track the state of characters (if any) we see before our first dot and
29299 // after any path separator we find
29300 var preDotState = 0;
29301 for (var i = path.length - 1; i >= 0; --i) {
29302 var code = path.charCodeAt(i);
29303 if (code === 47 /*/*/) {
29304 // If we reached a path separator that was not part of a set of path
29305 // separators at the end of the string, stop now
29306 if (!matchedSlash) {
29307 startPart = i + 1;
29308 break;
29309 }
29310 continue;
29311 }
29312 if (end === -1) {
29313 // We saw the first non-path separator, mark this as the end of our
29314 // extension
29315 matchedSlash = false;
29316 end = i + 1;
29317 }
29318 if (code === 46 /*.*/) {
29319 // If this is our first dot, mark it as the start of our extension
29320 if (startDot === -1)
29321 startDot = i;
29322 else if (preDotState !== 1)
29323 preDotState = 1;
29324 } else if (startDot !== -1) {
29325 // We saw a non-dot and non-path separator before our dot, so we should
29326 // have a good chance at having a non-empty extension
29327 preDotState = -1;
29328 }
29329 }
29330
29331 if (startDot === -1 || end === -1 ||
29332 // We saw a non-dot character immediately before the dot
29333 preDotState === 0 ||
29334 // The (right-most) trimmed path component is exactly '..'
29335 preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
29336 return '';
29337 }
29338 return path.slice(startDot, end);
29339 },
29340
29341 format: function format(pathObject) {
29342 if (pathObject === null || typeof pathObject !== 'object') {
29343 throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
29344 }
29345 return _format('/', pathObject);
29346 },
29347
29348 parse: function parse(path) {
29349 assertPath(path);
29350
29351 var ret = { root: '', dir: '', base: '', ext: '', name: '' };
29352 if (path.length === 0) return ret;
29353 var code = path.charCodeAt(0);
29354 var isAbsolute = code === 47 /*/*/;
29355 var start;
29356 if (isAbsolute) {
29357 ret.root = '/';
29358 start = 1;
29359 } else {
29360 start = 0;
29361 }
29362 var startDot = -1;
29363 var startPart = 0;
29364 var end = -1;
29365 var matchedSlash = true;
29366 var i = path.length - 1;
29367
29368 // Track the state of characters (if any) we see before our first dot and
29369 // after any path separator we find
29370 var preDotState = 0;
29371
29372 // Get non-dir info
29373 for (; i >= start; --i) {
29374 code = path.charCodeAt(i);
29375 if (code === 47 /*/*/) {
29376 // If we reached a path separator that was not part of a set of path
29377 // separators at the end of the string, stop now
29378 if (!matchedSlash) {
29379 startPart = i + 1;
29380 break;
29381 }
29382 continue;
29383 }
29384 if (end === -1) {
29385 // We saw the first non-path separator, mark this as the end of our
29386 // extension
29387 matchedSlash = false;
29388 end = i + 1;
29389 }
29390 if (code === 46 /*.*/) {
29391 // If this is our first dot, mark it as the start of our extension
29392 if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
29393 } else if (startDot !== -1) {
29394 // We saw a non-dot and non-path separator before our dot, so we should
29395 // have a good chance at having a non-empty extension
29396 preDotState = -1;
29397 }
29398 }
29399
29400 if (startDot === -1 || end === -1 ||
29401 // We saw a non-dot character immediately before the dot
29402 preDotState === 0 ||
29403 // The (right-most) trimmed path component is exactly '..'
29404 preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
29405 if (end !== -1) {
29406 if (startPart === 0 && isAbsolute) ret.base = ret.name = path.slice(1, end);else ret.base = ret.name = path.slice(startPart, end);
29407 }
29408 } else {
29409 if (startPart === 0 && isAbsolute) {
29410 ret.name = path.slice(1, startDot);
29411 ret.base = path.slice(1, end);
29412 } else {
29413 ret.name = path.slice(startPart, startDot);
29414 ret.base = path.slice(startPart, end);
29415 }
29416 ret.ext = path.slice(startDot, end);
29417 }
29418
29419 if (startPart > 0) ret.dir = path.slice(0, startPart - 1);else if (isAbsolute) ret.dir = '/';
29420
29421 return ret;
29422 },
29423
29424 sep: '/',
29425 delimiter: ':',
29426 win32: null,
29427 posix: null
29428};
29429
29430posix.posix = posix;
29431
29432module.exports = posix;
29433
29434
29435/***/ }),
29436
29437/***/ "@braintree/sanitize-url":
29438/*!******************************************!*\
29439 !*** external "@braintree/sanitize-url" ***!
29440 \******************************************/
29441/***/ ((module) => {
29442
29443"use strict";
29444module.exports = require("@braintree/sanitize-url");
29445
29446/***/ }),
29447
29448/***/ "d3":
29449/*!*********************!*\
29450 !*** external "d3" ***!
29451 \*********************/
29452/***/ ((module) => {
29453
29454"use strict";
29455module.exports = require("d3");
29456
29457/***/ }),
29458
29459/***/ "dagre":
29460/*!************************!*\
29461 !*** external "dagre" ***!
29462 \************************/
29463/***/ ((module) => {
29464
29465"use strict";
29466module.exports = require("dagre");
29467
29468/***/ }),
29469
29470/***/ "dagre-d3":
29471/*!***************************!*\
29472 !*** external "dagre-d3" ***!
29473 \***************************/
29474/***/ ((module) => {
29475
29476"use strict";
29477module.exports = require("dagre-d3");
29478
29479/***/ }),
29480
29481/***/ "dagre-d3/lib/label/add-html-label.js":
29482/*!*******************************************************!*\
29483 !*** external "dagre-d3/lib/label/add-html-label.js" ***!
29484 \*******************************************************/
29485/***/ ((module) => {
29486
29487"use strict";
29488module.exports = require("dagre-d3/lib/label/add-html-label.js");
29489
29490/***/ }),
29491
29492/***/ "dompurify":
29493/*!****************************!*\
29494 !*** external "dompurify" ***!
29495 \****************************/
29496/***/ ((module) => {
29497
29498"use strict";
29499module.exports = require("dompurify");
29500
29501/***/ }),
29502
29503/***/ "graphlib":
29504/*!***************************!*\
29505 !*** external "graphlib" ***!
29506 \***************************/
29507/***/ ((module) => {
29508
29509"use strict";
29510module.exports = require("graphlib");
29511
29512/***/ }),
29513
29514/***/ "khroma":
29515/*!*************************!*\
29516 !*** external "khroma" ***!
29517 \*************************/
29518/***/ ((module) => {
29519
29520"use strict";
29521module.exports = require("khroma");
29522
29523/***/ }),
29524
29525/***/ "moment-mini":
29526/*!******************************!*\
29527 !*** external "moment-mini" ***!
29528 \******************************/
29529/***/ ((module) => {
29530
29531"use strict";
29532module.exports = require("moment-mini");
29533
29534/***/ }),
29535
29536/***/ "stylis":
29537/*!*************************!*\
29538 !*** external "stylis" ***!
29539 \*************************/
29540/***/ ((module) => {
29541
29542"use strict";
29543module.exports = require("stylis");
29544
29545/***/ }),
29546
29547/***/ "?35ed":
29548/*!********************!*\
29549 !*** fs (ignored) ***!
29550 \********************/
29551/***/ (() => {
29552
29553/* (ignored) */
29554
29555/***/ }),
29556
29557/***/ "?3c87":
29558/*!********************!*\
29559 !*** fs (ignored) ***!
29560 \********************/
29561/***/ (() => {
29562
29563/* (ignored) */
29564
29565/***/ }),
29566
29567/***/ "?dbae":
29568/*!********************!*\
29569 !*** fs (ignored) ***!
29570 \********************/
29571/***/ (() => {
29572
29573/* (ignored) */
29574
29575/***/ }),
29576
29577/***/ "?8ed1":
29578/*!********************!*\
29579 !*** fs (ignored) ***!
29580 \********************/
29581/***/ (() => {
29582
29583/* (ignored) */
29584
29585/***/ }),
29586
29587/***/ "?2b40":
29588/*!********************!*\
29589 !*** fs (ignored) ***!
29590 \********************/
29591/***/ (() => {
29592
29593/* (ignored) */
29594
29595/***/ }),
29596
29597/***/ "?c5f1":
29598/*!********************!*\
29599 !*** fs (ignored) ***!
29600 \********************/
29601/***/ (() => {
29602
29603/* (ignored) */
29604
29605/***/ }),
29606
29607/***/ "?a3fa":
29608/*!********************!*\
29609 !*** fs (ignored) ***!
29610 \********************/
29611/***/ (() => {
29612
29613/* (ignored) */
29614
29615/***/ }),
29616
29617/***/ "?ebf4":
29618/*!********************!*\
29619 !*** fs (ignored) ***!
29620 \********************/
29621/***/ (() => {
29622
29623/* (ignored) */
29624
29625/***/ }),
29626
29627/***/ "?e940":
29628/*!********************!*\
29629 !*** fs (ignored) ***!
29630 \********************/
29631/***/ (() => {
29632
29633/* (ignored) */
29634
29635/***/ }),
29636
29637/***/ "?a3b8":
29638/*!********************!*\
29639 !*** fs (ignored) ***!
29640 \********************/
29641/***/ (() => {
29642
29643/* (ignored) */
29644
29645/***/ }),
29646
29647/***/ "?0f62":
29648/*!********************!*\
29649 !*** fs (ignored) ***!
29650 \********************/
29651/***/ (() => {
29652
29653/* (ignored) */
29654
29655/***/ }),
29656
29657/***/ "./package.json":
29658/*!**********************!*\
29659 !*** ./package.json ***!
29660 \**********************/
29661/***/ ((module) => {
29662
29663"use strict";
29664module.exports = JSON.parse('{"name":"mermaid","version":"8.13.4","description":"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.","main":"dist/mermaid.core.js","module":"dist/mermaid.esm.min.mjs","exports":{".":{"require":"./dist/mermaid.core.js","import":"./dist/mermaid.esm.min.mjs"},"./*":"./*"},"keywords":["diagram","markdown","flowchart","sequence diagram","gantt","class diagram","git graph"],"scripts":{"build:development":"webpack --progress --color","build:production":"yarn build:development --mode production --config webpack.config.prod.babel.js","build":"concurrently \\"yarn build:development\\" \\"yarn build:production\\"","postbuild":"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md","build:watch":"yarn build:development --watch","release":"yarn build","lint":"eslint src","e2e:depr":"yarn lint && jest e2e --config e2e/jest.config.js","cypress":"percy exec -- cypress run","e2e":"start-server-and-test dev http://localhost:9000/ cypress","e2e-upd":"yarn lint && jest e2e -u --config e2e/jest.config.js","dev":"webpack serve --config webpack.config.e2e.js","test":"yarn lint && jest src/.*","test:watch":"jest --watch src","prepublishOnly":"yarn build && yarn test","prepare":"yarn build"},"repository":{"type":"git","url":"https://github.com/knsv/mermaid"},"author":"Knut Sveidqvist","license":"MIT","standard":{"ignore":["**/parser/*.js","dist/**/*.js","cypress/**/*.js"],"globals":["page"]},"dependencies":{"@braintree/sanitize-url":"^3.1.0","d3":"^7.0.0","dagre":"^0.8.5","dagre-d3":"^0.6.4","dompurify":"2.3.3","graphlib":"^2.1.8","khroma":"^1.4.1","moment-mini":"^2.24.0","stylis":"^4.0.10"},"devDependencies":{"@babel/core":"^7.14.6","@babel/eslint-parser":"^7.14.7","@babel/preset-env":"^7.14.7","@babel/register":"^7.14.5","@percy/cli":"^1.0.0-beta.58","@percy/cypress":"^3.1.0","@percy/migrate":"^0.11.0","babel-jest":"^27.0.6","babel-loader":"^8.2.2","concurrently":"^6.2.2","coveralls":"^3.0.2","css-to-string-loader":"^0.1.3","cypress":"8.7.0","documentation":"13.2.0","eslint":"^8.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","husky":"^7.0.1","identity-obj-proxy":"^3.0.0","jest":"^27.0.6","jison":"^0.4.18","js-base64":"3.7.2","moment":"^2.23.0","path-browserify":"^1.0.1","prettier":"^2.3.2","start-server-and-test":"^1.12.6","terser-webpack-plugin":"^5.2.4","webpack":"^5.53.0","webpack-cli":"^4.7.2","webpack-dev-server":"^4.3.0","webpack-node-externals":"^3.0.0"},"files":["dist"],"sideEffects":["**/*.css","**/*.scss"],"husky":{"hooks":{"pre-push":"yarn test"}}}');
29665
29666/***/ })
29667
29668/******/ });
29669/************************************************************************/
29670/******/ // The module cache
29671/******/ var __webpack_module_cache__ = {};
29672/******/
29673/******/ // The require function
29674/******/ function __webpack_require__(moduleId) {
29675/******/ // Check if module is in cache
29676/******/ var cachedModule = __webpack_module_cache__[moduleId];
29677/******/ if (cachedModule !== undefined) {
29678/******/ return cachedModule.exports;
29679/******/ }
29680/******/ // Create a new module (and put it into the cache)
29681/******/ var module = __webpack_module_cache__[moduleId] = {
29682/******/ id: moduleId,
29683/******/ loaded: false,
29684/******/ exports: {}
29685/******/ };
29686/******/
29687/******/ // Execute the module function
29688/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
29689/******/
29690/******/ // Flag the module as loaded
29691/******/ module.loaded = true;
29692/******/
29693/******/ // Return the exports of the module
29694/******/ return module.exports;
29695/******/ }
29696/******/
29697/******/ // expose the module cache
29698/******/ __webpack_require__.c = __webpack_module_cache__;
29699/******/
29700/************************************************************************/
29701/******/ /* webpack/runtime/compat get default export */
29702/******/ (() => {
29703/******/ // getDefaultExport function for compatibility with non-harmony modules
29704/******/ __webpack_require__.n = (module) => {
29705/******/ var getter = module && module.__esModule ?
29706/******/ () => (module['default']) :
29707/******/ () => (module);
29708/******/ __webpack_require__.d(getter, { a: getter });
29709/******/ return getter;
29710/******/ };
29711/******/ })();
29712/******/
29713/******/ /* webpack/runtime/define property getters */
29714/******/ (() => {
29715/******/ // define getter functions for harmony exports
29716/******/ __webpack_require__.d = (exports, definition) => {
29717/******/ for(var key in definition) {
29718/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
29719/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
29720/******/ }
29721/******/ }
29722/******/ };
29723/******/ })();
29724/******/
29725/******/ /* webpack/runtime/hasOwnProperty shorthand */
29726/******/ (() => {
29727/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
29728/******/ })();
29729/******/
29730/******/ /* webpack/runtime/make namespace object */
29731/******/ (() => {
29732/******/ // define __esModule on exports
29733/******/ __webpack_require__.r = (exports) => {
29734/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
29735/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
29736/******/ }
29737/******/ Object.defineProperty(exports, '__esModule', { value: true });
29738/******/ };
29739/******/ })();
29740/******/
29741/******/ /* webpack/runtime/node module decorator */
29742/******/ (() => {
29743/******/ __webpack_require__.nmd = (module) => {
29744/******/ module.paths = [];
29745/******/ if (!module.children) module.children = [];
29746/******/ return module;
29747/******/ };
29748/******/ })();
29749/******/
29750/************************************************************************/
29751/******/
29752/******/ // module cache are used so entry inlining is disabled
29753/******/ // startup
29754/******/ // Load entry module and return exports
29755/******/ var __webpack_exports__ = __webpack_require__(__webpack_require__.s = "./src/mermaid.js");
29756/******/ __webpack_exports__ = __webpack_exports__["default"];
29757/******/
29758/******/ return __webpack_exports__;
29759/******/ })()
29760;
29761});
29762//# sourceMappingURL=mermaid.core.js.map
\No newline at end of file