@az-zephyr/slate 0.0.0-stage → 0.1.0
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.
- package/LICENSE +21 -0
- package/README.en.md +107 -0
- package/README.md +106 -2
- package/bin/slate.mjs +226 -0
- package/dist/agent/chunk-BVWXAL54.js +3654 -0
- package/dist/agent/cli.js +6 -0
- package/dist/agent/multi.js +59 -0
- package/dist/api/001_initial.sql +127 -0
- package/dist/api/002_project_assistant.sql +24 -0
- package/dist/api/003_card_decisions.sql +20 -0
- package/dist/api/004_card_default_agent.sql +3 -0
- package/dist/api/005_card_attachments.sql +24 -0
- package/dist/api/006_comment_attachments.sql +7 -0
- package/dist/api/007_participant_last_outcome.sql +6 -0
- package/dist/api/008_output_attachments.sql +7 -0
- package/dist/api/009_card_agent_runs.sql +23 -0
- package/dist/api/server.js +4567 -0
- package/dist/api/server.js.map +1 -0
- package/dist/web/assets/abnfDiagram-XWFEHMT6-DmNFXSdi.js +1 -0
- package/dist/web/assets/architectureDiagram-CSQXQB3N-BTCN41JR.js +36 -0
- package/dist/web/assets/blockDiagram-BEDRHYPZ-BUJZDqr0.js +140 -0
- package/dist/web/assets/bpmnIcons-APHXDYXF-ByGoYv9M.js +1 -0
- package/dist/web/assets/c4Diagram-M2UUVUY5-CoTmMGy5.js +38 -0
- package/dist/web/assets/chunk-2Q5K7J3B-DN1oTl6j.js +1 -0
- package/dist/web/assets/chunk-3BJB4PZV-f0-m4Ag2.js +1 -0
- package/dist/web/assets/chunk-3GCGMST5-79GFiiwz.js +1 -0
- package/dist/web/assets/chunk-5VM5RSS4-D8XyNr_K.js +15 -0
- package/dist/web/assets/chunk-7U7NFRK5-CwjNfj8w.js +88 -0
- package/dist/web/assets/chunk-CNRTWJTD-CrX82YZ2.js +1 -0
- package/dist/web/assets/chunk-D5HYT7QG-DLlJaHjh.js +1 -0
- package/dist/web/assets/chunk-EBZ3SEQC-DYMBSe-a.js +2 -0
- package/dist/web/assets/chunk-JWPE2WC7-D7hN7LFG.js +1 -0
- package/dist/web/assets/chunk-KTR4FSNJ-DNqOwqFL.js +1 -0
- package/dist/web/assets/chunk-XXDRQBXY-ZgzK0pt4.js +1 -0
- package/dist/web/assets/classDiagram-v2-IZLYA2OM-CA7bnKxc.js +217 -0
- package/dist/web/assets/cose-bilkent-JH36ORCC-DOKkzmxA.js +1 -0
- package/dist/web/assets/cynefin-EF2NZ3EQ-C-bSVtsc.js +141 -0
- package/dist/web/assets/cynefinDiagram-NJNITYFG-C37MEEtf.js +62 -0
- package/dist/web/assets/cytoscape.esm-Bw5aGq32.js +332 -0
- package/dist/web/assets/d3-scale-4DPf7zan.js +1 -0
- package/dist/web/assets/dagre-KIHZ2IZ3-9ncwFAl9.js +4 -0
- package/dist/web/assets/diagram-7YQZDPLS-B5nOmdUq.js +41 -0
- package/dist/web/assets/diagram-QBROCOUO-C2R6lDiO.js +200 -0
- package/dist/web/assets/diagram-RJJCUUZO-C6CCweHA.js +30 -0
- package/dist/web/assets/diagram-WERXNKYE-BMvmqzmc.js +24 -0
- package/dist/web/assets/diagram-YHHI257C-mq9rFYCr.js +3 -0
- package/dist/web/assets/diagram-YR4HJLHV-GnLZxfuk.js +24 -0
- package/dist/web/assets/ebnfDiagram-N527522P-BD49AZHw.js +1 -0
- package/dist/web/assets/elk-O5DQBFGD-BPi3gK_q.js +27 -0
- package/dist/web/assets/erDiagram-GT5GOJPG-v00zB8rw.js +99 -0
- package/dist/web/assets/flowDiagram-JAYNFW54-DIf4aoDB.js +213 -0
- package/dist/web/assets/ganttDiagram-3PRQTZWP-DRl_shHP.js +292 -0
- package/dist/web/assets/gitGraphDiagram-VXDFKS5L-2RrHppJt.js +106 -0
- package/dist/web/assets/graph-Bn3Yngep.js +1 -0
- package/dist/web/assets/grid-E2QIVN74-BuI-3sqA.js +1 -0
- package/dist/web/assets/index-5BTf4y0R.css +1 -0
- package/dist/web/assets/index-CtfDl2Kw.js +358 -0
- package/dist/web/assets/infoDiagram-ATMJ4U3S-afgUHtXU.js +2 -0
- package/dist/web/assets/ishikawaDiagram-S3EKX5GW-BsIUfApm.js +70 -0
- package/dist/web/assets/journeyDiagram-POQNLL5X-BM1Liuxy.js +139 -0
- package/dist/web/assets/kanban-definition-BH5XI6FM-Bz439vDv.js +89 -0
- package/dist/web/assets/katex-Be3d8Y4U.js +257 -0
- package/dist/web/assets/mermaid.core-CDkqDmQh.js +314 -0
- package/dist/web/assets/mindmap-definition-WVAN44T4-DcgvDd37.js +98 -0
- package/dist/web/assets/pegDiagram-D4NLKWP3-Bs1FcfRL.js +1 -0
- package/dist/web/assets/pieDiagram-36ENHN4W-CX3-kIFy.js +39 -0
- package/dist/web/assets/quadrantDiagram-ZQUDMS73-CrSg-66H.js +7 -0
- package/dist/web/assets/railroadDiagram-JIZHGYPL-DBm7mKc_.js +1 -0
- package/dist/web/assets/render-VIF2ZAQL-CjnzRbOQ.js +2 -0
- package/dist/web/assets/requirementDiagram-AXW2TVFA--vkT5OaJ.js +84 -0
- package/dist/web/assets/sankeyDiagram-FBCJTAIF-CXyuNpgP.js +40 -0
- package/dist/web/assets/sequenceDiagram-3LA2ROMG-Cfn5c7T5.js +169 -0
- package/dist/web/assets/sizeCapture-2Q2CQKSF-CQJexuw3.js +1 -0
- package/dist/web/assets/stateDiagram-v2-XZFR63ZJ-W23Y_4Yd.js +291 -0
- package/dist/web/assets/swimlanes-YQL5WMAO-B8ymV9uv.js +1 -0
- package/dist/web/assets/swimlanesDiagram-BA3ZWDFA-ClHf-9J2.js +8 -0
- package/dist/web/assets/timeline-definition-7Z437IG3-BElgSf_v.js +120 -0
- package/dist/web/assets/usecaseDiagram-RDK6N6HP-BfopeYcl.js +370 -0
- package/dist/web/assets/vennDiagram-SHRQU5PJ-034PLwGh.js +34 -0
- package/dist/web/assets/wardleyDiagram-F3OXNVQS-Cmiyei3a.js +78 -0
- package/dist/web/assets/xychartDiagram-GDYJKCDI-DxF4glgl.js +7 -0
- package/dist/web/index.html +13 -0
- package/package.json +42 -4
- package/scripts/git-worktree.mjs +63 -0
- package/scripts/slate-cli.mjs +851 -0
- package/skills/slate-card/SKILL.md +109 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import{g as ae}from"./chunk-XXDRQBXY-ZgzK0pt4.js";import{s as ce}from"./chunk-CNRTWJTD-CrX82YZ2.js";import{_ as l,l as w,p as le,r as he,N as de,Q as H,c as M,j,ac as ge,a7 as ue,a8 as pe,a9 as fe}from"./mermaid.core-CDkqDmQh.js";import"./index-CtfDl2Kw.js";var q=(function(){var n=l(function(T,s,i,o){for(i=i||{},o=T.length;o--;i[T[o]]=s);return i},"o"),e=[1,4],a=[1,13],d=[1,12],t=[1,15],h=[1,16],g=[1,20],f=[1,19],E=[6,7,8],L=[1,26],_=[1,24],x=[1,25],k=[6,7,11],A=[1,6,13,15,16,19,22],m=[1,33],$=[1,34],B=[1,6,7,11,13,15,16,19,22],W={trace:l(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:l(function(s,i,o,c,p,r,P){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};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:a,7:[1,10],9:9,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:g,22:f},n(E,[2,3]),{1:[2,2]},n(E,[2,4]),n(E,[2,5]),{1:[2,6],6:a,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:g,22:f},{6:a,9:22,12:11,13:d,14:14,15:t,16:h,17:17,18:18,19:g,22:f},{6:L,7:_,10:23,11:x},n(k,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:g,22:f}),n(k,[2,18]),n(k,[2,19]),n(k,[2,20]),n(k,[2,21]),n(k,[2,23]),n(k,[2,24]),n(k,[2,26],{19:[1,30]}),{20:[1,31]},{6:L,7:_,10:32,11:x},{1:[2,7],6:a,12:21,13:d,14:14,15:t,16:h,17:17,18:18,19:g,22:f},n(A,[2,14],{7:m,11:$}),n(B,[2,8]),n(B,[2,9]),n(B,[2,10]),n(k,[2,15]),n(k,[2,16]),n(k,[2,17]),{20:[1,35]},{21:[1,36]},n(A,[2,13],{7:m,11:$}),n(B,[2,11]),n(B,[2,12]),{21:[1,37]},n(k,[2,25]),n(k,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:l(function(s){var i=this,o=[0],c=[],p=[null],r=[],P=this.table,u="",V=0,J=0,ie=2,K=1,se=r.slice.call(arguments,1),y=Object.create(this.lexer),O={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(O.yy[z]=this.yy[z]);y.setInput(s,O.yy),O.yy.lexer=y,O.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var X=y.yylloc;r.push(X);var re=y.options&&y.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function oe(S){o.length=o.length-2*S,p.length=p.length-S,r.length=r.length-S}l(oe,"popStack");function Z(){var S;return S=c.pop()||y.lex()||K,typeof S!="number"&&(S instanceof Array&&(c=S,S=c.pop()),S=i.symbols_[S]||S),S}l(Z,"lex");for(var b,C,N,Y,I={},F,D,ee,G;;){if(C=o[o.length-1],this.defaultActions[C]?N=this.defaultActions[C]:((b===null||typeof b>"u")&&(b=Z()),N=P[C]&&P[C][b]),typeof N>"u"||!N.length||!N[0]){var Q="";G=[];for(F in P[C])this.terminals_[F]&&F>ie&&G.push("'"+this.terminals_[F]+"'");y.showPosition?Q="Parse error on line "+(V+1)+`:
|
|
2
|
+
`+y.showPosition()+`
|
|
3
|
+
Expecting `+G.join(", ")+", got '"+(this.terminals_[b]||b)+"'":Q="Parse error on line "+(V+1)+": Unexpected "+(b==K?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(Q,{text:y.match,token:this.terminals_[b]||b,line:y.yylineno,loc:X,expected:G})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+C+", token: "+b);switch(N[0]){case 1:o.push(b),p.push(y.yytext),r.push(y.yylloc),o.push(N[1]),b=null,J=y.yyleng,u=y.yytext,V=y.yylineno,X=y.yylloc;break;case 2:if(D=this.productions_[N[1]][1],I.$=p[p.length-D],I._$={first_line:r[r.length-(D||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(D||1)].first_column,last_column:r[r.length-1].last_column},re&&(I._$.range=[r[r.length-(D||1)].range[0],r[r.length-1].range[1]]),Y=this.performAction.apply(I,[u,J,V,O.yy,N[1],p,r].concat(se)),typeof Y<"u")return Y;D&&(o=o.slice(0,-1*D*2),p=p.slice(0,-1*D),r=r.slice(0,-1*D)),o.push(this.productions_[N[1]][0]),p.push(I.$),r.push(I._$),ee=P[o[o.length-2]][o[o.length-1]],o.push(ee);break;case 3:return!0}}return!0},"parse")},ne=(function(){var T={EOF:1,parseError:l(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:l(function(s,i){return this.yy=i||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:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(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:l(function(s){var i=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=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 p=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===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(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:l(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:l(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
|
5
|
+
`+i+"^"},"showPosition"),test_match:l(function(s,i){var o,c,p;if(this.options.backtrack_lexer&&(p={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&&(p.yylloc.range=this.yylloc.range.slice(0))),c=s[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.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,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),o)return o;if(this._backtrack){for(var r in p)this[r]=p[r];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,i,o,c;this._more||(this.yytext="",this.match="");for(var p=this._currentRules(),r=0;r<p.length;r++)if(o=this._input.match(this.rules[p[r]]),o&&(!i||o[0].length>i[0].length)){if(i=o,c=r,this.options.backtrack_lexer){if(s=this.test_match(o,p[r]),s!==!1)return s;if(this._backtrack){i=!1;continue}else return!1}else if(!this.options.flex)break}return i?(s=this.test_match(i,p[c]),s!==!1?s:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var i=this.next();return i||this.lex()},"lex"),begin:l(function(i){this.conditionStack.push(i)},"begin"),popState:l(function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(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:l(function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},"topState"),pushState:l(function(i){this.begin(i)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(i,o,c,p){switch(c){case 0:return i.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:i.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return i.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:i.getLogger().trace("end icon"),this.popState();break;case 10:return i.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return i.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return i.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return i.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:i.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return i.getLogger().trace("description:",o.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),i.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),i.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),i.getLogger().trace("node end ...",o.yytext),"NODE_DEND";case 30:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),i.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),i.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),i.getLogger().trace("node end (("),"NODE_DEND";case 35:return i.getLogger().trace("Long description:",o.yytext),20;case 36:return i.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})();W.lexer=ne;function U(){this.yy={}}return l(U,"Parser"),U.prototype=W,W.Parser=U,new U})();q.parser=q;var me=q,te=12,v={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},R,ye=(R=class{constructor(){this.nodes=[],this.count=0,this.elements={},this.getLogger=this.getLogger.bind(this),this.nodeType=v,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 a=this.nodes.length-1;a>=0;a--)if(this.nodes[a].level<e)return this.nodes[a];return null}getMindmap(){return this.nodes.length>0?this.nodes[0]:null}addNode(e,a,d,t){var _,x;w.info("addNode",e,a,d,t);let h=!1;this.nodes.length===0?(this.baseLevel=e,e=0,h=!0):this.baseLevel!==void 0&&(e=e-this.baseLevel,h=!1);const g=M();let f=((_=g.mindmap)==null?void 0:_.padding)??H.mindmap.padding;switch(t){case this.nodeType.ROUNDED_RECT:case this.nodeType.RECT:case this.nodeType.HEXAGON:f*=2;break}const E={id:this.count++,nodeId:j(a,g),level:e,descr:j(d,g),type:t,children:[],width:((x=g.mindmap)==null?void 0:x.maxNodeWidth)??H.mindmap.maxNodeWidth,padding:f,isRoot:h},L=this.getParent(e);if(L)L.children.push(E),this.nodes.push(E);else if(h)this.nodes.push(E);else throw new Error(`There can be only one root. No parent could be found for ("${E.descr}")`)}getType(e,a){switch(w.debug("In get type",e,a),e){case"[":return this.nodeType.RECT;case"(":return a===")"?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,a){this.elements[e]=a}getElementById(e){return this.elements[e]}decorateNode(e){if(!e)return;const a=M(),d=this.nodes[this.nodes.length-1];e.icon&&(d.icon=j(e.icon,a)),e.class&&(d.class=j(e.class,a))}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,a,d=0,t=!1){if(e.level===0?e.section=void 0:e.section=t?(d-1)%(te-1):a,e.children)for(const[h,g]of e.children.entries()){const f=e.level===0?h%(te-1):a;this.assignSections(g,f,d+1,t)}}flattenNodes(e,a){const d=M(),t=["mindmap-node"];e.isRoot===!0?t.push("section-root","section--1"):e.section!==void 0&&t.push(`section-${e.section}`),e.class&&t.push(e.class);const h=t.join(" "),g=l(E=>{var x;const _=(((x=d.theme)==null?void 0:x.toLowerCase())??"").includes("redux");switch(E){case v.CIRCLE:return"mindmapCircle";case v.RECT:return"rect";case v.ROUNDED_RECT:return"rounded";case v.CLOUD:return"cloud";case v.BANG:return"bang";case v.HEXAGON:return"hexagon";case v.DEFAULT:return _?"rounded":"defaultMindmapNode";case v.NO_BORDER:default:return"rect"}},"getShapeFromType"),f={id:e.id.toString(),placementId:e.nodeId,domId:"node_"+e.id.toString(),label:e.descr,labelType:"markdown",isGroup:!1,shape:g(e.type),width:e.width,height:e.height??0,padding:e.padding,cssClasses:h,cssStyles:[],centerLabel:!0,look:d.look,icon:e.icon,x:e.x,y:e.y,level:e.level,nodeId:e.nodeId,type:e.type,section:e.section};if(a.push(f),e.children)for(const E of e.children)this.flattenNodes(E,a)}generateEdges(e,a){if(!e.children)return;const d=M();for(const t of e.children){let h="edge";t.section!==void 0&&(h+=` section-edge-${t.section}`);const g=e.level+1;h+=` edge-depth-${g}`;const f={id:`edge_${e.id}_${t.id}`,start:e.id.toString(),end:t.id.toString(),type:"normal",curve:"basis",thickness:"normal",look:d.look,classes:h,depth:e.level,section:t.section};a.push(f),this.generateEdges(t,a)}}getData(){var L;const e=this.getMindmap(),a=M(),t=ge().layout!==void 0,h=a;if(t||(h.layout="cose-bilkent"),!e)return{nodes:[],edges:[],config:h};w.debug("getData: mindmapRoot",e,a),this.assignSections(e,void 0,0,((L=a.mindmap)==null?void 0:L.colorBy)==="depth");const g=[],f=[];this.flattenNodes(e,g),this.generateEdges(e,f),w.debug(`getData: processed ${g.length} nodes and ${f.length} edges`);const E=new Map;for(const _ of g)E.set(_.id,{shape:_.shape,width:_.width,height:_.height,padding:_.padding});return{nodes:g,edges:f,config:h,rootNode:e,markers:["point"],direction:"TB",nodeSpacing:50,rankSpacing:50,shapes:Object.fromEntries(E),type:"mindmap"}}getLogger(){return w}},l(R,"MindmapDB"),R),Ee=l(async(n,e,a,d)=>{var k,A;w.debug(`Rendering mindmap diagram
|
|
7
|
+
`+n);const t=d.db,h=t.getData(),g=ae(e,h.config.securityLevel);if(h.type=d.type,h.layoutAlgorithm=le(h.config.layout,{fallback:"cose-bilkent"}),h.diagramId=e,!t.getMindmap())return;h.nodes.forEach(m=>{m.shape==="rounded"?(m.radius=15,m.taper=15,m.stroke="none",m.width=0,m.padding=15):m.shape==="circle"?m.padding=10:m.shape==="rect"?(m.width=0,m.padding=10):m.shape==="hexagon"&&(m.width=0,m.height=0)}),await he(h,g);const{themeVariables:E}=de(),{useGradient:L,gradientStart:_,gradientStop:x}=E;if(L&&_&&x){const m=g.attr("id"),$=g.append("defs").append("linearGradient").attr("id",`${m}-gradient`).attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");$.append("stop").attr("offset","0%").attr("stop-color",_).attr("stop-opacity",1),$.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}ce(g,((k=h.config.mindmap)==null?void 0:k.padding)??H.mindmap.padding,"mindmapDiagram",((A=h.config.mindmap)==null?void 0:A.useMaxWidth)??H.mindmap.useMaxWidth)},"draw"),_e={draw:Ee},ke=l(n=>{const{theme:e,look:a}=n;let d="";for(let t=0;t<n.THEME_COLOR_LIMIT;t++)n["lineColor"+t]=n["lineColor"+t]||n["cScaleInv"+t],ue(n["lineColor"+t])?n["lineColor"+t]=pe(n["lineColor"+t],20):n["lineColor"+t]=fe(n["lineColor"+t],20);for(let t=0;t<n.THEME_COLOR_LIMIT;t++){const h=""+(a==="neo"?Math.max(10-(t-1)*2,2):17-3*t),g=e==="redux"||e==="redux-dark"?n.nodeBorder:n["cScaleLabel"+(e==="neutral"?1:t)];d+=`
|
|
8
|
+
.section-${t-1} rect, .section-${t-1} path, .section-${t-1} circle, .section-${t-1} polygon, .section-${t-1} path {
|
|
9
|
+
fill: ${n["cScale"+t]};
|
|
10
|
+
}
|
|
11
|
+
.section-${t-1} text {
|
|
12
|
+
fill: ${n["cScaleLabel"+t]};
|
|
13
|
+
}
|
|
14
|
+
.section-${t-1} span {
|
|
15
|
+
color: ${n["cScaleLabel"+t]};
|
|
16
|
+
}
|
|
17
|
+
.node-icon-${t-1} {
|
|
18
|
+
font-size: 40px;
|
|
19
|
+
color: ${n["cScaleLabel"+t]};
|
|
20
|
+
}
|
|
21
|
+
.section-edge-${t-1}{
|
|
22
|
+
stroke: ${n["cScale"+t]};
|
|
23
|
+
}
|
|
24
|
+
.edge-depth-${t-1}{
|
|
25
|
+
stroke-width: ${h};
|
|
26
|
+
}
|
|
27
|
+
.section-${t-1} line {
|
|
28
|
+
stroke: ${n["cScaleInv"+t]} ;
|
|
29
|
+
stroke-width: 3;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.disabled, .disabled circle, .disabled text {
|
|
33
|
+
fill: lightgray;
|
|
34
|
+
}
|
|
35
|
+
.disabled text {
|
|
36
|
+
fill: #efefef;
|
|
37
|
+
}
|
|
38
|
+
[data-look="neo"].mindmap-node.section-${t-1} rect, [data-look="neo"].mindmap-node.section-${t-1} path, [data-look="neo"].mindmap-node.section-${t-1} circle, [data-look="neo"].mindmap-node.section-${t-1} polygon {
|
|
39
|
+
fill: ${e==="redux"||e==="redux-dark"||e==="neutral"?n.mainBkg:n["cScale"+t]};
|
|
40
|
+
stroke: ${e==="redux"||e==="redux-dark"?n.nodeBorder:n["cScale"+t]};
|
|
41
|
+
stroke-width: ${n.strokeWidth??2}px;
|
|
42
|
+
}
|
|
43
|
+
[data-look="neo"].section-edge-${t-1}{
|
|
44
|
+
stroke: ${e!=null&&e.includes("redux")||e==="neo-dark"?n.nodeBorder:n["cScale"+t]};
|
|
45
|
+
}
|
|
46
|
+
[data-look="neo"].mindmap-node.section-${t-1} text, [data-look="neo"].mindmap-node.section-${t-1} span {
|
|
47
|
+
fill: ${g};
|
|
48
|
+
color: ${g};
|
|
49
|
+
}
|
|
50
|
+
`}return d},"genSections"),be=l((n,e,a)=>{let d="";for(let t=0;t<n;t++)d+=`
|
|
51
|
+
[data-look="neo"].mindmap-node.section-${t-1} rect, [data-look="neo"].mindmap-node.section-${t-1} path, [data-look="neo"].mindmap-node.section-${t-1} circle, [data-look="neo"].mindmap-node.section-${t-1} polygon {
|
|
52
|
+
stroke: url(${e}-gradient);
|
|
53
|
+
fill: ${a};
|
|
54
|
+
}
|
|
55
|
+
.section-${t-1} line {
|
|
56
|
+
stroke-width: 0;
|
|
57
|
+
}`;return d},"genGradient"),Se=l(n=>{const{theme:e}=n,a=n.svgId,d=e!=null&&e.includes("redux")?n.nodeBorder:n["cScaleLabel"+(e==="neutral"?1:0)],t=n.dropShadow?n.dropShadow.replace("url(#drop-shadow)",`url(${a}-drop-shadow)`):"none";return`
|
|
58
|
+
.edge {
|
|
59
|
+
stroke-width: 3;
|
|
60
|
+
}
|
|
61
|
+
${ke(n)}
|
|
62
|
+
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
|
|
63
|
+
fill: ${n.git0};
|
|
64
|
+
}
|
|
65
|
+
.section-root text {
|
|
66
|
+
fill: ${n.gitBranchLabel0};
|
|
67
|
+
}
|
|
68
|
+
.section-root span {
|
|
69
|
+
color: ${e!=null&&e.includes("redux")?n.nodeBorder:n.gitBranchLabel0};
|
|
70
|
+
}
|
|
71
|
+
.icon-container {
|
|
72
|
+
height:100%;
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
align-items: center;
|
|
76
|
+
}
|
|
77
|
+
.edge {
|
|
78
|
+
fill: none;
|
|
79
|
+
}
|
|
80
|
+
.mindmap-node-label {
|
|
81
|
+
dy: 1em;
|
|
82
|
+
alignment-baseline: middle;
|
|
83
|
+
text-anchor: middle;
|
|
84
|
+
dominant-baseline: middle;
|
|
85
|
+
text-align: center;
|
|
86
|
+
}
|
|
87
|
+
[data-look="neo"].mindmap-node {
|
|
88
|
+
filter: ${t};
|
|
89
|
+
}
|
|
90
|
+
[data-look="neo"].mindmap-node.section-root rect, [data-look="neo"].mindmap-node.section-root path, [data-look="neo"].mindmap-node.section-root circle, [data-look="neo"].mindmap-node.section-root polygon {
|
|
91
|
+
fill: ${e!=null&&e.includes("redux")?n.mainBkg:n.git0};
|
|
92
|
+
}
|
|
93
|
+
[data-look="neo"].mindmap-node.section-root .text-inner-tspan, [data-look="neo"].mindmap-node.section-root span {
|
|
94
|
+
fill: ${d};
|
|
95
|
+
color: ${d};
|
|
96
|
+
}
|
|
97
|
+
${n.useGradient&&a&&n.mainBkg?be(n.THEME_COLOR_LIMIT,a,n.mainBkg):""}
|
|
98
|
+
`},"getStyles"),Ne=Se,Te={get db(){return new ye},renderer:_e,parser:me,styles:Ne};export{Te as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as l,r as m,d as a}from"./chunk-7U7NFRK5-CwjNfj8w.js";import{p}from"./chunk-JWPE2WC7-D7hN7LFG.js";import{_ as t,l as o}from"./mermaid.core-CDkqDmQh.js";import{M as u,d as c}from"./cynefin-EF2NZ3EQ-C-bSVtsc.js";import"./index-CtfDl2Kw.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},G={parser:b,db:a,renderer:m,styles:l};export{G as diagram};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import{p as et}from"./chunk-JWPE2WC7-D7hN7LFG.js";import{g as at,s as rt,a as it,b as nt,t as st,q as ot,_ as l,l as E,c as lt,P as ct,S as dt,T as gt,U,d as ht,A as pt,V as ft,Q as ut}from"./mermaid.core-CDkqDmQh.js";import{p as mt}from"./cynefin-EF2NZ3EQ-C-bSVtsc.js";import{o as vt}from"./d3-scale-4DPf7zan.js";import"./index-CtfDl2Kw.js";var St=ut.pie,R={sections:new Map,showData:!1},T=R.sections,L=R.showData,xt=structuredClone(St),wt=l(()=>structuredClone(xt),"getConfig"),$t=l(()=>{T=new Map,L=R.showData,pt()},"clear"),Ct=l(({label:t,value:a})=>{if(a<0)throw new Error(`"${t}" has invalid value: ${a}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);T.has(t)||(T.set(t,a),E.debug(`added new section: ${t}, with value: ${a}`))},"addSection"),Dt=l(()=>T,"getSections"),yt=l(t=>{L=t},"setShowData"),Tt=l(()=>L,"getShowData"),V={getConfig:wt,clear:$t,setDiagramTitle:ot,getDiagramTitle:st,setAccTitle:nt,getAccTitle:it,setAccDescription:rt,getAccDescription:at,addSection:Ct,getSections:Dt,setShowData:yt,getShowData:Tt},bt=l((t,a)=>{et(t,a),a.setShowData(t.showData),t.sections.map(a.addSection)},"populateDb"),At={parse:l(async t=>{const a=await mt("pie",t);E.debug(a),bt(a,V)},"parse")},_t=l(t=>`
|
|
2
|
+
.pieCircle{
|
|
3
|
+
stroke: ${t.pieStrokeColor};
|
|
4
|
+
stroke-width : ${t.pieStrokeWidth};
|
|
5
|
+
opacity : ${t.pieOpacity};
|
|
6
|
+
}
|
|
7
|
+
.pieCircle.highlighted{
|
|
8
|
+
scale: 1.05;
|
|
9
|
+
opacity: 1;
|
|
10
|
+
}
|
|
11
|
+
.pieCircle.highlightedOnHover:hover{
|
|
12
|
+
transition-duration: 250ms;
|
|
13
|
+
scale: 1.05;
|
|
14
|
+
opacity: 1;
|
|
15
|
+
}
|
|
16
|
+
.pieOuterCircle{
|
|
17
|
+
stroke: ${t.pieOuterStrokeColor};
|
|
18
|
+
stroke-width: ${t.pieOuterStrokeWidth};
|
|
19
|
+
fill: none;
|
|
20
|
+
}
|
|
21
|
+
.pieTitleText {
|
|
22
|
+
text-anchor: middle;
|
|
23
|
+
font-size: ${t.pieTitleTextSize};
|
|
24
|
+
fill: ${t.pieTitleTextColor};
|
|
25
|
+
font-family: ${t.fontFamily};
|
|
26
|
+
}
|
|
27
|
+
.slice {
|
|
28
|
+
font-family: ${t.fontFamily};
|
|
29
|
+
fill: ${t.pieSectionTextColor};
|
|
30
|
+
font-size:${t.pieSectionTextSize};
|
|
31
|
+
// fill: white;
|
|
32
|
+
}
|
|
33
|
+
.legend text {
|
|
34
|
+
fill: ${t.pieLegendTextColor};
|
|
35
|
+
font-family: ${t.fontFamily};
|
|
36
|
+
font-size: ${t.pieLegendTextSize};
|
|
37
|
+
}
|
|
38
|
+
`,"getStyles"),kt=_t,zt=l(t=>{const a=[...t.values()].reduce((s,m)=>s+m,0),P=[...t.entries()].map(([s,m])=>({label:s,value:m})).filter(s=>s.value/a*100>=1);return ft().value(s=>s.value).sort(null)(P)},"createPieArcs"),Et=l((t,a,P,W)=>{var I;E.debug(`rendering pie chart
|
|
39
|
+
`+t);const s=W.db,m=lt(),p=ct(s.getConfig(),m.pie),F=40,i=18,c=4,$=450,S=$,b=dt(a),C=b.append("g");C.attr("transform","translate("+S/2+","+$/2+")");const{themeVariables:n}=m;let[H]=gt(n.pieOuterStrokeWidth);H??(H=2);const q=p.legendPosition,M=p.textPosition,Q=p.donutHole>0&&p.donutHole<=.9?p.donutHole:0,f=Math.min(S,$)/2-F,X=U().innerRadius(Q*f).outerRadius(f),Z=U().innerRadius(f*M).outerRadius(f*M),x=C.append("g");x.append("circle").attr("cx",0).attr("cy",0).attr("r",f+H/2).attr("class","pieOuterCircle");const D=s.getSections(),j=zt(D),J=[n.pie1,n.pie2,n.pie3,n.pie4,n.pie5,n.pie6,n.pie7,n.pie8,n.pie9,n.pie10,n.pie11,n.pie12];let A=0;D.forEach(e=>{A+=e});const O=j.filter(e=>(e.data.value/A*100).toFixed(0)!=="0"),_=vt(J).domain([...D.keys()]);x.selectAll("mySlices").data(O).enter().append("path").attr("d",X).attr("fill",e=>_(e.data.label)).attr("class",e=>{let r="pieCircle";return p.highlightSlice==="hover"?r+=" highlightedOnHover":p.highlightSlice===e.data.label&&(r+=" highlighted"),r}),x.selectAll("mySlices").data(O).enter().append("text").text(e=>(e.data.value/A*100).toFixed(0)+"%").attr("transform",e=>"translate("+Z.centroid(e)+")").style("text-anchor","middle").attr("class","slice");const K=C.append("text").text(s.getDiagramTitle()).attr("x",0).attr("y",-400/2).attr("class","pieTitleText"),w=[...D.entries()].map(([e,r])=>({label:e,value:r})),u=C.selectAll(".legend").data(w).enter().append("g").attr("class","legend");u.append("rect").attr("width",i).attr("height",i).style("fill",e=>_(e.label)).style("stroke",e=>_(e.label)),u.append("text").attr("x",i+c).attr("y",i-c).text(e=>s.getShowData()?`${e.label} [${e.value}]`:e.label);const v=Math.max(...u.selectAll("text").nodes().map(e=>(e==null?void 0:e.getBoundingClientRect().width)??0));let y=$,k=S+F;const o=i+c,z=w.length*o;switch(q){case"center":u.attr("transform",(e,r)=>{const d=o*w.length/2,g=-v/2-(i+c),h=r*o-d;return"translate("+g+","+h+")"});break;case"top":y+=z,u.attr("transform",(e,r)=>{const d=f,g=-v/2-(i+c),h=r*o-d;return`translate(${g}, ${h})`}),x.attr("transform",()=>`translate(0, ${z+o})`);break;case"bottom":y+=z,u.attr("transform",(e,r)=>{const d=-f-o,g=-v/2-(i+c),h=r*o-d;return"translate("+g+","+h+")"});break;case"left":k+=i+c+v,u.attr("transform",(e,r)=>{const d=o*w.length/2,g=-f-(i+c),h=r*o-d;return"translate("+g+","+h+")"}),x.attr("transform",()=>`translate(${v+i+c}, 0)`);break;case"right":default:k+=i+c+v,u.attr("transform",(e,r)=>{const d=o*w.length/2,g=12*i,h=r*o-d;return"translate("+g+","+h+")"});break}const G=((I=K.node())==null?void 0:I.getBoundingClientRect().width)??0,Y=S/2-G/2,tt=S/2+G/2,B=Math.min(0,Y),N=Math.max(k,tt)-B;b.attr("viewBox",`${B} 0 ${N} ${y}`),ht(b,y,N,p.useMaxWidth)},"draw"),Rt={draw:Et},Ot={parser:At,db:V,renderer:Rt,styles:kt};export{Ot as diagram};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{s as Ae,g as ke,t as ae,q as Fe,a as Pe,b as ve,_ as o,c as wt,l as At,k as zt,d as Ce,A as Le,Q as z,j as Ee,W as De}from"./mermaid.core-CDkqDmQh.js";import{l as ie}from"./d3-scale-4DPf7zan.js";import"./index-CtfDl2Kw.js";var Vt=(function(){var t=o(function(j,r,l,g){for(l=l||{},g=j.length;g--;l[j[g]]=r);return l},"o"),n=[1,3],u=[1,4],c=[1,5],h=[1,6],p=[1,7],y=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],S=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],a=[55,56,57],k=[2,36],d=[1,37],T=[1,36],q=[1,38],m=[1,35],b=[1,43],x=[1,41],_=[1,45],Y=[1,14],G=[1,23],yt=[1,18],Tt=[1,19],dt=[1,20],Ft=[1,21],ut=[1,22],xt=[1,24],ft=[1,25],gt=[1,26],i=[1,27],Bt=[1,28],Rt=[1,29],Q=[1,32],U=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Nt=[1,66],Wt=[1,67],Qt=[1,68],Ut=[1,69],Ot=[1,70],Ht=[1,71],Xt=[1,72],Mt=[1,73],Yt=[1,74],jt=[1,75],Gt=[1,76],Kt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],J=[1,91],$=[1,92],tt=[1,93],et=[1,100],it=[1,94],at=[1,97],nt=[1,95],st=[1,96],rt=[1,98],ot=[1,99],Pt=[1,103],Zt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],vt={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:o(function(r,l,g,f,A,e,pt){var s=e.length-1;switch(A){case 23:this.$=e[s];break;case 24:this.$=e[s-1]+""+e[s];break;case 26:this.$=e[s-1]+e[s];break;case 27:this.$=[e[s].trim()];break;case 28:e[s-2].push(e[s].trim()),this.$=e[s-2];break;case 29:this.$=e[s-4],f.addClass(e[s-2],e[s]);break;case 37:this.$=[];break;case 42:this.$=e[s].trim(),f.setDiagramTitle(this.$);break;case 43:this.$=e[s].trim(),f.setAccTitle(this.$);break;case 44:case 45:this.$=e[s].trim(),f.setAccDescription(this.$);break;case 46:f.addSection(e[s].substr(8)),this.$=e[s].substr(8);break;case 47:f.addPoint(e[s-3],"",e[s-1],e[s],[]);break;case 48:f.addPoint(e[s-4],e[s-3],e[s-1],e[s],[]);break;case 49:f.addPoint(e[s-4],"",e[s-2],e[s-1],e[s]);break;case 50:f.addPoint(e[s-5],e[s-4],e[s-2],e[s-1],e[s]);break;case 51:f.setXAxisLeftText(e[s-2]),f.setXAxisRightText(e[s]);break;case 52:e[s-1].text+=" ⟶ ",f.setXAxisLeftText(e[s-1]);break;case 53:f.setXAxisLeftText(e[s]);break;case 54:f.setYAxisBottomText(e[s-2]),f.setYAxisTopText(e[s]);break;case 55:e[s-1].text+=" ⟶ ",f.setYAxisBottomText(e[s-1]);break;case 56:f.setYAxisBottomText(e[s]);break;case 57:f.setQuadrant1Text(e[s]);break;case 58:f.setQuadrant2Text(e[s]);break;case 59:f.setQuadrant3Text(e[s]);break;case 60:f.setQuadrant4Text(e[s]);break;case 64:this.$={text:e[s],type:"text"};break;case 65:this.$={text:e[s-1].text+""+e[s],type:e[s-1].type};break;case 66:this.$={text:e[s],type:"text"};break;case 67:this.$={text:e[s],type:"markdown"};break;case 68:this.$=e[s];break;case 69:this.$=e[s-1]+""+e[s];break}},"anonymous"),table:[{18:n,26:1,27:2,28:u,55:c,56:h,57:p},{1:[3]},{18:n,26:8,27:2,28:u,55:c,56:h,57:p},{18:n,26:9,27:2,28:u,55:c,56:h,57:p},t(y,[2,33],{29:10}),t(S,[2,61]),t(S,[2,62]),t(S,[2,63]),{1:[2,30]},{1:[2,31]},t(a,k,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:d,5:T,10:q,12:m,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:Q,61:U,63:F,64:P,65:v,66:C,67:L}),t(y,[2,34]),{27:46,55:c,56:h,57:p},t(a,[2,37]),t(a,k,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:d,5:T,10:q,12:m,13:b,14:x,15:_,18:Y,25:G,35:yt,37:Tt,39:dt,41:Ft,42:ut,48:xt,50:ft,51:gt,52:i,53:Bt,54:Rt,60:Q,61:U,63:F,64:P,65:v,66:C,67:L}),t(a,[2,39]),t(a,[2,40]),t(a,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(a,[2,45]),t(a,[2,46]),{18:[1,51]},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:52,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:53,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:54,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:55,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:56,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,10:q,12:m,13:b,14:x,15:_,43:57,58:31,60:Q,61:U,63:F,64:P,65:v,66:C,67:L},{4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(y,[2,35]),t(a,[2,38]),t(a,[2,42]),t(a,[2,43]),t(a,[2,44]),{3:65,4:Nt,5:Wt,6:Qt,7:Ut,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,21:64},t(a,[2,53],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(a,[2,56],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(a,[2,57],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,58],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,59],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,60],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Nt,5:Wt,6:Qt,7:Ut,8:Ot,9:Ht,10:Xt,11:Mt,12:Yt,13:jt,14:Gt,15:Kt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(a,[2,52],{58:31,43:84,4:d,5:T,10:q,12:m,13:b,14:x,15:_,60:Q,61:U,63:F,64:P,65:v,66:C,67:L}),t(a,[2,55],{58:31,43:85,4:d,5:T,10:q,12:m,13:b,14:x,15:_,60:Q,61:U,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:89,23:88},t(w,[2,24]),t(a,[2,51],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,54],{59:60,58:61,4:d,5:T,8:H,10:q,12:m,13:b,14:x,15:_,18:X,63:F,64:P,65:v,66:C,67:L}),t(a,[2,47],{22:89,16:90,23:101,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{46:[1,102]},t(a,[2,29],{10:Pt}),t(Zt,[2,27],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(a,[2,49],{10:Pt}),t(a,[2,48],{22:89,16:90,23:105,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot}),{4:J,5:$,6:tt,8:et,11:it,13:at,16:90,17:nt,18:st,19:rt,20:ot,22:106},t(N,[2,26]),t(a,[2,50],{10:Pt}),t(Zt,[2,28],{16:104,4:J,5:$,6:tt,8:et,11:it,13:at,17:nt,18:st,19:rt,20:ot})],defaultActions:{8:[2,30],9:[2,31]},parseError:o(function(r,l){if(l.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=l,g}},"parseError"),parse:o(function(r){var l=this,g=[0],f=[],A=[null],e=[],pt=this.table,s="",mt=0,Jt=0,me=2,$t=1,be=e.slice.call(arguments,1),D=Object.create(this.lexer),K={yy:{}};for(var Ct in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ct)&&(K.yy[Ct]=this.yy[Ct]);D.setInput(r,K.yy),K.yy.lexer=D,K.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Lt=D.yylloc;e.push(Lt);var Se=D.options&&D.options.ranges;typeof K.yy.parseError=="function"?this.parseError=K.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function _e(R){g.length=g.length-2*R,A.length=A.length-R,e.length=e.length-R}o(_e,"popStack");function te(){var R;return R=f.pop()||D.lex()||$t,typeof R!="number"&&(R instanceof Array&&(f=R,R=f.pop()),R=l.symbols_[R]||R),R}o(te,"lex");for(var B,Z,W,Et,lt={},bt,M,ee,St;;){if(Z=g[g.length-1],this.defaultActions[Z]?W=this.defaultActions[Z]:((B===null||typeof B>"u")&&(B=te()),W=pt[Z]&&pt[Z][B]),typeof W>"u"||!W.length||!W[0]){var Dt="";St=[];for(bt in pt[Z])this.terminals_[bt]&&bt>me&&St.push("'"+this.terminals_[bt]+"'");D.showPosition?Dt="Parse error on line "+(mt+1)+`:
|
|
2
|
+
`+D.showPosition()+`
|
|
3
|
+
Expecting `+St.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Dt="Parse error on line "+(mt+1)+": Unexpected "+(B==$t?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Dt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Lt,expected:St})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Z+", token: "+B);switch(W[0]){case 1:g.push(B),A.push(D.yytext),e.push(D.yylloc),g.push(W[1]),B=null,Jt=D.yyleng,s=D.yytext,mt=D.yylineno,Lt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],lt.$=A[A.length-M],lt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},Se&&(lt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Et=this.performAction.apply(lt,[s,Jt,mt,K.yy,W[1],A,e].concat(be)),typeof Et<"u")return Et;M&&(g=g.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),g.push(this.productions_[W[1]][0]),A.push(lt.$),e.push(lt._$),ee=pt[g[g.length-2]][g[g.length-1]],g.push(ee);break;case 3:return!0}}return!0},"parse")},qe=(function(){var j={EOF:1,parseError:o(function(l,g){if(this.yy.parser)this.yy.parser.parseError(l,g);else throw new Error(l)},"parseError"),setInput:o(function(r,l){return this.yy=l||this.yy||{},this._input=r,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:o(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var l=r.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:o(function(r){var l=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=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),g.length-1&&(this.yylineno-=g.length-1);var A=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:g?(g.length===f.length?this.yylloc.first_column:0)+f[f.length-g.length].length-g[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(r){this.unput(this.match.slice(r))},"less"),pastInput:o(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var r=this.pastInput(),l=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
|
|
5
|
+
`+l+"^"},"showPosition"),test_match:o(function(r,l){var g,f,A;if(this.options.backtrack_lexer&&(A={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&&(A.yylloc.range=this.yylloc.range.slice(0))),f=r[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,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(r[0].length),this.matched+=r[0],g=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var e in A)this[e]=A[e];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,l,g,f;this._more||(this.yytext="",this.match="");for(var A=this._currentRules(),e=0;e<A.length;e++)if(g=this._input.match(this.rules[A[e]]),g&&(!l||g[0].length>l[0].length)){if(l=g,f=e,this.options.backtrack_lexer){if(r=this.test_match(g,A[e]),r!==!1)return r;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(r=this.test_match(l,A[f]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var l=this.next();return l||this.lex()},"lex"),begin:o(function(l){this.conditionStack.push(l)},"begin"),popState:o(function(){var l=this.conditionStack.length-1;return l>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(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:o(function(l){return l=this.conditionStack.length-1-Math.abs(l||0),l>=0?this.conditionStack[l]:"INITIAL"},"topState"),pushState:o(function(l){this.begin(l)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(l,g,f,A){switch(f){case 0:break;case 1:break;case 2:return 55;case 3:break;case 4:return this.begin("title"),35;case 5:return this.popState(),"title_value";case 6:return this.begin("acc_title"),37;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),39;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:return 48;case 14:return 50;case 15:return 49;case 16:return 51;case 17:return 52;case 18:return 53;case 19:return 54;case 20:return 25;case 21:this.begin("md_string");break;case 22:return"MD_STR";case 23:this.popState();break;case 24:this.begin("string");break;case 25:this.popState();break;case 26:return"STR";case 27:this.begin("class_name");break;case 28:return this.popState(),47;case 29:return this.begin("point_start"),44;case 30:return this.begin("point_x"),45;case 31:this.popState();break;case 32:this.popState(),this.begin("point_y");break;case 33:return this.popState(),46;case 34:return 28;case 35:return 4;case 36:return 15;case 37:return 11;case 38:return 64;case 39:return 10;case 40:return 65;case 41:return 65;case 42:return 14;case 43:return 13;case 44:return 67;case 45:return 66;case 46:return 12;case 47:return 8;case 48:return 5;case 49:return 18;case 50:return 56;case 51:return 63;case 52:return 57}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?: *x-axis *)/i,/^(?: *y-axis *)/i,/^(?: *--+> *)/i,/^(?: *quadrant-1 *)/i,/^(?: *quadrant-2 *)/i,/^(?: *quadrant-3 *)/i,/^(?: *quadrant-4 *)/i,/^(?:classDef\b)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?::::)/i,/^(?:^\w+)/i,/^(?:\s*:\s*\[\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?:\s*\] *)/i,/^(?:\s*,\s*)/i,/^(?:(1)|(0(.\d+)?))/i,/^(?: *quadrantChart *)/i,/^(?:[A-Za-z]+)/i,/^(?:[^\x00-\x7F]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s)/i,/^(?:;)/i,/^(?:[!"#$%&'*+,-.`?\\_/])/i,/^(?:$)/i],conditions:{class_name:{rules:[28],inclusive:!1},point_y:{rules:[33],inclusive:!1},point_x:{rules:[32],inclusive:!1},point_start:{rules:[30,31],inclusive:!1},acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},title:{rules:[5],inclusive:!1},md_string:{rules:[22,23],inclusive:!1},string:{rules:[25,26],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,6,8,10,13,14,15,16,17,18,19,20,21,24,27,29,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],inclusive:!0}}};return j})();vt.lexer=qe;function qt(){this.yy={}}return o(qt,"Parser"),qt.prototype=vt,vt.Parser=qt,new qt})();Vt.parser=Vt;var ze=Vt,I=De(),ht,Ve=(ht=class{constructor(){this.classes=new Map,this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData()}getDefaultData(){return{titleText:"",quadrant1Text:"",quadrant2Text:"",quadrant3Text:"",quadrant4Text:"",xAxisLeftText:"",xAxisRightText:"",yAxisBottomText:"",yAxisTopText:"",points:[]}}getDefaultConfig(){var n,u,c,h,p,y,S,a,k,d,T,q,m,b,x,_,Y,G;return{showXAxis:!0,showYAxis:!0,showTitle:!0,chartHeight:((n=z.quadrantChart)==null?void 0:n.chartWidth)||500,chartWidth:((u=z.quadrantChart)==null?void 0:u.chartHeight)||500,titlePadding:((c=z.quadrantChart)==null?void 0:c.titlePadding)||10,titleFontSize:((h=z.quadrantChart)==null?void 0:h.titleFontSize)||20,quadrantPadding:((p=z.quadrantChart)==null?void 0:p.quadrantPadding)||5,xAxisLabelPadding:((y=z.quadrantChart)==null?void 0:y.xAxisLabelPadding)||5,yAxisLabelPadding:((S=z.quadrantChart)==null?void 0:S.yAxisLabelPadding)||5,xAxisLabelFontSize:((a=z.quadrantChart)==null?void 0:a.xAxisLabelFontSize)||16,yAxisLabelFontSize:((k=z.quadrantChart)==null?void 0:k.yAxisLabelFontSize)||16,quadrantLabelFontSize:((d=z.quadrantChart)==null?void 0:d.quadrantLabelFontSize)||16,quadrantTextTopPadding:((T=z.quadrantChart)==null?void 0:T.quadrantTextTopPadding)||5,pointTextPadding:((q=z.quadrantChart)==null?void 0:q.pointTextPadding)||5,pointLabelFontSize:((m=z.quadrantChart)==null?void 0:m.pointLabelFontSize)||12,pointRadius:((b=z.quadrantChart)==null?void 0:b.pointRadius)||5,xAxisPosition:((x=z.quadrantChart)==null?void 0:x.xAxisPosition)||"top",yAxisPosition:((_=z.quadrantChart)==null?void 0:_.yAxisPosition)||"left",quadrantInternalBorderStrokeWidth:((Y=z.quadrantChart)==null?void 0:Y.quadrantInternalBorderStrokeWidth)||1,quadrantExternalBorderStrokeWidth:((G=z.quadrantChart)==null?void 0:G.quadrantExternalBorderStrokeWidth)||2}}getDefaultThemeConfig(){return{quadrant1Fill:I.quadrant1Fill,quadrant2Fill:I.quadrant2Fill,quadrant3Fill:I.quadrant3Fill,quadrant4Fill:I.quadrant4Fill,quadrant1TextFill:I.quadrant1TextFill,quadrant2TextFill:I.quadrant2TextFill,quadrant3TextFill:I.quadrant3TextFill,quadrant4TextFill:I.quadrant4TextFill,quadrantPointFill:I.quadrantPointFill,quadrantPointTextFill:I.quadrantPointTextFill,quadrantXAxisTextFill:I.quadrantXAxisTextFill,quadrantYAxisTextFill:I.quadrantYAxisTextFill,quadrantTitleFill:I.quadrantTitleFill,quadrantInternalBorderStrokeFill:I.quadrantInternalBorderStrokeFill,quadrantExternalBorderStrokeFill:I.quadrantExternalBorderStrokeFill}}clear(){this.config=this.getDefaultConfig(),this.themeConfig=this.getDefaultThemeConfig(),this.data=this.getDefaultData(),this.classes=new Map,At.info("clear called")}setData(n){this.data={...this.data,...n}}addPoints(n){this.data.points=[...n,...this.data.points]}addClass(n,u){this.classes.set(n,u)}setConfig(n){At.trace("setConfig called with: ",n),this.config={...this.config,...n}}setThemeConfig(n){At.trace("setThemeConfig called with: ",n),this.themeConfig={...this.themeConfig,...n}}calculateSpace(n,u,c,h){const p=this.config.xAxisLabelPadding*2+this.config.xAxisLabelFontSize,y={top:n==="top"&&u?p:0,bottom:n==="bottom"&&u?p:0},S=this.config.yAxisLabelPadding*2+this.config.yAxisLabelFontSize,a={left:this.config.yAxisPosition==="left"&&c?S:0,right:this.config.yAxisPosition==="right"&&c?S:0},k=this.config.titleFontSize+this.config.titlePadding*2,d={top:h?k:0},T=this.config.quadrantPadding+a.left,q=this.config.quadrantPadding+y.top+d.top,m=this.config.chartWidth-this.config.quadrantPadding*2-a.left-a.right,b=this.config.chartHeight-this.config.quadrantPadding*2-y.top-y.bottom-d.top,x=m/2,_=b/2;return{xAxisSpace:y,yAxisSpace:a,titleSpace:d,quadrantSpace:{quadrantLeft:T,quadrantTop:q,quadrantWidth:m,quadrantHalfWidth:x,quadrantHeight:b,quadrantHalfHeight:_}}}getAxisLabels(n,u,c,h){const{quadrantSpace:p,titleSpace:y}=h,{quadrantHalfHeight:S,quadrantHeight:a,quadrantLeft:k,quadrantHalfWidth:d,quadrantTop:T,quadrantWidth:q}=p,m=!!this.data.xAxisRightText,b=!!this.data.yAxisTopText,x=[];return this.data.xAxisLeftText&&u&&x.push({text:this.data.xAxisLeftText,fill:this.themeConfig.quadrantXAxisTextFill,x:k+(m?d/2:0),y:n==="top"?this.config.xAxisLabelPadding+y.top:this.config.xAxisLabelPadding+T+a+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:m?"center":"left",horizontalPos:"top",rotation:0}),this.data.xAxisRightText&&u&&x.push({text:this.data.xAxisRightText,fill:this.themeConfig.quadrantXAxisTextFill,x:k+d+(m?d/2:0),y:n==="top"?this.config.xAxisLabelPadding+y.top:this.config.xAxisLabelPadding+T+a+this.config.quadrantPadding,fontSize:this.config.xAxisLabelFontSize,verticalPos:m?"center":"left",horizontalPos:"top",rotation:0}),this.data.yAxisBottomText&&c&&x.push({text:this.data.yAxisBottomText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+k+q+this.config.quadrantPadding,y:T+a-(b?S/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:b?"center":"left",horizontalPos:"top",rotation:-90}),this.data.yAxisTopText&&c&&x.push({text:this.data.yAxisTopText,fill:this.themeConfig.quadrantYAxisTextFill,x:this.config.yAxisPosition==="left"?this.config.yAxisLabelPadding:this.config.yAxisLabelPadding+k+q+this.config.quadrantPadding,y:T+S-(b?S/2:0),fontSize:this.config.yAxisLabelFontSize,verticalPos:b?"center":"left",horizontalPos:"top",rotation:-90}),x}getQuadrants(n){const{quadrantSpace:u}=n,{quadrantHalfHeight:c,quadrantLeft:h,quadrantHalfWidth:p,quadrantTop:y}=u,S=[{text:{text:this.data.quadrant1Text,fill:this.themeConfig.quadrant1TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:h+p,y,width:p,height:c,fill:this.themeConfig.quadrant1Fill},{text:{text:this.data.quadrant2Text,fill:this.themeConfig.quadrant2TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:h,y,width:p,height:c,fill:this.themeConfig.quadrant2Fill},{text:{text:this.data.quadrant3Text,fill:this.themeConfig.quadrant3TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:h,y:y+c,width:p,height:c,fill:this.themeConfig.quadrant3Fill},{text:{text:this.data.quadrant4Text,fill:this.themeConfig.quadrant4TextFill,x:0,y:0,fontSize:this.config.quadrantLabelFontSize,verticalPos:"center",horizontalPos:"middle",rotation:0},x:h+p,y:y+c,width:p,height:c,fill:this.themeConfig.quadrant4Fill}];for(const a of S)a.text.x=a.x+a.width/2,this.data.points.length===0?(a.text.y=a.y+a.height/2,a.text.horizontalPos="middle"):(a.text.y=a.y+this.config.quadrantTextTopPadding,a.text.horizontalPos="top");return S}getQuadrantPoints(n){const{quadrantSpace:u}=n,{quadrantHeight:c,quadrantLeft:h,quadrantTop:p,quadrantWidth:y}=u,S=ie().domain([0,1]).range([h,y+h]),a=ie().domain([0,1]).range([c+p,p]);return this.data.points.map(d=>{const T=this.classes.get(d.className);return T&&(d={...T,...d}),{x:S(d.x),y:a(d.y),fill:d.color??this.themeConfig.quadrantPointFill,radius:d.radius??this.config.pointRadius,text:{text:d.text,fill:this.themeConfig.quadrantPointTextFill,x:S(d.x),y:a(d.y)+this.config.pointTextPadding,verticalPos:"center",horizontalPos:"top",fontSize:this.config.pointLabelFontSize,rotation:0},strokeColor:d.strokeColor??this.themeConfig.quadrantPointFill,strokeWidth:d.strokeWidth??"0px"}})}getBorders(n){const u=this.config.quadrantExternalBorderStrokeWidth/2,{quadrantSpace:c}=n,{quadrantHalfHeight:h,quadrantHeight:p,quadrantLeft:y,quadrantHalfWidth:S,quadrantTop:a,quadrantWidth:k}=c;return[{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:y-u,y1:a,x2:y+k+u,y2:a},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:y+k,y1:a+u,x2:y+k,y2:a+p-u},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:y-u,y1:a+p,x2:y+k+u,y2:a+p},{strokeFill:this.themeConfig.quadrantExternalBorderStrokeFill,strokeWidth:this.config.quadrantExternalBorderStrokeWidth,x1:y,y1:a+u,x2:y,y2:a+p-u},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:y+S,y1:a+u,x2:y+S,y2:a+p-u},{strokeFill:this.themeConfig.quadrantInternalBorderStrokeFill,strokeWidth:this.config.quadrantInternalBorderStrokeWidth,x1:y+u,y1:a+h,x2:y+k-u,y2:a+h}]}getTitle(n){if(n)return{text:this.data.titleText,fill:this.themeConfig.quadrantTitleFill,fontSize:this.config.titleFontSize,horizontalPos:"top",verticalPos:"center",rotation:0,y:this.config.titlePadding,x:this.config.chartWidth/2}}build(){const n=this.config.showXAxis&&!!(this.data.xAxisLeftText||this.data.xAxisRightText),u=this.config.showYAxis&&!!(this.data.yAxisTopText||this.data.yAxisBottomText),c=this.config.showTitle&&!!this.data.titleText,h=this.data.points.length>0?"bottom":this.config.xAxisPosition,p=this.calculateSpace(h,n,u,c);return{points:this.getQuadrantPoints(p),quadrants:this.getQuadrants(p),axisLabels:this.getAxisLabels(h,n,u,p),borderLines:this.getBorders(p),title:this.getTitle(c)}}},o(ht,"QuadrantBuilder"),ht),ct,_t=(ct=class extends Error{constructor(n,u,c){super(`value for ${n} ${u} is invalid, please use a valid ${c}`),this.name="InvalidStyleError"}},o(ct,"InvalidStyleError"),ct);function It(t){return!/^#?([\dA-Fa-f]{6}|[\dA-Fa-f]{3})$/.test(t)}o(It,"validateHexCode");function ne(t){return!/^\d+$/.test(t)}o(ne,"validateNumber");function se(t){return!/^\d+px$/.test(t)}o(se,"validateSizeInPixels");function O(t){return Ee(t.trim(),wt())}o(O,"textSanitizer");var V=new Ve;function re(t){V.setData({quadrant1Text:O(t.text)})}o(re,"setQuadrant1Text");function oe(t){V.setData({quadrant2Text:O(t.text)})}o(oe,"setQuadrant2Text");function le(t){V.setData({quadrant3Text:O(t.text)})}o(le,"setQuadrant3Text");function he(t){V.setData({quadrant4Text:O(t.text)})}o(he,"setQuadrant4Text");function ce(t){V.setData({xAxisLeftText:O(t.text)})}o(ce,"setXAxisLeftText");function de(t){V.setData({xAxisRightText:O(t.text)})}o(de,"setXAxisRightText");function ue(t){V.setData({yAxisTopText:O(t.text)})}o(ue,"setYAxisTopText");function xe(t){V.setData({yAxisBottomText:O(t.text)})}o(xe,"setYAxisBottomText");function kt(t){const n={};for(const u of t){const[c,h]=u.trim().split(/\s*:\s*/);if(c==="radius"){if(ne(h))throw new _t(c,h,"number");n.radius=parseInt(h)}else if(c==="color"){if(It(h))throw new _t(c,h,"hex code");n.color=h}else if(c==="stroke-color"){if(It(h))throw new _t(c,h,"hex code");n.strokeColor=h}else if(c==="stroke-width"){if(se(h))throw new _t(c,h,"number of pixels (eg. 10px)");n.strokeWidth=h}else throw new Error(`style named ${c} is not supported.`)}return n}o(kt,"parseStyles");function fe(t,n,u,c,h){const p=kt(h);V.addPoints([{x:u,y:c,text:O(t.text),className:n,...p}])}o(fe,"addPoint");function ge(t,n){V.addClass(t,kt(n))}o(ge,"addClass");function pe(t){V.setConfig({chartWidth:t})}o(pe,"setWidth");function ye(t){V.setConfig({chartHeight:t})}o(ye,"setHeight");function Te(){const t=wt(),{themeVariables:n,quadrantChart:u}=t;return u&&V.setConfig(u),V.setThemeConfig({quadrant1Fill:n.quadrant1Fill,quadrant2Fill:n.quadrant2Fill,quadrant3Fill:n.quadrant3Fill,quadrant4Fill:n.quadrant4Fill,quadrant1TextFill:n.quadrant1TextFill,quadrant2TextFill:n.quadrant2TextFill,quadrant3TextFill:n.quadrant3TextFill,quadrant4TextFill:n.quadrant4TextFill,quadrantPointFill:n.quadrantPointFill,quadrantPointTextFill:n.quadrantPointTextFill,quadrantXAxisTextFill:n.quadrantXAxisTextFill,quadrantYAxisTextFill:n.quadrantYAxisTextFill,quadrantExternalBorderStrokeFill:n.quadrantExternalBorderStrokeFill,quadrantInternalBorderStrokeFill:n.quadrantInternalBorderStrokeFill,quadrantTitleFill:n.quadrantTitleFill}),V.setData({titleText:ae()}),V.build()}o(Te,"getQuadrantData");var Ie=o(function(){V.clear(),Le()},"clear"),we={setWidth:pe,setHeight:ye,setQuadrant1Text:re,setQuadrant2Text:oe,setQuadrant3Text:le,setQuadrant4Text:he,setXAxisLeftText:ce,setXAxisRightText:de,setYAxisTopText:ue,setYAxisBottomText:xe,parseStyles:kt,addPoint:fe,addClass:ge,getQuadrantData:Te,clear:Ie,setAccTitle:ve,getAccTitle:Pe,setDiagramTitle:Fe,getDiagramTitle:ae,getAccDescription:ke,setAccDescription:Ae},Be=o((t,n,u,c)=>{var xt,ft,gt;function h(i){return i==="top"?"hanging":"middle"}o(h,"getDominantBaseLine");function p(i){return i==="left"?"start":"middle"}o(p,"getTextAnchor");function y(i){return`translate(${i.x}, ${i.y}) rotate(${i.rotation||0})`}o(y,"getTransformation");const S=wt();At.debug(`Rendering quadrant chart
|
|
7
|
+
`+t);const a=S.securityLevel;let k;a==="sandbox"&&(k=zt("#i"+n));const T=(a==="sandbox"?zt(k.nodes()[0].contentDocument.body):zt("body")).select(`[id="${n}"]`),q=T.append("g").attr("class","main"),m=((xt=S.quadrantChart)==null?void 0:xt.chartWidth)??500,b=((ft=S.quadrantChart)==null?void 0:ft.chartHeight)??500;Ce(T,b,m,((gt=S.quadrantChart)==null?void 0:gt.useMaxWidth)??!0),T.attr("viewBox","0 0 "+m+" "+b),c.db.setHeight(b),c.db.setWidth(m);const x=c.db.getQuadrantData(),_=q.append("g").attr("class","quadrants"),Y=q.append("g").attr("class","border"),G=q.append("g").attr("class","data-points"),yt=q.append("g").attr("class","labels"),Tt=q.append("g").attr("class","title");x.title&&Tt.append("text").attr("x",0).attr("y",0).attr("fill",x.title.fill).attr("font-size",x.title.fontSize).attr("dominant-baseline",h(x.title.horizontalPos)).attr("text-anchor",p(x.title.verticalPos)).attr("transform",y(x.title)).text(x.title.text),x.borderLines&&Y.selectAll("line").data(x.borderLines).enter().append("line").attr("x1",i=>i.x1).attr("y1",i=>i.y1).attr("x2",i=>i.x2).attr("y2",i=>i.y2).style("stroke",i=>i.strokeFill).style("stroke-width",i=>i.strokeWidth);const dt=_.selectAll("g.quadrant").data(x.quadrants).enter().append("g").attr("class","quadrant");dt.append("rect").attr("x",i=>i.x).attr("y",i=>i.y).attr("width",i=>i.width).attr("height",i=>i.height).attr("fill",i=>i.fill),dt.append("text").attr("x",0).attr("y",0).attr("fill",i=>i.text.fill).attr("font-size",i=>i.text.fontSize).attr("dominant-baseline",i=>h(i.text.horizontalPos)).attr("text-anchor",i=>p(i.text.verticalPos)).attr("transform",i=>y(i.text)).text(i=>i.text.text),yt.selectAll("g.label").data(x.axisLabels).enter().append("g").attr("class","label").append("text").attr("x",0).attr("y",0).text(i=>i.text).attr("fill",i=>i.fill).attr("font-size",i=>i.fontSize).attr("dominant-baseline",i=>h(i.horizontalPos)).attr("text-anchor",i=>p(i.verticalPos)).attr("transform",i=>y(i));const ut=G.selectAll("g.data-point").data(x.points).enter().append("g").attr("class","data-point");ut.append("circle").attr("cx",i=>i.x).attr("cy",i=>i.y).attr("r",i=>i.radius).attr("fill",i=>i.fill).attr("stroke",i=>i.strokeColor).attr("stroke-width",i=>i.strokeWidth),ut.append("text").attr("x",0).attr("y",0).text(i=>i.text.text).attr("fill",i=>i.text.fill).attr("font-size",i=>i.text.fontSize).attr("dominant-baseline",i=>h(i.text.horizontalPos)).attr("text-anchor",i=>p(i.text.verticalPos)).attr("transform",i=>y(i.text))},"draw"),Re={draw:Be},Ue={parser:ze,db:we,renderer:Re,styles:o(()=>"","styles")};export{Ue as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as s,r as l,d as t}from"./chunk-7U7NFRK5-CwjNfj8w.js";import{p as m}from"./chunk-JWPE2WC7-D7hN7LFG.js";import{_ as n,l as i}from"./mermaid.core-CDkqDmQh.js";import{M as p,c as u}from"./cynefin-EF2NZ3EQ-C-bSVtsc.js";import"./index-CtfDl2Kw.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},x={parser:y,db:t,renderer:l,styles:s};export{x as diagram};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-KIHZ2IZ3-9ncwFAl9.js","assets/chunk-EBZ3SEQC-DYMBSe-a.js","assets/index-CtfDl2Kw.js","assets/index-5BTf4y0R.css","assets/mermaid.core-CDkqDmQh.js","assets/graph-Bn3Yngep.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as Fn}from"./index-CtfDl2Kw.js";import{n as On,a as Dn}from"./chunk-3GCGMST5-79GFiiwz.js";import{a as Pn,c as _n,d as Bn}from"./chunk-EBZ3SEQC-DYMBSe-a.js";import{l as Gn,_ as x,aB as Cn,aC as Wn,aD as le}from"./mermaid.core-CDkqDmQh.js";import"./graph-Bn3Yngep.js";var He=!1;function Hn(t){He=t}x(Hn,"setLayeredThrowsOnFailure");function je(){return He}x(je,"layeredThrowsOnFailure");var jn=6;function Ue(t,{measure:r}){var e,d;const n=On((d=(e=t.config)==null?void 0:e.layered)==null?void 0:d.lineHops);if(n===!1)return;const i=t.edges.filter(l=>Array.isArray(l.points)&&l.points.length>=2).map(l=>({id:l.id,points:l.points,curve:l.curve,cornerRadius:l.cornerRadius,arrowTypeStart:l.arrowTypeStart,arrowTypeEnd:l.arrowTypeEnd}));Dn(r.groups.edgePaths,i,{enabled:!0,jumpRadius:jn,jumpStyle:n})}x(Ue,"applyLayeredLineJumps");var gt={Node:0,Dummy:1,Label:2,StartPort:3,EndPort:4},Un=["w","h","kind","pin","hint","key","span"],Xn=["tail","head","minlen","labelW","labelH","tailDx","headDx","tailFixed","headFixed"];function Xe(t,r){const n=[];for(const i of t)for(const e of Un)n.push(i[e]);for(const i of r)for(const e of Xn)n.push(+i[e]);return n}x(Xe,"layoutInputs");function zt(t,r,n=gt.Node){return{w:t,h:r,kind:n,pin:0,hint:NaN,key:NaN,span:0,x:0,y:0,rank:0}}x(zt,"lnode");function Vt(t,r,n=1,i=0,e=0){return{tail:t,head:r,minlen:n,labelW:i,labelH:e,tailDx:0,headDx:0,tailFixed:!1,headFixed:!1,reversed:!1,points:[],labelX:0,labelY:0}}x(Vt,"ledge");var Kn=24,Fe=2e4,fe=16,Oe=8,$n=.125,De=3,qn=20,Yn=10,zn=14,Vn=2,Jn=28,Pe=12,Qn=12,Zn=8,to=4,_e=.5,Dt=.5,he=1,eo=12,Be=24,no=40,Ge=400,qt=16,ae=new Float64Array(2*qt+2),ce=new Float64Array(2*qt+2),Ot={Held:0,Leaves:1,Arrives:2};function Ht(t){return t===gt.Dummy||t===gt.Label}x(Ht,"isDummy");function Ke(t,r,n,i){return t===gt.Node?n/2+i/2:t===r?i:i/2}x(Ke,"gapBetween");function ue(t,r,n,i){for(let e=r+1;e<n;e++){const d=t[e],l=i[d];let w=e-1;for(;w>=r&&(i[t[w]]>l||i[t[w]]===l&&t[w]>d);)t[w+1]=t[w],w--;t[w+1]=d}}x(ue,"sortRange");function $e(t,r,n,i,e,d){const l=x((L,k)=>n[L]<n[k]||n[L]===n[k]&&(e?i[L]>i[k]:i[L]<i[k]),"before"),w=8;for(let L=0;L<r;L+=w)for(let k=L+1,E=Math.min(r,L+w);k<E;k++){const G=t[k];let A=k-1;for(;A>=L&&l(G,t[A]);)t[A+1]=t[A],A--;t[A+1]=G}let T=t,v=d;for(let L=w;L<r;L*=2){for(let E=0;E<r;E+=2*L){const G=Math.min(r,E+L),A=Math.min(r,E+2*L);let C=E,K=G,nt=E;for(;C<G&&K<A;)v[nt++]=l(T[K],T[C])?T[K++]:T[C++];for(;C<G;)v[nt++]=T[C++];for(;K<A;)v[nt++]=T[K++]}const k=T;T=v,v=k}if(T!==t)for(let L=0;L<r;L++)t[L]=T[L]}x($e,"sortByBary");function oe(t,r,n){var Pt;const i=t.length;if(i===0)return{width:0,height:0};const e=r.length;if(i===1&&e===0&&t[0].kind===gt.Node){const a=t[0];return a.rank=0,a.x=a.w/2,a.y=a.h/2,{width:a.w,height:a.h}}let d=1;if(e>0){const a=new Set;for(const S of r){const U=Math.min(S.tail,S.head),et=Math.max(S.tail,S.head),X=U*i+et;if(S.labelW>0||a.has(X)){d=2;break}a.add(X)}}Se(t,r),ke(t,r,d);const l=new Int32Array(e);let w=0;for(let a=0;a<e;a++){const S=r[a];l[a]=Math.abs(t[S.head].rank-t[S.tail].rank),l[a]>1&&(w+=l[a]-1)}const T=new Uint8Array(e);if(w>Fe){const a=[];for(let S=0;S<e;S++)l[S]>1&&a.push(S);a.sort((S,U)=>l[U]-l[S]||S-U);for(const S of a){if(w<=Fe)break;T[S]=1,w-=l[S]-1}}const v=i+w,L=new Float64Array(v),k=new Float64Array(v),E=new Uint8Array(v),G=new Int32Array(v);let A=0;for(let a=0;a<i;a++){const S=t[a];L[a]=S.w,k[a]=S.h,E[a]=S.kind,G[a]=S.rank,S.rank>A&&(A=S.rank)}let C=0;for(let a=0;a<e;a++)T[a]||(C+=l[a]);const K=new Int32Array(C),nt=new Int32Array(C),Q=new Float64Array(C),N=new Float64Array(C),D=new Int32Array(e).fill(-1),j=new Uint8Array(A+1),_=new Int32Array(e).fill(-1);let Y=!1;for(let a=0;a<i;a++)t[a].span>0&&t[a].kind===gt.Node&&(Y=!0);const q=Y?new Uint8Array(C):void 0,Z=Y?new Uint8Array(C):void 0,o=new Int32Array(e).fill(-1),f=new Int32Array(e).fill(-1),m=new Float64Array(v).fill(NaN);for(let a=0;a<i;a++)m[a]=t[a].key;let I=!1;{let a=i,S=0;for(let U=0;U<e;U++){if(T[U])continue;const et=r[U],X=et.reversed?et.head:et.tail,at=et.reversed?et.tail:et.head,vt=et.reversed?et.headDx:et.tailDx,ht=et.reversed?et.tailDx:et.headDx;(vt!==0||ht!==0)&&(I=!0);const It=G[X],Nt=G[at];let Ft=-1;et.labelW>0&&(Ft=It+(Nt-It>>1),d===2&&Nt-It>=4?(Ft&1)===1&&(Ft+=et.reversed?1:-1):d===2&&(Ft&1)===0&&(Ft+=et.reversed?1:-1));let Bt=X;Nt-It>1&&(D[U]=a),o[U]=S,q&&!(et.reversed?et.headFixed:et.tailFixed)&&(q[S]=et.reversed?Ot.Arrives:Ot.Leaves);for(let Ut=It+1;Ut<Nt;Ut++){const _t=a++;G[_t]=Ut,m[_t]=m[X]+(m[at]-m[X])*(Ut-It)/(Nt-It),Ut===Ft?(L[_t]=et.labelW,k[_t]=et.labelH,E[_t]=gt.Label,_[U]=_t,j[Ut]|=et.reversed?2:1):E[_t]=gt.Dummy,K[S]=Bt,nt[S]=_t,Q[S]=Bt===X?vt:0,S++,Bt=_t}K[S]=Bt,nt[S]=at,Q[S]=Bt===X?vt:0,N[S]=ht,Z&&!(et.reversed?et.tailFixed:et.headFixed)&&(Z[S]=et.reversed?Ot.Leaves:Ot.Arrives),f[U]=S,S++}}let O;if(n.groups){const{of:a,parent:S}=n.groups;O=new Int32Array(v);for(let X=0;X<i;X++)O[X]=a[X];const U=x(X=>{let at=0;for(;X>=0;X=S[X])at++;return at},"depth"),et=x((X,at)=>{let vt=U(X),ht=U(at);for(;vt>ht;vt--)X=S[X];for(;ht>vt;ht--)at=S[at];for(;X!==at;)X=S[X],at=S[at];return X},"lca");for(let X=0;X<e;X++){if(D[X]<0)continue;const at=r[X],vt=et(a[at.tail],a[at.head]);for(let ht=D[X],It=ht+l[X]-1;ht<It;ht++)O[ht]=vt}}const y=new Int32Array(v+1),c=new Int32Array(v+1);for(let a=0;a<C;a++)y[K[a]+1]++,c[nt[a]+1]++;for(let a=0;a<v;a++)y[a+1]+=y[a],c[a+1]+=c[a];const s=new Int32Array(C),u=new Int32Array(C);{const a=y.slice(0,v),S=c.slice(0,v);for(let U=0;U<C;U++)s[a[K[U]]++]=U,u[S[nt[U]]++]=U}const g=new Int32Array(A+2);for(let a=0;a<v;a++)g[G[a]+1]++;for(let a=0;a<=A;a++)g[a+1]+=g[a];const b=new Int32Array(v),P=new Int32Array(v);{const a=new Int32Array(v),S=g.slice(0,A+1);for(let X=0;X<v;X++)a[S[G[X]]++]=X;for(let X=0;X<=A;X++)S[X]=g[X];const U=new Uint8Array(v),et=[];for(let X=0;X<v;X++)if(!U[a[X]])for(et.push(a[X]);et.length>0;){const at=et.pop();if(!U[at]){U[at]=1,b[S[G[at]]++]=at;for(let vt=y[at+1]-1;vt>=y[at];vt--){const ht=nt[s[vt]];U[ht]||et.push(ht)}}}}const M=x((a,S)=>{const U=g[a],et=g[a+1];if(et-U<2)return!1;for(let vt=U;vt<et;vt++)if(Number.isNaN(S(b[vt])))return!1;const X=Array.from(b.subarray(U,et)),at=new Map;return X.forEach((vt,ht)=>at.set(vt,ht)),X.sort((vt,ht)=>S(vt)-S(ht)||at.get(vt)-at.get(ht)),b.set(X,U),!0},"sortRank");for(let a=0;a<=A;a++)M(a,S=>m[S]);let h=!1;for(let a=0;a<i;a++)t[a].pin!==0&&(h=!0);if(h)for(let a=0;a<=A;a++){const S=Array.from(b.subarray(g[a],g[a+1])),U=new Map;S.forEach((X,at)=>U.set(X,at));const et=x(X=>X<i?t[X].pin:0,"pinOf");S.sort((X,at)=>et(X)-et(at)||U.get(X)-U.get(at)),b.set(S,g[a])}const z=new Uint8Array(A+1),p=x(a=>a<i&&(t[a].kind===gt.StartPort||t[a].kind===gt.EndPort)?t[a].hint:NaN,"hint");for(const a of[0,A])M(a,p)&&(z[a]=1);const H=x(()=>{for(let a=0;a<=A;a++){const S=g[a];for(let U=S,et=g[a+1];U<et;U++)P[b[U]]=U-S}},"setPositions");H();const W={n:v,real:i,maxRank:A,W:L,KIND:E,RANK:G,EF:K,ET:nt,EFD:Q,ETD:N,succStart:y,succE:s,predStart:c,predE:u,layerStart:g,order:b,pos:P,offsets:I,fixed:z,GRP:O,groupParent:(Pt=n.groups)==null?void 0:Pt.parent};let R=0,ot=0;if(C>0&&A>0&&([R,ot]=on(W,t),H()),n.orderOnly){const a=de(W,n);for(let S=0;S<i;S++)t[S].x=a[S];for(let S=0;S<e;S++){const U=r[S],et=U.reversed?U.head:U.tail,X=U.reversed?U.tail:U.head,at=[G[et],a[et]];if(!T[S]&&D[S]>=0)for(let vt=D[S],ht=vt+l[S]-1;vt<ht;vt++)at.push(G[vt],a[vt]);at.push(G[X],a[X]),U.points=at}return{width:0,height:0,crossings:R,declared:ot}}q&&Z&&qe(W,t,q,Z);const rt=de(W,n),ft=Ze(W);if(q&&Z){const a=ze(W,q,Z);Ve(W,t,rt,a,n,ft),Je(W,t,rt,q,Z,a,ft),Qe(W,rt,ft,n);for(let S=0;S<e;S++){if(T[S])continue;const U=r[S],et=Q[o[S]],X=N[f[S]];U.tailDx=U.reversed?X:et,U.headDx=U.reversed?et:X}}Ye(W,rt,ft);const Et=new Uint8Array(v);ft&&!n.tracks&&en(W,rt,ft,D,l,n.apart?0:n.edgeSep,Et),n.tracks||nn(W,rt,D,l,n.edgeSep,Et);const dt=new Int32Array(e+1),F=n.tracks||q&&!n.straight?{from:[],to:[],rank:[],lower:[],track:[],levels:[],wide:[]}:void 0,ut=new Int32Array(A+1);if(F){for(let a=0;a<e;a++){if(dt[a]=F.from.length,T[a])continue;const S=D[a];let U=!1;for(let at=S,vt=S<0?S:S+l[a]-1;at<vt;at++){const ht=ft!==void 0&&ft[G[at]]===1;!n.tracks&&ht!==(Et[at]===1)&&(U=!0)}if(U)continue;let et=rt[K[o[a]]]+Q[o[a]],X=G[K[o[a]]];for(let at=S,vt=S<0?S:S+l[a]-1;at<vt;at++)ft&&ft[G[at]]||(F.from.push(et),F.to.push(rt[at]),F.rank.push(X),F.lower.push(at),et=rt[at],X=G[at]);F.from.push(et),F.to.push(rt[nt[f[a]]]+N[f[a]]),F.rank.push(X),F.lower.push(-1)}dt[e]=F.from.length}const yt=x((a,S)=>{let U=!1;for(let et=g[a];et<g[a+1];et++){const X=E[b[et]];if(X===S)U=!0;else if(X!==gt.Dummy)return!1}return U},"portOnly"),At=yt(0,gt.StartPort)?d:0,wt=yt(A,gt.EndPort)?d:0,$=new Float64Array(A+1);for(let a=0;a<C;a++){const S=Math.abs(rt[K[a]]+Q[a]-rt[nt[a]]-N[a]);S>$[G[K[a]]]&&($[G[K[a]]]=S)}const V=new Float64Array(A+1),B=new Float64Array(A+1),J=x(a=>(a<At||a>=A-wt?n.portSep:n.rankSep)/d,"usual"),tt=new Float64Array(A+1);for(let a=0;a<A;a++)tt[a]=F?J(a):Math.max(J(a),Math.min(De*n.rankSep/d,$[a]*$n));const st=new Uint8Array(A+1).fill(1);for(let a=0;a<i;a++)st[G[a]]=0;for(let a=1;a<A;a++){if(n.tracks||!st[a]||j[a]!==1&&j[a]!==2)continue;const S=Math.min((n.headRoom??0)/2,tt[j[a]===1?a-1:a]/2);tt[a-1]+=j[a]===1?-S:S,tt[a]+=j[a]===1?S:-S}const ct=x(a=>E[a]===gt.Dummy&&st[G[a]]&&!n.tracks?(B[G[a]]-V[G[a]])/4:0,"inset"),Mt=n.tracks?qn:Jn,it=n.tracks?Yn:Pe,mt=n.tracks?zn:Pe,lt=new Int32Array(A+1);if(F){const a=new Float64Array(A+1);for(let U=0;U<A;U++){if(ft&&ft[U])continue;let et=U+1;for(a[U]=tt[U];et<A&&ft&&ft[et];)a[U]+=tt[et++];lt[U]=et}for(let U=0;U<F.from.length;U++)F.wide.push(Math.abs(F.from[U]-F.to[U])>Vn*a[F.rank[U]]?1:0);const S=new Float64Array(A+1);tn(F,ut,!n.tracks,a,S);for(let U=0;U<A;U++)ut[U]>0?tt[U]+=Math.max(0,2*Mt+(ut[U]-1)*it-a[U]):S[U]>0&&(tt[U]+=Math.max(0,Math.min(De*n.rankSep,S[U])-a[U]))}let pt=0;for(let a=0;a<=A;a++){let S=0;for(let U=g[a];U<g[a+1];U++)k[b[U]]>S&&(S=k[b[U]]);V[a]=pt,B[a]=pt+S,pt+=S+tt[a]}const bt=pt,xt=x((a,S=F.track[a])=>{const U=F.rank[a],et=B[U],X=V[lt[U]],at=n.tracks?ut[U]:F.levels[a],vt=at>1?Math.min(mt,(X-et-2*Mt)/(at-1)):0;return(et+X)/2+(S-(at-1)/2)*vt},"trackY");let St=1/0,Rt=-1/0;for(let a=0;a<v;a++){const S=L[a]/2;rt[a]-S<St&&(St=rt[a]-S),rt[a]+S>Rt&&(Rt=rt[a]+S)}const Ct=new Uint8Array(A+1),Wt=new Uint8Array(A+1);for(let a=0;a<i;a++)E[a]!==gt.Node||!q||(c[a+1]>c[a]&&(Ct[G[a]]=1),y[a+1]>y[a]&&(Wt[G[a]]=1));for(let a=0;a<i;a++){const S=t[a],U=S.rank;S.x=rt[a]-St,E[a]===gt.Node&&Wt[U]&&!Ct[U]?S.y=B[U]-S.h/2:E[a]===gt.Node&&Ct[U]&&!Wt[U]?S.y=V[U]+S.h/2:S.y=(V[U]+B[U])/2}for(let a=0;a<e;a++){const S=r[a],U=t[S.reversed?S.head:S.tail],et=t[S.reversed?S.tail:S.head],X=[U.x+(S.reversed?S.headDx:S.tailDx),U.y+U.h/2],at=D[a];if(F&&dt[a+1]>dt[a])for(let ht=dt[a];ht<dt[a+1];ht++){if(F.track[ht]>=0&&(n.tracks||F.wide[ht]===1)){const Nt=xt(ht);X.push(F.from[ht]-St,Nt,F.to[ht]-St,Nt)}else F.track[ht]>0&&X.push(F.from[ht]-St,xt(ht,F.track[ht]-1));const It=F.lower[ht];It<0||(X.push(rt[It]-St,V[G[It]]+ct(It)),B[G[It]]>V[G[It]]&&X.push(rt[It]-St,B[G[It]]-ct(It)))}else if(at>=0)for(let ht=at,It=at+l[a]-1;ht<It;ht++){if(Et[ht])continue;const Nt=rt[ht]-St,Ft=V[G[ht]],Bt=B[G[ht]];X.push(Nt,Ft+ct(ht)),Bt>Ft&&X.push(Nt,Bt-ct(ht))}if(X.push(et.x+(S.reversed?S.tailDx:S.headDx),et.y-et.h/2),S.reversed)for(let ht=0,It=X.length-2;ht<It;ht+=2,It-=2){const Nt=X[ht],Ft=X[ht+1];X[ht]=X[It],X[ht+1]=X[It+1],X[It]=Nt,X[It+1]=Ft}S.points=X;const vt=_[a];vt>=0?(S.labelX=rt[vt]-St,S.labelY=(V[G[vt]]+B[G[vt]])/2):S.labelW>0&&(S.labelX=(X[0]+X[X.length-2])/2,S.labelY=(X[1]+X[X.length-1])/2)}return{width:Rt-St,height:bt}}x(oe,"layered");function Se(t,r){const n=t.length,i=r.length,e=new Int32Array(n+1);for(let v=0;v<i;v++){const L=r[v];L.reversed=t[L.head].kind===gt.StartPort||t[L.tail].kind===gt.EndPort,L.reversed||e[L.tail+1]++}for(let v=0;v<n;v++)e[v+1]+=e[v];const d=new Int32Array(e[n]);{const v=e.slice(0,n);for(let L=0;L<i;L++)r[L].reversed||(d[v[r[L].tail]++]=L)}const l=new Uint8Array(n),w=e.slice(0,n),T=[];for(let v=0;v<n;v++)if(l[v]===0)for(T.push(v),l[v]=1;T.length>0;){const L=T[T.length-1];if(w[L]<e[L+1]){const k=r[d[w[L]++]],E=k.head;l[E]===1?k.reversed=!0:l[E]===0&&(l[E]=1,T.push(E))}else l[L]=2,T.pop()}}x(Se,"orient");function ke(t,r,n){const i=t.length,e=r.length,d=new Int32Array(e),l=new Int32Array(e),w=new Int32Array(e),T=new Int32Array(i+1),v=new Int32Array(i+1);for(let N=0;N<e;N++){const D=r[N],j=D.reversed?D.head:D.tail,_=D.reversed?D.tail:D.head;d[N]=j,l[N]=_,w[N]=Math.max(1,D.minlen)*n,T[j+1]++,v[_+1]++}for(let N=0;N<i;N++)T[N+1]+=T[N],v[N+1]+=v[N];const L=new Int32Array(e),k=new Int32Array(e);{const N=T.slice(0,i),D=v.slice(0,i);for(let j=0;j<e;j++)L[N[d[j]]++]=j,k[D[l[j]]++]=j}const E=new Int32Array(i);for(let N=0;N<i;N++)t[N].kind===gt.StartPort&&(E[N]=-n);const G=new Int32Array(i);for(let N=0;N<i;N++)G[N]=v[N+1]-v[N];const A=new Int32Array(i);let C=0;for(let N=0;N<i;N++)G[N]===0&&(A[C++]=N);for(let N=0;N<C;N++){const D=A[N];for(let j=T[D];j<T[D+1];j++){const _=L[j],Y=l[_];E[D]+w[_]>E[Y]&&(E[Y]=E[D]+w[_]),--G[Y]===0&&(A[C++]=Y)}}for(let N=0;N<8;N++){let D=!1;for(let j=C-1;j>=0;j--){const _=A[j],Y=v[_+1]-v[_],q=T[_+1]-T[_];if(Y===0&&q===0)continue;let Z=-1/0,o=1/0;for(let m=v[_];m<v[_+1];m++){const I=k[m];Z=Math.max(Z,E[d[I]]+w[I])}for(let m=T[_];m<T[_+1];m++){const I=L[m];o=Math.min(o,E[l[I]]-w[I])}let f=E[_];q>Y&&o!==1/0?f=o:Y>q&&Z!==-1/0&&(f=Z),f!==E[_]&&(E[_]=f,D=!0)}if(!D)break}let K=1/0,nt=-1/0,Q=!1;for(let N=0;N<i;N++){const D=t[N].kind;D===gt.StartPort&&(Q=!0),!(D===gt.StartPort||D===gt.EndPort)&&(E[N]<K&&(K=E[N]),E[N]>nt&&(nt=E[N]))}K===1/0&&(K=0,nt=0);for(let N=0;N<i;N++)t[N].kind===gt.StartPort?E[N]=K-n:t[N].kind===gt.EndPort&&(E[N]=nt+n);Q&&(K-=n);for(let N=0;N<i;N++)t[N].rank=E[N]-K}x(ke,"rank");function Le(t,r,n,i,e,d,l){const w=n===0?t.predStart:t.succStart,T=n===0?t.predE:t.succE,v=n===0?t.EF:t.ET,L=t.pos;for(let A=w[r];A<w[r+1];A++)e[T[A]]!==Ot.Held&&d.push(T[A]);if(d.length<2)return 0;d.sort((A,C)=>L[v[A]]-L[v[C]]||A-C);const k=x(A=>{let C=0;l[0]=0;for(let K=1;K<d.length;K++){const nt=e[d[K]]===e[d[K-1]];l[K]=A(nt&&e[d[K]]===Ot.Leaves,nt),C+=l[K]}return C},"fill");let E=k(()=>1);if(i/E<Oe&&(E=k(A=>A?.5:1)),i/E<Oe&&(E=k((A,C)=>C?0:1)),E===0)return 0;const G=Math.min(fe,i/E);for(let A=1;A<d.length;A++)l[A]*=G;return E*G}x(Le,"sideEnds");function qe(t,r,n,i){const{real:e,W:d,EFD:l,ETD:w}=t;for(let T=0;T<e;T++){const v=Math.min(r[T].span,d[T]);if(!(v<=0||r[T].kind!==gt.Node))for(let L=0;L<2;L++){const k=[],E=[],G=Le(t,T,L,v,L===0?i:n,k,E);if(G===0)continue;const A=L===0?w:l;let C=-G/2;for(let K=0;K<k.length;K++)C+=E[K],A[k[K]]=C}}}x(qe,"spread");function Yt(t,r,n,i){if(!r)return n;const{KIND:e,RANK:d,EF:l,ET:w,succStart:T,succE:v,predStart:L,predE:k}=t;for(let E=0;E<1e5;E++){const G=i===0?l[n]:w[n];if(e[G]!==gt.Dummy||!r[d[G]])break;n=i===0?k[L[G]]:v[T[G]]}return n}x(Yt,"follow");function Ye(t,r,n){const{maxRank:i,KIND:e,EF:d,ET:l,EFD:w,ETD:T,succStart:v,succE:L,predStart:k,predE:E,layerStart:G,order:A}=t;for(const[C,K]of[[0,gt.StartPort],[i,gt.EndPort]]){const nt=G[C],Q=G[C+1],N=[];for(let D=nt;D<Q;D++){const j=A[D],_=K===gt.StartPort;if(e[j]!==K||(_?v[j+1]-v[j]:k[j+1]-k[j])!==1)break;const Y=Yt(t,n,_?L[v[j]]:E[k[j]],_?1:0),q=_?r[l[Y]]+T[Y]:r[d[Y]]+w[Y];if(N.length>0&&q<N[N.length-1]+he)break;N.push(q)}if(!(N.length===0||N.length!==Q-nt))for(let D=nt;D<Q;D++)r[A[D]]=N[D-nt]}}x(Ye,"alignPorts");function ze(t,r,n){const i=[new Int32Array(t.n),new Int32Array(t.n)];for(let e=0;e<t.EF.length;e++)n[e]!==Ot.Held&&i[0][t.ET[e]]++,r[e]!==Ot.Held&&i[1][t.EF[e]]++;return i}x(ze,"freeEnds");function Ve(t,r,n,i,e,d){const l=e.edgeSep,{n:w,real:T,maxRank:v,KIND:L,RANK:k,W:E,EF:G,ET:A,EFD:C,ETD:K,succStart:nt,succE:Q,predStart:N,predE:D,layerStart:j,order:_,pos:Y}=t,q=x(O=>L[O]===gt.Label||L[O]===gt.Dummy&&!(d!==void 0&&d[k[O]]===1),"placed"),Z=x((O,y)=>{const c=y===0?G[O]:A[O];return[y===0?n[c]+C[O]:n[c]+K[O],c<T&&r[c].kind===gt.Node?i[1-y][c]:0]},"end"),o=x(O=>{const y=j[k[O]],c=y+Y[O],s=x(u=>E[u]/2+E[O]/2+Ke(L[u],L[O],e.nodeSep,l),"clear");return[c>y?n[_[c-1]]+s(_[c-1]):-1/0,c+1<j[k[O]+1]?n[_[c+1]]-s(_[c+1]):1/0]},"room"),f=x((O,y,c,s,u)=>{const b=(y[1]!==c[1]?y[1]<c[1]:Math.abs(y[0]-O)<=Math.abs(c[0]-O))?[y[0],c[0]]:[c[0],y[0]];return b.find(P=>P>=s&&P<=u)??Math.max(s,Math.min(u,b[0]))},"choose"),m=new Uint8Array(w),I=[];for(let O=1;O<v;O++)for(let y=j[O];y<j[O+1];y++){if(!q(_[y])||m[_[y]])continue;let c=_[y];for(;Ht(L[G[D[N[c]]]]);)c=G[D[N[c]]];let s=c,u=-1/0,g=1/0;I.length=0;for(let b=c;Ht(L[b]);b=A[Q[nt[b]]]){if(s=b,!q(b))continue;m[b]=1,I.push(b);const[P,M]=o(b);P>u&&(u=P),M<g&&(g=M)}if(u<=g){const b=f(n[I[0]],Z(D[N[c]],0),Z(Q[nt[s]],1),u,g);for(const P of I)n[P]=b;continue}for(const b of I){const[P,M]=o(b);P>M||(n[b]=f(n[b],Z(Yt(t,d,D[N[b]],0),0),Z(Yt(t,d,Q[nt[b]],1),1),P,M))}}}x(Ve,"alignLabels");function Je(t,r,n,i,e,d,l){const{real:w,W:T,EF:v,ET:L,EFD:k,ETD:E,succStart:G,succE:A,predStart:C,predE:K,pos:nt}=t,Q=x((D,j,_,Y,q)=>{if(d[j][_]<2)return 0;D=Yt(t,l,D,j);const Z=j===0?v[D]:L[D],o=j===0?n[Z]+k[D]:n[Z]+E[D];if(q&&Math.abs(o-n[_])<=Y/2+Dt)return Math.max(-Y/2,Math.min(Y/2,o-n[_]));let f=o,m=0;Z<w&&r[Z].kind===gt.Node&&(j===0?i:e)[D]!==Ot.Held&&d[1-j][Z]>=2&&(m=Math.max(0,Math.min(r[Z].span,T[Z])),m>0&&(f=n[Z]));const I=Math.max(n[_]-Y/2,f-m/2),O=Math.min(n[_]+Y/2,f+m/2);if(I>O+Dt){const c=Math.max(0,Y/2-no);return Math.max(-c,Math.min(c,o-n[_]))}const y=(n[_]*m+f*Y)/(m+Y);return Math.max(I,Math.min(O,y))-n[_]},"wanted"),N=[];for(let D=0;D<w;D++){const j=Math.min(r[D].span,T[D]);if(!(j<=0||r[D].kind!==gt.Node))for(let _=0;_<2;_++){const Y=_===0?v:L,q=_===0?C:G,Z=_===0?K:A,o=[],f=[];if(Le(t,D,_,j,_===0?e:i,o,f),o.length===0)continue;o.length===1&&(f[0]=0);const m=[];for(let I=q[D];I<q[D+1];I++)m.push(Z[I]);m.sort((I,O)=>nt[Y[I]]-nt[Y[O]]||I-O),N.push({v:D,side:_,span:j,ids:o,room:f,all:m})}}for(let D=0,j=!0;j&&D<6;D++){j=!1;for(const{v:_,side:Y,span:q,ids:Z,room:o,all:f}of N){const m=Y===0?e:i,I=Y===0?E:k;let O=0,y=-q/2;for(let c=0;c<=f.length;c++){const s=c<f.length&&m[f[c]]===Ot.Held;if(c<f.length&&!s)continue;let u=0;for(let b=c-1;b>=0&&m[f[b]]!==Ot.Held;b--)u++;const g=s?I[f[c]]-fe:q/2;if(u>0){const b=[],P=[];let M=0;for(let p=0;p<u;p++){p>0&&(M+=o[O+p]),b.push(Q(Z[O+p],Y,_,q,D>0)-M),P.push(1);let H=p>0&&o[O+p]===0;for(;b.length>1&&(H||b[b.length-2]/P[P.length-2]>b[b.length-1]/P[P.length-1]);){H=!1;const W=b.pop(),R=P.pop();b[b.length-1]+=W,P[P.length-1]+=R}}const h=M;let z=0;M=0;for(let p=0;p<b.length;p++){const H=g-h<y?(y+g-h)/2:Math.max(y,Math.min(g-h,b[p]/P[p]));for(let W=0;W<P[p];W++,z++)z>0&&(M+=o[O+z]),Math.abs(I[Z[O+z]]-H-M)>.01&&(j=!0),I[Z[O+z]]=H+M}O+=u}s&&(y=I[f[c]]+fe)}}}}x(Je,"settle");function Qe(t,r,n,i){const{n:e,KIND:d,RANK:l,EF:w,ET:T,EFD:v,ETD:L,layerStart:k,order:E,pos:G}=t,A=x(o=>n!==void 0&&d[o]===gt.Dummy&&n[l[o]]===1,"passed"),C=[],K=[],nt=[],Q=[];for(let o=0;o<w.length;o++){if(A(w[o]))continue;const f=Yt(t,n,o,1);C.push(w[o]),K.push(T[f]),nt.push(v[o]),Q.push(L[f])}const N=x(o=>r[K[o]]+Q[o]-r[C[o]]-nt[o],"off"),D=new Int32Array(e),j=[];for(let o=0;o<e;o++)D[o]=o,j.push([o]);const _=x((o,f)=>{let m=D[o],I=D[f];if(m!==I){j[m].length<j[I].length&&([m,I]=[I,m]);for(const O of j[I])D[O]=m,j[m].push(O);j[I]=[]}},"join"),Y=[];for(let o=0;o<C.length;o++){const f=Math.abs(N(o));f<.01?_(C[o],K[o]):f<=Be&&Y.push(o)}if(Y.length===0)return;Y.sort((o,f)=>Math.abs(N(o))-Math.abs(N(f))||o-f);const q=x(o=>Te(t,i,o),"gap"),Z=x((o,f)=>{for(const m of j[o]){const I=k[l[m]],O=k[l[m]+1],y=I+G[m];if(y>I&&D[E[y-1]]!==o&&r[m]+f-r[E[y-1]]<q(m)+q(E[y-1])-.01||y+1<O&&D[E[y+1]]!==o&&r[E[y+1]]-r[m]-f<q(m)+q(E[y+1])-.01)return!1}return!0},"free");for(const o of Y){const f=N(o);if(Math.abs(f)<.01){_(C[o],K[o]);continue}if(Math.abs(f)>Be||D[C[o]]===D[K[o]])continue;const m=D[C[o]],I=D[K[o]],O=j[m].length<=j[I].length?m:I;for(const y of[O,O===m?I:m]){const c=y===m?f:-f;if(!(Math.abs(f)>eo&&!j[y].every(s=>d[s]===gt.Dummy))&&Z(y,c)){for(const s of j[y])r[s]+=c;_(C[o],K[o]);break}}}}x(Qe,"snap");function Ze(t){const{maxRank:r,KIND:n,layerStart:i,order:e}=t,d=new Uint8Array(r+1);let l=!1;for(let w=1;w<r;w++){let T=i[w+1]>i[w];for(let v=i[w];T&&v<i[w+1];v++)n[e[v]]!==gt.Dummy&&(T=!1);T&&(d[w]=1,l=!0)}return l?d:void 0}x(Ze,"emptyRanks");function tn(t,r,n,i,e){const{from:d,to:l,rank:w,track:T,levels:v,wide:L}=t,k=d.length,E=new Map;for(let o=0;o<k;o++){if(T.push(-1),v.push(0),Math.abs(d[o]-l[o])<Dt)continue;const f=E.get(w[o]);f?f.push(o):E.set(w[o],[o])}if(E.size===0)return;const G=new Float64Array(k),A=new Float64Array(k);for(let o=0;o<k;o++)G[o]=Math.min(d[o],l[o]),A[o]=Math.max(d[o],l[o]);const C=x((o,f)=>o>=G[f]-Dt&&o<=A[f]+Dt?1:0,"within"),K=x((o,f)=>Math.abs(d[o]-d[f])<Dt||Math.abs(l[o]-l[f])<Dt,"mates"),nt=x((o,f)=>G[o]<A[f]-Dt&&G[f]<A[o]-Dt,"overlap"),Q=x((o,f)=>nt(o,f)&&!K(o,f),"clash"),N=x((o,f)=>nt(o,f)||C(l[o],f)+C(d[f],o)+C(l[f],o)+C(d[o],f)>0,"meet"),D=x((o,f)=>C(l[o],f)+C(d[f],o),"crossings"),j=x(o=>{const f=o.map((I,O)=>O).sort((I,O)=>G[o[I]]-G[o[O]]),m=[];for(let I=0;I<f.length;I++){const O=f[I],y=A[o[O]]+4*Dt;for(let c=I+1;c<f.length&&G[o[f[c]]]<=y;c++){const s=f[c];m.push(Math.min(O,s),Math.max(O,s))}}return m},"nearPairs"),_=x(o=>{var z;o.sort((p,H)=>A[H]-G[H]-(A[p]-G[p])||G[p]-G[H]||p-H);const f=o.length,m=[],I=o.map((p,H)=>H),O=x(p=>{for(;I[p]!==p;)p=I[p]=I[I[p]];return p},"find"),y=f<=Ge,c=y?j(o):[],s=y?o.map(()=>[]):[];for(let p=0;p<c.length;p+=2){const H=c[p],W=c[p+1];Q(o[H],o[W])&&(s[H].push(W),s[W].push(H))}let u=o.map((p,H)=>H);if(y){const p=new Int32Array(f),H=[];for(let R=0;R<f;R++)m.push([]),H.push([]);for(let R=0;R<c.length;R+=2){const ot=c[R],rt=c[R+1],ft=o[ot],Et=o[rt];if(!N(ft,Et))continue;I[O(ot)]=O(rt);const dt=D(ft,Et),F=D(Et,ft);if(dt===F)continue;const ut=dt<F?ot:rt,yt=dt<F?rt:ot;m[yt].push(ut),H[ut].push(yt),p[yt]++}const W=new Uint8Array(f);u=[];for(let R=0;R<f;R++){let ot=-1;for(let rt=0;rt<f&&!(!W[rt]&&((ot<0||p[rt]<p[ot])&&(ot=rt),p[rt]===0));rt++);W[ot]=1,u.push(ot);for(const rt of H[ot])p[rt]--}}const g=new Set,b=[];let P=0;for(const p of u){const H=o[p];let W=0;for(const R of m[p]??[])T[o[R]]>=W&&(W=T[o[R]]+1);if(y){g.clear();for(const R of s[p])g.add(T[o[R]]);for(;g.has(W);)W++}else{for(;(z=b[W])!=null&&z.some(R=>Q(H,R));)W++;(b[W]??(b[W]=[])).push(H)}T[H]=W,W>=P&&(P=W+1)}const M=new Int32Array(f).fill(P),h=new Int32Array(f).fill(-1);for(let p=0;p<f;p++){const H=O(p);M[H]=Math.min(M[H],T[o[p]]),h[H]=Math.max(h[H],T[o[p]])}for(let p=0;p<f;p++){const H=O(p);v[o[p]]=h[H]-M[H]+1,n&&(T[o[p]]-=M[H])}return P},"lay"),Y=x((o,f,m)=>{const I=le(l[o]-d[o],f);for(let O=0;O<=qt;O++){const y=O/qt,c=1-y;m[2*O]=d[o]+(l[o]-d[o])*y*y*(3-2*y),m[2*O+1]=f*(3*I*y*c*c+3*(1-I)*y*y*c+y*y*y)}},"sample"),q=x((o,f,m)=>{const I=m*m*1.000000001;for(let O=0;O<=qt;O++){const y=o[2*O],c=o[2*O+1];for(let s=0;s<qt;s++){const u=f[2*s+2]-f[2*s],g=f[2*s+3]-f[2*s+1],b=Math.max(0,Math.min(1,((y-f[2*s])*u+(c-f[2*s+1])*g)/(u*u+g*g||1))),P=y-f[2*s]-b*u,M=c-f[2*s+1]-b*g;if(P*P+M*M<I&&Math.hypot(P,M)<m)return!0}}return!1},"reaches"),Z=x((o,f,m,I)=>{const O=Math.max(m/2,m-2*Qn);return Y(o,O,ae),Y(f,O,ce),q(ae,ce,I)||q(ce,ae,I)},"near");for(const[o,f]of E){if(!n){r[o]=_(f);continue}if(f.length>Ge)continue;const m=f.filter(b=>L[b]===1);_(m);const I=new Set(m.filter(b=>v[b]>1)),O=j(f);for(let b=0;b<O.length;b+=2){const P=f[O[b]],M=f[O[b+1]];I.has(P)&&I.has(M)||!Q(P,M)||d[P]<l[P]!=d[M]<l[M]||Z(P,M,i[o],L[P]===1||L[M]===1?Zn:to)&&I.add(P).add(M)}for(const b of m)T[b]=-1,v[b]=0;if(I.size===0)continue;let y=0,c=0;const s=new Set;for(let b=0;b<O.length;b+=2){const P=f[O[b]],M=f[O[b+1]];if(I.has(P)&&I.has(M)){if(!nt(P,M))continue;d[P]<l[P]!=d[M]<l[M]?y++:K(P,M)||c++}else(I.has(P)||I.has(M))&&N(P,M)&&s.add(P).add(M)}if(y>c){for(const b of f)(A[b]-G[b])*_e>e[o]&&(e[o]=(A[b]-G[b])*_e);continue}const u=f.filter(b=>I.has(b)||L[b]!==1&&s.has(b));_(u);let g=0;for(const b of u)v[b]>g&&(g=v[b]);r[o]=g}}x(tn,"assignTracks");function en(t,r,n,i,e,d,l){const{maxRank:w,EF:T,ET:v,EFD:L,ETD:k,succStart:E,succE:G,predStart:A,predE:C,layerStart:K,order:nt}=t,Q=new Float64Array(r.length),N=new Float64Array(r.length),D=new Float64Array(r.length);for(let _=0;_<i.length;_++){const Y=i[_];if(Y<0)continue;const q=Y+e[_]-1,Z=t.RANK[Y];for(let o=Y;o<q;o++){if(!n[Z+o-Y])continue;let f=o;for(;f+1<q&&n[Z+f+1-Y];)f++;const m=C[A[o]],I=G[E[f]],O=r[T[m]]+L[m],y=r[v[I]]+k[I],c=f-o+2;for(let s=o;s<=f;s++)Q[s]=O+(y-O)*(s-o+1)/c,N[s]=O,D[s]=y;o=f}}const j=[];for(let _=1;_<w;_++){if(!n[_])continue;const Y=K[_],q=K[_+1],Z=Array.from(nt.subarray(Y,q)).sort((o,f)=>N[o]-N[f]||D[o]-D[f]||o-f);for(let o=0;o<Z.length;){j.length=0;let f=o;for(;f<Z.length&&Math.abs(N[Z[f]]-N[Z[o]])<he&&Math.abs(D[Z[f]]-D[Z[o]])<he;f++)j.push(Z[f]);j.sort((m,I)=>t.pos[m]-t.pos[I]);for(let m=0;m<j.length;m++){const I=j[m];r[I]=Q[I]+(m-(j.length-1)/2)*d,(j.length===1||d===0)&&(l[I]=1)}o=f}}}x(en,"straighten");function nn(t,r,n,i,e,d){const{maxRank:l,W:w,KIND:T,RANK:v,EF:L,ET:k,EFD:E,ETD:G,succStart:A,succE:C,predStart:K,predE:nt,layerStart:Q,order:N}=t,D=new Uint8Array(l+1);let j=!1;for(let _=1;_<l;_++){let Y=!1,q=!1;for(let Z=Q[_];Z<Q[_+1];Z++){const o=T[N[Z]];o===gt.Label?Y=!0:o!==gt.Dummy&&(q=!0)}Y&&!q&&(D[_]=1,j=!0)}if(j)for(let _=0;_<n.length;_++){const Y=n[_];if(!(Y<0))for(let q=Y,Z=Y+i[_]-1;q<Z;q++){if(T[q]!==gt.Dummy||!D[v[q]])continue;let o=q,f=q;for(;o>Y&&d[o-1];)o--;for(;f+1<Z&&d[f+1];)f++;const m=nt[K[o]],I=C[A[f]],O=r[L[m]]+E[m],y=r[k[I]]+G[I],c=Math.min(O,y)-e,s=Math.max(O,y)+e;let u=!0;const g=v[q];for(let P=Q[g];u&&P<Q[g+1];P++){const M=N[P];T[M]===gt.Label&&r[M]+w[M]/2>c&&r[M]-w[M]/2<s&&(u=!1)}if(!u)continue;d[q]=1;const b=f-o+2;for(let P=o;P<=f;P++)r[P]=O+(y-O)*(P-o+1)/b}}}x(nn,"pastLabels");function on(t,r){const{n,real:i,maxRank:e,W:d,EF:l,ET:w,EFD:T,ETD:v,succStart:L,succE:k,predStart:E,predE:G,layerStart:A,order:C,pos:K,offsets:nt,fixed:Q,GRP:N,groupParent:D}=t;let j=0;for(let $=0;$<=e;$++)j=Math.max(j,A[$+1]-A[$]);if(j<2)return[0,0];const _=nt?new Int32Array(l.length):void 0,Y=new Int32Array(_?l.length:0),q=new Int32Array(_?n:0),Z=_?k.slice():k,o=new Uint8Array(_?n:0);if(_){const $=G.slice(),V=x((B,J,tt,st)=>{for(let ct=J+1;ct<tt;ct++)if(st[B[ct]]!==st[B[J]])return B.subarray(J,tt).sort((Mt,it)=>st[Mt]-st[it]),!0;return!1},"byOffset");for(let B=0;B<n;B++){if(q[B]=1,V($,E[B],E[B+1],v))for(let J=E[B]+1;J<E[B+1];J++)v[$[J]]!==v[$[J-1]]&&q[B]++,Y[$[J]]=q[B]-1;V(Z,L[B],L[B+1],T)&&(o[B]=1)}}let f=1;for(;f<(_?j+l.length:j);)f<<=1;const m=new Int32Array(2*f),I=new Int32Array(l.length),O=x(()=>{let $=0;for(let V=0;V<e;V++){let B=A[V+2]-A[V+1];if(_){let st=0;for(let ct=A[V+1];ct<A[V+2];ct++){const Mt=C[ct];for(let it=E[Mt];it<E[Mt+1];it++)_[G[it]]=st+Y[G[it]];st+=q[Mt]}B=st}if(B<2)continue;let J=0;for(let st=A[V];st<A[V+1];st++){const ct=C[st],Mt=L[ct],it=L[ct+1],mt=J;for(let pt=Mt;pt<it;pt++)I[J++]=_?_[Z[pt]]:K[w[k[pt]]];const lt=J-mt;if(!(lt<2))if(_&&o[ct])for(let pt=mt+1;pt<J;pt++){const bt=I[pt],xt=T[Z[Mt+pt-mt]];let St=pt-1;for(;St>=mt&&T[Z[Mt+St-mt]]===xt&&I[St]>bt;)I[St+1]=I[St],St--;I[St+1]=bt}else if(lt<=12)for(let pt=mt+1;pt<J;pt++){const bt=I[pt];let xt=pt-1;for(;xt>=mt&&I[xt]>bt;)I[xt+1]=I[xt],xt--;I[xt+1]=bt}else I.subarray(mt,J).sort()}if(J<2)continue;let tt=1;for(;tt<B;)tt<<=1;m.fill(0,0,2*tt);for(let st=0;st<J;st++){let ct=I[st]+tt;for(m[ct]++;ct>1;)(ct&1)===0&&($+=m[ct+1]),ct>>=1,m[ct]++}}return $},"count"),y=O(),c=new Float64Array(n),s=new Int32Array(j),u=new Int32Array(j),g=D?D.length:0,b=new Int32Array(g);for(let $=0;$<g;$++)for(let V=$;V>=0;V=D[V])b[$]++;const P=new Float64Array(g),M=new Int32Array(g),h=new Int32Array(g),z=x(($,V)=>{const B=A[$],J=A[$+1];for(let it=B;it<J;it++)for(let mt=N[C[it]];mt>=0;mt=D[mt])P[mt]=0,M[mt]=0;for(let it=B;it<J;it++){const mt=C[it];for(let lt=N[mt];lt>=0;lt=D[lt])M[lt]===0&&(h[lt]=it),P[lt]+=V[mt],M[lt]++}const tt=x(it=>it>=n?P[it-n]/M[it-n]:V[it],"value"),st=x(it=>it>=n?h[it-n]:B+K[it],"first"),ct=x((it,mt)=>{let lt=it,pt=mt,bt=N[it],xt=N[mt],St=bt<0?0:b[bt],Rt=xt<0?0:b[xt];for(;St>Rt;St--)lt=n+bt,bt=D[bt];for(;Rt>St;Rt--)pt=n+xt,xt=D[xt];for(;bt!==xt;)lt=n+bt,bt=D[bt],pt=n+xt,xt=D[xt];return tt(lt)-tt(pt)||st(lt)-st(pt)},"compare"),Mt=Array.from(C.subarray(B,J)).sort(ct);C.set(Mt,B);for(let it=B;it<J;it++)K[C[it]]=it-B},"arrange");if(N){const $=new Float64Array(n);for(let V=0;V<=e;V++){for(let B=A[V];B<A[V+1];B++)$[C[B]]=B-A[V];z(V,$)}}let p=N?O():y;if(p===0)return[0,y];const H=C.slice(),W=Math.min(p,y),R=x(($,V)=>{const B=$?E:L,J=$?G:k,tt=$?l:w,st=$?T:v;for(let ct=1;ct<=e;ct++){const Mt=$?ct:e-ct;if(Q[Mt])continue;const it=A[Mt],mt=A[Mt+1];let lt=0;for(let bt=it;bt<mt;bt++){const xt=C[bt],St=xt<i?r[xt].pin:0;if(St!==0){c[xt]=St*1e9,s[lt++]=xt;continue}const Rt=B[xt],Ct=B[xt+1];if(Rt===Ct){if(N){const Pt=$?A[Mt]-A[Mt-1]:A[Mt+2]-A[Mt+1];c[xt]=(bt-it)*Pt/(mt-it);continue}c[xt]=-1;continue}let Wt=0;for(let Pt=Rt;Pt<Ct;Pt++){const a=tt[J[Pt]];Wt+=K[a],nt&&d[a]>0&&(Wt+=st[J[Pt]]/d[a])}c[xt]=Wt/(Ct-Rt),s[lt++]=xt}if(N){z(Mt,c);continue}if(lt<2)continue;$e(s,lt,c,K,V,u);let pt=0;for(let bt=it;bt<mt;bt++)c[C[bt]]!==-1&&(C[bt]=s[pt++]);for(let bt=it;bt<mt;bt++)K[C[bt]]=bt-it}},"sweep"),ot=x(()=>{let $=0;for(let V=0;V<=e;V++)for(let B=A[V];B<A[V+1];B++)if(!(C[B]>=i))for(let J=B+1;J<A[V+1];J++)C[J]<C[B]&&$++;return $},"outOfOrder"),rt=x(()=>{for(let $=0;$<=e;$++)for(let V=A[$];V<A[$+1];V++)K[C[V]]=V-A[$]},"settlePositions"),ft=x($=>$<i?r[$].pin:0,"pinOf"),Et=x(($,V)=>{const B=V?l[$]:w[$];return nt&&d[B]>0?K[B]+(V?T[$]:v[$])/d[B]:K[B]},"at"),dt=x(($,V)=>{let B=0;for(let J=E[$];J<E[$+1];J++){const tt=Et(G[J],!0);for(let st=E[V];st<E[V+1];st++)tt>Et(G[st],!0)&&B++}for(let J=L[$];J<L[$+1];J++){const tt=Et(k[J],!1);for(let st=L[V];st<L[V+1];st++)tt>Et(k[st],!1)&&B++}return B},"between"),F=x(()=>{for(let $=0;$<8;$++){let V=!1;for(let B=0;B<=e;B++){if(Q[B])continue;const J=A[B];for(let tt=J;tt+1<A[B+1];tt++){const st=C[tt],ct=C[tt+1];ft(st)!==ft(ct)||N&&N[st]!==N[ct]||dt(ct,st)>=dt(st,ct)||(C[tt]=ct,C[tt+1]=st,K[ct]=tt-J,K[st]=tt+1-J,V=!0)}}if(!V)break}},"transpose"),ut=C.slice(),yt=n<=600;let At=H,wt=1/0;for(let $=0;$<(yt?2:1);$++){$>0&&(C.set(ut),rt());let V=W;const B=ut.slice();for(let tt=0,st=0;st<4&&tt<Kn;tt++,st++){R((tt+$)%2===0,tt%4>=2);const ct=O();if(ct<V&&(V=ct,B.set(C),st=0,ct===0))break}if(C.set(B),yt&&V>0){rt(),F();const tt=O();tt<V&&(V=tt,B.set(C))}const J=yt?ot():0;($===0||V<p||V===p&&J<wt)&&(p=V,At=B,wt=J)}if(C.set(At),rt(),H.set(At),N&&(p=O()),!yt)return[p,y];for(let $=0;$<i;$++)if(r[$].pin!==0)return[p,y];if(wt===0||Q[0]||Q[e])return[p,y];for(let $=0;$<=e;$++)C.subarray(A[$],A[$+1]).reverse();return rt(),(O()>p||ot()>=wt)&&C.set(H),[p,y]}x(on,"reduceCrossings");function Te(t,r,n){return t.W[n]/2+(t.KIND[n]===gt.Node?r.nodeSep:r.edgeSep)/2}x(Te,"halfRoom");function de(t,r){const{n,maxRank:i,W:e,KIND:d,EF:l,ET:w,EFD:T,ETD:v,succStart:L,succE:k,predStart:E,predE:G,layerStart:A,order:C,pos:K}=t,nt=l.length,Q=new Float64Array(n);for(let h=0;h<n;h++)Q[h]=Te(t,r,h);const N=new Int32Array(nt);for(let h=0;h<nt;h++)N[h]=K[w[h]];for(let h=0;h<n;h++)L[h+1]-L[h]>1&&ue(k,L[h],L[h+1],N);for(let h=0;h<nt;h++)N[h]=K[l[h]];for(let h=0;h<n;h++)E[h+1]-E[h]>1&&ue(G,E[h],E[h+1],N);const D=new Uint8Array(nt);for(let h=1;h<=i;h++){const z=A[h]-A[h-1],p=A[h],H=A[h+1];let W=0,R=p;for(let ot=p;ot<H;ot++){const rt=C[ot];let ft=-1;if(Ht(d[rt])){const dt=l[G[E[rt]]];Ht(d[dt])&&(ft=dt)}const Et=ft>=0?K[ft]:z;if(ft>=0||ot===H-1){for(let dt=R;dt<=ot;dt++){const F=C[dt],ut=Ht(d[F]);for(let yt=E[F];yt<E[F+1];yt++){const At=G[yt],wt=K[l[At]];(wt<W||Et<wt)&&!(ut&&Ht(d[l[At]]))&&(D[At]=1)}}R=ot+1,W=Et}}}const j=[],_=new Int32Array(n),Y=new Int32Array(n),q=new Float64Array(n),Z=new Int32Array(n),o=new Int32Array(n),f=new Float64Array(n),m=new Int32Array(n),I=new Int32Array(n+1),O=new Int32Array(n),y=new Int32Array(n),c=new Int32Array(n),s=new Float64Array(n);for(let h=0;h<4;h++){const z=h<2,p=(h&1)===1,H=z?E:L,W=z?G:k,R=z?l:w,ot=z?v:T,rt=z?T:v;for(let F=0;F<n;F++)_[F]=F,Y[F]=F,q[F]=0,m[F]=0,I[F+1]=0,s[F]=0;for(let F=0;F<=i;F++){const ut=z?F:i-F,yt=A[ut],At=A[ut+1],wt=z?ut-1:ut+1,$=wt>=0&&wt<=i?A[wt+1]-A[wt]-1:0;let V=-1;for(let B=p?At-1:yt;p?B>=yt:B<At;p?B--:B++){const J=C[B],tt=H[J],st=H[J+1]-tt;if(st===0)continue;const ct=tt+(st-1>>1),Mt=tt+(st>>1);for(let it=0;it<2&&!(it===1&&ct===Mt);it++){const mt=W[it===0!==p?ct:Mt],lt=R[mt],pt=p?$-K[lt]:K[lt];Y[J]===J&&V<pt&&D[mt]===0&&(Y[lt]=J,Y[J]=_[J]=_[lt],q[J]=q[lt]+rt[mt]-ot[mt],V=pt)}}}let ft=0;for(let F=0;F<=i;F++){const ut=A[F],yt=A[F+1];for(let At=ut+1;At<yt;At++){const wt=p?C[At]:C[At-1],$=p?C[At-1]:C[At],V=Q[wt]+Q[$];Z[ft]=_[wt],o[ft]=_[$],f[ft]=p?V-q[wt]+q[$]:V+q[wt]-q[$],m[_[$]]++,I[_[wt]+1]++,ft++}}for(let F=0;F<n;F++)I[F+1]+=I[F];for(let F=0;F<n;F++)y[F]=I[F];for(let F=0;F<ft;F++)O[y[Z[F]]++]=F;let Et=0;for(let F=0;F<n;F++)_[F]===F&&m[F]===0&&(c[Et++]=F);for(let F=0;F<Et;F++){const ut=c[F];for(let yt=I[ut];yt<I[ut+1];yt++){const At=O[yt],wt=o[At];s[ut]+f[At]>s[wt]&&(s[wt]=s[ut]+f[At]),--m[wt]===0&&(c[Et++]=wt)}}for(let F=Et-1;F>=0;F--){const ut=c[F];let yt=1/0;for(let At=I[ut];At<I[ut+1];At++){const wt=O[At],$=s[o[wt]]-f[wt];$<yt&&(yt=$)}yt!==1/0&&yt>s[ut]&&(s[ut]=yt)}const dt=new Float64Array(n);for(let F=0;F<n;F++)dt[F]=(p?-s[_[F]]:s[_[F]])+q[F];j.push(dt)}let u=0,g=1/0;const b=[],P=[];for(let h=0;h<4;h++){let z=1/0,p=-1/0;const H=j[h];for(let W=0;W<n;W++){const R=e[W]/2;H[W]-R<z&&(z=H[W]-R),H[W]+R>p&&(p=H[W]+R)}b.push(z),P.push(p),p-z<g&&(g=p-z,u=h)}for(let h=0;h<4;h++){const z=(h&1)===0?b[u]-b[h]:P[u]-P[h];if(z!==0){const p=j[h];for(let H=0;H<n;H++)p[H]+=z}}const M=new Float64Array(n);for(let h=0;h<n;h++){let z=j[0][h],p=j[1][h],H=j[2][h],W=j[3][h],R;z>p&&(R=z,z=p,p=R),H>W&&(R=H,H=W,W=R),z>H&&(R=z,z=H,H=R),p>W&&(R=p,p=W,W=R),p>H&&(R=p,p=H,H=R),M[h]=(p+H)/2}return M}x(de,"position");var kt={Top:0,Right:1,Bottom:2,Left:3},oo=4e4,ro=400,so=500,io=1.5,ao=4;function pe(t,r,n,i){return{nodes:t.map(({x:e,y:d,w:l,h:w})=>({x:e,y:d,w:l,h:w})),edges:r.map(({route:e,labelX:d,labelY:l})=>({route:e,labelX:d,labelY:l})),levels:n.map(({x:e,y:d,ports:l})=>({x:e,y:d,ports:l.map(({px:w,py:T})=>({px:w,py:T}))})),total:i}}x(pe,"snapshot");function ye(t,r,n,i){return r.forEach((e,d)=>Object.assign(e,t.nodes[d])),n.forEach((e,d)=>Object.assign(e,t.edges[d])),i.forEach((e,d)=>{const l=t.levels[d];e.x=l.x,e.y=l.y,e.ports.forEach((w,T)=>Object.assign(w,l.ports[T]))}),t.total}x(ye,"restore");var Ce=24,Xt=.5,ge=3,we=2,co=Math.max(3,ge,we+1),te=.62,lo=128,jt={Curved:0,Stepped:1,Linear:2};function rn(t){return t.tracks?jt.Stepped:t.straight?jt.Linear:jt.Curved}x(rn,"styleOf");function Jt(t,r,n=jt.Curved){let i=0;for(const y of r)y.src!==y.dst&&y.route.length>3&&(i+=(y.route.length/3-1)*co);const e=new Float64Array(i),d=new Float64Array(i),l=new Float64Array(i),w=new Float64Array(i),T=new Float64Array(i),v=new Float64Array(i),L=new Int32Array(i),k=new Uint8Array(i);let E=0,G=1/0,A=-1/0,C=NaN,K=NaN,nt=NaN,Q=NaN;const N=x((y,c,s,u,g,b)=>{const P=E-1;s===nt&&u===Q&&(b===u&&K===u||g===s&&C===s)&&L[P]===y&&k[P]===c&&(s-C)*(g-s)+(u-K)*(b-u)>0&&(E--,s=C,u=K),C=s,K=u,nt=g,Q=b,k[E]=c,e[E]=Math.min(s,g),l[E]=Math.max(s,g),d[E]=s<=g?u:b,w[E]=s<=g?b:u,T[E]=Math.min(u,b),v[E]=Math.max(u,b),T[E]<G&&(G=T[E]),v[E]>A&&(A=v[E]),L[E++]=y},"add");for(let y=0;y<r.length;y++){const c=r[y];if(c.src===c.dst)continue;const s=c.route,u=x(h=>Math.abs(s[h]-s[h-3])<.01||Math.abs(s[h+1]-s[h-2])<.01,"aligned"),g=x(h=>Math.abs(s[h]-s[h-3])+Math.abs(s[h+1]-s[h-2]),"length"),b=x(h=>n===jt.Curved&&h>0&&h<s.length-3&&u(h)&&u(h+3)&&g(h)>=.01&&g(h+3)>=.01&&Math.abs(s[h]-s[h-3])<.01!=Math.abs(s[h+3]-s[h])<.01,"turns");let P=s[0],M=s[1];for(let h=3;h<s.length;h+=3){const z=(h===3?1:0)|(h===s.length-3?2:0),p=P,H=M,W=s[h],R=s[h+1];if(P=W,M=R,u(h)||n===jt.Linear){if(!b(h)){N(y,z,p,H,W,R);continue}const dt=b(h-3)?g(h)/2:g(h),F=b(h+3)?g(h+3)/2:g(h+3),ut=(W-s[h-3])/g(h),yt=(R-s[h-2])/g(h),At=(s[h+3]-W)/g(h+3),wt=(s[h+4]-R)/g(h+3),$=W-ut*dt,V=R-yt*dt;N(y,z,p,H,$,V);const B=W-ut*dt*(1-te),J=R-yt*dt*(1-te),tt=W+At*F*(1-te),st=R+wt*F*(1-te);P=W+At*F,M=R+wt*F;const ct=z|(h+3===s.length-3?2:0);let Mt=$,it=V;for(let mt=1;mt<=we;mt++){const lt=mt/we,pt=1-lt,bt=pt*pt*pt*$+3*pt*pt*lt*B+3*pt*lt*lt*tt+lt*lt*lt*P,xt=pt*pt*pt*V+3*pt*pt*lt*J+3*pt*lt*lt*st+lt*lt*lt*M;N(y,ct,Mt,it,bt,xt),Mt=bt,it=xt}continue}if(n===jt.Stepped){const dt=s[h+2]===0,F=dt?p:(p+W)/2,ut=dt?(H+R)/2:H;N(y,z,p,H,F,ut),N(y,z,F,ut,dt?W:F,dt?ut:R),N(y,z,dt?W:F,dt?ut:R,W,R);continue}const ot=s[h+2]===0,rt=ot?le(W-p,R-H):le(R-H,W-p);let ft=p,Et=H;for(let dt=1;dt<=ge;dt++){const F=dt/ge,ut=1-F,yt=F*F*(3-2*F),At=3*rt*F*ut*ut+3*(1-rt)*F*F*ut+F*F*F,wt=p+(W-p)*(ot?yt:At),$=H+(R-H)*(ot?At:yt);N(y,z,ft,Et,wt,$),ft=wt,Et=$}}}const D=A>G?Math.round(Math.sqrt(E)):1,j=A>G?D/(A-G):0,_=x(y=>Math.min(D-1,Math.floor((y-G)*j)),"bandOf"),Y=new Int32Array(E),q=new Int32Array(D+1);for(let y=0;y<E;y++){Y[y]=_(T[y]);for(let c=Y[y],s=_(v[y]);c<=s;c++)q[c+1]++}for(let y=0;y<D;y++)q[y+1]+=q[y];const Z=q.slice(0,D),o=new Int32Array(q[D]);for(let y=0;y<E;y++)for(let c=Y[y],s=_(v[y]);c<=s;c++)o[Z[c]++]=y;const f=new Float64Array(r.length*8),m=x((y,c,s,u)=>Math.abs(y[c]-y[s])<Xt&&Math.abs(y[c]-y[u])<Xt||Math.abs(y[c+1]-y[s+1])<Xt&&Math.abs(y[c+1]-y[u+1])<Xt,"inLine");for(let y=0;y<r.length;y++){const c=r[y].route;if(c.length<6)continue;let s=3;for(;s+3<c.length&&m(c,0,s,s+3);)s+=3;const u=c.length-3;let g=u-3;for(;g>=3&&m(c,u,g,g-3);)g-=3;f.set([c[0],c[1],c[s],c[s+1],c[g],c[g+1],c[u],c[u+1]],y*8)}const I=x((y,c,s,u)=>{const g=y*8+(c===1?0:4),b=f[g],P=f[g+1],M=f[g+2]-b,h=f[g+3]-P,z=M*M+h*h,p=z>0?Math.max(0,Math.min(1,((s-b)*M+(u-P)*h)/z)):0;return Math.hypot(s-b-p*M,u-P-p*h)<Xt},"onRun");let O=0;for(let y=0;y<D;y++){const c=q[y+1];if(c-q[y]>lo)o.subarray(q[y],c).sort((s,u)=>e[s]-e[u]||s-u);else for(let s=q[y]+1;s<c;s++){const u=o[s];let g=s;for(;g>q[y]&&e[o[g-1]]>e[u];g--)o[g]=o[g-1];o[g]=u}for(let s=q[y];s<c;s++){const u=o[s],g=l[u]-e[u],b=w[u]-d[u],P=Y[u]===y;for(let M=s+1;M<c;M++){const h=o[M];if(e[h]>l[u])break;if(v[h]<T[u]||T[h]>v[u]||L[u]===L[h]||!P&&Y[h]!==y)continue;const z=g*(d[h]-d[u])-b*(e[h]-e[u]),p=g*(w[h]-d[u])-b*(l[h]-e[u]);if(z>0==p>0)continue;const H=l[h]-e[h],W=w[h]-d[h],R=H*(d[u]-d[h])-W*(e[u]-e[h]),ot=H*(w[u]-d[h])-W*(l[u]-e[h]);if(R>0==ot>0)continue;const rt=r[L[u]],ft=r[L[h]],Et=R/(R-ot),dt=e[u]+Et*g,F=d[u]+Et*b,ut=x((yt,At,wt)=>(k[u]&At)!==0&&(k[h]&wt)!==0||Math.abs(dt-t[yt].x)<t[yt].w/2+Ce&&Math.abs(F-t[yt].y)<t[yt].h/2+Ce||I(L[u],At,dt,F)&&I(L[h],wt,dt,F),"fan");rt.src===ft.src&&ut(rt.src,1,1)||rt.src===ft.dst&&ut(rt.src,1,2)||rt.dst===ft.src&&ut(rt.dst,2,1)||rt.dst===ft.dst&&ut(rt.dst,2,2)||O++}}}return O}x(Jt,"routeCrossings");function sn(t,r){const n=x(i=>{const e=new Set;for(let d=t[i].parent;d>=0&&!e.has(d);d=t[d].parent)e.add(d);return e},"ancestors");for(const[i,e]of r){if(i<0||e<0||i===e)continue;const d=n(i),l=n(e);for(const w of d)l.has(w)||(t[w].dir=void 0);for(const w of l)d.has(w)||(t[w].dir=void 0)}}x(sn,"inheritCrossedDirections");function me(t,r,n=-1){return{w:t,h:r,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}x(me,"cnode");var fo={TB:kt.Top,BT:kt.Bottom,LR:kt.Left,RL:kt.Right};function Qt(t){return fo[t]}x(Qt,"startSide");function Kt(t){return t+2&3}x(Kt,"opposite");function an(t,r,n,i){const e=t.length,d=new Map,l=[],w=x((c,s)=>{const u={id:c,dir:s,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return d.set(c,u),u},"makeLevel"),T=w(-1,n),v=[];for(let c=0;c<e;c++)v.push([]);const L=[];for(let c=0;c<e;c++){const s=t[c].parent;s>=0&&s<e&&s!==c&&t[s].isGroup?v[s].push(c):(t[c].parent=-1,L.push(c))}T.items=L,l.push(T);const k=new Int32Array(e),E=new Uint8Array(e),G=x(c=>{for(let s=c;s<l.length;s++){const u=l[s];for(const g of u.items)if(E[g]=1,k[g]=u.id<0?0:k[u.id]+1,t[g].isGroup){const b=w(g,t[g].dir??u.dir);b.items=v[g],l.push(b)}}},"descend");G(0);for(let c=0;c<e;c++){if(E[c])continue;const s=t[c].parent;if(v[s]=v[s].filter(u=>u!==c),t[c].parent=-1,T.items.push(c),E[c]=1,k[c]=0,t[c].isGroup){const u=l.length,g=w(c,t[c].dir??n);g.items=v[c],l.push(g),G(u)}}for(let c=l.length-1;c>0;c--){const s=l[c];let u=1/0;for(const g of s.items)t[g].seq<u&&(u=t[g].seq);u!==1/0&&(t[s.id].seq=u)}for(const c of l)c.items.sort((s,u)=>t[s].seq-t[u].seq||s-u);let A=0;for(const c of r){let s=c.src,u=c.dst,g=0;for(;k[s]>k[u];g++)s=t[s].parent;for(;k[u]>k[s];g++)u=t[u].parent;for(;s!==u&&t[s].parent!==t[u].parent;g+=2)s=t[s].parent,u=t[u].parent;s!==u&&(A+g>oo?(c.src=s,c.dst=u):A+=g)}const C=[],K=[];for(let c=0;c<r.length;c++){const s=r[c];if(s.route=[],s.src===s.dst){C.push(c);continue}let u=s.src,g=s.dst;const b=[],P=[];for(;k[u]>k[g];)b.push(u),u=t[u].parent;for(;k[g]>k[u];)P.push(g),g=t[g].parent;if(u===g){K.push(c);continue}for(;t[u].parent!==t[g].parent;)b.push(u),P.push(g),u=t[u].parent,g=t[g].parent;d.get(t[u].parent).edges.push({e:c,a:u,b:g});for(const[M,h]of[[b,!0],[P,!1]])for(const z of M){const p=d.get(t[z].parent),H={e:c,inner:z,out:h,side:kt.Top,hint:NaN,px:0,py:0,route:[]};p.ports.push(H),p.portOf.set(c*2+(h?0:1),H)}}const nt=new Int32Array(e),Q=x((c,s,u)=>(u?s.src:s.dst)!==c,"endpointBelow"),N=x((c,s)=>{const u=c.dir==="TB"||c.dir==="BT",g=Qt(c.dir),b=[],P=[];c.items.forEach((p,H)=>{nt[p]=H;const W=t[p],R=s?zt(u?W.w:W.h,u?W.h:W.w):zt(0,0);R.span=W.isGroup?Math.min(W.span,R.w-2*W.padX):W.span,R.key=_?j[p]:NaN,b.push(R)});const M=x((p,H,W)=>t[p].isGroup&&Q(p,r[H],W),"held"),h=x((p,H,W)=>{if(!s||!t[p].isGroup||!Q(p,r[H],W))return 0;const R=d.get(p).portOf.get(H*2+(W?0:1));return u?R.px-t[p].w/2:R.py-t[p].h/2},"offset");for(const p of c.edges){const H=r[p.e],W=Vt(nt[p.a],nt[p.b],H.minlen);s&&(W.labelW=u?H.labelW:H.labelH,W.labelH=u?H.labelH:H.labelW,W.tailDx=h(p.a,p.e,!0),W.headDx=h(p.b,p.e,!1),W.tailFixed=M(p.a,p.e,!0),W.headFixed=M(p.b,p.e,!1)),P.push(W)}const z=new Int32Array(c.ports.length).fill(-1);return c.ports.forEach((p,H)=>{if(p.side===g||p.side===Kt(g)){const W=b.length,R=zt(0,0,p.side===g?gt.StartPort:gt.EndPort);R.key=_?j[p.out?r[p.e].dst:r[p.e].src]:NaN,R.hint=Number.isNaN(p.hint)&&_&&q?q(c,p):p.hint,b.push(R),z[H]=W;const ot=p.out?Vt(nt[p.inner],W):Vt(W,nt[p.inner]);p.out?(ot.tailDx=h(p.inner,p.e,!0),ot.tailFixed=M(p.inner,p.e,!0)):(ot.headDx=h(p.inner,p.e,!1),ot.headFixed=M(p.inner,p.e,!1)),P.push(ot)}else b[nt[p.inner]].pin=p.side===kt.Top||p.side===kt.Left?-1:1}),{lnodes:b,ledges:P,dummies:z}},"build"),D=A>1&&A<=ro&&r.length<=so,j=new Float64Array(e).fill(NaN);let _=!1,Y=0,q,Z=l.length>1&&D;for(const c of l)c.dir!==n&&(Z=!1);if(Z){const c=n==="TB"||n==="BT",s=new Int32Array(e).fill(-1),u=new Int32Array(e).fill(-1),g=[],b=[],P=[];for(let R=0;R<e;R++)t[R].isGroup&&(u[R]=P.length,P.push(-1));for(let R=0;R<e;R++){const ot=t[R].parent;t[R].isGroup?P[u[R]]=ot>=0?u[ot]:-1:(s[R]=g.length,g.push(zt(c?t[R].w:t[R].h,c?t[R].h:t[R].w)),b.push(ot>=0?u[ot]:-1))}const M=[],h=new Int32Array(r.length).fill(-1);r.forEach((R,ot)=>{R.src===R.dst||s[R.src]<0||s[R.dst]<0||(h[ot]=M.length,M.push(Vt(s[R.src],s[R.dst],R.minlen,c?R.labelW:R.labelH,c?R.labelH:R.labelW)))});const z=oe(g,M,{...i,groups:{of:Int32Array.from(b),parent:Int32Array.from(P)},orderOnly:!0});Y=Math.min(z.crossings??0,z.declared??0);const p=new Float64Array(e),H=new Int32Array(e),W=new Int32Array(e).fill(-1);for(let R=0;R<e;R++)if(!(s[R]<0)){j[R]=g[s[R]].x;for(let ot=t[R].parent;ot>=0;ot=t[ot].parent)p[ot]+=j[R],H[ot]++,W[ot]=Math.max(W[ot],g[s[R]].rank)}for(let R=0;R<e;R++)H[R]>0&&(j[R]=p[R]/H[R]);q=x((R,ot)=>{const rt=h[ot.e];if(rt<0||R.id<0||!ot.out||ot.side!==Kt(Qt(R.dir)))return NaN;const ft=M[rt].points;let Et=j[r[ot.e].src],dt=0;for(let F=0;F<ft.length;F+=2)ft[F]===W[R.id]&&(Et=ft[F+1]),ft[F]===W[R.id]+1&&(dt=ft[F+1]);return Et+dt*1e-6},"farHint")}const o=new Map,f=x((c,s,u)=>{if(!D)return{lnodes:s,ledges:u,size:oe(s,u,i)};const g=Xe(s,u);let b=o.get(c.id);b||o.set(c.id,b=[]);for(const M of b){let h=M.given.length===g.length;for(let z=0;h&&z<g.length;z++)h=Object.is(M.given[z],g[z]);if(h)return M}const P={given:g,lnodes:s,ledges:u,size:oe(s,u,i)};return b.push(P),P},"layOut");let m={width:0,height:0};const I=x(()=>{for(const s of l){for(const M of s.ports)t[M.inner].isGroup&&Q(M.inner,r[M.e],M.out)&&(d.get(M.inner).portOf.get(M.e*2+(M.out?0:1)).side=M.side);if(s.edges.length===0)continue;let u=!1;for(const M of s.edges){const h=r[M.e];(t[M.a].isGroup&&h.src!==M.a||t[M.b].isGroup&&h.dst!==M.b)&&(u=!0)}if(!u)continue;const{lnodes:g,ledges:b}=N(s,!1);Se(g,b),ke(g,b,1);const P=Qt(s.dir);s.edges.forEach((M,h)=>{const z=r[M.e],p=!b[h].reversed;t[M.a].isGroup&&z.src!==M.a&&(d.get(M.a).portOf.get(M.e*2).side=p?Kt(P):P),t[M.b].isGroup&&z.dst!==M.b&&(d.get(M.b).portOf.get(M.e*2+1).side=p?P:Kt(P))})}for(let s=l.length-1;s>=0;s--){const u=l[s],g=u.id>=0?t[u.id]:void 0,b=u.dir==="TB"||u.dir==="BT",P=u.dir==="BT"||u.dir==="RL",M=N(u,!0),{lnodes:h,ledges:z,size:p}=f(u,M.lnodes,M.ledges),H=M.dummies,W=b?p.width:p.height,R=b?p.height:p.width,ot=g?g.padX:0,rt=g?g.padTop:0,ft=Math.max(W+2*ot,g?g.minW:0),Et=R+rt+(g?g.padBottom:0),dt=(ft-W)/2,F=rt,ut=x(B=>P?p.height-B:B,"across"),yt=x((B,J)=>dt+(b?B:ut(J)),"tx"),At=x((B,J)=>F+(b?ut(J):B),"ty"),wt=b?0:1,$=x(B=>{const J=[];for(let tt=0;tt<B.length;tt+=2)J.push(yt(B[tt],B[tt+1]),At(B[tt],B[tt+1]),wt);return J},"convert");u.items.forEach((B,J)=>{t[B].x=yt(h[J].x,h[J].y),t[B].y=At(h[J].x,h[J].y)}),u.edges.forEach((B,J)=>{const tt=z[J];u.routes.set(B.e,$(tt.points));const st=r[B.e];st.labelW>0&&(st.labelX=yt(tt.labelX,tt.labelY),st.labelY=At(tt.labelX,tt.labelY))});let V=u.edges.length;u.ports.forEach((B,J)=>{const tt=t[B.inner];if(H[J]>=0){const lt=$(z[V++].points),pt=B.out?lt.length-3:0;let bt=lt[pt],xt=lt[pt+1];B.side===kt.Top?xt=0:B.side===kt.Bottom?xt=Et:B.side===kt.Left?bt=0:bt=ft,B.out?lt.push(bt,xt,wt):lt.unshift(bt,xt,wt),B.px=bt,B.py=xt,B.route=lt;return}let st=tt.x,ct=tt.y;if(tt.isGroup&&Q(B.inner,r[B.e],B.out)){const lt=d.get(B.inner).portOf.get(B.e*2+(B.out?0:1));st+=lt.px-tt.w/2,ct+=lt.py-tt.h/2}else B.side===kt.Top?ct-=tt.h/2:B.side===kt.Bottom?ct+=tt.h/2:B.side===kt.Left?st-=tt.w/2:st+=tt.w/2;let Mt=st,it=ct;B.side===kt.Top?it=0:B.side===kt.Bottom?it=Et:B.side===kt.Left?Mt=0:Mt=ft;const mt=B.side===kt.Top||B.side===kt.Bottom?0:1;B.px=Mt,B.py=it,B.route=B.out?[st,ct,mt,Mt,it,mt]:[Mt,it,mt,st,ct,mt]}),g?(g.w=ft,g.h=Et):m={width:ft,height:Et}}for(const s of l){const u=s.x,g=s.y;for(const b of s.items){const P=t[b];if(P.x+=u,P.y+=g,P.isGroup){const M=d.get(b);M.x=P.x-P.w/2,M.y=P.y-P.h/2}}}const c=x((s,u,g,b)=>{for(let P=0;P<u.length;P+=3){const M=u[P]+g,h=u[P+1]+b,z=s.length;z>=3&&Math.abs(s[z-3]-M)<.01&&Math.abs(s[z-2]-h)<.01||s.push(M,h,u[P+2])}},"append");for(const s of l)for(const u of s.edges){const g=r[u.e],b=[],P=[];for(let h=g.src;t[h].parent!==s.id;h=t[h].parent)P.push(d.get(t[h].parent));for(const h of P)c(b,h.portOf.get(u.e*2).route,h.x,h.y);c(b,s.routes.get(u.e),s.x,s.y);const M=[];for(let h=g.dst;t[h].parent!==s.id;h=t[h].parent)M.push(d.get(t[h].parent));for(let h=M.length-1;h>=0;h--)c(b,M[h].portOf.get(u.e*2+1).route,M[h].x,M[h].y);g.route=b,g.labelW>0&&(g.labelX+=s.x,g.labelY+=s.y)}},"place"),O=rn(i);_=Z,I();let y=-1;if(Z&&(y=Jt(t,r,O),y>Y*io+ao)){const c=pe(t,r,l,m);_=!1,I();const s=Jt(t,r,O);s>=y?(_=!0,m=ye(c,t,r,l)):y=s}if(_===Z&&D){let c=!1;for(const s of l){if(s.id<0)continue;const u=t[s.id],g=s.dir==="TB"||s.dir==="BT",b=Kt(Qt(s.dir)),P=[];for(const M of s.ports){if(M.side!==b)continue;const h=r[M.e].route,z=s.x+M.px,p=s.y+M.py;let H=-1;for(let ot=0;ot<h.length&&(H<0||M.out);ot+=3)Math.abs(h[ot]-z)<.01&&Math.abs(h[ot+1]-p)<.01&&(H=ot);if(H<0)continue;const W=g?0:1;let R=M.out?H+3:H-3;for(;R>=0&&R<h.length&&Math.abs(h[R+W]-h[H+W])<Xt;)R+=M.out?3:-3;R<0||R>=h.length||(M.hint=h[R+W]-(g?u.x-u.w/2:u.y-u.h/2),P.push([g?M.px:M.py,M.hint]))}P.sort((M,h)=>M[0]-h[0]);for(let M=1;M<P.length;M++)P[M-1][1]>P[M][1]&&(c=!0)}if(c){const s=y>=0?y:Jt(t,r,O),u=s>0?pe(t,r,l,m):void 0;u&&(I(),Jt(t,r,O)>=s&&(m=ye(u,t,r,l)))}}for(const c of K){const s=r[c],u=t[s.src],g=t[s.dst];s.route=[u.x,u.y,0,g.x,g.y,0],s.labelX=(u.x+g.x)/2,s.labelY=(u.y+g.y)/2}for(const c of C){const s=r[c],u=t[s.src];s.labelX=u.x+u.w/2+28+s.labelW/2,s.labelY=u.y}return m}x(an,"compoundLayout");var $t=20,be=26,xe=6,cn=12,ho=4,uo=4,po=640,yo=.5,go=.75,wo=.6,mo=1e3,ee={nodeSpacing:50,rankSpacing:50,edgeSpacing:20,diagramPadding:8};function ln(t={}){return{spacing:{node:t.nodeSpacing??ee.nodeSpacing,rank:t.rankSpacing??ee.rankSpacing,edge:ee.edgeSpacing},diagramPadding:t.diagramPadding??ee.diagramPadding}}x(ln,"layoutSettings");var bo=x((t,r)=>{fn(t);const n=t.availableWidth,i=Ae(t,t.direction);if(n===void 0||!(n>0)||i.width<=n||!Gt(t.direction)||n>=po)return i;const e=Ae(t,"TB");return e.width<i.width?e:i},"layered");function Gt(t){return t==="LR"||t==="RL"}x(Gt,"runsAcross");function Ae(t,r){const n=ve(t,r,!1),i=t.availableWidth;if(i===void 0||!(i>0)||n.width<=i)return n;const e=ve(t,r,!0);return e.width<n.width?e:n}x(Ae,"tighten");function Tt(t,r){if(!Number.isFinite(t)||t<0)throw new RangeError(`layout: ${r} must be a finite number >= 0, got ${t}`)}x(Tt,"finite");function fn(t){const r=new Set,n=x((w,T)=>{if(r.has(w))throw new Error(`layout: duplicate ${T} id '${w}'`);r.add(w)},"add");for(const w of t.nodes)n(w.id,"node"),Tt(w.width,`width of node '${w.id}'`),Tt(w.height,`height of node '${w.id}'`),w.span!==void 0&&Tt(w.span,`span of node '${w.id}'`);for(const w of t.groups){n(w.id,"group");const{top:T,right:v,bottom:L,left:k}=w.padding;for(const E of[T,v,L,k])Tt(E,`padding of group '${w.id}'`);w.title&&(Tt(w.title.width,`title width of group '${w.id}'`),Tt(w.title.height,`title height of group '${w.id}'`))}const i=new Set;for(const w of t.edges){if(i.has(w.id))throw new Error(`layout: duplicate edge id '${w.id}'`);if(i.add(w.id),!r.has(w.source))throw new Error(`layout: edge '${w.id}' has unknown source '${w.source}'`);if(!r.has(w.target))throw new Error(`layout: edge '${w.id}' has unknown target '${w.target}'`);Tt(w.minLen,`minLen of edge '${w.id}'`),w.label&&(Tt(w.label.width,`label width of edge '${w.id}'`),Tt(w.label.height,`label height of edge '${w.id}'`))}const{node:e,rank:d,edge:l}=t.spacing;Tt(e,"spacing.node"),Tt(d,"spacing.rank"),Tt(l,"spacing.edge"),t.diagramPadding!==void 0&&Tt(t.diagramPadding,"diagramPadding"),t.headRoom!==void 0&&Tt(t.headRoom,"headRoom")}x(fn,"check");function ve(t,r,n){const i=n?wo:1,e=t.nodes.length,d=new Map,l=[];t.nodes.forEach((o,f)=>{d.set(o.id,f);const m=me(o.width,o.height);m.seq=f,l.push(m)});const w=[];t.groups.forEach((o,f)=>{var O,y;d.set(o.id,e+f);const m=me(0,0);m.isGroup=!0,m.dir=o.direction,m.padX=Math.max(o.padding.left,o.padding.right)*i;const I=o.padding.top*i;w.push(I),m.padTop=I+(((O=o.title)==null?void 0:O.height)??0),m.padBottom=o.padding.bottom*i,m.minW=(((y=o.title)==null?void 0:y.width)??0)+2*m.padX,m.seq=e+f,m.span=1/0,l.push(m)});const T=x(o=>{if(o===void 0)return-1;const f=d.get(o);return f!==void 0&&f>=e?f:-1},"parentOf");t.nodes.forEach((o,f)=>l[f].parent=T(o.parent)),t.groups.forEach((o,f)=>l[e+f].parent=T(o.parent));const v=t.edges.map(o=>[d.get(o.source),d.get(o.target)]);sn(l,v);const L=v.map(([o,f],m)=>{const I=Ee(l,o,f);if(!I&&!Ee(l,f,o))return;const O=I?o:f,y=hn(l,O,r),c=!Gt(y),s=t.edges[m].label,u=s?c?s.height:s.width:0,g=l[O],b=c&&I===(y==="TB"),P=c?b?g.padTop:g.padBottom:g.padX,M=O-e,h=b?t.groups[M].title:void 0,z=h?w[M]/2+h.height:0,p=h?h.width:0;return{group:O,member:I?f:o,out:I,dir:y,band:P,skip:z,titleW:p,labelLen:u}});for(const o of L){if(!o||o.labelLen===0&&o.skip===0)continue;const f=l[o.group],m=o.band+o.labelLen+(t.headRoom??0);Gt(o.dir)?(f.minW+=2*Math.max(0,m-f.padX),f.padX=Math.max(f.padX,m)):o.out===(o.dir==="TB")?f.padTop=Math.max(f.padTop,m):f.padBottom=Math.max(f.padBottom,m)}const k=x(o=>{let f;const m=new Set;for(let I=l[o].parent;I>=0&&f===void 0&&!m.has(I);I=l[I].parent)m.add(I),f=l[I].dir;return Gt(f??r)},"sideways");t.nodes.forEach((o,f)=>{const m=k(f)?o.height:o.width;l[f].span=o.span??Math.max(0,m-2*cn)});const E=new Uint8Array(l.length),G=new Uint16Array(l.length),A=new Float64Array(l.length),C=[],K=t.edges.map((o,f)=>{var c,s;const[m,I]=v[f],O=((c=o.label)==null?void 0:c.width)??0,y=((s=o.label)==null?void 0:s.height)??0;if(m===I&&m<e){const u=l[m],g=k(m)?y:O,b=be+(g>0?g+xe:0);C[f]={index:G[m],reach:A[m]},G[m]++,A[m]+=b,k(m)?(u.h+=2*b,E[m]=2):(u.w+=2*b,E[m]=1)}return{src:m,dst:I,minlen:Math.min(mo,Math.max(1,Math.round(o.minLen))),labelW:O,labelH:y,route:[],labelX:0,labelY:0}}),nt=t.routing??"curved",Q={nodeSep:t.spacing.node*(n?yo:1),edgeSep:t.spacing.edge,rankSep:t.spacing.rank*(n?go:1),portSep:$t,tracks:nt==="stepped",straight:nt==="straight",headRoom:t.headRoom??0},N=an(l,K,r,Q),D=t.diagramPadding??0,j=new Map;t.nodes.forEach((o,f)=>{const m=l[f];j.set(o.id,{x:m.x+D,y:m.y+D,width:o.width,height:o.height})});const _=new Map;t.groups.forEach((o,f)=>{var s;const m=l[e+f],I=m.x+D,O=m.y+D,c=O-m.h/2+w[f]/2+(((s=o.title)==null?void 0:s.height)??0)/2;_.set(o.id,{x:I,y:O,width:m.w,height:m.h,title:{x:I,y:c}})});const Y=x(o=>{const f=l[o],m=o<e?t.nodes[o]:{width:f.w,height:f.h};return{x:f.x+D,y:f.y+D,width:m.width,height:m.height}},"box"),q=new Map,Z=[];t.edges.forEach((o,f)=>{const m=K[f],[I,O]=v[f];if(I===O){const s=C[f]??{index:0,reach:0};q.set(o.id,wn(Y(I),E[I]===2,o.label,s.reach,s.index,G[I]||1));return}if(L[f]){Z.push(f);return}const y=[];for(let s=0;s+2<m.route.length;s+=3)y.push({x:m.route[s]+D,y:m.route[s+1]+D,axis:m.route[s+2]===1?"h":"v"});const c={points:y,ports:{source:Me(Y(I),y[0],ie(r)),target:Me(Y(O),y[y.length-1],se(r))}};(m.labelW>0||m.labelH>0)&&(c.label={x:m.labelX+D,y:m.labelY+D}),q.set(o.id,c)});for(const o of Z){const f=L[o],m=Y(f.member),I=Y(f.group),O=t.edges[o].label,y=dn(m,f,q.values()),c=yn(m,f,y),s=O?gn(I,f,O,c,y):c;q.set(t.edges[o].id,un(I,m,f,O,c,s))}return{width:N.width+2*D,height:N.height+2*D,nodes:j,edges:q,groups:_,direction:r}}x(ve,"run");function Ee(t,r,n){if(r===n||!t[r].isGroup)return!1;const i=new Set;for(let e=t[n].parent;e>=0&&!i.has(e);e=t[e].parent){if(e===r)return!0;i.add(e)}return!1}x(Ee,"holds");function hn(t,r,n){const i=new Set;for(let e=r;e>=0&&!i.has(e);e=t[e].parent){i.add(e);const d=t[e].dir;if(d)return d}return n}x(hn,"flowIn");function un(t,r,{out:n,dir:i,band:e,skip:d,titleW:l,labelLen:w},T,v,L){const{down:k,side:E,face:G}=Ne(r,n,i),C=(k?t.y:t.x)+E*(k?t.height:t.width)/2,K=x(_=>k?{x:v,y:_,axis:"v"}:{x:_,y:v,axis:"h"},"at"),Q=k&&Math.abs(v-t.x)<l/2?C-E*d:C,[N,D]=n?[Q,G]:[G,Q],j={points:[K(N),K(D)],ports:{source:n?se(i):ie(i),target:n?se(i):ie(i)}};if(T){const _=C-E*(e+w/2);j.label=k?{x:L,y:_}:{x:_,y:L}}return j}x(un,"innerEdge");function Ne(t,r,n){const i=!Gt(n),e=n==="TB"||n==="LR"?1:-1,d=r?-e:e,l=(i?t.y:t.x)+d*(i?t.height:t.width)/2;return{down:i,side:d,face:l}}x(Ne,"innerFace");function dn(t,{out:r,dir:n},i){const{down:e,face:d}=Ne(t,r,n),l=e?t.x:t.y,w=(e?t.width:t.height)/2,T=x(k=>e?k.y:k.x,"along"),v=x(k=>e?k.x:k.y,"acrossOf"),L=[];for(const k of i)for(const E of[k.points[0],k.points[k.points.length-1]])!E||Math.abs(T(E)-d)>1||Math.abs(v(E)-l)>w+1||L.push(v(E));return L}x(dn,"endsAt");var pn=x((t,r)=>r.reduce((n,i)=>Math.min(n,Math.abs(t-i)),1/0),"gapTo");function yn(t,{dir:r},n){const i=!Gt(r),e=i?t.x:t.y,d=(i?t.width:t.height)/2,l=x(v=>pn(v,n),"gap");if(l(e)>=$t)return e;const w=Math.max(0,d-Math.min(cn,d/2));let T=e;for(let v=1;v*$t<=w+1e-6;v++)for(const L of[e+v*$t,e-v*$t]){if(l(L)>=$t)return L;l(L)>l(T)&&(T=L)}for(const v of[e+w,e-w])l(v)>l(T)&&(T=v);return T}x(yn,"freeAcross");function gn(t,{dir:r},n,i,e){const d=!Gt(r),l=(d?n.width:n.height)/2,w=l+ho,T=(d?t.width:t.height)/2-l,v=d?t.x:t.y,[L,k]=T>=0?[v-T,v+T]:[v,v],E=Math.max(0,l-uo),G=x(Q=>Q>=L-1e-6&&Q<=k+1e-6&&Math.abs(Q-i)<=E+1e-6,"fits"),A=x(Q=>pn(Q,e),"gap");if(e.length===0||A(i)>=w&&G(i))return i;const C=[i,...e.flatMap(Q=>[Q-w,Q+w])].filter(G);C.sort((Q,N)=>Math.abs(Q-i)-Math.abs(N-i));const K=C.find(Q=>A(Q)>=w);return K!==void 0?K:[x(Q=>Math.min(k,Math.max(L,Q)),"clamp")(i),...C].reduce((Q,N)=>A(N)>A(Q)?N:Q)}x(gn,"labelAcross");var xo={TB:"top",BT:"bottom",LR:"left",RL:"right"},Ao={TB:"bottom",BT:"top",LR:"right",RL:"left"};function se(t){return xo[t]}x(se,"flowStart");function ie(t){return Ao[t]}x(ie,"flowEnd");function Me(t,r,n){if(!r)return n;const i=r.x-t.x,e=r.y-t.y,d=t.width>0?Math.abs(i)/(t.width/2):Math.abs(i),l=t.height>0?Math.abs(e)/(t.height/2):Math.abs(e);return d<1e-6&&l<1e-6?n:l>=d?e<0?"top":"bottom":i<0?"left":"right"}x(Me,"sideOf");function wn(t,r,n,i=0,e=0,d=1){const l=(e+1)/(d+1)/2;if(r){const k=t.y+t.height/2,E=k+i+be,G=t.x-t.width*l,A=t.x+t.width*l;return{points:[{x:G,y:k,axis:"v"},{x:G,y:E,axis:"v"},{x:A,y:E,axis:"h"},{x:A,y:k,axis:"v"}],...n?{label:{x:t.x,y:E+xe+n.height/2}}:{},ports:{source:"bottom",target:"bottom"}}}const w=t.x+t.width/2,T=w+i+be,v=t.y-t.height*l,L=t.y+t.height*l;return{points:[{x:w,y:v,axis:"h"},{x:T,y:v,axis:"h"},{x:T,y:L,axis:"v"},{x:w,y:L,axis:"h"}],...n?{label:{x:T+xe+n.width/2,y:t.y}}:{},ports:{source:"right",target:"right"}}}x(wn,"selfLoop");var vo=12,Eo=4,Mo=7,ne=20,Io=12,mn={TB:"TB",TD:"TB",BT:"BT",LR:"LR",RL:"RL"};function bn(t){return mn[String(t.direction??"").toUpperCase()]??"TB"}x(bn,"direction");var So=x(t=>t==="LR"||t==="RL","sideways"),ko=x((t,r,n)=>(n?r:t)*.6,"roundSpan"),Lo=new Map([...["circle","circ","doublecircle","double-circle","dbl-circ","ellipse","diamond","diam","decision","question","sm-circ","small-circle","start","fr-circ","framed-circle","stop","f-circ","filled-circle","junction","cross-circ","crossed-circle","summary","stateStart","stateEnd","choice","cloud","bang"].map(t=>[t,ko]),...["stadium","terminal","pill"].map(t=>[t,((r,n,i)=>i?n*.6:r-n)]),...["hexagon","hex","prepare"].map(t=>[t,((r,n,i)=>i?n*.5:r-n/2-12)])]),Lt=x(t=>typeof t=="number"&&Number.isFinite(t)&&t>0?t:0,"size"),To=new Set(["rounded","curved","stepped","straight"]);function Re(t){var n,i;const r=(i=(n=t.config)==null?void 0:n.layered)==null?void 0:i.edgeRouting;return r&&To.has(r)?r:"rounded"}x(Re,"routing");var No=new Set(["step","stepBefore","stepAfter"]);function xn(t,r){return t==="rounded"?"rounded":t==="straight"?"linear":t==="stepped"?r&&No.has(r)?r:"step":r}x(xn,"drawnCurve");function An(t,r,n){var v,L,k,E;const i=(L=(v=r.config)==null?void 0:v.flowchart)==null?void 0:L.subGraphTitleMargin,e=Lt((k=t.labelBBox)==null?void 0:k.width),d=Lt((E=t.labelBBox)==null?void 0:E.height),l=e>0&&d>0,w={id:t.id,padding:{top:l?Lt(i==null?void 0:i.top)+Lt(i==null?void 0:i.bottom)+Io:ne,right:ne,bottom:ne,left:ne}};t.parentId&&n.has(t.parentId)&&(w.parent=t.parentId);const T=t.dir?mn[String(t.dir).toUpperCase()]:void 0;return T&&(w.direction=T),l&&(w.title={width:e,height:d}),w}x(An,"toLayoutGroup");function vn(t){const r=new Map(t.map(n=>[n.id,n.parent]));for(const{id:n}of t){const i=new Set([n]);for(let e=r.get(n);e!==void 0;e=r.get(e)){if(i.has(e))throw new Error(`layered: subgraph '${e}' is nested inside itself`);i.add(e)}}}x(vn,"checkNesting");function En(t){return typeof t.label=="string"?t.label.trim().length>0:!!t.label}x(En,"hasLabel");function Mn(t){var L;const r=bn(t),n=(L=t.config)==null?void 0:L.flowchart,{spacing:i}=ln({nodeSpacing:Lt(t.nodeSpacing)||Lt(n==null?void 0:n.nodeSpacing)||void 0,rankSpacing:Lt(t.rankSpacing)||Lt(n==null?void 0:n.rankSpacing)||void 0}),e=new Set(t.nodes.filter(k=>k.isGroup).map(k=>k.id)),d=t.nodes.filter(k=>k.isGroup).map(k=>An(k,t,e));vn(d);const l=[],w=new Set(e);for(const k of t.nodes){if(k.isGroup)continue;w.add(k.id);const E=Lt(k.width),G=Lt(k.height),A={id:k.id,width:E,height:G};k.parentId&&e.has(k.parentId)&&(A.parent=k.parentId);const C=k.shape?Lo.get(k.shape):void 0;C&&(A.span=Math.max(0,C(E,G,So(r)))),l.push(A)}const T=[];for(const k of t.edges){if(k.isLayoutOnly||!k.start||!k.end||!w.has(k.start)||!w.has(k.end))continue;const E={id:k.id,source:k.start,target:k.end,minLen:Math.max(1,Math.round(Lt(k.minlen)||1))},G=Lt(k.width);En(k)&&G>0&&(E.label={width:G+vo,height:Lt(k.height)+Eo}),T.push(E)}const v=Re(t);return{direction:r,nodes:l,edges:T,groups:d,spacing:i,diagramPadding:0,routing:v==="rounded"?"stepped":v,headRoom:Mo}}x(Mn,"toLayoutGraph");function In(t,r){const n=Re(t);for(const i of t.nodes){const e=r.nodes.get(i.id);if(e){i.x=e.x,i.y=e.y;continue}const d=i.isGroup?r.groups.get(i.id):void 0;d&&(i.x=d.x,i.y=d.y,i.width=d.width,i.height=d.height)}for(const i of t.edges){const e=r.edges.get(i.id);e&&(i.points=e.points.map(d=>({x:d.x,y:d.y,axis:d.axis})),i.curve=xn(n,i.curve),e.label&&(i.x=e.label.x,i.y=e.label.y))}}x(In,"applyLayoutModel");var We=x(t=>t!==void 0&&!t.isGroup&&typeof t.intersect=="function"&&Number.isFinite(t.x)&&Number.isFinite(t.y),"hasOutline");function re(t,r){const n=Math.hypot(r.x-t.x,r.y-t.y);if(n<1e-6)return!0;const i=t.intersect(r),e=Math.hypot(i.x-t.x,i.y-t.y);return Number.isFinite(e)&&n<=e+1e-6}x(re,"inside");function Ie(t,r){const n=Math.abs(Math.abs(r.y-t.y)-Lt(t.height)/2)<.5,i=Math.abs(Math.abs(r.x-t.x)-Lt(t.width)/2)<.5;if(!n&&!i)return r;const e=Sn(t,r,n);if(e)return e;if(re(t,r))return r;const d=n?{x:r.x,y:t.y}:{x:t.x,y:r.y};if(!re(t,d)){const T=t.intersect(r);return Number.isFinite(T.x)&&Number.isFinite(T.y)?{...r,x:T.x,y:T.y}:r}let l=0,w=1;for(let T=0;T<40;T++){const v=(l+w)/2,L={x:r.x+(d.x-r.x)*v,y:r.y+(d.y-r.y)*v};re(t,L)?w=v:l=v}return{...r,x:r.x+(d.x-r.x)*w,y:r.y+(d.y-r.y)*w}}x(Ie,"onOutline");function Sn(t,r,n){const i=n?{x:r.x,y:2*t.y-r.y}:{x:2*t.x-r.x,y:r.y},e=t.intersect(Wn(r,i));if(!e||!Number.isFinite(e.x)||!Number.isFinite(e.y)||e===t||e.x===t.x&&e.y===t.y)return;const d=n?Math.abs(e.x-r.x)<.5:Math.abs(e.y-r.y)<.5,l=Math.abs(e.x-t.x)<=Lt(t.width)/2+.5&&Math.abs(e.y-t.y)<=Lt(t.height)/2+.5;if(!(!d||!l))return n?{...r,y:e.y}:{...r,x:e.x}}x(Sn,"firstMet");function kn(t){const r=new Map(t.nodes.map(n=>[n.id,n]));for(const n of t.edges){const i=n.points;if(!Cn(i))continue;const e=r.get(n.start??""),d=r.get(n.end??""),l=[...i];We(e)&&(l[0]=Ie(e,l[0])),We(d)&&(l[l.length-1]=Ie(d,l[l.length-1])),n.points=l}}x(kn,"clipRouteEnds");function Ln(t){const r=bo(Mn(t));return In(t,r),kn(t),r}x(Ln,"runLayeredLayoutCore");var Ro=_n({measureLayout:x((t,r)=>Bn(t,r,{unwrapGroupLabels:!0}),"measureLayout"),runLayoutCore:Ln,paintOptions:{getNodes:x(t=>Tn(t.nodes),"getNodes")},afterPaint:Ue});function Tn(t){const r=new Map(t.filter(e=>e.isGroup).map(e=>[e.id,e.parentId])),n=x(e=>{const d=new Set([e]);let l=0;for(let w=r.get(e);w!==void 0&&r.has(w)&&!d.has(w);)d.add(w),l++,w=r.get(w);return l},"depth");return[...t.map((e,d)=>({n:e,i:d,d:e.isGroup?n(e.id):0})).filter(({n:e})=>e.isGroup).sort((e,d)=>e.d-d.d||e.i-d.i).map(({n:e})=>e),...t.filter(e=>!e.isGroup)]}x(Tn,"paintOrder");function Zt(t){if(Array.isArray(t))return t.map(Zt);if(t!==null&&typeof t=="object"){const r=Object.getPrototypeOf(t);if(r===Object.prototype||r===null){const n={};for(const[i,e]of Object.entries(t))i!=="__proto__"&&(n[i]=Zt(e));return n}}return t}x(Zt,"copyPlain");function Nn(t){const r=new Map;for(const n of[...t.nodes,...t.edges])r.set(n,Zt({...n}));return{nodes:[...t.nodes],edges:[...t.edges],copies:r}}x(Nn,"snapshot");function Rn(t,{nodes:r,edges:n,copies:i}){for(const[e,d]of i){const l=e;for(const w of Object.keys(l))w in d||delete l[w];Object.assign(l,Zt(d))}t.nodes=r,t.edges=n}x(Rn,"restore");async function Fo(t,r,n,i){const e=Nn(t);try{await Ro(t,r,n,i)}catch(d){if(je())throw d;const l=d instanceof Error?d.message:String(d);Gn.warn(`Layered layout failed (${l}); falling back to dagre.`),Rn(t,e),Pn(),r.select("g").selectAll("*").remove(),r.attr("data-layout-fallback","dagre"),t.layoutAlgorithm="dagre",await(await Fn(()=>import("./dagre-KIHZ2IZ3-9ncwFAl9.js"),__vite__mapDeps([0,1,2,3,4,5]))).render(t,r,n,i)}}x(Fo,"render");export{Fo as render,Hn as setLayeredThrowsOnFailure};
|