Files
build_notes_simengweb/assets/blockDiagram-HG7WUIX4-pYMouvi2.js
2026-03-29 16:10:06 +08:00

133 lines
69 KiB
JavaScript

import{m as ce}from"./chunk-HN6EAY2L-CnY8HTH7.js";import{o as he}from"./chunk-KSICW3F5-Cj3UG-uo.js";import{m as g,o as at,i as N,U as de,p as k,$ as ge,Q as ue,G as ye,bh as pe,aW as xe,b1 as fe,x as C,a_ as be,bi as Y,bj as Lt,bk as Q,bl as me,e as tt,a as we,s as It,bm as Bt,bn as ke,bo as Le}from"./mermaid.esm.min-DGQNoR5D.js";import{_ as Se}from"./chunk-H3VCZNTA-CxC2d02b.js";import"./app-t8Vldhgr.js";var ft=(function(){var e=g(function(D,d,x,w){for(x=x||{},w=D.length;w--;x[D[w]]=d);return x},"o"),t=[1,15],a=[1,7],s=[1,13],l=[1,14],r=[1,19],i=[1,16],n=[1,17],o=[1,18],f=[8,30],c=[8,10,21,28,29,30,31,39,43,46],u=[1,23],b=[1,24],y=[8,10,15,16,21,28,29,30,31,39,43,46],m=[8,10,15,16,21,27,28,29,30,31,39,43,46],L=[1,49],S={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(D,d,x,w,E,h,_){var p=h.length-1;switch(E){case 4:w.getLogger().debug("Rule: separator (NL) ");break;case 5:w.getLogger().debug("Rule: separator (Space) ");break;case 6:w.getLogger().debug("Rule: separator (EOF) ");break;case 7:w.getLogger().debug("Rule: hierarchy: ",h[p-1]),w.setHierarchy(h[p-1]);break;case 8:w.getLogger().debug("Stop NL ");break;case 9:w.getLogger().debug("Stop EOF ");break;case 10:w.getLogger().debug("Stop NL2 ");break;case 11:w.getLogger().debug("Stop EOF2 ");break;case 12:w.getLogger().debug("Rule: statement: ",h[p]),typeof h[p].length=="number"?this.$=h[p]:this.$=[h[p]];break;case 13:w.getLogger().debug("Rule: statement #2: ",h[p-1]),this.$=[h[p-1]].concat(h[p]);break;case 14:w.getLogger().debug("Rule: link: ",h[p],D),this.$={edgeTypeStr:h[p],label:""};break;case 15:w.getLogger().debug("Rule: LABEL link: ",h[p-3],h[p-1],h[p]),this.$={edgeTypeStr:h[p],label:h[p-1]};break;case 18:let A=parseInt(h[p]),O=w.generateId();this.$={id:O,type:"space",label:"",width:A,children:[]};break;case 23:w.getLogger().debug("Rule: (nodeStatement link node) ",h[p-2],h[p-1],h[p]," typestr: ",h[p-1].edgeTypeStr);let q=w.edgeStrToEdgeData(h[p-1].edgeTypeStr);this.$=[{id:h[p-2].id,label:h[p-2].label,type:h[p-2].type,directions:h[p-2].directions},{id:h[p-2].id+"-"+h[p].id,start:h[p-2].id,end:h[p].id,label:h[p-1].label,type:"edge",directions:h[p].directions,arrowTypeEnd:q,arrowTypeStart:"arrow_open"},{id:h[p].id,label:h[p].label,type:w.typeStr2Type(h[p].typeStr),directions:h[p].directions}];break;case 24:w.getLogger().debug("Rule: nodeStatement (abc88 node size) ",h[p-1],h[p]),this.$={id:h[p-1].id,label:h[p-1].label,type:w.typeStr2Type(h[p-1].typeStr),directions:h[p-1].directions,widthInColumns:parseInt(h[p],10)};break;case 25:w.getLogger().debug("Rule: nodeStatement (node) ",h[p]),this.$={id:h[p].id,label:h[p].label,type:w.typeStr2Type(h[p].typeStr),directions:h[p].directions,widthInColumns:1};break;case 26:w.getLogger().debug("APA123",this?this:"na"),w.getLogger().debug("COLUMNS: ",h[p]),this.$={type:"column-setting",columns:h[p]==="auto"?-1:parseInt(h[p])};break;case 27:w.getLogger().debug("Rule: id-block statement : ",h[p-2],h[p-1]),w.generateId(),this.$={...h[p-2],type:"composite",children:h[p-1]};break;case 28:w.getLogger().debug("Rule: blockStatement : ",h[p-2],h[p-1],h[p]);let Z=w.generateId();this.$={id:Z,type:"composite",label:"",children:h[p-1]};break;case 29:w.getLogger().debug("Rule: node (NODE_ID separator): ",h[p]),this.$={id:h[p]};break;case 30:w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",h[p-1],h[p]),this.$={id:h[p-1],label:h[p].label,typeStr:h[p].typeStr,directions:h[p].directions};break;case 31:w.getLogger().debug("Rule: dirList: ",h[p]),this.$=[h[p]];break;case 32:w.getLogger().debug("Rule: dirList: ",h[p-1],h[p]),this.$=[h[p-1]].concat(h[p]);break;case 33:w.getLogger().debug("Rule: nodeShapeNLabel: ",h[p-2],h[p-1],h[p]),this.$={typeStr:h[p-2]+h[p],label:h[p-1]};break;case 34:w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",h[p-3],h[p-2]," #3:",h[p-1],h[p]),this.$={typeStr:h[p-3]+h[p],label:h[p-2],directions:h[p-1]};break;case 35:case 36:this.$={type:"classDef",id:h[p-1].trim(),css:h[p].trim()};break;case 37:this.$={type:"applyClass",id:h[p-1].trim(),styleClass:h[p].trim()};break;case 38:this.$={type:"applyStyles",id:h[p-1].trim(),stylesStr:h[p].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:l,31:r,39:i,43:n,46:o},{8:[1,20]},e(f,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:l,31:r,39:i,43:n,46:o}),e(c,[2,16],{14:22,15:u,16:b}),e(c,[2,17]),e(c,[2,18]),e(c,[2,19]),e(c,[2,20]),e(c,[2,21]),e(c,[2,22]),e(y,[2,25],{27:[1,25]}),e(c,[2,26]),{19:26,26:12,31:r},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:l,31:r,39:i,43:n,46:o},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(m,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(f,[2,13]),{26:35,31:r},{31:[2,14]},{17:[1,36]},e(y,[2,24]),{10:t,11:37,13:4,14:22,15:u,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:l,31:r,39:i,43:n,46:o},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(m,[2,30]),{18:[1,43]},{18:[1,44]},e(y,[2,23]),{18:[1,45]},{30:[1,46]},e(c,[2,28]),e(c,[2,35]),e(c,[2,36]),e(c,[2,37]),e(c,[2,38]),{36:[1,47]},{33:48,34:L},{15:[1,50]},e(c,[2,27]),e(m,[2,33]),{38:[1,51]},{33:52,34:L,38:[2,31]},{31:[2,15]},e(m,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(D,d){if(d.recoverable)this.trace(D);else{var x=new Error(D);throw x.hash=d,x}},"parseError"),parse:g(function(D){var d=this,x=[0],w=[],E=[null],h=[],_=this.table,p="",A=0,O=0,q=0,Z=2,Nt=1,ne=h.slice.call(arguments,1),R=Object.create(this.lexer),V={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(V.yy[dt]=this.yy[dt]);R.setInput(D,V.yy),V.yy.lexer=R,V.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var gt=R.yylloc;h.push(gt);var le=R.options&&R.options.ranges;typeof V.yy.parseError=="function"?this.parseError=V.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(W){x.length=x.length-2*W,E.length=E.length-W,h.length=h.length-W}g(oe,"popStack");function Tt(){var W;return W=w.pop()||R.lex()||Nt,typeof W!="number"&&(W instanceof Array&&(w=W,W=w.pop()),W=d.symbols_[W]||W),W}g(Tt,"lex");for(var P,ut,J,F,jr,yt,G={},it,j,$t,st;;){if(J=x[x.length-1],this.defaultActions[J]?F=this.defaultActions[J]:((P===null||typeof P>"u")&&(P=Tt()),F=_[J]&&_[J][P]),typeof F>"u"||!F.length||!F[0]){var pt="";st=[];for(it in _[J])this.terminals_[it]&&it>Z&&st.push("'"+this.terminals_[it]+"'");R.showPosition?pt="Parse error on line "+(A+1)+`:
`+R.showPosition()+`
Expecting `+st.join(", ")+", got '"+(this.terminals_[P]||P)+"'":pt="Parse error on line "+(A+1)+": Unexpected "+(P==Nt?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(pt,{text:R.match,token:this.terminals_[P]||P,line:R.yylineno,loc:gt,expected:st})}if(F[0]instanceof Array&&F.length>1)throw new Error("Parse Error: multiple actions possible at state: "+J+", token: "+P);switch(F[0]){case 1:x.push(P),E.push(R.yytext),h.push(R.yylloc),x.push(F[1]),P=null,ut?(P=ut,ut=null):(O=R.yyleng,p=R.yytext,A=R.yylineno,gt=R.yylloc,q>0);break;case 2:if(j=this.productions_[F[1]][1],G.$=E[E.length-j],G._$={first_line:h[h.length-(j||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(j||1)].first_column,last_column:h[h.length-1].last_column},le&&(G._$.range=[h[h.length-(j||1)].range[0],h[h.length-1].range[1]]),yt=this.performAction.apply(G,[p,O,A,V.yy,F[1],E,h].concat(ne)),typeof yt<"u")return yt;j&&(x=x.slice(0,-1*j*2),E=E.slice(0,-1*j),h=h.slice(0,-1*j)),x.push(this.productions_[F[1]][0]),E.push(G.$),h.push(G._$),$t=_[x[x.length-2]][x[x.length-1]],x.push($t);break;case 3:return!0}}return!0},"parse")},v=(function(){var D={EOF:1,parseError:g(function(d,x){if(this.yy.parser)this.yy.parser.parseError(d,x);else throw new Error(d)},"parseError"),setInput:g(function(d,x){return this.yy=x||this.yy||{},this._input=d,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:g(function(){var d=this._input[0];this.yytext+=d,this.yyleng++,this.offset++,this.match+=d,this.matched+=d;var x=d.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),d},"input"),unput:g(function(d){var x=d.length,w=d.split(/(?:\r\n?|\n)/g);this._input=d+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var E=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),w.length-1&&(this.yylineno-=w.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:w?(w.length===E.length?this.yylloc.first_column:0)+E[E.length-w.length].length-w[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(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:g(function(d){this.unput(this.match.slice(d))},"less"),pastInput:g(function(){var d=this.matched.substr(0,this.matched.length-this.match.length);return(d.length>20?"...":"")+d.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var d=this.match;return d.length<20&&(d+=this._input.substr(0,20-d.length)),(d.substr(0,20)+(d.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var d=this.pastInput(),x=new Array(d.length+1).join("-");return d+this.upcomingInput()+`
`+x+"^"},"showPosition"),test_match:g(function(d,x){var w,E,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))),E=d[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+d[0].length},this.yytext+=d[0],this.match+=d[0],this.matches=d,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(d[0].length),this.matched+=d[0],w=this.performAction.call(this,this.yy,this,x,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var _ in h)this[_]=h[_];return!1}return!1},"test_match"),next:g(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var d,x,w,E;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),_=0;_<h.length;_++)if(w=this._input.match(this.rules[h[_]]),w&&(!x||w[0].length>x[0].length)){if(x=w,E=_,this.options.backtrack_lexer){if(d=this.test_match(w,h[_]),d!==!1)return d;if(this._backtrack){x=!1;continue}else return!1}else if(!this.options.flex)break}return x?(d=this.test_match(x,h[E]),d!==!1?d:!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:g(function(){var d=this.next();return d||this.lex()},"lex"),begin:g(function(d){this.conditionStack.push(d)},"begin"),popState:g(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:g(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:g(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:g(function(d){this.begin(d)},"pushState"),stateStackSize:g(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:g(function(d,x,w,E){switch(w){case 0:return d.getLogger().debug("Found block-beta"),10;case 1:return d.getLogger().debug("Found id-block"),29;case 2:return d.getLogger().debug("Found block"),10;case 3:d.getLogger().debug(".",x.yytext);break;case 4:d.getLogger().debug("_",x.yytext);break;case 5:return 5;case 6:return x.yytext=-1,28;case 7:return x.yytext=x.yytext.replace(/columns\s+/,""),d.getLogger().debug("COLUMNS (LEX)",x.yytext),28;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:d.getLogger().debug("LEX: POPPING STR:",x.yytext),this.popState();break;case 13:return d.getLogger().debug("LEX: STR end:",x.yytext),"STR";case 14:return x.yytext=x.yytext.replace(/space\:/,""),d.getLogger().debug("SPACE NUM (LEX)",x.yytext),21;case 15:return x.yytext="1",d.getLogger().debug("COLUMNS (LEX)",x.yytext),21;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 21:return this.popState(),this.pushState("CLASSDEFID"),40;case 22:return this.popState(),41;case 23:return this.pushState("CLASS"),43;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;case 25:return this.popState(),45;case 26:return this.pushState("STYLE_STMNT"),46;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;case 28:return this.popState(),48;case 29:return this.pushState("acc_title"),"acc_title";case 30:return this.popState(),"acc_title_value";case 31:return this.pushState("acc_descr"),"acc_descr";case 32:return this.popState(),"acc_descr_value";case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),d.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),d.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),d.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),d.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),d.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),d.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),d.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),d.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),d.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),d.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),d.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),d.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return d.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return d.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return d.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return d.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return d.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return d.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return d.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 65:return this.pushState("NODE"),35;case 66:return this.pushState("NODE"),35;case 67:return this.pushState("NODE"),35;case 68:return this.pushState("NODE"),35;case 69:return this.pushState("NODE"),35;case 70:return this.pushState("NODE"),35;case 71:return this.pushState("NODE"),35;case 72:return d.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),d.getLogger().debug("LEX ARR START"),37;case 74:return d.getLogger().debug("Lex: NODE_ID",x.yytext),31;case 75:return d.getLogger().debug("Lex: EOF",x.yytext),8;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:d.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:d.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return d.getLogger().debug("LEX: NODE_DESCR:",x.yytext),"NODE_DESCR";case 83:d.getLogger().debug("LEX POPPING"),this.popState();break;case 84:d.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (right): dir:",x.yytext),"DIR";case 86:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (left):",x.yytext),"DIR";case 87:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (x):",x.yytext),"DIR";case 88:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (y):",x.yytext),"DIR";case 89:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (up):",x.yytext),"DIR";case 90:return x.yytext=x.yytext.replace(/^,\s*/,""),d.getLogger().debug("Lex (down):",x.yytext),"DIR";case 91:return x.yytext="]>",d.getLogger().debug("Lex (ARROW_DIR end):",x.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return d.getLogger().debug("Lex: LINK","#"+x.yytext+"#"),15;case 93:return d.getLogger().debug("Lex: LINK",x.yytext),15;case 94:return d.getLogger().debug("Lex: LINK",x.yytext),15;case 95:return d.getLogger().debug("Lex: LINK",x.yytext),15;case 96:return d.getLogger().debug("Lex: START_LINK",x.yytext),this.pushState("LLABEL"),16;case 97:return d.getLogger().debug("Lex: START_LINK",x.yytext),this.pushState("LLABEL"),16;case 98:return d.getLogger().debug("Lex: START_LINK",x.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return d.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),d.getLogger().debug("Lex: LINK","#"+x.yytext+"#"),15;case 102:return this.popState(),d.getLogger().debug("Lex: LINK",x.yytext),15;case 103:return this.popState(),d.getLogger().debug("Lex: LINK",x.yytext),15;case 104:return d.getLogger().debug("Lex: COLON",x.yytext),x.yytext=x.yytext.slice(1),27}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return D})();S.lexer=v;function I(){this.yy={}}return g(I,"Parser"),I.prototype=S,S.Parser=I,new I})();ft.parser=ft;var _e=ft,K=new Map,St=[],bt=new Map,Ct="color",Ot="fill",Ee="bgFill",Xt=",",De=C(),lt=new Map,ve=g(e=>we.sanitizeText(e,De),"sanitizeText"),Ne=g(function(e,t=""){let a=lt.get(e);a||(a={id:e,styles:[],textStyles:[]},lt.set(e,a)),t?.split(Xt).forEach(s=>{let l=s.replace(/([^;]*);/,"$1").trim();if(RegExp(Ct).exec(s)){let r=l.replace(Ot,Ee).replace(Ct,Ot);a.textStyles.push(r)}a.styles.push(l)})},"addStyleClass"),Te=g(function(e,t=""){let a=K.get(e);t!=null&&(a.styles=t.split(Xt))},"addStyle2Node"),$e=g(function(e,t){e.split(",").forEach(function(a){let s=K.get(a);if(s===void 0){let l=a.trim();s={id:l,type:"na",children:[]},K.set(l,s)}s.classes||(s.classes=[]),s.classes.push(t)})},"setCssClass"),Ft=g((e,t)=>{let a=e.flat(),s=[],l=a.find(r=>r?.type==="column-setting")?.columns??-1;for(let r of a){if(typeof l=="number"&&l>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>l&&k.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${l}`),r.label&&(r.label=ve(r.label)),r.type==="classDef"){Ne(r.id,r.css);continue}if(r.type==="applyClass"){$e(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){r?.stylesStr&&Te(r.id,r?.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){let i=(bt.get(r.id)??0)+1;bt.set(r.id,i),r.id=i+"-"+r.id,St.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);let i=K.get(r.id);if(i===void 0?K.set(r.id,r):(r.type!=="na"&&(i.type=r.type),r.label!==r.id&&(i.label=r.label)),r.children&&Ft(r.children,r),r.type==="space"){let n=r.width??1;for(let o=0;o<n;o++){let f=Se(r);f.id=f.id+"-"+o,K.set(f.id,f),s.push(f)}}else i===void 0&&s.push(r)}}t.children=s},"populateBlockDatabase"),_t=[],rt={id:"root",type:"composite",children:[],columns:-1},Ie=g(()=>{k.debug("Clear called"),ge(),rt={id:"root",type:"composite",children:[],columns:-1},K=new Map([["root",rt]]),_t=[],lt=new Map,St=[],bt=new Map},"clear");function Ut(e){switch(k.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return k.debug("we have a round"),"round";case"(())":return"circle";case">]":return"rect_left_inv_arrow";case"{}":return"diamond";case"{{}}":return"hexagon";case"([])":return"stadium";case"[[]]":return"subroutine";case"[()]":return"cylinder";case"((()))":return"doublecircle";case"[//]":return"lean_right";case"[\\\\]":return"lean_left";case"[/\\]":return"trapezoid";case"[\\/]":return"inv_trapezoid";case"<[]>":return"block_arrow";default:return"na"}}g(Ut,"typeStr2Type");function Kt(e){switch(k.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}g(Kt,"edgeTypeStr2Type");function Ht(e){switch(e.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}g(Ht,"edgeStrToEdgeData");var Rt=0,Be=g(()=>(Rt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Rt),"generateId"),Ce=g(e=>{rt.children=e,Ft(e,rt),_t=rt.children},"setHierarchy"),Oe=g(e=>{let t=K.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),Re=g(()=>[...K.values()],"getBlocksFlat"),ze=g(()=>_t||[],"getBlocks"),Ae=g(()=>St,"getEdges"),Me=g(e=>K.get(e),"getBlock"),Pe=g(e=>{K.set(e.id,e)},"setBlock"),Ye=g(()=>k,"getLogger"),We=g(function(){return lt},"getClasses"),Xe={getConfig:g(()=>at().block,"getConfig"),typeStr2Type:Ut,edgeTypeStr2Type:Kt,edgeStrToEdgeData:Ht,getLogger:Ye,getBlocksFlat:Re,getBlocks:ze,getEdges:Ae,setHierarchy:Ce,getBlock:Me,setBlock:Pe,getColumns:Oe,getClasses:We,clear:Ie,generateId:Be},Fe=Xe,xt=g((e,t)=>{let a=ye,s=a(e,"r"),l=a(e,"g"),r=a(e,"b");return ue(s,l,r,t)},"fade"),Ue=g(e=>`.label {
font-family: ${e.fontFamily};
color: ${e.nodeTextColor||e.textColor};
}
.cluster-label text {
fill: ${e.titleColor};
}
.cluster-label span,p {
color: ${e.titleColor};
}
.label text,span,p {
fill: ${e.nodeTextColor||e.textColor};
color: ${e.nodeTextColor||e.textColor};
}
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
fill: ${e.mainBkg};
stroke: ${e.nodeBorder};
stroke-width: 1px;
}
.flowchart-label text {
text-anchor: middle;
}
// .flowchart-label .text-outer-tspan {
// text-anchor: middle;
// }
// .flowchart-label .text-inner-tspan {
// text-anchor: start;
// }
.node .label {
text-align: center;
}
.node.clickable {
cursor: pointer;
}
.arrowheadPath {
fill: ${e.arrowheadColor};
}
.edgePath .path {
stroke: ${e.lineColor};
stroke-width: 2.0px;
}
.flowchart-link {
stroke: ${e.lineColor};
fill: none;
}
.edgeLabel {
background-color: ${e.edgeLabelBackground};
/*
* This is for backward compatibility with existing code that didn't
* add a \`<p>\` around edge labels.
*
* TODO: We should probably remove this in a future release.
*/
p {
margin: 0;
padding: 0;
display: inline;
}
rect {
opacity: 0.5;
background-color: ${e.edgeLabelBackground};
fill: ${e.edgeLabelBackground};
}
text-align: center;
}
/* For html labels only */
.labelBkg {
background-color: ${e.edgeLabelBackground};
}
.node .cluster {
// fill: ${xt(e.mainBkg,.5)};
fill: ${xt(e.clusterBkg,.5)};
stroke: ${xt(e.clusterBorder,.2)};
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
stroke-width: 1px;
}
.cluster text {
fill: ${e.titleColor};
}
.cluster span,p {
color: ${e.titleColor};
}
/* .cluster div {
color: ${e.titleColor};
} */
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: ${e.fontFamily};
font-size: 12px;
background: ${e.tertiaryColor};
border: 1px solid ${e.border2};
border-radius: 2px;
pointer-events: none;
z-index: 100;
}
.flowchartTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${e.textColor};
}
${he()}
`,"getStyles"),Ke=Ue,He=g((e,t,a,s)=>{t.forEach(l=>{rr[l](e,a,s)})},"insertMarkers"),Ze=g((e,t,a)=>{k.trace("Making markers for ",a),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),je=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),qe=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),Ve=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",a+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).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")},"dependency"),Je=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",a+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),Ge=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),Qe=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),tr=g((e,t,a)=>{e.append("marker").attr("id",a+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",a+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),er=g((e,t,a)=>{e.append("defs").append("marker").attr("id",a+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),rr={extension:Ze,composition:je,aggregation:qe,dependency:Ve,lollipop:Je,point:Ge,circle:Qe,cross:tr,barb:er},ar=He,B=C()?.block?.padding??8;function mt(e,t){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(t<0||!Number.isInteger(t))throw new Error("Position must be a non-negative integer."+t);if(e<0)return{px:t,py:0};if(e===1)return{px:0,py:t};let a=t%e,s=Math.floor(t/e);return{px:a,py:s}}g(mt,"calculateBlockPosition");var ir=g(e=>{let t=0,a=0;for(let s of e.children){let{width:l,height:r,x:i,y:n}=s.size??{width:0,height:0,x:0,y:0};k.debug("getMaxChildSize abc95 child:",s.id,"width:",l,"height:",r,"x:",i,"y:",n,s.type),s.type!=="space"&&(l>t&&(t=l/(s.widthInColumns??1)),r>a&&(a=r))}return{width:t,height:a}},"getMaxChildSize");function ot(e,t,a=0,s=0){k.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",a),e?.size?.width||(e.size={width:a,height:s,x:0,y:0});let l=0,r=0;if(e.children?.length>0){for(let y of e.children)ot(y,t);let i=ir(e);l=i.width,r=i.height,k.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",l,r);for(let y of e.children)y.size&&(k.debug(`abc95 Setting size of children of ${e.id} id=${y.id} ${l} ${r} ${JSON.stringify(y.size)}`),y.size.width=l*(y.widthInColumns??1)+B*((y.widthInColumns??1)-1),y.size.height=r,y.size.x=0,y.size.y=0,k.debug(`abc95 updating size of ${e.id} children child:${y.id} maxWidth:${l} maxHeight:${r}`));for(let y of e.children)ot(y,t,l,r);let n=e.columns??-1,o=0;for(let y of e.children)o+=y.widthInColumns??1;let f=e.children.length;n>0&&n<o&&(f=n);let c=Math.ceil(o/f),u=f*(l+B)+B,b=c*(r+B)+B;if(u<a){k.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${u}`),u=a,b=s;let y=(a-f*B-B)/f,m=(s-c*B-B)/c;k.debug("Size indata abc88",e.id,"childWidth",y,"maxWidth",l),k.debug("Size indata abc88",e.id,"childHeight",m,"maxHeight",r),k.debug("Size indata abc88 xSize",f,"padding",B);for(let L of e.children)L.size&&(L.size.width=y,L.size.height=m,L.size.x=0,L.size.y=0)}if(k.debug(`abc95 (finale calc) ${e.id} xSize ${f} ySize ${c} columns ${n}${e.children.length} width=${Math.max(u,e.size?.width||0)}`),u<(e?.size?.width||0)){u=e?.size?.width||0;let y=n>0?Math.min(e.children.length,n):e.children.length;if(y>0){let m=(u-y*B-B)/y;k.debug("abc95 (growing to fit) width",e.id,u,e.size?.width,m);for(let L of e.children)L.size&&(L.size.width=m)}}e.size={width:u,height:b,x:0,y:0}}k.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}g(ot,"setBlockSizes");function Et(e,t){k.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let a=e.columns??-1;if(k.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){let s=e?.children[0]?.size?.width??0,l=e.children.length*s+(e.children.length-1)*B;k.debug("widthOfChildren 88",l,"posX");let r=new Map;{let c=0;for(let u of e.children){if(!u.size)continue;let{py:b}=mt(a,c),y=r.get(b)??0;u.size.height>y&&r.set(b,u.size.height);let m=u?.widthInColumns??1;a>0&&(m=Math.min(m,a-c%a)),c+=m}}let i=new Map;{let c=0,u=[...r.keys()].sort((b,y)=>b-y);for(let b of u)i.set(b,c),c+=(r.get(b)??0)+B}let n=0;k.debug("abc91 block?.size?.x",e.id,e?.size?.x);let o=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-B,f=0;for(let c of e.children){let u=e;if(!c.size)continue;let{width:b,height:y}=c.size,{px:m,py:L}=mt(a,n);if(L!=f&&(f=L,o=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-B,k.debug("New row in layout for block",e.id," and child ",c.id,f)),k.debug(`abc89 layout blocks (child) id: ${c.id} Pos: ${n} (px, py) ${m},${L} (${u?.size?.x},${u?.size?.y}) parent: ${u.id} width: ${b}${B}`),u.size){let v=b/2;c.size.x=o+B+v,k.debug(`abc91 layout blocks (calc) px, pyid:${c.id} startingPos=X${o} new startingPosX${c.size.x} ${v} padding=${B} width=${b} halfWidth=${v} => x:${c.size.x} y:${c.size.y} ${c.widthInColumns} (width * (child?.w || 1)) / 2 ${b*(c?.widthInColumns??1)/2}`),o=c.size.x+v;let I=i.get(L)??0,D=r.get(L)??y;c.size.y=u.size.y-u.size.height/2+I+D/2+B,k.debug(`abc88 layout blocks (calc) px, pyid:${c.id}startingPosX${o}${B}${v}=>x:${c.size.x}y:${c.size.y}${c.widthInColumns}(width * (child?.w || 1)) / 2${b*(c?.widthInColumns??1)/2}`)}c.children&&Et(c);let S=c?.widthInColumns??1;a>0&&(S=Math.min(S,a-n%a)),n+=S,k.debug("abc88 columnsPos",c,n)}}k.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}g(Et,"layoutBlocks");function Dt(e,{minX:t,minY:a,maxX:s,maxY:l}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:r,y:i,width:n,height:o}=e.size;r-n/2<t&&(t=r-n/2),i-o/2<a&&(a=i-o/2),r+n/2>s&&(s=r+n/2),i+o/2>l&&(l=i+o/2)}if(e.children)for(let r of e.children)({minX:t,minY:a,maxX:s,maxY:l}=Dt(r,{minX:t,minY:a,maxX:s,maxY:l}));return{minX:t,minY:a,maxX:s,maxY:l}}g(Dt,"findBounds");function Zt(e){let t=e.getBlock("root");if(!t)return;ot(t,e,0,0),Et(t),k.debug("getBlocks",JSON.stringify(t,null,2));let{minX:a,minY:s,maxX:l,maxY:r}=Dt(t),i=r-s,n=l-a;return{x:a,y:s,width:n,height:i}}g(Zt,"layout");var sr=g(async(e,t,a,s=!1,l=!1)=>{let r=t||"";typeof r=="object"&&(r=r[0]);let i=C(),n=Y(i);return await Lt(e,r,{style:a,isTitle:s,useHtmlLabels:n,markdown:!1,isNode:l,width:Number.POSITIVE_INFINITY},i)},"createLabel"),U=sr,nr=g((e,t,a,s,l)=>{t.arrowTypeStart&&zt(e,"start",t.arrowTypeStart,a,s,l),t.arrowTypeEnd&&zt(e,"end",t.arrowTypeEnd,a,s,l)},"addEdgeMarkers"),lr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},zt=g((e,t,a,s,l,r)=>{let i=lr[a];if(!i){k.warn(`Unknown arrow type: ${a}`);return}let n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${s}#${l}_${r}-${i}${n})`)},"addEdgeMarker"),wt={},M={},or=g(async(e,t)=>{let a=C(),s=Y(a),l=e.insert("g").attr("class","edgeLabel"),r=l.insert("g").attr("class","label"),i=t.labelType==="markdown",n=await Lt(e,t.label,{style:t.labelStyle,useHtmlLabels:s,addSvgBackground:i,isNode:!1,markdown:i,width:i?void 0:Number.POSITIVE_INFINITY},a);r.node().appendChild(n);let o=n.getBBox(),f=o;if(s){let u=n.children[0],b=N(n);o=u.getBoundingClientRect(),f=o,b.attr("width",o.width),b.attr("height",o.height)}else{let u=N(n).select("text").node();u&&typeof u.getBBox=="function"&&(f=u.getBBox())}r.attr("transform",Q(f,s)),wt[t.id]=l,t.width=o.width,t.height=o.height;let c;if(t.startLabelLeft){let u=e.insert("g").attr("class","edgeTerminals"),b=u.insert("g").attr("class","inner"),y=await U(b,t.startLabelLeft,t.labelStyle);c=y;let m=y.getBBox();if(s){let L=y.children[0],S=N(y);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}b.attr("transform",Q(m,s)),M[t.id]||(M[t.id]={}),M[t.id].startLeft=u,et(c,t.startLabelLeft)}if(t.startLabelRight){let u=e.insert("g").attr("class","edgeTerminals"),b=u.insert("g").attr("class","inner"),y=await U(u,t.startLabelRight,t.labelStyle);c=y,b.node().appendChild(y);let m=y.getBBox();if(s){let L=y.children[0],S=N(y);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}b.attr("transform",Q(m,s)),M[t.id]||(M[t.id]={}),M[t.id].startRight=u,et(c,t.startLabelRight)}if(t.endLabelLeft){let u=e.insert("g").attr("class","edgeTerminals"),b=u.insert("g").attr("class","inner"),y=await U(b,t.endLabelLeft,t.labelStyle);c=y;let m=y.getBBox();if(s){let L=y.children[0],S=N(y);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}b.attr("transform",Q(m,s)),u.node().appendChild(y),M[t.id]||(M[t.id]={}),M[t.id].endLeft=u,et(c,t.endLabelLeft)}if(t.endLabelRight){let u=e.insert("g").attr("class","edgeTerminals"),b=u.insert("g").attr("class","inner"),y=await U(b,t.endLabelRight,t.labelStyle);c=y;let m=y.getBBox();if(s){let L=y.children[0],S=N(y);m=L.getBoundingClientRect(),S.attr("width",m.width),S.attr("height",m.height)}b.attr("transform",Q(m,s)),u.node().appendChild(y),M[t.id]||(M[t.id]={}),M[t.id].endRight=u,et(c,t.endLabelRight)}return n},"insertEdgeLabel");function et(e,t){Y(C())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}g(et,"setTerminalWidth");var cr=g((e,t)=>{k.debug("Moving label abc88 ",e.id,e.label,wt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath,s=C(),{subGraphTitleTotalMargin:l}=me(s);if(e.label){let r=wt[e.id],i=e.x,n=e.y;if(a){let o=tt.calcLabelPosition(a);k.debug("Moving label "+e.label+" from (",i,",",n,") to (",o.x,",",o.y,") abc88"),t.updatedPath&&(i=o.x,n=o.y)}r.attr("transform",`translate(${i}, ${n+l/2})`)}if(e.startLabelLeft){let r=M[e.id].startLeft,i=e.x,n=e.y;if(a){let o=tt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);i=o.x,n=o.y}r.attr("transform",`translate(${i}, ${n})`)}if(e.startLabelRight){let r=M[e.id].startRight,i=e.x,n=e.y;if(a){let o=tt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);i=o.x,n=o.y}r.attr("transform",`translate(${i}, ${n})`)}if(e.endLabelLeft){let r=M[e.id].endLeft,i=e.x,n=e.y;if(a){let o=tt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);i=o.x,n=o.y}r.attr("transform",`translate(${i}, ${n})`)}if(e.endLabelRight){let r=M[e.id].endRight,i=e.x,n=e.y;if(a){let o=tt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);i=o.x,n=o.y}r.attr("transform",`translate(${i}, ${n})`)}},"positionEdgeLabel"),hr=g((e,t)=>{let a=e.x,s=e.y,l=Math.abs(t.x-a),r=Math.abs(t.y-s),i=e.width/2,n=e.height/2;return l>=i||r>=n},"outsideNode"),dr=g((e,t,a)=>{k.debug(`intersection calc abc89:
outsidePoint: ${JSON.stringify(t)}
insidePoint : ${JSON.stringify(a)}
node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);let s=e.x,l=e.y,r=Math.abs(s-a.x),i=e.width/2,n=a.x<t.x?i-r:i+r,o=e.height/2,f=Math.abs(t.y-a.y),c=Math.abs(t.x-a.x);if(Math.abs(l-t.y)*i>Math.abs(s-t.x)*o){let u=a.y<t.y?t.y-o-l:l-o-t.y;n=c*u/f;let b={x:a.x<t.x?a.x+n:a.x-c+n,y:a.y<t.y?a.y+f-u:a.y-f+u};return n===0&&(b.x=t.x,b.y=t.y),c===0&&(b.x=t.x),f===0&&(b.y=t.y),k.debug(`abc89 topp/bott calc, Q ${f}, q ${u}, R ${c}, r ${n}`,b),b}else{a.x<t.x?n=t.x-i-s:n=s-i-t.x;let u=f*n/c,b=a.x<t.x?a.x+c-n:a.x-c+n,y=a.y<t.y?a.y+u:a.y-u;return k.debug(`sides calc abc89, Q ${f}, q ${u}, R ${c}, r ${n}`,{_x:b,_y:y}),n===0&&(b=t.x,y=t.y),c===0&&(b=t.x),f===0&&(y=t.y),{x:b,y}}},"intersection"),At=g((e,t)=>{k.debug("abc88 cutPathAtIntersect",e,t);let a=[],s=e[0],l=!1;return e.forEach(r=>{if(!hr(t,r)&&!l){let i=dr(t,s,r),n=!1;a.forEach(o=>{n=n||o.x===i.x&&o.y===i.y}),a.some(o=>o.x===i.x&&o.y===i.y)||a.push(i),l=!0}else s=r,l||a.push(r)}),a},"cutPathAtIntersect"),gr=g(function(e,t,a,s,l,r,i){let n=a.points;k.debug("abc88 InsertEdge: edge=",a,"e=",t);let o=!1,f=r.node(t.v);var c=r.node(t.w);c?.intersect&&f?.intersect&&(n=n.slice(1,a.points.length-1),n.unshift(f.intersect(n[0])),n.push(c.intersect(n[n.length-1]))),a.toCluster&&(k.debug("to cluster abc88",s[a.toCluster]),n=At(a.points,s[a.toCluster].node),o=!0),a.fromCluster&&(k.debug("from cluster abc88",s[a.fromCluster]),n=At(n.reverse(),s[a.fromCluster].node).reverse(),o=!0);let u=n.filter(d=>!Number.isNaN(d.y)),b=fe;a.curve&&(l==="graph"||l==="flowchart")&&(b=a.curve);let{x:y,y:m}=pe(a),L=xe().x(y).y(m).curve(b),S;switch(a.thickness){case"normal":S="edge-thickness-normal";break;case"thick":S="edge-thickness-thick";break;case"invisible":S="edge-thickness-thick";break;default:S=""}switch(a.pattern){case"solid":S+=" edge-pattern-solid";break;case"dotted":S+=" edge-pattern-dotted";break;case"dashed":S+=" edge-pattern-dashed";break}let v=e.append("path").attr("d",L(u)).attr("id",a.id).attr("class"," "+S+(a.classes?" "+a.classes:"")).attr("style",a.style),I="";(C().flowchart.arrowMarkerAbsolute||C().state.arrowMarkerAbsolute)&&(I=be(!0)),nr(v,a,I,i,l);let D={};return o&&(D.updatedPath=n),D.originalPath=a.points,D},"insertEdge"),ur=g(e=>{let t=new Set;for(let a of e)switch(a){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(a);break}return t},"expandAndDeduplicateDirections"),yr=g((e,t,a)=>{let s=ur(e),l=2,r=t.height+2*a.padding,i=r/l,n=t.width+2*i+a.padding,o=a.padding/2;return s.has("right")&&s.has("left")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:i,y:0},{x:n/2,y:2*o},{x:n-i,y:0},{x:n,y:0},{x:n,y:-r/3},{x:n+2*o,y:-r/2},{x:n,y:-2*r/3},{x:n,y:-r},{x:n-i,y:-r},{x:n/2,y:-r-2*o},{x:i,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*o,y:-r/2},{x:0,y:-r/3}]:s.has("right")&&s.has("left")&&s.has("up")?[{x:i,y:0},{x:n-i,y:0},{x:n,y:-r/2},{x:n-i,y:-r},{x:i,y:-r},{x:0,y:-r/2}]:s.has("right")&&s.has("left")&&s.has("down")?[{x:0,y:0},{x:i,y:-r},{x:n-i,y:-r},{x:n,y:0}]:s.has("right")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:n,y:-i},{x:n,y:-r+i},{x:0,y:-r}]:s.has("left")&&s.has("up")&&s.has("down")?[{x:n,y:0},{x:0,y:-i},{x:0,y:-r+i},{x:n,y:-r}]:s.has("right")&&s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:n-i,y:-o},{x:n-i,y:0},{x:n,y:-r/2},{x:n-i,y:-r},{x:n-i,y:-r+o},{x:i,y:-r+o},{x:i,y:-r},{x:0,y:-r/2}]:s.has("up")&&s.has("down")?[{x:n/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-r+o},{x:0,y:-r+o},{x:n/2,y:-r},{x:n,y:-r+o},{x:n-i,y:-r+o},{x:n-i,y:-o},{x:n,y:-o}]:s.has("right")&&s.has("up")?[{x:0,y:0},{x:n,y:-i},{x:0,y:-r}]:s.has("right")&&s.has("down")?[{x:0,y:0},{x:n,y:0},{x:0,y:-r}]:s.has("left")&&s.has("up")?[{x:n,y:0},{x:0,y:-i},{x:n,y:-r}]:s.has("left")&&s.has("down")?[{x:n,y:0},{x:0,y:0},{x:n,y:-r}]:s.has("right")?[{x:i,y:-o},{x:i,y:-o},{x:n-i,y:-o},{x:n-i,y:0},{x:n,y:-r/2},{x:n-i,y:-r},{x:n-i,y:-r+o},{x:i,y:-r+o},{x:i,y:-r+o}]:s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:n-i,y:-o},{x:n-i,y:-r+o},{x:i,y:-r+o},{x:i,y:-r},{x:0,y:-r/2}]:s.has("up")?[{x:i,y:-o},{x:i,y:-r+o},{x:0,y:-r+o},{x:n/2,y:-r},{x:n,y:-r+o},{x:n-i,y:-r+o},{x:n-i,y:-o}]:s.has("down")?[{x:n/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-r+o},{x:n-i,y:-r+o},{x:n-i,y:-o},{x:n,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function jt(e,t){return e.intersect(t)}g(jt,"intersectNode");var pr=jt;function qt(e,t,a,s){var l=e.x,r=e.y,i=l-s.x,n=r-s.y,o=Math.sqrt(t*t*n*n+a*a*i*i),f=Math.abs(t*a*i/o);s.x<l&&(f=-f);var c=Math.abs(t*a*n/o);return s.y<r&&(c=-c),{x:l+f,y:r+c}}g(qt,"intersectEllipse");var Vt=qt;function Jt(e,t,a){return Vt(e,t,t,a)}g(Jt,"intersectCircle");var xr=Jt;function Gt(e,t,a,s){var l,r,i,n,o,f,c,u,b,y,m,L,S,v,I;if(l=t.y-e.y,i=e.x-t.x,o=t.x*e.y-e.x*t.y,b=l*a.x+i*a.y+o,y=l*s.x+i*s.y+o,!(b!==0&&y!==0&&kt(b,y))&&(r=s.y-a.y,n=a.x-s.x,f=s.x*a.y-a.x*s.y,c=r*e.x+n*e.y+f,u=r*t.x+n*t.y+f,!(c!==0&&u!==0&&kt(c,u))&&(m=l*n-r*i,m!==0)))return L=Math.abs(m/2),S=i*f-n*o,v=S<0?(S-L)/m:(S+L)/m,S=r*o-l*f,I=S<0?(S-L)/m:(S+L)/m,{x:v,y:I}}g(Gt,"intersectLine");function kt(e,t){return e*t>0}g(kt,"sameSign");var fr=Gt,br=Qt;function Qt(e,t,a){var s=e.x,l=e.y,r=[],i=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(m){i=Math.min(i,m.x),n=Math.min(n,m.y)}):(i=Math.min(i,t.x),n=Math.min(n,t.y));for(var o=s-e.width/2-i,f=l-e.height/2-n,c=0;c<t.length;c++){var u=t[c],b=t[c<t.length-1?c+1:0],y=fr(e,a,{x:o+u.x,y:f+u.y},{x:o+b.x,y:f+b.y});y&&r.push(y)}return r.length?(r.length>1&&r.sort(function(m,L){var S=m.x-a.x,v=m.y-a.y,I=Math.sqrt(S*S+v*v),D=L.x-a.x,d=L.y-a.y,x=Math.sqrt(D*D+d*d);return I<x?-1:I===x?0:1}),r[0]):e}g(Qt,"intersectPolygon");var mr=g((e,t)=>{var a=e.x,s=e.y,l=t.x-a,r=t.y-s,i=e.width/2,n=e.height/2,o,f;return Math.abs(r)*i>Math.abs(l)*n?(r<0&&(n=-n),o=r===0?0:n*l/r,f=n):(l<0&&(i=-i),o=i,f=l===0?0:i*r/l),{x:a+o,y:s+f}},"intersectRect"),wr=mr,T={node:pr,circle:xr,ellipse:Vt,polygon:br,rect:wr},z=g(async(e,t,a,s)=>{let l=C(),r,i=t.useHtmlLabels||Y(l);a?r=a:r="node default";let n=e.insert("g").attr("class",r).attr("id",t.domId||t.id),o=n.insert("g").attr("class","label").attr("style",t.labelStyle),f;t.labelText===void 0?f="":f=typeof t.labelText=="string"?t.labelText:t.labelText[0];let c;t.labelType==="markdown"?c=Lt(o,It(Bt(f),l),{useHtmlLabels:i,width:t.width||l.flowchart.wrappingWidth,classes:"markdown-node-label"},l):c=await U(o,It(Bt(f),l),t.labelStyle,!1,s);let u=c.getBBox(),b=t.padding/2;if(Y(l)){let y=c.children[0],m=N(c);await ke(y,f),u=y.getBoundingClientRect(),m.attr("width",u.width),m.attr("height",u.height)}return i?o.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"):o.attr("transform","translate(0, "+-u.height/2+")"),t.centerLabel&&o.attr("transform","translate("+-u.width/2+", "+-u.height/2+")"),o.insert("rect",":first-child"),{shapeSvg:n,bbox:u,halfPadding:b,label:o}},"labelHelper"),$=g((e,t)=>{let a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function H(e,t,a,s){return e.insert("polygon",":first-child").attr("points",s.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}g(H,"insertPolygonShape");var kr=g(async(e,t)=>{t.useHtmlLabels||Y(C())||(t.centerLabel=!0);let{shapeSvg:a,bbox:s,halfPadding:l}=await z(e,t,"node "+t.classes,!0);k.info("Classes = ",t.classes);let r=a.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-s.width/2-l).attr("y",-s.height/2-l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),$(t,r),t.intersect=function(i){return T.rect(t,i)},a},"note"),Lr=kr,Mt=g(e=>e?" "+e:"","formatClass"),X=g((e,t)=>`${t||"node default"}${Mt(e.classes)} ${Mt(e.class)}`,"getClassesFromNode"),Pt=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=l+r,n=[{x:i/2,y:0},{x:i,y:-i/2},{x:i/2,y:-i},{x:0,y:-i/2}];k.info("Question main (Circle)");let o=H(a,i,i,n);return o.attr("style",t.style),$(t,o),t.intersect=function(f){return k.warn("Intersect called"),T.polygon(t,n,f)},a},"question"),Sr=g((e,t)=>{let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,l=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}];return a.insert("polygon",":first-child").attr("points",l.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return T.circle(t,14,r)},a},"choice"),_r=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=4,r=s.height+t.padding,i=r/l,n=s.width+2*i+t.padding,o=[{x:i,y:0},{x:n-i,y:0},{x:n,y:-r/2},{x:n-i,y:-r},{x:i,y:-r},{x:0,y:-r/2}],f=H(a,n,r,o);return f.attr("style",t.style),$(t,f),t.intersect=function(c){return T.polygon(t,o,c)},a},"hexagon"),Er=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,void 0,!0),l=2,r=s.height+2*t.padding,i=r/l,n=s.width+2*i+t.padding,o=yr(t.directions,s,t),f=H(a,n,r,o);return f.attr("style",t.style),$(t,f),t.intersect=function(c){return T.polygon(t,o,c)},a},"block_arrow"),Dr=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:-r/2,y:0},{x:l,y:0},{x:l,y:-r},{x:-r/2,y:-r},{x:0,y:-r/2}];return H(a,l,r,i).attr("style",t.style),t.width=l+r,t.height=r,t.intersect=function(n){return T.polygon(t,i,n)},a},"rect_left_inv_arrow"),vr=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:-2*r/6,y:0},{x:l-r/6,y:0},{x:l+2*r/6,y:-r},{x:r/6,y:-r}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"lean_right"),Nr=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:2*r/6,y:0},{x:l+r/6,y:0},{x:l-2*r/6,y:-r},{x:-r/6,y:-r}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"lean_left"),Tr=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:-2*r/6,y:0},{x:l+2*r/6,y:0},{x:l-r/6,y:-r},{x:r/6,y:-r}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"trapezoid"),$r=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:r/6,y:0},{x:l-r/6,y:0},{x:l+2*r/6,y:-r},{x:-2*r/6,y:-r}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"inv_trapezoid"),Ir=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:0,y:0},{x:l+r/2,y:0},{x:l,y:-r/2},{x:l+r/2,y:-r},{x:0,y:-r}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"rect_right_inv_arrow"),Br=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=l/2,i=r/(2.5+l/50),n=s.height+i+t.padding,o="M 0,"+i+" a "+r+","+i+" 0,0,0 "+l+" 0 a "+r+","+i+" 0,0,0 "+-l+" 0 l 0,"+n+" a "+r+","+i+" 0,0,0 "+l+" 0 l 0,"+-n,f=a.attr("label-offset-y",i).insert("path",":first-child").attr("style",t.style).attr("d",o).attr("transform","translate("+-l/2+","+-(n/2+i)+")");return $(t,f),t.intersect=function(c){let u=T.rect(t,c),b=u.x-t.x;if(r!=0&&(Math.abs(b)<t.width/2||Math.abs(b)==t.width/2&&Math.abs(u.y-t.y)>t.height/2-i)){let y=i*i*(1-b*b/(r*r));y!=0&&(y=Math.sqrt(y)),y=i-y,c.y-t.y>0&&(y=-y),u.y+=y}return u},a},"cylinder"),Cr=g(async(e,t)=>{let{shapeSvg:a,bbox:s,halfPadding:l}=await z(e,t,"node "+t.classes+" "+t.class,!0),r=a.insert("rect",":first-child"),i=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,o=t.positioned?-i/2:-s.width/2-l,f=t.positioned?-n/2:-s.height/2-l;if(r.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",f).attr("width",i).attr("height",n),t.props){let c=new Set(Object.keys(t.props));t.props.borders&&(ct(r,t.props.borders,i,n),c.delete("borders")),c.forEach(u=>{k.warn(`Unknown node property ${u}`)})}return $(t,r),t.intersect=function(c){return T.rect(t,c)},a},"rect"),Or=g(async(e,t)=>{let{shapeSvg:a,bbox:s,halfPadding:l}=await z(e,t,"node "+t.classes,!0),r=a.insert("rect",":first-child"),i=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,o=t.positioned?-i/2:-s.width/2-l,f=t.positioned?-n/2:-s.height/2-l;if(r.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",f).attr("width",i).attr("height",n),t.props){let c=new Set(Object.keys(t.props));t.props.borders&&(ct(r,t.props.borders,i,n),c.delete("borders")),c.forEach(u=>{k.warn(`Unknown node property ${u}`)})}return $(t,r),t.intersect=function(c){return T.rect(t,c)},a},"composite"),Rr=g(async(e,t)=>{let{shapeSvg:a}=await z(e,t,"label",!0);k.trace("Classes = ",t.class);let s=a.insert("rect",":first-child"),l=0,r=0;if(s.attr("width",l).attr("height",r),a.attr("class","label edgeLabel"),t.props){let i=new Set(Object.keys(t.props));t.props.borders&&(ct(s,t.props.borders,l,r),i.delete("borders")),i.forEach(n=>{k.warn(`Unknown node property ${n}`)})}return $(t,s),t.intersect=function(i){return T.rect(t,i)},a},"labelRect");function ct(e,t,a,s){let l=[],r=g(n=>{l.push(n,0)},"addBorder"),i=g(n=>{l.push(0,n)},"skipBorder");t.includes("t")?(k.debug("add top border"),r(a)):i(a),t.includes("r")?(k.debug("add right border"),r(s)):i(s),t.includes("b")?(k.debug("add bottom border"),r(a)):i(a),t.includes("l")?(k.debug("add left border"),r(s)):i(s),e.attr("stroke-dasharray",l.join(" "))}g(ct,"applyNodePropertyBorders");var zr=g(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";let s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),l=s.insert("rect",":first-child"),r=s.insert("line"),i=s.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText,o="";typeof n=="object"?o=n[0]:o=n,k.info("Label text abc79",o,n,typeof n=="object");let f=await U(i,o,t.labelStyle,!0,!0),c={width:0,height:0};if(Y(C())){let L=f.children[0],S=N(f);c=L.getBoundingClientRect(),S.attr("width",c.width),S.attr("height",c.height)}k.info("Text 2",n);let u=n.slice(1,n.length),b=f.getBBox(),y=await U(i,u.join?u.join("<br/>"):u,t.labelStyle,!0,!0);if(Y(C())){let L=y.children[0],S=N(y);c=L.getBoundingClientRect(),S.attr("width",c.width),S.attr("height",c.height)}let m=t.padding/2;return N(y).attr("transform","translate( "+(c.width>b.width?0:(b.width-c.width)/2)+", "+(b.height+m+5)+")"),N(f).attr("transform","translate( "+(c.width<b.width?0:-(b.width-c.width)/2)+", 0)"),c=i.node().getBBox(),i.attr("transform","translate("+-c.width/2+", "+(-c.height/2-m+3)+")"),l.attr("class","outer title-state").attr("x",-c.width/2-m).attr("y",-c.height/2-m).attr("width",c.width+t.padding).attr("height",c.height+t.padding),r.attr("class","divider").attr("x1",-c.width/2-m).attr("x2",c.width/2+m).attr("y1",-c.height/2-m+b.height+m).attr("y2",-c.height/2-m+b.height+m),$(t,l),t.intersect=function(L){return T.rect(t,L)},s},"rectWithTitle"),Ar=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.height+t.padding,r=s.width+l/4+t.padding,i=a.insert("rect",":first-child").attr("style",t.style).attr("rx",l/2).attr("ry",l/2).attr("x",-r/2).attr("y",-l/2).attr("width",r).attr("height",l);return $(t,i),t.intersect=function(n){return T.rect(t,n)},a},"stadium"),Mr=g(async(e,t)=>{let{shapeSvg:a,bbox:s,halfPadding:l}=await z(e,t,X(t,void 0),!0),r=a.insert("circle",":first-child");return r.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),k.info("Circle main"),$(t,r),t.intersect=function(i){return k.info("Circle intersect",t,s.width/2+l,i),T.circle(t,s.width/2+l,i)},a},"circle"),Pr=g(async(e,t)=>{let{shapeSvg:a,bbox:s,halfPadding:l}=await z(e,t,X(t,void 0),!0),r=5,i=a.insert("g",":first-child"),n=i.insert("circle"),o=i.insert("circle");return i.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l+r).attr("width",s.width+t.padding+r*2).attr("height",s.height+t.padding+r*2),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),k.info("DoubleCircle main"),$(t,n),t.intersect=function(f){return k.info("DoubleCircle intersect",t,s.width/2+l+r,f),T.circle(t,s.width/2+l+r,f)},a},"doublecircle"),Yr=g(async(e,t)=>{let{shapeSvg:a,bbox:s}=await z(e,t,X(t,void 0),!0),l=s.width+t.padding,r=s.height+t.padding,i=[{x:0,y:0},{x:l,y:0},{x:l,y:-r},{x:0,y:-r},{x:0,y:0},{x:-8,y:0},{x:l+8,y:0},{x:l+8,y:-r},{x:-8,y:-r},{x:-8,y:0}],n=H(a,l,r,i);return n.attr("style",t.style),$(t,n),t.intersect=function(o){return T.polygon(t,i,o)},a},"subroutine"),Wr=g((e,t)=>{let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),$(t,s),t.intersect=function(l){return T.circle(t,7,l)},a},"start"),Yt=g((e,t,a)=>{let s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),l=70,r=10;a==="LR"&&(l=10,r=70);let i=s.append("rect").attr("x",-1*l/2).attr("y",-1*r/2).attr("width",l).attr("height",r).attr("class","fork-join");return $(t,i),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return T.rect(t,n)},s},"forkJoin"),Xr=g((e,t)=>{let a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child"),l=a.insert("circle",":first-child");return l.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),s.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),$(t,l),t.intersect=function(r){return T.circle(t,7,r)},a},"end"),Fr=g(async(e,t)=>{let a=t.padding/2,s=4,l=8,r;t.classes?r="node "+t.classes:r="node default";let i=e.insert("g").attr("class",r).attr("id",t.domId||t.id),n=i.insert("rect",":first-child"),o=i.insert("line"),f=i.insert("line"),c=0,u=s,b=i.insert("g").attr("class","label"),y=0,m=t.classData.annotations?.[0],L=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",S=await U(b,L,t.labelStyle,!0,!0),v=S.getBBox();if(Y(C())){let h=S.children[0],_=N(S);v=h.getBoundingClientRect(),_.attr("width",v.width),_.attr("height",v.height)}t.classData.annotations[0]&&(u+=v.height+s,c+=v.width);let I=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(Y(C())?I+="&lt;"+t.classData.type+"&gt;":I+="<"+t.classData.type+">");let D=await U(b,I,t.labelStyle,!0,!0);N(D).attr("class","classTitle");let d=D.getBBox();if(Y(C())){let h=D.children[0],_=N(D);d=h.getBoundingClientRect(),_.attr("width",d.width),_.attr("height",d.height)}u+=d.height+s,d.width>c&&(c=d.width);let x=[];t.classData.members.forEach(async h=>{let _=h.getDisplayDetails(),p=_.displayText;Y(C())&&(p=p.replace(/</g,"&lt;").replace(/>/g,"&gt;"));let A=await U(b,p,_.cssStyle?_.cssStyle:t.labelStyle,!0,!0),O=A.getBBox();if(Y(C())){let q=A.children[0],Z=N(A);O=q.getBoundingClientRect(),Z.attr("width",O.width),Z.attr("height",O.height)}O.width>c&&(c=O.width),u+=O.height+s,x.push(A)}),u+=l;let w=[];if(t.classData.methods.forEach(async h=>{let _=h.getDisplayDetails(),p=_.displayText;Y(C())&&(p=p.replace(/</g,"&lt;").replace(/>/g,"&gt;"));let A=await U(b,p,_.cssStyle?_.cssStyle:t.labelStyle,!0,!0),O=A.getBBox();if(Y(C())){let q=A.children[0],Z=N(A);O=q.getBoundingClientRect(),Z.attr("width",O.width),Z.attr("height",O.height)}O.width>c&&(c=O.width),u+=O.height+s,w.push(A)}),u+=l,m){let h=(c-v.width)/2;N(S).attr("transform","translate( "+(-1*c/2+h)+", "+-1*u/2+")"),y=v.height+s}let E=(c-d.width)/2;return N(D).attr("transform","translate( "+(-1*c/2+E)+", "+(-1*u/2+y)+")"),y+=d.height+s,o.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-u/2-a+l+y).attr("y2",-u/2-a+l+y),y+=l,x.forEach(h=>{N(h).attr("transform","translate( "+-c/2+", "+(-1*u/2+y+l/2)+")");let _=h?.getBBox();y+=(_?.height??0)+s}),y+=l,f.attr("class","divider").attr("x1",-c/2-a).attr("x2",c/2+a).attr("y1",-u/2-a+l+y).attr("y2",-u/2-a+l+y),y+=l,w.forEach(h=>{N(h).attr("transform","translate( "+-c/2+", "+(-1*u/2+y)+")");let _=h?.getBBox();y+=(_?.height??0)+s}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-c/2-a).attr("y",-(u/2)-a).attr("width",c+t.padding).attr("height",u+t.padding),$(t,n),t.intersect=function(h){return T.rect(t,h)},i},"class_box"),Wt={rhombus:Pt,composite:Or,question:Pt,rect:Cr,labelRect:Rr,rectWithTitle:zr,choice:Sr,circle:Mr,doublecircle:Pr,stadium:Ar,hexagon:_r,block_arrow:Er,rect_left_inv_arrow:Dr,lean_right:vr,lean_left:Nr,trapezoid:Tr,inv_trapezoid:$r,rect_right_inv_arrow:Ir,cylinder:Br,start:Wr,end:Xr,note:Lr,subroutine:Yr,fork:Yt,join:Yt,class_box:Fr},nt={},te=g(async(e,t,a)=>{let s,l;if(t.link){let r;C().securityLevel==="sandbox"?r="_top":t.linkTarget&&(r=t.linkTarget||"_blank"),s=e.insert("svg:a").attr("xlink:href",t.link).attr("target",r),l=await Wt[t.shape](s,t,a)}else l=await Wt[t.shape](e,t,a),s=l;return t.tooltip&&l.attr("title",t.tooltip),t.class&&l.attr("class","node default "+t.class),nt[t.id]=s,t.haveCallback&&nt[t.id].attr("class",nt[t.id].attr("class")+" clickable"),s},"insertNode"),Ur=g(e=>{let t=nt[e.id];k.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");let a=8,s=e.diff||0;return e.clusterNode?t.attr("transform","translate("+(e.x+s-e.width/2)+", "+(e.y-e.height/2-a)+")"):t.attr("transform","translate("+e.x+", "+e.y+")"),s},"positionNode");function vt(e,t,a=!1){let s=e,l="default";(s?.classes?.length||0)>0&&(l=(s?.classes??[]).join(" ")),l=l+" flowchart-label";let r=0,i="",n;switch(s.type){case"round":r=5,i="rect";break;case"composite":r=0,i="composite",n=0;break;case"square":i="rect";break;case"diamond":i="question";break;case"hexagon":i="hexagon";break;case"block_arrow":i="block_arrow";break;case"odd":i="rect_left_inv_arrow";break;case"lean_right":i="lean_right";break;case"lean_left":i="lean_left";break;case"trapezoid":i="trapezoid";break;case"inv_trapezoid":i="inv_trapezoid";break;case"rect_left_inv_arrow":i="rect_left_inv_arrow";break;case"circle":i="circle";break;case"ellipse":i="ellipse";break;case"stadium":i="stadium";break;case"subroutine":i="subroutine";break;case"cylinder":i="cylinder";break;case"group":i="rect";break;case"doublecircle":i="doublecircle";break;default:i="rect"}let o=Le(s?.styles??[]),f=s.label,c=s.size??{width:0,height:0,x:0,y:0};return{labelStyle:o.labelStyle,shape:i,labelText:f,rx:r,ry:r,class:l,style:o.style,id:s.id,directions:s.directions,width:c.width,height:c.height,x:c.x,y:c.y,positioned:a,intersect:void 0,type:s.type,padding:n??at()?.block?.padding??0}}g(vt,"getNodeFromBlock");async function ee(e,t,a){let s=vt(t,a,!1);if(s.type==="group")return;let l=at(),r=await te(e,s,{config:l}),i=r.node().getBBox(),n=a.getBlock(s.id);n.size={width:i.width,height:i.height,x:0,y:0,node:r},a.setBlock(n),r.remove()}g(ee,"calculateBlockSize");async function re(e,t,a){let s=vt(t,a,!0);if(a.getBlock(s.id).type!=="space"){let l=at();await te(e,s,{config:l}),t.intersect=s?.intersect,Ur(s)}}g(re,"insertBlockPositioned");async function ht(e,t,a,s){for(let l of t)await s(e,l,a),l.children&&await ht(e,l.children,a,s)}g(ht,"performOperations");async function ae(e,t,a){await ht(e,t,a,ee)}g(ae,"calculateBlockSizes");async function ie(e,t,a){await ht(e,t,a,re)}g(ie,"insertBlocks");async function se(e,t,a,s,l){let r=new ce({multigraph:!0,compound:!0});r.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let i of a)i.size&&r.setNode(i.id,{width:i.size.width,height:i.size.height,intersect:i.intersect});for(let i of t)if(i.start&&i.end){let n=s.getBlock(i.start),o=s.getBlock(i.end);if(n?.size&&o?.size){let f=n.size,c=o.size,u=[{x:f.x,y:f.y},{x:f.x+(c.x-f.x)/2,y:f.y+(c.y-f.y)/2},{x:c.x,y:c.y}];gr(e,{v:i.start,w:i.end,name:i.id},{...i,arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:u,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",r,l),i.label&&(await or(e,{...i,label:i.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:i.arrowTypeEnd,arrowTypeStart:i.arrowTypeStart,points:u,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),cr({...i,x:u[1].x,y:u[1].y},{originalPath:u}))}}}g(se,"insertEdges");var Kr=g(function(e,t){return t.db.getClasses()},"getClasses"),Hr=g(async function(e,t,a,s){let{securityLevel:l,block:r}=at(),i=s.db,n;l==="sandbox"&&(n=N("#i"+t));let o=l==="sandbox"?N(n.nodes()[0].contentDocument.body):N("body"),f=l==="sandbox"?o.select(`[id="${t}"]`):N(`[id="${t}"]`);ar(f,["point","circle","cross"],s.type,t);let c=i.getBlocks(),u=i.getBlocksFlat(),b=i.getEdges(),y=f.insert("g").attr("class","block");await ae(y,c,i);let m=Zt(i);if(await ie(y,c,i),await se(y,b,u,i,t),m){let L=m,S=Math.max(1,Math.round(.125*(L.width/L.height))),v=L.height+S+10,I=L.width+10,{useMaxWidth:D}=r;de(f,v,I,!!D),k.debug("Here Bounds",m,L),f.attr("viewBox",`${L.x-5} ${L.y-5} ${L.width+10} ${L.height+10}`)}},"draw"),Zr={draw:Hr,getClasses:Kr},ta={parser:_e,db:Fe,renderer:Zr,styles:Ke};export{ta as diagram};