omni-context-cli 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cli.js +7 -7
  2. package/dist/clients/extension.vsix +0 -0
  3. package/dist/clients/web/assets/{_baseUniq-CWlTL7nF.js → _baseUniq-O6Fk0Wzr.js} +1 -1
  4. package/dist/clients/web/assets/{arc-CZjkqmF_.js → arc-n0x23Ctx.js} +1 -1
  5. package/dist/clients/web/assets/{architectureDiagram-VXUJARFQ-BOYa2bjw.js → architectureDiagram-VXUJARFQ-siUxtu84.js} +1 -1
  6. package/dist/clients/web/assets/{blockDiagram-VD42YOAC-DDOynruE.js → blockDiagram-VD42YOAC-DSqh9eGY.js} +1 -1
  7. package/dist/clients/web/assets/{c4Diagram-YG6GDRKO-C-97RpE_.js → c4Diagram-YG6GDRKO-wYR7H7xi.js} +1 -1
  8. package/dist/clients/web/assets/channel-NwuYDCTJ.js +1 -0
  9. package/dist/clients/web/assets/{chunk-4BX2VUAB-Cq-CVpiF.js → chunk-4BX2VUAB-Cay_iY5D.js} +1 -1
  10. package/dist/clients/web/assets/{chunk-55IACEB6-DgNYsQB7.js → chunk-55IACEB6-BeMIObm3.js} +1 -1
  11. package/dist/clients/web/assets/{chunk-B4BG7PRW-DlQsB2me.js → chunk-B4BG7PRW-B6cIgi7d.js} +1 -1
  12. package/dist/clients/web/assets/{chunk-DI55MBZ5-BHeF7oM6.js → chunk-DI55MBZ5-BXrfKlO3.js} +1 -1
  13. package/dist/clients/web/assets/{chunk-FMBD7UC4-D5QlY4R_.js → chunk-FMBD7UC4-67W1cNu_.js} +1 -1
  14. package/dist/clients/web/assets/{chunk-QN33PNHL-CHk3Nn1_.js → chunk-QN33PNHL-DuPwsSus.js} +1 -1
  15. package/dist/clients/web/assets/{chunk-QZHKN3VN-CAJ02eyq.js → chunk-QZHKN3VN-DWUuzBl_.js} +1 -1
  16. package/dist/clients/web/assets/{chunk-TZMSLE5B-fdEkh5Xq.js → chunk-TZMSLE5B-D3SRAd4i.js} +1 -1
  17. package/dist/clients/web/assets/classDiagram-2ON5EDUG-CA17y53i.js +1 -0
  18. package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-CA17y53i.js +1 -0
  19. package/dist/clients/web/assets/clone-Ccjp7w8U.js +1 -0
  20. package/dist/clients/web/assets/{cose-bilkent-S5V4N54A-C-KgfDpO.js → cose-bilkent-S5V4N54A-2yiAjDsY.js} +1 -1
  21. package/dist/clients/web/assets/{dagre-6UL2VRFP-XmHvxEnn.js → dagre-6UL2VRFP-DWtKyQlZ.js} +1 -1
  22. package/dist/clients/web/assets/{diagram-PSM6KHXK-piStbVS-.js → diagram-PSM6KHXK-BsH8ucOy.js} +1 -1
  23. package/dist/clients/web/assets/{diagram-QEK2KX5R-CclADJ9n.js → diagram-QEK2KX5R-CgAM_caT.js} +1 -1
  24. package/dist/clients/web/assets/{diagram-S2PKOQOG-yfPR_M0P.js → diagram-S2PKOQOG-5sXZE5fB.js} +1 -1
  25. package/dist/clients/web/assets/{erDiagram-Q2GNP2WA-C-QpleLm.js → erDiagram-Q2GNP2WA-SZjIGLfC.js} +1 -1
  26. package/dist/clients/web/assets/{flowDiagram-NV44I4VS-BXBJgvY4.js → flowDiagram-NV44I4VS-B13r1-Qr.js} +1 -1
  27. package/dist/clients/web/assets/{ganttDiagram-JELNMOA3-BId-yi2d.js → ganttDiagram-JELNMOA3-tnNnlmJ_.js} +1 -1
  28. package/dist/clients/web/assets/{gitGraphDiagram-NY62KEGX-C4GmkdUU.js → gitGraphDiagram-NY62KEGX-D3vXxiLR.js} +1 -1
  29. package/dist/clients/web/assets/{graph-lKpmm44U.js → graph-yEZO5As9.js} +1 -1
  30. package/dist/clients/web/assets/index-BvMYTiOr.js +27 -0
  31. package/dist/clients/web/assets/{index-QpapYAy5.css → index-bgcKJQwq.css} +1 -1
  32. package/dist/clients/web/assets/{infoDiagram-WHAUD3N6-DlTKBMRb.js → infoDiagram-WHAUD3N6-Diqs41Bs.js} +1 -1
  33. package/dist/clients/web/assets/{journeyDiagram-XKPGCS4Q-uR4zvhag.js → journeyDiagram-XKPGCS4Q-CsFCBnpU.js} +1 -1
  34. package/dist/clients/web/assets/{kanban-definition-3W4ZIXB7-BAth3XiM.js → kanban-definition-3W4ZIXB7-ToLQEJ6t.js} +1 -1
  35. package/dist/clients/web/assets/{layout-dqzmM9SC.js → layout-DAYHKwLI.js} +1 -1
  36. package/dist/clients/web/assets/{linear-BDsjBD51.js → linear-C6-59Tkb.js} +1 -1
  37. package/dist/clients/web/assets/{min-BpvcSMeI.js → min-CcGwUInn.js} +1 -1
  38. package/dist/clients/web/assets/{mindmap-definition-VGOIOE7T-YOfHJc2b.js → mindmap-definition-VGOIOE7T-DUxl95g0.js} +1 -1
  39. package/dist/clients/web/assets/{pieDiagram-ADFJNKIX-sxupIhex.js → pieDiagram-ADFJNKIX-B01HV9sF.js} +1 -1
  40. package/dist/clients/web/assets/{quadrantDiagram-AYHSOK5B-Clx0aaiI.js → quadrantDiagram-AYHSOK5B-CeqFw4rm.js} +1 -1
  41. package/dist/clients/web/assets/{requirementDiagram-UZGBJVZJ-Jff8r0V3.js → requirementDiagram-UZGBJVZJ-CFCoQIAQ.js} +1 -1
  42. package/dist/clients/web/assets/{sankeyDiagram-TZEHDZUN-tCX6Wk6i.js → sankeyDiagram-TZEHDZUN-C4bOlCv6.js} +1 -1
  43. package/dist/clients/web/assets/{sequenceDiagram-WL72ISMW-B66jOgtV.js → sequenceDiagram-WL72ISMW-CmcZq0aE.js} +1 -1
  44. package/dist/clients/web/assets/{stateDiagram-FKZM4ZOC-DFsarSTD.js → stateDiagram-FKZM4ZOC-BrC_Infp.js} +1 -1
  45. package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-Bi_Pj5vD.js +1 -0
  46. package/dist/clients/web/assets/{timeline-definition-IT6M3QCI-B7iIhHj6.js → timeline-definition-IT6M3QCI-C25RxMkJ.js} +1 -1
  47. package/dist/clients/web/assets/{treemap-KMMF4GRG-bwvPNBHC.js → treemap-KMMF4GRG-CYbXQA3w.js} +1 -1
  48. package/dist/clients/web/assets/{xychartDiagram-PRI3JC2R-CstqFcD3.js → xychartDiagram-PRI3JC2R-DxEjdm1o.js} +1 -1
  49. package/dist/clients/web/index.html +2 -2
  50. package/package.json +1 -1
  51. package/dist/clients/web/assets/channel-CrQbNsBe.js +0 -1
  52. package/dist/clients/web/assets/classDiagram-2ON5EDUG-CoAFxeb1.js +0 -1
  53. package/dist/clients/web/assets/classDiagram-v2-WZHVMYZB-CoAFxeb1.js +0 -1
  54. package/dist/clients/web/assets/clone-V8tKmkAv.js +0 -1
  55. package/dist/clients/web/assets/index-5wVqr2Ny.js +0 -27
  56. package/dist/clients/web/assets/stateDiagram-v2-4FDKWEC3-DhAPZEUr.js +0 -1
@@ -1 +1 @@
1
- var t,e;import{g as r}from"./chunk-FMBD7UC4-D5QlY4R_.js";import{_ as s,F as n,d as i,e as a,l as o,y as c,A as l,ai as d,R as h,S as u,c as f,O as y,aj as x,ak as p,al as g,u as b,k as m,am as k,an as w,i as v,ao as S}from"./index-5wVqr2Ny.js";import{c as _}from"./clone-V8tKmkAv.js";import{G as L}from"./graph-lKpmm44U.js";import{c as E}from"./channel-CrQbNsBe.js";import"./_baseUniq-CWlTL7nF.js";var D=function(){var t=s(function(t,e,r,s){for(r=r||{},s=t.length;s--;r[t[s]]=e);return r},"o"),e=[1,15],r=[1,7],n=[1,13],i=[1,14],a=[1,19],o=[1,16],c=[1,17],l=[1,18],d=[8,30],h=[8,10,21,28,29,30,31,39,43,46],u=[1,23],f=[1,24],y=[8,10,15,16,21,28,29,30,31,39,43,46],x=[8,10,15,16,21,27,28,29,30,31,39,43,46],p=[1,49],g={trace:s(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:s(function(t,e,r,s,n,i,a){var o=i.length-1;switch(n){case 4:s.getLogger().debug("Rule: separator (NL) ");break;case 5:s.getLogger().debug("Rule: separator (Space) ");break;case 6:s.getLogger().debug("Rule: separator (EOF) ");break;case 7:s.getLogger().debug("Rule: hierarchy: ",i[o-1]),s.setHierarchy(i[o-1]);break;case 8:s.getLogger().debug("Stop NL ");break;case 9:s.getLogger().debug("Stop EOF ");break;case 10:s.getLogger().debug("Stop NL2 ");break;case 11:s.getLogger().debug("Stop EOF2 ");break;case 12:s.getLogger().debug("Rule: statement: ",i[o]),"number"==typeof i[o].length?this.$=i[o]:this.$=[i[o]];break;case 13:s.getLogger().debug("Rule: statement #2: ",i[o-1]),this.$=[i[o-1]].concat(i[o]);break;case 14:s.getLogger().debug("Rule: link: ",i[o],t),this.$={edgeTypeStr:i[o],label:""};break;case 15:s.getLogger().debug("Rule: LABEL link: ",i[o-3],i[o-1],i[o]),this.$={edgeTypeStr:i[o],label:i[o-1]};break;case 18:const e=parseInt(i[o]),r=s.generateId();this.$={id:r,type:"space",label:"",width:e,children:[]};break;case 23:s.getLogger().debug("Rule: (nodeStatement link node) ",i[o-2],i[o-1],i[o]," typestr: ",i[o-1].edgeTypeStr);const n=s.edgeStrToEdgeData(i[o-1].edgeTypeStr);this.$=[{id:i[o-2].id,label:i[o-2].label,type:i[o-2].type,directions:i[o-2].directions},{id:i[o-2].id+"-"+i[o].id,start:i[o-2].id,end:i[o].id,label:i[o-1].label,type:"edge",directions:i[o].directions,arrowTypeEnd:n,arrowTypeStart:"arrow_open"},{id:i[o].id,label:i[o].label,type:s.typeStr2Type(i[o].typeStr),directions:i[o].directions}];break;case 24:s.getLogger().debug("Rule: nodeStatement (abc88 node size) ",i[o-1],i[o]),this.$={id:i[o-1].id,label:i[o-1].label,type:s.typeStr2Type(i[o-1].typeStr),directions:i[o-1].directions,widthInColumns:parseInt(i[o],10)};break;case 25:s.getLogger().debug("Rule: nodeStatement (node) ",i[o]),this.$={id:i[o].id,label:i[o].label,type:s.typeStr2Type(i[o].typeStr),directions:i[o].directions,widthInColumns:1};break;case 26:s.getLogger().debug("APA123",this?this:"na"),s.getLogger().debug("COLUMNS: ",i[o]),this.$={type:"column-setting",columns:"auto"===i[o]?-1:parseInt(i[o])};break;case 27:s.getLogger().debug("Rule: id-block statement : ",i[o-2],i[o-1]),s.generateId(),this.$={...i[o-2],type:"composite",children:i[o-1]};break;case 28:s.getLogger().debug("Rule: blockStatement : ",i[o-2],i[o-1],i[o]);const a=s.generateId();this.$={id:a,type:"composite",label:"",children:i[o-1]};break;case 29:s.getLogger().debug("Rule: node (NODE_ID separator): ",i[o]),this.$={id:i[o]};break;case 30:s.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",i[o-1],i[o]),this.$={id:i[o-1],label:i[o].label,typeStr:i[o].typeStr,directions:i[o].directions};break;case 31:s.getLogger().debug("Rule: dirList: ",i[o]),this.$=[i[o]];break;case 32:s.getLogger().debug("Rule: dirList: ",i[o-1],i[o]),this.$=[i[o-1]].concat(i[o]);break;case 33:s.getLogger().debug("Rule: nodeShapeNLabel: ",i[o-2],i[o-1],i[o]),this.$={typeStr:i[o-2]+i[o],label:i[o-1]};break;case 34:s.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",i[o-3],i[o-2]," #3:",i[o-1],i[o]),this.$={typeStr:i[o-3]+i[o],label:i[o-2],directions:i[o-1]};break;case 35:case 36:this.$={type:"classDef",id:i[o-1].trim(),css:i[o].trim()};break;case 37:this.$={type:"applyClass",id:i[o-1].trim(),styleClass:i[o].trim()};break;case 38:this.$={type:"applyStyles",id:i[o-1].trim(),stylesStr:i[o].trim()}}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:e,11:3,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{8:[1,20]},t(d,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:e,21:r,28:n,29:i,31:a,39:o,43:c,46:l}),t(h,[2,16],{14:22,15:u,16:f}),t(h,[2,17]),t(h,[2,18]),t(h,[2,19]),t(h,[2,20]),t(h,[2,21]),t(h,[2,22]),t(y,[2,25],{27:[1,25]}),t(h,[2,26]),{19:26,26:12,31:a},{10:e,11:27,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},t(x,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},t(d,[2,13]),{26:35,31:a},{31:[2,14]},{17:[1,36]},t(y,[2,24]),{10:e,11:37,13:4,14:22,15:u,16:f,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},t(x,[2,30]),{18:[1,43]},{18:[1,44]},t(y,[2,23]),{18:[1,45]},{30:[1,46]},t(h,[2,28]),t(h,[2,35]),t(h,[2,36]),t(h,[2,37]),t(h,[2,38]),{36:[1,47]},{33:48,34:p},{15:[1,50]},t(h,[2,27]),t(x,[2,33]),{38:[1,51]},{33:52,34:p,38:[2,31]},{31:[2,15]},t(x,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:s(function(t,e){if(!e.recoverable){var r=new Error(t);throw r.hash=e,r}this.trace(t)},"parseError"),parse:s(function(t){var e=this,r=[0],n=[],i=[null],a=[],o=this.table,c="",l=0,d=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),f={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(f.yy[y]=this.yy[y]);u.setInput(t,f.yy),f.yy.lexer=u,f.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var x=u.yylloc;a.push(x);var p=u.options&&u.options.ranges;function g(){var t;return"number"!=typeof(t=n.pop()||u.lex()||1)&&(t instanceof Array&&(t=(n=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof f.yy.parseError?this.parseError=f.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s(function(t){r.length=r.length-2*t,i.length=i.length-t,a.length=a.length-t},"popStack"),s(g,"lex");for(var b,m,k,w,v,S,_,L,E={};;){if(m=r[r.length-1],this.defaultActions[m]?k=this.defaultActions[m]:(null==b&&(b=g()),k=o[m]&&o[m][b]),void 0===k||!k.length||!k[0]){var D="";for(v in L=[],o[m])this.terminals_[v]&&v>2&&L.push("'"+this.terminals_[v]+"'");D=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==b?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:u.match,token:this.terminals_[b]||b,line:u.yylineno,loc:x,expected:L})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+b);switch(k[0]){case 1:r.push(b),i.push(u.yytext),a.push(u.yylloc),r.push(k[1]),b=null,d=u.yyleng,c=u.yytext,l=u.yylineno,x=u.yylloc;break;case 2:if(S=this.productions_[k[1]][1],E.$=i[i.length-S],E._$={first_line:a[a.length-(S||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(S||1)].first_column,last_column:a[a.length-1].last_column},p&&(E._$.range=[a[a.length-(S||1)].range[0],a[a.length-1].range[1]]),void 0!==(w=this.performAction.apply(E,[c,d,l,f.yy,k[1],i,a].concat(h))))return w;S&&(r=r.slice(0,-1*S*2),i=i.slice(0,-1*S),a=a.slice(0,-1*S)),r.push(this.productions_[k[1]][0]),i.push(E.$),a.push(E._$),_=o[r[r.length-2]][r[r.length-1]],r.push(_);break;case 3:return!0}}return!0},"parse")},b=function(){return{EOF:1,parseError:s(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:s(function(t,e){return this.yy=e||this.yy||{},this._input=t,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:s(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:s(function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=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),r.length-1&&(this.yylineno-=r.length-1);var n=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:r?(r.length===s.length?this.yylloc.first_column:0)+s[s.length-r.length].length-r[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:s(function(t){this.unput(this.match.slice(t))},"less"),pastInput:s(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:s(function(t,e){var r,s,n;if(this.options.backtrack_lexer&&(n={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&&(n.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var i in n)this[i]=n[i];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;var t,e,r,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),i=0;i<n.length;i++)if((r=this._input.match(this.rules[n[i]]))&&(!e||r[0].length>e[0].length)){if(e=r,s=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(r,n[i])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var t=this.next();return t||this.lex()},"lex"),begin:s(function(t){this.conditionStack.push(t)},"begin"),popState:s(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(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:s(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:s(function(t){this.begin(t)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:s(function(t,e,r,s){switch(r){case 0:return t.getLogger().debug("Found block-beta"),10;case 1:return t.getLogger().debug("Found id-block"),29;case 2:return t.getLogger().debug("Found block"),10;case 3:t.getLogger().debug(".",e.yytext);break;case 4:t.getLogger().debug("_",e.yytext);break;case 5:return 5;case 6:return e.yytext=-1,28;case 7:return e.yytext=e.yytext.replace(/columns\s+/,""),t.getLogger().debug("COLUMNS (LEX)",e.yytext),28;case 8:case 76:case 77:case 99:this.pushState("md_string");break;case 9:return"MD_STR";case 10:case 34:case 79:this.popState();break;case 11:this.pushState("string");break;case 12:t.getLogger().debug("LEX: POPPING STR:",e.yytext),this.popState();break;case 13:return t.getLogger().debug("LEX: STR end:",e.yytext),"STR";case 14:return e.yytext=e.yytext.replace(/space\:/,""),t.getLogger().debug("SPACE NUM (LEX)",e.yytext),21;case 15:return e.yytext="1",t.getLogger().debug("COLUMNS (LEX)",e.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 35:return"acc_descr_multiline_value";case 36:return 30;case 37:case 38:case 40:case 41:case 44:return this.popState(),t.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),t.getLogger().debug("Lex: ))"),"NODE_DEND";case 42:return this.popState(),t.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),t.getLogger().debug("Lex: -)"),"NODE_DEND";case 45:return this.popState(),t.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),t.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),t.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:case 49:return this.popState(),t.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),t.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),t.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),t.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),t.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return t.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return t.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return t.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:case 59:case 60:case 61:case 64:return t.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return t.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 62:return t.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return t.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 65:case 66:case 67:case 68:case 69:case 70:case 71:return this.pushState("NODE"),35;case 72:return t.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),t.getLogger().debug("LEX ARR START"),37;case 74:return t.getLogger().debug("Lex: NODE_ID",e.yytext),31;case 75:return t.getLogger().debug("Lex: EOF",e.yytext),8;case 78:return"NODE_DESCR";case 80:t.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:t.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return t.getLogger().debug("LEX: NODE_DESCR:",e.yytext),"NODE_DESCR";case 83:t.getLogger().debug("LEX POPPING"),this.popState();break;case 84:t.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (right): dir:",e.yytext),"DIR";case 86:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (left):",e.yytext),"DIR";case 87:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (x):",e.yytext),"DIR";case 88:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (y):",e.yytext),"DIR";case 89:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (up):",e.yytext),"DIR";case 90:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (down):",e.yytext),"DIR";case 91:return e.yytext="]>",t.getLogger().debug("Lex (ARROW_DIR end):",e.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 93:case 94:case 95:return t.getLogger().debug("Lex: LINK",e.yytext),15;case 96:case 97:case 98:return t.getLogger().debug("Lex: START_LINK",e.yytext),this.pushState("LLABEL"),16;case 100:return t.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 102:case 103:return this.popState(),t.getLogger().debug("Lex: LINK",e.yytext),15;case 104:return t.getLogger().debug("Lex: COLON",e.yytext),e.yytext=e.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}}}}();function m(){this.yy={}}return g.lexer=b,s(m,"Parser"),m.prototype=g,g.Parser=m,new m}();D.parser=D;var $=D,N=new Map,T=[],O=new Map,I="color",R="fill",A=f(),M=new Map,C=s(t=>m.sanitizeText(t,A),"sanitizeText"),B=s(function(t,e=""){let r=M.get(t);r||(r={id:t,styles:[],textStyles:[]},M.set(t,r)),null!=e&&e.split(",").forEach(t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(I).exec(t)){const t=e.replace(R,"bgFill").replace(I,R);r.textStyles.push(t)}r.styles.push(e)})},"addStyleClass"),P=s(function(t,e=""){const r=N.get(t);null!=e&&(r.styles=e.split(","))},"addStyle2Node"),Y=s(function(t,e){t.split(",").forEach(function(t){let r=N.get(t);if(void 0===r){const e=t.trim();r={id:e,type:"na",children:[]},N.set(e,r)}r.classes||(r.classes=[]),r.classes.push(e)})},"setCssClass"),X=s((t,e)=>{const r=t.flat(),s=[],n=r.find(t=>"column-setting"===(null==t?void 0:t.type)),i=(null==n?void 0:n.columns)??-1;for(const a of r)if("number"==typeof i&&i>0&&"column-setting"!==a.type&&"number"==typeof a.widthInColumns&&a.widthInColumns>i&&o.warn(`Block ${a.id} width ${a.widthInColumns} exceeds configured column width ${i}`),a.label&&(a.label=C(a.label)),"classDef"!==a.type)if("applyClass"!==a.type)if("applyStyles"!==a.type)if("column-setting"===a.type)e.columns=a.columns??-1;else if("edge"===a.type){const t=(O.get(a.id)??0)+1;O.set(a.id,t),a.id=t+"-"+a.id,T.push(a)}else{a.label||("composite"===a.type?a.label="":a.label=a.id);const t=N.get(a.id);if(void 0===t?N.set(a.id,a):("na"!==a.type&&(t.type=a.type),a.label!==a.id&&(t.label=a.label)),a.children&&X(a.children,a),"space"===a.type){const t=a.width??1;for(let e=0;e<t;e++){const t=_(a);t.id=t.id+"-"+e,N.set(t.id,t),s.push(t)}}else void 0===t&&s.push(a)}else(null==a?void 0:a.stylesStr)&&P(a.id,null==a?void 0:a.stylesStr);else Y(a.id,(null==a?void 0:a.styleClass)??"");else B(a.id,a.css);e.children=s},"populateBlockDatabase"),W=[],z={id:"root",type:"composite",children:[],columns:-1},F=s(()=>{o.debug("Clear called"),c(),z={id:"root",type:"composite",children:[],columns:-1},N=new Map([["root",z]]),W=[],M=new Map,T=[],O=new Map},"clear");function U(t){switch(o.debug("typeStr2Type",t),t){case"[]":return"square";case"()":return o.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"}}function H(t){return o.debug("typeStr2Type",t),"=="===t?"thick":"normal"}function K(t){switch(t.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}s(U,"typeStr2Type"),s(H,"edgeTypeStr2Type"),s(K,"edgeStrToEdgeData");var j=0,Z=s(()=>(j++,"id-"+Math.random().toString(36).substr(2,12)+"-"+j),"generateId"),q=s(t=>{z.children=t,X(t,z),W=z.children},"setHierarchy"),G=s(t=>{const e=N.get(t);return e?e.columns?e.columns:e.children?e.children.length:-1:-1},"getColumns"),J=s(()=>[...N.values()],"getBlocksFlat"),Q=s(()=>W||[],"getBlocks"),V=s(()=>T,"getEdges"),tt=s(t=>N.get(t),"getBlock"),et=s(t=>{N.set(t.id,t)},"setBlock"),rt=s(()=>o,"getLogger"),st=s(function(){return M},"getClasses"),nt={getConfig:s(()=>n().block,"getConfig"),typeStr2Type:U,edgeTypeStr2Type:H,edgeStrToEdgeData:K,getLogger:rt,getBlocksFlat:J,getBlocks:Q,getEdges:V,setHierarchy:q,getBlock:tt,setBlock:et,getColumns:G,getClasses:st,clear:F,generateId:Z},it=s((t,e)=>{const r=E,s=r(t,"r"),n=r(t,"g"),i=r(t,"b");return l(s,n,i,e)},"fade"),at=s(t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.nodeTextColor||t.textColor};\n }\n .cluster-label text {\n fill: ${t.titleColor};\n }\n .cluster-label span,p {\n color: ${t.titleColor};\n }\n\n\n\n .label text,span,p {\n fill: ${t.nodeTextColor||t.textColor};\n color: ${t.nodeTextColor||t.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n .flowchart-label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${it(t.edgeLabelBackground,.5)};\n // background-color:\n }\n\n .node .cluster {\n // fill: ${it(t.mainBkg,.5)};\n fill: ${it(t.clusterBkg,.5)};\n stroke: ${it(t.clusterBorder,.2)};\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n .cluster span,p {\n color: ${t.titleColor};\n }\n /* .cluster div {\n color: ${t.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n ${r()}\n`,"getStyles"),ot=s((t,e,r,s)=>{e.forEach(e=>{ct[e](t,r,s)})},"insertMarkers"),ct={extension:s((t,e,r)=>{o.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).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"),composition:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).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"),aggregation:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).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"),dependency:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).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"),lollipop:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).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),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).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"),point:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).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"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).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"),circle:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).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"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).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"),cross:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).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"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).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"),barb:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-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")},lt=ot,dt=(null==(e=null==(t=f())?void 0:t.block)?void 0:e.padding)??8;function ht(t,e){if(0===t||!Number.isInteger(t))throw new Error("Columns must be an integer !== 0.");if(e<0||!Number.isInteger(e))throw new Error("Position must be a non-negative integer."+e);if(t<0)return{px:e,py:0};if(1===t)return{px:0,py:e};return{px:e%t,py:Math.floor(e/t)}}s(ht,"calculateBlockPosition");var ut=s(t=>{let e=0,r=0;for(const s of t.children){const{width:n,height:i,x:a,y:c}=s.size??{width:0,height:0,x:0,y:0};o.debug("getMaxChildSize abc95 child:",s.id,"width:",n,"height:",i,"x:",a,"y:",c,s.type),"space"!==s.type&&(n>e&&(e=n/(t.widthInColumns??1)),i>r&&(r=i))}return{width:e,height:r}},"getMaxChildSize");function ft(t,e,r=0,s=0){var n,i,a,c,l,d,h,u,f,y,x;o.debug("setBlockSizes abc95 (start)",t.id,null==(n=null==t?void 0:t.size)?void 0:n.x,"block width =",null==t?void 0:t.size,"siblingWidth",r),(null==(i=null==t?void 0:t.size)?void 0:i.width)||(t.size={width:r,height:s,x:0,y:0});let p=0,g=0;if((null==(a=t.children)?void 0:a.length)>0){for(const r of t.children)ft(r,e);const n=ut(t);p=n.width,g=n.height,o.debug("setBlockSizes abc95 maxWidth of",t.id,":s children is ",p,g);for(const e of t.children)e.size&&(o.debug(`abc95 Setting size of children of ${t.id} id=${e.id} ${p} ${g} ${JSON.stringify(e.size)}`),e.size.width=p*(e.widthInColumns??1)+dt*((e.widthInColumns??1)-1),e.size.height=g,e.size.x=0,e.size.y=0,o.debug(`abc95 updating size of ${t.id} children child:${e.id} maxWidth:${p} maxHeight:${g}`));for(const r of t.children)ft(r,e,p,g);const i=t.columns??-1;let a=0;for(const e of t.children)a+=e.widthInColumns??1;let u=t.children.length;i>0&&i<a&&(u=i);const f=Math.ceil(a/u);let y=u*(p+dt)+dt,x=f*(g+dt)+dt;if(y<r){o.debug(`Detected to small sibling: abc95 ${t.id} siblingWidth ${r} siblingHeight ${s} width ${y}`),y=r,x=s;const e=(r-u*dt-dt)/u,n=(s-f*dt-dt)/f;o.debug("Size indata abc88",t.id,"childWidth",e,"maxWidth",p),o.debug("Size indata abc88",t.id,"childHeight",n,"maxHeight",g),o.debug("Size indata abc88 xSize",u,"padding",dt);for(const r of t.children)r.size&&(r.size.width=e,r.size.height=n,r.size.x=0,r.size.y=0)}if(o.debug(`abc95 (finale calc) ${t.id} xSize ${u} ySize ${f} columns ${i}${t.children.length} width=${Math.max(y,(null==(c=t.size)?void 0:c.width)||0)}`),y<((null==(l=null==t?void 0:t.size)?void 0:l.width)||0)){y=(null==(d=null==t?void 0:t.size)?void 0:d.width)||0;const e=i>0?Math.min(t.children.length,i):t.children.length;if(e>0){const r=(y-e*dt-dt)/e;o.debug("abc95 (growing to fit) width",t.id,y,null==(h=t.size)?void 0:h.width,r);for(const e of t.children)e.size&&(e.size.width=r)}}t.size={width:y,height:x,x:0,y:0}}o.debug("setBlockSizes abc94 (done)",t.id,null==(u=null==t?void 0:t.size)?void 0:u.x,null==(f=null==t?void 0:t.size)?void 0:f.width,null==(y=null==t?void 0:t.size)?void 0:y.y,null==(x=null==t?void 0:t.size)?void 0:x.height)}function yt(t,e){var r,s,n,i,a,c,l,d,h,u,f,y,x,p,g,b,m;o.debug(`abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${null==(r=null==t?void 0:t.size)?void 0:r.x} y: ${null==(s=null==t?void 0:t.size)?void 0:s.y} width: ${null==(n=null==t?void 0:t.size)?void 0:n.width}`);const k=t.columns??-1;if(o.debug("layoutBlocks columns abc95",t.id,"=>",k,t),t.children&&t.children.length>0){const e=(null==(a=null==(i=null==t?void 0:t.children[0])?void 0:i.size)?void 0:a.width)??0,r=t.children.length*e+(t.children.length-1)*dt;o.debug("widthOfChildren 88",r,"posX");let s=0;o.debug("abc91 block?.size?.x",t.id,null==(c=null==t?void 0:t.size)?void 0:c.x);let n=(null==(l=null==t?void 0:t.size)?void 0:l.x)?(null==(d=null==t?void 0:t.size)?void 0:d.x)+(-(null==(h=null==t?void 0:t.size)?void 0:h.width)/2||0):-dt,g=0;for(const i of t.children){const e=t;if(!i.size)continue;const{width:r,height:a}=i.size,{px:c,py:l}=ht(k,s);if(l!=g&&(g=l,n=(null==(u=null==t?void 0:t.size)?void 0:u.x)?(null==(f=null==t?void 0:t.size)?void 0:f.x)+(-(null==(y=null==t?void 0:t.size)?void 0:y.width)/2||0):-dt,o.debug("New row in layout for block",t.id," and child ",i.id,g)),o.debug(`abc89 layout blocks (child) id: ${i.id} Pos: ${s} (px, py) ${c},${l} (${null==(x=null==e?void 0:e.size)?void 0:x.x},${null==(p=null==e?void 0:e.size)?void 0:p.y}) parent: ${e.id} width: ${r}${dt}`),e.size){const t=r/2;i.size.x=n+dt+t,o.debug(`abc91 layout blocks (calc) px, pyid:${i.id} startingPos=X${n} new startingPosX${i.size.x} ${t} padding=${dt} width=${r} halfWidth=${t} => x:${i.size.x} y:${i.size.y} ${i.widthInColumns} (width * (child?.w || 1)) / 2 ${r*((null==i?void 0:i.widthInColumns)??1)/2}`),n=i.size.x+t,i.size.y=e.size.y-e.size.height/2+l*(a+dt)+a/2+dt,o.debug(`abc88 layout blocks (calc) px, pyid:${i.id}startingPosX${n}${dt}${t}=>x:${i.size.x}y:${i.size.y}${i.widthInColumns}(width * (child?.w || 1)) / 2${r*((null==i?void 0:i.widthInColumns)??1)/2}`)}i.children&&yt(i);let d=(null==i?void 0:i.widthInColumns)??1;k>0&&(d=Math.min(d,k-s%k)),s+=d,o.debug("abc88 columnsPos",i,s)}}o.debug(`layout blocks (<==layoutBlocks) ${t.id} x: ${null==(g=null==t?void 0:t.size)?void 0:g.x} y: ${null==(b=null==t?void 0:t.size)?void 0:b.y} width: ${null==(m=null==t?void 0:t.size)?void 0:m.width}`)}function xt(t,{minX:e,minY:r,maxX:s,maxY:n}={minX:0,minY:0,maxX:0,maxY:0}){if(t.size&&"root"!==t.id){const{x:i,y:a,width:o,height:c}=t.size;i-o/2<e&&(e=i-o/2),a-c/2<r&&(r=a-c/2),i+o/2>s&&(s=i+o/2),a+c/2>n&&(n=a+c/2)}if(t.children)for(const i of t.children)({minX:e,minY:r,maxX:s,maxY:n}=xt(i,{minX:e,minY:r,maxX:s,maxY:n}));return{minX:e,minY:r,maxX:s,maxY:n}}function pt(t){const e=t.getBlock("root");if(!e)return;ft(e,t,0,0),yt(e),o.debug("getBlocks",JSON.stringify(e,null,2));const{minX:r,minY:s,maxX:n,maxY:i}=xt(e);return{x:r,y:s,width:n-r,height:i-s}}function gt(t,e){e&&t.attr("style",e)}function bt(t,e){const r=i(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),s=r.append("xhtml:div"),n=t.label,a=t.isNode?"nodeLabel":"edgeLabel",o=s.append("span");return o.html(v(n,e)),gt(o,t.labelStyle),o.attr("class",a),gt(s,t.labelStyle),s.style("display","inline-block"),s.style("white-space","nowrap"),s.attr("xmlns","http://www.w3.org/1999/xhtml"),r.node()}s(ft,"setBlockSizes"),s(yt,"layoutBlocks"),s(xt,"findBounds"),s(pt,"layout"),s(gt,"applyStyle"),s(bt,"addHtmlLabel");var mt=s(async(t,e,r,s)=>{let n=t||"";"object"==typeof n&&(n=n[0]);const i=f();if(x(i.flowchart.htmlLabels)){n=n.replace(/\\n|\n/g,"<br />"),o.debug("vertexText"+n);return bt({isNode:s,label:await k(w(n)),labelStyle:e.replace("fill:","color:")},i)}{const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));let s=[];s="string"==typeof n?n.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(n)?n:[];for(const e of s){const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),r?s.setAttribute("class","title-row"):s.setAttribute("class","row"),s.textContent=e.trim(),t.appendChild(s)}return t}},"createLabel"),kt=s((t,e,r,s,n)=>{e.arrowTypeStart&&vt(t,"start",e.arrowTypeStart,r,s,n),e.arrowTypeEnd&&vt(t,"end",e.arrowTypeEnd,r,s,n)},"addEdgeMarkers"),wt={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},vt=s((t,e,r,s,n,i)=>{const a=wt[r];if(!a)return void o.warn(`Unknown arrow type: ${r}`);const c="start"===e?"Start":"End";t.attr(`marker-${e}`,`url(${s}#${n}_${i}-${a}${c})`)},"addEdgeMarker"),St={},_t={},Lt=s(async(t,e)=>{const r=f(),s=x(r.flowchart.htmlLabels),n="markdown"===e.labelType?p(t,e.label,{style:e.labelStyle,useHtmlLabels:s,addSvgBackground:!0},r):await mt(e.label,e.labelStyle),a=t.insert("g").attr("class","edgeLabel"),o=a.insert("g").attr("class","label");o.node().appendChild(n);let c,l=n.getBBox();if(s){const t=n.children[0],e=i(n);l=t.getBoundingClientRect(),e.attr("width",l.width),e.attr("height",l.height)}if(o.attr("transform","translate("+-l.width/2+", "+-l.height/2+")"),St[e.id]=a,e.width=l.width,e.height=l.height,e.startLabelLeft){const r=await mt(e.startLabelLeft,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),_t[e.id]||(_t[e.id]={}),_t[e.id].startLeft=s,Et(c,e.startLabelLeft)}if(e.startLabelRight){const r=await mt(e.startLabelRight,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=s.node().appendChild(r),n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),_t[e.id]||(_t[e.id]={}),_t[e.id].startRight=s,Et(c,e.startLabelRight)}if(e.endLabelLeft){const r=await mt(e.endLabelLeft,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),s.node().appendChild(r),_t[e.id]||(_t[e.id]={}),_t[e.id].endLeft=s,Et(c,e.endLabelLeft)}if(e.endLabelRight){const r=await mt(e.endLabelRight,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),s.node().appendChild(r),_t[e.id]||(_t[e.id]={}),_t[e.id].endRight=s,Et(c,e.endLabelRight)}return n},"insertEdgeLabel");function Et(t,e){f().flowchart.htmlLabels&&t&&(t.style.width=9*e.length+"px",t.style.height="12px")}s(Et,"setTerminalWidth");var Dt=s((t,e)=>{o.debug("Moving label abc88 ",t.id,t.label,St[t.id],e);let r=e.updatedPath?e.updatedPath:e.originalPath;const s=f(),{subGraphTitleTotalMargin:n}=g(s);if(t.label){const s=St[t.id];let i=t.x,a=t.y;if(r){const s=b.calcLabelPosition(r);o.debug("Moving label "+t.label+" from (",i,",",a,") to (",s.x,",",s.y,") abc88"),e.updatedPath&&(i=s.x,a=s.y)}s.attr("transform",`translate(${i}, ${a+n/2})`)}if(t.startLabelLeft){const e=_t[t.id].startLeft;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.startLabelRight){const e=_t[t.id].startRight;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.endLabelLeft){const e=_t[t.id].endLeft;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.endLabelRight){const e=_t[t.id].endRight;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}},"positionEdgeLabel"),$t=s((t,e)=>{const r=t.x,s=t.y,n=Math.abs(e.x-r),i=Math.abs(e.y-s),a=t.width/2,o=t.height/2;return n>=a||i>=o},"outsideNode"),Nt=s((t,e,r)=>{o.debug(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(e)}\n insidePoint : ${JSON.stringify(r)}\n node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const s=t.x,n=t.y,i=Math.abs(s-r.x),a=t.width/2;let c=r.x<e.x?a-i:a+i;const l=t.height/2,d=Math.abs(e.y-r.y),h=Math.abs(e.x-r.x);if(Math.abs(n-e.y)*a>Math.abs(s-e.x)*l){let t=r.y<e.y?e.y-l-n:n-l-e.y;c=h*t/d;const s={x:r.x<e.x?r.x+c:r.x-h+c,y:r.y<e.y?r.y+d-t:r.y-d+t};return 0===c&&(s.x=e.x,s.y=e.y),0===h&&(s.x=e.x),0===d&&(s.y=e.y),o.debug(`abc89 topp/bott calc, Q ${d}, q ${t}, R ${h}, r ${c}`,s),s}{c=r.x<e.x?e.x-a-s:s-a-e.x;let t=d*c/h,n=r.x<e.x?r.x+h-c:r.x-h+c,i=r.y<e.y?r.y+t:r.y-t;return o.debug(`sides calc abc89, Q ${d}, q ${t}, R ${h}, r ${c}`,{_x:n,_y:i}),0===c&&(n=e.x,i=e.y),0===h&&(n=e.x),0===d&&(i=e.y),{x:n,y:i}}},"intersection"),Tt=s((t,e)=>{o.debug("abc88 cutPathAtIntersect",t,e);let r=[],s=t[0],n=!1;return t.forEach(t=>{if($t(e,t)||n)s=t,n||r.push(t);else{const i=Nt(e,s,t);let a=!1;r.forEach(t=>{a=a||t.x===i.x&&t.y===i.y}),r.some(t=>t.x===i.x&&t.y===i.y)||r.push(i),n=!0}}),r},"cutPathAtIntersect"),Ot=s(function(t,e,r,s,n,i,a){let c=r.points;o.debug("abc88 InsertEdge: edge=",r,"e=",e);let l=!1;const x=i.node(e.v);var p=i.node(e.w);(null==p?void 0:p.intersect)&&(null==x?void 0:x.intersect)&&(c=c.slice(1,r.points.length-1),c.unshift(x.intersect(c[0])),c.push(p.intersect(c[c.length-1]))),r.toCluster&&(o.debug("to cluster abc88",s[r.toCluster]),c=Tt(r.points,s[r.toCluster].node),l=!0),r.fromCluster&&(o.debug("from cluster abc88",s[r.fromCluster]),c=Tt(c.reverse(),s[r.fromCluster].node).reverse(),l=!0);const g=c.filter(t=>!Number.isNaN(t.y));let b=u;!r.curve||"graph"!==n&&"flowchart"!==n||(b=r.curve);const{x:m,y:k}=d(r),w=h().x(m).y(k).curve(b);let v;switch(r.thickness){case"normal":v="edge-thickness-normal";break;case"thick":case"invisible":v="edge-thickness-thick";break;default:v=""}switch(r.pattern){case"solid":v+=" edge-pattern-solid";break;case"dotted":v+=" edge-pattern-dotted";break;case"dashed":v+=" edge-pattern-dashed"}const S=t.append("path").attr("d",w(g)).attr("id",r.id).attr("class"," "+v+(r.classes?" "+r.classes:"")).attr("style",r.style);let _="";(f().flowchart.arrowMarkerAbsolute||f().state.arrowMarkerAbsolute)&&(_=y(!0)),kt(S,r,_,a,n);let L={};return l&&(L.updatedPath=c),L.originalPath=r.points,L},"insertEdge"),It=s(t=>{const e=new Set;for(const r of t)switch(r){case"x":e.add("right"),e.add("left");break;case"y":e.add("up"),e.add("down");break;default:e.add(r)}return e},"expandAndDeduplicateDirections"),Rt=s((t,e,r)=>{const s=It(t),n=e.height+2*r.padding,i=n/2,a=e.width+2*i+r.padding,o=r.padding/2;return s.has("right")&&s.has("left")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:i,y:0},{x:a/2,y:2*o},{x:a-i,y:0},{x:a,y:0},{x:a,y:-n/3},{x:a+2*o,y:-n/2},{x:a,y:-2*n/3},{x:a,y:-n},{x:a-i,y:-n},{x:a/2,y:-n-2*o},{x:i,y:-n},{x:0,y:-n},{x:0,y:-2*n/3},{x:-2*o,y:-n/2},{x:0,y:-n/3}]:s.has("right")&&s.has("left")&&s.has("up")?[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}]:s.has("right")&&s.has("left")&&s.has("down")?[{x:0,y:0},{x:i,y:-n},{x:a-i,y:-n},{x:a,y:0}]:s.has("right")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:a,y:-i},{x:a,y:-n+i},{x:0,y:-n}]:s.has("left")&&s.has("up")&&s.has("down")?[{x:a,y:0},{x:0,y:-i},{x:0,y:-n+i},{x:a,y:-n}]:s.has("right")&&s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n},{x:0,y:-n/2}]:s.has("up")&&s.has("down")?[{x:a/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-n+o},{x:0,y:-n+o},{x:a/2,y:-n},{x:a,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o},{x:a,y:-o}]:s.has("right")&&s.has("up")?[{x:0,y:0},{x:a,y:-i},{x:0,y:-n}]:s.has("right")&&s.has("down")?[{x:0,y:0},{x:a,y:0},{x:0,y:-n}]:s.has("left")&&s.has("up")?[{x:a,y:0},{x:0,y:-i},{x:a,y:-n}]:s.has("left")&&s.has("down")?[{x:a,y:0},{x:0,y:0},{x:a,y:-n}]:s.has("right")?[{x:i,y:-o},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n+o}]:s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n},{x:0,y:-n/2}]:s.has("up")?[{x:i,y:-o},{x:i,y:-n+o},{x:0,y:-n+o},{x:a/2,y:-n},{x:a,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o}]:s.has("down")?[{x:a/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o},{x:a,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function At(t,e){return t.intersect(e)}s(At,"intersectNode");var Mt=At;function Ct(t,e,r,s){var n=t.x,i=t.y,a=n-s.x,o=i-s.y,c=Math.sqrt(e*e*o*o+r*r*a*a),l=Math.abs(e*r*a/c);s.x<n&&(l=-l);var d=Math.abs(e*r*o/c);return s.y<i&&(d=-d),{x:n+l,y:i+d}}s(Ct,"intersectEllipse");var Bt=Ct;function Pt(t,e,r){return Bt(t,e,e,r)}s(Pt,"intersectCircle");var Yt=Pt;function Xt(t,e,r,s){var n,i,a,o,c,l,d,h,u,f,y,x,p;if(n=e.y-t.y,a=t.x-e.x,c=e.x*t.y-t.x*e.y,u=n*r.x+a*r.y+c,f=n*s.x+a*s.y+c,!(0!==u&&0!==f&&Wt(u,f)||(i=s.y-r.y,o=r.x-s.x,l=s.x*r.y-r.x*s.y,d=i*t.x+o*t.y+l,h=i*e.x+o*e.y+l,0!==d&&0!==h&&Wt(d,h)||0===(y=n*o-i*a))))return x=Math.abs(y/2),{x:(p=a*l-o*c)<0?(p-x)/y:(p+x)/y,y:(p=i*c-n*l)<0?(p-x)/y:(p+x)/y}}function Wt(t,e){return t*e>0}s(Xt,"intersectLine"),s(Wt,"sameSign");var zt=Xt,Ft=Ut;function Ut(t,e,r){var s=t.x,n=t.y,i=[],a=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach(function(t){a=Math.min(a,t.x),o=Math.min(o,t.y)}):(a=Math.min(a,e.x),o=Math.min(o,e.y));for(var c=s-t.width/2-a,l=n-t.height/2-o,d=0;d<e.length;d++){var h=e[d],u=e[d<e.length-1?d+1:0],f=zt(t,r,{x:c+h.x,y:l+h.y},{x:c+u.x,y:l+u.y});f&&i.push(f)}return i.length?(i.length>1&&i.sort(function(t,e){var s=t.x-r.x,n=t.y-r.y,i=Math.sqrt(s*s+n*n),a=e.x-r.x,o=e.y-r.y,c=Math.sqrt(a*a+o*o);return i<c?-1:i===c?0:1}),i[0]):t}s(Ut,"intersectPolygon");var Ht={node:Mt,circle:Yt,ellipse:Bt,polygon:Ft,rect:s((t,e)=>{var r,s,n=t.x,i=t.y,a=e.x-n,o=e.y-i,c=t.width/2,l=t.height/2;return Math.abs(o)*c>Math.abs(a)*l?(o<0&&(l=-l),r=0===o?0:l*a/o,s=l):(a<0&&(c=-c),r=c,s=0===a?0:c*o/a),{x:n+r,y:i+s}},"intersectRect")},Kt=s(async(t,e,r,n)=>{const a=f();let o;const c=e.useHtmlLabels||x(a.flowchart.htmlLabels);o=r||"node default";const l=t.insert("g").attr("class",o).attr("id",e.domId||e.id),d=l.insert("g").attr("class","label").attr("style",e.labelStyle);let h;h=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const u=d.node();let y;y="markdown"===e.labelType?p(d,v(w(h),a),{useHtmlLabels:c,width:e.width||a.flowchart.wrappingWidth,classes:"markdown-node-label"},a):u.appendChild(await mt(v(w(h),a),e.labelStyle,!1,n));let g=y.getBBox();const b=e.padding/2;if(x(a.flowchart.htmlLabels)){const t=y.children[0],e=i(y),r=t.getElementsByTagName("img");if(r){const t=""===h.replace(/<img[^>]*>/g,"").trim();await Promise.all([...r].map(e=>new Promise(r=>{function n(){if(e.style.display="flex",e.style.flexDirection="column",t){const t=a.fontSize?a.fontSize:window.getComputedStyle(document.body).fontSize,r=5,s=parseInt(t,10)*r+"px";e.style.minWidth=s,e.style.maxWidth=s}else e.style.width="100%";r(e)}s(n,"setupImage"),setTimeout(()=>{e.complete&&n()}),e.addEventListener("error",n),e.addEventListener("load",n)})))}g=t.getBoundingClientRect(),e.attr("width",g.width),e.attr("height",g.height)}return c?d.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"):d.attr("transform","translate(0, "+-g.height/2+")"),e.centerLabel&&d.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"),d.insert("rect",":first-child"),{shapeSvg:l,bbox:g,halfPadding:b,label:d}},"labelHelper"),jt=s((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds");function Zt(t,e,r,s){return t.insert("polygon",":first-child").attr("points",s.map(function(t){return t.x+","+t.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}s(Zt,"insertPolygonShape");var qt=s(async(t,e)=>{e.useHtmlLabels||f().flowchart.htmlLabels||(e.centerLabel=!0);const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes,!0);o.info("Classes = ",e.classes);const i=r.insert("rect",":first-child");return i.attr("rx",e.rx).attr("ry",e.ry).attr("x",-s.width/2-n).attr("y",-s.height/2-n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"note"),Gt=s(t=>t?" "+t:"","formatClass"),Jt=s((t,e)=>`${e||"node default"}${Gt(t.classes)} ${Gt(t.class)}`,"getClassesFromNode"),Qt=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding+(s.height+e.padding),i=[{x:n/2,y:0},{x:n,y:-n/2},{x:n/2,y:-n},{x:0,y:-n/2}];o.info("Question main (Circle)");const a=Zt(r,n,n,i);return a.attr("style",e.style),jt(e,a),e.intersect=function(t){return o.warn("Intersect called"),Ht.polygon(e,i,t)},r},"question"),Vt=s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return r.insert("polygon",":first-child").attr("points",s.map(function(t){return t.x+","+t.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(t){return Ht.circle(e,14,t)},r},"choice"),te=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.height+e.padding,i=n/4,a=s.width+2*i+e.padding,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}],c=Zt(r,a,n,o);return c.attr("style",e.style),jt(e,c),e.intersect=function(t){return Ht.polygon(e,o,t)},r},"hexagon"),ee=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,void 0,!0),n=s.height+2*e.padding,i=n/2,a=s.width+2*i+e.padding,o=Rt(e.directions,s,e),c=Zt(r,a,n,o);return c.attr("style",e.style),jt(e,c),e.intersect=function(t){return Ht.polygon(e,o,t)},r},"block_arrow"),re=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-i/2,y:0},{x:n,y:0},{x:n,y:-i},{x:-i/2,y:-i},{x:0,y:-i/2}];return Zt(r,n,i,a).attr("style",e.style),e.width=n+i,e.height=i,e.intersect=function(t){return Ht.polygon(e,a,t)},r},"rect_left_inv_arrow"),se=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-2*i/6,y:0},{x:n-i/6,y:0},{x:n+2*i/6,y:-i},{x:i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"lean_right"),ne=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:2*i/6,y:0},{x:n+i/6,y:0},{x:n-2*i/6,y:-i},{x:-i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"lean_left"),ie=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-2*i/6,y:0},{x:n+2*i/6,y:0},{x:n-i/6,y:-i},{x:i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"trapezoid"),ae=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:i/6,y:0},{x:n-i/6,y:0},{x:n+2*i/6,y:-i},{x:-2*i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"inv_trapezoid"),oe=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:0,y:0},{x:n+i/2,y:0},{x:n,y:-i/2},{x:n+i/2,y:-i},{x:0,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"rect_right_inv_arrow"),ce=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=n/2,a=i/(2.5+n/50),o=s.height+a+e.padding,c="M 0,"+a+" a "+i+","+a+" 0,0,0 "+n+" 0 a "+i+","+a+" 0,0,0 "+-n+" 0 l 0,"+o+" a "+i+","+a+" 0,0,0 "+n+" 0 l 0,"+-o,l=r.attr("label-offset-y",a).insert("path",":first-child").attr("style",e.style).attr("d",c).attr("transform","translate("+-n/2+","+-(o/2+a)+")");return jt(e,l),e.intersect=function(t){const r=Ht.rect(e,t),s=r.x-e.x;if(0!=i&&(Math.abs(s)<e.width/2||Math.abs(s)==e.width/2&&Math.abs(r.y-e.y)>e.height/2-a)){let n=a*a*(1-s*s/(i*i));0!=n&&(n=Math.sqrt(n)),n=a-n,t.y-e.y>0&&(n=-n),r.y+=n}return r},r},"cylinder"),le=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes+" "+e.class,!0),i=r.insert("rect",":first-child"),a=e.positioned?e.width:s.width+e.padding,c=e.positioned?e.height:s.height+e.padding,l=e.positioned?-a/2:-s.width/2-n,d=e.positioned?-c/2:-s.height/2-n;if(i.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",d).attr("width",a).attr("height",c),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(i,e.props.borders,a,c),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"rect"),de=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes,!0),i=r.insert("rect",":first-child"),a=e.positioned?e.width:s.width+e.padding,c=e.positioned?e.height:s.height+e.padding,l=e.positioned?-a/2:-s.width/2-n,d=e.positioned?-c/2:-s.height/2-n;if(i.attr("class","basic cluster composite label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",d).attr("width",a).attr("height",c),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(i,e.props.borders,a,c),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"composite"),he=s(async(t,e)=>{const{shapeSvg:r}=await Kt(t,e,"label",!0);o.trace("Classes = ",e.class);const s=r.insert("rect",":first-child");if(s.attr("width",0).attr("height",0),r.attr("class","label edgeLabel"),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(s,e.props.borders,0,0),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,s),e.intersect=function(t){return Ht.rect(e,t)},r},"labelRect");function ue(t,e,r,n){const i=[],a=s(t=>{i.push(t,0)},"addBorder"),c=s(t=>{i.push(0,t)},"skipBorder");e.includes("t")?(o.debug("add top border"),a(r)):c(r),e.includes("r")?(o.debug("add right border"),a(n)):c(n),e.includes("b")?(o.debug("add bottom border"),a(r)):c(r),e.includes("l")?(o.debug("add left border"),a(n)):c(n),t.attr("stroke-dasharray",i.join(" "))}s(ue,"applyNodePropertyBorders");var fe=s(async(t,e)=>{let r;r=e.classes?"node "+e.classes:"node default";const s=t.insert("g").attr("class",r).attr("id",e.domId||e.id),n=s.insert("rect",":first-child"),a=s.insert("line"),c=s.insert("g").attr("class","label"),l=e.labelText.flat?e.labelText.flat():e.labelText;let d="";d="object"==typeof l?l[0]:l,o.info("Label text abc79",d,l,"object"==typeof l);const h=c.node().appendChild(await mt(d,e.labelStyle,!0,!0));let u={width:0,height:0};if(x(f().flowchart.htmlLabels)){const t=h.children[0],e=i(h);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}o.info("Text 2",l);const y=l.slice(1,l.length);let p=h.getBBox();const g=c.node().appendChild(await mt(y.join?y.join("<br/>"):y,e.labelStyle,!0,!0));if(x(f().flowchart.htmlLabels)){const t=g.children[0],e=i(g);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}const b=e.padding/2;return i(g).attr("transform","translate( "+(u.width>p.width?0:(p.width-u.width)/2)+", "+(p.height+b+5)+")"),i(h).attr("transform","translate( "+(u.width<p.width?0:-(p.width-u.width)/2)+", 0)"),u=c.node().getBBox(),c.attr("transform","translate("+-u.width/2+", "+(-u.height/2-b+3)+")"),n.attr("class","outer title-state").attr("x",-u.width/2-b).attr("y",-u.height/2-b).attr("width",u.width+e.padding).attr("height",u.height+e.padding),a.attr("class","divider").attr("x1",-u.width/2-b).attr("x2",u.width/2+b).attr("y1",-u.height/2-b+p.height+b).attr("y2",-u.height/2-b+p.height+b),jt(e,n),e.intersect=function(t){return Ht.rect(e,t)},s},"rectWithTitle"),ye=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.height+e.padding,i=s.width+n/4+e.padding,a=r.insert("rect",":first-child").attr("style",e.style).attr("rx",n/2).attr("ry",n/2).attr("x",-i/2).attr("y",-n/2).attr("width",i).attr("height",n);return jt(e,a),e.intersect=function(t){return Ht.rect(e,t)},r},"stadium"),xe=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,Jt(e,void 0),!0),i=r.insert("circle",":first-child");return i.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),o.info("Circle main"),jt(e,i),e.intersect=function(t){return o.info("Circle intersect",e,s.width/2+n,t),Ht.circle(e,s.width/2+n,t)},r},"circle"),pe=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,Jt(e,void 0),!0),i=r.insert("g",":first-child"),a=i.insert("circle"),c=i.insert("circle");return i.attr("class",e.class),a.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n+5).attr("width",s.width+e.padding+10).attr("height",s.height+e.padding+10),c.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),o.info("DoubleCircle main"),jt(e,a),e.intersect=function(t){return o.info("DoubleCircle intersect",e,s.width/2+n+5,t),Ht.circle(e,s.width/2+n+5,t)},r},"doublecircle"),ge=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:0,y:0},{x:n,y:0},{x:n,y:-i},{x:0,y:-i},{x:0,y:0},{x:-8,y:0},{x:n+8,y:0},{x:n+8,y:-i},{x:-8,y:-i},{x:-8,y:0}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"subroutine"),be=s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=r.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),jt(e,s),e.intersect=function(t){return Ht.circle(e,7,t)},r},"start"),me=s((t,e,r)=>{const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let n=70,i=10;"LR"===r&&(n=10,i=70);const a=s.append("rect").attr("x",-1*n/2).attr("y",-1*i/2).attr("width",n).attr("height",i).attr("class","fork-join");return jt(e,a),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(t){return Ht.rect(e,t)},s},"forkJoin"),ke={rhombus:Qt,composite:de,question:Qt,rect:le,labelRect:he,rectWithTitle:fe,choice:Vt,circle:xe,doublecircle:pe,stadium:ye,hexagon:te,block_arrow:ee,rect_left_inv_arrow:re,lean_right:se,lean_left:ne,trapezoid:ie,inv_trapezoid:ae,rect_right_inv_arrow:oe,cylinder:ce,start:be,end:s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=r.insert("circle",":first-child"),n=r.insert("circle",":first-child");return n.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),jt(e,n),e.intersect=function(t){return Ht.circle(e,7,t)},r},"end"),note:qt,subroutine:ge,fork:me,join:me,class_box:s(async(t,e)=>{var r;const s=e.padding/2;let n;n=e.classes?"node "+e.classes:"node default";const a=t.insert("g").attr("class",n).attr("id",e.domId||e.id),o=a.insert("rect",":first-child"),c=a.insert("line"),l=a.insert("line");let d=0,h=4;const u=a.insert("g").attr("class","label");let y=0;const p=null==(r=e.classData.annotations)?void 0:r[0],g=e.classData.annotations[0]?"«"+e.classData.annotations[0]+"»":"",b=u.node().appendChild(await mt(g,e.labelStyle,!0,!0));let m=b.getBBox();if(x(f().flowchart.htmlLabels)){const t=b.children[0],e=i(b);m=t.getBoundingClientRect(),e.attr("width",m.width),e.attr("height",m.height)}e.classData.annotations[0]&&(h+=m.height+4,d+=m.width);let k=e.classData.label;void 0!==e.classData.type&&""!==e.classData.type&&(f().flowchart.htmlLabels?k+="&lt;"+e.classData.type+"&gt;":k+="<"+e.classData.type+">");const w=u.node().appendChild(await mt(k,e.labelStyle,!0,!0));i(w).attr("class","classTitle");let v=w.getBBox();if(x(f().flowchart.htmlLabels)){const t=w.children[0],e=i(w);v=t.getBoundingClientRect(),e.attr("width",v.width),e.attr("height",v.height)}h+=v.height+4,v.width>d&&(d=v.width);const S=[];e.classData.members.forEach(async t=>{const r=t.getDisplayDetails();let s=r.displayText;f().flowchart.htmlLabels&&(s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const n=u.node().appendChild(await mt(s,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let a=n.getBBox();if(x(f().flowchart.htmlLabels)){const t=n.children[0],e=i(n);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>d&&(d=a.width),h+=a.height+4,S.push(n)}),h+=8;const _=[];if(e.classData.methods.forEach(async t=>{const r=t.getDisplayDetails();let s=r.displayText;f().flowchart.htmlLabels&&(s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const n=u.node().appendChild(await mt(s,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let a=n.getBBox();if(x(f().flowchart.htmlLabels)){const t=n.children[0],e=i(n);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>d&&(d=a.width),h+=a.height+4,_.push(n)}),h+=8,p){let t=(d-m.width)/2;i(b).attr("transform","translate( "+(-1*d/2+t)+", "+-1*h/2+")"),y=m.height+4}let L=(d-v.width)/2;return i(w).attr("transform","translate( "+(-1*d/2+L)+", "+(-1*h/2+y)+")"),y+=v.height+4,c.attr("class","divider").attr("x1",-d/2-s).attr("x2",d/2+s).attr("y1",-h/2-s+8+y).attr("y2",-h/2-s+8+y),y+=8,S.forEach(t=>{i(t).attr("transform","translate( "+-d/2+", "+(-1*h/2+y+4)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4}),y+=8,l.attr("class","divider").attr("x1",-d/2-s).attr("x2",d/2+s).attr("y1",-h/2-s+8+y).attr("y2",-h/2-s+8+y),y+=8,_.forEach(t=>{i(t).attr("transform","translate( "+-d/2+", "+(-1*h/2+y)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4}),o.attr("style",e.style).attr("class","outer title-state").attr("x",-d/2-s).attr("y",-h/2-s).attr("width",d+e.padding).attr("height",h+e.padding),jt(e,o),e.intersect=function(t){return Ht.rect(e,t)},a},"class_box")},we={},ve=s(async(t,e,r)=>{let s,n;if(e.link){let i;"sandbox"===f().securityLevel?i="_top":e.linkTarget&&(i=e.linkTarget||"_blank"),s=t.insert("svg:a").attr("xlink:href",e.link).attr("target",i),n=await ke[e.shape](s,e,r)}else n=await ke[e.shape](t,e,r),s=n;return e.tooltip&&n.attr("title",e.tooltip),e.class&&n.attr("class","node default "+e.class),we[e.id]=s,e.haveCallback&&we[e.id].attr("class",we[e.id].attr("class")+" clickable"),s},"insertNode"),Se=s(t=>{const e=we[t.id];o.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+r-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),r},"positionNode");function _e(t,e,r=!1){var s,i,a;const o=t;let c="default";((null==(s=null==o?void 0:o.classes)?void 0:s.length)||0)>0&&(c=((null==o?void 0:o.classes)??[]).join(" ")),c+=" flowchart-label";let l,d=0,h="";switch(o.type){case"round":d=5,h="rect";break;case"composite":d=0,h="composite",l=0;break;case"square":case"group":default:h="rect";break;case"diamond":h="question";break;case"hexagon":h="hexagon";break;case"block_arrow":h="block_arrow";break;case"odd":case"rect_left_inv_arrow":h="rect_left_inv_arrow";break;case"lean_right":h="lean_right";break;case"lean_left":h="lean_left";break;case"trapezoid":h="trapezoid";break;case"inv_trapezoid":h="inv_trapezoid";break;case"circle":h="circle";break;case"ellipse":h="ellipse";break;case"stadium":h="stadium";break;case"subroutine":h="subroutine";break;case"cylinder":h="cylinder";break;case"doublecircle":h="doublecircle"}const u=S((null==o?void 0:o.styles)??[]),f=o.label,y=o.size??{width:0,height:0,x:0,y:0};return{labelStyle:u.labelStyle,shape:h,labelText:f,rx:d,ry:d,class:c,style:u.style,id:o.id,directions:o.directions,width:y.width,height:y.height,x:y.x,y:y.y,positioned:r,intersect:void 0,type:o.type,padding:l??(null==(a=null==(i=n())?void 0:i.block)?void 0:a.padding)??0}}async function Le(t,e,r){const s=_e(e,0,!1);if("group"===s.type)return;const i=n(),a=await ve(t,s,{config:i}),o=a.node().getBBox(),c=r.getBlock(s.id);c.size={width:o.width,height:o.height,x:0,y:0,node:a},r.setBlock(c),a.remove()}async function Ee(t,e,r){const s=_e(e,0,!0);if("space"!==r.getBlock(s.id).type){const r=n();await ve(t,s,{config:r}),e.intersect=null==s?void 0:s.intersect,Se(s)}}async function De(t,e,r,s){for(const n of e)await s(t,n,r),n.children&&await De(t,n.children,r,s)}async function $e(t,e,r){await De(t,e,r,Le)}async function Ne(t,e,r){await De(t,e,r,Ee)}async function Te(t,e,r,s,n){const i=new L({multigraph:!0,compound:!0});i.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const a of r)a.size&&i.setNode(a.id,{width:a.size.width,height:a.size.height,intersect:a.intersect});for(const a of e)if(a.start&&a.end){const e=s.getBlock(a.start),r=s.getBlock(a.end);if((null==e?void 0:e.size)&&(null==r?void 0:r.size)){const s=e.size,o=r.size,c=[{x:s.x,y:s.y},{x:s.x+(o.x-s.x)/2,y:s.y+(o.y-s.y)/2},{x:o.x,y:o.y}];Ot(t,{v:a.start,w:a.end,name:a.id},{...a,arrowTypeEnd:a.arrowTypeEnd,arrowTypeStart:a.arrowTypeStart,points:c,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",i,n),a.label&&(await Lt(t,{...a,label:a.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:a.arrowTypeEnd,arrowTypeStart:a.arrowTypeStart,points:c,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),Dt({...a,x:c[1].x,y:c[1].y},{originalPath:c}))}}}s(_e,"getNodeFromBlock"),s(Le,"calculateBlockSize"),s(Ee,"insertBlockPositioned"),s(De,"performOperations"),s($e,"calculateBlockSizes"),s(Ne,"insertBlocks"),s(Te,"insertEdges");var Oe=s(function(t,e){return e.db.getClasses()},"getClasses"),Ie={parser:$,db:nt,renderer:{draw:s(async function(t,e,r,s){const{securityLevel:c,block:l}=n(),d=s.db;let h;"sandbox"===c&&(h=i("#i"+e));const u=i("sandbox"===c?h.nodes()[0].contentDocument.body:"body"),f="sandbox"===c?u.select(`[id="${e}"]`):i(`[id="${e}"]`);lt(f,["point","circle","cross"],s.type,e);const y=d.getBlocks(),x=d.getBlocksFlat(),p=d.getEdges(),g=f.insert("g").attr("class","block");await $e(g,y,d);const b=pt(d);if(await Ne(g,y,d),await Te(g,p,x,d,e),b){const t=b,e=Math.max(1,Math.round(t.width/t.height*.125)),r=t.height+e+10,s=t.width+10,{useMaxWidth:n}=l;a(f,r,s,!!n),o.debug("Here Bounds",b,t),f.attr("viewBox",`${t.x-5} ${t.y-5} ${t.width+10} ${t.height+10}`)}},"draw"),getClasses:Oe},styles:at};export{Ie as diagram};
1
+ var t,e;import{g as r}from"./chunk-FMBD7UC4-67W1cNu_.js";import{_ as s,F as n,d as i,e as a,l as o,y as c,A as l,ai as d,R as h,S as u,c as f,O as y,aj as x,ak as p,al as g,u as b,k as m,am as k,an as w,i as v,ao as S}from"./index-BvMYTiOr.js";import{c as _}from"./clone-Ccjp7w8U.js";import{G as L}from"./graph-yEZO5As9.js";import{c as E}from"./channel-NwuYDCTJ.js";import"./_baseUniq-O6Fk0Wzr.js";var D=function(){var t=s(function(t,e,r,s){for(r=r||{},s=t.length;s--;r[t[s]]=e);return r},"o"),e=[1,15],r=[1,7],n=[1,13],i=[1,14],a=[1,19],o=[1,16],c=[1,17],l=[1,18],d=[8,30],h=[8,10,21,28,29,30,31,39,43,46],u=[1,23],f=[1,24],y=[8,10,15,16,21,28,29,30,31,39,43,46],x=[8,10,15,16,21,27,28,29,30,31,39,43,46],p=[1,49],g={trace:s(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:s(function(t,e,r,s,n,i,a){var o=i.length-1;switch(n){case 4:s.getLogger().debug("Rule: separator (NL) ");break;case 5:s.getLogger().debug("Rule: separator (Space) ");break;case 6:s.getLogger().debug("Rule: separator (EOF) ");break;case 7:s.getLogger().debug("Rule: hierarchy: ",i[o-1]),s.setHierarchy(i[o-1]);break;case 8:s.getLogger().debug("Stop NL ");break;case 9:s.getLogger().debug("Stop EOF ");break;case 10:s.getLogger().debug("Stop NL2 ");break;case 11:s.getLogger().debug("Stop EOF2 ");break;case 12:s.getLogger().debug("Rule: statement: ",i[o]),"number"==typeof i[o].length?this.$=i[o]:this.$=[i[o]];break;case 13:s.getLogger().debug("Rule: statement #2: ",i[o-1]),this.$=[i[o-1]].concat(i[o]);break;case 14:s.getLogger().debug("Rule: link: ",i[o],t),this.$={edgeTypeStr:i[o],label:""};break;case 15:s.getLogger().debug("Rule: LABEL link: ",i[o-3],i[o-1],i[o]),this.$={edgeTypeStr:i[o],label:i[o-1]};break;case 18:const e=parseInt(i[o]),r=s.generateId();this.$={id:r,type:"space",label:"",width:e,children:[]};break;case 23:s.getLogger().debug("Rule: (nodeStatement link node) ",i[o-2],i[o-1],i[o]," typestr: ",i[o-1].edgeTypeStr);const n=s.edgeStrToEdgeData(i[o-1].edgeTypeStr);this.$=[{id:i[o-2].id,label:i[o-2].label,type:i[o-2].type,directions:i[o-2].directions},{id:i[o-2].id+"-"+i[o].id,start:i[o-2].id,end:i[o].id,label:i[o-1].label,type:"edge",directions:i[o].directions,arrowTypeEnd:n,arrowTypeStart:"arrow_open"},{id:i[o].id,label:i[o].label,type:s.typeStr2Type(i[o].typeStr),directions:i[o].directions}];break;case 24:s.getLogger().debug("Rule: nodeStatement (abc88 node size) ",i[o-1],i[o]),this.$={id:i[o-1].id,label:i[o-1].label,type:s.typeStr2Type(i[o-1].typeStr),directions:i[o-1].directions,widthInColumns:parseInt(i[o],10)};break;case 25:s.getLogger().debug("Rule: nodeStatement (node) ",i[o]),this.$={id:i[o].id,label:i[o].label,type:s.typeStr2Type(i[o].typeStr),directions:i[o].directions,widthInColumns:1};break;case 26:s.getLogger().debug("APA123",this?this:"na"),s.getLogger().debug("COLUMNS: ",i[o]),this.$={type:"column-setting",columns:"auto"===i[o]?-1:parseInt(i[o])};break;case 27:s.getLogger().debug("Rule: id-block statement : ",i[o-2],i[o-1]),s.generateId(),this.$={...i[o-2],type:"composite",children:i[o-1]};break;case 28:s.getLogger().debug("Rule: blockStatement : ",i[o-2],i[o-1],i[o]);const a=s.generateId();this.$={id:a,type:"composite",label:"",children:i[o-1]};break;case 29:s.getLogger().debug("Rule: node (NODE_ID separator): ",i[o]),this.$={id:i[o]};break;case 30:s.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",i[o-1],i[o]),this.$={id:i[o-1],label:i[o].label,typeStr:i[o].typeStr,directions:i[o].directions};break;case 31:s.getLogger().debug("Rule: dirList: ",i[o]),this.$=[i[o]];break;case 32:s.getLogger().debug("Rule: dirList: ",i[o-1],i[o]),this.$=[i[o-1]].concat(i[o]);break;case 33:s.getLogger().debug("Rule: nodeShapeNLabel: ",i[o-2],i[o-1],i[o]),this.$={typeStr:i[o-2]+i[o],label:i[o-1]};break;case 34:s.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",i[o-3],i[o-2]," #3:",i[o-1],i[o]),this.$={typeStr:i[o-3]+i[o],label:i[o-2],directions:i[o-1]};break;case 35:case 36:this.$={type:"classDef",id:i[o-1].trim(),css:i[o].trim()};break;case 37:this.$={type:"applyClass",id:i[o-1].trim(),styleClass:i[o].trim()};break;case 38:this.$={type:"applyStyles",id:i[o-1].trim(),stylesStr:i[o].trim()}}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:e,11:3,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{8:[1,20]},t(d,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:e,21:r,28:n,29:i,31:a,39:o,43:c,46:l}),t(h,[2,16],{14:22,15:u,16:f}),t(h,[2,17]),t(h,[2,18]),t(h,[2,19]),t(h,[2,20]),t(h,[2,21]),t(h,[2,22]),t(y,[2,25],{27:[1,25]}),t(h,[2,26]),{19:26,26:12,31:a},{10:e,11:27,13:4,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},t(x,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},t(d,[2,13]),{26:35,31:a},{31:[2,14]},{17:[1,36]},t(y,[2,24]),{10:e,11:37,13:4,14:22,15:u,16:f,19:5,20:6,21:r,22:8,23:9,24:10,25:11,26:12,28:n,29:i,31:a,39:o,43:c,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},t(x,[2,30]),{18:[1,43]},{18:[1,44]},t(y,[2,23]),{18:[1,45]},{30:[1,46]},t(h,[2,28]),t(h,[2,35]),t(h,[2,36]),t(h,[2,37]),t(h,[2,38]),{36:[1,47]},{33:48,34:p},{15:[1,50]},t(h,[2,27]),t(x,[2,33]),{38:[1,51]},{33:52,34:p,38:[2,31]},{31:[2,15]},t(x,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:s(function(t,e){if(!e.recoverable){var r=new Error(t);throw r.hash=e,r}this.trace(t)},"parseError"),parse:s(function(t){var e=this,r=[0],n=[],i=[null],a=[],o=this.table,c="",l=0,d=0,h=a.slice.call(arguments,1),u=Object.create(this.lexer),f={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(f.yy[y]=this.yy[y]);u.setInput(t,f.yy),f.yy.lexer=u,f.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var x=u.yylloc;a.push(x);var p=u.options&&u.options.ranges;function g(){var t;return"number"!=typeof(t=n.pop()||u.lex()||1)&&(t instanceof Array&&(t=(n=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof f.yy.parseError?this.parseError=f.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s(function(t){r.length=r.length-2*t,i.length=i.length-t,a.length=a.length-t},"popStack"),s(g,"lex");for(var b,m,k,w,v,S,_,L,E={};;){if(m=r[r.length-1],this.defaultActions[m]?k=this.defaultActions[m]:(null==b&&(b=g()),k=o[m]&&o[m][b]),void 0===k||!k.length||!k[0]){var D="";for(v in L=[],o[m])this.terminals_[v]&&v>2&&L.push("'"+this.terminals_[v]+"'");D=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==b?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(D,{text:u.match,token:this.terminals_[b]||b,line:u.yylineno,loc:x,expected:L})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+b);switch(k[0]){case 1:r.push(b),i.push(u.yytext),a.push(u.yylloc),r.push(k[1]),b=null,d=u.yyleng,c=u.yytext,l=u.yylineno,x=u.yylloc;break;case 2:if(S=this.productions_[k[1]][1],E.$=i[i.length-S],E._$={first_line:a[a.length-(S||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(S||1)].first_column,last_column:a[a.length-1].last_column},p&&(E._$.range=[a[a.length-(S||1)].range[0],a[a.length-1].range[1]]),void 0!==(w=this.performAction.apply(E,[c,d,l,f.yy,k[1],i,a].concat(h))))return w;S&&(r=r.slice(0,-1*S*2),i=i.slice(0,-1*S),a=a.slice(0,-1*S)),r.push(this.productions_[k[1]][0]),i.push(E.$),a.push(E._$),_=o[r[r.length-2]][r[r.length-1]],r.push(_);break;case 3:return!0}}return!0},"parse")},b=function(){return{EOF:1,parseError:s(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:s(function(t,e){return this.yy=e||this.yy||{},this._input=t,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:s(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:s(function(t){var e=t.length,r=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=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),r.length-1&&(this.yylineno-=r.length-1);var n=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:r?(r.length===s.length?this.yylloc.first_column:0)+s[s.length-r.length].length-r[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:s(function(t){this.unput(this.match.slice(t))},"less"),pastInput:s(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:s(function(t,e){var r,s,n;if(this.options.backtrack_lexer&&(n={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&&(n.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],r=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),r)return r;if(this._backtrack){for(var i in n)this[i]=n[i];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;var t,e,r,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),i=0;i<n.length;i++)if((r=this._input.match(this.rules[n[i]]))&&(!e||r[0].length>e[0].length)){if(e=r,s=i,this.options.backtrack_lexer){if(!1!==(t=this.test_match(r,n[i])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var t=this.next();return t||this.lex()},"lex"),begin:s(function(t){this.conditionStack.push(t)},"begin"),popState:s(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(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:s(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:s(function(t){this.begin(t)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:s(function(t,e,r,s){switch(r){case 0:return t.getLogger().debug("Found block-beta"),10;case 1:return t.getLogger().debug("Found id-block"),29;case 2:return t.getLogger().debug("Found block"),10;case 3:t.getLogger().debug(".",e.yytext);break;case 4:t.getLogger().debug("_",e.yytext);break;case 5:return 5;case 6:return e.yytext=-1,28;case 7:return e.yytext=e.yytext.replace(/columns\s+/,""),t.getLogger().debug("COLUMNS (LEX)",e.yytext),28;case 8:case 76:case 77:case 99:this.pushState("md_string");break;case 9:return"MD_STR";case 10:case 34:case 79:this.popState();break;case 11:this.pushState("string");break;case 12:t.getLogger().debug("LEX: POPPING STR:",e.yytext),this.popState();break;case 13:return t.getLogger().debug("LEX: STR end:",e.yytext),"STR";case 14:return e.yytext=e.yytext.replace(/space\:/,""),t.getLogger().debug("SPACE NUM (LEX)",e.yytext),21;case 15:return e.yytext="1",t.getLogger().debug("COLUMNS (LEX)",e.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 35:return"acc_descr_multiline_value";case 36:return 30;case 37:case 38:case 40:case 41:case 44:return this.popState(),t.getLogger().debug("Lex: (("),"NODE_DEND";case 39:return this.popState(),t.getLogger().debug("Lex: ))"),"NODE_DEND";case 42:return this.popState(),t.getLogger().debug("Lex: (-"),"NODE_DEND";case 43:return this.popState(),t.getLogger().debug("Lex: -)"),"NODE_DEND";case 45:return this.popState(),t.getLogger().debug("Lex: ]]"),"NODE_DEND";case 46:return this.popState(),t.getLogger().debug("Lex: ("),"NODE_DEND";case 47:return this.popState(),t.getLogger().debug("Lex: ])"),"NODE_DEND";case 48:case 49:return this.popState(),t.getLogger().debug("Lex: /]"),"NODE_DEND";case 50:return this.popState(),t.getLogger().debug("Lex: )]"),"NODE_DEND";case 51:return this.popState(),t.getLogger().debug("Lex: )"),"NODE_DEND";case 52:return this.popState(),t.getLogger().debug("Lex: ]>"),"NODE_DEND";case 53:return this.popState(),t.getLogger().debug("Lex: ]"),"NODE_DEND";case 54:return t.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;case 55:return t.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;case 56:return t.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;case 57:case 59:case 60:case 61:case 64:return t.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;case 58:return t.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;case 62:return t.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;case 63:return t.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;case 65:case 66:case 67:case 68:case 69:case 70:case 71:return this.pushState("NODE"),35;case 72:return t.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;case 73:return this.pushState("BLOCK_ARROW"),t.getLogger().debug("LEX ARR START"),37;case 74:return t.getLogger().debug("Lex: NODE_ID",e.yytext),31;case 75:return t.getLogger().debug("Lex: EOF",e.yytext),8;case 78:return"NODE_DESCR";case 80:t.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:t.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return t.getLogger().debug("LEX: NODE_DESCR:",e.yytext),"NODE_DESCR";case 83:t.getLogger().debug("LEX POPPING"),this.popState();break;case 84:t.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (right): dir:",e.yytext),"DIR";case 86:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (left):",e.yytext),"DIR";case 87:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (x):",e.yytext),"DIR";case 88:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (y):",e.yytext),"DIR";case 89:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (up):",e.yytext),"DIR";case 90:return e.yytext=e.yytext.replace(/^,\s*/,""),t.getLogger().debug("Lex (down):",e.yytext),"DIR";case 91:return e.yytext="]>",t.getLogger().debug("Lex (ARROW_DIR end):",e.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";case 92:return t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 93:case 94:case 95:return t.getLogger().debug("Lex: LINK",e.yytext),15;case 96:case 97:case 98:return t.getLogger().debug("Lex: START_LINK",e.yytext),this.pushState("LLABEL"),16;case 100:return t.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";case 101:return this.popState(),t.getLogger().debug("Lex: LINK","#"+e.yytext+"#"),15;case 102:case 103:return this.popState(),t.getLogger().debug("Lex: LINK",e.yytext),15;case 104:return t.getLogger().debug("Lex: COLON",e.yytext),e.yytext=e.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}}}}();function m(){this.yy={}}return g.lexer=b,s(m,"Parser"),m.prototype=g,g.Parser=m,new m}();D.parser=D;var $=D,N=new Map,T=[],O=new Map,I="color",R="fill",A=f(),M=new Map,C=s(t=>m.sanitizeText(t,A),"sanitizeText"),B=s(function(t,e=""){let r=M.get(t);r||(r={id:t,styles:[],textStyles:[]},M.set(t,r)),null!=e&&e.split(",").forEach(t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(I).exec(t)){const t=e.replace(R,"bgFill").replace(I,R);r.textStyles.push(t)}r.styles.push(e)})},"addStyleClass"),P=s(function(t,e=""){const r=N.get(t);null!=e&&(r.styles=e.split(","))},"addStyle2Node"),Y=s(function(t,e){t.split(",").forEach(function(t){let r=N.get(t);if(void 0===r){const e=t.trim();r={id:e,type:"na",children:[]},N.set(e,r)}r.classes||(r.classes=[]),r.classes.push(e)})},"setCssClass"),X=s((t,e)=>{const r=t.flat(),s=[],n=r.find(t=>"column-setting"===(null==t?void 0:t.type)),i=(null==n?void 0:n.columns)??-1;for(const a of r)if("number"==typeof i&&i>0&&"column-setting"!==a.type&&"number"==typeof a.widthInColumns&&a.widthInColumns>i&&o.warn(`Block ${a.id} width ${a.widthInColumns} exceeds configured column width ${i}`),a.label&&(a.label=C(a.label)),"classDef"!==a.type)if("applyClass"!==a.type)if("applyStyles"!==a.type)if("column-setting"===a.type)e.columns=a.columns??-1;else if("edge"===a.type){const t=(O.get(a.id)??0)+1;O.set(a.id,t),a.id=t+"-"+a.id,T.push(a)}else{a.label||("composite"===a.type?a.label="":a.label=a.id);const t=N.get(a.id);if(void 0===t?N.set(a.id,a):("na"!==a.type&&(t.type=a.type),a.label!==a.id&&(t.label=a.label)),a.children&&X(a.children,a),"space"===a.type){const t=a.width??1;for(let e=0;e<t;e++){const t=_(a);t.id=t.id+"-"+e,N.set(t.id,t),s.push(t)}}else void 0===t&&s.push(a)}else(null==a?void 0:a.stylesStr)&&P(a.id,null==a?void 0:a.stylesStr);else Y(a.id,(null==a?void 0:a.styleClass)??"");else B(a.id,a.css);e.children=s},"populateBlockDatabase"),W=[],z={id:"root",type:"composite",children:[],columns:-1},F=s(()=>{o.debug("Clear called"),c(),z={id:"root",type:"composite",children:[],columns:-1},N=new Map([["root",z]]),W=[],M=new Map,T=[],O=new Map},"clear");function U(t){switch(o.debug("typeStr2Type",t),t){case"[]":return"square";case"()":return o.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"}}function H(t){return o.debug("typeStr2Type",t),"=="===t?"thick":"normal"}function K(t){switch(t.replace(/^[\s-]+|[\s-]+$/g,"")){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}s(U,"typeStr2Type"),s(H,"edgeTypeStr2Type"),s(K,"edgeStrToEdgeData");var j=0,Z=s(()=>(j++,"id-"+Math.random().toString(36).substr(2,12)+"-"+j),"generateId"),q=s(t=>{z.children=t,X(t,z),W=z.children},"setHierarchy"),G=s(t=>{const e=N.get(t);return e?e.columns?e.columns:e.children?e.children.length:-1:-1},"getColumns"),J=s(()=>[...N.values()],"getBlocksFlat"),Q=s(()=>W||[],"getBlocks"),V=s(()=>T,"getEdges"),tt=s(t=>N.get(t),"getBlock"),et=s(t=>{N.set(t.id,t)},"setBlock"),rt=s(()=>o,"getLogger"),st=s(function(){return M},"getClasses"),nt={getConfig:s(()=>n().block,"getConfig"),typeStr2Type:U,edgeTypeStr2Type:H,edgeStrToEdgeData:K,getLogger:rt,getBlocksFlat:J,getBlocks:Q,getEdges:V,setHierarchy:q,getBlock:tt,setBlock:et,getColumns:G,getClasses:st,clear:F,generateId:Z},it=s((t,e)=>{const r=E,s=r(t,"r"),n=r(t,"g"),i=r(t,"b");return l(s,n,i,e)},"fade"),at=s(t=>`.label {\n font-family: ${t.fontFamily};\n color: ${t.nodeTextColor||t.textColor};\n }\n .cluster-label text {\n fill: ${t.titleColor};\n }\n .cluster-label span,p {\n color: ${t.titleColor};\n }\n\n\n\n .label text,span,p {\n fill: ${t.nodeTextColor||t.textColor};\n color: ${t.nodeTextColor||t.textColor};\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon,\n .node path {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n stroke-width: 1px;\n }\n .flowchart-label text {\n text-anchor: middle;\n }\n // .flowchart-label .text-outer-tspan {\n // text-anchor: middle;\n // }\n // .flowchart-label .text-inner-tspan {\n // text-anchor: start;\n // }\n\n .node .label {\n text-align: center;\n }\n .node.clickable {\n cursor: pointer;\n }\n\n .arrowheadPath {\n fill: ${t.arrowheadColor};\n }\n\n .edgePath .path {\n stroke: ${t.lineColor};\n stroke-width: 2.0px;\n }\n\n .flowchart-link {\n stroke: ${t.lineColor};\n fill: none;\n }\n\n .edgeLabel {\n background-color: ${t.edgeLabelBackground};\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n }\n\n /* For html labels only */\n .labelBkg {\n background-color: ${it(t.edgeLabelBackground,.5)};\n // background-color:\n }\n\n .node .cluster {\n // fill: ${it(t.mainBkg,.5)};\n fill: ${it(t.clusterBkg,.5)};\n stroke: ${it(t.clusterBorder,.2)};\n box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;\n stroke-width: 1px;\n }\n\n .cluster text {\n fill: ${t.titleColor};\n }\n\n .cluster span,p {\n color: ${t.titleColor};\n }\n /* .cluster div {\n color: ${t.titleColor};\n } */\n\n div.mermaidTooltip {\n position: absolute;\n text-align: center;\n max-width: 200px;\n padding: 2px;\n font-family: ${t.fontFamily};\n font-size: 12px;\n background: ${t.tertiaryColor};\n border: 1px solid ${t.border2};\n border-radius: 2px;\n pointer-events: none;\n z-index: 100;\n }\n\n .flowchartTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n ${r()}\n`,"getStyles"),ot=s((t,e,r,s)=>{e.forEach(e=>{ct[e](t,r,s)})},"insertMarkers"),ct={extension:s((t,e,r)=>{o.trace("Making markers for ",r),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionStart").attr("class","marker extension "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-extensionEnd").attr("class","marker extension "+e).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"),composition:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionStart").attr("class","marker composition "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-compositionEnd").attr("class","marker composition "+e).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"),aggregation:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationStart").attr("class","marker aggregation "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-aggregationEnd").attr("class","marker aggregation "+e).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"),dependency:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyStart").attr("class","marker dependency "+e).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"),t.append("defs").append("marker").attr("id",r+"_"+e+"-dependencyEnd").attr("class","marker dependency "+e).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"),lollipop:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopStart").attr("class","marker lollipop "+e).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),t.append("defs").append("marker").attr("id",r+"_"+e+"-lollipopEnd").attr("class","marker lollipop "+e).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"),point:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-pointEnd").attr("class","marker "+e).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"),t.append("marker").attr("id",r+"_"+e+"-pointStart").attr("class","marker "+e).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"),circle:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-circleEnd").attr("class","marker "+e).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"),t.append("marker").attr("id",r+"_"+e+"-circleStart").attr("class","marker "+e).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"),cross:s((t,e,r)=>{t.append("marker").attr("id",r+"_"+e+"-crossEnd").attr("class","marker cross "+e).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"),t.append("marker").attr("id",r+"_"+e+"-crossStart").attr("class","marker cross "+e).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"),barb:s((t,e,r)=>{t.append("defs").append("marker").attr("id",r+"_"+e+"-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")},lt=ot,dt=(null==(e=null==(t=f())?void 0:t.block)?void 0:e.padding)??8;function ht(t,e){if(0===t||!Number.isInteger(t))throw new Error("Columns must be an integer !== 0.");if(e<0||!Number.isInteger(e))throw new Error("Position must be a non-negative integer."+e);if(t<0)return{px:e,py:0};if(1===t)return{px:0,py:e};return{px:e%t,py:Math.floor(e/t)}}s(ht,"calculateBlockPosition");var ut=s(t=>{let e=0,r=0;for(const s of t.children){const{width:n,height:i,x:a,y:c}=s.size??{width:0,height:0,x:0,y:0};o.debug("getMaxChildSize abc95 child:",s.id,"width:",n,"height:",i,"x:",a,"y:",c,s.type),"space"!==s.type&&(n>e&&(e=n/(t.widthInColumns??1)),i>r&&(r=i))}return{width:e,height:r}},"getMaxChildSize");function ft(t,e,r=0,s=0){var n,i,a,c,l,d,h,u,f,y,x;o.debug("setBlockSizes abc95 (start)",t.id,null==(n=null==t?void 0:t.size)?void 0:n.x,"block width =",null==t?void 0:t.size,"siblingWidth",r),(null==(i=null==t?void 0:t.size)?void 0:i.width)||(t.size={width:r,height:s,x:0,y:0});let p=0,g=0;if((null==(a=t.children)?void 0:a.length)>0){for(const r of t.children)ft(r,e);const n=ut(t);p=n.width,g=n.height,o.debug("setBlockSizes abc95 maxWidth of",t.id,":s children is ",p,g);for(const e of t.children)e.size&&(o.debug(`abc95 Setting size of children of ${t.id} id=${e.id} ${p} ${g} ${JSON.stringify(e.size)}`),e.size.width=p*(e.widthInColumns??1)+dt*((e.widthInColumns??1)-1),e.size.height=g,e.size.x=0,e.size.y=0,o.debug(`abc95 updating size of ${t.id} children child:${e.id} maxWidth:${p} maxHeight:${g}`));for(const r of t.children)ft(r,e,p,g);const i=t.columns??-1;let a=0;for(const e of t.children)a+=e.widthInColumns??1;let u=t.children.length;i>0&&i<a&&(u=i);const f=Math.ceil(a/u);let y=u*(p+dt)+dt,x=f*(g+dt)+dt;if(y<r){o.debug(`Detected to small sibling: abc95 ${t.id} siblingWidth ${r} siblingHeight ${s} width ${y}`),y=r,x=s;const e=(r-u*dt-dt)/u,n=(s-f*dt-dt)/f;o.debug("Size indata abc88",t.id,"childWidth",e,"maxWidth",p),o.debug("Size indata abc88",t.id,"childHeight",n,"maxHeight",g),o.debug("Size indata abc88 xSize",u,"padding",dt);for(const r of t.children)r.size&&(r.size.width=e,r.size.height=n,r.size.x=0,r.size.y=0)}if(o.debug(`abc95 (finale calc) ${t.id} xSize ${u} ySize ${f} columns ${i}${t.children.length} width=${Math.max(y,(null==(c=t.size)?void 0:c.width)||0)}`),y<((null==(l=null==t?void 0:t.size)?void 0:l.width)||0)){y=(null==(d=null==t?void 0:t.size)?void 0:d.width)||0;const e=i>0?Math.min(t.children.length,i):t.children.length;if(e>0){const r=(y-e*dt-dt)/e;o.debug("abc95 (growing to fit) width",t.id,y,null==(h=t.size)?void 0:h.width,r);for(const e of t.children)e.size&&(e.size.width=r)}}t.size={width:y,height:x,x:0,y:0}}o.debug("setBlockSizes abc94 (done)",t.id,null==(u=null==t?void 0:t.size)?void 0:u.x,null==(f=null==t?void 0:t.size)?void 0:f.width,null==(y=null==t?void 0:t.size)?void 0:y.y,null==(x=null==t?void 0:t.size)?void 0:x.height)}function yt(t,e){var r,s,n,i,a,c,l,d,h,u,f,y,x,p,g,b,m;o.debug(`abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${null==(r=null==t?void 0:t.size)?void 0:r.x} y: ${null==(s=null==t?void 0:t.size)?void 0:s.y} width: ${null==(n=null==t?void 0:t.size)?void 0:n.width}`);const k=t.columns??-1;if(o.debug("layoutBlocks columns abc95",t.id,"=>",k,t),t.children&&t.children.length>0){const e=(null==(a=null==(i=null==t?void 0:t.children[0])?void 0:i.size)?void 0:a.width)??0,r=t.children.length*e+(t.children.length-1)*dt;o.debug("widthOfChildren 88",r,"posX");let s=0;o.debug("abc91 block?.size?.x",t.id,null==(c=null==t?void 0:t.size)?void 0:c.x);let n=(null==(l=null==t?void 0:t.size)?void 0:l.x)?(null==(d=null==t?void 0:t.size)?void 0:d.x)+(-(null==(h=null==t?void 0:t.size)?void 0:h.width)/2||0):-dt,g=0;for(const i of t.children){const e=t;if(!i.size)continue;const{width:r,height:a}=i.size,{px:c,py:l}=ht(k,s);if(l!=g&&(g=l,n=(null==(u=null==t?void 0:t.size)?void 0:u.x)?(null==(f=null==t?void 0:t.size)?void 0:f.x)+(-(null==(y=null==t?void 0:t.size)?void 0:y.width)/2||0):-dt,o.debug("New row in layout for block",t.id," and child ",i.id,g)),o.debug(`abc89 layout blocks (child) id: ${i.id} Pos: ${s} (px, py) ${c},${l} (${null==(x=null==e?void 0:e.size)?void 0:x.x},${null==(p=null==e?void 0:e.size)?void 0:p.y}) parent: ${e.id} width: ${r}${dt}`),e.size){const t=r/2;i.size.x=n+dt+t,o.debug(`abc91 layout blocks (calc) px, pyid:${i.id} startingPos=X${n} new startingPosX${i.size.x} ${t} padding=${dt} width=${r} halfWidth=${t} => x:${i.size.x} y:${i.size.y} ${i.widthInColumns} (width * (child?.w || 1)) / 2 ${r*((null==i?void 0:i.widthInColumns)??1)/2}`),n=i.size.x+t,i.size.y=e.size.y-e.size.height/2+l*(a+dt)+a/2+dt,o.debug(`abc88 layout blocks (calc) px, pyid:${i.id}startingPosX${n}${dt}${t}=>x:${i.size.x}y:${i.size.y}${i.widthInColumns}(width * (child?.w || 1)) / 2${r*((null==i?void 0:i.widthInColumns)??1)/2}`)}i.children&&yt(i);let d=(null==i?void 0:i.widthInColumns)??1;k>0&&(d=Math.min(d,k-s%k)),s+=d,o.debug("abc88 columnsPos",i,s)}}o.debug(`layout blocks (<==layoutBlocks) ${t.id} x: ${null==(g=null==t?void 0:t.size)?void 0:g.x} y: ${null==(b=null==t?void 0:t.size)?void 0:b.y} width: ${null==(m=null==t?void 0:t.size)?void 0:m.width}`)}function xt(t,{minX:e,minY:r,maxX:s,maxY:n}={minX:0,minY:0,maxX:0,maxY:0}){if(t.size&&"root"!==t.id){const{x:i,y:a,width:o,height:c}=t.size;i-o/2<e&&(e=i-o/2),a-c/2<r&&(r=a-c/2),i+o/2>s&&(s=i+o/2),a+c/2>n&&(n=a+c/2)}if(t.children)for(const i of t.children)({minX:e,minY:r,maxX:s,maxY:n}=xt(i,{minX:e,minY:r,maxX:s,maxY:n}));return{minX:e,minY:r,maxX:s,maxY:n}}function pt(t){const e=t.getBlock("root");if(!e)return;ft(e,t,0,0),yt(e),o.debug("getBlocks",JSON.stringify(e,null,2));const{minX:r,minY:s,maxX:n,maxY:i}=xt(e);return{x:r,y:s,width:n-r,height:i-s}}function gt(t,e){e&&t.attr("style",e)}function bt(t,e){const r=i(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),s=r.append("xhtml:div"),n=t.label,a=t.isNode?"nodeLabel":"edgeLabel",o=s.append("span");return o.html(v(n,e)),gt(o,t.labelStyle),o.attr("class",a),gt(s,t.labelStyle),s.style("display","inline-block"),s.style("white-space","nowrap"),s.attr("xmlns","http://www.w3.org/1999/xhtml"),r.node()}s(ft,"setBlockSizes"),s(yt,"layoutBlocks"),s(xt,"findBounds"),s(pt,"layout"),s(gt,"applyStyle"),s(bt,"addHtmlLabel");var mt=s(async(t,e,r,s)=>{let n=t||"";"object"==typeof n&&(n=n[0]);const i=f();if(x(i.flowchart.htmlLabels)){n=n.replace(/\\n|\n/g,"<br />"),o.debug("vertexText"+n);return bt({isNode:s,label:await k(w(n)),labelStyle:e.replace("fill:","color:")},i)}{const t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("style",e.replace("color:","fill:"));let s=[];s="string"==typeof n?n.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(n)?n:[];for(const e of s){const s=document.createElementNS("http://www.w3.org/2000/svg","tspan");s.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),s.setAttribute("dy","1em"),s.setAttribute("x","0"),r?s.setAttribute("class","title-row"):s.setAttribute("class","row"),s.textContent=e.trim(),t.appendChild(s)}return t}},"createLabel"),kt=s((t,e,r,s,n)=>{e.arrowTypeStart&&vt(t,"start",e.arrowTypeStart,r,s,n),e.arrowTypeEnd&&vt(t,"end",e.arrowTypeEnd,r,s,n)},"addEdgeMarkers"),wt={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},vt=s((t,e,r,s,n,i)=>{const a=wt[r];if(!a)return void o.warn(`Unknown arrow type: ${r}`);const c="start"===e?"Start":"End";t.attr(`marker-${e}`,`url(${s}#${n}_${i}-${a}${c})`)},"addEdgeMarker"),St={},_t={},Lt=s(async(t,e)=>{const r=f(),s=x(r.flowchart.htmlLabels),n="markdown"===e.labelType?p(t,e.label,{style:e.labelStyle,useHtmlLabels:s,addSvgBackground:!0},r):await mt(e.label,e.labelStyle),a=t.insert("g").attr("class","edgeLabel"),o=a.insert("g").attr("class","label");o.node().appendChild(n);let c,l=n.getBBox();if(s){const t=n.children[0],e=i(n);l=t.getBoundingClientRect(),e.attr("width",l.width),e.attr("height",l.height)}if(o.attr("transform","translate("+-l.width/2+", "+-l.height/2+")"),St[e.id]=a,e.width=l.width,e.height=l.height,e.startLabelLeft){const r=await mt(e.startLabelLeft,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),_t[e.id]||(_t[e.id]={}),_t[e.id].startLeft=s,Et(c,e.startLabelLeft)}if(e.startLabelRight){const r=await mt(e.startLabelRight,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=s.node().appendChild(r),n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),_t[e.id]||(_t[e.id]={}),_t[e.id].startRight=s,Et(c,e.startLabelRight)}if(e.endLabelLeft){const r=await mt(e.endLabelLeft,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),s.node().appendChild(r),_t[e.id]||(_t[e.id]={}),_t[e.id].endLeft=s,Et(c,e.endLabelLeft)}if(e.endLabelRight){const r=await mt(e.endLabelRight,e.labelStyle),s=t.insert("g").attr("class","edgeTerminals"),n=s.insert("g").attr("class","inner");c=n.node().appendChild(r);const i=r.getBBox();n.attr("transform","translate("+-i.width/2+", "+-i.height/2+")"),s.node().appendChild(r),_t[e.id]||(_t[e.id]={}),_t[e.id].endRight=s,Et(c,e.endLabelRight)}return n},"insertEdgeLabel");function Et(t,e){f().flowchart.htmlLabels&&t&&(t.style.width=9*e.length+"px",t.style.height="12px")}s(Et,"setTerminalWidth");var Dt=s((t,e)=>{o.debug("Moving label abc88 ",t.id,t.label,St[t.id],e);let r=e.updatedPath?e.updatedPath:e.originalPath;const s=f(),{subGraphTitleTotalMargin:n}=g(s);if(t.label){const s=St[t.id];let i=t.x,a=t.y;if(r){const s=b.calcLabelPosition(r);o.debug("Moving label "+t.label+" from (",i,",",a,") to (",s.x,",",s.y,") abc88"),e.updatedPath&&(i=s.x,a=s.y)}s.attr("transform",`translate(${i}, ${a+n/2})`)}if(t.startLabelLeft){const e=_t[t.id].startLeft;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.startLabelRight){const e=_t[t.id].startRight;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.endLabelLeft){const e=_t[t.id].endLeft;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}if(t.endLabelRight){const e=_t[t.id].endRight;let s=t.x,n=t.y;if(r){const e=b.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",r);s=e.x,n=e.y}e.attr("transform",`translate(${s}, ${n})`)}},"positionEdgeLabel"),$t=s((t,e)=>{const r=t.x,s=t.y,n=Math.abs(e.x-r),i=Math.abs(e.y-s),a=t.width/2,o=t.height/2;return n>=a||i>=o},"outsideNode"),Nt=s((t,e,r)=>{o.debug(`intersection calc abc89:\n outsidePoint: ${JSON.stringify(e)}\n insidePoint : ${JSON.stringify(r)}\n node : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);const s=t.x,n=t.y,i=Math.abs(s-r.x),a=t.width/2;let c=r.x<e.x?a-i:a+i;const l=t.height/2,d=Math.abs(e.y-r.y),h=Math.abs(e.x-r.x);if(Math.abs(n-e.y)*a>Math.abs(s-e.x)*l){let t=r.y<e.y?e.y-l-n:n-l-e.y;c=h*t/d;const s={x:r.x<e.x?r.x+c:r.x-h+c,y:r.y<e.y?r.y+d-t:r.y-d+t};return 0===c&&(s.x=e.x,s.y=e.y),0===h&&(s.x=e.x),0===d&&(s.y=e.y),o.debug(`abc89 topp/bott calc, Q ${d}, q ${t}, R ${h}, r ${c}`,s),s}{c=r.x<e.x?e.x-a-s:s-a-e.x;let t=d*c/h,n=r.x<e.x?r.x+h-c:r.x-h+c,i=r.y<e.y?r.y+t:r.y-t;return o.debug(`sides calc abc89, Q ${d}, q ${t}, R ${h}, r ${c}`,{_x:n,_y:i}),0===c&&(n=e.x,i=e.y),0===h&&(n=e.x),0===d&&(i=e.y),{x:n,y:i}}},"intersection"),Tt=s((t,e)=>{o.debug("abc88 cutPathAtIntersect",t,e);let r=[],s=t[0],n=!1;return t.forEach(t=>{if($t(e,t)||n)s=t,n||r.push(t);else{const i=Nt(e,s,t);let a=!1;r.forEach(t=>{a=a||t.x===i.x&&t.y===i.y}),r.some(t=>t.x===i.x&&t.y===i.y)||r.push(i),n=!0}}),r},"cutPathAtIntersect"),Ot=s(function(t,e,r,s,n,i,a){let c=r.points;o.debug("abc88 InsertEdge: edge=",r,"e=",e);let l=!1;const x=i.node(e.v);var p=i.node(e.w);(null==p?void 0:p.intersect)&&(null==x?void 0:x.intersect)&&(c=c.slice(1,r.points.length-1),c.unshift(x.intersect(c[0])),c.push(p.intersect(c[c.length-1]))),r.toCluster&&(o.debug("to cluster abc88",s[r.toCluster]),c=Tt(r.points,s[r.toCluster].node),l=!0),r.fromCluster&&(o.debug("from cluster abc88",s[r.fromCluster]),c=Tt(c.reverse(),s[r.fromCluster].node).reverse(),l=!0);const g=c.filter(t=>!Number.isNaN(t.y));let b=u;!r.curve||"graph"!==n&&"flowchart"!==n||(b=r.curve);const{x:m,y:k}=d(r),w=h().x(m).y(k).curve(b);let v;switch(r.thickness){case"normal":v="edge-thickness-normal";break;case"thick":case"invisible":v="edge-thickness-thick";break;default:v=""}switch(r.pattern){case"solid":v+=" edge-pattern-solid";break;case"dotted":v+=" edge-pattern-dotted";break;case"dashed":v+=" edge-pattern-dashed"}const S=t.append("path").attr("d",w(g)).attr("id",r.id).attr("class"," "+v+(r.classes?" "+r.classes:"")).attr("style",r.style);let _="";(f().flowchart.arrowMarkerAbsolute||f().state.arrowMarkerAbsolute)&&(_=y(!0)),kt(S,r,_,a,n);let L={};return l&&(L.updatedPath=c),L.originalPath=r.points,L},"insertEdge"),It=s(t=>{const e=new Set;for(const r of t)switch(r){case"x":e.add("right"),e.add("left");break;case"y":e.add("up"),e.add("down");break;default:e.add(r)}return e},"expandAndDeduplicateDirections"),Rt=s((t,e,r)=>{const s=It(t),n=e.height+2*r.padding,i=n/2,a=e.width+2*i+r.padding,o=r.padding/2;return s.has("right")&&s.has("left")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:i,y:0},{x:a/2,y:2*o},{x:a-i,y:0},{x:a,y:0},{x:a,y:-n/3},{x:a+2*o,y:-n/2},{x:a,y:-2*n/3},{x:a,y:-n},{x:a-i,y:-n},{x:a/2,y:-n-2*o},{x:i,y:-n},{x:0,y:-n},{x:0,y:-2*n/3},{x:-2*o,y:-n/2},{x:0,y:-n/3}]:s.has("right")&&s.has("left")&&s.has("up")?[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}]:s.has("right")&&s.has("left")&&s.has("down")?[{x:0,y:0},{x:i,y:-n},{x:a-i,y:-n},{x:a,y:0}]:s.has("right")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:a,y:-i},{x:a,y:-n+i},{x:0,y:-n}]:s.has("left")&&s.has("up")&&s.has("down")?[{x:a,y:0},{x:0,y:-i},{x:0,y:-n+i},{x:a,y:-n}]:s.has("right")&&s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n},{x:0,y:-n/2}]:s.has("up")&&s.has("down")?[{x:a/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-n+o},{x:0,y:-n+o},{x:a/2,y:-n},{x:a,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o},{x:a,y:-o}]:s.has("right")&&s.has("up")?[{x:0,y:0},{x:a,y:-i},{x:0,y:-n}]:s.has("right")&&s.has("down")?[{x:0,y:0},{x:a,y:0},{x:0,y:-n}]:s.has("left")&&s.has("up")?[{x:a,y:0},{x:0,y:-i},{x:a,y:-n}]:s.has("left")&&s.has("down")?[{x:a,y:0},{x:0,y:0},{x:a,y:-n}]:s.has("right")?[{x:i,y:-o},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n+o}]:s.has("left")?[{x:i,y:0},{x:i,y:-o},{x:a-i,y:-o},{x:a-i,y:-n+o},{x:i,y:-n+o},{x:i,y:-n},{x:0,y:-n/2}]:s.has("up")?[{x:i,y:-o},{x:i,y:-n+o},{x:0,y:-n+o},{x:a/2,y:-n},{x:a,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o}]:s.has("down")?[{x:a/2,y:0},{x:0,y:-o},{x:i,y:-o},{x:i,y:-n+o},{x:a-i,y:-n+o},{x:a-i,y:-o},{x:a,y:-o}]:[{x:0,y:0}]},"getArrowPoints");function At(t,e){return t.intersect(e)}s(At,"intersectNode");var Mt=At;function Ct(t,e,r,s){var n=t.x,i=t.y,a=n-s.x,o=i-s.y,c=Math.sqrt(e*e*o*o+r*r*a*a),l=Math.abs(e*r*a/c);s.x<n&&(l=-l);var d=Math.abs(e*r*o/c);return s.y<i&&(d=-d),{x:n+l,y:i+d}}s(Ct,"intersectEllipse");var Bt=Ct;function Pt(t,e,r){return Bt(t,e,e,r)}s(Pt,"intersectCircle");var Yt=Pt;function Xt(t,e,r,s){var n,i,a,o,c,l,d,h,u,f,y,x,p;if(n=e.y-t.y,a=t.x-e.x,c=e.x*t.y-t.x*e.y,u=n*r.x+a*r.y+c,f=n*s.x+a*s.y+c,!(0!==u&&0!==f&&Wt(u,f)||(i=s.y-r.y,o=r.x-s.x,l=s.x*r.y-r.x*s.y,d=i*t.x+o*t.y+l,h=i*e.x+o*e.y+l,0!==d&&0!==h&&Wt(d,h)||0===(y=n*o-i*a))))return x=Math.abs(y/2),{x:(p=a*l-o*c)<0?(p-x)/y:(p+x)/y,y:(p=i*c-n*l)<0?(p-x)/y:(p+x)/y}}function Wt(t,e){return t*e>0}s(Xt,"intersectLine"),s(Wt,"sameSign");var zt=Xt,Ft=Ut;function Ut(t,e,r){var s=t.x,n=t.y,i=[],a=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;"function"==typeof e.forEach?e.forEach(function(t){a=Math.min(a,t.x),o=Math.min(o,t.y)}):(a=Math.min(a,e.x),o=Math.min(o,e.y));for(var c=s-t.width/2-a,l=n-t.height/2-o,d=0;d<e.length;d++){var h=e[d],u=e[d<e.length-1?d+1:0],f=zt(t,r,{x:c+h.x,y:l+h.y},{x:c+u.x,y:l+u.y});f&&i.push(f)}return i.length?(i.length>1&&i.sort(function(t,e){var s=t.x-r.x,n=t.y-r.y,i=Math.sqrt(s*s+n*n),a=e.x-r.x,o=e.y-r.y,c=Math.sqrt(a*a+o*o);return i<c?-1:i===c?0:1}),i[0]):t}s(Ut,"intersectPolygon");var Ht={node:Mt,circle:Yt,ellipse:Bt,polygon:Ft,rect:s((t,e)=>{var r,s,n=t.x,i=t.y,a=e.x-n,o=e.y-i,c=t.width/2,l=t.height/2;return Math.abs(o)*c>Math.abs(a)*l?(o<0&&(l=-l),r=0===o?0:l*a/o,s=l):(a<0&&(c=-c),r=c,s=0===a?0:c*o/a),{x:n+r,y:i+s}},"intersectRect")},Kt=s(async(t,e,r,n)=>{const a=f();let o;const c=e.useHtmlLabels||x(a.flowchart.htmlLabels);o=r||"node default";const l=t.insert("g").attr("class",o).attr("id",e.domId||e.id),d=l.insert("g").attr("class","label").attr("style",e.labelStyle);let h;h=void 0===e.labelText?"":"string"==typeof e.labelText?e.labelText:e.labelText[0];const u=d.node();let y;y="markdown"===e.labelType?p(d,v(w(h),a),{useHtmlLabels:c,width:e.width||a.flowchart.wrappingWidth,classes:"markdown-node-label"},a):u.appendChild(await mt(v(w(h),a),e.labelStyle,!1,n));let g=y.getBBox();const b=e.padding/2;if(x(a.flowchart.htmlLabels)){const t=y.children[0],e=i(y),r=t.getElementsByTagName("img");if(r){const t=""===h.replace(/<img[^>]*>/g,"").trim();await Promise.all([...r].map(e=>new Promise(r=>{function n(){if(e.style.display="flex",e.style.flexDirection="column",t){const t=a.fontSize?a.fontSize:window.getComputedStyle(document.body).fontSize,r=5,s=parseInt(t,10)*r+"px";e.style.minWidth=s,e.style.maxWidth=s}else e.style.width="100%";r(e)}s(n,"setupImage"),setTimeout(()=>{e.complete&&n()}),e.addEventListener("error",n),e.addEventListener("load",n)})))}g=t.getBoundingClientRect(),e.attr("width",g.width),e.attr("height",g.height)}return c?d.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"):d.attr("transform","translate(0, "+-g.height/2+")"),e.centerLabel&&d.attr("transform","translate("+-g.width/2+", "+-g.height/2+")"),d.insert("rect",":first-child"),{shapeSvg:l,bbox:g,halfPadding:b,label:d}},"labelHelper"),jt=s((t,e)=>{const r=e.node().getBBox();t.width=r.width,t.height=r.height},"updateNodeBounds");function Zt(t,e,r,s){return t.insert("polygon",":first-child").attr("points",s.map(function(t){return t.x+","+t.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-e/2+","+r/2+")")}s(Zt,"insertPolygonShape");var qt=s(async(t,e)=>{e.useHtmlLabels||f().flowchart.htmlLabels||(e.centerLabel=!0);const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes,!0);o.info("Classes = ",e.classes);const i=r.insert("rect",":first-child");return i.attr("rx",e.rx).attr("ry",e.ry).attr("x",-s.width/2-n).attr("y",-s.height/2-n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"note"),Gt=s(t=>t?" "+t:"","formatClass"),Jt=s((t,e)=>`${e||"node default"}${Gt(t.classes)} ${Gt(t.class)}`,"getClassesFromNode"),Qt=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding+(s.height+e.padding),i=[{x:n/2,y:0},{x:n,y:-n/2},{x:n/2,y:-n},{x:0,y:-n/2}];o.info("Question main (Circle)");const a=Zt(r,n,n,i);return a.attr("style",e.style),jt(e,a),e.intersect=function(t){return o.warn("Intersect called"),Ht.polygon(e,i,t)},r},"question"),Vt=s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=[{x:0,y:14},{x:14,y:0},{x:0,y:-14},{x:-14,y:0}];return r.insert("polygon",":first-child").attr("points",s.map(function(t){return t.x+","+t.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),e.width=28,e.height=28,e.intersect=function(t){return Ht.circle(e,14,t)},r},"choice"),te=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.height+e.padding,i=n/4,a=s.width+2*i+e.padding,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}],c=Zt(r,a,n,o);return c.attr("style",e.style),jt(e,c),e.intersect=function(t){return Ht.polygon(e,o,t)},r},"hexagon"),ee=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,void 0,!0),n=s.height+2*e.padding,i=n/2,a=s.width+2*i+e.padding,o=Rt(e.directions,s,e),c=Zt(r,a,n,o);return c.attr("style",e.style),jt(e,c),e.intersect=function(t){return Ht.polygon(e,o,t)},r},"block_arrow"),re=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-i/2,y:0},{x:n,y:0},{x:n,y:-i},{x:-i/2,y:-i},{x:0,y:-i/2}];return Zt(r,n,i,a).attr("style",e.style),e.width=n+i,e.height=i,e.intersect=function(t){return Ht.polygon(e,a,t)},r},"rect_left_inv_arrow"),se=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-2*i/6,y:0},{x:n-i/6,y:0},{x:n+2*i/6,y:-i},{x:i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"lean_right"),ne=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:2*i/6,y:0},{x:n+i/6,y:0},{x:n-2*i/6,y:-i},{x:-i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"lean_left"),ie=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:-2*i/6,y:0},{x:n+2*i/6,y:0},{x:n-i/6,y:-i},{x:i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"trapezoid"),ae=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:i/6,y:0},{x:n-i/6,y:0},{x:n+2*i/6,y:-i},{x:-2*i/6,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"inv_trapezoid"),oe=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:0,y:0},{x:n+i/2,y:0},{x:n,y:-i/2},{x:n+i/2,y:-i},{x:0,y:-i}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"rect_right_inv_arrow"),ce=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=n/2,a=i/(2.5+n/50),o=s.height+a+e.padding,c="M 0,"+a+" a "+i+","+a+" 0,0,0 "+n+" 0 a "+i+","+a+" 0,0,0 "+-n+" 0 l 0,"+o+" a "+i+","+a+" 0,0,0 "+n+" 0 l 0,"+-o,l=r.attr("label-offset-y",a).insert("path",":first-child").attr("style",e.style).attr("d",c).attr("transform","translate("+-n/2+","+-(o/2+a)+")");return jt(e,l),e.intersect=function(t){const r=Ht.rect(e,t),s=r.x-e.x;if(0!=i&&(Math.abs(s)<e.width/2||Math.abs(s)==e.width/2&&Math.abs(r.y-e.y)>e.height/2-a)){let n=a*a*(1-s*s/(i*i));0!=n&&(n=Math.sqrt(n)),n=a-n,t.y-e.y>0&&(n=-n),r.y+=n}return r},r},"cylinder"),le=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes+" "+e.class,!0),i=r.insert("rect",":first-child"),a=e.positioned?e.width:s.width+e.padding,c=e.positioned?e.height:s.height+e.padding,l=e.positioned?-a/2:-s.width/2-n,d=e.positioned?-c/2:-s.height/2-n;if(i.attr("class","basic label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",d).attr("width",a).attr("height",c),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(i,e.props.borders,a,c),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"rect"),de=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,"node "+e.classes,!0),i=r.insert("rect",":first-child"),a=e.positioned?e.width:s.width+e.padding,c=e.positioned?e.height:s.height+e.padding,l=e.positioned?-a/2:-s.width/2-n,d=e.positioned?-c/2:-s.height/2-n;if(i.attr("class","basic cluster composite label-container").attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",l).attr("y",d).attr("width",a).attr("height",c),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(i,e.props.borders,a,c),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,i),e.intersect=function(t){return Ht.rect(e,t)},r},"composite"),he=s(async(t,e)=>{const{shapeSvg:r}=await Kt(t,e,"label",!0);o.trace("Classes = ",e.class);const s=r.insert("rect",":first-child");if(s.attr("width",0).attr("height",0),r.attr("class","label edgeLabel"),e.props){const t=new Set(Object.keys(e.props));e.props.borders&&(ue(s,e.props.borders,0,0),t.delete("borders")),t.forEach(t=>{o.warn(`Unknown node property ${t}`)})}return jt(e,s),e.intersect=function(t){return Ht.rect(e,t)},r},"labelRect");function ue(t,e,r,n){const i=[],a=s(t=>{i.push(t,0)},"addBorder"),c=s(t=>{i.push(0,t)},"skipBorder");e.includes("t")?(o.debug("add top border"),a(r)):c(r),e.includes("r")?(o.debug("add right border"),a(n)):c(n),e.includes("b")?(o.debug("add bottom border"),a(r)):c(r),e.includes("l")?(o.debug("add left border"),a(n)):c(n),t.attr("stroke-dasharray",i.join(" "))}s(ue,"applyNodePropertyBorders");var fe=s(async(t,e)=>{let r;r=e.classes?"node "+e.classes:"node default";const s=t.insert("g").attr("class",r).attr("id",e.domId||e.id),n=s.insert("rect",":first-child"),a=s.insert("line"),c=s.insert("g").attr("class","label"),l=e.labelText.flat?e.labelText.flat():e.labelText;let d="";d="object"==typeof l?l[0]:l,o.info("Label text abc79",d,l,"object"==typeof l);const h=c.node().appendChild(await mt(d,e.labelStyle,!0,!0));let u={width:0,height:0};if(x(f().flowchart.htmlLabels)){const t=h.children[0],e=i(h);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}o.info("Text 2",l);const y=l.slice(1,l.length);let p=h.getBBox();const g=c.node().appendChild(await mt(y.join?y.join("<br/>"):y,e.labelStyle,!0,!0));if(x(f().flowchart.htmlLabels)){const t=g.children[0],e=i(g);u=t.getBoundingClientRect(),e.attr("width",u.width),e.attr("height",u.height)}const b=e.padding/2;return i(g).attr("transform","translate( "+(u.width>p.width?0:(p.width-u.width)/2)+", "+(p.height+b+5)+")"),i(h).attr("transform","translate( "+(u.width<p.width?0:-(p.width-u.width)/2)+", 0)"),u=c.node().getBBox(),c.attr("transform","translate("+-u.width/2+", "+(-u.height/2-b+3)+")"),n.attr("class","outer title-state").attr("x",-u.width/2-b).attr("y",-u.height/2-b).attr("width",u.width+e.padding).attr("height",u.height+e.padding),a.attr("class","divider").attr("x1",-u.width/2-b).attr("x2",u.width/2+b).attr("y1",-u.height/2-b+p.height+b).attr("y2",-u.height/2-b+p.height+b),jt(e,n),e.intersect=function(t){return Ht.rect(e,t)},s},"rectWithTitle"),ye=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.height+e.padding,i=s.width+n/4+e.padding,a=r.insert("rect",":first-child").attr("style",e.style).attr("rx",n/2).attr("ry",n/2).attr("x",-i/2).attr("y",-n/2).attr("width",i).attr("height",n);return jt(e,a),e.intersect=function(t){return Ht.rect(e,t)},r},"stadium"),xe=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,Jt(e,void 0),!0),i=r.insert("circle",":first-child");return i.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),o.info("Circle main"),jt(e,i),e.intersect=function(t){return o.info("Circle intersect",e,s.width/2+n,t),Ht.circle(e,s.width/2+n,t)},r},"circle"),pe=s(async(t,e)=>{const{shapeSvg:r,bbox:s,halfPadding:n}=await Kt(t,e,Jt(e,void 0),!0),i=r.insert("g",":first-child"),a=i.insert("circle"),c=i.insert("circle");return i.attr("class",e.class),a.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n+5).attr("width",s.width+e.padding+10).attr("height",s.height+e.padding+10),c.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("r",s.width/2+n).attr("width",s.width+e.padding).attr("height",s.height+e.padding),o.info("DoubleCircle main"),jt(e,a),e.intersect=function(t){return o.info("DoubleCircle intersect",e,s.width/2+n+5,t),Ht.circle(e,s.width/2+n+5,t)},r},"doublecircle"),ge=s(async(t,e)=>{const{shapeSvg:r,bbox:s}=await Kt(t,e,Jt(e,void 0),!0),n=s.width+e.padding,i=s.height+e.padding,a=[{x:0,y:0},{x:n,y:0},{x:n,y:-i},{x:0,y:-i},{x:0,y:0},{x:-8,y:0},{x:n+8,y:0},{x:n+8,y:-i},{x:-8,y:-i},{x:-8,y:0}],o=Zt(r,n,i,a);return o.attr("style",e.style),jt(e,o),e.intersect=function(t){return Ht.polygon(e,a,t)},r},"subroutine"),be=s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=r.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),jt(e,s),e.intersect=function(t){return Ht.circle(e,7,t)},r},"start"),me=s((t,e,r)=>{const s=t.insert("g").attr("class","node default").attr("id",e.domId||e.id);let n=70,i=10;"LR"===r&&(n=10,i=70);const a=s.append("rect").attr("x",-1*n/2).attr("y",-1*i/2).attr("width",n).attr("height",i).attr("class","fork-join");return jt(e,a),e.height=e.height+e.padding/2,e.width=e.width+e.padding/2,e.intersect=function(t){return Ht.rect(e,t)},s},"forkJoin"),ke={rhombus:Qt,composite:de,question:Qt,rect:le,labelRect:he,rectWithTitle:fe,choice:Vt,circle:xe,doublecircle:pe,stadium:ye,hexagon:te,block_arrow:ee,rect_left_inv_arrow:re,lean_right:se,lean_left:ne,trapezoid:ie,inv_trapezoid:ae,rect_right_inv_arrow:oe,cylinder:ce,start:be,end:s((t,e)=>{const r=t.insert("g").attr("class","node default").attr("id",e.domId||e.id),s=r.insert("circle",":first-child"),n=r.insert("circle",":first-child");return n.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),jt(e,n),e.intersect=function(t){return Ht.circle(e,7,t)},r},"end"),note:qt,subroutine:ge,fork:me,join:me,class_box:s(async(t,e)=>{var r;const s=e.padding/2;let n;n=e.classes?"node "+e.classes:"node default";const a=t.insert("g").attr("class",n).attr("id",e.domId||e.id),o=a.insert("rect",":first-child"),c=a.insert("line"),l=a.insert("line");let d=0,h=4;const u=a.insert("g").attr("class","label");let y=0;const p=null==(r=e.classData.annotations)?void 0:r[0],g=e.classData.annotations[0]?"«"+e.classData.annotations[0]+"»":"",b=u.node().appendChild(await mt(g,e.labelStyle,!0,!0));let m=b.getBBox();if(x(f().flowchart.htmlLabels)){const t=b.children[0],e=i(b);m=t.getBoundingClientRect(),e.attr("width",m.width),e.attr("height",m.height)}e.classData.annotations[0]&&(h+=m.height+4,d+=m.width);let k=e.classData.label;void 0!==e.classData.type&&""!==e.classData.type&&(f().flowchart.htmlLabels?k+="&lt;"+e.classData.type+"&gt;":k+="<"+e.classData.type+">");const w=u.node().appendChild(await mt(k,e.labelStyle,!0,!0));i(w).attr("class","classTitle");let v=w.getBBox();if(x(f().flowchart.htmlLabels)){const t=w.children[0],e=i(w);v=t.getBoundingClientRect(),e.attr("width",v.width),e.attr("height",v.height)}h+=v.height+4,v.width>d&&(d=v.width);const S=[];e.classData.members.forEach(async t=>{const r=t.getDisplayDetails();let s=r.displayText;f().flowchart.htmlLabels&&(s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const n=u.node().appendChild(await mt(s,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let a=n.getBBox();if(x(f().flowchart.htmlLabels)){const t=n.children[0],e=i(n);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>d&&(d=a.width),h+=a.height+4,S.push(n)}),h+=8;const _=[];if(e.classData.methods.forEach(async t=>{const r=t.getDisplayDetails();let s=r.displayText;f().flowchart.htmlLabels&&(s=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"));const n=u.node().appendChild(await mt(s,r.cssStyle?r.cssStyle:e.labelStyle,!0,!0));let a=n.getBBox();if(x(f().flowchart.htmlLabels)){const t=n.children[0],e=i(n);a=t.getBoundingClientRect(),e.attr("width",a.width),e.attr("height",a.height)}a.width>d&&(d=a.width),h+=a.height+4,_.push(n)}),h+=8,p){let t=(d-m.width)/2;i(b).attr("transform","translate( "+(-1*d/2+t)+", "+-1*h/2+")"),y=m.height+4}let L=(d-v.width)/2;return i(w).attr("transform","translate( "+(-1*d/2+L)+", "+(-1*h/2+y)+")"),y+=v.height+4,c.attr("class","divider").attr("x1",-d/2-s).attr("x2",d/2+s).attr("y1",-h/2-s+8+y).attr("y2",-h/2-s+8+y),y+=8,S.forEach(t=>{i(t).attr("transform","translate( "+-d/2+", "+(-1*h/2+y+4)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4}),y+=8,l.attr("class","divider").attr("x1",-d/2-s).attr("x2",d/2+s).attr("y1",-h/2-s+8+y).attr("y2",-h/2-s+8+y),y+=8,_.forEach(t=>{i(t).attr("transform","translate( "+-d/2+", "+(-1*h/2+y)+")");const e=null==t?void 0:t.getBBox();y+=((null==e?void 0:e.height)??0)+4}),o.attr("style",e.style).attr("class","outer title-state").attr("x",-d/2-s).attr("y",-h/2-s).attr("width",d+e.padding).attr("height",h+e.padding),jt(e,o),e.intersect=function(t){return Ht.rect(e,t)},a},"class_box")},we={},ve=s(async(t,e,r)=>{let s,n;if(e.link){let i;"sandbox"===f().securityLevel?i="_top":e.linkTarget&&(i=e.linkTarget||"_blank"),s=t.insert("svg:a").attr("xlink:href",e.link).attr("target",i),n=await ke[e.shape](s,e,r)}else n=await ke[e.shape](t,e,r),s=n;return e.tooltip&&n.attr("title",e.tooltip),e.class&&n.attr("class","node default "+e.class),we[e.id]=s,e.haveCallback&&we[e.id].attr("class",we[e.id].attr("class")+" clickable"),s},"insertNode"),Se=s(t=>{const e=we[t.id];o.trace("Transforming node",t.diff,t,"translate("+(t.x-t.width/2-5)+", "+t.width/2+")");const r=t.diff||0;return t.clusterNode?e.attr("transform","translate("+(t.x+r-t.width/2)+", "+(t.y-t.height/2-8)+")"):e.attr("transform","translate("+t.x+", "+t.y+")"),r},"positionNode");function _e(t,e,r=!1){var s,i,a;const o=t;let c="default";((null==(s=null==o?void 0:o.classes)?void 0:s.length)||0)>0&&(c=((null==o?void 0:o.classes)??[]).join(" ")),c+=" flowchart-label";let l,d=0,h="";switch(o.type){case"round":d=5,h="rect";break;case"composite":d=0,h="composite",l=0;break;case"square":case"group":default:h="rect";break;case"diamond":h="question";break;case"hexagon":h="hexagon";break;case"block_arrow":h="block_arrow";break;case"odd":case"rect_left_inv_arrow":h="rect_left_inv_arrow";break;case"lean_right":h="lean_right";break;case"lean_left":h="lean_left";break;case"trapezoid":h="trapezoid";break;case"inv_trapezoid":h="inv_trapezoid";break;case"circle":h="circle";break;case"ellipse":h="ellipse";break;case"stadium":h="stadium";break;case"subroutine":h="subroutine";break;case"cylinder":h="cylinder";break;case"doublecircle":h="doublecircle"}const u=S((null==o?void 0:o.styles)??[]),f=o.label,y=o.size??{width:0,height:0,x:0,y:0};return{labelStyle:u.labelStyle,shape:h,labelText:f,rx:d,ry:d,class:c,style:u.style,id:o.id,directions:o.directions,width:y.width,height:y.height,x:y.x,y:y.y,positioned:r,intersect:void 0,type:o.type,padding:l??(null==(a=null==(i=n())?void 0:i.block)?void 0:a.padding)??0}}async function Le(t,e,r){const s=_e(e,0,!1);if("group"===s.type)return;const i=n(),a=await ve(t,s,{config:i}),o=a.node().getBBox(),c=r.getBlock(s.id);c.size={width:o.width,height:o.height,x:0,y:0,node:a},r.setBlock(c),a.remove()}async function Ee(t,e,r){const s=_e(e,0,!0);if("space"!==r.getBlock(s.id).type){const r=n();await ve(t,s,{config:r}),e.intersect=null==s?void 0:s.intersect,Se(s)}}async function De(t,e,r,s){for(const n of e)await s(t,n,r),n.children&&await De(t,n.children,r,s)}async function $e(t,e,r){await De(t,e,r,Le)}async function Ne(t,e,r){await De(t,e,r,Ee)}async function Te(t,e,r,s,n){const i=new L({multigraph:!0,compound:!0});i.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(const a of r)a.size&&i.setNode(a.id,{width:a.size.width,height:a.size.height,intersect:a.intersect});for(const a of e)if(a.start&&a.end){const e=s.getBlock(a.start),r=s.getBlock(a.end);if((null==e?void 0:e.size)&&(null==r?void 0:r.size)){const s=e.size,o=r.size,c=[{x:s.x,y:s.y},{x:s.x+(o.x-s.x)/2,y:s.y+(o.y-s.y)/2},{x:o.x,y:o.y}];Ot(t,{v:a.start,w:a.end,name:a.id},{...a,arrowTypeEnd:a.arrowTypeEnd,arrowTypeStart:a.arrowTypeStart,points:c,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"},void 0,"block",i,n),a.label&&(await Lt(t,{...a,label:a.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:a.arrowTypeEnd,arrowTypeStart:a.arrowTypeStart,points:c,classes:"edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"}),Dt({...a,x:c[1].x,y:c[1].y},{originalPath:c}))}}}s(_e,"getNodeFromBlock"),s(Le,"calculateBlockSize"),s(Ee,"insertBlockPositioned"),s(De,"performOperations"),s($e,"calculateBlockSizes"),s(Ne,"insertBlocks"),s(Te,"insertEdges");var Oe=s(function(t,e){return e.db.getClasses()},"getClasses"),Ie={parser:$,db:nt,renderer:{draw:s(async function(t,e,r,s){const{securityLevel:c,block:l}=n(),d=s.db;let h;"sandbox"===c&&(h=i("#i"+e));const u=i("sandbox"===c?h.nodes()[0].contentDocument.body:"body"),f="sandbox"===c?u.select(`[id="${e}"]`):i(`[id="${e}"]`);lt(f,["point","circle","cross"],s.type,e);const y=d.getBlocks(),x=d.getBlocksFlat(),p=d.getEdges(),g=f.insert("g").attr("class","block");await $e(g,y,d);const b=pt(d);if(await Ne(g,y,d),await Te(g,p,x,d,e),b){const t=b,e=Math.max(1,Math.round(t.width/t.height*.125)),r=t.height+e+10,s=t.width+10,{useMaxWidth:n}=l;a(f,r,s,!!n),o.debug("Here Bounds",b,t),f.attr("viewBox",`${t.x-5} ${t.y-5} ${t.width+10} ${t.height+10}`)}},"draw"),getClasses:Oe},styles:at};export{Ie as diagram};