text: var parser=function(){function t(){this.yy={}}var e=function(t,e,r,n){for(r=r||{},n=t.length;n--;r[t[n]]=e);return r},r=[1,7],n=[2,10],i=[1,15],s=[1,16],a=[1,11],o=[6,9],h=[11,28,29,37],l=[11,32,33,34,35],c=[9,11,18,20,21,22,23,24,32,33,34,35,36],u=[9,11,18,20,21,22,23,24,28,29,32,33,34,35,36],y=[9,11,18,20,21,22,23,24,27,28,29,32,33,34,35,36],d=[28,29],p=[28,29,36],f=[20,22,24,36],m=[1,66],g=[1,63],_=[1,61],k=[1,64],x=[1,67],b=[1,62],v=[1,65],S=[1,70],E=[11,41],w=[9,11,27,28,29,39,41,43,44],I={trace:function(){},yy:{},symbols_:{error:2,expressions:3,graphConfig:4,statements:5,EOF:6,spaceList:7,GRAPH:8,SPACE:9,DIR:10,SEMI:11,statement:12,verticeStatement:13,styleStatement:14,vertex:15,link:16,alphaNum:17,SQS:18,text:19,SQE:20,PS:21,PE:22,DIAMOND_START:23,DIAMOND_STOP:24,alphaNumStatement:25,alphaNumToken:26,MINUS:27,ALPHA:28,NUM:29,linkStatement:30,arrowText:31,ARROW_POINT:32,ARROW_CIRCLE:33,ARROW_CROSS:34,ARROW_OPEN:35,PIPE:36,STYLE:37,stylesOpt:38,HEX:39,style:40,COMMA:41,styleComponent:42,COLON:43,UNIT:44,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",8:"GRAPH",9:"SPACE",10:"DIR",11:"SEMI",18:"SQS",20:"SQE",21:"PS",22:"PE",23:"DIAMOND_START",24:"DIAMOND_STOP",27:"MINUS",28:"ALPHA",29:"NUM",32:"ARROW_POINT",33:"ARROW_CIRCLE",34:"ARROW_CROSS",35:"ARROW_OPEN",36:"PIPE",37:"STYLE",39:"HEX",41:"COMMA",43:"COLON",44:"UNIT"},productions_:[0,[3,3],[3,4],[4,4],[5,3],[5,1],[7,2],[7,1],[12,2],[12,2],[13,0],[13,3],[13,1],[15,4],[15,4],[15,4],[15,1],[17,1],[17,2],[25,1],[25,3],[26,1],[26,1],[16,2],[16,1],[30,1],[30,1],[30,1],[30,1],[31,3],[19,3],[19,2],[19,1],[14,5],[14,5],[38,1],[38,3],[40,1],[40,2],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1],[42,1]],performAction:function(t,e,r,n,i,s){var a=s.length-1;switch(i){case 2:this.$=s[a-3];break;case 3:console.log("In graph config"),n.setDirection(s[a-1]),this.$=s[a-1];break;case 11:console.log("In vertexStatement"),n.addLink(s[a-2],s[a],s[a-1]),this.$="oy";break;case 12:console.log("In vertexStatement ... "),this.$="yo";break;case 13:this.$=s[a-3],n.addVertex(s[a-3],s[a-1],"square");break;case 14:this.$=s[a-3],n.addVertex(s[a-3],s[a-1],"round");break;case 15:this.$=s[a-3],n.addVertex(s[a-3],s[a-1],"diamond");break;case 16:console.log("In vertex:"+s[a]),this.$=s[a],n.addVertex(s[a]);break;case 17:case 21:case 22:case 37:this.$=s[a];break;case 18:this.$=s[a-1]+""+s[a];break;case 19:console.log("Found token (statement): "+s[a]),this.$=s[a];break;case 20:this.$=s[a-2]+"-"+s[a];break;case 23:s[a-1].text=s[a],this.$=s[a-1];break;case 24:case 32:this.$=s[a];break;case 25:this.$={type:"arrow"};break;case 26:this.$={type:"arrow_circle"};break;case 27:this.$={type:"arrow_cross"};break;case 28:this.$={type:"arrow_open"};break;case 29:console.log("Nice link text here: "+s[a-1]),this.$=s[a-1];break;case 30:this.$=s[a-2]+" "+s[a];break;case 31:this.$=s[a-1];break;case 33:this.$=s[a-4],n.addVertex(s[a-2],void 0,void 0,s[a]);break;case 34:console.log("In parser - style: "+s[a]),this.$=s[a-4],n.updateLink(s[a-2],s[a]);break;case 35:this.$=[s[a]];break;case 36:s[a-2].push(s[a]),this.$=s[a-2];break;case 38:this.$=s[a-1]+s[a];break;case 39:case 40:case 41:case 42:case 43:case 44:case 45:this.$=s[a]}},table:[{3:1,4:2,8:[1,3]},{1:[3]},{5:4,7:5,9:r,11:n,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,37:a},{9:[1,17]},{6:[1,18],7:19,9:r},{5:20,11:n,12:6,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,37:a},e(o,[2,5]),e(h,[2,7],{7:21,9:r}),{11:[1,22]},{11:[1,23]},{11:[2,12],16:24,30:25,32:[1,26],33:[1,27],34:[1,28],35:[1,29]},{9:[1,30]},e(l,[2,16],{18:[1,31],21:[1,32],23:[1,33]}),e(c,[2,17],{25:13,26:14,17:34,28:i,29:s}),e(u,[2,19],{27:[1,35]}),e(y,[2,21]),e(y,[2,22]),{10:[1,36]},{1:[2,1]},{11:n,12:37,13:8,14:9,15:10,17:12,25:13,26:14,28:i,29:s,37:a},{6:[1,38],7:19,9:r},e(h,[2,6]),e(o,[2,8]),e(o,[2,9]),{15:39,17:12,25:13,26:14,28:i,29:s},e(d,[2,24],{31:40,36:[1,41]}),e(p,[2,25]),e(p,[2,26]),e(p,[2,27]),e(p,[2,28]),{17:42,25:13,26:14,28:i,29:s,39:[1,43]},{17:45,19:44,25:13,26:14,28:i,29:s},{17:45,19:46,25:13,26:14,28:i,29:s},{17:45,19:47,25:13,26:14,28:i,29:s},e(c,[2,18]),{26:48,28:i,29:s},{11:[1,49]},e(o,[2,4]),{1:[2,2]},{11:[2,11]},e(d,[2,23]),{17:45,19:50,25:13,26:14,28:i,29:s},{9:[1,51]},{9:[1,52]},{20:[1,53]},e(f,[2,32],{9:[1,54]}),{22:[1,55]},{24:[1,56]},e(u,[2,20]),e([9,11,28,29,37],[2,3]),{36:[1,57]},{9:m,27:g,28:_,29:k,38:58,39:x,40:59,42:60,43:b,44:v},{9:m,27:g,28:_,29:k,38:68,39:x,40:59,42:60,43:b,44:v},e(l,[2,13]),e(f,[2,31],{25:13,26:14,17:45,19:69,28:i,29:s}),e(l,[2,14]),e(l,[2,15]),e(d,[2,29]),{11:[2,33],41:S},e(E,[2,35],{42:71,9:m,27:g,28:_,29:k,39:x,43:b,44:v}),e(w,[2,37]),e(w,[2,39]),e(w,[2,40]),e(w,[2,41]),e(w,[2,42]),e(w,[2,43]),e(w,[2,44]),e(w,[2,45]),{11:[2,34],41:S},e(f,[2,30]),{9:m,27:g,28:_,29:k,39:x,40:72,42:60,43:b,44:v},e(w,[2,38]),e(E,[2,36],{42:71,9:m,27:g,28:_,29:k,39:x,43:b,44:v})],defaultActions:{18:[2,1],38:[2,2],39:[2,11]},parseError:function(t,e){if(!e.recoverable)throw new Error(t);this.trace(t)},parse:function(t){function e(){var t;return t=p.lex()||y,"number"!=typeof t&&(t=r.symbols_[t]||t),t}var r=this,n=[0],i=[null],s=[],a=this.table,o="",h=0,l=0,c=0,u=2,y=1,d=s.slice.call(arguments,1),p=Object.create(this.lexer),f={yy:{}};for(var m in this.yy)Object.prototype.hasOwnProperty.call(this.yy,m)&&(f.yy[m]=this.yy[m]);p.setInput(t,f.yy),f.yy.lexer=p,f.yy.parser=this,"undefined"==typeof p.yylloc&&(p.yylloc={});var g=p.yylloc;s.push(g);var _=p.options&&p.options.ranges;this.parseError="function"==typeof f.yy.parseError?f.yy.parseError:Object.getPrototypeOf(this).parseError;for(var k,x,b,v,S,E,w,I,O,A={};;){if(b=n[n.length-1],this.defaultActions[b]?v=this.defaultActions[b]:((null===k||"undefined"==typeof k)&&(k=e()),v=a[b]&&a[b][k]),"undefined"==typeof v||!v.length||!v[0]){var $="";O=[];for(E in a[b])this.terminals_[E]&&E>u&&O.push("'"+this.terminals_[E]+"'");$=p.showPosition?"Parse error on line "+(h+1)+":\n"+p.showPosition()+"\nExpecting "+O.join(", ")+", got '"+(this.terminals_[k]||k)+"'":"Parse error on line "+(h+1)+": Unexpected "+(k==y?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError($,{text:p.match,token:this.terminals_[k]||k,line:p.yylineno,loc:g,expected:O})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+k);switch(v[0]){case 1:n.push(k),i.push(p.yytext),s.push(p.yylloc),n.push(v[1]),k=null,x?(k=x,x=null):(l=p.yyleng,o=p.yytext,h=p.yylineno,g=p.yylloc,c>0&&c--);break;case 2:if(w=this.productions_[v[1]][1],A.$=i[i.length-w],A._$={first_line:s[s.length-(w||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(w||1)].first_column,last_column:s[s.length-1].last_column},_&&(A._$.range=[s[s.length-(w||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.apply(A,[o,l,h,f.yy,v[1],i,s].concat(d)),"undefined"!=typeof S)return S;w&&(n=n.slice(0,-1*w*2),i=i.slice(0,-1*w),s=s.slice(0,-1*w)),n.push(this.productions_[v[1]][0]),i.push(A.$),s.push(A._$),I=a[n[n.length-2]][n[n.length-1]],n.push(I);break;case 3:return!0}}return!0}},O=function(){var t={EOF:1,parseError:function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},setInput:function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var e=t.match(/(?:\r\n?|\n).*/g);return e?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},unput:function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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(),{text:"",token:null,line:this.yylineno})},less:function(t){this.unput(this.match.slice(t))},pastInput:function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},test_match:function(t,e){var r,n,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),n=t[0].match(/(?:\r\n?|\n).*/g),n&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var s in i)this[s]=i[s];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var t,e,r,n;this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),s=0;s<i.length;s++)if(r=this._input.match(this.rules[i[s]]),r&&(!e||r[0].length>e[0].length)){if(e=r,n=s,this.options.backtrack_lexer){if(t=this.test_match(r,i[s]),t!==!1)return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?(t=this.test_match(e,i[n]),t!==!1?t:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return t?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){var t=this.conditionStack.length-1;return t>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(t){return t=this.conditionStack.length-1-Math.abs(t||0),t>=0?this.conditionStack[t]:"INITIAL"},pushState:function(t){this.begin(t)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(t,e,r,n){switch(r){case 0:return 37;case 1:return 8;case 2:return 10;case 3:return 10;case 4:return 39;case 5:return 29;case 6:return"BRKT";case 7:return 44;case 8:return 44;case 9:return 44;case 10:return 43;case 11:return 11;case 12:return 41;case 13:return 34;case 14:return 32;case 15:return 33;case 16:return 35;case 17:return 27;case 18:return 28;case 19:return 36;case 20:return 21;case 21:return 22;case 22:return 18;case 23:return 20;case 24:return 23;case 25:return 24;case 26:return 9;case 27:return"NEWLINE";case 28:return 6}},rules:[/^(?:style\b)/,/^(?:graph\b)/,/^(?:LR\b)/,/^(?:TD\b)/,/^(?:#[a-f0-9]+)/,/^(?:[0-9]+)/,/^(?:#)/,/^(?:px\b)/,/^(?:pt\b)/,/^(?:dot\b)/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:--[x])/,/^(?:-->)/,/^(?:--[o])/,/^(?:---)/,/^(?:-)/,/^(?:[a-zåäöæøA-ZÅÄÖÆØ]+)/,/^(?:\|)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:\{)/,/^(?:\})/,/^(?:\s)/,/^(?:\n)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],inclusive:!0}}};return t}();return I.lexer=O,t.prototype=I,I.Parser=t,new t}();"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=parser,exports.Parser=parser.Parser,exports.parse=function(){return parser.parse.apply(parser,arguments)},exports.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var e=require("fs").readFileSync(require("path").normalize(t[1]),"utf8");return exports.parser.parse(e)},"undefined"!=typeof module&&require.main===module&&exports.main(process.argv.slice(1)));var mermaid;"undefined"==typeof mermaid&&(mermaid={}),mermaid.vertices={},mermaid.edges=[],mermaid.graph={addVertex:function(t,e,r,n){console.log("Got node "+t+" "+r+" "+e+" styles: "+JSON.stringify(n)),"undefined"==typeof mermaid.vertices[t]&&(mermaid.vertices[t]={id:t,styles:[]}),"undefined"!=typeof e&&(mermaid.vertices[t].text=e),"undefined"!=typeof r&&(mermaid.vertices[t].type=r),"undefined"!=typeof n&&null!==n&&n.forEach(function(e){mermaid.vertices[t].styles.push(e)})},addLink:function(t,e,r,n){var i={start:t,end:e,type:void 0,text:""},n=r.text;"undefined"!=typeof n&&(i.text=n),"undefined"!=typeof r&&(i.type=r.type),mermaid.edges.push(i)},updateLink:function(t,e){var r=t.substr(1);mermaid.edges[r].style=e},setDirection:function(t){mermaid.direction=t},getVertices:function(){return mermaid.vertices},getEdges:function(){return mermaid.edges},clear:function(){mermaid.vertices={},mermaid.edges=[]},defaultStyle:function(){return"fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"}};var mermaid;"undefined"==typeof mermaid&&(mermaid={}),mermaid.addVertices=function(t,e){var r=Object.keys(t);r.forEach(function(r){var n,i,s=t[r],a="";for(i=0;i<s.styles.length;i++)"undefined"!=typeof s.styles[i]&&(a=a+s.styles[i]+";");n=void 0===s.text?s.id:s.text,"round"===s.type?e.setNode(s.id,{label:n,rx:5,ry:5,style:a}):"diamond"===s.type?e.setNode(s.id,{shape:"question",label:n,rx:0,ry:0,style:a}):e.setNode(s.id,{label:n,rx:0,ry:0,style:a})})},mermaid.addEdges=function(t,e){t.forEach(function(t){aHead="arrow_open"===t.type?"none":"vee","undefined"===t.text?"undefined"==typeof t.style?e.setEdge(t.start,t.end,{arrowheadStyle:"fill: #333",arrowhead:aHead}):e.setEdge(t.start,t.end,{style:t.style,arrowheadStyle:"fill: #333",arrowhead:aHead}):"undefined"==typeof t.style?e.setEdge(t.start,t.end,{label:t.text,arrowheadStyle:"fill: #33f",arrowhead:aHead}):e.setEdge(t.start,t.end,{style:t.style,arrowheadStyle:"fill: #333",label:t.text,arrowhead:aHead})})},mermaid.drawChart=function(t,e){mermaid.graph.clear(),parser.yy=mermaid.graph,parser.parse(t);var r;r=mermaid.direction,"undefined"==typeof r&&(r="TD");var n=(new dagreD3.graphlib.Graph).setGraph({rankdir:r,marginx:20,marginy:20}).setDefaultEdgeLabel(function(){return{}}),i=mermaid.graph.getVertices(),s=mermaid.graph.getEdges();this.addVertices(i,n),this.addEdges(s,n);var a=new dagreD3.render;a.shapes().question=function(t,e,r){var n=e.width,i=3*e.height,s=[{x:n/2,y:0},{x:n,y:-i/2},{x:n/2,y:-i},{x:0,y:-i/2}];return shapeSvg=t.insert("polygon",":first-child").attr("points",s.map(function(t){return t.x+","+t.y}).join(" ")).style("fill","#fff").style("stroke","#333").attr("rx",5).attr("ry",5).attr("transform","translate("+-n/2+","+2*i/4+")"),r.intersect=function(t){return dagreD3.intersect.polygon(r,s,t)},shapeSvg},a.arrows().none=function(t,e,r,n){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),s=i.append("path").attr("d","M 0 0 L 0 0 L 0 0 z");dagreD3.util.applyStyle(s,r[n+"Style"])};var o=d3.select("#"+e);svgGroup=d3.select("#"+e+" g"),a(d3.select("#"+e+" g"),n);(o.attr("width")-n.graph().width)/2;o.attr("height",n.graph().height+40)},mermaid.init=function(){var t=document.querySelectorAll(".mermaid"),e=0;for(i=0;i<t.length;i++){var r,n=t[i];r="mermaidChart"+e,e++;var s=n.textContent.trim();n.innerHTML='<svg id="'+r+'" width="100%"><g /></svg>',this.drawChart(s,r)}},document.addEventListener("DOMContentLoaded",function(){mermaid.init()},!1);