import{s as Ie}from"./chunk-VSLJSFIP-Bx4cniBy.js";import{g as Le,f as Gt,h as lt,x as ke,E as Kt,d as Zt}from"./chunk-WONJCSFZ-DKxzR-8d.js";import{m as y,E as Pe,a as at,i as At,p as Z,q as _e,W as ve,v as Ne,h as k,H as ae,G as Ae,j as Me,U as Oe,$ as Se,e as De,g as $e,k as Re,N as Ce,o as Mt,d as Y,aX as kt,aY as W,f as Be,aP as ie,aZ as Ye,a_ as Fe,a$ as se,O as zt}from"./mermaid.esm.min-C3PPQ_C2.js";import"./app-COnnofor.js";var Ht=(function(){var e=y(function(ct,w,L,E){for(L=L||{},E=ct.length;E--;L[ct[E]]=w);return L},"o"),t=[1,2],o=[1,3],a=[1,4],i=[2,4],s=[1,9],c=[1,11],d=[1,13],n=[1,14],r=[1,16],p=[1,17],x=[1,18],u=[1,24],m=[1,25],T=[1,26],I=[1,27],v=[1,28],A=[1,29],N=[1,30],$=[1,31],R=[1,32],V=[1,33],q=[1,34],J=[1,35],rt=[1,36],z=[1,37],H=[1,38],F=[1,39],D=[1,41],Q=[1,42],U=[1,43],X=[1,44],it=[1,45],S=[1,46],f=[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,55,60,61,62,63,71],P=[2,71],G=[4,5,16,50,52,53],tt=[4,5,13,14,16,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,55,60,61,62,63,71],O=[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,55,60,61,62,63,71],Ct=[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,55,60,61,62,63,71],Jt=[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,55,60,61,62,63,71],nt=[69,70,71],ht=[1,127],Bt={trace:y(function(){},"trace"),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,actor_with_config:54,note:55,placement:56,text2:57,over:58,actor_pair:59,links:60,link:61,properties:62,details:63,spaceList:64,",":65,left_of:66,right_of:67,signaltype:68,"+":69,"-":70,ACTOR:71,config_object:72,CONFIG_START:73,CONFIG_CONTENT:74,CONFIG_END:75,SOLID_OPEN_ARROW:76,DOTTED_OPEN_ARROW:77,SOLID_ARROW:78,BIDIRECTIONAL_SOLID_ARROW:79,DOTTED_ARROW:80,BIDIRECTIONAL_DOTTED_ARROW:81,SOLID_CROSS:82,DOTTED_CROSS:83,SOLID_POINT:84,DOTTED_POINT:85,TXT:86,$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",55:"note",58:"over",60:"links",61:"link",62:"properties",63:"details",65:",",66:"left_of",67:"right_of",69:"+",70:"-",71:"ACTOR",73:"CONFIG_START",74:"CONFIG_CONTENT",75:"CONFIG_END",76:"SOLID_OPEN_ARROW",77:"DOTTED_OPEN_ARROW",78:"SOLID_ARROW",79:"BIDIRECTIONAL_SOLID_ARROW",80:"DOTTED_ARROW",81:"BIDIRECTIONAL_DOTTED_ARROW",82:"SOLID_CROSS",83:"DOTTED_CROSS",84:"SOLID_POINT",85:"DOTTED_POINT",86:"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],[12,3],[24,4],[24,4],[25,3],[26,3],[27,3],[28,3],[64,2],[64,1],[59,3],[59,1],[56,1],[56,1],[17,5],[17,5],[17,4],[54,2],[72,3],[22,1],[68,1],[68,1],[68,1],[68,1],[68,1],[68,1],[68,1],[68,1],[68,1],[68,1],[57,1]],performAction:y(function(ct,w,L,E,M,h,K){var g=h.length-1;switch(M){case 3:return E.apply(h[g]),h[g];case 4:case 9:this.$=[];break;case 5:case 10:h[g-1].push(h[g]),this.$=h[g-1];break;case 6:case 7:case 11:case 12:this.$=h[g];break;case 8:case 13:this.$=[];break;case 15:h[g].type="createParticipant",this.$=h[g];break;case 16:h[g-1].unshift({type:"boxStart",boxData:E.parseBoxData(h[g-2])}),h[g-1].push({type:"boxEnd",boxText:h[g-2]}),this.$=h[g-1];break;case 18:this.$={type:"sequenceIndex",sequenceIndex:Number(h[g-2]),sequenceIndexStep:Number(h[g-1]),sequenceVisible:!0,signalType:E.LINETYPE.AUTONUMBER};break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(h[g-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:E.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:E.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:E.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"activeStart",signalType:E.LINETYPE.ACTIVE_START,actor:h[g-1].actor};break;case 23:this.$={type:"activeEnd",signalType:E.LINETYPE.ACTIVE_END,actor:h[g-1].actor};break;case 29:E.setDiagramTitle(h[g].substring(6)),this.$=h[g].substring(6);break;case 30:E.setDiagramTitle(h[g].substring(7)),this.$=h[g].substring(7);break;case 31:this.$=h[g].trim(),E.setAccTitle(this.$);break;case 32:case 33:this.$=h[g].trim(),E.setAccDescription(this.$);break;case 34:h[g-1].unshift({type:"loopStart",loopText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.LOOP_START}),h[g-1].push({type:"loopEnd",loopText:h[g-2],signalType:E.LINETYPE.LOOP_END}),this.$=h[g-1];break;case 35:h[g-1].unshift({type:"rectStart",color:E.parseMessage(h[g-2]),signalType:E.LINETYPE.RECT_START}),h[g-1].push({type:"rectEnd",color:E.parseMessage(h[g-2]),signalType:E.LINETYPE.RECT_END}),this.$=h[g-1];break;case 36:h[g-1].unshift({type:"optStart",optText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.OPT_START}),h[g-1].push({type:"optEnd",optText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.OPT_END}),this.$=h[g-1];break;case 37:h[g-1].unshift({type:"altStart",altText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.ALT_START}),h[g-1].push({type:"altEnd",signalType:E.LINETYPE.ALT_END}),this.$=h[g-1];break;case 38:h[g-1].unshift({type:"parStart",parText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.PAR_START}),h[g-1].push({type:"parEnd",signalType:E.LINETYPE.PAR_END}),this.$=h[g-1];break;case 39:h[g-1].unshift({type:"parStart",parText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.PAR_OVER_START}),h[g-1].push({type:"parEnd",signalType:E.LINETYPE.PAR_END}),this.$=h[g-1];break;case 40:h[g-1].unshift({type:"criticalStart",criticalText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.CRITICAL_START}),h[g-1].push({type:"criticalEnd",signalType:E.LINETYPE.CRITICAL_END}),this.$=h[g-1];break;case 41:h[g-1].unshift({type:"breakStart",breakText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.BREAK_START}),h[g-1].push({type:"breakEnd",optText:E.parseMessage(h[g-2]),signalType:E.LINETYPE.BREAK_END}),this.$=h[g-1];break;case 43:this.$=h[g-3].concat([{type:"option",optionText:E.parseMessage(h[g-1]),signalType:E.LINETYPE.CRITICAL_OPTION},h[g]]);break;case 45:this.$=h[g-3].concat([{type:"and",parText:E.parseMessage(h[g-1]),signalType:E.LINETYPE.PAR_AND},h[g]]);break;case 47:this.$=h[g-3].concat([{type:"else",altText:E.parseMessage(h[g-1]),signalType:E.LINETYPE.ALT_ELSE},h[g]]);break;case 48:h[g-3].draw="participant",h[g-3].type="addParticipant",h[g-3].description=E.parseMessage(h[g-1]),this.$=h[g-3];break;case 49:h[g-1].draw="participant",h[g-1].type="addParticipant",this.$=h[g-1];break;case 50:h[g-3].draw="actor",h[g-3].type="addParticipant",h[g-3].description=E.parseMessage(h[g-1]),this.$=h[g-3];break;case 51:h[g-1].draw="actor",h[g-1].type="addParticipant",this.$=h[g-1];break;case 52:h[g-1].type="destroyParticipant",this.$=h[g-1];break;case 53:h[g-1].draw="participant",h[g-1].type="addParticipant",this.$=h[g-1];break;case 54:this.$=[h[g-1],{type:"addNote",placement:h[g-2],actor:h[g-1].actor,text:h[g]}];break;case 55:h[g-2]=[].concat(h[g-1],h[g-1]).slice(0,2),h[g-2][0]=h[g-2][0].actor,h[g-2][1]=h[g-2][1].actor,this.$=[h[g-1],{type:"addNote",placement:E.PLACEMENT.OVER,actor:h[g-2].slice(0,2),text:h[g]}];break;case 56:this.$=[h[g-1],{type:"addLinks",actor:h[g-1].actor,text:h[g]}];break;case 57:this.$=[h[g-1],{type:"addALink",actor:h[g-1].actor,text:h[g]}];break;case 58:this.$=[h[g-1],{type:"addProperties",actor:h[g-1].actor,text:h[g]}];break;case 59:this.$=[h[g-1],{type:"addDetails",actor:h[g-1].actor,text:h[g]}];break;case 62:this.$=[h[g-2],h[g]];break;case 63:this.$=h[g];break;case 64:this.$=E.PLACEMENT.LEFTOF;break;case 65:this.$=E.PLACEMENT.RIGHTOF;break;case 66:this.$=[h[g-4],h[g-1],{type:"addMessage",from:h[g-4].actor,to:h[g-1].actor,signalType:h[g-3],msg:h[g],activate:!0},{type:"activeStart",signalType:E.LINETYPE.ACTIVE_START,actor:h[g-1].actor}];break;case 67:this.$=[h[g-4],h[g-1],{type:"addMessage",from:h[g-4].actor,to:h[g-1].actor,signalType:h[g-3],msg:h[g]},{type:"activeEnd",signalType:E.LINETYPE.ACTIVE_END,actor:h[g-4].actor}];break;case 68:this.$=[h[g-3],h[g-1],{type:"addMessage",from:h[g-3].actor,to:h[g-1].actor,signalType:h[g-2],msg:h[g]}];break;case 69:this.$={type:"addParticipant",actor:h[g-1],config:h[g]};break;case 70:this.$=h[g-1].trim();break;case 71:this.$={type:"addParticipant",actor:h[g]};break;case 72:this.$=E.LINETYPE.SOLID_OPEN;break;case 73:this.$=E.LINETYPE.DOTTED_OPEN;break;case 74:this.$=E.LINETYPE.SOLID;break;case 75:this.$=E.LINETYPE.BIDIRECTIONAL_SOLID;break;case 76:this.$=E.LINETYPE.DOTTED;break;case 77:this.$=E.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 78:this.$=E.LINETYPE.SOLID_CROSS;break;case 79:this.$=E.LINETYPE.DOTTED_CROSS;break;case 80:this.$=E.LINETYPE.SOLID_POINT;break;case 81:this.$=E.LINETYPE.DOTTED_POINT;break;case 82:this.$=E.parseMessage(h[g].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:o,6:a},{1:[3]},{3:5,4:t,5:o,6:a},{3:6,4:t,5:o,6:a},e([1,4,5,13,14,18,21,23,29,30,31,33,35,36,37,38,39,41,43,44,46,50,52,53,55,60,61,62,63,71],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:s,5:c,8:8,9:10,12:12,13:d,14:n,17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},e(f,[2,5]),{9:47,12:12,13:d,14:n,17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},e(f,[2,7]),e(f,[2,8]),e(f,[2,14]),{12:48,50:z,52:H,53:F},{15:[1,49]},{5:[1,50]},{5:[1,53],19:[1,51],20:[1,52]},{22:54,71:S},{22:55,71:S},{5:[1,56]},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},e(f,[2,29]),e(f,[2,30]),{32:[1,61]},{34:[1,62]},e(f,[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,54:72,71:[1,73]},{22:74,71:S},{22:75,71:S},{68:76,76:[1,77],77:[1,78],78:[1,79],79:[1,80],80:[1,81],81:[1,82],82:[1,83],83:[1,84],84:[1,85],85:[1,86]},{56:87,58:[1,88],66:[1,89],67:[1,90]},{22:91,71:S},{22:92,71:S},{22:93,71:S},{22:94,71:S},e([5,51,65,76,77,78,79,80,81,82,83,84,85,86],P),e(f,[2,6]),e(f,[2,15]),e(G,[2,9],{10:95}),e(f,[2,17]),{5:[1,97],19:[1,96]},{5:[1,98]},e(f,[2,21]),{5:[1,99]},{5:[1,100]},e(f,[2,24]),e(f,[2,25]),e(f,[2,26]),e(f,[2,27]),e(f,[2,28]),e(f,[2,31]),e(f,[2,32]),e(tt,i,{7:101}),e(tt,i,{7:102}),e(tt,i,{7:103}),e(O,i,{40:104,7:105}),e(Ct,i,{42:106,7:107}),e(Ct,i,{7:107,42:108}),e(Jt,i,{45:109,7:110}),e(tt,i,{7:111}),{5:[1,113],51:[1,112]},{5:[1,114]},e([5,51],P,{72:115,73:[1,116]}),{5:[1,118],51:[1,117]},{5:[1,119]},{22:122,69:[1,120],70:[1,121],71:S},e(nt,[2,72]),e(nt,[2,73]),e(nt,[2,74]),e(nt,[2,75]),e(nt,[2,76]),e(nt,[2,77]),e(nt,[2,78]),e(nt,[2,79]),e(nt,[2,80]),e(nt,[2,81]),{22:123,71:S},{22:125,59:124,71:S},{71:[2,64]},{71:[2,65]},{57:126,86:ht},{57:128,86:ht},{57:129,86:ht},{57:130,86:ht},{4:[1,133],5:[1,135],11:132,12:134,16:[1,131],50:z,52:H,53:F},{5:[1,136]},e(f,[2,19]),e(f,[2,20]),e(f,[2,22]),e(f,[2,23]),{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[1,137],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[1,138],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[1,139],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{16:[1,140]},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[2,46],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,49:[1,141],50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{16:[1,142]},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[2,44],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,48:[1,143],50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{16:[1,144]},{16:[1,145]},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[2,42],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,47:[1,146],50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{4:s,5:c,8:8,9:10,12:12,13:d,14:n,16:[1,147],17:15,18:r,21:p,22:40,23:x,24:19,25:20,26:21,27:22,28:23,29:u,30:m,31:T,33:I,35:v,36:A,37:N,38:$,39:R,41:V,43:q,44:J,46:rt,50:z,52:H,53:F,55:D,60:Q,61:U,62:X,63:it,71:S},{15:[1,148]},e(f,[2,49]),e(f,[2,53]),{5:[2,69]},{74:[1,149]},{15:[1,150]},e(f,[2,51]),e(f,[2,52]),{22:151,71:S},{22:152,71:S},{57:153,86:ht},{57:154,86:ht},{57:155,86:ht},{65:[1,156],86:[2,63]},{5:[2,56]},{5:[2,82]},{5:[2,57]},{5:[2,58]},{5:[2,59]},e(f,[2,16]),e(G,[2,10]),{12:157,50:z,52:H,53:F},e(G,[2,12]),e(G,[2,13]),e(f,[2,18]),e(f,[2,34]),e(f,[2,35]),e(f,[2,36]),e(f,[2,37]),{15:[1,158]},e(f,[2,38]),{15:[1,159]},e(f,[2,39]),e(f,[2,40]),{15:[1,160]},e(f,[2,41]),{5:[1,161]},{75:[1,162]},{5:[1,163]},{57:164,86:ht},{57:165,86:ht},{5:[2,68]},{5:[2,54]},{5:[2,55]},{22:166,71:S},e(G,[2,11]),e(O,i,{7:105,40:167}),e(Ct,i,{7:107,42:168}),e(Jt,i,{7:110,45:169}),e(f,[2,48]),{5:[2,70]},e(f,[2,50]),{5:[2,66]},{5:[2,67]},{86:[2,62]},{16:[2,47]},{16:[2,45]},{16:[2,43]}],defaultActions:{5:[2,1],6:[2,2],89:[2,64],90:[2,65],115:[2,69],126:[2,56],127:[2,82],128:[2,57],129:[2,58],130:[2,59],153:[2,68],154:[2,54],155:[2,55],162:[2,70],164:[2,66],165:[2,67],166:[2,62],167:[2,47],168:[2,45],169:[2,43]},parseError:y(function(ct,w){if(w.recoverable)this.trace(ct);else{var L=new Error(ct);throw L.hash=w,L}},"parseError"),parse:y(function(ct){var w=this,L=[0],E=[],M=[null],h=[],K=this.table,g="",_t=0,Qt=0,be=0,fe=2,Xt=1,Ee=h.slice.call(arguments,1),B=Object.create(this.lexer),yt={yy:{}};for(var Yt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Yt)&&(yt.yy[Yt]=this.yy[Yt]);B.setInput(ct,yt.yy),yt.yy.lexer=B,yt.yy.parser=this,typeof B.yylloc>"u"&&(B.yylloc={});var Ft=B.yylloc;h.push(Ft);var Te=B.options&&B.options.ranges;typeof yt.yy.parseError=="function"?this.parseError=yt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function we(et){L.length=L.length-2*et,M.length=M.length-et,h.length=h.length-et}y(we,"popStack");function te(){var et;return et=E.pop()||B.lex()||Xt,typeof et!="number"&&(et instanceof Array&&(E=et,et=E.pop()),et=w.symbols_[et]||et),et}y(te,"lex");for(var j,Vt,mt,st,Pa,Wt,Et={},vt,dt,ee,Nt;;){if(mt=L[L.length-1],this.defaultActions[mt]?st=this.defaultActions[mt]:((j===null||typeof j>"u")&&(j=te()),st=K[mt]&&K[mt][j]),typeof st>"u"||!st.length||!st[0]){var qt="";Nt=[];for(vt in K[mt])this.terminals_[vt]&&vt>fe&&Nt.push("'"+this.terminals_[vt]+"'");B.showPosition?qt="Parse error on line "+(_t+1)+`: `+B.showPosition()+` Expecting `+Nt.join(", ")+", got '"+(this.terminals_[j]||j)+"'":qt="Parse error on line "+(_t+1)+": Unexpected "+(j==Xt?"end of input":"'"+(this.terminals_[j]||j)+"'"),this.parseError(qt,{text:B.match,token:this.terminals_[j]||j,line:B.yylineno,loc:Ft,expected:Nt})}if(st[0]instanceof Array&&st.length>1)throw new Error("Parse Error: multiple actions possible at state: "+mt+", token: "+j);switch(st[0]){case 1:L.push(j),M.push(B.yytext),h.push(B.yylloc),L.push(st[1]),j=null,Vt?(j=Vt,Vt=null):(Qt=B.yyleng,g=B.yytext,_t=B.yylineno,Ft=B.yylloc,be>0);break;case 2:if(dt=this.productions_[st[1]][1],Et.$=M[M.length-dt],Et._$={first_line:h[h.length-(dt||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(dt||1)].first_column,last_column:h[h.length-1].last_column},Te&&(Et._$.range=[h[h.length-(dt||1)].range[0],h[h.length-1].range[1]]),Wt=this.performAction.apply(Et,[g,Qt,_t,yt.yy,st[1],M,h].concat(Ee)),typeof Wt<"u")return Wt;dt&&(L=L.slice(0,-1*dt*2),M=M.slice(0,-1*dt),h=h.slice(0,-1*dt)),L.push(this.productions_[st[1]][0]),M.push(Et.$),h.push(Et._$),ee=K[L[L.length-2]][L[L.length-1]],L.push(ee);break;case 3:return!0}}return!0},"parse")},me=(function(){var ct={EOF:1,parseError:y(function(w,L){if(this.yy.parser)this.yy.parser.parseError(w,L);else throw new Error(w)},"parseError"),setInput:y(function(w,L){return this.yy=L||this.yy||{},this._input=w,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},"setInput"),input:y(function(){var w=this._input[0];this.yytext+=w,this.yyleng++,this.offset++,this.match+=w,this.matched+=w;var L=w.match(/(?:\r\n?|\n).*/g);return L?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),w},"input"),unput:y(function(w){var L=w.length,E=w.split(/(?:\r\n?|\n)/g);this._input=w+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-L),this.offset-=L;var M=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),E.length-1&&(this.yylineno-=E.length-1);var h=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:E?(E.length===M.length?this.yylloc.first_column:0)+M[M.length-E.length].length-E[0].length:this.yylloc.first_column-L},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-L]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(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},"reject"),less:y(function(w){this.unput(this.match.slice(w))},"less"),pastInput:y(function(){var w=this.matched.substr(0,this.matched.length-this.match.length);return(w.length>20?"...":"")+w.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var w=this.match;return w.length<20&&(w+=this._input.substr(0,20-w.length)),(w.substr(0,20)+(w.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var w=this.pastInput(),L=new Array(w.length+1).join("-");return w+this.upcomingInput()+` `+L+"^"},"showPosition"),test_match:y(function(w,L){var E,M,h;if(this.options.backtrack_lexer&&(h={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&&(h.yylloc.range=this.yylloc.range.slice(0))),M=w[0].match(/(?:\r\n?|\n).*/g),M&&(this.yylineno+=M.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:M?M[M.length-1].length-M[M.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+w[0].length},this.yytext+=w[0],this.match+=w[0],this.matches=w,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(w[0].length),this.matched+=w[0],E=this.performAction.call(this,this.yy,this,L,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var K in h)this[K]=h[K];return!1}return!1},"test_match"),next:y(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var w,L,E,M;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),K=0;KL[0].length)){if(L=E,M=K,this.options.backtrack_lexer){if(w=this.test_match(E,h[K]),w!==!1)return w;if(this._backtrack){L=!1;continue}else return!1}else if(!this.options.flex)break}return L?(w=this.test_match(L,h[M]),w!==!1?w:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:y(function(){var w=this.next();return w||this.lex()},"lex"),begin:y(function(w){this.conditionStack.push(w)},"begin"),popState:y(function(){var w=this.conditionStack.length-1;return w>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:y(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:y(function(w){return w=this.conditionStack.length-1-Math.abs(w||0),w>=0?this.conditionStack[w]:"INITIAL"},"topState"),pushState:y(function(w){this.begin(w)},"pushState"),stateStackSize:y(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:y(function(w,L,E,M){switch(E){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("CONFIG"),73;case 8:return 74;case 9:return this.popState(),this.popState(),75;case 10:return L.yytext=L.yytext.trim(),71;case 11:return L.yytext=L.yytext.trim(),this.begin("ALIAS"),71;case 12:return this.begin("LINE"),14;case 13:return this.begin("ID"),50;case 14:return this.begin("ID"),52;case 15:return 13;case 16:return this.begin("ID"),53;case 17:return L.yytext=L.yytext.trim(),this.begin("ALIAS"),71;case 18:return this.popState(),this.popState(),this.begin("LINE"),51;case 19:return this.popState(),this.popState(),5;case 20:return this.begin("LINE"),36;case 21:return this.begin("LINE"),37;case 22:return this.begin("LINE"),38;case 23:return this.begin("LINE"),39;case 24:return this.begin("LINE"),49;case 25:return this.begin("LINE"),41;case 26:return this.begin("LINE"),43;case 27:return this.begin("LINE"),48;case 28:return this.begin("LINE"),44;case 29:return this.begin("LINE"),47;case 30:return this.begin("LINE"),46;case 31:return this.popState(),15;case 32:return 16;case 33:return 66;case 34:return 67;case 35:return 60;case 36:return 61;case 37:return 62;case 38:return 63;case 39:return 58;case 40:return 55;case 41:return this.begin("ID"),21;case 42:return this.begin("ID"),23;case 43:return 29;case 44:return 30;case 45:return this.begin("acc_title"),31;case 46:return this.popState(),"acc_title_value";case 47:return this.begin("acc_descr"),33;case 48:return this.popState(),"acc_descr_value";case 49:this.begin("acc_descr_multiline");break;case 50:this.popState();break;case 51:return"acc_descr_multiline_value";case 52:return 6;case 53:return 18;case 54:return 20;case 55:return 65;case 56:return 5;case 57:return L.yytext=L.yytext.trim(),71;case 58:return 78;case 59:return 79;case 60:return 80;case 61:return 81;case 62:return 76;case 63:return 77;case 64:return 82;case 65:return 83;case 66:return 84;case 67:return 85;case 68:return 86;case 69:return 86;case 70:return 69;case 71:return 70;case 72:return 5;case 73:return"INVALID"}},"anonymous"),rules:[/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[0-9]+(?=[ \n]+))/i,/^(?:@\{)/i,/^(?:[^\}]+)/i,/^(?:\})/i,/^(?:[^\<->\->:\n,;@\s]+(?=@\{))/i,/^(?:[^\<->\->:\n,;@]+?([\-]*[^\<->\->:\n,;@]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\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,/^(?:->)/i,/^(?:-->)/i,/^(?:-[x])/i,/^(?:--[x])/i,/^(?:-[\)])/i,/^(?:--[\)])/i,/^(?::(?:(?:no)?wrap)?[^#\n;]*)/i,/^(?::)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[50,51],inclusive:!1},acc_descr:{rules:[48],inclusive:!1},acc_title:{rules:[46],inclusive:!1},ID:{rules:[2,3,7,10,11,17],inclusive:!1},ALIAS:{rules:[2,3,18,19],inclusive:!1},LINE:{rules:[2,3,31],inclusive:!1},CONFIG:{rules:[8,9],inclusive:!1},CONFIG_DATA:{rules:[],inclusive:!1},INITIAL:{rules:[0,1,3,4,5,6,12,13,14,15,16,20,21,22,23,24,25,26,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,49,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73],inclusive:!0}}};return ct})();Bt.lexer=me;function Pt(){this.yy={}}return y(Pt,"Parser"),Pt.prototype=Bt,Bt.Parser=Pt,new Pt})();Ht.parser=Ht;var Ve=Ht,We={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,BIDIRECTIONAL_SOLID:33,BIDIRECTIONAL_DOTTED:34},qe={FILLED:0,OPEN:1},ze={LEFTOF:0,RIGHTOF:1,OVER:2},Ot={ACTOR:"actor",CONTROL:"control",DATABASE:"database",ENTITY:"entity"},wt,He=(wt=class{constructor(){this.state=new Ie(()=>({prevActor:void 0,actors:new Map,createdActors:new Map,destroyedActors:new Map,boxes:[],messages:[],notes:[],sequenceNumbersEnabled:!1,wrapEnabled:void 0,currentBox:void 0,lastCreated:void 0,lastDestroyed:void 0})),this.setAccTitle=ae,this.setAccDescription=Ae,this.setDiagramTitle=Me,this.getAccTitle=Oe,this.getAccDescription=Se,this.getDiagramTitle=De,this.apply=this.apply.bind(this),this.parseBoxData=this.parseBoxData.bind(this),this.parseMessage=this.parseMessage.bind(this),this.clear(),this.setWrap(at().wrap),this.LINETYPE=We,this.ARROWTYPE=qe,this.PLACEMENT=ze}addBox(t){this.state.records.boxes.push({name:t.text,wrap:t.wrap??this.autoWrap(),fill:t.color,actorKeys:[]}),this.state.records.currentBox=this.state.records.boxes.slice(-1)[0]}addActor(t,o,a,i,s){let c=this.state.records.currentBox,d;if(s!==void 0){let r;s.includes(` `)?r=s+` `:r=`{ `+s+` }`,d=$e(r,{schema:Re})}i=d?.type??i;let n=this.state.records.actors.get(t);if(n){if(this.state.records.currentBox&&n.box&&this.state.records.currentBox!==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 '${this.state.records.currentBox.name}' at the same time.`);if(c=n.box?n.box:this.state.records.currentBox,n.box=c,n&&o===n.name&&a==null)return}if(a?.text==null&&(a={text:o,type:i}),(i==null||a.text==null)&&(a={text:o,type:i}),this.state.records.actors.set(t,{box:c,name:o,description:a.text,wrap:a.wrap??this.autoWrap(),prevActor:this.state.records.prevActor,links:{},properties:{},actorCnt:null,rectData:null,type:i??"participant"}),this.state.records.prevActor){let r=this.state.records.actors.get(this.state.records.prevActor);r&&(r.nextActor=t)}this.state.records.currentBox&&this.state.records.currentBox.actorKeys.push(t),this.state.records.prevActor=t}activationCount(t){let o,a=0;if(!t)return 0;for(o=0;o>-",token:"->>-",line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:["'ACTIVE_PARTICIPANT'"]},c}return this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:t,to:o,message:a?.text??"",wrap:a?.wrap??this.autoWrap(),type:i,activate:s}),!0}hasAtLeastOneBox(){return this.state.records.boxes.length>0}hasAtLeastOneBoxWithTitle(){return this.state.records.boxes.some(t=>t.name)}getMessages(){return this.state.records.messages}getBoxes(){return this.state.records.boxes}getActors(){return this.state.records.actors}getCreatedActors(){return this.state.records.createdActors}getDestroyedActors(){return this.state.records.destroyedActors}getActor(t){return this.state.records.actors.get(t)}getActorKeys(){return[...this.state.records.actors.keys()]}enableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!0}disableSequenceNumbers(){this.state.records.sequenceNumbersEnabled=!1}showSequenceNumbers(){return this.state.records.sequenceNumbersEnabled}setWrap(t){this.state.records.wrapEnabled=t}extractWrap(t){if(t===void 0)return{};t=t.trim();let o=/^:?wrap:/.exec(t)!==null?!0:/^:?nowrap:/.exec(t)!==null?!1:void 0;return{cleanedText:(o===void 0?t:t.replace(/^:?(?:no)?wrap:/,"")).trim(),wrap:o}}autoWrap(){return this.state.records.wrapEnabled!==void 0?this.state.records.wrapEnabled:at().sequence?.wrap??!1}clear(){this.state.reset(),Ce()}parseMessage(t){let o=t.trim(),{wrap:a,cleanedText:i}=this.extractWrap(o),s={text:i,wrap:a};return Z.debug(`parseMessage: ${JSON.stringify(s)}`),s}parseBoxData(t){let o=/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/.exec(t),a=o?.[1]?o[1].trim():"transparent",i=o?.[2]?o[2].trim():void 0;if(window?.CSS)window.CSS.supports("color",a)||(a="transparent",i=t.trim());else{let d=new Option().style;d.color=a,d.color!==a&&(a="transparent",i=t.trim())}let{wrap:s,cleanedText:c}=this.extractWrap(i);return{text:c?Mt(c,at()):void 0,color:a,wrap:s}}addNote(t,o,a){let i={actor:t,placement:o,message:a.text,wrap:a.wrap??this.autoWrap()},s=[].concat(t,t);this.state.records.notes.push(i),this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:s[0],to:s[1],message:a.text,wrap:a.wrap??this.autoWrap(),type:this.LINETYPE.NOTE,placement:o})}addLinks(t,o){let a=this.getActor(t);try{let i=Mt(o.text,at());i=i.replace(/=/g,"="),i=i.replace(/&/g,"&");let s=JSON.parse(i);this.insertLinks(a,s)}catch(i){Z.error("error while parsing actor link text",i)}}addALink(t,o){let a=this.getActor(t);try{let i={},s=Mt(o.text,at()),c=s.indexOf("@");s=s.replace(/=/g,"="),s=s.replace(/&/g,"&");let d=s.slice(0,c-1).trim(),n=s.slice(c+1).trim();i[d]=n,this.insertLinks(a,i)}catch(i){Z.error("error while parsing actor link text",i)}}insertLinks(t,o){if(t.links==null)t.links=o;else for(let a in o)t.links[a]=o[a]}addProperties(t,o){let a=this.getActor(t);try{let i=Mt(o.text,at()),s=JSON.parse(i);this.insertProperties(a,s)}catch(i){Z.error("error while parsing actor properties text",i)}}insertProperties(t,o){if(t.properties==null)t.properties=o;else for(let a in o)t.properties[a]=o[a]}boxEnd(){this.state.records.currentBox=void 0}addDetails(t,o){let a=this.getActor(t),i=document.getElementById(o.text);try{let s=i.innerHTML,c=JSON.parse(s);c.properties&&this.insertProperties(a,c.properties),c.links&&this.insertLinks(a,c.links)}catch(s){Z.error("error while parsing actor details text",s)}}getActorProperty(t,o){if(t?.properties!==void 0)return t.properties[o]}apply(t){if(Array.isArray(t))t.forEach(o=>{this.apply(o)});else switch(t.type){case"sequenceIndex":this.state.records.messages.push({id:this.state.records.messages.length.toString(),from:void 0,to:void 0,message:{start:t.sequenceIndex,step:t.sequenceIndexStep,visible:t.sequenceVisible},wrap:!1,type:t.signalType});break;case"addParticipant":this.addActor(t.actor,t.actor,t.description,t.draw,t.config);break;case"createParticipant":if(this.state.records.actors.has(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");this.state.records.lastCreated=t.actor,this.addActor(t.actor,t.actor,t.description,t.draw,t.config),this.state.records.createdActors.set(t.actor,this.state.records.messages.length);break;case"destroyParticipant":this.state.records.lastDestroyed=t.actor,this.state.records.destroyedActors.set(t.actor,this.state.records.messages.length);break;case"activeStart":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"activeEnd":this.addSignal(t.actor,void 0,void 0,t.signalType);break;case"addNote":this.addNote(t.actor,t.placement,t.text);break;case"addLinks":this.addLinks(t.actor,t.text);break;case"addALink":this.addALink(t.actor,t.text);break;case"addProperties":this.addProperties(t.actor,t.text);break;case"addDetails":this.addDetails(t.actor,t.text);break;case"addMessage":if(this.state.records.lastCreated){if(t.to!==this.state.records.lastCreated)throw new Error("The created participant "+this.state.records.lastCreated.name+" does not have an associated creating message after its declaration. Please check the sequence diagram.");this.state.records.lastCreated=void 0}else if(this.state.records.lastDestroyed){if(t.to!==this.state.records.lastDestroyed&&t.from!==this.state.records.lastDestroyed)throw new Error("The destroyed participant "+this.state.records.lastDestroyed.name+" does not have an associated destroying message after its declaration. Please check the sequence diagram.");this.state.records.lastDestroyed=void 0}this.addSignal(t.from,t.to,t.msg,t.signalType,t.activate);break;case"boxStart":this.addBox(t.boxData);break;case"boxEnd":this.boxEnd();break;case"loopStart":this.addSignal(void 0,void 0,t.loopText,t.signalType);break;case"loopEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"rectStart":this.addSignal(void 0,void 0,t.color,t.signalType);break;case"rectEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"optStart":this.addSignal(void 0,void 0,t.optText,t.signalType);break;case"optEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"altStart":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case"else":this.addSignal(void 0,void 0,t.altText,t.signalType);break;case"altEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"setAccTitle":ae(t.text);break;case"parStart":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case"and":this.addSignal(void 0,void 0,t.parText,t.signalType);break;case"parEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"criticalStart":this.addSignal(void 0,void 0,t.criticalText,t.signalType);break;case"option":this.addSignal(void 0,void 0,t.optionText,t.signalType);break;case"criticalEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break;case"breakStart":this.addSignal(void 0,void 0,t.breakText,t.signalType);break;case"breakEnd":this.addSignal(void 0,void 0,void 0,t.signalType);break}}getConfig(){return at().sequence}},y(wt,"SequenceDB"),wt),je=y(e=>`.actor { stroke: ${e.actorBorder}; fill: ${e.actorBkg}; } text.actor > tspan { fill: ${e.actorTextColor}; stroke: none; } .actor-line { stroke: ${e.actorLineColor}; } .innerArc { stroke-width: 1.5; stroke-dasharray: none; } .messageLine0 { stroke-width: 1.5; stroke-dasharray: none; stroke: ${e.signalColor}; } .messageLine1 { stroke-width: 1.5; stroke-dasharray: 2, 2; stroke: ${e.signalColor}; } #arrowhead path { fill: ${e.signalColor}; stroke: ${e.signalColor}; } .sequenceNumber { fill: ${e.sequenceNumberColor}; } #sequencenumber { fill: ${e.signalColor}; } #crosshead path { fill: ${e.signalColor}; stroke: ${e.signalColor}; } .messageText { fill: ${e.signalTextColor}; stroke: none; } .labelBox { stroke: ${e.labelBoxBorderColor}; fill: ${e.labelBoxBkgColor}; } .labelText, .labelText > tspan { fill: ${e.labelTextColor}; stroke: none; } .loopText, .loopText > tspan { fill: ${e.loopTextColor}; stroke: none; } .loopLine { stroke-width: 2px; stroke-dasharray: 2, 2; stroke: ${e.labelBoxBorderColor}; fill: ${e.labelBoxBorderColor}; } .note { //stroke: #decc93; stroke: ${e.noteBorderColor}; fill: ${e.noteBkgColor}; } .noteText, .noteText > tspan { fill: ${e.noteTextColor}; stroke: none; } .activation0 { fill: ${e.activationBkgColor}; stroke: ${e.activationBorderColor}; } .activation1 { fill: ${e.activationBkgColor}; stroke: ${e.activationBorderColor}; } .activation2 { fill: ${e.activationBkgColor}; stroke: ${e.activationBorderColor}; } .actorPopupMenu { position: absolute; } .actorPopupMenuPanel { position: absolute; fill: ${e.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: ${e.actorBorder}; fill: ${e.actorBkg}; } .actor-man circle, line { stroke: ${e.actorBorder}; fill: ${e.actorBkg}; stroke-width: 2px; } `,"getStyles"),Ue=je,oe=_e(Be()),bt=36,ut="actor-top",xt="actor-bottom",Dt="actor-box",gt="actor-man",Lt=y(function(e,t){return ke(e,t)},"drawRect"),Ge=y(function(e,t,o,a,i){if(t.links===void 0||t.links===null||Object.keys(t.links).length===0)return{height:0,width:0};let s=t.links,c=t.actorCnt,d=t.rectData;var n="none";i&&(n="block !important");let r=e.append("g");r.attr("id","actor"+c+"_popup"),r.attr("class","actorPopupMenu"),r.attr("display",n);var p="";d.class!==void 0&&(p=" "+d.class);let x=d.width>o?d.width:o,u=r.append("rect");if(u.attr("class","actorPopupMenuPanel"+p),u.attr("x",d.x),u.attr("y",d.height),u.attr("fill",d.fill),u.attr("stroke",d.stroke),u.attr("width",x),u.attr("height",d.height),u.attr("rx",d.rx),u.attr("ry",d.ry),s!=null){var m=20;for(let v in s){var T=r.append("a"),I=(0,oe.sanitizeUrl)(s[v]);T.attr("xlink:href",I),T.attr("target","_blank"),ya(a)(v,T,d.x+10,d.height+m,x,20,{class:"actor"},a),m+=30}}return u.attr("height",m),{height:d.height+m,width:x}},"drawPopup"),$t=y(function(e){return"var pu = document.getElementById('"+e+"'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }"},"popupMenuToggle"),St=y(async function(e,t,o=null){let a=e.append("foreignObject"),i=await se(t.text,zt()),s=a.append("xhtml:div").attr("style","width: fit-content;").attr("xmlns","http://www.w3.org/1999/xhtml").html(i).node().getBoundingClientRect();if(a.attr("height",Math.round(s.height)).attr("width",Math.round(s.width)),t.class==="noteText"){let c=e.node().firstChild;c.setAttribute("height",s.height+2*t.textMargin);let d=c.getBBox();a.attr("x",Math.round(d.x+d.width/2-s.width/2)).attr("y",Math.round(d.y+d.height/2-s.height/2))}else if(o){let{startx:c,stopx:d,starty:n}=o;if(c>d){let r=c;c=d,d=r}a.attr("x",Math.round(c+Math.abs(c-d)/2-s.width/2)),t.class==="loopText"?a.attr("y",Math.round(n)):a.attr("y",Math.round(n-s.height))}return[a]},"drawKatex"),It=y(function(e,t){let o=0,a=0,i=t.text.split(k.lineBreakRegex),[s,c]=ie(t.fontSize),d=[],n=0,r=y(()=>t.y,"yfunc");if(t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0)switch(t.valign){case"top":case"start":r=y(()=>Math.round(t.y+t.textMargin),"yfunc");break;case"middle":case"center":r=y(()=>Math.round(t.y+(o+a+t.textMargin)/2),"yfunc");break;case"bottom":case"end":r=y(()=>Math.round(t.y+(o+a+2*t.textMargin)-t.textMargin),"yfunc");break}if(t.anchor!==void 0&&t.textMargin!==void 0&&t.width!==void 0)switch(t.anchor){case"left":case"start":t.x=Math.round(t.x+t.textMargin),t.anchor="start",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"middle":case"center":t.x=Math.round(t.x+t.width/2),t.anchor="middle",t.dominantBaseline="middle",t.alignmentBaseline="middle";break;case"right":case"end":t.x=Math.round(t.x+t.width-t.textMargin),t.anchor="end",t.dominantBaseline="middle",t.alignmentBaseline="middle";break}for(let[p,x]of i.entries()){t.textMargin!==void 0&&t.textMargin===0&&s!==void 0&&(n=p*s);let u=e.append("text");u.attr("x",t.x),u.attr("y",r()),t.anchor!==void 0&&u.attr("text-anchor",t.anchor).attr("dominant-baseline",t.dominantBaseline).attr("alignment-baseline",t.alignmentBaseline),t.fontFamily!==void 0&&u.style("font-family",t.fontFamily),c!==void 0&&u.style("font-size",c),t.fontWeight!==void 0&&u.style("font-weight",t.fontWeight),t.fill!==void 0&&u.attr("fill",t.fill),t.class!==void 0&&u.attr("class",t.class),t.dy!==void 0?u.attr("dy",t.dy):n!==0&&u.attr("dy",n);let m=x||Ye;if(t.tspan){let T=u.append("tspan");T.attr("x",t.x),t.fill!==void 0&&T.attr("fill",t.fill),T.text(m)}else u.text(m);t.valign!==void 0&&t.textMargin!==void 0&&t.textMargin>0&&(a+=(u._groups||u)[0][0].getBBox().height,o=a),d.push(u)}return d},"drawText"),ne=y(function(e,t){function o(i,s,c,d,n){return i+","+s+" "+(i+c)+","+s+" "+(i+c)+","+(s+d-n)+" "+(i+c-n*1.2)+","+(s+d)+" "+i+","+(s+d)}y(o,"genPoints");let a=e.append("polygon");return a.attr("points",o(t.x,t.y,t.width,t.height,7)),a.attr("class","labelBox"),t.y=t.y+t.height/2,It(e,t),a},"drawLabel"),_=-1,ce=y((e,t,o,a)=>{e.select&&o.forEach(i=>{let s=t.get(i),c=e.select("#actor"+s.actorCnt);!a.mirrorActors&&s.stopy?c.attr("y2",s.stopy+s.height/2):a.mirrorActors&&c.attr("y2",s.stopy)})},"fixLifeLineHeights"),Ke=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+t.height,d=e.append("g").lower();var n=d;a||(_++,Object.keys(t.links||{}).length&&!o.forceMenus&&n.attr("onclick",$t(`actor${_}_popup`)).attr("cursor","pointer"),n.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),n=d.append("g"),t.actorCnt=_,t.links!=null&&n.attr("id","root-"+_));let r=lt();var p="actor";t.properties?.class?p=t.properties.class:r.fill="#eaeaea",a?p+=` ${xt}`:p+=` ${ut}`,r.x=t.x,r.y=i,r.width=t.width,r.height=t.height,r.class=p,r.rx=3,r.ry=3,r.name=t.name;let x=Lt(n,r);if(t.rectData=r,t.properties?.icon){let m=t.properties.icon.trim();m.charAt(0)==="@"?Kt(n,r.x+r.width-20,r.y+10,m.substr(1)):Zt(n,r.x+r.width-20,r.y+10,m)}pt(o,W(t.description))(t.description,n,r.x,r.y,r.width,r.height,{class:`actor ${Dt}`},o);let u=t.height;if(x.node){let m=x.node().getBBox();t.height=m.height,u=m.height}return u},"drawActorTypeParticipant"),Ze=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+t.height,d=e.append("g").lower();var n=d;a||(_++,Object.keys(t.links||{}).length&&!o.forceMenus&&n.attr("onclick",$t(`actor${_}_popup`)).attr("cursor","pointer"),n.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),n=d.append("g"),t.actorCnt=_,t.links!=null&&n.attr("id","root-"+_));let r=lt();var p="actor";t.properties?.class?p=t.properties.class:r.fill="#eaeaea",a?p+=` ${xt}`:p+=` ${ut}`,r.x=t.x,r.y=i,r.width=t.width,r.height=t.height,r.class=p,r.name=t.name;let x=6,u={...r,x:r.x+-x,y:r.y+ +x,class:"actor"},m=Lt(n,r);if(Lt(n,u),t.rectData=r,t.properties?.icon){let I=t.properties.icon.trim();I.charAt(0)==="@"?Kt(n,r.x+r.width-20,r.y+10,I.substr(1)):Zt(n,r.x+r.width-20,r.y+10,I)}pt(o,W(t.description))(t.description,n,r.x-x,r.y+x,r.width,r.height,{class:`actor ${Dt}`},o);let T=t.height;if(m.node){let I=m.node().getBBox();t.height=I.height,T=I.height}return T},"drawActorTypeCollections"),Je=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+t.height,d=e.append("g").lower(),n=d;a||(_++,Object.keys(t.links||{}).length&&!o.forceMenus&&n.attr("onclick",$t(`actor${_}_popup`)).attr("cursor","pointer"),n.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),n=d.append("g"),t.actorCnt=_,t.links!=null&&n.attr("id","root-"+_));let r=lt(),p="actor";t.properties?.class?p=t.properties.class:r.fill="#eaeaea",a?p+=` ${xt}`:p+=` ${ut}`,r.x=t.x,r.y=i,r.width=t.width,r.height=t.height,r.class=p,r.name=t.name;let x=r.height/2,u=x/(2.5+r.height/50),m=n.append("g"),T=n.append("g");if(m.append("path").attr("d",`M ${r.x},${r.y+x} a ${u},${x} 0 0 0 0,${r.height} h ${r.width-2*u} a ${u},${x} 0 0 0 0,-${r.height} Z `).attr("class",p),T.append("path").attr("d",`M ${r.x},${r.y+x} a ${u},${x} 0 0 0 0,${r.height}`).attr("stroke","#666").attr("stroke-width","1px").attr("class",p),m.attr("transform",`translate(${u}, ${-(r.height/2)})`),T.attr("transform",`translate(${r.width-u}, ${-r.height/2})`),t.rectData=r,t.properties?.icon){let A=t.properties.icon.trim(),N=r.x+r.width-20,$=r.y+10;A.charAt(0)==="@"?Kt(n,N,$,A.substr(1)):Zt(n,N,$,A)}pt(o,W(t.description))(t.description,n,r.x,r.y,r.width,r.height,{class:`actor ${Dt}`},o);let I=t.height,v=m.select("path:last-child");if(v.node()){let A=v.node().getBBox();t.height=A.height,I=A.height}return I},"drawActorTypeQueue"),Qe=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+75,d=e.append("g").lower();a||(_++,d.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=_);let n=e.append("g"),r=gt;a?r+=` ${xt}`:r+=` ${ut}`,n.attr("class",r),n.attr("name",t.name);let p=lt();p.x=t.x,p.y=i,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor";let x=t.x+t.width/2,u=i+30,m=18;n.append("defs").append("marker").attr("id","filled-head-control").attr("refX",11).attr("refY",5.8).attr("markerWidth",20).attr("markerHeight",28).attr("orient","172.5").append("path").attr("d","M 14.4 5.6 L 7.2 10.4 L 8.8 5.6 L 7.2 0.8 Z"),n.append("circle").attr("cx",x).attr("cy",u).attr("r",m).attr("fill","#eaeaf7").attr("stroke","#666").attr("stroke-width",1.2),n.append("line").attr("marker-end","url(#filled-head-control)").attr("transform",`translate(${x}, ${u-m})`);let T=n.node().getBBox();return t.height=T.height+2*(o?.sequence?.labelBoxHeight??0),pt(o,W(t.description))(t.description,n,p.x,p.y+m+(a?5:10),p.width,p.height,{class:`actor ${gt}`},o),t.height},"drawActorTypeControl"),Xe=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+75,d=e.append("g").lower(),n=e.append("g"),r=gt;a?r+=` ${xt}`:r+=` ${ut}`,n.attr("class",r),n.attr("name",t.name);let p=lt();p.x=t.x,p.y=i,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor";let x=t.x+t.width/2,u=i+(a?10:25),m=18;n.append("circle").attr("cx",x).attr("cy",u).attr("r",m).attr("width",t.width).attr("height",t.height),n.append("line").attr("x1",x-m).attr("x2",x+m).attr("y1",u+m).attr("y2",u+m).attr("stroke","#333").attr("stroke-width",2);let T=n.node().getBBox();return t.height=T.height+(o?.sequence?.labelBoxHeight??0),a||(_++,d.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=_),pt(o,W(t.description))(t.description,n,p.x,p.y+(a?(u-i+m-5)/2:(u+m-i)/2),p.width,p.height,{class:`actor ${gt}`},o),a?n.attr("transform",`translate(0, ${m/2})`):n.attr("transform",`translate(0, ${m/2})`),t.height},"drawActorTypeEntity"),ta=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+t.height+2*o.boxTextMargin,d=e.append("g").lower(),n=d;a||(_++,Object.keys(t.links||{}).length&&!o.forceMenus&&n.attr("onclick",$t(`actor${_}_popup`)).attr("cursor","pointer"),n.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),n=d.append("g"),t.actorCnt=_,t.links!=null&&n.attr("id","root-"+_));let r=lt(),p="actor";t.properties?.class?p=t.properties.class:r.fill="#eaeaea",a?p+=` ${xt}`:p+=` ${ut}`,r.x=t.x,r.y=i,r.width=t.width,r.height=t.height,r.class=p,r.name=t.name,r.x=t.x,r.y=i;let x=r.width/4,u=r.width/4,m=x/2,T=m/(2.5+x/50),I=n.append("g"),v=` M ${r.x},${r.y+T} a ${m},${T} 0 0 0 ${x},0 a ${m},${T} 0 0 0 -${x},0 l 0,${u-2*T} a ${m},${T} 0 0 0 ${x},0 l 0,-${u-2*T} `;I.append("path").attr("d",v).attr("fill","#eaeaea").attr("stroke","#000").attr("stroke-width",1).attr("class",p),a?I.attr("transform",`translate(${x*1.5}, ${r.height/4-2*T})`):I.attr("transform",`translate(${x*1.5}, ${(r.height+T)/4})`),t.rectData=r,pt(o,W(t.description))(t.description,n,r.x,r.y+(a?(r.height+u)/4:(r.height+T)/2),r.width,r.height,{class:`actor ${Dt}`},o);let A=I.select("path:last-child");if(A.node()){let N=A.node().getBBox();t.height=N.height+(o.sequence.labelBoxHeight??0)}return t.height},"drawActorTypeDatabase"),ea=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+80,d=30,n=e.append("g").lower();a||(_++,n.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=_);let r=e.append("g"),p=gt;a?p+=` ${xt}`:p+=` ${ut}`,r.attr("class",p),r.attr("name",t.name);let x=lt();x.x=t.x,x.y=i,x.fill="#eaeaea",x.width=t.width,x.height=t.height,x.class="actor",r.append("line").attr("id","actor-man-torso"+_).attr("x1",t.x+t.width/2-d*2.5).attr("y1",i+10).attr("x2",t.x+t.width/2-15).attr("y2",i+10),r.append("line").attr("id","actor-man-arms"+_).attr("x1",t.x+t.width/2-d*2.5).attr("y1",i+0).attr("x2",t.x+t.width/2-d*2.5).attr("y2",i+20),r.append("circle").attr("cx",t.x+t.width/2).attr("cy",i+10).attr("r",d);let u=r.node().getBBox();return t.height=u.height+(o.sequence.labelBoxHeight??0),pt(o,W(t.description))(t.description,r,x.x,x.y+(a?d/2-4:d/2+3),x.width,x.height,{class:`actor ${gt}`},o),a?r.attr("transform",`translate(0,${d/2+7})`):r.attr("transform",`translate(0,${d/2+7})`),t.height},"drawActorTypeBoundary"),aa=y(function(e,t,o,a){let i=a?t.stopy:t.starty,s=t.x+t.width/2,c=i+80,d=e.append("g").lower();a||(_++,d.append("line").attr("id","actor"+_).attr("x1",s).attr("y1",c).attr("x2",s).attr("y2",2e3).attr("class","actor-line 200").attr("stroke-width","0.5px").attr("stroke","#999").attr("name",t.name),t.actorCnt=_);let n=e.append("g"),r=gt;a?r+=` ${xt}`:r+=` ${ut}`,n.attr("class",r),n.attr("name",t.name);let p=lt();p.x=t.x,p.y=i,p.fill="#eaeaea",p.width=t.width,p.height=t.height,p.class="actor",p.rx=3,p.ry=3,n.append("line").attr("id","actor-man-torso"+_).attr("x1",s).attr("y1",i+25).attr("x2",s).attr("y2",i+45),n.append("line").attr("id","actor-man-arms"+_).attr("x1",s-bt/2).attr("y1",i+33).attr("x2",s+bt/2).attr("y2",i+33),n.append("line").attr("x1",s-bt/2).attr("y1",i+60).attr("x2",s).attr("y2",i+45),n.append("line").attr("x1",s).attr("y1",i+45).attr("x2",s+bt/2-2).attr("y2",i+60);let x=n.append("circle");x.attr("cx",t.x+t.width/2),x.attr("cy",i+10),x.attr("r",15),x.attr("width",t.width),x.attr("height",t.height);let u=n.node().getBBox();return t.height=u.height,pt(o,W(t.description))(t.description,n,p.x,p.y+35,p.width,p.height,{class:`actor ${gt}`},o),t.height},"drawActorTypeActor"),ra=y(async function(e,t,o,a){switch(t.type){case"actor":return await aa(e,t,o,a);case"participant":return await Ke(e,t,o,a);case"boundary":return await ea(e,t,o,a);case"control":return await Qe(e,t,o,a);case"entity":return await Xe(e,t,o,a);case"database":return await ta(e,t,o,a);case"collections":return await Ze(e,t,o,a);case"queue":return await Je(e,t,o,a)}},"drawActor"),ia=y(function(e,t,o){let a=e.append("g");le(a,t),t.name&&pt(o)(t.name,a,t.x,t.y+o.boxTextMargin+(t.textMaxHeight||0)/2,t.width,0,{class:"text"},o),a.lower()},"drawBox"),sa=y(function(e){return e.append("g")},"anchorElement"),oa=y(function(e,t,o,a,i){let s=lt(),c=t.anchored;s.x=t.startx,s.y=t.starty,s.class="activation"+i%3,s.width=t.stopx-t.startx,s.height=o-t.starty,Lt(c,s)},"drawActivation"),na=y(async function(e,t,o,a){let{boxMargin:i,boxTextMargin:s,labelBoxHeight:c,labelBoxWidth:d,messageFontFamily:n,messageFontSize:r,messageFontWeight:p}=a,x=e.append("g"),u=y(function(I,v,A,N){return x.append("line").attr("x1",I).attr("y1",v).attr("x2",A).attr("y2",N).attr("class","loopLine")},"drawLoopLine");u(t.startx,t.starty,t.stopx,t.starty),u(t.stopx,t.starty,t.stopx,t.stopy),u(t.startx,t.stopy,t.stopx,t.stopy),u(t.startx,t.starty,t.startx,t.stopy),t.sections!==void 0&&t.sections.forEach(function(I){u(t.startx,I.y,t.stopx,I.y).style("stroke-dasharray","3, 3")});let m=Gt();m.text=o,m.x=t.startx,m.y=t.starty,m.fontFamily=n,m.fontSize=r,m.fontWeight=p,m.anchor="middle",m.valign="middle",m.tspan=!1,m.width=d||50,m.height=c||20,m.textMargin=s,m.class="labelText",ne(x,m),m=he(),m.text=t.title,m.x=t.startx+d/2+(t.stopx-t.startx)/2,m.y=t.starty+i+s,m.anchor="middle",m.valign="middle",m.textMargin=s,m.class="loopText",m.fontFamily=n,m.fontSize=r,m.fontWeight=p,m.wrap=!0;let T=W(m.text)?await St(x,m,t):It(x,m);if(t.sectionTitles!==void 0){for(let[I,v]of Object.entries(t.sectionTitles))if(v.message){m.text=v.message,m.x=t.startx+(t.stopx-t.startx)/2,m.y=t.sections[I].y+i+s,m.class="loopText",m.anchor="middle",m.valign="middle",m.tspan=!1,m.fontFamily=n,m.fontSize=r,m.fontWeight=p,m.wrap=t.wrap,W(m.text)?(t.starty=t.sections[I].y,await St(x,m,t)):It(x,m);let A=Math.round(T.map(N=>(N._groups||N)[0][0].getBBox().height).reduce((N,$)=>N+$));t.sections[I].height+=A-(i+s)}}return t.height=Math.round(t.stopy-t.starty),x},"drawLoop"),le=y(function(e,t){Le(e,t)},"drawBackgroundRect"),ca=y(function(e){e.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")},"insertDatabaseIcon"),la=y(function(e){e.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")},"insertComputerIcon"),ha=y(function(e){e.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")},"insertClockIcon"),da=y(function(e){e.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-start-reverse").append("path").attr("d","M -1 0 L 10 5 L 0 10 z")},"insertArrowHead"),pa=y(function(e){e.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")},"insertArrowFilledHead"),ga=y(function(e){e.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)},"insertSequenceNumber"),ua=y(function(e){e.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")},"insertArrowCrossHead"),he=y(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}},"getTextObj"),xa=y(function(){return{x:0,y:0,fill:"#EDF2AE",stroke:"#666",width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),pt=(function(){function e(s,c,d,n,r,p,x){let u=c.append("text").attr("x",d+r/2).attr("y",n+p/2+5).style("text-anchor","middle").text(s);i(u,x)}y(e,"byText");function t(s,c,d,n,r,p,x,u){let{actorFontSize:m,actorFontFamily:T,actorFontWeight:I}=u,[v,A]=ie(m),N=s.split(k.lineBreakRegex);for(let $=0;$e.height||0))+(this.loops.length===0?0:this.loops.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.messages.length===0?0:this.messages.map(e=>e.height||0).reduce((e,t)=>e+t))+(this.notes.length===0?0:this.notes.map(e=>e.height||0).reduce((e,t)=>e+t))},"getHeight"),clear:y(function(){this.actors=[],this.boxes=[],this.loops=[],this.messages=[],this.notes=[]},"clear"),addBox:y(function(e){this.boxes.push(e)},"addBox"),addActor:y(function(e){this.actors.push(e)},"addActor"),addLoop:y(function(e){this.loops.push(e)},"addLoop"),addMessage:y(function(e){this.messages.push(e)},"addMessage"),addNote:y(function(e){this.notes.push(e)},"addNote"),lastActor:y(function(){return this.actors[this.actors.length-1]},"lastActor"),lastLoop:y(function(){return this.loops[this.loops.length-1]},"lastLoop"),lastMessage:y(function(){return this.messages[this.messages.length-1]},"lastMessage"),lastNote:y(function(){return this.notes[this.notes.length-1]},"lastNote"),actors:[],boxes:[],loops:[],messages:[],notes:[]},init:y(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,ge(at())},"init"),updateVal:y(function(e,t,o,a){e[t]===void 0?e[t]=o:e[t]=a(o,e[t])},"updateVal"),updateBounds:y(function(e,t,o,a){let i=this,s=0;function c(d){return y(function(n){s++;let r=i.sequenceItems.length-s+1;i.updateVal(n,"starty",t-r*l.boxMargin,Math.min),i.updateVal(n,"stopy",a+r*l.boxMargin,Math.max),i.updateVal(b.data,"startx",e-r*l.boxMargin,Math.min),i.updateVal(b.data,"stopx",o+r*l.boxMargin,Math.max),d!=="activation"&&(i.updateVal(n,"startx",e-r*l.boxMargin,Math.min),i.updateVal(n,"stopx",o+r*l.boxMargin,Math.max),i.updateVal(b.data,"starty",t-r*l.boxMargin,Math.min),i.updateVal(b.data,"stopy",a+r*l.boxMargin,Math.max))},"updateItemBounds")}y(c,"updateFn"),this.sequenceItems.forEach(c()),this.activations.forEach(c("activation"))},"updateBounds"),insert:y(function(e,t,o,a){let i=k.getMin(e,o),s=k.getMax(e,o),c=k.getMin(t,a),d=k.getMax(t,a);this.updateVal(b.data,"startx",i,Math.min),this.updateVal(b.data,"starty",c,Math.min),this.updateVal(b.data,"stopx",s,Math.max),this.updateVal(b.data,"stopy",d,Math.max),this.updateBounds(i,c,s,d)},"insert"),newActivation:y(function(e,t,o){let a=o.get(e.from),i=Rt(e.from).length||0,s=a.x+a.width/2+(i-1)*l.activationWidth/2;this.activations.push({startx:s,starty:this.verticalPos+2,stopx:s+l.activationWidth,stopy:void 0,actor:e.from,anchored:C.anchorElement(t)})},"newActivation"),endActivation:y(function(e){let t=this.activations.map(function(o){return o.actor}).lastIndexOf(e.from);return this.activations.splice(t,1)[0]},"endActivation"),createLoop:y(function(e={message:void 0,wrap:!1,width:void 0},t){return{startx:void 0,starty:this.verticalPos,stopx:void 0,stopy:void 0,title:e.message,wrap:e.wrap,width:e.width,height:0,fill:t}},"createLoop"),newLoop:y(function(e={message:void 0,wrap:!1,width:void 0},t){this.sequenceItems.push(this.createLoop(e,t))},"newLoop"),endLoop:y(function(){return this.sequenceItems.pop()},"endLoop"),isLoopOverlap:y(function(){return this.sequenceItems.length?this.sequenceItems[this.sequenceItems.length-1].overlap:!1},"isLoopOverlap"),addSectionToLoop:y(function(e){let t=this.sequenceItems.pop();t.sections=t.sections||[],t.sectionTitles=t.sectionTitles||[],t.sections.push({y:b.getVerticalPos(),height:0}),t.sectionTitles.push(e),this.sequenceItems.push(t)},"addSectionToLoop"),saveVerticalPos:y(function(){this.isLoopOverlap()&&(this.savedVerticalPos=this.verticalPos)},"saveVerticalPos"),resetVerticalPos:y(function(){this.isLoopOverlap()&&(this.verticalPos=this.savedVerticalPos)},"resetVerticalPos"),bumpVerticalPos:y(function(e){this.verticalPos=this.verticalPos+e,this.data.stopy=k.getMax(this.data.stopy,this.verticalPos)},"bumpVerticalPos"),getVerticalPos:y(function(){return this.verticalPos},"getVerticalPos"),getBounds:y(function(){return{bounds:this.data,models:this.models}},"getBounds")},ma=y(async function(e,t){b.bumpVerticalPos(l.boxMargin),t.height=l.boxMargin,t.starty=b.getVerticalPos();let o=lt();o.x=t.startx,o.y=t.starty,o.width=t.width||l.width,o.class="note";let a=e.append("g"),i=C.drawRect(a,o),s=Gt();s.x=t.startx,s.y=t.starty,s.width=o.width,s.dy="1em",s.text=t.message,s.class="noteText",s.fontFamily=l.noteFontFamily,s.fontSize=l.noteFontSize,s.fontWeight=l.noteFontWeight,s.anchor=l.noteAlign,s.textMargin=l.noteMargin,s.valign="center";let c=W(s.text)?await St(a,s):It(a,s),d=Math.round(c.map(n=>(n._groups||n)[0][0].getBBox().height).reduce((n,r)=>n+r));i.attr("height",d+2*l.noteMargin),t.height+=d+2*l.noteMargin,b.bumpVerticalPos(d+2*l.noteMargin),t.stopy=t.starty+d+2*l.noteMargin,t.stopx=t.startx+o.width,b.insert(t.startx,t.starty,t.stopx,t.stopy),b.models.addNote(t)},"drawNote"),ft=y(e=>({fontFamily:e.messageFontFamily,fontSize:e.messageFontSize,fontWeight:e.messageFontWeight}),"messageFont"),Tt=y(e=>({fontFamily:e.noteFontFamily,fontSize:e.noteFontSize,fontWeight:e.noteFontWeight}),"noteFont"),jt=y(e=>({fontFamily:e.actorFontFamily,fontSize:e.actorFontSize,fontWeight:e.actorFontWeight}),"actorFont");async function de(e,t){b.bumpVerticalPos(10);let{startx:o,stopx:a,message:i}=t,s=k.splitBreaks(i).length,c=W(i),d=c?await kt(i,at()):Y.calculateTextDimensions(i,ft(l));if(!c){let x=d.height/s;t.height+=x,b.bumpVerticalPos(x)}let n,r=d.height-10,p=d.width;if(o===a){n=b.getVerticalPos()+r,l.rightAngles||(r+=l.boxMargin,n=b.getVerticalPos()+r),r+=30;let x=k.getMax(p/2,l.width/2);b.insert(o-x,b.getVerticalPos()-10+r,a+x,b.getVerticalPos()+30+r)}else r+=l.boxMargin,n=b.getVerticalPos()+r,b.insert(o,n-10,a,n);return b.bumpVerticalPos(r),t.height+=r,t.stopy=t.starty+t.height,b.insert(t.fromBounds,t.starty,t.toBounds,t.stopy),n}y(de,"boundMessage");var ba=y(async function(e,t,o,a){let{startx:i,stopx:s,starty:c,message:d,type:n,sequenceIndex:r,sequenceVisible:p}=t,x=Y.calculateTextDimensions(d,ft(l)),u=Gt();u.x=i,u.y=c+10,u.width=s-i,u.class="messageText",u.dy="1em",u.text=d,u.fontFamily=l.messageFontFamily,u.fontSize=l.messageFontSize,u.fontWeight=l.messageFontWeight,u.anchor=l.messageAlign,u.valign="center",u.textMargin=l.wrapPadding,u.tspan=!1,W(u.text)?await St(e,u,{startx:i,stopx:s,starty:o}):It(e,u);let m=x.width,T;i===s?l.rightAngles?T=e.append("path").attr("d",`M ${i},${o} H ${i+k.getMax(l.width/2,m/2)} V ${o+25} H ${i}`):T=e.append("path").attr("d","M "+i+","+o+" C "+(i+60)+","+(o-10)+" "+(i+60)+","+(o+30)+" "+i+","+(o+20)):(T=e.append("line"),T.attr("x1",i),T.attr("y1",o),T.attr("x2",s),T.attr("y2",o)),n===a.db.LINETYPE.DOTTED||n===a.db.LINETYPE.DOTTED_CROSS||n===a.db.LINETYPE.DOTTED_POINT||n===a.db.LINETYPE.DOTTED_OPEN||n===a.db.LINETYPE.BIDIRECTIONAL_DOTTED?(T.style("stroke-dasharray","3, 3"),T.attr("class","messageLine1")):T.attr("class","messageLine0");let I="";l.arrowMarkerAbsolute&&(I=Fe(!0)),T.attr("stroke-width",2),T.attr("stroke","none"),T.style("fill","none"),(n===a.db.LINETYPE.SOLID||n===a.db.LINETYPE.DOTTED)&&T.attr("marker-end","url("+I+"#arrowhead)"),(n===a.db.LINETYPE.BIDIRECTIONAL_SOLID||n===a.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(T.attr("marker-start","url("+I+"#arrowhead)"),T.attr("marker-end","url("+I+"#arrowhead)")),(n===a.db.LINETYPE.SOLID_POINT||n===a.db.LINETYPE.DOTTED_POINT)&&T.attr("marker-end","url("+I+"#filled-head)"),(n===a.db.LINETYPE.SOLID_CROSS||n===a.db.LINETYPE.DOTTED_CROSS)&&T.attr("marker-end","url("+I+"#crosshead)"),(p||l.showSequenceNumbers)&&((n===a.db.LINETYPE.BIDIRECTIONAL_SOLID||n===a.db.LINETYPE.BIDIRECTIONAL_DOTTED)&&(ii&&(i=r.height),r.width+d.x>s&&(s=r.width+d.x)}return{maxHeight:i,maxWidth:s}},"drawActorsPopup"),ge=y(function(e){Ne(l,e),e.fontFamily&&(l.actorFontFamily=l.noteFontFamily=l.messageFontFamily=e.fontFamily),e.fontSize&&(l.actorFontSize=l.noteFontSize=l.messageFontSize=e.fontSize),e.fontWeight&&(l.actorFontWeight=l.noteFontWeight=l.messageFontWeight=e.fontWeight)},"setConf"),Rt=y(function(e){return b.activations.filter(function(t){return t.actor===e})},"actorActivations"),re=y(function(e,t){let o=t.get(e),a=Rt(e),i=a.reduce(function(c,d){return k.getMin(c,d.startx)},o.x+o.width/2-1),s=a.reduce(function(c,d){return k.getMax(c,d.stopx)},o.x+o.width/2+1);return[i,s]},"activationBounds");function ot(e,t,o,a,i){b.bumpVerticalPos(o);let s=a;if(t.id&&t.message&&e[t.id]){let c=e[t.id].width,d=ft(l);t.message=Y.wrapLabel(`[${t.message}]`,c-2*l.wrapPadding,d),t.width=c,t.wrap=!0;let n=Y.calculateTextDimensions(t.message,d),r=k.getMax(n.height,l.labelBoxHeight);s=a+r,Z.debug(`${r} - ${t.message}`)}i(t),b.bumpVerticalPos(s)}y(ot,"adjustLoopHeightForWrap");function ue(e,t,o,a,i,s,c){function d(p,x){p.x{f.add(P.from),f.add(P.to)}),T=T.filter(P=>f.has(P))}fa(r,p,x,T,0,I,!1);let R=await La(I,p,$,a);C.insertArrowHead(r),C.insertArrowCrossHead(r),C.insertArrowFilledHead(r),C.insertSequenceNumber(r);function V(f,P){let G=b.endActivation(f);G.starty+18>P&&(G.starty=P-6,P+=12),C.drawActivation(r,G,P,l,Rt(f.from).length),b.insert(G.startx,P-10,G.stopx,P)}y(V,"activeEnd");let q=1,J=1,rt=[],z=[],H=0;for(let f of I){let P,G,tt;switch(f.type){case a.db.LINETYPE.NOTE:b.resetVerticalPos(),G=f.noteModel,await ma(r,G);break;case a.db.LINETYPE.ACTIVE_START:b.newActivation(f,r,p);break;case a.db.LINETYPE.ACTIVE_END:V(f,b.getVerticalPos());break;case a.db.LINETYPE.LOOP_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O));break;case a.db.LINETYPE.LOOP_END:P=b.endLoop(),await C.drawLoop(r,P,"loop",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;case a.db.LINETYPE.RECT_START:ot(R,f,l.boxMargin,l.boxMargin,O=>b.newLoop(void 0,O.message));break;case a.db.LINETYPE.RECT_END:P=b.endLoop(),z.push(P),b.models.addLoop(P),b.bumpVerticalPos(P.stopy-b.getVerticalPos());break;case a.db.LINETYPE.OPT_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O));break;case a.db.LINETYPE.OPT_END:P=b.endLoop(),await C.drawLoop(r,P,"opt",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;case a.db.LINETYPE.ALT_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O));break;case a.db.LINETYPE.ALT_ELSE:ot(R,f,l.boxMargin+l.boxTextMargin,l.boxMargin,O=>b.addSectionToLoop(O));break;case a.db.LINETYPE.ALT_END:P=b.endLoop(),await C.drawLoop(r,P,"alt",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;case a.db.LINETYPE.PAR_START:case a.db.LINETYPE.PAR_OVER_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O)),b.saveVerticalPos();break;case a.db.LINETYPE.PAR_AND:ot(R,f,l.boxMargin+l.boxTextMargin,l.boxMargin,O=>b.addSectionToLoop(O));break;case a.db.LINETYPE.PAR_END:P=b.endLoop(),await C.drawLoop(r,P,"par",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;case a.db.LINETYPE.AUTONUMBER:q=f.message.start||q,J=f.message.step||J,f.message.visible?a.db.enableSequenceNumbers():a.db.disableSequenceNumbers();break;case a.db.LINETYPE.CRITICAL_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O));break;case a.db.LINETYPE.CRITICAL_OPTION:ot(R,f,l.boxMargin+l.boxTextMargin,l.boxMargin,O=>b.addSectionToLoop(O));break;case a.db.LINETYPE.CRITICAL_END:P=b.endLoop(),await C.drawLoop(r,P,"critical",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;case a.db.LINETYPE.BREAK_START:ot(R,f,l.boxMargin,l.boxMargin+l.boxTextMargin,O=>b.newLoop(O));break;case a.db.LINETYPE.BREAK_END:P=b.endLoop(),await C.drawLoop(r,P,"break",l),b.bumpVerticalPos(P.stopy-b.getVerticalPos()),b.models.addLoop(P);break;default:try{tt=f.msgModel,tt.starty=b.getVerticalPos(),tt.sequenceIndex=q,tt.sequenceVisible=a.db.showSequenceNumbers();let O=await de(r,tt);ue(f,tt,O,H,p,x,u),rt.push({messageModel:tt,lineStartY:O}),b.models.addMessage(tt)}catch(O){Z.error("error while drawing message",O)}}[a.db.LINETYPE.SOLID_OPEN,a.db.LINETYPE.DOTTED_OPEN,a.db.LINETYPE.SOLID,a.db.LINETYPE.DOTTED,a.db.LINETYPE.SOLID_CROSS,a.db.LINETYPE.DOTTED_CROSS,a.db.LINETYPE.SOLID_POINT,a.db.LINETYPE.DOTTED_POINT,a.db.LINETYPE.BIDIRECTIONAL_SOLID,a.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(f.type)&&(q=q+J),H++}Z.debug("createdActors",x),Z.debug("destroyedActors",u),await Ut(r,p,T,!1);for(let f of rt)await ba(r,f.messageModel,f.lineStartY,a);l.mirrorActors&&await Ut(r,p,T,!0),z.forEach(f=>C.drawBackgroundRect(r,f)),ce(r,p,T,l);for(let f of b.models.boxes){f.height=b.getVerticalPos()-f.y,b.insert(f.x,f.y,f.x+f.width,f.height);let P=l.boxMargin*2;f.startx=f.x-P,f.starty=f.y-P*.25,f.stopx=f.startx+f.width+2*P,f.stopy=f.starty+f.height+P*.75,f.stroke="rgb(0,0,0, 0.5)",C.drawBox(r,f,l)}A&&b.bumpVerticalPos(l.boxMargin);let F=pe(r,p,T,n),{bounds:D}=b.getBounds();D.startx===void 0&&(D.startx=0),D.starty===void 0&&(D.starty=0),D.stopx===void 0&&(D.stopx=0),D.stopy===void 0&&(D.stopy=0);let Q=D.stopy-D.starty;Q{let c=ft(l),d=s.actorKeys.reduce((x,u)=>x+=e.get(u).width+(e.get(u).margin||0),0),n=l.boxMargin*8;d+=n,d-=2*l.boxTextMargin,s.wrap&&(s.name=Y.wrapLabel(s.name,d-2*l.wrapPadding,c));let r=Y.calculateTextDimensions(s.name,c);i=k.getMax(r.height,i);let p=k.getMax(d,r.width+2*l.wrapPadding);if(s.margin=l.boxTextMargin,ds.textMaxHeight=i),k.getMax(a,l.height)}y(ye,"calculateActorMargins");var wa=y(async function(e,t,o){let a=t.get(e.from),i=t.get(e.to),s=a.x,c=i.x,d=e.wrap&&e.message,n=W(e.message)?await kt(e.message,at()):Y.calculateTextDimensions(d?Y.wrapLabel(e.message,l.width,Tt(l)):e.message,Tt(l)),r={width:d?l.width:k.getMax(l.width,n.width+2*l.noteMargin),height:0,startx:a.x,stopx:0,starty:0,stopy:0,message:e.message};return e.placement===o.db.PLACEMENT.RIGHTOF?(r.width=d?k.getMax(l.width,n.width):k.getMax(a.width/2+i.width/2,n.width+2*l.noteMargin),r.startx=s+(a.width+l.actorMargin)/2):e.placement===o.db.PLACEMENT.LEFTOF?(r.width=d?k.getMax(l.width,n.width+2*l.noteMargin):k.getMax(a.width/2+i.width/2,n.width+2*l.noteMargin),r.startx=s-r.width+(a.width-l.actorMargin)/2):e.to===e.from?(n=Y.calculateTextDimensions(d?Y.wrapLabel(e.message,k.getMax(l.width,a.width),Tt(l)):e.message,Tt(l)),r.width=d?k.getMax(l.width,a.width):k.getMax(a.width,l.width,n.width+2*l.noteMargin),r.startx=s+(a.width-r.width)/2):(r.width=Math.abs(s+a.width/2-(c+i.width/2))+l.actorMargin,r.startx=s2,x=y(I=>d?-I:I,"adjustValue");e.from===e.to?r=n:(e.activate&&!p&&(r+=x(l.activationWidth/2-1)),[o.db.LINETYPE.SOLID_OPEN,o.db.LINETYPE.DOTTED_OPEN].includes(e.type)||(r+=x(3)),[o.db.LINETYPE.BIDIRECTIONAL_SOLID,o.db.LINETYPE.BIDIRECTIONAL_DOTTED].includes(e.type)&&(n-=x(3)));let u=[a,i,s,c],m=Math.abs(n-r);e.wrap&&e.message&&(e.message=Y.wrapLabel(e.message,k.getMax(m+2*l.wrapPadding,l.width),ft(l)));let T=Y.calculateTextDimensions(e.message,ft(l));return{width:k.getMax(e.wrap?0:T.width+2*l.wrapPadding,m+2*l.wrapPadding,l.width),height:0,startx:n,stopx:r,starty:0,stopy:0,message:e.message,type:e.type,wrap:e.wrap,fromBounds:Math.min.apply(null,u),toBounds:Math.max.apply(null,u)}},"buildMessageModel"),La=y(async function(e,t,o,a){let i={},s=[],c,d,n;for(let r of e){switch(r.type){case a.db.LINETYPE.LOOP_START:case a.db.LINETYPE.ALT_START:case a.db.LINETYPE.OPT_START:case a.db.LINETYPE.PAR_START:case a.db.LINETYPE.PAR_OVER_START:case a.db.LINETYPE.CRITICAL_START:case a.db.LINETYPE.BREAK_START:s.push({id:r.id,msg:r.message,from:Number.MAX_SAFE_INTEGER,to:Number.MIN_SAFE_INTEGER,width:0});break;case a.db.LINETYPE.ALT_ELSE:case a.db.LINETYPE.PAR_AND:case a.db.LINETYPE.CRITICAL_OPTION:r.message&&(c=s.pop(),i[c.id]=c,i[r.id]=c,s.push(c));break;case a.db.LINETYPE.LOOP_END:case a.db.LINETYPE.ALT_END:case a.db.LINETYPE.OPT_END:case a.db.LINETYPE.PAR_END:case a.db.LINETYPE.CRITICAL_END:case a.db.LINETYPE.BREAK_END:c=s.pop(),i[c.id]=c;break;case a.db.LINETYPE.ACTIVE_START:{let p=t.get(r.from?r.from:r.to.actor),x=Rt(r.from?r.from:r.to.actor).length,u=p.x+p.width/2+(x-1)*l.activationWidth/2,m={startx:u,stopx:u+l.activationWidth,actor:r.from,enabled:!0};b.activations.push(m)}break;case a.db.LINETYPE.ACTIVE_END:{let p=b.activations.map(x=>x.actor).lastIndexOf(r.from);b.activations.splice(p,1).splice(0,1)}break}r.placement!==void 0?(d=await wa(r,t,a),r.noteModel=d,s.forEach(p=>{c=p,c.from=k.getMin(c.from,d.startx),c.to=k.getMax(c.to,d.startx+d.width),c.width=k.getMax(c.width,Math.abs(c.from-c.to))-l.labelBoxWidth})):(n=Ia(r,t,a),r.msgModel=n,n.startx&&n.stopx&&s.length>0&&s.forEach(p=>{if(c=p,n.startx===n.stopx){let x=t.get(r.from),u=t.get(r.to);c.from=k.getMin(x.x-n.width/2,x.x-x.width/2,c.from),c.to=k.getMax(u.x+n.width/2,u.x+x.width/2,c.to),c.width=k.getMax(c.width,Math.abs(c.to-c.from))-l.labelBoxWidth}else c.from=k.getMin(n.startx,c.from),c.to=k.getMax(n.stopx,c.to),c.width=k.getMax(c.width,n.width)-l.labelBoxWidth}))}return b.activations=[],Z.debug("Loop type widths:",i),i},"calculateLoopBounds"),ka={bounds:b,drawActors:Ut,drawActorsPopup:pe,setConf:ge,draw:Ea},Ma={parser:Ve,get db(){return new He},renderer:ka,styles:Ue,init:y(e=>{e.sequence||(e.sequence={}),e.wrap&&(e.sequence.wrap=e.wrap,Pe({sequence:{wrap:e.wrap}}))},"init")};export{Ma as diagram};