blockDiagram-GPEHLZMM-Bs4JwEUX.js 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import{g as Ee}from"./chunk-FMBD7UC4-DHs-G9op.js";import{ex as _e,dG as Xt,eD as Te,a$ as Vt,cA as Zt,bN as Gt,fj as jt,gj as wt,cC as qt,fN as Jt,gp as Qt,eZ as $t,g8 as te,aZ as ee,gI as De,gH as Ne,gK as Ie,gJ as Be,fk as Ce,e9 as Oe,e8 as Re,ea as Ae,d7 as ze,d6 as Me,b8 as Pe,aa as d,dm as at,g0 as D,cb as Fe,eV as k,bZ as We,fZ as Ye,dy as He,eO as Ke,cx as Ue,dn as A,dK as Xe,dt as P,cu as Et,c8 as $,dE as Ve,gX as tt,c4 as Ze,dD as Ge,f$ as Rt,cI as At,ca as je}from"./builder-DygomDiV.js";import{G as qe}from"./graph-jgSlyQdO.js";import{c as Je}from"./channel-CeYxnof1.js";import"./reduce-AUdM8MX2.js";function Qe(e){return Array.isArray(e)}function $e(e){if(_e(e))return e;const t=Xt(e);if(!tr(e))return{};if(Qe(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(Te(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t===Vt)return new ArrayBuffer(e.byteLength);if(t===Zt){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t===Gt||t===jt||t===wt){const s=e.constructor,i=new s(e.valueOf());return t===wt?rr(i,e):yt(i,e),i}if(t===qt)return new Date(Number(e));if(t===Jt){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t===Qt)return Object(Symbol.prototype.valueOf.call(e));if(t===$t){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t===te){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t===ee){const s=e,i={};return yt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return ar(a,e),yt(a,e),er(a,e),a}function tr(e){switch(Xt(e)){case ee:case Pe:case Vt:case Zt:case Gt:case qt:case Me:case ze:case Ae:case Re:case Oe:case $t:case jt:case Ce:case Jt:case te:case wt:case Qt:case Be:case Ie:case Ne:case De:return!0;default:return!1}}function yt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function er(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s<a.length;s++){const i=a[s];Object.prototype.propertyIsEnumerable.call(t,i)&&(e[i]=t[i])}}function rr(e,t){const a=t.valueOf().length;for(const s in t)Object.hasOwn(t,s)&&(Number.isNaN(Number(s))||Number(s)>=a)&&(e[s]=t[s])}function ar(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var mt=(function(){var e=d(function(T,m,u,y){for(u=u||{},y=T.length;y--;u[T[y]]=m);return u},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],g=[8,30],o=[8,10,21,28,29,30,31,39,43,46],p=[1,23],b=[1,24],x=[8,10,15,16,21,28,29,30,31,39,43,46],w=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],S={trace:d(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:d(function(m,u,y,L,E,h,W){var f=h.length-1;switch(E){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",h[f-1]),L.setHierarchy(h[f-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",h[f]),typeof h[f].length=="number"?this.$=h[f]:this.$=[h[f]];break;case 13:L.getLogger().debug("Rule: statement #2: ",h[f-1]),this.$=[h[f-1]].concat(h[f]);break;case 14:L.getLogger().debug("Rule: link: ",h[f],m),this.$={edgeTypeStr:h[f],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",h[f-3],h[f-1],h[f]),this.$={edgeTypeStr:h[f],label:h[f-1]};break;case 18:const O=parseInt(h[f]),q=L.generateId();this.$={id:q,type:"space",label:"",width:O,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",h[f-2],h[f-1],h[f]," typestr: ",h[f-1].edgeTypeStr);const Z=L.edgeStrToEdgeData(h[f-1].edgeTypeStr),st=L.edgeStrToEdgeStartData(h[f-1].edgeTypeStr),dt=L.edgeStrToThickness(h[f-1].edgeTypeStr),R=L.edgeStrToPattern(h[f-1].edgeTypeStr);this.$=[{id:h[f-2].id,label:h[f-2].label,type:h[f-2].type,directions:h[f-2].directions},{id:h[f-2].id+"-"+h[f].id,start:h[f-2].id,end:h[f].id,label:h[f-1].label,type:"edge",thickness:dt,pattern:R,directions:h[f].directions,arrowTypeEnd:Z,arrowTypeStart:st},{id:h[f].id,label:h[f].label,type:L.typeStr2Type(h[f].typeStr),directions:h[f].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",h[f-1],h[f]),this.$={id:h[f-1].id,label:h[f-1].label,type:L.typeStr2Type(h[f-1].typeStr),directions:h[f-1].directions,widthInColumns:parseInt(h[f],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",h[f]),this.$={id:h[f].id,label:h[f].label,type:L.typeStr2Type(h[f].typeStr),directions:h[f].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",h[f]),this.$={type:"column-setting",columns:h[f]==="auto"?-1:parseInt(h[f])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",h[f-2],h[f-1]),L.generateId(),this.$={...h[f-2],type:"composite",children:h[f-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",h[f-2],h[f-1],h[f]);const G=L.generateId();this.$={id:G,type:"composite",label:"",children:h[f-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",h[f]),this.$={id:h[f]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",h[f-1],h[f]),this.$={id:h[f-1],label:h[f].label,typeStr:h[f].typeStr,directions:h[f].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",h[f]),this.$=[h[f]];break;case 32:L.getLogger().debug("Rule: dirList: ",h[f-1],h[f]),this.$=[h[f-1]].concat(h[f]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",h[f-2],h[f-1],h[f]),this.$={typeStr:h[f-2]+h[f],label:h[f-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",h[f-3],h[f-2]," #3:",h[f-1],h[f]),this.$={typeStr:h[f-3]+h[f],label:h[f-2],directions:h[f-1]};break;case 35:case 36:this.$={type:"classDef",id:h[f-1].trim(),css:h[f].trim()};break;case 37:this.$={type:"applyClass",id:h[f-1].trim(),styleClass:h[f].trim()};break;case 38:this.$={type:"applyStyles",id:h[f-1].trim(),stylesStr:h[f].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:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(g,[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:i,31:c,39:r,43:n,46:l}),e(o,[2,16],{14:22,15:p,16:b}),e(o,[2,17]),e(o,[2,18]),e(o,[2,19]),e(o,[2,20]),e(o,[2,21]),e(o,[2,22]),e(x,[2,25],{27:[1,25]}),e(o,[2,26]),{19:26,26:12,31:c},{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:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(w,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(g,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(x,[2,24]),{10:t,11:37,13:4,14:22,15:p,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(w,[2,30]),{18:[1,43]},{18:[1,44]},e(x,[2,23]),{18:[1,45]},{30:[1,46]},e(o,[2,28]),e(o,[2,35]),e(o,[2,36]),e(o,[2,37]),e(o,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(o,[2,27]),e(w,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(w,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:d(function(m,u){if(u.recoverable)this.trace(m);else{var y=new Error(m);throw y.hash=u,y}},"parseError"),parse:d(function(m){var u=this,y=[0],L=[],E=[null],h=[],W=this.table,f="",O=0,q=0,Z=2,st=1,dt=h.slice.call(arguments,1),R=Object.create(this.lexer),G={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(G.yy[ut]=this.yy[ut]);R.setInput(m,G.yy),G.yy.lexer=R,G.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var pt=R.yylloc;h.push(pt);var ke=R.options&&R.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ve(Y){y.length=y.length-2*Y,E.length=E.length-Y,h.length=h.length-Y}d(ve,"popStack");function Ct(){var Y;return Y=L.pop()||R.lex()||st,typeof Y!="number"&&(Y instanceof Array&&(L=Y,Y=L.pop()),Y=u.symbols_[Y]||Y),Y}d(Ct,"lex");for(var F,J,K,ft,Q={},it,j,Ot,nt;;){if(J=y[y.length-1],this.defaultActions[J]?K=this.defaultActions[J]:((F===null||typeof F>"u")&&(F=Ct()),K=W[J]&&W[J][F]),typeof K>"u"||!K.length||!K[0]){var xt="";nt=[];for(it in W[J])this.terminals_[it]&&it>Z&&nt.push("'"+this.terminals_[it]+"'");R.showPosition?xt="Parse error on line "+(O+1)+`:
  2. `+R.showPosition()+`
  3. Expecting `+nt.join(", ")+", got '"+(this.terminals_[F]||F)+"'":xt="Parse error on line "+(O+1)+": Unexpected "+(F==st?"end of input":"'"+(this.terminals_[F]||F)+"'"),this.parseError(xt,{text:R.match,token:this.terminals_[F]||F,line:R.yylineno,loc:pt,expected:nt})}if(K[0]instanceof Array&&K.length>1)throw new Error("Parse Error: multiple actions possible at state: "+J+", token: "+F);switch(K[0]){case 1:y.push(F),E.push(R.yytext),h.push(R.yylloc),y.push(K[1]),F=null,q=R.yyleng,f=R.yytext,O=R.yylineno,pt=R.yylloc;break;case 2:if(j=this.productions_[K[1]][1],Q.$=E[E.length-j],Q._$={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},ke&&(Q._$.range=[h[h.length-(j||1)].range[0],h[h.length-1].range[1]]),ft=this.performAction.apply(Q,[f,q,O,G.yy,K[1],E,h].concat(dt)),typeof ft<"u")return ft;j&&(y=y.slice(0,-1*j*2),E=E.slice(0,-1*j),h=h.slice(0,-1*j)),y.push(this.productions_[K[1]][0]),E.push(Q.$),h.push(Q._$),Ot=W[y[y.length-2]][y[y.length-1]],y.push(Ot);break;case 3:return!0}}return!0},"parse")},_=(function(){var T={EOF:1,parseError:d(function(u,y){if(this.yy.parser)this.yy.parser.parseError(u,y);else throw new Error(u)},"parseError"),setInput:d(function(m,u){return this.yy=u||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var u=m.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:d(function(m){var u=m.length,y=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var L=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),y.length-1&&(this.yylineno-=y.length-1);var E=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:y?(y.length===L.length?this.yylloc.first_column:0)+L[L.length-y.length].length-y[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(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).
  4. `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(m){this.unput(this.match.slice(m))},"less"),pastInput:d(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var m=this.pastInput(),u=new Array(m.length+1).join("-");return m+this.upcomingInput()+`
  5. `+u+"^"},"showPosition"),test_match:d(function(m,u){var y,L,E;if(this.options.backtrack_lexer&&(E={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&&(E.yylloc.range=this.yylloc.range.slice(0))),L=m[0].match(/(?:\r\n?|\n).*/g),L&&(this.yylineno+=L.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:L?L[L.length-1].length-L[L.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(m[0].length),this.matched+=m[0],y=this.performAction.call(this,this.yy,this,u,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var h in E)this[h]=E[h];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,u,y,L;this._more||(this.yytext="",this.match="");for(var E=this._currentRules(),h=0;h<E.length;h++)if(y=this._input.match(this.rules[E[h]]),y&&(!u||y[0].length>u[0].length)){if(u=y,L=h,this.options.backtrack_lexer){if(m=this.test_match(y,E[h]),m!==!1)return m;if(this._backtrack){u=!1;continue}else return!1}else if(!this.options.flex)break}return u?(m=this.test_match(u,E[L]),m!==!1?m:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
  6. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var u=this.next();return u||this.lex()},"lex"),begin:d(function(u){this.conditionStack.push(u)},"begin"),popState:d(function(){var u=this.conditionStack.length-1;return u>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(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:d(function(u){return u=this.conditionStack.length-1-Math.abs(u||0),u>=0?this.conditionStack[u]:"INITIAL"},"topState"),pushState:d(function(u){this.begin(u)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:d(function(u,y,L,E){switch(L){case 0:return u.getLogger().debug("Found block-beta"),10;case 1:return u.getLogger().debug("Found id-block"),29;case 2:return u.getLogger().debug("Found block"),10;case 3:u.getLogger().debug(".",y.yytext);break;case 4:u.getLogger().debug("_",y.yytext);break;case 5:return 5;case 6:return y.yytext=-1,28;case 7:return y.yytext=y.yytext.replace(/columns\s+/,""),u.getLogger().debug("COLUMNS (LEX)",y.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:u.getLogger().debug("LEX: POPPING STR:",y.yytext),this.popState();break;case 13:return u.getLogger().debug("LEX: STR end:",y.yytext),"STR";case 14:return y.yytext=y.yytext.replace(/space\:/,""),u.getLogger().debug("SPACE NUM (LEX)",y.yytext),21;case 15:return y.yytext="1",u.getLogger().debug("COLUMNS (LEX)",y.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(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 38:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),u.getLogger().debug("Lex: ))"),"NODE_DEND";case 40:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 41:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 42:return this.popState(),u.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),u.getLogger().debug("Lex: -)"),"NODE_DEND";case 44:return this.popState(),u.getLogger().debug("Lex: (("),"NODE_DEND";case 45:return this.popState(),u.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),u.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),u.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 49:return this.popState(),u.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),u.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),u.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),u.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),u.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return u.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return u.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return u.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return u.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 59:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 60:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 61:return u.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 62:return u.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return u.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 64:return u.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 u.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),u.getLogger().debug("LEX ARR START"),37;case 74:return u.getLogger().debug("Lex: NODE_ID",y.yytext),31;case 75:return u.getLogger().debug("Lex: EOF",y.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:u.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:u.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return u.getLogger().debug("LEX: NODE_DESCR:",y.yytext),"NODE_DESCR";case 83:u.getLogger().debug("LEX POPPING"),this.popState();break;case 84:u.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (right): dir:",y.yytext),"DIR";case 86:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (left):",y.yytext),"DIR";case 87:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (x):",y.yytext),"DIR";case 88:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (y):",y.yytext),"DIR";case 89:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (up):",y.yytext),"DIR";case 90:return y.yytext=y.yytext.replace(/^,\s*/,""),u.getLogger().debug("Lex (down):",y.yytext),"DIR";case 91:return y.yytext="]>",u.getLogger().debug("Lex (ARROW_DIR end):",y.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return u.getLogger().debug("Lex: LINK","#"+y.yytext+"#"),15;case 93:return u.getLogger().debug("Lex: LINK",y.yytext),15;case 94:return u.getLogger().debug("Lex: LINK",y.yytext),15;case 95:return u.getLogger().debug("Lex: LINK",y.yytext),15;case 96:return u.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 97:return u.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 98:return u.getLogger().debug("Lex: START_LINK",y.yytext),this.pushState("LLABEL"),16;case 99:this.pushState("md_string");break;case 100:return u.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),u.getLogger().debug("Lex: LINK","#"+y.yytext+"#"),15;case 102:return this.popState(),u.getLogger().debug("Lex: LINK",y.yytext),15;case 103:return this.popState(),u.getLogger().debug("Lex: LINK",y.yytext),15;case 104:return u.getLogger().debug("Lex: COLON",y.yytext),y.yytext=y.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 T})();S.lexer=_;function B(){this.yy={}}return d(B,"Parser"),B.prototype=S,S.Parser=B,new B})();mt.parser=mt;var sr=mt,X=new Map,_t=[],St=new Map,zt="color",Mt="fill",ir="bgFill",re=",",nr=A(),lt=new Map,Tt="",cr=d(e=>Ze.sanitizeText(e,nr),"sanitizeText"),lr=d(function(e,t=""){let a=lt.get(e);a||(a={id:e,styles:[],textStyles:[]},lt.set(e,a)),t?.split(re).forEach(s=>{const i=s.replace(/([^;]*);/,"$1").trim();if(RegExp(zt).exec(s)){const r=i.replace(Mt,ir).replace(zt,Mt);a.textStyles.push(r)}a.styles.push(i)})},"addStyleClass"),or=d(function(e,t=""){const a=X.get(e);t!=null&&(a.styles=t.split(re))},"addStyle2Node"),hr=d(function(e,t){e.split(",").forEach(function(a){let s=X.get(a);if(s===void 0){const i=a.trim();s={id:i,type:"na",children:[]},X.set(i,s)}s.classes||(s.classes=[]),s.classes.push(t)})},"setCssClass"),ae=d((e,t)=>{const a=e.flat(),s=[],c=a.find(r=>r?.type==="column-setting")?.columns??-1;for(const r of a){if(typeof c=="number"&&c>0&&r.type!=="column-setting"&&typeof r.widthInColumns=="number"&&r.widthInColumns>c&&k.warn(`Block ${r.id} width ${r.widthInColumns} exceeds configured column width ${c}`),r.label&&(r.label=cr(r.label)),r.type==="classDef"){lr(r.id,r.css);continue}if(r.type==="applyClass"){hr(r.id,r?.styleClass??"");continue}if(r.type==="applyStyles"){r?.stylesStr&&or(r.id,r?.stylesStr);continue}if(r.type==="column-setting")t.columns=r.columns??-1;else if(r.type==="edge"){const n=(St.get(r.id)??0)+1;St.set(r.id,n),r.id=n+"-"+r.id,_t.push(r)}else{r.label||(r.type==="composite"?r.label="":r.label=r.id);const n=X.get(r.id);if(n===void 0?X.set(r.id,r):(r.type!=="na"&&(n.type=r.type),r.label!==r.id&&(n.label=r.label)),r.children&&ae(r.children,r),r.type==="space"){const l=r.width??1;for(let g=0;g<l;g++){const o=$e(r);o.id=o.id+"-"+g,X.set(o.id,o),s.push(o)}}else n===void 0&&s.push(r)}}t.children=s},"populateBlockDatabase"),Dt=[],rt={id:"root",type:"composite",children:[],columns:-1},gr=d(()=>{k.debug("Clear called"),We(),rt={id:"root",type:"composite",children:[],columns:-1},X=new Map([["root",rt]]),Dt=[],lt=new Map,_t=[],St=new Map,Tt=""},"clear");function se(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"}}d(se,"typeStr2Type");function ie(e){switch(k.debug("typeStr2Type",e),e){case"==":return"thick";default:return"normal"}}d(ie,"edgeTypeStr2Type");function ne(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}d(ne,"edgeStrToEdgeData");function ce(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}d(ce,"edgeStrToEdgeStartData");function le(e){return e.includes("==")?"thick":"normal"}d(le,"edgeStrToThickness");function oe(e){return e.includes(".-")?"dotted":"solid"}d(oe,"edgeStrToPattern");var Pt=0,dr=d(()=>(Pt++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Pt),"generateId"),ur=d(e=>{rt.children=e,ae(e,rt),Dt=rt.children},"setHierarchy"),pr=d(e=>{const t=X.get(e);return t?t.columns?t.columns:t.children?t.children.length:-1:-1},"getColumns"),fr=d(()=>[...X.values()],"getBlocksFlat"),xr=d(()=>Dt||[],"getBlocks"),yr=d(()=>_t,"getEdges"),br=d(e=>X.get(e),"getBlock"),wr=d(e=>{X.set(e.id,e)},"setBlock"),mr=d(e=>{Tt=e},"setDiagramId"),Sr=d(()=>Tt,"getDiagramId"),Lr=d(()=>k,"getLogger"),kr=d(function(){return lt},"getClasses"),vr={getConfig:d(()=>at().block,"getConfig"),typeStr2Type:se,edgeTypeStr2Type:ie,edgeStrToEdgeData:ne,edgeStrToEdgeStartData:ce,edgeStrToThickness:le,edgeStrToPattern:oe,getLogger:Lr,getBlocksFlat:fr,getBlocks:xr,getEdges:yr,setHierarchy:ur,getBlock:br,setBlock:wr,getColumns:pr,getClasses:kr,clear:gr,generateId:dr,setDiagramId:mr,getDiagramId:Sr},Er=vr,bt=d((e,t)=>{const a=Je,s=a(e,"r"),i=a(e,"g"),c=a(e,"b");return Ye(s,i,c,t)},"fade"),_r=d(e=>`.label {
  7. font-family: ${e.fontFamily};
  8. color: ${e.nodeTextColor||e.textColor};
  9. }
  10. .cluster-label text {
  11. fill: ${e.titleColor};
  12. }
  13. .cluster-label span,p {
  14. color: ${e.titleColor};
  15. }
  16. .label text,span,p {
  17. fill: ${e.nodeTextColor||e.textColor};
  18. color: ${e.nodeTextColor||e.textColor};
  19. }
  20. .node rect,
  21. .node circle,
  22. .node ellipse,
  23. .node polygon,
  24. .node path {
  25. fill: ${e.mainBkg};
  26. stroke: ${e.nodeBorder};
  27. stroke-width: 1px;
  28. }
  29. .flowchart-label text {
  30. text-anchor: middle;
  31. }
  32. // .flowchart-label .text-outer-tspan {
  33. // text-anchor: middle;
  34. // }
  35. // .flowchart-label .text-inner-tspan {
  36. // text-anchor: start;
  37. // }
  38. .node .label {
  39. text-align: center;
  40. }
  41. .node.clickable {
  42. cursor: pointer;
  43. }
  44. .arrowheadPath {
  45. fill: ${e.arrowheadColor};
  46. }
  47. .edgePath .path {
  48. stroke: ${e.lineColor};
  49. stroke-width: 2.0px;
  50. }
  51. .flowchart-link {
  52. stroke: ${e.lineColor};
  53. fill: none;
  54. }
  55. .edgeLabel {
  56. background-color: ${e.edgeLabelBackground};
  57. /*
  58. * This is for backward compatibility with existing code that didn't
  59. * add a \`<p>\` around edge labels.
  60. *
  61. * TODO: We should probably remove this in a future release.
  62. */
  63. p {
  64. margin: 0;
  65. padding: 0;
  66. display: inline;
  67. }
  68. rect {
  69. opacity: 0.5;
  70. background-color: ${e.edgeLabelBackground};
  71. fill: ${e.edgeLabelBackground};
  72. }
  73. text-align: center;
  74. }
  75. /* For html labels only */
  76. .labelBkg {
  77. background-color: ${e.edgeLabelBackground};
  78. }
  79. .node .cluster {
  80. // fill: ${bt(e.mainBkg,.5)};
  81. fill: ${bt(e.clusterBkg,.5)};
  82. stroke: ${bt(e.clusterBorder,.2)};
  83. box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
  84. stroke-width: 1px;
  85. }
  86. .cluster text {
  87. fill: ${e.titleColor};
  88. }
  89. .cluster span,p {
  90. color: ${e.titleColor};
  91. }
  92. /* .cluster div {
  93. color: ${e.titleColor};
  94. } */
  95. div.mermaidTooltip {
  96. position: absolute;
  97. text-align: center;
  98. max-width: 200px;
  99. padding: 2px;
  100. font-family: ${e.fontFamily};
  101. font-size: 12px;
  102. background: ${e.tertiaryColor};
  103. border: 1px solid ${e.border2};
  104. border-radius: 2px;
  105. pointer-events: none;
  106. z-index: 100;
  107. }
  108. .flowchartTitleText {
  109. text-anchor: middle;
  110. font-size: 18px;
  111. fill: ${e.textColor};
  112. }
  113. ${Ee()}
  114. `,"getStyles"),Tr=_r,Dr=d((e,t,a,s)=>{t.forEach(i=>{Pr[i](e,a,s)})},"insertMarkers"),Nr=d((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"),Ir=d((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"),Br=d((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"),Cr=d((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"),Or=d((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"),Rr=d((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"),Ar=d((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"),zr=d((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"),Mr=d((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"),Pr={extension:Nr,composition:Ir,aggregation:Br,dependency:Cr,lollipop:Or,point:Rr,circle:Ar,cross:zr,barb:Mr},Fr=Dr,C=A()?.block?.padding??8;function Lt(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};const a=t%e,s=Math.floor(t/e);return{px:a,py:s}}d(Lt,"calculateBlockPosition");var Wr=d(e=>{let t=0,a=0;for(const s of e.children){const{width:i,height:c,x:r,y:n}=s.size??{width:0,height:0,x:0,y:0};if(k.debug("getMaxChildSize abc95 child:",s.id,"width:",i,"height:",c,"x:",r,"y:",n,s.type),s.type==="space")continue;const l=i/(s.widthInColumns??1);l>t&&(t=l),c>a&&(a=c)}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 i=0,c=0;if(e.children?.length>0){for(const x of e.children)ot(x,t);const r=Wr(e);i=r.width,c=r.height,k.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",i,c);for(const x of e.children)x.size&&(k.debug(`abc95 Setting size of children of ${e.id} id=${x.id} ${i} ${c} ${JSON.stringify(x.size)}`),x.size.width=i*(x.widthInColumns??1)+C*((x.widthInColumns??1)-1),x.size.height=c,x.size.x=0,x.size.y=0,k.debug(`abc95 updating size of ${e.id} children child:${x.id} maxWidth:${i} maxHeight:${c}`));for(const x of e.children)ot(x,t,i,c);const n=e.columns??-1;let l=0;for(const x of e.children)l+=x.widthInColumns??1;let g=e.children.length;n>0&&n<l&&(g=n);const o=Math.ceil(l/g);let p=g*(i+C)+C,b=o*(c+C)+C;if(p<a){k.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${a} siblingHeight ${s} width ${p}`),p=a,b=s;const x=(a-g*C-C)/g,w=(s-o*C-C)/o;k.debug("Size indata abc88",e.id,"childWidth",x,"maxWidth",i),k.debug("Size indata abc88",e.id,"childHeight",w,"maxHeight",c),k.debug("Size indata abc88 xSize",g,"padding",C);for(const v of e.children)v.size&&(v.size.width=x,v.size.height=w,v.size.x=0,v.size.y=0)}if(k.debug(`abc95 (finale calc) ${e.id} xSize ${g} ySize ${o} columns ${n}${e.children.length} width=${Math.max(p,e.size?.width||0)}`),p<(e?.size?.width||0)){p=e?.size?.width||0;const x=n>0?Math.min(e.children.length,n):e.children.length;if(x>0){const w=(p-x*C-C)/x;k.debug("abc95 (growing to fit) width",e.id,p,e.size?.width,w);for(const v of e.children)v.size&&(v.size.width=w)}}e.size={width:p,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)}d(ot,"setBlockSizes");function Nt(e,t){k.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);const a=e.columns??-1;if(k.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){const s=e?.children[0]?.size?.width??0,i=e.children.length*s+(e.children.length-1)*C;k.debug("widthOfChildren 88",i,"posX");const c=new Map;{let o=0;for(const p of e.children){if(!p.size)continue;const{py:b}=Lt(a,o),x=c.get(b)??0;p.size.height>x&&c.set(b,p.size.height);let w=p?.widthInColumns??1;a>0&&(w=Math.min(w,a-o%a)),o+=w}}const r=new Map;{let o=0;const p=[...c.keys()].sort((b,x)=>b-x);for(const b of p)r.set(b,o),o+=(c.get(b)??0)+C}let n=0;k.debug("abc91 block?.size?.x",e.id,e?.size?.x);let l=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,g=0;for(const o of e.children){const p=e;if(!o.size)continue;const{width:b,height:x}=o.size,{px:w,py:v}=Lt(a,n);if(v!=g&&(g=v,l=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-C,k.debug("New row in layout for block",e.id," and child ",o.id,g)),k.debug(`abc89 layout blocks (child) id: ${o.id} Pos: ${n} (px, py) ${w},${v} (${p?.size?.x},${p?.size?.y}) parent: ${p.id} width: ${b}${C}`),p.size){const _=b/2;o.size.x=l+C+_,k.debug(`abc91 layout blocks (calc) px, pyid:${o.id} startingPos=X${l} new startingPosX${o.size.x} ${_} padding=${C} width=${b} halfWidth=${_} => x:${o.size.x} y:${o.size.y} ${o.widthInColumns} (width * (child?.w || 1)) / 2 ${b*(o?.widthInColumns??1)/2}`),l=o.size.x+_;const B=r.get(v)??0,T=c.get(v)??x;o.size.y=p.size.y-p.size.height/2+B+T/2+C,k.debug(`abc88 layout blocks (calc) px, pyid:${o.id}startingPosX${l}${C}${_}=>x:${o.size.x}y:${o.size.y}${o.widthInColumns}(width * (child?.w || 1)) / 2${b*(o?.widthInColumns??1)/2}`)}o.children&&Nt(o);let S=o?.widthInColumns??1;a>0&&(S=Math.min(S,a-n%a)),n+=S,k.debug("abc88 columnsPos",o,n)}}k.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}d(Nt,"layoutBlocks");function It(e,{minX:t,minY:a,maxX:s,maxY:i}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){const{x:c,y:r,width:n,height:l}=e.size;c-n/2<t&&(t=c-n/2),r-l/2<a&&(a=r-l/2),c+n/2>s&&(s=c+n/2),r+l/2>i&&(i=r+l/2)}if(e.children)for(const c of e.children)({minX:t,minY:a,maxX:s,maxY:i}=It(c,{minX:t,minY:a,maxX:s,maxY:i}));return{minX:t,minY:a,maxX:s,maxY:i}}d(It,"findBounds");function he(e){const t=e.getBlock("root");if(!t)return;ot(t,e,0,0),Nt(t),k.debug("getBlocks",JSON.stringify(t,null,2));const{minX:a,minY:s,maxX:i,maxY:c}=It(t),r=c-s,n=i-a;return{x:a,y:s,width:n,height:r}}d(he,"layout");var Yr=d(async(e,t,a,s=!1,i=!1)=>{let c=t||"";typeof c=="object"&&(c=c[0]);const r=A(),n=P(r);return await Et(e,c,{style:a,isTitle:s,useHtmlLabels:n,markdown:!1,isNode:i,width:Number.POSITIVE_INFINITY},r)},"createLabel"),U=Yr,Hr=d((e,t,a,s,i)=>{t.arrowTypeStart&&Ft(e,"start",t.arrowTypeStart,a,s,i),t.arrowTypeEnd&&Ft(e,"end",t.arrowTypeEnd,a,s,i)},"addEdgeMarkers"),Kr={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},Ft=d((e,t,a,s,i,c)=>{const r=Kr[a];if(!r){k.warn(`Unknown arrow type: ${a}`);return}const n=t==="start"?"Start":"End";e.attr(`marker-${t}`,`url(${s}#${i}_${c}-${r}${n})`)},"addEdgeMarker"),kt={},M={},Ur=d(async(e,t)=>{const a=A(),s=P(a),i=e.insert("g").attr("class","edgeLabel"),c=i.insert("g").attr("class","label"),r=t.labelType==="markdown",n=await Et(e,t.label,{style:t.labelStyle,useHtmlLabels:s,addSvgBackground:r,isNode:!1,markdown:r,width:r?void 0:Number.POSITIVE_INFINITY},a);c.node().appendChild(n);let l=n.getBBox(),g=l;if(s){const p=n.children[0],b=D(n);l=p.getBoundingClientRect(),g=l,b.attr("width",l.width),b.attr("height",l.height)}else{const p=D(n).select("text").node();p&&typeof p.getBBox=="function"&&(g=p.getBBox())}c.attr("transform",$(g,s)),kt[t.id]=i,t.width=l.width,t.height=l.height;let o;if(t.startLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),b=p.insert("g").attr("class","inner"),x=await U(b,t.startLabelLeft,t.labelStyle);o=x;let w=x.getBBox();if(s){const v=x.children[0],S=D(x);w=v.getBoundingClientRect(),S.attr("width",w.width),S.attr("height",w.height)}b.attr("transform",$(w,s)),M[t.id]||(M[t.id]={}),M[t.id].startLeft=p,et(o,t.startLabelLeft)}if(t.startLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),b=p.insert("g").attr("class","inner"),x=await U(b,t.startLabelRight,t.labelStyle);o=x;let w=x.getBBox();if(s){const v=x.children[0],S=D(x);w=v.getBoundingClientRect(),S.attr("width",w.width),S.attr("height",w.height)}b.attr("transform",$(w,s)),M[t.id]||(M[t.id]={}),M[t.id].startRight=p,et(o,t.startLabelRight)}if(t.endLabelLeft){const p=e.insert("g").attr("class","edgeTerminals"),b=p.insert("g").attr("class","inner"),x=await U(p,t.endLabelLeft,t.labelStyle);o=x;let w=x.getBBox();if(s){const v=x.children[0],S=D(x);w=v.getBoundingClientRect(),S.attr("width",w.width),S.attr("height",w.height)}b.attr("transform",$(w,s)),M[t.id]||(M[t.id]={}),M[t.id].endLeft=p,et(o,t.endLabelLeft)}if(t.endLabelRight){const p=e.insert("g").attr("class","edgeTerminals"),b=p.insert("g").attr("class","inner"),x=await U(p,t.endLabelRight,t.labelStyle);o=x;let w=x.getBBox();if(s){const v=x.children[0],S=D(x);w=v.getBoundingClientRect(),S.attr("width",w.width),S.attr("height",w.height)}b.attr("transform",$(w,s)),M[t.id]||(M[t.id]={}),M[t.id].endRight=p,et(o,t.endLabelRight)}return n},"insertEdgeLabel");function et(e,t){P(A())&&e&&(e.style.width=t.length*9+"px",e.style.height="12px")}d(et,"setTerminalWidth");var Xr=d((e,t)=>{k.debug("Moving label abc88 ",e.id,e.label,kt[e.id],t);let a=t.updatedPath?t.updatedPath:t.originalPath;const s=A(),{subGraphTitleTotalMargin:i}=Ve(s);if(e.label){const c=kt[e.id];let r=e.x,n=e.y;if(a){const l=tt.calcLabelPosition(a);k.debug("Moving label "+e.label+" from (",r,",",n,") to (",l.x,",",l.y,") abc88"),t.updatedPath&&(r=l.x,n=l.y)}c.attr("transform",`translate(${r}, ${n+i/2})`)}if(e.startLabelLeft){const c=M[e.id].startLeft;let r=e.x,n=e.y;if(a){const l=tt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.startLabelRight){const c=M[e.id].startRight;let r=e.x,n=e.y;if(a){const l=tt.calcTerminalLabelPosition(e.arrowTypeStart?10:0,"start_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelLeft){const c=M[e.id].endLeft;let r=e.x,n=e.y;if(a){const l=tt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_left",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}if(e.endLabelRight){const c=M[e.id].endRight;let r=e.x,n=e.y;if(a){const l=tt.calcTerminalLabelPosition(e.arrowTypeEnd?10:0,"end_right",a);r=l.x,n=l.y}c.attr("transform",`translate(${r}, ${n})`)}},"positionEdgeLabel"),Vr=d((e,t)=>{const a=e.x,s=e.y,i=Math.abs(t.x-a),c=Math.abs(t.y-s),r=e.width/2,n=e.height/2;return i>=r||c>=n},"outsideNode"),Zr=d((e,t,a)=>{k.debug(`intersection calc abc89:
  115. outsidePoint: ${JSON.stringify(t)}
  116. insidePoint : ${JSON.stringify(a)}
  117. node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const s=e.x,i=e.y,c=Math.abs(s-a.x),r=e.width/2;let n=a.x<t.x?r-c:r+c;const l=e.height/2,g=Math.abs(t.y-a.y),o=Math.abs(t.x-a.x);if(Math.abs(i-t.y)*r>Math.abs(s-t.x)*l){let p=a.y<t.y?t.y-l-i:i-l-t.y;n=o*p/g;const b={x:a.x<t.x?a.x+n:a.x-o+n,y:a.y<t.y?a.y+g-p:a.y-g+p};return n===0&&(b.x=t.x,b.y=t.y),o===0&&(b.x=t.x),g===0&&(b.y=t.y),k.debug(`abc89 topp/bott calc, Q ${g}, q ${p}, R ${o}, r ${n}`,b),b}else{a.x<t.x?n=t.x-r-s:n=s-r-t.x;let p=g*n/o,b=a.x<t.x?a.x+o-n:a.x-o+n,x=a.y<t.y?a.y+p:a.y-p;return k.debug(`sides calc abc89, Q ${g}, q ${p}, R ${o}, r ${n}`,{_x:b,_y:x}),n===0&&(b=t.x,x=t.y),o===0&&(b=t.x),g===0&&(x=t.y),{x:b,y:x}}},"intersection"),Wt=d((e,t)=>{k.debug("abc88 cutPathAtIntersect",e,t);let a=[],s=e[0],i=!1;return e.forEach(c=>{if(!Vr(t,c)&&!i){const r=Zr(t,s,c);let n=!1;a.forEach(l=>{n=n||l.x===r.x&&l.y===r.y}),a.some(l=>l.x===r.x&&l.y===r.y)||a.push(r),i=!0}else s=c,i||a.push(c)}),a},"cutPathAtIntersect"),Gr=d(function(e,t,a,s,i,c,r){let n=a.points;k.debug("abc88 InsertEdge: edge=",a,"e=",t);let l=!1;const g=c.node(t.v);var o=c.node(t.w);o?.intersect&&g?.intersect&&(n=n.slice(1,a.points.length-1),n.unshift(g.intersect(n[0])),n.push(o.intersect(n[n.length-1]))),a.toCluster&&(k.debug("to cluster abc88",s[a.toCluster]),n=Wt(a.points,s[a.toCluster].node),l=!0),a.fromCluster&&(k.debug("from cluster abc88",s[a.fromCluster]),n=Wt(n.reverse(),s[a.fromCluster].node).reverse(),l=!0);const p=n.filter(m=>!Number.isNaN(m.y));let b=Ue;a.curve&&(i==="graph"||i==="flowchart")&&(b=a.curve);const{x,y:w}=He(a),v=Ke().x(x).y(w).curve(b);let 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}const _=e.append("path").attr("d",v(p)).attr("id",a.id).attr("class"," "+S+(a.classes?" "+a.classes:"")).attr("style",a.style);let B="";(A().flowchart.arrowMarkerAbsolute||A().state.arrowMarkerAbsolute)&&(B=Xe(!0)),Hr(_,a,B,r,i);let T={};return l&&(T.updatedPath=n),T.originalPath=a.points,T},"insertEdge"),jr=d(e=>{const t=new Set;for(const 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"),qr=d((e,t,a,s)=>{const i=jr(e),c=2,r=t.height+2*a.padding,n=r/c,l=s??t.width+2*n+a.padding,g=a.padding/2;return i.has("right")&&i.has("left")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:n,y:0},{x:l/2,y:2*g},{x:l-n,y:0},{x:l,y:0},{x:l,y:-r/3},{x:l+2*g,y:-r/2},{x:l,y:-2*r/3},{x:l,y:-r},{x:l-n,y:-r},{x:l/2,y:-r-2*g},{x:n,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*g,y:-r/2},{x:0,y:-r/3}]:i.has("right")&&i.has("left")&&i.has("up")?[{x:n,y:0},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}]:i.has("right")&&i.has("left")&&i.has("down")?[{x:0,y:0},{x:n,y:-r},{x:l-n,y:-r},{x:l,y:0}]:i.has("right")&&i.has("up")&&i.has("down")?[{x:0,y:0},{x:l,y:-n},{x:l,y:-r+n},{x:0,y:-r}]:i.has("left")&&i.has("up")&&i.has("down")?[{x:l,y:0},{x:0,y:-n},{x:0,y:-r+n},{x:l,y:-r}]:i.has("right")&&i.has("left")?[{x:n,y:0},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")&&i.has("down")?[{x:l/2,y:0},{x:0,y:-g},{x:n,y:-g},{x:n,y:-r+g},{x:0,y:-r+g},{x:l/2,y:-r},{x:l,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g},{x:l,y:-g}]:i.has("right")&&i.has("up")?[{x:0,y:0},{x:l,y:-n},{x:0,y:-r}]:i.has("right")&&i.has("down")?[{x:0,y:0},{x:l,y:0},{x:0,y:-r}]:i.has("left")&&i.has("up")?[{x:l,y:0},{x:0,y:-n},{x:l,y:-r}]:i.has("left")&&i.has("down")?[{x:l,y:0},{x:0,y:0},{x:l,y:-r}]:i.has("right")?[{x:n,y:-g},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:0},{x:l,y:-r/2},{x:l-n,y:-r},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r+g}]:i.has("left")?[{x:n,y:0},{x:n,y:-g},{x:l-n,y:-g},{x:l-n,y:-r+g},{x:n,y:-r+g},{x:n,y:-r},{x:0,y:-r/2}]:i.has("up")?[{x:n,y:-g},{x:n,y:-r+g},{x:0,y:-r+g},{x:l/2,y:-r},{x:l,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g}]:i.has("down")?[{x:l/2,y:0},{x:0,y:-g},{x:n,y:-g},{x:n,y:-r+g},{x:l-n,y:-r+g},{x:l-n,y:-g},{x:l,y:-g}]:[{x:0,y:0}]},"getArrowPoints");function ge(e,t){return e.intersect(t)}d(ge,"intersectNode");var Jr=ge;function de(e,t,a,s){var i=e.x,c=e.y,r=i-s.x,n=c-s.y,l=Math.sqrt(t*t*n*n+a*a*r*r),g=Math.abs(t*a*r/l);s.x<i&&(g=-g);var o=Math.abs(t*a*n/l);return s.y<c&&(o=-o),{x:i+g,y:c+o}}d(de,"intersectEllipse");var ue=de;function pe(e,t,a){return ue(e,t,t,a)}d(pe,"intersectCircle");var Qr=pe;function fe(e,t,a,s){var i,c,r,n,l,g,o,p,b,x,w,v,S,_,B;if(i=t.y-e.y,r=e.x-t.x,l=t.x*e.y-e.x*t.y,b=i*a.x+r*a.y+l,x=i*s.x+r*s.y+l,!(b!==0&&x!==0&&vt(b,x))&&(c=s.y-a.y,n=a.x-s.x,g=s.x*a.y-a.x*s.y,o=c*e.x+n*e.y+g,p=c*t.x+n*t.y+g,!(o!==0&&p!==0&&vt(o,p))&&(w=i*n-c*r,w!==0)))return v=Math.abs(w/2),S=r*g-n*l,_=S<0?(S-v)/w:(S+v)/w,S=c*l-i*g,B=S<0?(S-v)/w:(S+v)/w,{x:_,y:B}}d(fe,"intersectLine");function vt(e,t){return e*t>0}d(vt,"sameSign");var $r=fe,ta=xe;function xe(e,t,a){var s=e.x,i=e.y,c=[],r=Number.POSITIVE_INFINITY,n=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(w){r=Math.min(r,w.x),n=Math.min(n,w.y)}):(r=Math.min(r,t.x),n=Math.min(n,t.y));for(var l=s-e.width/2-r,g=i-e.height/2-n,o=0;o<t.length;o++){var p=t[o],b=t[o<t.length-1?o+1:0],x=$r(e,a,{x:l+p.x,y:g+p.y},{x:l+b.x,y:g+b.y});x&&c.push(x)}return c.length?(c.length>1&&c.sort(function(w,v){var S=w.x-a.x,_=w.y-a.y,B=Math.sqrt(S*S+_*_),T=v.x-a.x,m=v.y-a.y,u=Math.sqrt(T*T+m*m);return B<u?-1:B===u?0:1}),c[0]):e}d(xe,"intersectPolygon");var ea=d((e,t)=>{var a=e.x,s=e.y,i=t.x-a,c=t.y-s,r=e.width/2,n=e.height/2,l,g;return Math.abs(c)*r>Math.abs(i)*n?(c<0&&(n=-n),l=c===0?0:n*i/c,g=n):(i<0&&(r=-r),l=r,g=i===0?0:r*c/i),{x:a+l,y:s+g}},"intersectRect"),ra=ea,N={node:Jr,circle:Qr,ellipse:ue,polygon:ta,rect:ra},z=d(async(e,t,a,s)=>{const i=A();let c;const r=t.useHtmlLabels||P(i);a?c=a:c="node default";const n=e.insert("g").attr("class",c).attr("id",t.domId||t.id),l=n.insert("g").attr("class","label").attr("style",t.labelStyle);let g;t.labelText===void 0?g="":g=typeof t.labelText=="string"?t.labelText:t.labelText[0];let o;t.labelType==="markdown"?o=Et(l,Rt(At(g),i),{useHtmlLabels:r,width:t.width||i.flowchart.wrappingWidth,classes:"markdown-node-label"},i):o=await U(l,Rt(At(g),i),t.labelStyle,!1,s);let p=o.getBBox();const b=t.padding/2;if(P(i)){const x=o.children[0],w=D(o);await je(x,g),p=x.getBoundingClientRect(),w.attr("width",p.width),w.attr("height",p.height)}return r?l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"):l.attr("transform","translate(0, "+-p.height/2+")"),t.centerLabel&&l.attr("transform","translate("+-p.width/2+", "+-p.height/2+")"),l.insert("rect",":first-child"),{shapeSvg:n,bbox:p,halfPadding:b,label:l}},"labelHelper"),I=d((e,t)=>{const a=t.node().getBBox();e.width=a.width,e.height=a.height},"updateNodeBounds");function V(e,t,a,s){return e.insert("polygon",":first-child").attr("points",s.map(function(i){return i.x+","+i.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+a/2+")")}d(V,"insertPolygonShape");var aa=d(async(e,t)=>{t.useHtmlLabels||P(A())||(t.centerLabel=!0);const{shapeSvg:s,bbox:i,halfPadding:c}=await z(e,t,"node "+t.classes,!0);k.info("Classes = ",t.classes);const r=s.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-i.width/2-c).attr("y",-i.height/2-c).attr("width",i.width+t.padding).attr("height",i.height+t.padding),I(t,r),t.intersect=function(n){return N.rect(t,n)},s},"note"),sa=aa,Yt=d(e=>e?" "+e:"","formatClass"),H=d((e,t)=>`${t||"node default"}${Yt(e.classes)} ${Yt(e.class)}`,"getClassesFromNode"),Ht=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=i+c,n=[{x:r/2,y:0},{x:r,y:-r/2},{x:r/2,y:-r},{x:0,y:-r/2}];k.info("Question main (Circle)");const l=V(a,r,r,n);return l.attr("style",t.style),I(t,l),t.intersect=function(g){return k.warn("Intersect called"),N.polygon(t,n,g)},a},"question"),ia=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,i=[{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",i.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 N.circle(t,14,r)},a},"choice"),na=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=4,c=t.positioned?t.height:s.height+t.padding,r=c/i,n=t.positioned?t.width:s.width+2*r+t.padding,l=[{x:r,y:0},{x:n-r,y:0},{x:n,y:-c/2},{x:n-r,y:-c},{x:r,y:-c},{x:0,y:-c/2}],g=V(a,n,c,l);return g.attr("style",t.style),I(t,g),t.intersect=function(o){return N.polygon(t,l,o)},a},"hexagon"),ca=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,void 0,!0),i=2,c=s.height+2*t.padding,r=c/i,n=s.width+2*r+t.padding,g=t.positioned&&(t.widthInColumns??1)>1&&t.width>n?t.width:n,o=qr(t.directions,s,t,g),p=V(a,g,c,o);return p.attr("style",t.style),I(t,p),t.intersect=function(b){return N.polygon(t,o,b)},a},"block_arrow"),la=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-c/2,y:0},{x:i,y:0},{x:i,y:-c},{x:-c/2,y:-c},{x:0,y:-c/2}];return V(a,i,c,r).attr("style",t.style),t.width=i+c,t.height=c,t.intersect=function(l){return N.polygon(t,r,l)},a},"rect_left_inv_arrow"),oa=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:c/6,y:-c}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"lean_right"),ha=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:2*c/6,y:0},{x:i+c/6,y:0},{x:i-2*c/6,y:-c},{x:-c/6,y:-c}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"lean_left"),ga=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:-2*c/6,y:0},{x:i+2*c/6,y:0},{x:i-c/6,y:-c},{x:c/6,y:-c}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"trapezoid"),da=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:c/6,y:0},{x:i-c/6,y:0},{x:i+2*c/6,y:-c},{x:-2*c/6,y:-c}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"inv_trapezoid"),ua=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i+c/2,y:0},{x:i,y:-c/2},{x:i+c/2,y:-c},{x:0,y:-c}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"rect_right_inv_arrow"),pa=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=i/2,r=c/(2.5+i/50),n=s.height+r+t.padding,l="M 0,"+r+" a "+c+","+r+" 0,0,0 "+i+" 0 a "+c+","+r+" 0,0,0 "+-i+" 0 l 0,"+n+" a "+c+","+r+" 0,0,0 "+i+" 0 l 0,"+-n,g=a.attr("label-offset-y",r).insert("path",":first-child").attr("style",t.style).attr("d",l).attr("transform","translate("+-i/2+","+-(n/2+r)+")");return I(t,g),t.intersect=function(o){const p=N.rect(t,o),b=p.x-t.x;if(c!=0&&(Math.abs(b)<t.width/2||Math.abs(b)==t.width/2&&Math.abs(p.y-t.y)>t.height/2-r)){let x=r*r*(1-b*b/(c*c));x!=0&&(x=Math.sqrt(x)),x=r-x,o.y-t.y>0&&(x=-x),p.y+=x}return p},a},"cylinder"),fa=d(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await z(e,t,"node "+t.classes+" "+t.class,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,g=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",g).attr("width",r).attr("height",n),t.props){const o=new Set(Object.keys(t.props));t.props.borders&&(ht(c,t.props.borders,r,n),o.delete("borders")),o.forEach(p=>{k.warn(`Unknown node property ${p}`)})}return I(t,c),t.intersect=function(o){return N.rect(t,o)},a},"rect"),xa=d(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await z(e,t,"node "+t.classes,!0),c=a.insert("rect",":first-child"),r=t.positioned?t.width:s.width+t.padding,n=t.positioned?t.height:s.height+t.padding,l=t.positioned?-r/2:-s.width/2-i,g=t.positioned?-n/2:-s.height/2-i;if(c.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",l).attr("y",g).attr("width",r).attr("height",n),t.props){const o=new Set(Object.keys(t.props));t.props.borders&&(ht(c,t.props.borders,r,n),o.delete("borders")),o.forEach(p=>{k.warn(`Unknown node property ${p}`)})}return I(t,c),t.intersect=function(o){return N.rect(t,o)},a},"composite"),ya=d(async(e,t)=>{const{shapeSvg:a}=await z(e,t,"label",!0);k.trace("Classes = ",t.class);const s=a.insert("rect",":first-child"),i=0,c=0;if(s.attr("width",i).attr("height",c),a.attr("class","label edgeLabel"),t.props){const r=new Set(Object.keys(t.props));t.props.borders&&(ht(s,t.props.borders,i,c),r.delete("borders")),r.forEach(n=>{k.warn(`Unknown node property ${n}`)})}return I(t,s),t.intersect=function(r){return N.rect(t,r)},a},"labelRect");function ht(e,t,a,s){const i=[],c=d(n=>{i.push(n,0)},"addBorder"),r=d(n=>{i.push(0,n)},"skipBorder");t.includes("t")?(k.debug("add top border"),c(a)):r(a),t.includes("r")?(k.debug("add right border"),c(s)):r(s),t.includes("b")?(k.debug("add bottom border"),c(a)):r(a),t.includes("l")?(k.debug("add left border"),c(s)):r(s),e.attr("stroke-dasharray",i.join(" "))}d(ht,"applyNodePropertyBorders");var ba=d(async(e,t)=>{let a;t.classes?a="node "+t.classes:a="node default";const s=e.insert("g").attr("class",a).attr("id",t.domId||t.id),i=s.insert("rect",":first-child"),c=s.insert("line"),r=s.insert("g").attr("class","label"),n=t.labelText.flat?t.labelText.flat():t.labelText;let l="";typeof n=="object"?l=n[0]:l=n,k.info("Label text abc79",l,n,typeof n=="object");const g=await U(r,l,t.labelStyle,!0,!0);let o={width:0,height:0};if(P(A())){const v=g.children[0],S=D(g);o=v.getBoundingClientRect(),S.attr("width",o.width),S.attr("height",o.height)}k.info("Text 2",n);const p=n.slice(1,n.length);let b=g.getBBox();const x=await U(r,p.join?p.join("<br/>"):p,t.labelStyle,!0,!0);if(P(A())){const v=x.children[0],S=D(x);o=v.getBoundingClientRect(),S.attr("width",o.width),S.attr("height",o.height)}const w=t.padding/2;return D(x).attr("transform","translate( "+(o.width>b.width?0:(b.width-o.width)/2)+", "+(b.height+w+5)+")"),D(g).attr("transform","translate( "+(o.width<b.width?0:-(b.width-o.width)/2)+", 0)"),o=r.node().getBBox(),r.attr("transform","translate("+-o.width/2+", "+(-o.height/2-w+3)+")"),i.attr("class","outer title-state").attr("x",-o.width/2-w).attr("y",-o.height/2-w).attr("width",o.width+t.padding).attr("height",o.height+t.padding),c.attr("class","divider").attr("x1",-o.width/2-w).attr("x2",o.width/2+w).attr("y1",-o.height/2-w+b.height+w).attr("y2",-o.height/2-w+b.height+w),I(t,i),t.intersect=function(v){return N.rect(t,v)},s},"rectWithTitle"),wa=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.height+t.padding,c=s.width+i/4+t.padding,r=a.insert("rect",":first-child").attr("style",t.style).attr("rx",i/2).attr("ry",i/2).attr("x",-c/2).attr("y",-i/2).attr("width",c).attr("height",i);return I(t,r),t.intersect=function(n){return N.rect(t,n)},a},"stadium"),ma=d(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await z(e,t,H(t,void 0),!0),c=a.insert("circle",":first-child");return c.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),k.info("Circle main"),I(t,c),t.intersect=function(r){return k.info("Circle intersect",t,s.width/2+i,r),N.circle(t,s.width/2+i,r)},a},"circle"),Sa=d(async(e,t)=>{const{shapeSvg:a,bbox:s,halfPadding:i}=await z(e,t,H(t,void 0),!0),c=5,r=a.insert("g",":first-child"),n=r.insert("circle"),l=r.insert("circle");return r.attr("class",t.class),n.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i+c).attr("width",s.width+t.padding+c*2).attr("height",s.height+t.padding+c*2),l.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+i).attr("width",s.width+t.padding).attr("height",s.height+t.padding),k.info("DoubleCircle main"),I(t,n),t.intersect=function(g){return k.info("DoubleCircle intersect",t,s.width/2+i+c,g),N.circle(t,s.width/2+i+c,g)},a},"doublecircle"),La=d(async(e,t)=>{const{shapeSvg:a,bbox:s}=await z(e,t,H(t,void 0),!0),i=s.width+t.padding,c=s.height+t.padding,r=[{x:0,y:0},{x:i,y:0},{x:i,y:-c},{x:0,y:-c},{x:0,y:0},{x:-8,y:0},{x:i+8,y:0},{x:i+8,y:-c},{x:-8,y:-c},{x:-8,y:0}],n=V(a,i,c,r);return n.attr("style",t.style),I(t,n),t.intersect=function(l){return N.polygon(t,r,l)},a},"subroutine"),ka=d((e,t)=>{const 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),I(t,s),t.intersect=function(i){return N.circle(t,7,i)},a},"start"),Kt=d((e,t,a)=>{const s=e.insert("g").attr("class","node default").attr("id",t.domId||t.id);let i=70,c=10;a==="LR"&&(i=10,c=70);const r=s.append("rect").attr("x",-1*i/2).attr("y",-1*c/2).attr("width",i).attr("height",c).attr("class","fork-join");return I(t,r),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(n){return N.rect(t,n)},s},"forkJoin"),va=d((e,t)=>{const a=e.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=a.insert("circle",":first-child"),i=a.insert("circle",":first-child");return i.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),I(t,i),t.intersect=function(c){return N.circle(t,7,c)},a},"end"),Ea=d(async(e,t)=>{const a=t.padding/2,s=4,i=8;let c;t.classes?c="node "+t.classes:c="node default";const r=e.insert("g").attr("class",c).attr("id",t.domId||t.id),n=r.insert("rect",":first-child"),l=r.insert("line"),g=r.insert("line");let o=0,p=s;const b=r.insert("g").attr("class","label");let x=0;const w=t.classData.annotations?.[0],v=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",S=await U(b,v,t.labelStyle,!0,!0);let _=S.getBBox();if(P(A())){const E=S.children[0],h=D(S);_=E.getBoundingClientRect(),h.attr("width",_.width),h.attr("height",_.height)}t.classData.annotations[0]&&(p+=_.height+s,o+=_.width);let B=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(P(A())?B+="&lt;"+t.classData.type+"&gt;":B+="<"+t.classData.type+">");const T=await U(b,B,t.labelStyle,!0,!0);D(T).attr("class","classTitle");let m=T.getBBox();if(P(A())){const E=T.children[0],h=D(T);m=E.getBoundingClientRect(),h.attr("width",m.width),h.attr("height",m.height)}p+=m.height+s,m.width>o&&(o=m.width);const u=[];t.classData.members.forEach(async E=>{const h=E.getDisplayDetails();let W=h.displayText;P(A())&&(W=W.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const f=await U(b,W,h.cssStyle?h.cssStyle:t.labelStyle,!0,!0);let O=f.getBBox();if(P(A())){const q=f.children[0],Z=D(f);O=q.getBoundingClientRect(),Z.attr("width",O.width),Z.attr("height",O.height)}O.width>o&&(o=O.width),p+=O.height+s,u.push(f)}),p+=i;const y=[];if(t.classData.methods.forEach(async E=>{const h=E.getDisplayDetails();let W=h.displayText;P(A())&&(W=W.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const f=await U(b,W,h.cssStyle?h.cssStyle:t.labelStyle,!0,!0);let O=f.getBBox();if(P(A())){const q=f.children[0],Z=D(f);O=q.getBoundingClientRect(),Z.attr("width",O.width),Z.attr("height",O.height)}O.width>o&&(o=O.width),p+=O.height+s,y.push(f)}),p+=i,w){let E=(o-_.width)/2;D(S).attr("transform","translate( "+(-1*o/2+E)+", "+-1*p/2+")"),x=_.height+s}let L=(o-m.width)/2;return D(T).attr("transform","translate( "+(-1*o/2+L)+", "+(-1*p/2+x)+")"),x+=m.height+s,l.attr("class","divider").attr("x1",-o/2-a).attr("x2",o/2+a).attr("y1",-p/2-a+i+x).attr("y2",-p/2-a+i+x),x+=i,u.forEach(E=>{D(E).attr("transform","translate( "+-o/2+", "+(-1*p/2+x+i/2)+")");const h=E?.getBBox();x+=(h?.height??0)+s}),x+=i,g.attr("class","divider").attr("x1",-o/2-a).attr("x2",o/2+a).attr("y1",-p/2-a+i+x).attr("y2",-p/2-a+i+x),x+=i,y.forEach(E=>{D(E).attr("transform","translate( "+-o/2+", "+(-1*p/2+x)+")");const h=E?.getBBox();x+=(h?.height??0)+s}),n.attr("style",t.style).attr("class","outer title-state").attr("x",-o/2-a).attr("y",-(p/2)-a).attr("width",o+t.padding).attr("height",p+t.padding),I(t,n),t.intersect=function(E){return N.rect(t,E)},r},"class_box"),Ut={rhombus:Ht,composite:xa,question:Ht,rect:fa,labelRect:ya,rectWithTitle:ba,choice:ia,circle:ma,doublecircle:Sa,stadium:wa,hexagon:na,block_arrow:ca,rect_left_inv_arrow:la,lean_right:oa,lean_left:ha,trapezoid:ga,inv_trapezoid:da,rect_right_inv_arrow:ua,cylinder:pa,start:ka,end:va,note:sa,subroutine:La,fork:Kt,join:Kt,class_box:Ea},ct={},ye=d(async(e,t,a)=>{let s,i;if(t.link){let c;A().securityLevel==="sandbox"?c="_top":t.linkTarget&&(c=t.linkTarget||"_blank"),s=e.insert("svg:a").attr("xlink:href",t.link).attr("target",c),i=await Ut[t.shape](s,t,a)}else i=await Ut[t.shape](e,t,a),s=i;return t.tooltip&&i.attr("title",t.tooltip),t.class&&i.attr("class","node default "+t.class),ct[t.id]=s,t.haveCallback&&ct[t.id].attr("class",ct[t.id].attr("class")+" clickable"),s},"insertNode"),_a=d(e=>{const t=ct[e.id];k.trace("Transforming node",e.diff,e,"translate("+(e.x-e.width/2-5)+", "+e.width/2+")");const 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 Bt(e,t,a=!1){const s=e;let i="default";(s?.classes?.length||0)>0&&(i=(s?.classes??[]).join(" ")),i=i+" flowchart-label";let c=0,r="",n;switch(s.type){case"round":c=5,r="rect";break;case"composite":c=0,r="composite",n=0;break;case"square":r="rect";break;case"diamond":r="question";break;case"hexagon":r="hexagon";break;case"block_arrow":r="block_arrow";break;case"odd":r="rect_left_inv_arrow";break;case"lean_right":r="lean_right";break;case"lean_left":r="lean_left";break;case"trapezoid":r="trapezoid";break;case"inv_trapezoid":r="inv_trapezoid";break;case"rect_left_inv_arrow":r="rect_left_inv_arrow";break;case"circle":r="circle";break;case"ellipse":r="ellipse";break;case"stadium":r="stadium";break;case"subroutine":r="subroutine";break;case"cylinder":r="cylinder";break;case"group":r="rect";break;case"doublecircle":r="doublecircle";break;default:r="rect"}const l=Ge(s?.styles??[]),g=s.label,o=s.size??{width:0,height:0,x:0,y:0},p=t.getDiagramId();return{labelStyle:l.labelStyle,shape:r,labelText:g,rx:c,ry:c,class:i,style:l.style,id:s.id,domId:p?`${p}-${s.id}`:s.id,directions:s.directions,width:o.width,height:o.height,x:o.x,y:o.y,positioned:a,intersect:void 0,type:s.type,padding:n??at()?.block?.padding??0,widthInColumns:s.widthInColumns??1}}d(Bt,"getNodeFromBlock");async function be(e,t,a){const s=Bt(t,a,!1);if(s.type==="group")return;const i=at(),c=await ye(e,s,{config:i}),r=c.node().getBBox(),n=a.getBlock(s.id);n.size={width:r.width,height:r.height,x:0,y:0,node:c},a.setBlock(n),c.remove()}d(be,"calculateBlockSize");async function we(e,t,a){const s=Bt(t,a,!0);if(a.getBlock(s.id).type!=="space"){const c=at();await ye(e,s,{config:c}),t.intersect=s?.intersect,_a(s)}}d(we,"insertBlockPositioned");async function gt(e,t,a,s){for(const i of t)await s(e,i,a),i.children&&await gt(e,i.children,a,s)}d(gt,"performOperations");async function me(e,t,a){await gt(e,t,a,be)}d(me,"calculateBlockSizes");async function Se(e,t,a){await gt(e,t,a,we)}d(Se,"insertBlocks");async function Le(e,t,a,s,i){const c=new qe({multigraph:!0,compound:!0});c.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const r of a)r.size&&c.setNode(r.id,{width:r.size.width,height:r.size.height,intersect:r.intersect});for(const r of t)if(r.start&&r.end){const n=s.getBlock(r.start),l=s.getBlock(r.end);if(n?.size&&l?.size){const g=n.size,o=l.size,p=[{x:g.x,y:g.y},{x:g.x+(o.x-g.x)/2,y:g.y+(o.y-g.y)/2},{x:o.x,y:o.y}],b=i?`${i}-${r.id}`:r.id,x=r.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",w=r.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",v=`${x} ${w} flowchart-link LS-a1 LE-b1`;Gr(e,{v:r.start,w:r.end,name:b},{...r,id:b,arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:v},void 0,"block",c,i),r.label&&(await Ur(e,{...r,label:r.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:r.arrowTypeEnd,arrowTypeStart:r.arrowTypeStart,points:p,classes:v}),Xr({...r,x:p[1].x,y:p[1].y},{originalPath:p}))}}}d(Le,"insertEdges");var Ta=d(function(e,t){return t.db.getClasses()},"getClasses"),Da=d(async function(e,t,a,s){const{securityLevel:i,block:c}=at(),r=s.db;r.setDiagramId(t);let n;i==="sandbox"&&(n=D("#i"+t));const l=i==="sandbox"?D(n.nodes()[0].contentDocument.body):D("body"),g=i==="sandbox"?l.select(`[id="${t}"]`):D(`[id="${t}"]`);Fr(g,["point","circle","cross"],s.type,t);const p=r.getBlocks(),b=r.getBlocksFlat(),x=r.getEdges(),w=g.insert("g").attr("class","block");await me(w,p,r);const v=he(r);if(await Se(w,p,r),await Le(w,x,b,r,t),v){const S=v,_=Math.max(1,Math.round(.125*(S.width/S.height))),B=S.height+_+10,T=S.width+10,{useMaxWidth:m}=c;Fe(g,B,T,!!m),k.debug("Here Bounds",v,S),g.attr("viewBox",`${S.x-5} ${S.y-5} ${S.width+10} ${S.height+10}`)}},"draw"),Na={draw:Da,getClasses:Ta},Aa={parser:sr,db:Er,renderer:Na,styles:Tr};export{Aa as diagram};