import{a as oe,b as ce,d as le,e as he,f as Pt,g as Dt}from"./chunk-NSKVY3IF.js";import{$a as ot,Fa as z,Ha as kt,I as ze,Ka as w,Na as de,Oa as pe,Wa as Ht,Ya as O,b as We,bb as ue,c as qe,db as fe,eb as Ut,fb as ge,gb as xe,h as _t,hb as Te,ib as ye,jb as Ee,nb as be}from"./chunk-KR7JTV7U.js";import{h as zt}from"./chunk-3V74GZ4F.js";var Qt=zt(qe(),1);var ti=zt(We(),1),ei=zt(ze(),1);var Kt=function(){var t=function(dt,m,_,k){for(_=_||{},k=dt.length;k--;_[dt[k]]=m);return _},e=[1,2],o=[1,3],i=[1,4],s=[2,4],n=[1,9],c=[1,11],h=[1,13],p=[1,14],r=[1,16],x=[1,17],E=[1,18],u=[1,24],g=[1,25],b=[1,26],P=[1,27],I=[1,28],R=[1,29],N=[1,30],F=[1,31],S=[1,32],tt=[1,33],W=[1,34],K=[1,35],Z=[1,36],q=[1,37],Y=[1,38],C=[1,39],G=[1,41],H=[1,42],X=[1,43],Q=[1,44],j=[1,45],y=[1,46],v=[1,4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,48,49,50,52,53,54,59,60,61,62,70],L=[4,5,16,50,52,53],pt=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],et=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,49,50,52,53,54,59,60,61,62,70],A=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,48,50,52,53,54,59,60,61,62,70],se=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,47,50,52,53,54,59,60,61,62,70],ht=[68,69,70],nt=[1,120],Ot={trace:function(){},yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,box_section:10,box_line:11,participant_statement:12,create:13,box:14,restOfLine:15,end:16,signal:17,autonumber:18,NUM:19,off:20,activate:21,actor:22,deactivate:23,note_statement:24,links_statement:25,link_statement:26,properties_statement:27,details_statement:28,title:29,legacy_title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,loop:36,rect:37,opt:38,alt:39,else_sections:40,par:41,par_sections:42,par_over:43,critical:44,option_sections:45,break:46,option:47,and:48,else:49,participant:50,AS:51,participant_actor:52,destroy:53,note:54,placement:55,text2:56,over:57,actor_pair:58,links:59,link:60,properties:61,details:62,spaceList:63,",":64,left_of:65,right_of:66,signaltype:67,"+":68,"-":69,ACTOR:70,SOLID_OPEN_ARROW:71,DOTTED_OPEN_ARROW:72,SOLID_ARROW:73,DOTTED_ARROW:74,SOLID_CROSS:75,DOTTED_CROSS:76,SOLID_POINT:77,DOTTED_POINT:78,TXT:79,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",13:"create",14:"box",15:"restOfLine",16:"end",18:"autonumber",19:"NUM",20:"off",21:"activate",23:"deactivate",29:"title",30:"legacy_title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"loop",37:"rect",38:"opt",39:"alt",41:"par",43:"par_over",44:"critical",46:"break",47:"option",48:"and",49:"else",50:"participant",51:"AS",52:"participant_actor",53:"destroy",54:"note",57:"over",59:"links",60:"link",61:"properties",62:"details",64:",",65:"left_of",66:"right_of",68:"+",69:"-",70:"ACTOR",71:"SOLID_OPEN_ARROW",72:"DOTTED_OPEN_ARROW",73:"SOLID_ARROW",74:"DOTTED_ARROW",75:"SOLID_CROSS",76:"DOTTED_CROSS",77:"SOLID_POINT",78:"DOTTED_POINT",79:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[10,0],[10,2],[11,2],[11,1],[11,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[45,1],[45,4],[42,1],[42,4],[40,1],[40,4],[12,5],[12,3],[12,5],[12,3],[12,3],[24,4],[24,4],[25,3],[26,3],[27,3],[28,3],[63,2],[63,1],[58,3],[58,1],[55,1],[55,1],[17,5],[17,5],[17,4],[22,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[67,1],[56,1]],performAction:function(m,_,k,T,M,l,vt){var d=l.length-1;switch(M){case 3:return T.apply(l[d]),l[d];case 4:case 9:this.$=[];break;case 5:case 10:l[d-1].push(l[d]),this.$=l[d-1];break;case 6:case 7:case 11:case 12:this.$=l[d];break;case 8:case 13:this.$=[];break;case 15:l[d].type="createParticipant",this.$=l[d];break;case 16:l[d-1].unshift({type:"boxStart",boxData:T.parseBoxData(l[d-2])}),l[d-1].push({type:"boxEnd",boxText:l[d-2]}),this.$=l[d-1];break;case 18:this.$={type:"sequenceIndex",sequenceIndex:Number(l[d-2]),sequenceIndexStep:Number(l[d-1]),sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(l[d-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:T.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:T.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"activeStart",signalType:T.LINETYPE.ACTIVE_START,actor:l[d-1]};break;case 23:this.$={type:"activeEnd",signalType:T.LINETYPE.ACTIVE_END,actor:l[d-1]};break;case 29:T.setDiagramTitle(l[d].substring(6)),this.$=l[d].substring(6);break;case 30:T.setDiagramTitle(l[d].substring(7)),this.$=l[d].substring(7);break;case 31:this.$=l[d].trim(),T.setAccTitle(this.$);break;case 32:case 33:this.$=l[d].trim(),T.setAccDescription(this.$);break;case 34:l[d-1].unshift({type:"loopStart",loopText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.LOOP_START}),l[d-1].push({type:"loopEnd",loopText:l[d-2],signalType:T.LINETYPE.LOOP_END}),this.$=l[d-1];break;case 35:l[d-1].unshift({type:"rectStart",color:T.parseMessage(l[d-2]),signalType:T.LINETYPE.RECT_START}),l[d-1].push({type:"rectEnd",color:T.parseMessage(l[d-2]),signalType:T.LINETYPE.RECT_END}),this.$=l[d-1];break;case 36:l[d-1].unshift({type:"optStart",optText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.OPT_START}),l[d-1].push({type:"optEnd",optText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.OPT_END}),this.$=l[d-1];break;case 37:l[d-1].unshift({type:"altStart",altText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.ALT_START}),l[d-1].push({type:"altEnd",signalType:T.LINETYPE.ALT_END}),this.$=l[d-1];break;case 38:l[d-1].unshift({type:"parStart",parText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.PAR_START}),l[d-1].push({type:"parEnd",signalType:T.LINETYPE.PAR_END}),this.$=l[d-1];break;case 39:l[d-1].unshift({type:"parStart",parText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.PAR_OVER_START}),l[d-1].push({type:"parEnd",signalType:T.LINETYPE.PAR_END}),this.$=l[d-1];break;case 40:l[d-1].unshift({type:"criticalStart",criticalText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.CRITICAL_START}),l[d-1].push({type:"criticalEnd",signalType:T.LINETYPE.CRITICAL_END}),this.$=l[d-1];break;case 41:l[d-1].unshift({type:"breakStart",breakText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.BREAK_START}),l[d-1].push({type:"breakEnd",optText:T.parseMessage(l[d-2]),signalType:T.LINETYPE.BREAK_END}),this.$=l[d-1];break;case 43:this.$=l[d-3].concat([{type:"option",optionText:T.parseMessage(l[d-1]),signalType:T.LINETYPE.CRITICAL_OPTION},l[d]]);break;case 45:this.$=l[d-3].concat([{type:"and",parText:T.parseMessage(l[d-1]),signalType:T.LINETYPE.PAR_AND},l[d]]);break;case 47:this.$=l[d-3].concat([{type:"else",altText:T.parseMessage(l[d-1]),signalType:T.LINETYPE.ALT_ELSE},l[d]]);break;case 48:l[d-3].draw="participant",l[d-3].type="addParticipant",l[d-3].description=T.parseMessage(l[d-1]),this.$=l[d-3];break;case 49:l[d-1].draw="participant",l[d-1].type="addParticipant",this.$=l[d-1];break;case 50:l[d-3].draw="actor",l[d-3].type="addParticipant",l[d-3].description=T.parseMessage(l[d-1]),this.$=l[d-3];break;case 51:l[d-1].draw="actor",l[d-1].type="addParticipant",this.$=l[d-1];break;case 52:l[d-1].type="destroyParticipant",this.$=l[d-1];break;case 53:this.$=[l[d-1],{type:"addNote",placement:l[d-2],actor:l[d-1].actor,text:l[d]}];break;case 54:l[d-2]=[].concat(l[d-1],l[d-1]).slice(0,2),l[d-2][0]=l[d-2][0].actor,l[d-2][1]=l[d-2][1].actor,this.$=[l[d-1],{type:"addNote",placement:T.PLACEMENT.OVER,actor:l[d-2].slice(0,2),text:l[d]}];break;case 55:this.$=[l[d-1],{type:"addLinks",actor:l[d-1].actor,text:l[d]}];break;case 56:this.$=[l[d-1],{type:"addALink",actor:l[d-1].actor,text:l[d]}];break;case 57:this.$=[l[d-1],{type:"addProperties",actor:l[d-1].actor,text:l[d]}];break;case 58:this.$=[l[d-1],{type:"addDetails",actor:l[d-1].actor,text:l[d]}];break;case 61:this.$=[l[d-2],l[d]];break;case 62:this.$=l[d];break;case 63:this.$=T.PLACEMENT.LEFTOF;break;case 64:this.$=T.PLACEMENT.RIGHTOF;break;case 65:this.$=[l[d-4],l[d-1],{type:"addMessage",from:l[d-4].actor,to:l[d-1].actor,signalType:l[d-3],msg:l[d],activate:!0},{type:"activeStart",signalType:T.LINETYPE.ACTIVE_START,actor:l[d-1]}];break;case 66:this.$=[l[d-4],l[d-1],{type:"addMessage",from:l[d-4].actor,to:l[d-1].actor,signalType:l[d-3],msg:l[d]},{type:"activeEnd",signalType:T.LINETYPE.ACTIVE_END,actor:l[d-4]}];break;case 67:this.$=[l[d-3],l[d-1],{type:"addMessage",from:l[d-3].actor,to:l[d-1].actor,signalType:l[d-2],msg:l[d]}];break;case 68:this.$={type:"addParticipant",actor:l[d]};break;case 69:this.$=T.LINETYPE.SOLID_OPEN;break;case 70:this.$=T.LINETYPE.DOTTED_OPEN;break;case 71:this.$=T.LINETYPE.SOLID;break;case 72:this.$=T.LINETYPE.DOTTED;break;case 73:this.$=T.LINETYPE.SOLID_CROSS;break;case 74:this.$=T.LINETYPE.DOTTED_CROSS;break;case 75:this.$=T.LINETYPE.SOLID_POINT;break;case 76:this.$=T.LINETYPE.DOTTED_POINT;break;case 77:this.$=T.parseMessage(l[d].trim().substring(1));break}},table:[{3:1,4:e,5:o,6:i},{1:[3]},{3:5,4:e,5:o,6:i},{3:6,4:e,5:o,6:i},t([1,4,5,13,14,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,54,59,60,61,62,70],s,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:c,8:8,9:10,12:12,13:h,14:p,17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},t(v,[2,5]),{9:47,12:12,13:h,14:p,17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},t(v,[2,7]),t(v,[2,8]),t(v,[2,14]),{12:48,50:q,52:Y,53:C},{15:[1,49]},{5:[1,50]},{5:[1,53],19:[1,51],20:[1,52]},{22:54,70:y},{22:55,70:y},{5:[1,56]},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},t(v,[2,29]),t(v,[2,30]),{32:[1,61]},{34:[1,62]},t(v,[2,33]),{15:[1,63]},{15:[1,64]},{15:[1,65]},{15:[1,66]},{15:[1,67]},{15:[1,68]},{15:[1,69]},{15:[1,70]},{22:71,70:y},{22:72,70:y},{22:73,70:y},{67:74,71:[1,75],72:[1,76],73:[1,77],74:[1,78],75:[1,79],76:[1,80],77:[1,81],78:[1,82]},{55:83,57:[1,84],65:[1,85],66:[1,86]},{22:87,70:y},{22:88,70:y},{22:89,70:y},{22:90,70:y},t([5,51,64,71,72,73,74,75,76,77,78,79],[2,68]),t(v,[2,6]),t(v,[2,15]),t(L,[2,9],{10:91}),t(v,[2,17]),{5:[1,93],19:[1,92]},{5:[1,94]},t(v,[2,21]),{5:[1,95]},{5:[1,96]},t(v,[2,24]),t(v,[2,25]),t(v,[2,26]),t(v,[2,27]),t(v,[2,28]),t(v,[2,31]),t(v,[2,32]),t(pt,s,{7:97}),t(pt,s,{7:98}),t(pt,s,{7:99}),t(et,s,{40:100,7:101}),t(A,s,{42:102,7:103}),t(A,s,{7:103,42:104}),t(se,s,{45:105,7:106}),t(pt,s,{7:107}),{5:[1,109],51:[1,108]},{5:[1,111],51:[1,110]},{5:[1,112]},{22:115,68:[1,113],69:[1,114],70:y},t(ht,[2,69]),t(ht,[2,70]),t(ht,[2,71]),t(ht,[2,72]),t(ht,[2,73]),t(ht,[2,74]),t(ht,[2,75]),t(ht,[2,76]),{22:116,70:y},{22:118,58:117,70:y},{70:[2,63]},{70:[2,64]},{56:119,79:nt},{56:121,79:nt},{56:122,79:nt},{56:123,79:nt},{4:[1,126],5:[1,128],11:125,12:127,16:[1,124],50:q,52:Y,53:C},{5:[1,129]},t(v,[2,19]),t(v,[2,20]),t(v,[2,22]),t(v,[2,23]),{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[1,130],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[1,131],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[1,132],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{16:[1,133]},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[2,46],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,49:[1,134],50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{16:[1,135]},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[2,44],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,48:[1,136],50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{16:[1,137]},{16:[1,138]},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[2,42],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,47:[1,139],50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{4:n,5:c,8:8,9:10,12:12,13:h,14:p,16:[1,140],17:15,18:r,21:x,22:40,23:E,24:19,25:20,26:21,27:22,28:23,29:u,30:g,31:b,33:P,35:I,36:R,37:N,38:F,39:S,41:tt,43:W,44:K,46:Z,50:q,52:Y,53:C,54:G,59:H,60:X,61:Q,62:j,70:y},{15:[1,141]},t(v,[2,49]),{15:[1,142]},t(v,[2,51]),t(v,[2,52]),{22:143,70:y},{22:144,70:y},{56:145,79:nt},{56:146,79:nt},{56:147,79:nt},{64:[1,148],79:[2,62]},{5:[2,55]},{5:[2,77]},{5:[2,56]},{5:[2,57]},{5:[2,58]},t(v,[2,16]),t(L,[2,10]),{12:149,50:q,52:Y,53:C},t(L,[2,12]),t(L,[2,13]),t(v,[2,18]),t(v,[2,34]),t(v,[2,35]),t(v,[2,36]),t(v,[2,37]),{15:[1,150]},t(v,[2,38]),{15:[1,151]},t(v,[2,39]),t(v,[2,40]),{15:[1,152]},t(v,[2,41]),{5:[1,153]},{5:[1,154]},{56:155,79:nt},{56:156,79:nt},{5:[2,67]},{5:[2,53]},{5:[2,54]},{22:157,70:y},t(L,[2,11]),t(et,s,{7:101,40:158}),t(A,s,{7:103,42:159}),t(se,s,{7:106,45:160}),t(v,[2,48]),t(v,[2,50]),{5:[2,65]},{5:[2,66]},{79:[2,61]},{16:[2,47]},{16:[2,45]},{16:[2,43]}],defaultActions:{5:[2,1],6:[2,2],85:[2,63],86:[2,64],119:[2,55],120:[2,77],121:[2,56],122:[2,57],123:[2,58],145:[2,67],146:[2,53],147:[2,54],155:[2,65],156:[2,66],157:[2,61],158:[2,47],159:[2,45],160:[2,43]},parseError:function(m,_){if(_.recoverable)this.trace(m);else{var k=new Error(m);throw k.hash=_,k}},parse:function(m){var _=this,k=[0],T=[],M=[null],l=[],vt=this.table,d="",St=0,ne=0,Oe=2,re=1,Be=l.slice.call(arguments,1),B=Object.create(this.lexer),ut={yy:{}};for(var Yt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Yt)&&(ut.yy[Yt]=this.yy[Yt]);B.setInput(m,ut.yy),ut.yy.lexer=B,ut.yy.parser=this,typeof B.yylloc=="undefined"&&(B.yylloc={});var Ft=B.yylloc;l.push(Ft);var Ye=B.options&&B.options.ranges;typeof ut.yy.parseError=="function"?this.parseError=ut.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Fe(){var at;return at=T.pop()||B.lex()||re,typeof at!="number"&&(at instanceof Array&&(T=at,at=T.pop()),at=_.symbols_[at]||at),at}for(var U,ft,$,Wt,yt={},Mt,rt,ae,Rt;;){if(ft=k[k.length-1],this.defaultActions[ft]?$=this.defaultActions[ft]:((U===null||typeof U=="undefined")&&(U=Fe()),$=vt[ft]&&vt[ft][U]),typeof $=="undefined"||!$.length||!$[0]){var qt="";Rt=[];for(Mt in vt[ft])this.terminals_[Mt]&&Mt>Oe&&Rt.push("'"+this.terminals_[Mt]+"'");B.showPosition?qt="Parse error on line "+(St+1)+`: `+B.showPosition()+` Expecting `+Rt.join(", ")+", got '"+(this.terminals_[U]||U)+"'":qt="Parse error on line "+(St+1)+": Unexpected "+(U==re?"end of input":"'"+(this.terminals_[U]||U)+"'"),this.parseError(qt,{text:B.match,token:this.terminals_[U]||U,line:B.yylineno,loc:Ft,expected:Rt})}if($[0]instanceof Array&&$.length>1)throw new Error("Parse Error: multiple actions possible at state: "+ft+", token: "+U);switch($[0]){case 1:k.push(U),M.push(B.yytext),l.push(B.yylloc),k.push($[1]),U=null,ne=B.yyleng,d=B.yytext,St=B.yylineno,Ft=B.yylloc;break;case 2:if(rt=this.productions_[$[1]][1],yt.$=M[M.length-rt],yt._$={first_line:l[l.length-(rt||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(rt||1)].first_column,last_column:l[l.length-1].last_column},Ye&&(yt._$.range=[l[l.length-(rt||1)].range[0],l[l.length-1].range[1]]),Wt=this.performAction.apply(yt,[d,ne,St,ut.yy,$[1],M,l].concat(Be)),typeof Wt!="undefined")return Wt;rt&&(k=k.slice(0,-1*rt*2),M=M.slice(0,-1*rt),l=l.slice(0,-1*rt)),k.push(this.productions_[$[1]][0]),M.push(yt.$),l.push(yt._$),ae=vt[k[k.length-2]][k[k.length-1]],k.push(ae);break;case 3:return!0}}return!0}},Ce=function(){var dt={EOF:1,parseError:function(_,k){if(this.yy.parser)this.yy.parser.parseError(_,k);else throw new Error(_)},setInput:function(m,_){return this.yy=_||this.yy||{},this._input=m,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 m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var _=m.match(/(?:\r\n?|\n).*/g);return _?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},unput:function(m){var _=m.length,k=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-_),this.offset-=_;var T=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),k.length-1&&(this.yylineno-=k.length-1);var M=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:k?(k.length===T.length?this.yylloc.first_column:0)+T[T.length-k.length].length-k[0].length:this.yylloc.first_column-_},this.options.ranges&&(this.yylloc.range=[M[0],M[0]+this.yyleng-_]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else 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). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(m){this.unput(this.match.slice(m))},pastInput:function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var m=this.pastInput(),_=new Array(m.length+1).join("-");return m+this.upcomingInput()+` `+_+"^"},test_match:function(m,_){var k,T,M;if(this.options.backtrack_lexer&&(M={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&&(M.yylloc.range=this.yylloc.range.slice(0))),T=m[0].match(/(?:\r\n?|\n).*/g),T&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,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(m[0].length),this.matched+=m[0],k=this.performAction.call(this,this.yy,this,_,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var l in M)this[l]=M[l];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,_,k,T;this._more||(this.yytext="",this.match="");for(var M=this._currentRules(),l=0;l_[0].length)){if(_=k,T=l,this.options.backtrack_lexer){if(m=this.test_match(k,M[l]),m!==!1)return m;if(this._backtrack){_=!1;continue}else return!1}else if(!this.options.flex)break}return _?(m=this.test_match(_,M[T]),m!==!1?m:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var _=this.next();return _||this.lex()},begin:function(_){this.conditionStack.push(_)},popState:function(){var _=this.conditionStack.length-1;return _>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(_){return _=this.conditionStack.length-1-Math.abs(_||0),_>=0?this.conditionStack[_]:"INITIAL"},pushState:function(_){this.begin(_)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(_,k,T,M){switch(T){case 0:return 5;case 1:break;case 2:break;case 3:break;case 4:break;case 5:break;case 6:return 19;case 7:return this.begin("LINE"),14;case 8:return this.begin("ID"),50;case 9:return this.begin("ID"),52;case 10:return 13;case 11:return this.begin("ID"),53;case 12:return k.yytext=k.yytext.trim(),this.begin("ALIAS"),70;case 13:return this.popState(),this.popState(),this.begin("LINE"),51;case 14:return this.popState(),this.popState(),5;case 15:return this.begin("LINE"),36;case 16:return this.begin("LINE"),37;case 17:return this.begin("LINE"),38;case 18:return this.begin("LINE"),39;case 19:return this.begin("LINE"),49;case 20:return this.begin("LINE"),41;case 21:return this.begin("LINE"),43;case 22:return this.begin("LINE"),48;case 23:return this.begin("LINE"),44;case 24:return this.begin("LINE"),47;case 25:return this.begin("LINE"),46;case 26:return this.popState(),15;case 27:return 16;case 28:return 65;case 29:return 66;case 30:return 59;case 31:return 60;case 32:return 61;case 33:return 62;case 34:return 57;case 35:return 54;case 36:return this.begin("ID"),21;case 37:return this.begin("ID"),23;case 38:return 29;case 39:return 30;case 40:return this.begin("acc_title"),31;case 41:return this.popState(),"acc_title_value";case 42:return this.begin("acc_descr"),33;case 43:return this.popState(),"acc_descr_value";case 44:this.begin("acc_descr_multiline");break;case 45:this.popState();break;case 46:return"acc_descr_multiline_value";case 47:return 6;case 48:return 18;case 49:return 20;case 50:return 64;case 51:return 5;case 52:return k.yytext=k.yytext.trim(),70;case 53:return 73;case 54:return 74;case 55:return 71;case 56:return 72;case 57:return 75;case 58:return 76;case 59:return 77;case 60:return 78;case 61:return 79;case 62:return 68;case 63:return 69;case 64:return 5;case 65:return"INVALID"}},rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:box\b)/i,/^(?:participant\b)/i,/^(?:actor\b)/i,/^(?:create\b)/i,/^(?:destroy\b)/i,/^(?:[^\->:\n,;]+?([\-]*[^\->:\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,/^(?:par_over\b)/i,/^(?:and\b)/i,/^(?:critical\b)/i,/^(?:option\b)/i,/^(?:break\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\s[^#\n;]+)/i,/^(?:title:\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:sequenceDiagram\b)/i,/^(?:autonumber\b)/i,/^(?:off\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],conditions:{acc_descr_multiline:{rules:[45,46],inclusive:!1},acc_descr:{rules:[43],inclusive:!1},acc_title:{rules:[41],inclusive:!1},ID:{rules:[2,3,12],inclusive:!1},ALIAS:{rules:[2,3,13,14],inclusive:!1},LINE:{rules:[2,3,26],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,7,8,9,10,11,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,39,40,42,44,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65],inclusive:!0}}};return dt}();Ot.lexer=Ce;function Bt(){this.yy={}}return Bt.prototype=Ot,Ot.Parser=Bt,new Bt}();Kt.parser=Kt;var He=Kt,Lt,lt={},jt={},$t={},mt=[],J=[],Vt=!1,Gt,ct,It,Et,Ue=function(t){mt.push({name:t.text,wrap:t.wrap===void 0&&xt()||!!t.wrap,fill:t.color,actorKeys:[]}),ct=mt.slice(-1)[0]},Xt=function(t,e,o,i){let s=ct,n=lt[t];if(n){if(ct&&n.box&&ct!==n.box)throw new Error("A same participant should only be defined in one Box: "+n.name+" can't be in '"+n.box.name+"' and in '"+ct.name+"' at the same time.");if(s=n.box?n.box:ct,n.box=s,n&&e===n.name&&o==null)return}(o==null||o.text==null)&&(o={text:e,wrap:null,type:i}),(i==null||o.text==null)&&(o={text:e,wrap:null,type:i}),lt[t]={box:s,name:e,description:o.text,wrap:o.wrap===void 0&&xt()||!!o.wrap,prevActor:Lt,links:{},properties:{},actorCnt:null,rectData:null,type:i||"participant"},Lt&<[Lt]&&(lt[Lt].nextActor=t),ct&&ct.actorKeys.push(t),Lt=t},Ke=t=>{let e,o=0;for(e=0;e>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},c}return J.push({from:t,to:e,message:o.text,wrap:o.wrap===void 0&&xt()||!!o.wrap,type:i,activate:s}),!0},Xe=function(){return mt.length>0},Je=function(){return mt.some(t=>t.name)},Ze=function(){return J},Qe=function(){return mt},je=function(){return lt},$e=function(){return jt},t0=function(){return $t},Nt=function(t){return lt[t]},e0=function(){return Object.keys(lt)},i0=function(){Vt=!0},s0=function(){Vt=!1},n0=()=>Vt,r0=function(t){Gt=t},xt=()=>Gt!==void 0?Gt:ot().sequence.wrap,a0=function(){lt={},jt={},$t={},mt=[],J=[],Vt=!1,fe()},o0=function(t){let e=t.trim(),o={text:e.replace(/^:?(?:no)?wrap:/,"").trim(),wrap:e.match(/^:?wrap:/)!==null?!0:e.match(/^:?nowrap:/)!==null?!1:void 0};return z.debug("parseMessage:",o),o},c0=function(t){let e=t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/),o=e!=null&&e[1]?e[1].trim():"transparent",i=e!=null&&e[2]?e[2].trim():void 0;if(window&&window.CSS)window.CSS.supports("color",o)||(o="transparent",i=t.trim());else{let n=new Option().style;n.color=o,n.color!==o&&(o="transparent",i=t.trim())}return{color:o,text:i!==void 0?kt(i.replace(/^:?(?:no)?wrap:/,""),ot()):void 0,wrap:i!==void 0?i.match(/^:?wrap:/)!==null?!0:i.match(/^:?nowrap:/)!==null?!1:void 0:void 0}},At={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25,AUTONUMBER:26,CRITICAL_START:27,CRITICAL_OPTION:28,CRITICAL_END:29,BREAK_START:30,BREAK_END:31,PAR_OVER_START:32},l0={FILLED:0,OPEN:1},h0={LEFTOF:0,RIGHTOF:1,OVER:2},ve=function(t,e,o){o.text,o.wrap===void 0&&xt()||o.wrap;let i=[].concat(t,t);J.push({from:i[0],to:i[1],message:o.text,wrap:o.wrap===void 0&&xt()||!!o.wrap,type:At.NOTE,placement:e})},_e=function(t,e){let o=Nt(t);try{let i=kt(e.text,ot());i=i.replace(/&/g,"&"),i=i.replace(/=/g,"=");let s=JSON.parse(i);te(o,s)}catch(i){z.error("error while parsing actor link text",i)}},d0=function(t,e){let o=Nt(t);try{let c={},h=kt(e.text,ot());var i=h.indexOf("@");h=h.replace(/&/g,"&"),h=h.replace(/=/g,"=");var s=h.slice(0,i-1).trim(),n=h.slice(i+1).trim();c[s]=n,te(o,c)}catch(c){z.error("error while parsing actor link text",c)}};function te(t,e){if(t.links==null)t.links=e;else for(let o in e)t.links[o]=e[o]}var Pe=function(t,e){let o=Nt(t);try{let i=kt(e.text,ot()),s=JSON.parse(i);ke(o,s)}catch(i){z.error("error while parsing actor properties text",i)}};function ke(t,e){if(t.properties==null)t.properties=e;else for(let o in e)t.properties[o]=e[o]}function p0(){ct=void 0}var Le=function(t,e){let o=Nt(t),i=document.getElementById(e.text);try{let s=i.innerHTML,n=JSON.parse(s);n.properties&&ke(o,n.properties),n.links&&te(o,n.links)}catch(s){z.error("error while parsing actor details text",s)}},u0=function(t,e){if(t!==void 0&&t.properties!==void 0)return t.properties[e]},Ie=function(t){if(Array.isArray(t))t.forEach(function(e){Ie(e)});else switch(t.type){case"sequenceIndex":J.push({from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":Xt(t.actor,t.actor,t.description,t.draw);break;case"createParticipant":if(lt[t.actor])throw new Error("It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior");It=t.actor,Xt(t.actor,t.actor,t.description,t.draw),jt[t.actor]=J.length;break;case"destroyParticipant":Et=t.actor,$t[t.actor]=J.length;break;case"activeStart":D(t.actor,void 0,void 0,t.signalType);break;case"activeEnd":D(t.actor,void 0,void 0,t.signalType);break;case"addNote":ve(t.actor,t.placement,t.text);break;case"addLinks":_e(t.actor,t.text);break;case"addALink":d0(t.actor,t.text);break;case"addProperties":Pe(t.actor,t.text);break;case"addDetails":Le(t.actor,t.text);break;case"addMessage":if(It){if(t.to!==It)throw new Error("The created participant "+It+" does not have an associated creating message after its declaration. Please check the sequence diagram.");It=void 0}else if(Et){if(t.to!==Et&&t.from!==Et)throw new Error("The destroyed participant "+Et+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");Et=void 0}D(t.from,t.to,t.msg,t.signalType,t.activate);break;case"boxStart":Ue(t.boxData);break;case"boxEnd":p0();break;case"loopStart":D(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":D(void 0,void 0,void 0,t.signalType);break;case"rectStart":D(void 0,void 0,t.color,t.signalType);break;case"rectEnd":D(void 0,void 0,void 0,t.signalType);break;case"optStart":D(void 0,void 0,t.optText,t.signalType);break;case"optEnd":D(void 0,void 0,void 0,t.signalType);break;case"altStart":D(void 0,void 0,t.altText,t.signalType);break;case"else":D(void 0,void 0,t.altText,t.signalType);break;case"altEnd":D(void 0,void 0,void 0,t.signalType);break;case"setAccTitle":Ut(t.text);break;case"parStart":D(void 0,void 0,t.parText,t.signalType);break;case"and":D(void 0,void 0,t.parText,t.signalType);break;case"parEnd":D(void 0,void 0,void 0,t.signalType);break;case"criticalStart":D(void 0,void 0,t.criticalText,t.signalType);break;case"option":D(void 0,void 0,t.optionText,t.signalType);break;case"criticalEnd":D(void 0,void 0,void 0,t.signalType);break;case"breakStart":D(void 0,void 0,t.breakText,t.signalType);break;case"breakEnd":D(void 0,void 0,void 0,t.signalType);break}},me={addActor:Xt,addMessage:Ge,addSignal:D,addLinks:_e,addDetails:Le,addProperties:Pe,autoWrap:xt,setWrap:r0,enableSequenceNumbers:i0,disableSequenceNumbers:s0,showSequenceNumbers:n0,getMessages:Ze,getActors:je,getCreatedActors:$e,getDestroyedActors:t0,getActor:Nt,getActorKeys:e0,getActorProperty:u0,getAccTitle:ge,getBoxes:Qe,getDiagramTitle:Ee,setDiagramTitle:ye,getConfig:()=>ot().sequence,clear:a0,parseMessage:o0,parseBoxData:c0,LINETYPE:At,ARROWTYPE:l0,PLACEMENT:h0,addNote:ve,setAccTitle:Ut,apply:Ie,setAccDescription:xe,getAccDescription:Te,hasAtLeastOneBox:Xe,hasAtLeastOneBoxWithTitle:Je},f0=t=>`.actor { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; } text.actor > tspan { fill: ${t.actorTextColor}; stroke: none; } .actor-line { stroke: ${t.actorLineColor}; } .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: ${t.signalColor}; } .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: ${t.signalColor}; } #arrowhead path { fill: ${t.signalColor}; stroke: ${t.signalColor}; } .sequenceNumber { fill: ${t.sequenceNumberColor}; } #sequencenumber { fill: ${t.signalColor}; } #crosshead path { fill: ${t.signalColor}; stroke: ${t.signalColor}; } .messageText { fill: ${t.signalTextColor}; stroke: none; } .labelBox { stroke: ${t.labelBoxBorderColor}; fill: ${t.labelBoxBkgColor}; } .labelText, .labelText > tspan { fill: ${t.labelTextColor}; stroke: none; } .loopText, .loopText > tspan { fill: ${t.loopTextColor}; stroke: none; } .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: ${t.labelBoxBorderColor}; fill: ${t.labelBoxBorderColor}; } .note { //stroke: #decc93; stroke: ${t.noteBorderColor}; fill: ${t.noteBkgColor}; } .noteText, .noteText > tspan { fill: ${t.noteTextColor}; stroke: none; } .activation0 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .activation1 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .activation2 { fill: ${t.activationBkgColor}; stroke: ${t.activationBorderColor}; } .actorPopupMenu { position: absolute; } .actorPopupMenuPanel { position: absolute; fill: ${t.actorBkg}; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4)); } .actor-man line { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; } .actor-man circle, line { stroke: ${t.actorBorder}; fill: ${t.actorBkg}; stroke-width: 2px; } `,g0=f0,gt=18*2,ee=function(t,e){return oe(t,e)},Ae=(t,e)=>{be(()=>{let o=document.querySelectorAll(t);o.length!==0&&(o[0].addEventListener("mouseover",function(){E0("actor"+e+"_popup")}),o[0].addEventListener("mouseout",function(){b0("actor"+e+"_popup")}))})},x0=function(t,e,o,i,s){if(e.links===void 0||e.links===null||Object.keys(e.links).length===0)return{height:0,width:0};let n=e.links,c=e.actorCnt,h=e.rectData;var p="none";s&&(p="block !important");let r=t.append("g");r.attr("id","actor"+c+"_popup"),r.attr("class","actorPopupMenu"),r.attr("display",p),Ae("#actor"+c+"_popup",c);var x="";h.class!==void 0&&(x=" "+h.class);let E=h.width>o?h.width:o,u=r.append("rect");if(u.attr("class","actorPopupMenuPanel"+x),u.attr("x",h.x),u.attr("y",h.height),u.attr("fill",h.fill),u.attr("stroke",h.stroke),u.attr("width",E),u.attr("height",h.height),u.attr("rx",h.rx),u.attr("ry",h.ry),n!=null){var g=20;for(let I in n){var b=r.append("a"),P=(0,Qt.sanitizeUrl)(n[I]);b.attr("xlink:href",P),b.attr("target","_blank"),C0(i)(I,b,h.x+10,h.height+g,E,20,{class:"actor"},i),g+=30}}return u.attr("height",g),{height:h.height+g,width:E}},T0=function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'block'; }"},y0=function(t){return"var pu = document.getElementById('"+t+"'); if (pu != null) { pu.style.display = 'none'; }"},E0=function(t){var e=document.getElementById(t);e!=null&&(e.style.display="block")},b0=function(t){var e=document.getElementById(t);e!=null&&(e.style.display="none")},wt=function(t,e){let o=0,i=0,s=e.text.split(w.lineBreakRegex),[n,c]=Ht(e.fontSize),h=[],p=0,r=()=>e.y;if(e.valign!==void 0&&e.textMargin!==void 0&&e.textMargin>0)switch(e.valign){case"top":case"start":r=()=>Math.round(e.y+e.textMargin);break;case"middle":case"center":r=()=>Math.round(e.y+(o+i+e.textMargin)/2);break;case"bottom":case"end":r=()=>Math.round(e.y+(o+i+2*e.textMargin)-e.textMargin);break}if(e.anchor!==void 0&&e.textMargin!==void 0&&e.width!==void 0)switch(e.anchor){case"left":case"start":e.x=Math.round(e.x+e.textMargin),e.anchor="start",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"middle":case"center":e.x=Math.round(e.x+e.width/2),e.anchor="middle",e.dominantBaseline="middle",e.alignmentBaseline="middle";break;case"right":case"end":e.x=Math.round(e.x+e.width-e.textMargin),e.anchor="end",e.dominantBaseline="middle",e.alignmentBaseline="middle";break}for(let[x,E]of s.entries()){e.textMargin!==void 0&&e.textMargin===0&&n!==void 0&&(p=x*n);let u=t.append("text");u.attr("x",e.x),u.attr("y",r()),e.anchor!==void 0&&u.attr("text-anchor",e.anchor).attr("dominant-baseline",e.dominantBaseline).attr("alignment-baseline",e.alignmentBaseline),e.fontFamily!==void 0&&u.style("font-family",e.fontFamily),c!==void 0&&u.style("font-size",c),e.fontWeight!==void 0&&u.style("font-weight",e.fontWeight),e.fill!==void 0&&u.attr("fill",e.fill),e.class!==void 0&&u.attr("class",e.class),e.dy!==void 0?u.attr("dy",e.dy):p!==0&&u.attr("dy",p);let g=E||pe;if(e.tspan){let b=u.append("tspan");b.attr("x",e.x),e.fill!==void 0&&b.attr("fill",e.fill),b.text(g)}else u.text(g);e.valign!==void 0&&e.textMargin!==void 0&&e.textMargin>0&&(i+=(u._groups||u)[0][0].getBBox().height,o=i),h.push(u)}return h},Ne=function(t,e){function o(s,n,c,h,p){return s+","+n+" "+(s+c)+","+n+" "+(s+c)+","+(n+h-p)+" "+(s+c-p*1.2)+","+(n+h)+" "+s+","+(n+h)}let i=t.append("polygon");return i.attr("points",o(e.x,e.y,e.width,e.height,7)),i.attr("class","labelBox"),e.y=e.y+e.height/2,wt(t,e),i},it=-1,Se=(t,e,o,i)=>{t.select&&o.forEach(s=>{let n=e[s],c=t.select("#actor"+n.actorCnt);!i.mirrorActors&&n.stopy?c.attr("y2",n.stopy+n.height/2):i.mirrorActors&&c.attr("y2",n.stopy)})},m0=function(t,e,o,i){let s=i?e.stopy:e.starty,n=e.x+e.width/2,c=s+5,h=t.append("g").lower();var p=h;i||(it++,p.append("line").attr("id","actor"+it).attr("x1",n).attr("y1",c).attr("x2",n).attr("y2",2e3).attr("class","actor-line").attr("class","200").attr("stroke-width","0.5px").attr("stroke","#999"),p=h.append("g"),e.actorCnt=it,e.links!=null&&(p.attr("id","root-"+it),Ae("#root-"+it,it)));let r=Pt();var x="actor";e.properties!=null&&e.properties.class?x=e.properties.class:r.fill="#eaeaea",r.x=e.x,r.y=s,r.width=e.width,r.height=e.height,r.class=x,r.rx=3,r.ry=3;let E=ee(p,r);if(e.rectData=r,e.properties!=null&&e.properties.icon){let g=e.properties.icon.trim();g.charAt(0)==="@"?he(p,r.x+r.width-20,r.y+10,g.substr(1)):le(p,r.x+r.width-20,r.y+10,g)}ie(o)(e.description,p,r.x,r.y,r.width,r.height,{class:"actor"},o);let u=e.height;if(E.node){let g=E.node().getBBox();e.height=g.height,u=g.height}return u},w0=function(t,e,o,i){let s=i?e.stopy:e.starty,n=e.x+e.width/2,c=s+80;t.lower(),i||(it++,t.append("line").attr("id","actor"+it).attr("x1",n).attr("y1",c).attr("x2",n).attr("y2",2e3).attr("class","actor-line").attr("class","200").attr("stroke-width","0.5px").attr("stroke","#999"),e.actorCnt=it);let h=t.append("g");h.attr("class","actor-man");let p=Pt();p.x=e.x,p.y=s,p.fill="#eaeaea",p.width=e.width,p.height=e.height,p.class="actor",p.rx=3,p.ry=3,h.append("line").attr("id","actor-man-torso"+it).attr("x1",n).attr("y1",s+25).attr("x2",n).attr("y2",s+45),h.append("line").attr("id","actor-man-arms"+it).attr("x1",n-gt/2).attr("y1",s+33).attr("x2",n+gt/2).attr("y2",s+33),h.append("line").attr("x1",n-gt/2).attr("y1",s+60).attr("x2",n).attr("y2",s+45),h.append("line").attr("x1",n).attr("y1",s+45).attr("x2",n+gt/2-2).attr("y2",s+60);let r=h.append("circle");r.attr("cx",e.x+e.width/2),r.attr("cy",s+10),r.attr("r",15),r.attr("width",e.width),r.attr("height",e.height);let x=h.node().getBBox();return e.height=x.height,ie(o)(e.description,h,p.x,p.y+35,p.width,p.height,{class:"actor"},o),e.height},v0=function(t,e,o,i){switch(e.type){case"actor":return w0(t,e,o,i);case"participant":return m0(t,e,o,i)}},_0=function(t,e,o){let s=t.append("g");Me(s,e),e.name&&ie(o)(e.name,s,e.x,e.y+(e.textMaxHeight||0)/2,e.width,0,{class:"text"},o),s.lower()},P0=function(t){return t.append("g")},k0=function(t,e,o,i,s){let n=Pt(),c=e.anchored;n.x=e.startx,n.y=e.starty,n.class="activation"+s%3,n.width=e.stopx-e.startx,n.height=o-e.starty,ee(c,n)},L0=function(t,e,o,i){let{boxMargin:s,boxTextMargin:n,labelBoxHeight:c,labelBoxWidth:h,messageFontFamily:p,messageFontSize:r,messageFontWeight:x}=i,E=t.append("g"),u=function(P,I,R,N){return E.append("line").attr("x1",P).attr("y1",I).attr("x2",R).attr("y2",N).attr("class","loopLine")};u(e.startx,e.starty,e.stopx,e.starty),u(e.stopx,e.starty,e.stopx,e.stopy),u(e.startx,e.stopy,e.stopx,e.stopy),u(e.startx,e.starty,e.startx,e.stopy),e.sections!==void 0&&e.sections.forEach(function(P){u(e.startx,P.y,e.stopx,P.y).style("stroke-dasharray","3, 3")});let g=Dt();g.text=o,g.x=e.startx,g.y=e.starty,g.fontFamily=p,g.fontSize=r,g.fontWeight=x,g.anchor="middle",g.valign="middle",g.tspan=!1,g.width=h||50,g.height=c||20,g.textMargin=n,g.class="labelText",Ne(E,g),g=Re(),g.text=e.title,g.x=e.startx+h/2+(e.stopx-e.startx)/2,g.y=e.starty+s+n,g.anchor="middle",g.valign="middle",g.textMargin=n,g.class="loopText",g.fontFamily=p,g.fontSize=r,g.fontWeight=x,g.wrap=!0;let b=wt(E,g);return e.sectionTitles!==void 0&&e.sectionTitles.forEach(function(P,I){if(P.message){g.text=P.message,g.x=e.startx+(e.stopx-e.startx)/2,g.y=e.sections[I].y+s+n,g.class="loopText",g.anchor="middle",g.valign="middle",g.tspan=!1,g.fontFamily=p,g.fontSize=r,g.fontWeight=x,g.wrap=e.wrap,b=wt(E,g);let R=Math.round(b.map(N=>(N._groups||N)[0][0].getBBox().height).reduce((N,F)=>N+F));e.sections[I].height+=R-(s+n)}}),e.height=Math.round(e.stopy-e.starty),E},Me=function(t,e){ce(t,e)},I0=function(t){t.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")},A0=function(t){t.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")},N0=function(t){t.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")},S0=function(t){t.append("defs").append("marker").attr("id","arrowhead").attr("refX",7.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")},M0=function(t){t.append("defs").append("marker").attr("id","filled-head").attr("refX",15.5).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")},R0=function(t){t.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)},D0=function(t){t.append("defs").append("marker").attr("id","crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",4).attr("refY",4.5).append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1pt").attr("d","M 1,2 L 6,7 M 6,2 L 1,7")},Re=function(){return{x:0,y:0,fill:void 0,anchor:void 0,style:"#666",width:void 0,height:void 0,textMargin:0,rx:0,ry:0,tspan:!0,valign:void 0}},V0=function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},ie=function(){function t(s,n,c,h,p,r,x){let E=n.append("text").attr("x",c+p/2).attr("y",h+r/2+5).style("text-anchor","middle").text(s);i(E,x)}function e(s,n,c,h,p,r,x,E){let{actorFontSize:u,actorFontFamily:g,actorFontWeight:b}=E,[P,I]=Ht(u),R=s.split(w.lineBreakRegex);for(let N=0;Nt.height||0))+(this.loops.length===0?0:this.loops.map(t=>t.height||0).reduce((t,e)=>t+e))+(this.messages.length===0?0:this.messages.map(t=>t.height||0).reduce((t,e)=>t+e))+(this.notes.length===0?0:this.notes.map(t=>t.height||0).reduce((t,e)=>t+e))},clear:function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},addBox:function(t){this.boxes.push(t)},addActor:function(t){this.actors.push(t)},addLoop:function(t){this.loops.push(t)},addMessage:function(t){this.messages.push(t)},addNote:function(t){this.notes.push(t)},lastActor:function(){return this.actors[this.actors.length-1]},lastLoop:function(){return this.loops[this.loops.length-1]},lastMessage:function(){return this.messages[this.messages.length-1]},lastNote:function(){return this.notes[this.notes.length-1]},actors:[],boxes:[],loops:[],messages:[],notes:[]},init:function(){this.sequenceItems=[],this.activations=[],this.models.clear(),this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0,Ve(ot())},updateVal:function(t,e,o,i){t[e]===void 0?t[e]=o:t[e]=i(o,t[e])},updateBounds:function(t,e,o,i){let s=this,n=0;function c(h){return function(r){n++;let x=s.sequenceItems.length-n+1;s.updateVal(r,"starty",e-x*a.boxMargin,Math.min),s.updateVal(r,"stopy",i+x*a.boxMargin,Math.max),s.updateVal(f.data,"startx",t-x*a.boxMargin,Math.min),s.updateVal(f.data,"stopx",o+x*a.boxMargin,Math.max),h!=="activation"&&(s.updateVal(r,"startx",t-x*a.boxMargin,Math.min),s.updateVal(r,"stopx",o+x*a.boxMargin,Math.max),s.updateVal(f.data,"starty",e-x*a.boxMargin,Math.min),s.updateVal(f.data,"stopy",i+x*a.boxMargin,Math.max))}}this.sequenceItems.forEach(c()),this.activations.forEach(c("activation"))},insert:function(t,e,o,i){let s=w.getMin(t,o),n=w.getMax(t,o),c=w.getMin(e,i),h=w.getMax(e,i);this.updateVal(f.data,"startx",s,Math.min),this.updateVal(f.data,"starty",c,Math.min),this.updateVal(f.data,"stopx",n,Math.max),this.updateVal(f.data,"stopy",h,Math.max),this.updateBounds(s,c,n,h)},newActivation:function(t,e,o){let i=o[t.from.actor],s=Ct(t.from.actor).length||0,n=i.x+i.width/2+(s-1)*a.activationWidth/2;this.activations.push({startx:n,starty:this.verticalPos+2,stopx:n+a.activationWidth,stopy:void 0,actor:t.from.actor,anchored:V.anchorElement(e)})},endActivation:function(t){let e=this.activations.map(function(o){return o.actor}).lastIndexOf(t.from.actor);return this.activations.splice(e,1)[0]},createLoop:function(t={message:void 0,wrap:!1,width:void 0},e){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:t.message,wrap:t.wrap,width:t.width,height:0,fill:e}},newLoop:function(t={message:void 0,wrap:!1,width:void 0},e){this.sequenceItems.push(this.createLoop(t,e))},endLoop:function(){return this.sequenceItems.pop()},isLoopOverlap:function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},addSectionToLoop:function(t){let e=this.sequenceItems.pop();e.sections=e.sections||[],e.sectionTitles=e.sectionTitles||[],e.sections.push({y:f.getVerticalPos(),height:0}),e.sectionTitles.push(t),this.sequenceItems.push(e)},saveVerticalPos:function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},resetVerticalPos:function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},bumpVerticalPos:function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=w.getMax(this.data.stopy,this.verticalPos)},getVerticalPos:function(){return this.verticalPos},getBounds:function(){return{bounds:this.data,models:this.models}}},O0=function(t,e){f.bumpVerticalPos(a.boxMargin),e.height=a.boxMargin,e.starty=f.getVerticalPos();let o=Pt();o.x=e.startx,o.y=e.starty,o.width=e.width||a.width,o.class="note";let i=t.append("g"),s=V.drawRect(i,o),n=Dt();n.x=e.startx,n.y=e.starty,n.width=o.width,n.dy="1em",n.text=e.message,n.class="noteText",n.fontFamily=a.noteFontFamily,n.fontSize=a.noteFontSize,n.fontWeight=a.noteFontWeight,n.anchor=a.noteAlign,n.textMargin=a.noteMargin,n.valign="center";let c=wt(i,n),h=Math.round(c.map(p=>(p._groups||p)[0][0].getBBox().height).reduce((p,r)=>p+r));s.attr("height",h+2*a.noteMargin),e.height+=h+2*a.noteMargin,f.bumpVerticalPos(h+2*a.noteMargin),e.stopy=e.starty+h+2*a.noteMargin,e.stopx=e.startx+o.width,f.insert(e.startx,e.starty,e.stopx,e.stopy),f.models.addNote(e)},Tt=t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),bt=t=>({fontFamily:t.noteFontFamily,fontSize:t.noteFontSize,fontWeight:t.noteFontWeight}),Jt=t=>({fontFamily:t.actorFontFamily,fontSize:t.actorFontSize,fontWeight:t.actorFontWeight});function B0(t,e){f.bumpVerticalPos(10);let{startx:o,stopx:i,message:s}=e,n=w.splitBreaks(s).length,c=O.calculateTextDimensions(s,Tt(a)),h=c.height/n;e.height+=h,f.bumpVerticalPos(h);let p,r=c.height-10,x=c.width;if(o===i){p=f.getVerticalPos()+r,a.rightAngles||(r+=a.boxMargin,p=f.getVerticalPos()+r),r+=30;let E=w.getMax(x/2,a.width/2);f.insert(o-E,f.getVerticalPos()-10+r,i+E,f.getVerticalPos()+30+r)}else r+=a.boxMargin,p=f.getVerticalPos()+r,f.insert(o,p-10,i,p);return f.bumpVerticalPos(r),e.height+=r,e.stopy=e.starty+e.height,f.insert(e.fromBounds,e.starty,e.toBounds,e.stopy),p}var Y0=function(t,e,o,i){let{startx:s,stopx:n,starty:c,message:h,type:p,sequenceIndex:r,sequenceVisible:x}=e,E=O.calculateTextDimensions(h,Tt(a)),u=Dt();u.x=s,u.y=c+10,u.width=n-s,u.class="messageText",u.dy="1em",u.text=h,u.fontFamily=a.messageFontFamily,u.fontSize=a.messageFontSize,u.fontWeight=a.messageFontWeight,u.anchor=a.messageAlign,u.valign="center",u.textMargin=a.wrapPadding,u.tspan=!1,wt(t,u);let g=E.width,b;s===n?a.rightAngles?b=t.append("path").attr("d",`M ${s},${o} H ${s+w.getMax(a.width/2,g/2)} V ${o+25} H ${s}`):b=t.append("path").attr("d","M "+s+","+o+" C "+(s+60)+","+(o-10)+" "+(s+60)+","+(o+30)+" "+s+","+(o+20)):(b=t.append("line"),b.attr("x1",s),b.attr("y1",o),b.attr("x2",n),b.attr("y2",o)),p===i.db.LINETYPE.DOTTED||p===i.db.LINETYPE.DOTTED_CROSS||p===i.db.LINETYPE.DOTTED_POINT||p===i.db.LINETYPE.DOTTED_OPEN?(b.style("stroke-dasharray","3, 3"),b.attr("class","messageLine1")):b.attr("class","messageLine0");let P="";a.arrowMarkerAbsolute&&(P=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,P=P.replace(/\(/g,"\\("),P=P.replace(/\)/g,"\\)")),b.attr("stroke-width",2),b.attr("stroke","none"),b.style("fill","none"),(p===i.db.LINETYPE.SOLID||p===i.db.LINETYPE.DOTTED)&&b.attr("marker-end","url("+P+"#arrowhead)"),(p===i.db.LINETYPE.SOLID_POINT||p===i.db.LINETYPE.DOTTED_POINT)&&b.attr("marker-end","url("+P+"#filled-head)"),(p===i.db.LINETYPE.SOLID_CROSS||p===i.db.LINETYPE.DOTTED_CROSS)&&b.attr("marker-end","url("+P+"#crosshead)"),(x||a.showSequenceNumbers)&&(b.attr("marker-start","url("+P+"#sequencenumber)"),t.append("text").attr("x",s).attr("y",o+4).attr("font-family","sans-serif").attr("font-size","12px").attr("text-anchor","middle").attr("class","sequenceNumber").text(r))},F0=function(t,e,o,i,s,n,c){let h=0,p=0,r,x=0;for(let E of i){let u=e[E],g=u.box;r&&r!=g&&(c||f.models.addBox(r),p+=a.boxMargin+r.margin),g&&g!=r&&(c||(g.x=h+p,g.y=s),p+=g.margin),u.width=u.width||a.width,u.height=w.getMax(u.height||a.height,a.height),u.margin=u.margin||a.actorMargin,x=w.getMax(x,u.height),o[u.name]&&(p+=u.width/2),u.x=h+p,u.starty=f.getVerticalPos(),f.insert(u.x,s,u.x+u.width,u.height),h+=u.width+p,u.box&&(u.box.width=h+g.margin-u.box.x),p=u.margin,r=u.box,f.models.addActor(u)}r&&!c&&f.models.addBox(r),f.bumpVerticalPos(x)},Zt=function(t,e,o,i){if(i){let s=0;f.bumpVerticalPos(a.boxMargin*2);for(let n of o){let c=e[n];c.stopy||(c.stopy=f.getVerticalPos());let h=V.drawActor(t,c,a,!0);s=w.getMax(s,h)}f.bumpVerticalPos(s+a.boxMargin)}else for(let s of o){let n=e[s];V.drawActor(t,n,a,!1)}},De=function(t,e,o,i){let s=0,n=0;for(let c of o){let h=e[c],p=H0(h),r=V.drawPopup(t,h,p,a,a.forceMenus,i);r.height>s&&(s=r.height),r.width+h.x>n&&(n=r.width+h.x)}return{maxHeight:s,maxWidth:n}},Ve=function(t){de(a,t),t.fontFamily&&(a.actorFontFamily=a.noteFontFamily=a.messageFontFamily=t.fontFamily),t.fontSize&&(a.actorFontSize=a.noteFontSize=a.messageFontSize=t.fontSize),t.fontWeight&&(a.actorFontWeight=a.noteFontWeight=a.messageFontWeight=t.fontWeight)},Ct=function(t){return f.activations.filter(function(e){return e.actor===t})},we=function(t,e){let o=e[t],i=Ct(t),s=i.reduce(function(c,h){return w.getMin(c,h.startx)},o.x+o.width/2-1),n=i.reduce(function(c,h){return w.getMax(c,h.stopx)},o.x+o.width/2+1);return[s,n]};function st(t,e,o,i,s){f.bumpVerticalPos(o);let n=i;if(e.id&&e.message&&t[e.id]){let c=t[e.id].width,h=Tt(a);e.message=O.wrapLabel(`[${e.message}]`,c-2*a.wrapPadding,h),e.width=c,e.wrap=!0;let p=O.calculateTextDimensions(e.message,h),r=w.getMax(p.height,a.labelBoxHeight);n=i+r,z.debug(`${r} - ${e.message}`)}s(e),f.bumpVerticalPos(n)}function W0(t,e,o,i,s,n,c){function h(r,x){r.x{y.add(v.from),y.add(v.to)}),b=b.filter(v=>y.has(v))}F0(r,x,E,b,0,P,!1);let S=X0(P,x,F,i);V.insertArrowHead(r),V.insertArrowCrossHead(r),V.insertArrowFilledHead(r),V.insertSequenceNumber(r);function tt(y,v){let L=f.endActivation(y);L.starty+18>v&&(L.starty=v-6,v+=12),V.drawActivation(r,L,v,a,Ct(y.from.actor).length),f.insert(L.startx,v-10,L.stopx,v)}let W=1,K=1,Z=[],q=[];P.forEach(function(y,v){let L,pt,et;switch(y.type){case i.db.LINETYPE.NOTE:f.resetVerticalPos(),pt=y.noteModel,O0(r,pt);break;case i.db.LINETYPE.ACTIVE_START:f.newActivation(y,r,x);break;case i.db.LINETYPE.ACTIVE_END:tt(y,f.getVerticalPos());break;case i.db.LINETYPE.LOOP_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A));break;case i.db.LINETYPE.LOOP_END:L=f.endLoop(),V.drawLoop(r,L,"loop",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;case i.db.LINETYPE.RECT_START:st(S,y,a.boxMargin,a.boxMargin,A=>f.newLoop(void 0,A.message));break;case i.db.LINETYPE.RECT_END:L=f.endLoop(),q.push(L),f.models.addLoop(L),f.bumpVerticalPos(L.stopy-f.getVerticalPos());break;case i.db.LINETYPE.OPT_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A));break;case i.db.LINETYPE.OPT_END:L=f.endLoop(),V.drawLoop(r,L,"opt",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;case i.db.LINETYPE.ALT_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A));break;case i.db.LINETYPE.ALT_ELSE:st(S,y,a.boxMargin+a.boxTextMargin,a.boxMargin,A=>f.addSectionToLoop(A));break;case i.db.LINETYPE.ALT_END:L=f.endLoop(),V.drawLoop(r,L,"alt",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;case i.db.LINETYPE.PAR_START:case i.db.LINETYPE.PAR_OVER_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A)),f.saveVerticalPos();break;case i.db.LINETYPE.PAR_AND:st(S,y,a.boxMargin+a.boxTextMargin,a.boxMargin,A=>f.addSectionToLoop(A));break;case i.db.LINETYPE.PAR_END:L=f.endLoop(),V.drawLoop(r,L,"par",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;case i.db.LINETYPE.AUTONUMBER:W=y.message.start||W,K=y.message.step||K,y.message.visible?i.db.enableSequenceNumbers():i.db.disableSequenceNumbers();break;case i.db.LINETYPE.CRITICAL_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A));break;case i.db.LINETYPE.CRITICAL_OPTION:st(S,y,a.boxMargin+a.boxTextMargin,a.boxMargin,A=>f.addSectionToLoop(A));break;case i.db.LINETYPE.CRITICAL_END:L=f.endLoop(),V.drawLoop(r,L,"critical",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;case i.db.LINETYPE.BREAK_START:st(S,y,a.boxMargin,a.boxMargin+a.boxTextMargin,A=>f.newLoop(A));break;case i.db.LINETYPE.BREAK_END:L=f.endLoop(),V.drawLoop(r,L,"break",a),f.bumpVerticalPos(L.stopy-f.getVerticalPos()),f.models.addLoop(L);break;default:try{et=y.msgModel,et.starty=f.getVerticalPos(),et.sequenceIndex=W,et.sequenceVisible=i.db.showSequenceNumbers();let A=B0(r,et);W0(y,et,A,v,x,E,u),Z.push({messageModel:et,lineStartY:A}),f.models.addMessage(et)}catch(A){z.error("error while drawing message",A)}}[i.db.LINETYPE.SOLID_OPEN,i.db.LINETYPE.DOTTED_OPEN,i.db.LINETYPE.SOLID,i.db.LINETYPE.DOTTED,i.db.LINETYPE.SOLID_CROSS,i.db.LINETYPE.DOTTED_CROSS,i.db.LINETYPE.SOLID_POINT,i.db.LINETYPE.DOTTED_POINT].includes(y.type)&&(W=W+K)}),z.debug("createdActors",E),z.debug("destroyedActors",u),Zt(r,x,b,!1),Z.forEach(y=>Y0(r,y.messageModel,y.lineStartY,i)),a.mirrorActors&&Zt(r,x,b,!0),q.forEach(y=>V.drawBackgroundRect(r,y)),Se(r,x,b,a),f.models.boxes.forEach(function(y){y.height=f.getVerticalPos()-y.y,f.insert(y.x,y.y,y.x+y.width,y.height),y.startx=y.x,y.starty=y.y,y.stopx=y.startx+y.width,y.stopy=y.starty+y.height,y.stroke="rgb(0,0,0, 0.5)",V.drawBox(r,y,a)}),R&&f.bumpVerticalPos(a.boxMargin);let Y=De(r,x,b,p),{bounds:C}=f.getBounds(),G=C.stopy-C.starty;G{let c=t[n];c.wrap&&(c.description=O.wrapLabel(c.description,a.width-2*a.wrapPadding,Jt(a)));let h=O.calculateTextDimensions(c.description,Jt(a));c.width=c.wrap?a.width:w.getMax(a.width,h.width+2*a.wrapPadding),c.height=c.wrap?w.getMax(h.height,a.height):a.height,i=w.getMax(i,c.height)});for(let n in e){let c=t[n];if(!c)continue;let h=t[c.nextActor];if(!h){let E=e[n]+a.actorMargin-c.width/2;c.margin=w.getMax(E,a.actorMargin);continue}let r=e[n]+a.actorMargin-c.width/2-h.width/2;c.margin=w.getMax(r,a.actorMargin)}let s=0;return o.forEach(n=>{let c=Tt(a),h=n.actorKeys.reduce((x,E)=>x+=t[E].width+(t[E].margin||0),0);h-=2*a.boxTextMargin,n.wrap&&(n.name=O.wrapLabel(n.name,h-2*a.wrapPadding,c));let p=O.calculateTextDimensions(n.name,c);s=w.getMax(p.height,s);let r=w.getMax(h,p.width+2*a.wrapPadding);if(n.margin=a.boxTextMargin,hn.textMaxHeight=s),w.getMax(i,a.height)}var K0=function(t,e,o){let i=e[t.from].x,s=e[t.to].x,n=t.wrap&&t.message,c=O.calculateTextDimensions(n?O.wrapLabel(t.message,a.width,bt(a)):t.message,bt(a)),h={width:n?a.width:w.getMax(a.width,c.width+2*a.noteMargin),height:0,startx:e[t.from].x,stopx:0,starty:0,stopy:0,message:t.message};return t.placement===o.db.PLACEMENT.RIGHTOF?(h.width=n?w.getMax(a.width,c.width):w.getMax(e[t.from].width/2+e[t.to].width/2,c.width+2*a.noteMargin),h.startx=i+(e[t.from].width+a.actorMargin)/2):t.placement===o.db.PLACEMENT.LEFTOF?(h.width=n?w.getMax(a.width,c.width+2*a.noteMargin):w.getMax(e[t.from].width/2+e[t.to].width/2,c.width+2*a.noteMargin),h.startx=i-h.width+(e[t.from].width-a.actorMargin)/2):t.to===t.from?(c=O.calculateTextDimensions(n?O.wrapLabel(t.message,w.getMax(a.width,e[t.from].width),bt(a)):t.message,bt(a)),h.width=n?w.getMax(a.width,e[t.from].width):w.getMax(e[t.from].width,a.width,c.width+2*a.noteMargin),h.startx=i+(e[t.from].width-h.width)/2):(h.width=Math.abs(i+e[t.from].width/2-(s+e[t.to].width/2))+a.actorMargin,h.startx=i2,E=P=>h?-P:P;t.from===t.to?r=p:(t.activate&&!x&&(r+=E(a.activationWidth/2-1)),[o.db.LINETYPE.SOLID_OPEN,o.db.LINETYPE.DOTTED_OPEN].includes(t.type)||(r+=E(3)));let u=[i,s,n,c],g=Math.abs(p-r);t.wrap&&t.message&&(t.message=O.wrapLabel(t.message,w.getMax(g+2*a.wrapPadding,a.width),Tt(a)));let b=O.calculateTextDimensions(t.message,Tt(a));return{width:w.getMax(t.wrap?0:b.width+2*a.wrapPadding,g+2*a.wrapPadding,a.width),height:0,startx:p,stopx:r,starty:0,stopy:0,message:t.message,type:t.type,wrap:t.wrap,fromBounds:Math.min.apply(null,u),toBounds:Math.max.apply(null,u)}},X0=function(t,e,o,i){let s={},n=[],c,h,p;return t.forEach(function(r){switch(r.id=O.random({length:10}),r.type){case i.db.LINETYPE.LOOP_START:case i.db.LINETYPE.ALT_START:case i.db.LINETYPE.OPT_START:case i.db.LINETYPE.PAR_START:case i.db.LINETYPE.PAR_OVER_START:case i.db.LINETYPE.CRITICAL_START:case i.db.LINETYPE.BREAK_START:n.push({id:r.id,msg:r.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case i.db.LINETYPE.ALT_ELSE:case i.db.LINETYPE.PAR_AND:case i.db.LINETYPE.CRITICAL_OPTION:r.message&&(c=n.pop(),s[c.id]=c,s[r.id]=c,n.push(c));break;case i.db.LINETYPE.LOOP_END:case i.db.LINETYPE.ALT_END:case i.db.LINETYPE.OPT_END:case i.db.LINETYPE.PAR_END:case i.db.LINETYPE.CRITICAL_END:case i.db.LINETYPE.BREAK_END:c=n.pop(),s[c.id]=c;break;case i.db.LINETYPE.ACTIVE_START:{let E=e[r.from?r.from.actor:r.to.actor],u=Ct(r.from?r.from.actor:r.to.actor).length,g=E.x+E.width/2+(u-1)*a.activationWidth/2,b={startx:g,stopx:g+a.activationWidth,actor:r.from.actor,enabled:!0};f.activations.push(b)}break;case i.db.LINETYPE.ACTIVE_END:{let E=f.activations.map(u=>u.actor).lastIndexOf(r.from.actor);delete f.activations.splice(E,1)[0]}break}r.placement!==void 0?(h=K0(r,e,i),r.noteModel=h,n.forEach(E=>{c=E,c.from=w.getMin(c.from,h.startx),c.to=w.getMax(c.to,h.startx+h.width),c.width=w.getMax(c.width,Math.abs(c.from-c.to))-a.labelBoxWidth})):(p=G0(r,e,i),r.msgModel=p,p.startx&&p.stopx&&n.length>0&&n.forEach(E=>{if(c=E,p.startx===p.stopx){let u=e[r.from],g=e[r.to];c.from=w.getMin(u.x-p.width/2,u.x-u.width/2,c.from),c.to=w.getMax(g.x+p.width/2,g.x+u.width/2,c.to),c.width=w.getMax(c.width,Math.abs(c.to-c.from))-a.labelBoxWidth}else c.from=w.getMin(p.startx,c.from),c.to=w.getMax(p.stopx,c.to),c.width=w.getMax(c.width,p.width)-a.labelBoxWidth}))}),f.activations=[],z.debug("Loop type widths:",s),s},J0={bounds:f,drawActors:Zt,drawActorsPopup:De,setConf:Ve,draw:q0},ii={parser:He,db:me,renderer:J0,styles:g0,init:({wrap:t})=>{me.setWrap(t)}};export{ii as diagram};