Files
countbot-ai__countbot/frontend/dist/assets/js/mindmap-definition-YRQLILUH-C_SPdZd4.js
T

69 lines
21 KiB
JavaScript

var ne=(t,e,i)=>new Promise((c,u)=>{var l=f=>{try{m(i.next(f))}catch(E){u(E)}},p=f=>{try{m(i.throw(f))}catch(E){u(E)}},m=f=>f.done?c(f.value):Promise.resolve(f.value).then(l,p);m((i=i.apply(t,e)).next())});import{g as he}from"./chunk-55IACEB6-Bydi-WSM.js";import{s as de}from"./chunk-KX2RTZJC-BE-4iInN.js";import{_ as h,l as R,o as ge,r as ue,F as G,c as Y,i as j,aK as pe,W as fe,X as ye,Y as me}from"./mermaid.core-I0hlAH9H.js";import"./index-XQkOl0bk.js";import"./ChatWindow-N4atnSdm.js";import"./countbot-logo-CNglRKg-.js";const b=[];for(let t=0;t<256;++t)b.push((t+256).toString(16).slice(1));function Ee(t,e=0){return(b[t[e+0]]+b[t[e+1]]+b[t[e+2]]+b[t[e+3]]+"-"+b[t[e+4]]+b[t[e+5]]+"-"+b[t[e+6]]+b[t[e+7]]+"-"+b[t[e+8]]+b[t[e+9]]+"-"+b[t[e+10]]+b[t[e+11]]+b[t[e+12]]+b[t[e+13]]+b[t[e+14]]+b[t[e+15]]).toLowerCase()}let K;const _e=new Uint8Array(16);function be(){if(!K){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");K=crypto.getRandomValues.bind(crypto)}return K(_e)}const Se=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),se={randomUUID:Se};function Ne(t,e,i){var u,l,p;if(se.randomUUID&&!t)return se.randomUUID();t=t||{};const c=(p=(l=t.random)!=null?l:(u=t.rng)==null?void 0:u.call(t))!=null?p:be();if(c.length<16)throw new Error("Random bytes length must be >= 16");return c[6]=c[6]&15|64,c[8]=c[8]&63|128,Ee(c)}var q=function(){var t=h(function(T,s,n,o){for(n=n||{},o=T.length;o--;n[T[o]]=s);return n},"o"),e=[1,4],i=[1,13],c=[1,12],u=[1,15],l=[1,16],p=[1,20],m=[1,19],f=[6,7,8],E=[1,26],x=[1,24],v=[1,25],d=[6,7,11],A=[1,6,13,15,16,19,22],J=[1,33],Q=[1,34],U=[1,6,7,11,13,15,16,19,22],H={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:h(function(s,n,o,a,y,r,P){var g=r.length-1;switch(y){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",r[g].id),a.addNode(r[g-1].length,r[g].id,r[g].descr,r[g].type);break;case 16:a.getLogger().trace("Icon: ",r[g]),a.decorateNode({icon:r[g]});break;case 17:case 21:a.decorateNode({class:r[g]});break;case 18:a.getLogger().trace("SPACELIST");break;case 19:a.getLogger().trace("Node: ",r[g].id),a.addNode(0,r[g].id,r[g].descr,r[g].type);break;case 20:a.decorateNode({icon:r[g]});break;case 25:a.getLogger().trace("node found ..",r[g-2]),this.$={id:r[g-1],descr:r[g-1],type:a.getType(r[g-2],r[g])};break;case 26:this.$={id:r[g],descr:r[g],type:a.nodeType.DEFAULT};break;case 27:a.getLogger().trace("node found ..",r[g-3]),this.$={id:r[g-3],descr:r[g-1],type:a.getType(r[g-2],r[g])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:i,7:[1,10],9:9,12:11,13:c,14:14,15:u,16:l,17:17,18:18,19:p,22:m},t(f,[2,3]),{1:[2,2]},t(f,[2,4]),t(f,[2,5]),{1:[2,6],6:i,12:21,13:c,14:14,15:u,16:l,17:17,18:18,19:p,22:m},{6:i,9:22,12:11,13:c,14:14,15:u,16:l,17:17,18:18,19:p,22:m},{6:E,7:x,10:23,11:v},t(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:p,22:m}),t(d,[2,18]),t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),t(d,[2,23]),t(d,[2,24]),t(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:E,7:x,10:32,11:v},{1:[2,7],6:i,12:21,13:c,14:14,15:u,16:l,17:17,18:18,19:p,22:m},t(A,[2,14],{7:J,11:Q}),t(U,[2,8]),t(U,[2,9]),t(U,[2,10]),t(d,[2,15]),t(d,[2,16]),t(d,[2,17]),{20:[1,35]},{21:[1,36]},t(A,[2,13],{7:J,11:Q}),t(U,[2,11]),t(U,[2,12]),{21:[1,37]},t(d,[2,25]),t(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:h(function(s,n){if(n.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=n,o}},"parseError"),parse:h(function(s){var n=this,o=[0],a=[],y=[null],r=[],P=this.table,g="",V=0,Z=0,oe=2,ee=1,ae=r.slice.call(arguments,1),_=Object.create(this.lexer),O={yy:{}};for(var $ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,$)&&(O.yy[$]=this.yy[$]);_.setInput(s,O.yy),O.yy.lexer=_,O.yy.parser=this,typeof _.yylloc=="undefined"&&(_.yylloc={});var W=_.yylloc;r.push(W);var ce=_.options&&_.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function le(N){o.length=o.length-2*N,y.length=y.length-N,r.length=r.length-N}h(le,"popStack");function te(){var N;return N=a.pop()||_.lex()||ee,typeof N!="number"&&(N instanceof Array&&(a=N,N=a.pop()),N=n.symbols_[N]||N),N}h(te,"lex");for(var S,I,D,X,C={},F,k,ie,B;;){if(I=o[o.length-1],this.defaultActions[I]?D=this.defaultActions[I]:((S===null||typeof S=="undefined")&&(S=te()),D=P[I]&&P[I][S]),typeof D=="undefined"||!D.length||!D[0]){var z="";B=[];for(F in P[I])this.terminals_[F]&&F>oe&&B.push("'"+this.terminals_[F]+"'");_.showPosition?z="Parse error on line "+(V+1)+`:
`+_.showPosition()+`
Expecting `+B.join(", ")+", got '"+(this.terminals_[S]||S)+"'":z="Parse error on line "+(V+1)+": Unexpected "+(S==ee?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(z,{text:_.match,token:this.terminals_[S]||S,line:_.yylineno,loc:W,expected:B})}if(D[0]instanceof Array&&D.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+S);switch(D[0]){case 1:o.push(S),y.push(_.yytext),r.push(_.yylloc),o.push(D[1]),S=null,Z=_.yyleng,g=_.yytext,V=_.yylineno,W=_.yylloc;break;case 2:if(k=this.productions_[D[1]][1],C.$=y[y.length-k],C._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},ce&&(C._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),X=this.performAction.apply(C,[g,Z,V,O.yy,D[1],y,r].concat(ae)),typeof X!="undefined")return X;k&&(o=o.slice(0,-1*k*2),y=y.slice(0,-1*k),r=r.slice(0,-1*k)),o.push(this.productions_[D[1]][0]),y.push(C.$),r.push(C._$),ie=P[o[o.length-2]][o[o.length-1]],o.push(ie);break;case 3:return!0}}return!0},"parse")},re=function(){var T={EOF:1,parseError:h(function(n,o){if(this.yy.parser)this.yy.parser.parseError(n,o);else throw new Error(n)},"parseError"),setInput:h(function(s,n){return this.yy=n||this.yy||{},this._input=s,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:h(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:h(function(s){var n=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=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),o.length-1&&(this.yylineno-=o.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:o?(o.length===a.length?this.yylloc.first_column:0)+a[a.length-o.length].length-o[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[y[0],y[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(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:h(function(s){this.unput(this.match.slice(s))},"less"),pastInput:h(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
`+n+"^"},"showPosition"),test_match:h(function(s,n){var o,a,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))),a=s[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,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(s[0].length),this.matched+=s[0],o=this.performAction.call(this,this.yy,this,n,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),o)return o;if(this._backtrack){for(var r in y)this[r]=y[r];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,n,o,a;this._more||(this.yytext="",this.match="");for(var y=this._currentRules(),r=0;r<y.length;r++)if(o=this._input.match(this.rules[y[r]]),o&&(!n||o[0].length>n[0].length)){if(n=o,a=r,this.options.backtrack_lexer){if(s=this.test_match(o,y[r]),s!==!1)return s;if(this._backtrack){n=!1;continue}else return!1}else if(!this.options.flex)break}return n?(s=this.test_match(n,y[a]),s!==!1?s:!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:h(function(){var n=this.next();return n||this.lex()},"lex"),begin:h(function(n){this.conditionStack.push(n)},"begin"),popState:h(function(){var n=this.conditionStack.length-1;return n>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(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:h(function(n){return n=this.conditionStack.length-1-Math.abs(n||0),n>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:h(function(n){this.begin(n)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:h(function(n,o,a,y){switch(a){case 0:return n.getLogger().trace("Found comment",o.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:n.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return n.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:n.getLogger().trace("end icon"),this.popState();break;case 10:return n.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return n.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return n.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return n.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:n.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return n.getLogger().trace("description:",o.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),n.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),n.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),n.getLogger().trace("node end ...",o.yytext),"NODE_DEND";case 30:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),n.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),n.getLogger().trace("node end (("),"NODE_DEND";case 35:return n.getLogger().trace("Long description:",o.yytext),20;case 36:return n.getLogger().trace("Long description:",o.yytext),20}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();H.lexer=re;function M(){this.yy={}}return h(M,"Parser"),M.prototype=H,H.Parser=M,new M}();q.parser=q;var De=q,ke=12,L={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},w,Le=(w=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=L,this.clear(),this.getType=this.getType.bind(this),this.getElementById=this.getElementById.bind(this),this.getParent=this.getParent.bind(this),this.getMindmap=this.getMindmap.bind(this),this.addNode=this.addNode.bind(this),this.decorateNode=this.decorateNode.bind(this)}clear(){this.nodes=[],this.count=0,this.elements={},this.baseLevel=void 0}getParent(e){for(let i=this.nodes.length-1;i>=0;i--)if(this.nodes[i].level<e)return this.nodes[i];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,i,c,u){var x,v,d,A;R.info("addNode",e,i,c,u);let l=!1;this.nodes.length===0?(this.baseLevel=e,e=0,l=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,l=!1);const p=Y();let m=(v=(x=p.mindmap)==null?void 0:x.padding)!=null?v:G.mindmap.padding;switch(u){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:m*=2;break}const f={id:this.count++,nodeId:j(i,p),level:e,descr:j(c,p),type:u,children:[],width:(A=(d=p.mindmap)==null?void 0:d.maxNodeWidth)!=null?A:G.mindmap.maxNodeWidth,padding:m,isRoot:l},E=this.getParent(e);if(E)E.children.push(f),this.nodes.push(f);else if(l)this.nodes.push(f);else throw new Error(`There can be only one root. No parent could be found for ("${f.descr}")`)}getType(e,i){switch(R.debug("In get type",e,i),e){case"[":return this.nodeType.RECT;case"(":return i===")"?this.nodeType.ROUNDED_RECT:this.nodeType.CLOUD;case"((":return this.nodeType.CIRCLE;case")":return this.nodeType.CLOUD;case"))":return this.nodeType.BANG;case"{{":return this.nodeType.HEXAGON;default:return this.nodeType.DEFAULT}}setElementForId(e,i){this.elements[e]=i}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;const i=Y(),c=this.nodes[this.nodes.length-1];e.icon&&(c.icon=j(e.icon,i)),e.class&&(c.class=j(e.class,i))}type2Str(e){switch(e){case this.nodeType.DEFAULT:return"no-border";case this.nodeType.RECT:return"rect";case this.nodeType.ROUNDED_RECT:return"rounded-rect";case this.nodeType.CIRCLE:return"circle";case this.nodeType.CLOUD:return"cloud";case this.nodeType.BANG:return"bang";case this.nodeType.HEXAGON:return"hexgon";default:return"no-border"}}assignSections(e,i){if(e.level===0?e.section=void 0:e.section=i,e.children)for(const[c,u]of e.children.entries()){const l=e.level===0?c%(ke-1):i;this.assignSections(u,l)}}flattenNodes(e,i){var m;const c=["mindmap-node"];e.isRoot===!0?c.push("section-root","section--1"):e.section!==void 0&&c.push(`section-${e.section}`),e.class&&c.push(e.class);const u=c.join(" "),l=h(f=>{switch(f){case L.CIRCLE:return"mindmapCircle";case L.RECT:return"rect";case L.ROUNDED_RECT:return"rounded";case L.CLOUD:return"cloud";case L.BANG:return"bang";case L.HEXAGON:return"hexagon";case L.DEFAULT:return"defaultMindmapNode";case L.NO_BORDER:default:return"rect"}},"getShapeFromType"),p={id:e.id.toString(),domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:l(e.type),width:e.width,height:(m=e.height)!=null?m:0,padding:e.padding,cssClasses:u,cssStyles:[],look:"default",icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(i.push(p),e.children)for(const f of e.children)this.flattenNodes(f,i)}generateEdges(e,i){if(e.children)for(const c of e.children){let u="edge";c.section!==void 0&&(u+=` section-edge-${c.section}`);const l=e.level+1;u+=` edge-depth-${l}`;const p={id:`edge_${e.id}_${c.id}`,start:e.id.toString(),end:c.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:"default",classes:u,depth:e.level,section:c.section};i.push(p),this.generateEdges(c,i)}}getData(){const e=this.getMindmap(),i=Y(),u=pe().layout!==void 0,l=i;if(u||(l.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:l};R.debug("getData: mindmapRoot",e,i),this.assignSections(e);const p=[],m=[];this.flattenNodes(e,p),this.generateEdges(e,m),R.debug(`getData: processed ${p.length} nodes and ${m.length} edges`);const f=new Map;for(const E of p)f.set(E.id,{shape:E.shape,width:E.width,height:E.height,padding:E.padding});return{nodes:p,edges:m,config:l,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(f),type:"mindmap",diagramId:"mindmap-"+Ne()}}getLogger(){return R}},h(w,"MindmapDB"),w),xe=h((t,e,i,c)=>ne(void 0,null,function*(){var f,E,x,v;R.debug(`Rendering mindmap diagram
`+t);const u=c.db,l=u.getData(),p=he(e,l.config.securityLevel);l.type=c.type,l.layoutAlgorithm=ge(l.config.layout,{fallback:"cose-bilkent"}),l.diagramId=e,u.getMindmap()&&(l.nodes.forEach(d=>{d.shape==="rounded"?(d.radius=15,d.taper=15,d.stroke="none",d.width=0,d.padding=15):d.shape==="circle"?d.padding=10:d.shape==="rect"&&(d.width=0,d.padding=10)}),yield ue(l,p),de(p,(E=(f=l.config.mindmap)==null?void 0:f.padding)!=null?E:G.mindmap.padding,"mindmapDiagram",(v=(x=l.config.mindmap)==null?void 0:x.useMaxWidth)!=null?v:G.mindmap.useMaxWidth))}),"draw"),ve={draw:xe},Te=h(t=>{let e="";for(let i=0;i<t.THEME_COLOR_LIMIT;i++)t["lineColor"+i]=t["lineColor"+i]||t["cScaleInv"+i],fe(t["lineColor"+i])?t["lineColor"+i]=ye(t["lineColor"+i],20):t["lineColor"+i]=me(t["lineColor"+i],20);for(let i=0;i<t.THEME_COLOR_LIMIT;i++){const c=""+(17-3*i);e+=`
.section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} polygon, .section-${i-1} path {
fill: ${t["cScale"+i]};
}
.section-${i-1} text {
fill: ${t["cScaleLabel"+i]};
}
.node-icon-${i-1} {
font-size: 40px;
color: ${t["cScaleLabel"+i]};
}
.section-edge-${i-1}{
stroke: ${t["cScale"+i]};
}
.edge-depth-${i-1}{
stroke-width: ${c};
}
.section-${i-1} line {
stroke: ${t["cScaleInv"+i]} ;
stroke-width: 3;
}
.disabled, .disabled circle, .disabled text {
fill: lightgray;
}
.disabled text {
fill: #efefef;
}
`}return e},"genSections"),Oe=h(t=>`
.edge {
stroke-width: 3;
}
${Te(t)}
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
fill: ${t.git0};
}
.section-root text {
fill: ${t.gitBranchLabel0};
}
.section-root span {
color: ${t.gitBranchLabel0};
}
.section-2 span {
color: ${t.gitBranchLabel0};
}
.icon-container {
height:100%;
display: flex;
justify-content: center;
align-items: center;
}
.edge {
fill: none;
}
.mindmap-node-label {
dy: 1em;
alignment-baseline: middle;
text-anchor: middle;
dominant-baseline: middle;
text-align: center;
}
`,"getStyles"),Ie=Oe,Ve={get db(){return new Le},renderer:ve,parser:De,styles:Ie};export{Ve as diagram};