UNPKG

code-server

Version:

Run VS Code on a remote server.

141 lines (124 loc) • 41.3 kB
import{a as Pe}from"./chunk-Q2MXL6CD.js";import{a as Ee}from"./chunk-5EN3FUU5.js";import{C as Re}from"./chunk-3JG36FMP.js";import{g as Oe,i as ze,j as Be,k as Ae}from"./chunk-Q4UTCILM.js";import{b as ae,e as Ce}from"./chunk-RS4OOBDL.js";import"./chunk-KWINGM6W.js";import"./chunk-XJWARXV4.js";import"./chunk-HBYVLBIR.js";import"./chunk-6XUBHLNE.js";import"./chunk-G2EWPYLQ.js";import{b as De,c as Ie,d as Ne,f as Te,g as ve}from"./chunk-OZ4ASJEX.js";import{a as we,f as _e}from"./chunk-7RYOY7AM.js";import"./chunk-IAAAUKJX.js";import{$ as ie,C as R,O as Le,P as me,U as ye,a as xe,b as ke}from"./chunk-YX6DBKFT.js";import{b as m,h as Y}from"./chunk-TOKYXDRE.js";import{a as c}from"./chunk-TZZ523SA.js";import"./chunk-3RNHDNP5.js";var oe=(function(){var e=c(function(C,g,s,n){for(s=s||{},n=C.length;n--;s[C[n]]=g);return s},"o"),o=[1,15],l=[1,7],a=[1,13],h=[1,14],p=[1,19],t=[1,16],u=[1,17],x=[1,18],k=[8,30],b=[8,10,21,28,29,30,31,39,43,46],f=[1,23],L=[1,24],E=[8,10,15,16,21,28,29,30,31,39,43,46],S=[8,10,15,16,21,27,28,29,30,31,39,43,46],_=[1,49],w={trace:c(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:c(function(g,s,n,d,y,r,K){var i=r.length-1;switch(y){case 4:d.getLogger().debug("Rule: separator (NL) ");break;case 5:d.getLogger().debug("Rule: separator (Space) ");break;case 6:d.getLogger().debug("Rule: separator (EOF) ");break;case 7:d.getLogger().debug("Rule: hierarchy: ",r[i-1]),d.setHierarchy(r[i-1]);break;case 8:d.getLogger().debug("Stop NL ");break;case 9:d.getLogger().debug("Stop EOF ");break;case 10:d.getLogger().debug("Stop NL2 ");break;case 11:d.getLogger().debug("Stop EOF2 ");break;case 12:d.getLogger().debug("Rule: statement: ",r[i]),typeof r[i].length=="number"?this.$=r[i]:this.$=[r[i]];break;case 13:d.getLogger().debug("Rule: statement #2: ",r[i-1]),this.$=[r[i-1]].concat(r[i]);break;case 14:d.getLogger().debug("Rule: link: ",r[i],g),this.$={edgeTypeStr:r[i],label:""};break;case 15:d.getLogger().debug("Rule: LABEL link: ",r[i-3],r[i-1],r[i]),this.$={edgeTypeStr:r[i],label:r[i-1]};break;case 18:let F=parseInt(r[i]),V=d.generateId();this.$={id:V,type:"space",label:"",width:F,children:[]};break;case 23:d.getLogger().debug("Rule: (nodeStatement link node) ",r[i-2],r[i-1],r[i]," typestr: ",r[i-1].edgeTypeStr);let j=d.edgeStrToEdgeData(r[i-1].edgeTypeStr),Z=d.edgeStrToEdgeStartData(r[i-1].edgeTypeStr),U=d.edgeStrToThickness(r[i-1].edgeTypeStr),Q=d.edgeStrToPattern(r[i-1].edgeTypeStr);this.$=[{id:r[i-2].id,label:r[i-2].label,type:r[i-2].type,directions:r[i-2].directions},{id:r[i-2].id+"-"+r[i].id,start:r[i-2].id,end:r[i].id,label:r[i-1].label,type:"edge",thickness:U,pattern:Q,directions:r[i].directions,arrowTypeEnd:j,arrowTypeStart:Z},{id:r[i].id,label:r[i].label,type:d.typeStr2Type(r[i].typeStr),directions:r[i].directions}];break;case 24:d.getLogger().debug("Rule: nodeStatement (abc88 node size) ",r[i-1],r[i]),this.$={id:r[i-1].id,label:r[i-1].label,type:d.typeStr2Type(r[i-1].typeStr),directions:r[i-1].directions,widthInColumns:parseInt(r[i],10)};break;case 25:d.getLogger().debug("Rule: nodeStatement (node) ",r[i]),this.$={id:r[i].id,label:r[i].label,type:d.typeStr2Type(r[i].typeStr),directions:r[i].directions,widthInColumns:1};break;case 26:d.getLogger().debug("APA123",this?this:"na"),d.getLogger().debug("COLUMNS: ",r[i]),this.$={type:"column-setting",columns:r[i]==="auto"?-1:parseInt(r[i])};break;case 27:d.getLogger().debug("Rule: id-block statement : ",r[i-2],r[i-1]);let D=d.generateId();this.$={...r[i-2],type:"composite",children:r[i-1]};break;case 28:d.getLogger().debug("Rule: blockStatement : ",r[i-2],r[i-1],r[i]);let B=d.generateId();this.$={id:B,type:"composite",label:"",children:r[i-1]};break;case 29:d.getLogger().debug("Rule: node (NODE_ID separator): ",r[i]),this.$={id:r[i]};break;case 30:d.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",r[i-1],r[i]),this.$={id:r[i-1],label:r[i].label,typeStr:r[i].typeStr,directions:r[i].directions};break;case 31:d.getLogger().debug("Rule: dirList: ",r[i]),this.$=[r[i]];break;case 32:d.getLogger().debug("Rule: dirList: ",r[i-1],r[i]),this.$=[r[i-1]].concat(r[i]);break;case 33:d.getLogger().debug("Rule: nodeShapeNLabel: ",r[i-2],r[i-1],r[i]),this.$={typeStr:r[i-2]+r[i],label:r[i-1]};break;case 34:d.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",r[i-3],r[i-2]," #3:",r[i-1],r[i]),this.$={typeStr:r[i-3]+r[i],label:r[i-2],directions:r[i-1]};break;case 35:case 36:this.$={type:"classDef",id:r[i-1].trim(),css:r[i].trim()};break;case 37:this.$={type:"applyClass",id:r[i-1].trim(),styleClass:r[i].trim()};break;case 38:this.$={type:"applyStyles",id:r[i-1].trim(),stylesStr:r[i].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:o,11:3,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:a,29:h,31:p,39:t,43:u,46:x},{8:[1,20]},e(k,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:o,21:l,28:a,29:h,31:p,39:t,43:u,46:x}),e(b,[2,16],{14:22,15:f,16:L}),e(b,[2,17]),e(b,[2,18]),e(b,[2,19]),e(b,[2,20]),e(b,[2,21]),e(b,[2,22]),e(E,[2,25],{27:[1,25]}),e(b,[2,26]),{19:26,26:12,31:p},{10:o,11:27,13:4,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:a,29:h,31:p,39:t,43:u,46:x},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(S,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(k,[2,13]),{26:35,31:p},{31:[2,14]},{17:[1,36]},e(E,[2,24]),{10:o,11:37,13:4,14:22,15:f,16:L,19:5,20:6,21:l,22:8,23:9,24:10,25:11,26:12,28:a,29:h,31:p,39:t,43:u,46:x},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(S,[2,30]),{18:[1,43]},{18:[1,44]},e(E,[2,23]),{18:[1,45]},{30:[1,46]},e(b,[2,28]),e(b,[2,35]),e(b,[2,36]),e(b,[2,37]),e(b,[2,38]),{36:[1,47]},{33:48,34:_},{15:[1,50]},e(b,[2,27]),e(S,[2,33]),{38:[1,51]},{33:52,34:_,38:[2,31]},{31:[2,15]},e(S,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:c(function(g,s){if(s.recoverable)this.trace(g);else{var n=new Error(g);throw n.hash=s,n}},"parseError"),parse:c(function(g){var s=this,n=[0],d=[],y=[null],r=[],K=this.table,i="",F=0,V=0,j=0,Z=2,U=1,Q=r.slice.call(arguments,1),D=Object.create(this.lexer),B={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(B.yy[$]=this.yy[$]);D.setInput(g,B.yy),B.yy.lexer=D,B.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var ee=D.yylloc;r.push(ee);var rt=D.options&&D.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function st(T){n.length=n.length-2*T,y.length=y.length-T,r.length=r.length-T}c(st,"popStack");function be(){var T;return T=d.pop()||D.lex()||U,typeof T!="number"&&(T instanceof Array&&(d=T,T=d.pop()),T=s.symbols_[T]||T),T}c(be,"lex");for(var N,te,P,O,Ot,re,M={},H,A,Se,X;;){if(P=n[n.length-1],this.defaultActions[P]?O=this.defaultActions[P]:((N===null||typeof N>"u")&&(N=be()),O=K[P]&&K[P][N]),typeof O>"u"||!O.length||!O[0]){var se="";X=[];for(H in K[P])this.terminals_[H]&&H>Z&&X.push("'"+this.terminals_[H]+"'");D.showPosition?se="Parse error on line "+(F+1)+`: `+D.showPosition()+` Expecting `+X.join(", ")+", got '"+(this.terminals_[N]||N)+"'":se="Parse error on line "+(F+1)+": Unexpected "+(N==U?"end of input":"'"+(this.terminals_[N]||N)+"'"),this.parseError(se,{text:D.match,token:this.terminals_[N]||N,line:D.yylineno,loc:ee,expected:X})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+N);switch(O[0]){case 1:n.push(N),y.push(D.yytext),r.push(D.yylloc),n.push(O[1]),N=null,te?(N=te,te=null):(V=D.yyleng,i=D.yytext,F=D.yylineno,ee=D.yylloc,j>0&&j--);break;case 2:if(A=this.productions_[O[1]][1],M.$=y[y.length-A],M._$={first_line:r[r.length-(A||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(A||1)].first_column,last_column:r[r.length-1].last_column},rt&&(M._$.range=[r[r.length-(A||1)].range[0],r[r.length-1].range[1]]),re=this.performAction.apply(M,[i,V,F,B.yy,O[1],y,r].concat(Q)),typeof re<"u")return re;A&&(n=n.slice(0,-1*A*2),y=y.slice(0,-1*A),r=r.slice(0,-1*A)),n.push(this.productions_[O[1]][0]),y.push(M.$),r.push(M._$),Se=K[n[n.length-2]][n[n.length-1]],n.push(Se);break;case 3:return!0}}return!0},"parse")},I=(function(){var C={EOF:1,parseError:c(function(s,n){if(this.yy.parser)this.yy.parser.parseError(s,n);else throw new Error(s)},"parseError"),setInput:c(function(g,s){return this.yy=s||this.yy||{},this._input=g,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:c(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var s=g.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:c(function(g){var s=g.length,n=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var d=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),n.length-1&&(this.yylineno-=n.length-1);var y=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:n?(n.length===d.length?this.yylloc.first_column:0)+d[d.length-n.length].length-n[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(g){this.unput(this.match.slice(g))},"less"),pastInput:c(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var g=this.pastInput(),s=new Array(g.length+1).join("-");return g+this.upcomingInput()+` `+s+"^"},"showPosition"),test_match:c(function(g,s){var n,d,y;if(this.options.backtrack_lexer&&(y={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&&(y.yylloc.range=this.yylloc.range.slice(0))),d=g[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+g[0].length},this.yytext+=g[0],this.match+=g[0],this.matches=g,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(g[0].length),this.matched+=g[0],n=this.performAction.call(this,this.yy,this,s,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in y)this[r]=y[r];return!1}return!1},"test_match"),next:c(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,s,n,d;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),r=0;r<y.length;r++)if(n=this._input.match(this.rules[y[r]]),n&&(!s||n[0].length>s[0].length)){if(s=n,d=r,this.options.backtrack_lexer){if(g=this.test_match(n,y[r]),g!==!1)return g;if(this._backtrack){s=!1;continue}else return!1}else if(!this.options.flex)break}return s?(g=this.test_match(s,y[d]),g!==!1?g:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:c(function(){var s=this.next();return s||this.lex()},"lex"),begin:c(function(s){this.conditionStack.push(s)},"begin"),popState:c(function(){var s=this.conditionStack.length-1;return s>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:c(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:c(function(s){return s=this.conditionStack.length-1-Math.abs(s||0),s>=0?this.conditionStack[s]:"INITIAL"},"topState"),pushState:c(function(s){this.begin(s)},"pushState"),stateStackSize:c(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:c(function(s,n,d,y){var r=y;switch(d){case 0:return s.getLogger().debug("Found block-beta"),10;break;case 1:return s.getLogger().debug("Found id-block"),29;break;case 2:return s.getLogger().debug("Found block"),10;break;case 3:s.getLogger().debug(".",n.yytext);break;case 4:s.getLogger().debug("_",n.yytext);break;case 5:return 5;case 6:return n.yytext=-1,28;break;case 7:return n.yytext=n.yytext.replace(/columns\s+/,""),s.getLogger().debug("COLUMNS (LEX)",n.yytext),28;break;case 8:this.pushState("md_string");break;case 9:return"MD_STR";case 10:this.popState();break;case 11:this.pushState("string");break;case 12:s.getLogger().debug("LEX: POPPING STR:",n.yytext),this.popState();break;case 13:return s.getLogger().debug("LEX: STR end:",n.yytext),"STR";break;case 14:return n.yytext=n.yytext.replace(/space\:/,""),s.getLogger().debug("SPACE NUM (LEX)",n.yytext),21;break;case 15:return n.yytext="1",s.getLogger().debug("COLUMNS (LEX)",n.yytext),21;break;case 16:return 42;case 17:return"LINKSTYLE";case 18:return"INTERPOLATE";case 19:return this.pushState("CLASSDEF"),39;break;case 20:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 21:return this.popState(),this.pushState("CLASSDEFID"),40;break;case 22:return this.popState(),41;break;case 23:return this.pushState("CLASS"),43;break;case 24:return this.popState(),this.pushState("CLASS_STYLE"),44;break;case 25:return this.popState(),45;break;case 26:return this.pushState("STYLE_STMNT"),46;break;case 27:return this.popState(),this.pushState("STYLE_DEFINITION"),47;break;case 28:return this.popState(),48;break;case 29:return this.pushState("acc_title"),"acc_title";break;case 30:return this.popState(),"acc_title_value";break;case 31:return this.pushState("acc_descr"),"acc_descr";break;case 32:return this.popState(),"acc_descr_value";break;case 33:this.pushState("acc_descr_multiline");break;case 34:this.popState();break;case 35:return"acc_descr_multiline_value";case 36:return 30;case 37:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 38:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 39:return this.popState(),s.getLogger().debug("Lex: ))"),"NODE_DEND";break;case 40:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 41:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 42:return this.popState(),s.getLogger().debug("Lex: (-"),"NODE_DEND";break;case 43:return this.popState(),s.getLogger().debug("Lex: -)"),"NODE_DEND";break;case 44:return this.popState(),s.getLogger().debug("Lex: (("),"NODE_DEND";break;case 45:return this.popState(),s.getLogger().debug("Lex: ]]"),"NODE_DEND";break;case 46:return this.popState(),s.getLogger().debug("Lex: ("),"NODE_DEND";break;case 47:return this.popState(),s.getLogger().debug("Lex: ])"),"NODE_DEND";break;case 48:return this.popState(),s.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 49:return this.popState(),s.getLogger().debug("Lex: /]"),"NODE_DEND";break;case 50:return this.popState(),s.getLogger().debug("Lex: )]"),"NODE_DEND";break;case 51:return this.popState(),s.getLogger().debug("Lex: )"),"NODE_DEND";break;case 52:return this.popState(),s.getLogger().debug("Lex: ]>"),"NODE_DEND";break;case 53:return this.popState(),s.getLogger().debug("Lex: ]"),"NODE_DEND";break;case 54:return s.getLogger().debug("Lexa: -)"),this.pushState("NODE"),35;break;case 55:return s.getLogger().debug("Lexa: (-"),this.pushState("NODE"),35;break;case 56:return s.getLogger().debug("Lexa: ))"),this.pushState("NODE"),35;break;case 57:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 58:return s.getLogger().debug("Lex: ((("),this.pushState("NODE"),35;break;case 59:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 60:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 61:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 62:return s.getLogger().debug("Lexc: >"),this.pushState("NODE"),35;break;case 63:return s.getLogger().debug("Lexa: (["),this.pushState("NODE"),35;break;case 64:return s.getLogger().debug("Lexa: )"),this.pushState("NODE"),35;break;case 65:return this.pushState("NODE"),35;break;case 66:return this.pushState("NODE"),35;break;case 67:return this.pushState("NODE"),35;break;case 68:return this.pushState("NODE"),35;break;case 69:return this.pushState("NODE"),35;break;case 70:return this.pushState("NODE"),35;break;case 71:return this.pushState("NODE"),35;break;case 72:return s.getLogger().debug("Lexa: ["),this.pushState("NODE"),35;break;case 73:return this.pushState("BLOCK_ARROW"),s.getLogger().debug("LEX ARR START"),37;break;case 74:return s.getLogger().debug("Lex: NODE_ID",n.yytext),31;break;case 75:return s.getLogger().debug("Lex: EOF",n.yytext),8;break;case 76:this.pushState("md_string");break;case 77:this.pushState("md_string");break;case 78:return"NODE_DESCR";case 79:this.popState();break;case 80:s.getLogger().debug("Lex: Starting string"),this.pushState("string");break;case 81:s.getLogger().debug("LEX ARR: Starting string"),this.pushState("string");break;case 82:return s.getLogger().debug("LEX: NODE_DESCR:",n.yytext),"NODE_DESCR";break;case 83:s.getLogger().debug("LEX POPPING"),this.popState();break;case 84:s.getLogger().debug("Lex: =>BAE"),this.pushState("ARROW_DIR");break;case 85:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (right): dir:",n.yytext),"DIR";break;case 86:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (left):",n.yytext),"DIR";break;case 87:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (x):",n.yytext),"DIR";break;case 88:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (y):",n.yytext),"DIR";break;case 89:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (up):",n.yytext),"DIR";break;case 90:return n.yytext=n.yytext.replace(/^,\s*/,""),s.getLogger().debug("Lex (down):",n.yytext),"DIR";break;case 91:return n.yytext="]>",s.getLogger().debug("Lex (ARROW_DIR end):",n.yytext),this.popState(),this.popState(),"BLOCK_ARROW_END";break;case 92:return s.getLogger().debug("Lex: LINK","#"+n.yytext+"#"),15;break;case 93:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 94:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 95:return s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 96:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 97:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 98:return s.getLogger().debug("Lex: START_LINK",n.yytext),this.pushState("LLABEL"),16;break;case 99:this.pushState("md_string");break;case 100:return s.getLogger().debug("Lex: Starting string"),this.pushState("string"),"LINK_LABEL";break;case 101:return this.popState(),s.getLogger().debug("Lex: LINK","#"+n.yytext+"#"),15;break;case 102:return this.popState(),s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 103:return this.popState(),s.getLogger().debug("Lex: LINK",n.yytext),15;break;case 104:return s.getLogger().debug("Lex: COLON",n.yytext),n.yytext=n.yytext.slice(1),27;break}},"anonymous"),rules:[/^(?:block-beta\b)/,/^(?:block:)/,/^(?:block\b)/,/^(?:[\s]+)/,/^(?:[\n]+)/,/^(?:((\u000D\u000A)|(\u000A)))/,/^(?:columns\s+auto\b)/,/^(?:columns\s+[\d]+)/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:space[:]\d+)/,/^(?:space\b)/,/^(?:default\b)/,/^(?:linkStyle\b)/,/^(?:interpolate\b)/,/^(?:classDef\s+)/,/^(?:DEFAULT\s+)/,/^(?:\w+\s+)/,/^(?:[^\n]*)/,/^(?:class\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:style\s+)/,/^(?:(\w+)+((,\s*\w+)*))/,/^(?:[^\n]*)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:end\b\s*)/,/^(?:\(\(\()/,/^(?:\)\)\))/,/^(?:[\)]\))/,/^(?:\}\})/,/^(?:\})/,/^(?:\(-)/,/^(?:-\))/,/^(?:\(\()/,/^(?:\]\])/,/^(?:\()/,/^(?:\]\))/,/^(?:\\\])/,/^(?:\/\])/,/^(?:\)\])/,/^(?:[\)])/,/^(?:\]>)/,/^(?:[\]])/,/^(?:-\))/,/^(?:\(-)/,/^(?:\)\))/,/^(?:\))/,/^(?:\(\(\()/,/^(?:\(\()/,/^(?:\{\{)/,/^(?:\{)/,/^(?:>)/,/^(?:\(\[)/,/^(?:\()/,/^(?:\[\[)/,/^(?:\[\|)/,/^(?:\[\()/,/^(?:\)\)\))/,/^(?:\[\\)/,/^(?:\[\/)/,/^(?:\[\\)/,/^(?:\[)/,/^(?:<\[)/,/^(?:[^\(\[\n\-\)\{\}\s\<\>:=]+)/,/^(?:$)/,/^(?:["][`])/,/^(?:["][`])/,/^(?:[^`"]+)/,/^(?:[`]["])/,/^(?:["])/,/^(?:["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:\]>\s*\()/,/^(?:,?\s*right\s*)/,/^(?:,?\s*left\s*)/,/^(?:,?\s*x\s*)/,/^(?:,?\s*y\s*)/,/^(?:,?\s*up\s*)/,/^(?:,?\s*down\s*)/,/^(?:\)\s*)/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?:\s*~~[\~]+\s*)/,/^(?:\s*[xo<]?--\s*)/,/^(?:\s*[xo<]?==\s*)/,/^(?:\s*[xo<]?-\.\s*)/,/^(?:["][`])/,/^(?:["])/,/^(?:\s*[xo<]?--+[-xo>]\s*)/,/^(?:\s*[xo<]?==+[=xo>]\s*)/,/^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/,/^(?::\d+)/],conditions:{STYLE_DEFINITION:{rules:[28],inclusive:!1},STYLE_STMNT:{rules:[27],inclusive:!1},CLASSDEFID:{rules:[22],inclusive:!1},CLASSDEF:{rules:[20,21],inclusive:!1},CLASS_STYLE:{rules:[25],inclusive:!1},CLASS:{rules:[24],inclusive:!1},LLABEL:{rules:[99,100,101,102,103],inclusive:!1},ARROW_DIR:{rules:[85,86,87,88,89,90,91],inclusive:!1},BLOCK_ARROW:{rules:[76,81,84],inclusive:!1},NODE:{rules:[37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,77,80],inclusive:!1},md_string:{rules:[9,10,78,79],inclusive:!1},space:{rules:[],inclusive:!1},string:{rules:[12,13,82,83],inclusive:!1},acc_descr_multiline:{rules:[34,35],inclusive:!1},acc_descr:{rules:[32],inclusive:!1},acc_title:{rules:[30],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,11,14,15,16,17,18,19,23,26,29,31,33,36,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,92,93,94,95,96,97,98,104],inclusive:!0}}};return C})();w.lexer=I;function v(){this.yy={}}return c(v,"Parser"),v.prototype=w,w.Parser=v,new v})();oe.parser=oe;var it=oe,z=new Map,he=[],le=new Map,Fe="color",Me="fill",at="bgFill",Ye=",",G=new Map,ue="",nt=c(e=>Le.sanitizeText(e,ie()),"sanitizeText"),ot=c(function(e,o=""){let l=G.get(e);l||(l={id:e,styles:[],textStyles:[]},G.set(e,l)),o?.split(Ye).forEach(a=>{let h=a.replace(/([^;]*);/,"$1").trim();if(RegExp(Fe).exec(a)){let t=h.replace(Me,at).replace(Fe,Me);l.textStyles.push(t)}l.styles.push(h)})},"addStyleClass"),lt=c(function(e,o=""){let l=z.get(e);o!=null&&(l.styles=o.split(Ye))},"addStyle2Node"),ct=c(function(e,o){e.split(",").forEach(function(l){let a=z.get(l);if(a===void 0){let h=l.trim();a={id:h,type:"na",children:[]},z.set(h,a)}a.classes||(a.classes=[]),a.classes.push(o)})},"setCssClass"),We=0,Ve=c((e,o)=>{let l=e.flat(),a=[],p=l.find(t=>t?.type==="column-setting")?.columns??-1;for(let t of l){if(typeof p=="number"&&p>0&&t.type!=="column-setting"&&typeof t.widthInColumns=="number"&&t.widthInColumns>p&&m.warn(`Block ${t.id} width ${t.widthInColumns} exceeds configured column width ${p}`),t.label&&(t.label=nt(t.label)),t.type==="classDef"){ot(t.id,t.css);continue}if(t.type==="applyClass"){ct(t.id,t?.styleClass??"");continue}if(t.type==="applyStyles"){t?.stylesStr&&lt(t.id,t?.stylesStr);continue}if(t.type==="column-setting")o.columns=t.columns??-1;else if(t.type==="edge"){let u=(le.get(t.id)??0)+1;le.set(t.id,u),t.id=u+"-"+t.id,he.push(t)}else{t.label||(t.type==="composite"?t.label="":t.label=t.id);let u=z.get(t.id);if(u===void 0?(t.type==="composite"&&(t.colorIndex=We++),z.set(t.id,t)):(t.type!=="na"&&(u.type=t.type),t.label!==t.id&&(u.label=t.label)),t.children&&Ve(t.children,t),t.type==="space"){let x=t.width??1;for(let k=0;k<x;k++){let b=we(t);b.id=b.id+"-"+k,z.set(b.id,b),a.push(b)}}else u===void 0&&a.push(t)}}o.children=a},"populateBlockDatabase"),ge=[],W={id:"root",type:"composite",children:[],columns:-1},ht=c(()=>{m.debug("Clear called"),ye(),W={id:"root",type:"composite",children:[],columns:-1},z=new Map([["root",W]]),ge=[],G=new Map,he=[],le=new Map,ue="",We=0},"clear");function je(e){switch(m.debug("typeStr2Type",e),e){case"[]":return"square";case"()":return m.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"}}c(je,"typeStr2Type");function Ue(e){return m.debug("typeStr2Type",e),e==="=="?"thick":"normal"}c(Ue,"edgeTypeStr2Type");function He(e){switch(e.trim().slice(-1)){case"x":return"arrow_cross";case"o":return"arrow_circle";case">":return"arrow_point";default:return""}}c(He,"edgeStrToEdgeData");function Xe(e){switch(e.trim().charAt(0)){case"x":return"arrow_cross";case"o":return"arrow_circle";case"<":return"arrow_point";default:return"arrow_open"}}c(Xe,"edgeStrToEdgeStartData");function Ge(e){return e.includes("==")?"thick":"normal"}c(Ge,"edgeStrToThickness");function qe(e){return e.includes(".-")?"dotted":"solid"}c(qe,"edgeStrToPattern");var Ke=0,ut=c(()=>(Ke++,"id-"+Math.random().toString(36).substr(2,12)+"-"+Ke),"generateId"),gt=c(e=>{W.children=e,Ve(e,W),ge=W.children},"setHierarchy"),dt=c(e=>{let o=z.get(e);return o?o.columns?o.columns:o.children?o.children.length:-1:-1},"getColumns"),pt=c(()=>[...z.values()],"getBlocksFlat"),ft=c(()=>ge||[],"getBlocks"),bt=c(()=>he,"getEdges"),St=c(e=>z.get(e),"getBlock"),xt=c(e=>{z.set(e.id,e)},"setBlock"),kt=c(e=>{ue=e},"setDiagramId"),Lt=c(()=>ue,"getDiagramId"),mt=c(()=>m,"getLogger"),yt=c(function(){return G},"getClasses"),Et={getConfig:c(()=>R().block,"getConfig"),typeStr2Type:je,edgeTypeStr2Type:Ue,edgeStrToEdgeData:He,edgeStrToEdgeStartData:Xe,edgeStrToThickness:Ge,edgeStrToPattern:qe,getLogger:mt,getBlocksFlat:pt,getBlocks:ft,getEdges:bt,setHierarchy:gt,getBlock:St,setBlock:xt,getColumns:dt,getClasses:yt,clear:ht,generateId:ut,setDiagramId:kt,getDiagramId:Lt},wt=Et,_t=c(e=>{let{theme:o,bkgColorArray:l,borderColorArray:a}=e;if(!Ie(o,a))return"";let h=Ne(e.look),p=De(l),t="";for(let u=0;u<Te(e.THEME_COLOR_LIMIT,a);u++){let x=a[u%a.length],k=p?`fill: ${l[u%l.length]};`:"",b=`[data-look="${h}"][data-color-id="color-${u}"]`;t+=` ${b}.node rect.composite { stroke: ${x}; ${k} } `}return t},"genColor"),ne=c((e,o)=>{let l=ke,a=l(e,"r"),h=l(e,"g"),p=l(e,"b");return xe(a,h,p,o)},"fade"),Dt=c(e=>`${_t(e)} .label { font-family: ${e.fontFamily}; color: ${e.nodeTextColor||e.textColor}; } .cluster-label text { fill: ${e.titleColor}; } .cluster-label span { color: ${e.titleColor}; } .label text,span { fill: ${e.nodeTextColor||e.textColor}; color: ${e.nodeTextColor||e.textColor}; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; /* From the theme, as every other diagram does. Pinned at 1px here, so block drew a thinner border than an identical flowchart node under any theme asking for more -- the neo theme asks for 2. Nothing downstream corrected it: the neo rules set stroke and filter, never stroke-width. */ stroke-width: ${e.strokeWidth??1}px; } .flowchart-label text { text-anchor: middle; } // .flowchart-label .text-outer-tspan { // text-anchor: middle; // } // .flowchart-label .text-inner-tspan { // text-anchor: start; // } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${e.arrowheadColor}; } .edgePaths .path { stroke: ${e.lineColor}; stroke-width: 2.0px; } .flowchart-link { stroke: ${e.lineColor}; fill: none; } .edgeLabel { background-color: ${e.edgeLabelBackground}; /* * This is for backward compatibility with existing code that didn't * add a \`<p>\` around edge labels. * * TODO: We should probably remove this in a future release. */ p { margin: 0; padding: 0; display: inline; } rect { opacity: 0.5; background-color: ${e.edgeLabelBackground}; fill: ${e.edgeLabelBackground}; } text-align: center; } /* For html labels only */ .labelBkg { background-color: ${e.edgeLabelBackground}; } .node .cluster { // fill: ${ne(e.mainBkg,.5)}; fill: ${ne(e.clusterBkg,.5)}; stroke: ${ne(e.clusterBorder,.2)}; box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; stroke-width: 1px; } .cluster text { fill: ${e.titleColor}; } .cluster span { color: ${e.titleColor}; } /* .cluster div { color: ${e.titleColor}; } */ div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${e.fontFamily}; font-size: 12px; background: ${e.tertiaryColor}; border: 1px solid ${e.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .flowchartTitleText { text-anchor: middle; font-size: 18px; fill: ${e.textColor}; } ${Pe()} `,"getStyles"),It=Dt;function ce(e,o){if(e===0||!Number.isInteger(e))throw new Error("Columns must be an integer !== 0.");if(o<0||!Number.isInteger(o))throw new Error("Position must be a non-negative integer."+o);if(e<0)return{px:o,py:0};if(e===1)return{px:0,py:o};let l=o%e,a=Math.floor(o/e);return{px:l,py:a}}c(ce,"calculateBlockPosition");var Nt=c(e=>{let o=0,l=0;for(let a of e.children){let{width:h,height:p,x:t,y:u}=a.size??{width:0,height:0,x:0,y:0};if(m.debug("getMaxChildSize abc95 child:",a.id,"width:",h,"height:",p,"x:",t,"y:",u,a.type),a.type==="space")continue;let x=h/(a.widthInColumns??1);x>o&&(o=x),p>l&&(l=p)}return{width:o,height:l}},"getMaxChildSize");function q(e,o,l=0,a=0,h=8){m.debug("setBlockSizes abc95 (start)",e.id,e?.size?.x,"block width =",e?.size,"siblingWidth",l),e?.size?.width||(e.size={width:l,height:a,x:0,y:0});let p=0,t=0;if(e.children?.length>0){for(let S of e.children)q(S,o,0,0,h);let u=Nt(e);p=u.width,t=u.height,m.debug("setBlockSizes abc95 maxWidth of",e.id,":s children is ",p,t);for(let S of e.children)S.size&&(m.debug(`abc95 Setting size of children of ${e.id} id=${S.id} ${p} ${t} ${JSON.stringify(S.size)}`),S.size.width=p*(S.widthInColumns??1)+h*((S.widthInColumns??1)-1),S.size.height=t,S.size.x=0,S.size.y=0,m.debug(`abc95 updating size of ${e.id} children child:${S.id} maxWidth:${p} maxHeight:${t}`));for(let S of e.children)q(S,o,p,t,h);let x=e.columns??-1,k=0;for(let S of e.children)k+=S.widthInColumns??1;let b=e.children.length;x>0&&x<k&&(b=x);let f=Math.ceil(k/b),L=b*(p+h)+h,E=f*(t+h)+h;if(L<l){m.debug(`Detected to small sibling: abc95 ${e.id} siblingWidth ${l} siblingHeight ${a} width ${L}`),L=l,E=a;let S=(l-b*h-h)/b,_=(a-f*h-h)/f;m.debug("Size indata abc88",e.id,"childWidth",S,"maxWidth",p),m.debug("Size indata abc88",e.id,"childHeight",_,"maxHeight",t),m.debug("Size indata abc88 xSize",b,"padding",h);for(let w of e.children)w.size&&(w.size.width=S,w.size.height=_,w.size.x=0,w.size.y=0)}if(m.debug(`abc95 (finale calc) ${e.id} xSize ${b} ySize ${f} columns ${x}${e.children.length} width=${Math.max(L,e.size?.width||0)}`),L<(e?.size?.width||0)){L=e?.size?.width||0;let S=x>0?Math.min(e.children.length,x):e.children.length;if(S>0){let _=(L-S*h-h)/S;m.debug("abc95 (growing to fit) width",e.id,L,e.size?.width,_);for(let w of e.children)w.size&&(w.size.width=_)}}e.size={width:L,height:E,x:0,y:0}}m.debug("setBlockSizes abc94 (done)",e.id,e?.size?.x,e?.size?.width,e?.size?.y,e?.size?.height)}c(q,"setBlockSizes");function de(e,o,l=8){m.debug(`abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`);let a=e.columns??-1;if(m.debug("layoutBlocks columns abc95",e.id,"=>",a,e),e.children&&e.children.length>0){let h=e?.children[0]?.size?.width??0,p=e.children.length*h+(e.children.length-1)*l;m.debug("widthOfChildren 88",p,"posX");let t=new Map;{let f=0;for(let L of e.children){if(!L.size)continue;let{py:E}=ce(a,f),S=t.get(E)??0;L.size.height>S&&t.set(E,L.size.height);let _=L?.widthInColumns??1;a>0&&(_=Math.min(_,a-f%a)),f+=_}}let u=new Map;{let f=0,L=[...t.keys()].sort((E,S)=>E-S);for(let E of L)u.set(E,f),f+=(t.get(E)??0)+l}let x=0;m.debug("abc91 block?.size?.x",e.id,e?.size?.x);let k=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-l,b=0;for(let f of e.children){let L=e;if(!f.size)continue;let{width:E,height:S}=f.size,{px:_,py:w}=ce(a,x);if(w!=b&&(b=w,k=e?.size?.x?e?.size?.x+(-e?.size?.width/2||0):-l,m.debug("New row in layout for block",e.id," and child ",f.id,b)),m.debug(`abc89 layout blocks (child) id: ${f.id} Pos: ${x} (px, py) ${_},${w} (${L?.size?.x},${L?.size?.y}) parent: ${L.id} width: ${E}${l}`),L.size){let v=E/2;f.size.x=k+l+v,m.debug(`abc91 layout blocks (calc) px, pyid:${f.id} startingPos=X${k} new startingPosX${f.size.x} ${v} padding=${l} width=${E} halfWidth=${v} => x:${f.size.x} y:${f.size.y} ${f.widthInColumns} (width * (child?.w || 1)) / 2 ${E*(f?.widthInColumns??1)/2}`),k=f.size.x+v;let C=u.get(w)??0,g=t.get(w)??S;f.size.y=L.size.y-L.size.height/2+C+g/2+l,m.debug(`abc88 layout blocks (calc) px, pyid:${f.id}startingPosX${k}${l}${v}=>x:${f.size.x}y:${f.size.y}${f.widthInColumns}(width * (child?.w || 1)) / 2${E*(f?.widthInColumns??1)/2}`)}f.children&&de(f,o,l);let I=f?.widthInColumns??1;a>0&&(I=Math.min(I,a-x%a)),x+=I,m.debug("abc88 columnsPos",f,x)}}m.debug(`layout blocks (<==layoutBlocks) ${e.id} x: ${e?.size?.x} y: ${e?.size?.y} width: ${e?.size?.width}`)}c(de,"layoutBlocks");function pe(e,{minX:o,minY:l,maxX:a,maxY:h}={minX:0,minY:0,maxX:0,maxY:0}){if(e.size&&e.id!=="root"){let{x:p,y:t,width:u,height:x}=e.size;p-u/2<o&&(o=p-u/2),t-x/2<l&&(l=t-x/2),p+u/2>a&&(a=p+u/2),t+x/2>h&&(h=t+x/2)}if(e.children)for(let p of e.children)({minX:o,minY:l,maxX:a,maxY:h}=pe(p,{minX:o,minY:l,maxX:a,maxY:h}));return{minX:o,minY:l,maxX:a,maxY:h}}c(pe,"findBounds");function Je(e){let o=e.getBlock("root");if(!o)return;let l=ie()?.block?.padding??8;q(o,e,0,0,l),de(o,e,l),m.debug("getBlocks",JSON.stringify(o,null,2));let{minX:a,minY:h,maxX:p,maxY:t}=pe(o),u=t-h,x=p-a;return{x:a,y:h,width:x,height:u}}c(Je,"layout");function fe(e,o,l=!1){let a=e,h="default";(a?.classes?.length||0)>0&&(h=(a?.classes??[]).join(" ")),h=h+" flowchart-label";let p=(a?.classes??[]).flatMap(S=>o.getClasses().get(S)?.styles??[]),t=0,u="rect",x;switch(a.type){case"round":t=5,u="rect";break;case"composite":t=0,u="composite",x=0;break;case"square":u="rect";break;case"diamond":u="question";break;case"hexagon":u="hexagon";break;case"block_arrow":u="block_arrow";break;case"odd":u="rect_left_inv_arrow";break;case"lean_right":u="lean_right";break;case"lean_left":u="lean_left";break;case"trapezoid":u="trapezoid";break;case"inv_trapezoid":u="inv_trapezoid";break;case"rect_left_inv_arrow":u="rect_left_inv_arrow";break;case"circle":u="circle";break;case"ellipse":u="ellipse";break;case"stadium":u="stadium";break;case"subroutine":u="subroutine";break;case"cylinder":u="cylinder";break;case"group":u="rect";break;case"doublecircle":u="doublecircle";break;default:u="rect"}let k=_e(a?.styles??[]),b=a.label,f=a.size??{width:0,height:0,x:0,y:0},L=o.getDiagramId();return{labelStyle:k.labelStyle,shape:u,label:b,labelText:b,rx:t,ry:t,class:h,cssClasses:h,cssStyles:a?.styles??[],cssCompiledStyles:p,style:k.style,id:a.id,domId:L?`${L}-${a.id}`:a.id,isGroup:!1,directions:a.directions,width:f.width||void 0,height:f.height||void 0,wrappingWidth:f.width||Number.POSITIVE_INFINITY,x:f.x,y:f.y,positioned:l,intersect:void 0,padding:x??R()?.block?.padding??0,widthInColumns:a.widthInColumns??1,colorIndex:a.colorIndex,look:R().look}}c(fe,"getNodeFromBlock");async function Ze(e,o,l){let a=fe(o,l,!1);if(o.type==="group")return;let h=R(),p=await ae(e,a,{config:h}),t=p.node()?.getBBox()??{width:0,height:0},u=l.getBlock(a.id);u.size={width:t.width,height:t.height,x:0,y:0,node:p},l.setBlock(u),p.remove()}c(Ze,"calculateBlockSize");async function Qe(e,o,l){let a=fe(o,l,!0);if(l.getBlock(a.id).type!=="space"){let p=R(),t=await ae(e,a,{config:p});a.colorIndex!==void 0&&ve(t,a.colorIndex,p.theme,p.themeVariables?.borderColorArray),o.intersect=a?.intersect,Ce(a)}}c(Qe,"insertBlockPositioned");async function J(e,o,l,a){for(let h of o)await a(e,h,l),h.children&&await J(e,h.children,l,a)}c(J,"performOperations");async function $e(e,o,l){await J(e,o,l,Ze)}c($e,"calculateBlockSizes");async function et(e,o,l){await J(e,o,l,Qe)}c(et,"insertBlocks");async function tt(e,o,l,a,h){let p=new Re({multigraph:!0,compound:!0});p.setGraph({rankdir:"TB",nodesep:10,ranksep:10,marginx:8,marginy:8});for(let t of l)t.size&&p.setNode(t.id,{width:t.size.width,height:t.size.height,intersect:t.intersect});for(let t of o)if(t.start&&t.end){let u=a.getBlock(t.start),x=a.getBlock(t.end);if(u?.size&&x?.size){let k=u.size,b=x.size,f=[{x:k.x,y:k.y},{x:k.x+(b.x-k.x)/2,y:k.y+(b.y-k.y)/2},{x:b.x,y:b.y}],L=h?`${h}-${t.id}`:t.id,E=t.thickness==="thick"?"edge-thickness-thick":"edge-thickness-normal",S=t.pattern==="dotted"?"edge-pattern-dotted":"edge-pattern-solid",_=`${E} ${S} flowchart-link LS-a1 LE-b1`;Be(e,{...t,id:L,arrowTypeEnd:t.arrowTypeEnd,arrowTypeStart:t.arrowTypeStart,points:f,classes:_},{},"block",p.node(t.start),p.node(t.end),h),t.label&&(await Oe(e,{...t,label:t.label,labelStyle:"stroke: #333; stroke-width: 1.5px;fill:none;",arrowTypeEnd:t.arrowTypeEnd,arrowTypeStart:t.arrowTypeStart,points:f,classes:_}),ze({...t,x:f[1].x,y:f[1].y},{originalPath:f}))}}}c(tt,"insertEdges");var Tt=c(function(e,o){return o.db.getClasses()},"getClasses"),vt=c(async function(e,o,l,a){let{securityLevel:h,block:p}=R(),t=a.db;t.setDiagramId(o);let u;h==="sandbox"&&(u=Y("#i"+o));let x=h==="sandbox"?Y(u.nodes()[0].contentDocument.body):Y("body"),k=h==="sandbox"?x.select(`[id="${o}"]`):Y(`[id="${o}"]`);Ee(k,R()),Ae(k,["point","circle","cross"],a.type,o);let f=t.getBlocks(),L=t.getBlocksFlat(),E=t.getEdges(),S=k.insert("g").attr("class","block");await $e(S,f,t);let _=Je(t);await et(S,f,t),await tt(S,E,L,t,o);let w=S.node()?.getBBox(),I=w&&Number.isFinite(w.width)&&Number.isFinite(w.height)?w:_;if(I){let v=Math.max(1,Math.round(.125*(I.width/I.height))),C=I.height+v+10,g=I.width+10,{useMaxWidth:s}=p;me(k,C,g,!!s),m.debug("Here Bounds",_,I),k.attr("viewBox",`${I.x-5} ${I.y-5} ${I.width+10} ${I.height+10}`)}},"draw"),Ct={draw:vt,getClasses:Tt},Jt={parser:it,db:wt,renderer:Ct,styles:It};export{Jt as diagram};