!function(){"use strict";functionDiagram(){this.title=void0,this.actors=[],this.signals=[]}functionParseError(message,hash){_.extend(this,hash),this.name="ParseError",this.message=message||""}functionAssertException(message){this.message=message}functionassert(exp,message){if(!exp)thrownewAssertException(message)}functiongetCenterX(box){returnbox.x+box.width/2}functiongetCenterY(box){returnbox.y+box.height/2}Diagram.prototype.getActor=function(alias,name){alias=alias.trim();vari,actors=this.actors;for(iinactors)if(actors[i].alias==alias)returnactors[i];returni=actors.push(newDiagram.Actor(alias,name||alias,actors.length)),actors[i-1]},Diagram.prototype.getActorWithAlias=function(input){input=input.trim();varalias,name,s=/([\s\S]+) as (\S+)$/im.exec(input);returns?(name=s[1].trim(),alias=s[2].trim()):name=alias=input,this.getActor(alias,name)},Diagram.prototype.setTitle=function(title){this.title=title},Diagram.prototype.addSignal=function(signal){this.signals.push(signal)},Diagram.Actor=function(alias,name,index){this.alias=alias,this.name=name,this.index=index},Diagram.Signal=function(actorA,signaltype,actorB,message){this.type="Signal",this.actorA=actorA,this.actorB=actorB,this.linetype=3&signaltype,this.arrowtype=signaltype>>2&3,this.message=message},Diagram.Signal.prototype.isSelf=function(){returnthis.actorA.index==this.actorB.index},Diagram.Note=function(actor,placement,message){if(this.type="Note",this.actor=actor,this.placement=placement,this.message=message,this.hasManyActors()&&actor[0]==actor[1])thrownewError("Note should be over two different actors")},Diagram.Note.prototype.hasManyActors=function(){return_.isArray(this.actor)},Diagram.unescape=function(s){returns.trim().replace(/^"(.*)"$/m,"$1").replace(/\\n/gm,"\n")},Diagram.LINETYPE={SOLID:0,DOTTED:1},Diagram.ARROWTYPE={FILLED:0,OPEN:1},Diagram.PLACEMENT={LEFTOF:0,RIGHTOF:1,OVER:2},"function"!=typeofObject.getPrototypeOf&&("object"==typeof"test".__proto__?Object.getPrototypeOf=function(object){returnobject.__proto__}:Object.getPrototypeOf=function(object){returnobject.constructor.prototype});varparser=function(){functionParser(){this.yy={}}varo=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);returno},$V0=[5,8,9,13,15,24],$V1=[1,13],$V2=[1,17],$V3=[24,29,30],parser={trace:function(){},yy:{},symbols_:{error:2,start:3,document:4,EOF:5,line:6,statement:7,NL:8,participant:9,actor_alias:10,signal:11,note_statement:12,title:13,message:14,note:15,placement:16,actor:17,over:18,actor_pair:19,",":20,left_of:21,right_of:22,signaltype:23,ACTOR:24,linetype:25,arrowtype:26,LINE:27,DOTLINE:28,ARROW:29,OPENARROW:30,MESSAGE:31,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"NL",9:"participant",13:"title",15:"note",18:"over",20:",",21:"left_of",22:"right_of",24:"ACTOR",27:"LINE",28:"DOTLINE",29:"ARROW",30:"OPENARROW",31:"MESSAGE"},productions_:[0,[3,2],[4,0],[4,2],[6,1],[6,1],[7,2],[7,1],[7,1],[7,2],[12,4],[12,4],[19,1],[19,3],[16,1],[16,1],[11,4],[17,1],[10,1],[23,2],[23,1],[25,1],[25,1],[26,1],[26,1],[14,1]],performAction:function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var$0=$$.length-1;switch(yystate){case1:returnyy.parser.yy;case4:break;case6:$$[$0];break;case7:case8:yy.parser.yy.addSignal($$[$0]);break;case9:yy.parser.yy.setTitle($$[$0]);break;case10:this.$=newDiagram.Note($$[$0-1],$$[$0-2],$$[$0]);break;case11:this.$=newDiagram.Note($$[$0-1],Diagram.PLACEMENT.OVER,$$[$0]);break;case12:case20:this.$=$$[$0];break;case13:this.$=[$$[$0-2],$$[$0]];break;case14:this.$=Diagram.PLACEMENT.LEFTOF;break;case15:this.$=Diagram.PLACEMENT.RIGHTOF;break;case16:this.$=newDiagram.Signal($$[$0-3],$$[$0-2],$$[$0-1],$$[$0]);break;case17:this.$=yy.parser.yy.getActor(Diagram.unescape($$[$0]));break;case18:this.$=yy.parser.yy.getActorWithAlias(Diagram.unescape($$[$0]));break;case19:this.$=$$[$0-1]|$$[$0]<<2;break;case21:this.$=Diagram.LINETYPE.SOLID;break;case22:this.$=Diagram.LINETYPE.DOTTED;break;case23:this.$=Diagram.ARROWTYPE.FILLED;break;case24:this.$=Diagram.ARROWTYPE.OPEN;break;case25:this.$=Diagram.unescape($$[$0]