orbitchat 1.0.3 → 2.0.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/README.md +2 -2
- package/dist/assets/api-BHF9IxKN.js +1 -0
- package/dist/assets/api-DvBZwzfV.js +2 -0
- package/dist/assets/arc-CVHSP1cu-Bj3hxGRV.js +1 -0
- package/dist/assets/{blockDiagram-c4efeb88-CLLcV2XJ-CMXih17a.js → blockDiagram-c4efeb88-BF2cqC5E-C5ugV9-s.js} +8 -8
- package/dist/assets/{c4Diagram-c83219d4-Bq976NrW-DFsl6C0Q.js → c4Diagram-c83219d4-D9AJbzWz-BWb1Tk8y.js} +4 -4
- package/dist/assets/channel-BYhLgIow-BPTRMgNI.js +1 -0
- package/dist/assets/{classDiagram-beda092f-7G8Y9ObP-BEJoZQBZ.js → classDiagram-beda092f-B88VjdUG-BWR-XkYO.js} +2 -2
- package/dist/assets/{classDiagram-v2-2358418a-CYz_KHej-Bu8C3_BF.js → classDiagram-v2-2358418a-BPyGCNOs-CnRIvvFY.js} +2 -2
- package/dist/assets/clone-C0MdfhAf-_B1M49Tw.js +1 -0
- package/dist/assets/{createText-1719965b-Cbn6MBZp-HdNLk45j.js → createText-1719965b-D5GExXUl-CSo0puOR.js} +2 -2
- package/dist/assets/edges-96097737-BnGLzlID--RpsQPpU.js +4 -0
- package/dist/assets/{erDiagram-0228fc6a-Bj5SeSQq-CsjVaWYC.js → erDiagram-0228fc6a-DNX6_tUA-CBfeRoEX.js} +4 -4
- package/dist/assets/{flowDb-c6c81e3f-CaVKc_SB-DZrfNATF.js → flowDb-c6c81e3f-DFROkPpA-DoF7w60g.js} +3 -3
- package/dist/assets/{flowDiagram-50d868cf-BcT1Qv7E-u8dx26BM.js → flowDiagram-50d868cf-Cmwizbui-DAWL0Ten.js} +3 -3
- package/dist/assets/flowDiagram-v2-4f6560a1-LfQOA08G-ByM7AhyC.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-CIF5zs_e-Bgt8PjTx.js → flowchart-elk-definition-6af322e1-CNwLXR6A-Bz6YKMuz.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-wX4z0bcl-BMkD98_f.js → ganttDiagram-a2739b55-7uphPAFV-BFKc01uq.js} +3 -3
- package/dist/assets/{gitGraphDiagram-82fe8481-BTMrrqSM-I1Bmvtxc.js → gitGraphDiagram-82fe8481-DRDypp_x-Cc3_bbqa.js} +5 -5
- package/dist/assets/{graph-Bc6U-Oet-3YUGkDrJ.js → graph-CvRY9YIM-BVZjlKfa.js} +1 -1
- package/dist/assets/index-5325376f-D7k5u-pg-D5Cux9AW.js +1 -0
- package/dist/assets/index-CV3ovvq1.js +983 -0
- package/dist/assets/index-CfrvHiM_.css +1 -0
- package/dist/assets/{infoDiagram-8eee0895-CGdieI3d-CIzc0OGw.js → infoDiagram-8eee0895-BcQBWTwp-Cuo1RYtb.js} +3 -3
- package/dist/assets/{journeyDiagram-c64418c1-D741T7Vx-qfoqs_hr.js → journeyDiagram-c64418c1-CN5eh0M6-CFlv0ZW_.js} +3 -3
- package/dist/assets/layout-DSZZaifl-B9Eg6v4O.js +1 -0
- package/dist/assets/{mindmap-definition-8da855dc-DYXCEYTW-DdvnL6p9.js → mindmap-definition-8da855dc-BIK1yn9--2Uavet_P.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-56nwm0bs-BpTsGhJJ.js → pieDiagram-a8764435-ikNRxsHY-J8pKwIba.js} +5 -5
- package/dist/assets/{quadrantDiagram-1e28029f-BPDrTwrc-DD_xkuIu.js → quadrantDiagram-1e28029f-jvSP5gnQ-IfKQkanh.js} +4 -4
- package/dist/assets/{requirementDiagram-08caed73-ErOyM087-CKQzZzTi.js → requirementDiagram-08caed73-FO_Z83qK-vBJAFnIP.js} +5 -5
- package/dist/assets/{sankeyDiagram-a04cb91d-Dr_h6k2R-DO_fI4J5.js → sankeyDiagram-a04cb91d-DN0iWjES-CD7wN8jh.js} +4 -4
- package/dist/assets/{sequenceDiagram-c5b8d532-wtK0ihCE-DCUXgjj-.js → sequenceDiagram-c5b8d532-CGsjpH84-C-ZWXP1Q.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-D6rDYnWS-Bj3UWumS.js → stateDiagram-1ecb1508-zuhKSs9y-BTHnrZrL.js} +1 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-CNnNRi3z-DT3KwZcD.js +1 -0
- package/dist/assets/{styles-b4e223ce-CPkoRhK8-Bn84ZqKn.js → styles-b4e223ce-BOk_k5Y1-PKPDqdqx.js} +3 -3
- package/dist/assets/{styles-ca3715f6-FCD4s0nN-BexUBZci.js → styles-ca3715f6-g0iC1zjD-CPChcZri.js} +4 -4
- package/dist/assets/{styles-d45a18b0-7fTS_K4G-BYM8_U5l.js → styles-d45a18b0-VfGWd52Q-D7qD0x-3.js} +3 -3
- package/dist/assets/{svgDrawCommon-b86b1483-C9ebAubK-Kv8qCklh.js → svgDrawCommon-b86b1483-BnVJ45aa-CErmScK_.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-C-TPmIif-BZmYoZoQ.js → timeline-definition-faaaa080-BpDBXry4-8Fh7Xq3v.js} +4 -4
- package/dist/assets/{xychartDiagram-f5964ef8-Dy6Sev6Z-D-p_N-TM.js → xychartDiagram-f5964ef8-CvN7DIQW-_wuj7Zir.js} +4 -4
- package/dist/index.html +2 -2
- package/package.json +3 -3
- package/dist/assets/api-Cw0muHPX.js +0 -2
- package/dist/assets/api-DDfFAb3S.js +0 -2
- package/dist/assets/arc-hH97QygY-Dc60tMPx.js +0 -1
- package/dist/assets/channel-CSC8iKVS-B3buI7Pt.js +0 -1
- package/dist/assets/clone-vCPXKFeo-CwhyC9Xy.js +0 -1
- package/dist/assets/edges-96097737-XAH6P1yX-FQjO7zBz.js +0 -4
- package/dist/assets/flowDiagram-v2-4f6560a1-B0fti9Da-BEpPg0cM.js +0 -1
- package/dist/assets/index-5325376f-DCLsNwAa-DsLbLzAP.js +0 -1
- package/dist/assets/index-Cdetzrl0.css +0 -1
- package/dist/assets/index-D-8SZBhx.js +0 -966
- package/dist/assets/layout-BtHnec7v-BmEhz7Rk.js +0 -1
- package/dist/assets/stateDiagram-v2-c2b004d7-K0flL3uN-CfGxGnyr.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{aL as yt,aM as gt,aN as ft,
|
|
1
|
+
import{aL as yt,aM as gt,aN as ft,g as mt,O as w,P as R,h as xt,aO as _t,m as kt}from"./index-CV3ovvq1.js";import{h as Z}from"./arc-CVHSP1cu-Bj3hxGRV.js";var X=function(){var n=function(m,i,o,l){for(o=o||{},l=m.length;l--;o[m[l]]=i);return o},t=[6,8,10,11,12,14,16,17,20,21],e=[1,9],s=[1,10],r=[1,11],a=[1,12],h=[1,13],u=[1,16],y=[1,17],g={trace:function(){},yy:{},symbols_:{error:2,start:3,timeline:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,period_statement:18,event_statement:19,period:20,event:21,$accept:0,$end:1},terminals_:{2:"error",4:"timeline",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",20:"period",21:"event"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[18,1],[19,1]],performAction:function(m,i,o,l,d,c,x){var _=c.length-1;switch(d){case 1:return c[_-1];case 2:this.$=[];break;case 3:c[_-1].push(c[_]),this.$=c[_-1];break;case 4:case 5:this.$=c[_];break;case 6:case 7:this.$=[];break;case 8:l.getCommonDb().setDiagramTitle(c[_].substr(6)),this.$=c[_].substr(6);break;case 9:this.$=c[_].trim(),l.getCommonDb().setAccTitle(this.$);break;case 10:case 11:this.$=c[_].trim(),l.getCommonDb().setAccDescription(this.$);break;case 12:l.addSection(c[_].substr(8)),this.$=c[_].substr(8);break;case 15:l.addTask(c[_],0,""),this.$=c[_];break;case 16:l.addEvent(c[_].substr(2)),this.$=c[_];break}},table:[{3:1,4:[1,2]},{1:[3]},n(t,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:e,12:s,14:r,16:a,17:h,18:14,19:15,20:u,21:y},n(t,[2,7],{1:[2,1]}),n(t,[2,3]),{9:18,11:e,12:s,14:r,16:a,17:h,18:14,19:15,20:u,21:y},n(t,[2,5]),n(t,[2,6]),n(t,[2,8]),{13:[1,19]},{15:[1,20]},n(t,[2,11]),n(t,[2,12]),n(t,[2,13]),n(t,[2,14]),n(t,[2,15]),n(t,[2,16]),n(t,[2,4]),n(t,[2,9]),n(t,[2,10])],defaultActions:{},parseError:function(m,i){if(i.recoverable)this.trace(m);else{var o=new Error(m);throw o.hash=i,o}},parse:function(m){var i=this,o=[0],l=[],d=[null],c=[],x=this.table,_="",$=0,D=0,O=2,A=1,W=c.slice.call(arguments,1),f=Object.create(this.lexer),k={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(k.yy[E]=this.yy[E]);f.setInput(m,k.yy),k.yy.lexer=f,k.yy.parser=this,typeof f.yylloc>"u"&&(f.yylloc={});var I=f.yylloc;c.push(I);var z=f.options&&f.options.ranges;typeof k.yy.parseError=="function"?this.parseError=k.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(){var T;return T=l.pop()||f.lex()||A,typeof T!="number"&&(T instanceof Array&&(l=T,T=l.pop()),T=i.symbols_[T]||T),T}for(var v,P,S,U,L={},B,M,Y,F;;){if(P=o[o.length-1],this.defaultActions[P]?S=this.defaultActions[P]:((v===null||typeof v>"u")&&(v=H()),S=x[P]&&x[P][v]),typeof S>"u"||!S.length||!S[0]){var G="";F=[];for(B in x[P])this.terminals_[B]&&B>O&&F.push("'"+this.terminals_[B]+"'");f.showPosition?G="Parse error on line "+($+1)+`:
|
|
2
2
|
`+f.showPosition()+`
|
|
3
|
-
Expecting `+F.join(", ")+", got '"+(this.terminals_[v]||v)+"'":
|
|
3
|
+
Expecting `+F.join(", ")+", got '"+(this.terminals_[v]||v)+"'":G="Parse error on line "+($+1)+": Unexpected "+(v==A?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(G,{text:f.match,token:this.terminals_[v]||v,line:f.yylineno,loc:I,expected:F})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+v);switch(S[0]){case 1:o.push(v),d.push(f.yytext),c.push(f.yylloc),o.push(S[1]),v=null,D=f.yyleng,_=f.yytext,$=f.yylineno,I=f.yylloc;break;case 2:if(M=this.productions_[S[1]][1],L.$=d[d.length-M],L._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},z&&(L._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),U=this.performAction.apply(L,[_,D,$,k.yy,S[1],d,c].concat(W)),typeof U<"u")return U;M&&(o=o.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),o.push(this.productions_[S[1]][0]),d.push(L.$),c.push(L._$),Y=x[o[o.length-2]][o[o.length-1]],o.push(Y);break;case 3:return!0}}return!0}},p=function(){var m={EOF:1,parseError:function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},setInput:function(i,o){return this.yy=o||this.yy||{},this._input=i,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},input:function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var o=i.match(/(?:\r\n?|\n).*/g);return o?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},unput:function(i){var o=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-o),this.offset-=o;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var c=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:l?(l.length===d.length?this.yylloc.first_column:0)+d[d.length-l.length].length-l[0].length:this.yylloc.first_column-o},this.options.ranges&&(this.yylloc.range=[c[0],c[0]+this.yyleng-o]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(i){this.unput(this.match.slice(i))},pastInput:function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var i=this.pastInput(),o=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
5
|
`+o+"^"},test_match:function(i,o){var l,d,c;if(this.options.backtrack_lexer&&(c={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&&(c.yylloc.range=this.yylloc.range.slice(0))),d=i[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,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(i[0].length),this.matched+=i[0],l=this.performAction.call(this,this.yy,this,o,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var x in c)this[x]=c[x];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,o,l,d;this._more||(this.yytext="",this.match="");for(var c=this._currentRules(),x=0;x<c.length;x++)if(l=this._input.match(this.rules[c[x]]),l&&(!o||l[0].length>o[0].length)){if(o=l,d=x,this.options.backtrack_lexer){if(i=this.test_match(l,c[x]),i!==!1)return i;if(this._backtrack){o=!1;continue}else return!1}else if(!this.options.flex)break}return o?(i=this.test_match(o,c[d]),i!==!1?i:!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})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(i,o,l,d){switch(l){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return m}();g.lexer=p;function b(){this.yy={}}return b.prototype=g,g.Parser=b,new b}();U.parser=U;const bt=U;let N="",nt=0;const G=[],R=[],j=[],it=()=>_t,rt=function(){G.length=0,R.length=0,N="",j.length=0,kt()},st=function(n){N=n,G.push(n)},at=function(){return G},ot=function(){let n=K();const t=100;let e=0;for(;!n&&e<t;)n=K(),e++;return R.push(...j),R},ct=function(n,t,e){const s={id:nt++,section:N,type:N,task:n,score:t||0,events:e?[e]:[]};j.push(s)},lt=function(n){j.find(t=>t.id===nt-1).events.push(n)},ht=function(n){const t={section:N,type:N,description:n,task:n,classes:[]};R.push(t)},K=function(){const n=function(e){return j[e].processed};let t=!0;for(const[e,s]of j.entries())n(e),t=t&&s.processed;return t},vt={clear:rt,getCommonDb:it,addSection:st,getSections:at,getTasks:ot,addTask:ct,addTaskOrg:ht,addEvent:lt},wt=Object.freeze(Object.defineProperty({__proto__:null,addEvent:lt,addSection:st,addTask:ct,addTaskOrg:ht,clear:rt,default:vt,getCommonDb:it,getSections:at,getTasks:ot},Symbol.toStringTag,{value:"Module"})),$t=12,q=function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},St=function(n,t){const e=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),s=n.append("g");s.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function r(u){const y=Z().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}function a(u){const y=Z().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}function h(u){u.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return t.score>3?r(s):t.score<3?a(s):h(s),e},Et=function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},dt=function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),s=n.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class!==void 0&&s.attr("class",t.class);const r=s.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(e),s},It=function(n,t){function e(r,a,h,u,y){return r+","+a+" "+(r+h)+","+a+" "+(r+h)+","+(a+u-y)+" "+(r+h-y*1.2)+","+(a+u)+" "+r+","+(a+u)}const s=n.append("polygon");s.attr("points",e(t.x,t.y,50,20,7)),s.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,dt(n,t)},Mt=function(n,t,e){const s=n.append("g"),r=J();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=e.width,r.height=e.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,q(s,r),ut(e)(t.text,s,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},e,t.colour)};let tt=-1;const Tt=function(n,t,e){const s=t.x+e.width/2,r=n.append("g");tt++,r.append("line").attr("id","task"+tt).attr("x1",s).attr("y1",t.y).attr("x2",s).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),St(r,{cx:s,cy:300+(5-t.score)*30,score:t.score});const a=J();a.x=t.x,a.y=t.y,a.fill=t.fill,a.width=e.width,a.height=e.height,a.class="task task-type-"+t.num,a.rx=3,a.ry=3,q(r,a),t.x+14,ut(e)(t.task,r,a.x,a.y,a.width,a.height,{class:"task"},e,t.colour)},At=function(n,t){q(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},Ht=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},J=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},ut=function(){function n(r,a,h,u,y,g,p,b){const m=a.append("text").attr("x",h+y/2).attr("y",u+g/2+5).style("font-color",b).style("text-anchor","middle").text(r);s(m,p)}function t(r,a,h,u,y,g,p,b,m){const{taskFontSize:i,taskFontFamily:o}=b,l=r.split(/<br\s*\/?>/gi);for(let d=0;d<l.length;d++){const c=d*i-i*(l.length-1)/2,x=a.append("text").attr("x",h+y/2).attr("y",u).attr("fill",m).style("text-anchor","middle").style("font-size",i).style("font-family",o);x.append("tspan").attr("x",h+y/2).attr("dy",c).text(l[d]),x.attr("y",u+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),s(x,p)}}function e(r,a,h,u,y,g,p,b){const m=a.append("switch"),i=m.append("foreignObject").attr("x",h).attr("y",u).attr("width",y).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");i.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,m,h,u,y,g,p,b),s(i,p)}function s(r,a){for(const h in a)h in a&&r.attr(h,a[h])}return function(r){return r.textPlacement==="fo"?e:r.textPlacement==="old"?n:t}}(),Pt=function(n){n.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")};function pt(n,t){n.each(function(){var e=V(this),s=e.text().split(/(\s+|<br>)/).reverse(),r,a=[],h=1.1,u=e.attr("y"),y=parseFloat(e.attr("dy")),g=e.text(null).append("tspan").attr("x",0).attr("y",u).attr("dy",y+"em");for(let p=0;p<s.length;p++)r=s[s.length-1-p],a.push(r),g.text(a.join(" ").trim()),(g.node().getComputedTextLength()>t||r==="<br>")&&(a.pop(),g.text(a.join(" ").trim()),r==="<br>"?a=[""]:a=[r],g=e.append("tspan").attr("x",0).attr("y",u).attr("dy",h+"em").text(r))})}const Ct=function(n,t,e,s){const r=e%$t-1,a=n.append("g");t.section=r,a.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+r));const h=a.append("g"),u=a.append("g"),y=u.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(pt,t.width).node().getBBox(),g=s.fontSize&&s.fontSize.replace?s.fontSize.replace("px",""):s.fontSize;return t.height=y.height+g*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,u.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),zt(h,t,r),t},Ot=function(n,t,e){const s=n.append("g"),r=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(pt,t.width).node().getBBox(),a=e.fontSize&&e.fontSize.replace?e.fontSize.replace("px",""):e.fontSize;return s.remove(),r.height+a*1.1*.5+t.padding},zt=function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},C={drawRect:q,drawCircle:Et,drawSection:Mt,drawText:dt,drawLabel:It,drawTask:Tt,drawBackgroundRect:At,getTextObj:Ht,getNoteRect:J,initGraphics:Pt,drawNode:Ct,getVirtualNodeHeight:Ot},Lt=function(n,t,e,s){var r,a;const h=mt(),u=h.leftMargin??50;w.debug("timeline",s.db);const y=h.securityLevel;let g;y==="sandbox"&&(g=V("#i"+t));const p=(y==="sandbox"?V(g.nodes()[0].contentDocument.body):V("body")).select("#"+t);p.append("g");const b=s.db.getTasks(),m=s.db.getCommonDb().getDiagramTitle();w.debug("task",b),C.initGraphics(p);const i=s.db.getSections();w.debug("sections",i);let o=0,l=0,d=0,c=0,x=50+u,_=50;c=50;let $=0,D=!0;i.forEach(function(f){const k={number:$,descr:f,section:$,width:150,padding:20,maxHeight:o},E=C.getVirtualNodeHeight(p,k,h);w.debug("sectionHeight before draw",E),o=Math.max(o,E+20)});let O=0,A=0;w.debug("tasks.length",b.length);for(const[f,k]of b.entries()){const E={number:f,descr:k,section:k.section,width:150,padding:20,maxHeight:l},I=C.getVirtualNodeHeight(p,E,h);w.debug("taskHeight before draw",I),l=Math.max(l,I+20),O=Math.max(O,k.events.length);let z=0;for(let H=0;H<k.events.length;H++){const v={descr:k.events[H],section:k.section,number:k.section,width:150,padding:20,maxHeight:50};z+=C.getVirtualNodeHeight(p,v,h)}A=Math.max(A,z)}w.debug("maxSectionHeight before draw",o),w.debug("maxTaskHeight before draw",l),i&&i.length>0?i.forEach(f=>{const k=b.filter(H=>H.section===f),E={number:$,descr:f,section:$,width:200*Math.max(k.length,1)-50,padding:20,maxHeight:o};w.debug("sectionNode",E);const I=p.append("g"),z=C.drawNode(I,E,$,h);w.debug("sectionNode output",z),I.attr("transform",`translate(${x}, ${c})`),_+=o+50,k.length>0&&et(p,k,$,x,_,l,h,O,A,o,!1),x+=200*Math.max(k.length,1),_=c,$++}):(D=!1,et(p,b,$,x,_,l,h,O,A,o,!0));const W=p.node().getBBox();w.debug("bounds",W),m&&p.append("text").text(m).attr("x",W.width/2-u).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),d=D?o+l+150:l+100,p.append("g").attr("class","lineWrapper").append("line").attr("x1",u).attr("y1",d).attr("x2",W.width+3*u).attr("y2",d).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),xt(void 0,p,((r=h.timeline)==null?void 0:r.padding)??50,((a=h.timeline)==null?void 0:a.useMaxWidth)??!1)},et=function(n,t,e,s,r,a,h,u,y,g,p){var b;for(const m of t){const i={descr:m.task,section:e,number:e,width:150,padding:20,maxHeight:a};w.debug("taskNode",i);const o=n.append("g").attr("class","taskWrapper"),l=C.drawNode(o,i,e,h).height;if(w.debug("taskHeight after draw",l),o.attr("transform",`translate(${s}, ${r})`),a=Math.max(a,l),m.events){const d=n.append("g").attr("class","lineWrapper");let c=a;r+=100,c=c+Nt(n,m.events,e,s,r,h),r-=100,d.append("line").attr("x1",s+190/2).attr("y1",r+a).attr("x2",s+190/2).attr("y2",r+a+(p?a:g)+y+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}s=s+200,p&&!((b=h.timeline)!=null&&b.disableMulticolor)&&e++}r=r-10},Nt=function(n,t,e,s,r,a){let h=0;const u=r;r=r+100;for(const y of t){const g={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};w.debug("eventNode",g);const p=n.append("g").attr("class","eventWrapper"),b=C.drawNode(p,g,e,a).height;h=h+b,p.attr("transform",`translate(${s}, ${r})`),r=r+10+b}return r=u,h},jt={setConf:()=>{},draw:Lt},Dt=n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],yt(n["lineColor"+e])?n["lineColor"+e]=gt(n["lineColor"+e],20):n["lineColor"+e]=ft(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const s=""+(17-3*e);t+=`
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var i=this.next();return i||this.lex()},begin:function(i){this.conditionStack.push(i)},popState:function(){var i=this.conditionStack.length-1;return i>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(i){return i=this.conditionStack.length-1-Math.abs(i||0),i>=0?this.conditionStack[i]:"INITIAL"},pushState:function(i){this.begin(i)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(i,o,l,d){switch(l){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;case 8:return this.popState(),"acc_title_value";case 9:return this.begin("acc_descr"),14;case 10:return this.popState(),"acc_descr_value";case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 21;case 16:return 20;case 17:return 6;case 18:return"INVALID"}},rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?::\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18],inclusive:!0}}};return m}();g.lexer=p;function b(){this.yy={}}return b.prototype=g,g.Parser=b,new b}();X.parser=X;const bt=X;let N="",nt=0;const J=[],V=[],j=[],it=()=>_t,rt=function(){J.length=0,V.length=0,N="",j.length=0,kt()},st=function(n){N=n,J.push(n)},at=function(){return J},ot=function(){let n=K();const t=100;let e=0;for(;!n&&e<t;)n=K(),e++;return V.push(...j),V},ct=function(n,t,e){const s={id:nt++,section:N,type:N,task:n,score:t||0,events:e?[e]:[]};j.push(s)},lt=function(n){j.find(t=>t.id===nt-1).events.push(n)},ht=function(n){const t={section:N,type:N,description:n,task:n,classes:[]};V.push(t)},K=function(){const n=function(e){return j[e].processed};let t=!0;for(const[e,s]of j.entries())n(e),t=t&&s.processed;return t},vt={clear:rt,getCommonDb:it,addSection:st,getSections:at,getTasks:ot,addTask:ct,addTaskOrg:ht,addEvent:lt},wt=Object.freeze(Object.defineProperty({__proto__:null,addEvent:lt,addSection:st,addTask:ct,addTaskOrg:ht,clear:rt,default:vt,getCommonDb:it,getSections:at,getTasks:ot},Symbol.toStringTag,{value:"Module"})),$t=12,q=function(n,t){const e=n.append("rect");return e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),e.attr("rx",t.rx),e.attr("ry",t.ry),t.class!==void 0&&e.attr("class",t.class),e},St=function(n,t){const e=n.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),s=n.append("g");s.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),s.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function r(u){const y=Z().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}function a(u){const y=Z().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);u.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}function h(u){u.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return t.score>3?r(s):t.score<3?a(s):h(s),e},Et=function(n,t){const e=n.append("circle");return e.attr("cx",t.cx),e.attr("cy",t.cy),e.attr("class","actor-"+t.pos),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("r",t.r),e.class!==void 0&&e.attr("class",e.class),t.title!==void 0&&e.append("title").text(t.title),e},dt=function(n,t){const e=t.text.replace(/<br\s*\/?>/gi," "),s=n.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class!==void 0&&s.attr("class",t.class);const r=s.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(e),s},It=function(n,t){function e(r,a,h,u,y){return r+","+a+" "+(r+h)+","+a+" "+(r+h)+","+(a+u-y)+" "+(r+h-y*1.2)+","+(a+u)+" "+r+","+(a+u)}const s=n.append("polygon");s.attr("points",e(t.x,t.y,50,20,7)),s.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,dt(n,t)},Mt=function(n,t,e){const s=n.append("g"),r=Q();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=e.width,r.height=e.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,q(s,r),ut(e)(t.text,s,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},e,t.colour)};let tt=-1;const Tt=function(n,t,e){const s=t.x+e.width/2,r=n.append("g");tt++,r.append("line").attr("id","task"+tt).attr("x1",s).attr("y1",t.y).attr("x2",s).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),St(r,{cx:s,cy:300+(5-t.score)*30,score:t.score});const a=Q();a.x=t.x,a.y=t.y,a.fill=t.fill,a.width=e.width,a.height=e.height,a.class="task task-type-"+t.num,a.rx=3,a.ry=3,q(r,a),t.x+14,ut(e)(t.task,r,a.x,a.y,a.width,a.height,{class:"task"},e,t.colour)},At=function(n,t){q(n,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},Ht=function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},Q=function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},ut=function(){function n(r,a,h,u,y,g,p,b){const m=a.append("text").attr("x",h+y/2).attr("y",u+g/2+5).style("font-color",b).style("text-anchor","middle").text(r);s(m,p)}function t(r,a,h,u,y,g,p,b,m){const{taskFontSize:i,taskFontFamily:o}=b,l=r.split(/<br\s*\/?>/gi);for(let d=0;d<l.length;d++){const c=d*i-i*(l.length-1)/2,x=a.append("text").attr("x",h+y/2).attr("y",u).attr("fill",m).style("text-anchor","middle").style("font-size",i).style("font-family",o);x.append("tspan").attr("x",h+y/2).attr("dy",c).text(l[d]),x.attr("y",u+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),s(x,p)}}function e(r,a,h,u,y,g,p,b){const m=a.append("switch"),i=m.append("foreignObject").attr("x",h).attr("y",u).attr("width",y).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");i.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,m,h,u,y,g,p,b),s(i,p)}function s(r,a){for(const h in a)h in a&&r.attr(h,a[h])}return function(r){return r.textPlacement==="fo"?e:r.textPlacement==="old"?n:t}}(),Pt=function(n){n.append("defs").append("marker").attr("id","arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")};function pt(n,t){n.each(function(){var e=R(this),s=e.text().split(/(\s+|<br>)/).reverse(),r,a=[],h=1.1,u=e.attr("y"),y=parseFloat(e.attr("dy")),g=e.text(null).append("tspan").attr("x",0).attr("y",u).attr("dy",y+"em");for(let p=0;p<s.length;p++)r=s[s.length-1-p],a.push(r),g.text(a.join(" ").trim()),(g.node().getComputedTextLength()>t||r==="<br>")&&(a.pop(),g.text(a.join(" ").trim()),r==="<br>"?a=[""]:a=[r],g=e.append("tspan").attr("x",0).attr("y",u).attr("dy",h+"em").text(r))})}const Ct=function(n,t,e,s){const r=e%$t-1,a=n.append("g");t.section=r,a.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+r));const h=a.append("g"),u=a.append("g"),y=u.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(pt,t.width).node().getBBox(),g=s.fontSize&&s.fontSize.replace?s.fontSize.replace("px",""):s.fontSize;return t.height=y.height+g*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,u.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),zt(h,t,r),t},Ot=function(n,t,e){const s=n.append("g"),r=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(pt,t.width).node().getBBox(),a=e.fontSize&&e.fontSize.replace?e.fontSize.replace("px",""):e.fontSize;return s.remove(),r.height+a*1.1*.5+t.padding},zt=function(n,t,e){n.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+t.type).attr("d",`M0 ${t.height-5} v${-t.height+10} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),n.append("line").attr("class","node-line-"+e).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},C={drawRect:q,drawCircle:Et,drawSection:Mt,drawText:dt,drawLabel:It,drawTask:Tt,drawBackgroundRect:At,getTextObj:Ht,getNoteRect:Q,initGraphics:Pt,drawNode:Ct,getVirtualNodeHeight:Ot},Lt=function(n,t,e,s){var r,a;const h=mt(),u=h.leftMargin??50;w.debug("timeline",s.db);const y=h.securityLevel;let g;y==="sandbox"&&(g=R("#i"+t));const p=(y==="sandbox"?R(g.nodes()[0].contentDocument.body):R("body")).select("#"+t);p.append("g");const b=s.db.getTasks(),m=s.db.getCommonDb().getDiagramTitle();w.debug("task",b),C.initGraphics(p);const i=s.db.getSections();w.debug("sections",i);let o=0,l=0,d=0,c=0,x=50+u,_=50;c=50;let $=0,D=!0;i.forEach(function(f){const k={number:$,descr:f,section:$,width:150,padding:20,maxHeight:o},E=C.getVirtualNodeHeight(p,k,h);w.debug("sectionHeight before draw",E),o=Math.max(o,E+20)});let O=0,A=0;w.debug("tasks.length",b.length);for(const[f,k]of b.entries()){const E={number:f,descr:k,section:k.section,width:150,padding:20,maxHeight:l},I=C.getVirtualNodeHeight(p,E,h);w.debug("taskHeight before draw",I),l=Math.max(l,I+20),O=Math.max(O,k.events.length);let z=0;for(let H=0;H<k.events.length;H++){const v={descr:k.events[H],section:k.section,number:k.section,width:150,padding:20,maxHeight:50};z+=C.getVirtualNodeHeight(p,v,h)}A=Math.max(A,z)}w.debug("maxSectionHeight before draw",o),w.debug("maxTaskHeight before draw",l),i&&i.length>0?i.forEach(f=>{const k=b.filter(H=>H.section===f),E={number:$,descr:f,section:$,width:200*Math.max(k.length,1)-50,padding:20,maxHeight:o};w.debug("sectionNode",E);const I=p.append("g"),z=C.drawNode(I,E,$,h);w.debug("sectionNode output",z),I.attr("transform",`translate(${x}, ${c})`),_+=o+50,k.length>0&&et(p,k,$,x,_,l,h,O,A,o,!1),x+=200*Math.max(k.length,1),_=c,$++}):(D=!1,et(p,b,$,x,_,l,h,O,A,o,!0));const W=p.node().getBBox();w.debug("bounds",W),m&&p.append("text").text(m).attr("x",W.width/2-u).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),d=D?o+l+150:l+100,p.append("g").attr("class","lineWrapper").append("line").attr("x1",u).attr("y1",d).attr("x2",W.width+3*u).attr("y2",d).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),xt(void 0,p,((r=h.timeline)==null?void 0:r.padding)??50,((a=h.timeline)==null?void 0:a.useMaxWidth)??!1)},et=function(n,t,e,s,r,a,h,u,y,g,p){var b;for(const m of t){const i={descr:m.task,section:e,number:e,width:150,padding:20,maxHeight:a};w.debug("taskNode",i);const o=n.append("g").attr("class","taskWrapper"),l=C.drawNode(o,i,e,h).height;if(w.debug("taskHeight after draw",l),o.attr("transform",`translate(${s}, ${r})`),a=Math.max(a,l),m.events){const d=n.append("g").attr("class","lineWrapper");let c=a;r+=100,c=c+Nt(n,m.events,e,s,r,h),r-=100,d.append("line").attr("x1",s+190/2).attr("y1",r+a).attr("x2",s+190/2).attr("y2",r+a+(p?a:g)+y+120).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5")}s=s+200,p&&!((b=h.timeline)!=null&&b.disableMulticolor)&&e++}r=r-10},Nt=function(n,t,e,s,r,a){let h=0;const u=r;r=r+100;for(const y of t){const g={descr:y,section:e,number:e,width:150,padding:20,maxHeight:50};w.debug("eventNode",g);const p=n.append("g").attr("class","eventWrapper"),b=C.drawNode(p,g,e,a).height;h=h+b,p.attr("transform",`translate(${s}, ${r})`),r=r+10+b}return r=u,h},jt={setConf:()=>{},draw:Lt},Dt=n=>{let t="";for(let e=0;e<n.THEME_COLOR_LIMIT;e++)n["lineColor"+e]=n["lineColor"+e]||n["cScaleInv"+e],yt(n["lineColor"+e])?n["lineColor"+e]=gt(n["lineColor"+e],20):n["lineColor"+e]=ft(n["lineColor"+e],20);for(let e=0;e<n.THEME_COLOR_LIMIT;e++){const s=""+(17-3*e);t+=`
|
|
7
7
|
.section-${e-1} rect, .section-${e-1} path, .section-${e-1} circle, .section-${e-1} path {
|
|
8
8
|
fill: ${n["cScale"+e]};
|
|
9
9
|
}
|
|
@@ -58,4 +58,4 @@ Expecting `+F.join(", ")+", got '"+(this.terminals_[v]||v)+"'":Q="Parse error on
|
|
|
58
58
|
.eventWrapper {
|
|
59
59
|
filter: brightness(120%);
|
|
60
60
|
}
|
|
61
|
-
`,Bt=Wt,
|
|
61
|
+
`,Bt=Wt,Vt={db:wt,renderer:jt,parser:bt,styles:Bt};export{Vt as diagram};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{v as Ft,x as Bt,j as At,w as Nt,y as Ot,b as Xt,O as wt,ab as Vt,V as Ut,m as Yt,ak as nt,ac as kt,af as Ht,aj as Gt,q as jt,al as xt,C as dt,c as pt}from"./index-CV3ovvq1.js";import{U as Qt}from"./createText-1719965b-D5GExXUl-CSo0puOR.js";var et=function(){var e=function($,h,r,l){for(r=r||{},l=$.length;l--;r[$[l]]=h);return r},t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],c=[1,6],g=[1,7],p=[1,5,10,12,14,16,18,19,21,23,34,35,36],y=[1,25],D=[1,26],C=[1,28],_=[1,29],P=[1,30],v=[1,31],S=[1,32],E=[1,33],d=[1,34],A=[1,35],o=[1,36],T=[1,37],B=[1,43],ot=[1,42],rt=[1,47],U=[1,50],m=[1,10,12,14,16,18,19,21,23,34,35,36],Q=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],R=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],lt=[1,64],K={trace:function(){},yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:function($,h,r,l,f,a,w){var u=a.length-1;switch(f){case 5:l.setOrientation(a[u]);break;case 9:l.setDiagramTitle(a[u].text.trim());break;case 12:l.setLineData({text:"",type:"text"},a[u]);break;case 13:l.setLineData(a[u-1],a[u]);break;case 14:l.setBarData({text:"",type:"text"},a[u]);break;case 15:l.setBarData(a[u-1],a[u]);break;case 16:this.$=a[u].trim(),l.setAccTitle(this.$);break;case 17:case 18:this.$=a[u].trim(),l.setAccDescription(this.$);break;case 19:this.$=a[u-1];break;case 20:this.$=[Number(a[u-2]),...a[u]];break;case 21:this.$=[Number(a[u])];break;case 22:l.setXAxisTitle(a[u]);break;case 23:l.setXAxisTitle(a[u-1]);break;case 24:l.setXAxisTitle({type:"text",text:""});break;case 25:l.setXAxisBand(a[u]);break;case 26:l.setXAxisRangeData(Number(a[u-2]),Number(a[u]));break;case 27:this.$=a[u-1];break;case 28:this.$=[a[u-2],...a[u]];break;case 29:this.$=[a[u]];break;case 30:l.setYAxisTitle(a[u]);break;case 31:l.setYAxisTitle(a[u-1]);break;case 32:l.setYAxisTitle({type:"text",text:""});break;case 33:l.setYAxisRangeData(Number(a[u-2]),Number(a[u]));break;case 37:this.$={text:a[u],type:"text"};break;case 38:this.$={text:a[u],type:"text"};break;case 39:this.$={text:a[u],type:"markdown"};break;case 40:this.$=a[u];break;case 41:this.$=a[u-1]+""+a[u];break}},table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:c,36:g}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:c,36:g}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:c,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,34]),e(p,[2,35]),e(p,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:c,36:g}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,34:n,35:c,36:g}),{11:23,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},{11:39,13:38,24:B,27:ot,29:40,30:41,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},{11:45,15:44,27:rt,33:46,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},{11:49,17:48,24:U,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},{11:52,17:51,24:U,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},{20:[1,53]},{22:[1,54]},e(m,[2,18]),{1:[2,2]},e(m,[2,8]),e(m,[2,9]),e(Q,[2,37],{40:55,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T}),e(Q,[2,38]),e(Q,[2,39]),e(R,[2,40]),e(R,[2,42]),e(R,[2,43]),e(R,[2,44]),e(R,[2,45]),e(R,[2,46]),e(R,[2,47]),e(R,[2,48]),e(R,[2,49]),e(R,[2,50]),e(R,[2,51]),e(m,[2,10]),e(m,[2,22],{30:41,29:56,24:B,27:ot}),e(m,[2,24]),e(m,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},e(m,[2,11]),e(m,[2,30],{33:60,27:rt}),e(m,[2,32]),{31:[1,61]},e(m,[2,12]),{17:62,24:U},{25:63,27:lt},e(m,[2,14]),{17:65,24:U},e(m,[2,16]),e(m,[2,17]),e(R,[2,41]),e(m,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(m,[2,31]),{27:[1,69]},e(m,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(m,[2,15]),e(m,[2,26]),e(m,[2,27]),{11:59,32:72,37:24,38:y,39:D,40:27,41:C,42:_,43:P,44:v,45:S,46:E,47:d,48:A,49:o,50:T},e(m,[2,33]),e(m,[2,19]),{25:73,27:lt},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:function($,h){if(h.recoverable)this.trace($);else{var r=new Error($);throw r.hash=h,r}},parse:function($){var h=this,r=[0],l=[],f=[null],a=[],w=this.table,u="",Y=0,ct=0,It=2,gt=1,Mt=a.slice.call(arguments,1),b=Object.create(this.lexer),z={yy:{}};for(var q in this.yy)Object.prototype.hasOwnProperty.call(this.yy,q)&&(z.yy[q]=this.yy[q]);b.setInput($,z.yy),z.yy.lexer=b,z.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var J=b.yylloc;a.push(J);var zt=b.options&&b.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Wt(){var M;return M=l.pop()||b.lex()||gt,typeof M!="number"&&(M instanceof Array&&(l=M,M=l.pop()),M=h.symbols_[M]||M),M}for(var k,W,L,tt,F={},H,I,ut,G;;){if(W=r[r.length-1],this.defaultActions[W]?L=this.defaultActions[W]:((k===null||typeof k>"u")&&(k=Wt()),L=w[W]&&w[W][k]),typeof L>"u"||!L.length||!L[0]){var it="";G=[];for(H in w[W])this.terminals_[H]&&H>It&&G.push("'"+this.terminals_[H]+"'");b.showPosition?it="Parse error on line "+(Y+1)+`:
|
|
2
2
|
`+b.showPosition()+`
|
|
3
|
-
Expecting `+G.join(", ")+", got '"+(this.terminals_[k]||k)+"'":it="Parse error on line "+(Y+1)+": Unexpected "+(k==gt?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(it,{text:b.match,token:this.terminals_[k]||k,line:b.yylineno,loc:
|
|
3
|
+
Expecting `+G.join(", ")+", got '"+(this.terminals_[k]||k)+"'":it="Parse error on line "+(Y+1)+": Unexpected "+(k==gt?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(it,{text:b.match,token:this.terminals_[k]||k,line:b.yylineno,loc:J,expected:G})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+k);switch(L[0]){case 1:r.push(k),f.push(b.yytext),a.push(b.yylloc),r.push(L[1]),k=null,ct=b.yyleng,u=b.yytext,Y=b.yylineno,J=b.yylloc;break;case 2:if(I=this.productions_[L[1]][1],F.$=f[f.length-I],F._$={first_line:a[a.length-(I||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(I||1)].first_column,last_column:a[a.length-1].last_column},zt&&(F._$.range=[a[a.length-(I||1)].range[0],a[a.length-1].range[1]]),tt=this.performAction.apply(F,[u,ct,Y,z.yy,L[1],f,a].concat(Mt)),typeof tt<"u")return tt;I&&(r=r.slice(0,-1*I*2),f=f.slice(0,-1*I),a=a.slice(0,-1*I)),r.push(this.productions_[L[1]][0]),f.push(F.$),a.push(F._$),ut=w[r[r.length-2]][r[r.length-1]],r.push(ut);break;case 3:return!0}}return!0}},$t=function(){var $={EOF:1,parseError:function(h,r){if(this.yy.parser)this.yy.parser.parseError(h,r);else throw new Error(h)},setInput:function(h,r){return this.yy=r||this.yy||{},this._input=h,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},input:function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var r=h.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},unput:function(h){var r=h.length,l=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;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),l.length-1&&(this.yylineno-=l.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:l?(l.length===f.length?this.yylloc.first_column:0)+f[f.length-l.length].length-l[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(h){this.unput(this.match.slice(h))},pastInput:function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var h=this.pastInput(),r=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
5
5
|
`+r+"^"},test_match:function(h,r){var l,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=h[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+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,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(h[0].length),this.matched+=h[0],l=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var w in a)this[w]=a[w];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var h,r,l,f;this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),w=0;w<a.length;w++)if(l=this._input.match(this.rules[a[w]]),l&&(!r||l[0].length>r[0].length)){if(r=l,f=w,this.options.backtrack_lexer){if(h=this.test_match(l,a[w]),h!==!1)return h;if(this._backtrack){r=!1;continue}else return!1}else if(!this.options.flex)break}return r?(h=this.test_match(r,a[f]),h!==!1?h:!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})},lex:function(){var h=this.next();return h||this.lex()},begin:function(h){this.conditionStack.push(h)},popState:function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},pushState:function(h){this.begin(h)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(h,r,l,f){switch(l){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";case 17:return this.pushState("axis_data"),"Y_AXIS";case 18:return this.pushState("axis_band_data"),24;case 19:return 31;case 20:return this.pushState("data"),16;case 21:return this.pushState("data"),18;case 22:return this.pushState("data_inner"),24;case 23:return 27;case 24:return this.popState(),26;case 25:this.popState();break;case 26:this.pushState("string");break;case 27:this.popState();break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 43:break;case 44:return 35;case 45:return 36}},rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}};return M}();K.lexer=Mt;function Z(){this.yy={}}return Z.prototype=K,K.Parser=Z,new Z}();et.parser=et;const Kt=et;function ft(e){return e.type==="bar"}function St(e){return e.type==="band"}function N(e){return e.type==="linear"}class Ct{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((c,g)=>Math.max(g.length,c),0)*i,height:i};const s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const c of t){const g=jt(n,1,c),p=g?g.width:c.length*i,y=g?g.height:i;s.width=Math.max(s.width,p),s.height=Math.max(s.height,y)}return n.remove(),s}}const yt=.7,mt=.2;class _t{constructor(t,i,s,n){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){yt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(yt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=mt*t.width;this.outerPadding=Math.min(s.width/2,n);const c=s.height+this.axisConfig.labelPadding*2;this.labelTextHeight=s.height,c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=mt*t.height;this.outerPadding=Math.min(s.height/2,n);const c=s.width+this.axisConfig.labelPadding*2;c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}}class Zt extends _t{constructor(t,i,s,n,c){super(t,n,c,i),this.categories=s,this.scale=xt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=xt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),wt.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)||this.getRange()[0]}}class Jt extends _t{constructor(t,i,s,n,c){super(t,n,c,i),this.domain=s,this.scale=dt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=dt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}}function bt(e,t,i,s){const n=new Ct(s);return St(e)?new Zt(t,i,e.categories,e.title,n):new Jt(t,i,[e.min,e.max],e.title,n)}class qt{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),n=i.height+2*this.chartConfig.titlePadding;return i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}}function ti(e,t,i,s){const n=new Ct(s);return new qt(n,e,t,i)}class ii{constructor(t,i,s,n,c){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=c}getDrawableElement(){const t=this.plotData.data.map(s=>[this.xAxis.getScaleValue(s[0]),this.yAxis.getScaleValue(s[1])]);let i;return this.orientation==="horizontal"?i=pt().y(s=>s[0]).x(s=>s[1])(t):i=pt().x(s=>s[0]).y(s=>s[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}}class ei{constructor(t,i,s,n,c,g){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=c,this.plotIndex=g}getDrawableElement(){const t=this.barData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),s=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:this.boundingRect.x,y:n[0]-s,height:i,width:n[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:n[0]-s,y:n[1],width:i,height:this.boundingRect.y+this.boundingRect.height-n[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}}class si{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const n=new ii(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break;case"bar":{const n=new ei(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break}return t}}function ni(e,t,i){return new si(e,t,i)}class ai{constructor(t,i,s,n){this.chartConfig=t,this.chartData=i,this.componentStore={title:ti(t,i,s,n),plot:ni(t,i,s),xAxis:bt(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:bt(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),g=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:c,height:g});t-=p.width,i-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=p.height,i-=p.height,this.componentStore.xAxis.setAxisPosition("bottom"),p=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=p.height,this.componentStore.yAxis.setAxisPosition("left"),p=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=p.width,t-=p.width,t>0&&(c+=t,t=0),i>0&&(g+=i,i=0),this.componentStore.plot.calculateSpace({width:c,height:g}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.xAxis.setRange([s,s+c]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+g}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(y=>ft(y))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=0,g=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),p=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),y=this.componentStore.plot.calculateSpace({width:g,height:p});t-=y.width,i-=y.height,y=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=y.height,i-=y.height,this.componentStore.xAxis.setAxisPosition("left"),y=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=y.width,n=y.width,this.componentStore.yAxis.setAxisPosition("top"),y=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=y.height,c=s+y.height,t>0&&(g+=t,t=0),i>0&&(p+=i,i=0),this.componentStore.plot.calculateSpace({width:g,height:p}),this.componentStore.plot.setBoundingBoxXY({x:n,y:c}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([c,c+p]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:c}),this.chartData.plots.some(D=>ft(D))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}}class hi{static build(t,i,s,n){return new ai(t,i,s,n).getDrawableElement()}}let O=0,Tt,X=Lt(),V=Rt(),x=Dt(),st=V.plotColorPalette.split(",").map(e=>e.trim()),Q=!1,at=!1;function Rt(){const e=Gt(),t=nt();return kt(e.xyChart,t.themeVariables.xyChart)}function Lt(){const e=nt();return kt(Ht.xyChart,e.xyChart)}function Dt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function ht(e){const t=nt();return Qt(e.trim(),t)}function oi(e){Tt=e}function ri(e){e==="horizontal"?X.chartOrientation="horizontal":X.chartOrientation="vertical"}function li(e){x.xAxis.title=ht(e.text)}function Pt(e,t){x.xAxis={type:"linear",title:x.xAxis.title,min:e,max:t},Q=!0}function ci(e){x.xAxis={type:"band",title:x.xAxis.title,categories:e.map(t=>ht(t.text))},Q=!0}function gi(e){x.yAxis.title=ht(e.text)}function ui(e,t){x.yAxis={type:"linear",title:x.yAxis.title,min:e,max:t},at=!0}function xi(e){const t=Math.min(...e),i=Math.max(...e),s=N(x.yAxis)?x.yAxis.min:1/0,n=N(x.yAxis)?x.yAxis.max:-1/0;x.yAxis={type:"linear",title:x.yAxis.title,min:Math.min(s,t),max:Math.max(n,i)}}function Et(e){let t=[];if(e.length===0)return t;if(!Q){const i=N(x.xAxis)?x.xAxis.min:1/0,s=N(x.xAxis)?x.xAxis.max:-1/0;Pt(Math.min(i,1),Math.max(s,e.length))}if(at||xi(e),St(x.xAxis)&&(t=x.xAxis.categories.map((i,s)=>[i,e[s]])),N(x.xAxis)){const i=x.xAxis.min,s=x.xAxis.max,n=(s-i+1)/e.length,c=[];for(let g=i;g<=s;g+=n)c.push(`${g}`);t=c.map((g,p)=>[g,e[p]])}return t}function vt(e){return st[e===0?0:e%st.length]}function di(e,t){const i=Et(t);x.plots.push({type:"line",strokeFill:vt(O),strokeWidth:2,data:i}),O++}function pi(e,t){const i=Et(t);x.plots.push({type:"bar",fill:vt(O),data:i}),O++}function fi(){if(x.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return x.title=At(),hi.build(X,x,V,Tt)}function yi(){return V}function mi(){return X}const bi=function(){Yt(),O=0,X=Lt(),x=Dt(),V=Rt(),st=V.plotColorPalette.split(",").map(e=>e.trim()),Q=!1,at=!1},Ai={getDrawableElem:fi,clear:bi,setAccTitle:Xt,getAccTitle:Ot,setDiagramTitle:Nt,getDiagramTitle:At,getAccDescription:Bt,setAccDescription:Ft,setOrientation:ri,setXAxisTitle:li,setXAxisRangeData:Pt,setXAxisBand:ci,setYAxisTitle:gi,setYAxisRangeData:ui,setLineData:di,setBarData:pi,setTmpSVGG:oi,getChartThemeConfig:yi,getChartConfig:mi},wi=(e,t,i,s)=>{const n=s.db,c=n.getChartThemeConfig(),g=n.getChartConfig();function p(d){return d==="top"?"text-before-edge":"middle"}function y(d){return d==="left"?"start":d==="right"?"end":"middle"}function D(d){return`translate(${d.x}, ${d.y}) rotate(${d.rotation||0})`}wt.debug(`Rendering xychart chart
|
|
7
|
-
`+e);const
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var h=this.next();return h||this.lex()},begin:function(h){this.conditionStack.push(h)},popState:function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},pushState:function(h){this.begin(h)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(h,r,l,f){switch(l){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 8;case 16:return this.pushState("axis_data"),"X_AXIS";case 17:return this.pushState("axis_data"),"Y_AXIS";case 18:return this.pushState("axis_band_data"),24;case 19:return 31;case 20:return this.pushState("data"),16;case 21:return this.pushState("data"),18;case 22:return this.pushState("data_inner"),24;case 23:return 27;case 24:return this.popState(),26;case 25:this.popState();break;case 26:this.pushState("string");break;case 27:this.popState();break;case 28:return"STR";case 29:return 24;case 30:return 26;case 31:return 43;case 32:return"COLON";case 33:return 44;case 34:return 28;case 35:return 45;case 36:return 46;case 37:return 48;case 38:return 50;case 39:return 47;case 40:return 41;case 41:return 49;case 42:return 42;case 43:break;case 44:return 35;case 45:return 36}},rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,23,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,20,21,22,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,24,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,23,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[27,28],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,20,21,25,26,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],inclusive:!0}}};return $}();K.lexer=$t;function Z(){this.yy={}}return Z.prototype=K,K.Parser=Z,new Z}();et.parser=et;const Kt=et;function ft(e){return e.type==="bar"}function Ct(e){return e.type==="band"}function N(e){return e.type==="linear"}class St{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((c,g)=>Math.max(g.length,c),0)*i,height:i};const s={width:0,height:0},n=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const c of t){const g=Qt(n,1,c),p=g?g.width:c.length*i,y=g?g.height:i;s.width=Math.max(s.width,p),s.height=Math.max(s.height,y)}return n.remove(),s}}const yt=.7,mt=.2;class _t{constructor(t,i,s,n){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){yt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(yt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=mt*t.width;this.outerPadding=Math.min(s.width/2,n);const c=s.height+this.axisConfig.labelPadding*2;this.labelTextHeight=s.height,c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const s=this.getLabelDimension(),n=mt*t.height;this.outerPadding=Math.min(s.height/2,n);const c=s.width+this.axisConfig.labelPadding*2;c<=i&&(i-=c,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),n=s.height+this.axisConfig.titlePadding*2;this.titleTextHeight=s.height,n<=i&&(i-=n,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(s=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}}class Zt extends _t{constructor(t,i,s,n,c){super(t,n,c,i),this.categories=s,this.scale=xt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=xt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),wt.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)||this.getRange()[0]}}class qt extends _t{constructor(t,i,s,n,c){super(t,n,c,i),this.domain=s,this.scale=dt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=dt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}}function bt(e,t,i,s){const n=new St(s);return Ct(e)?new Zt(t,i,e.categories,e.title,n):new qt(t,i,[e.min,e.max],e.title,n)}class Jt{constructor(t,i,s,n){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=n,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),n=i.height+2*this.chartConfig.titlePadding;return i.width<=s&&i.height<=n&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=s,this.boundingRect.height=n,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}}function ti(e,t,i,s){const n=new St(s);return new Jt(n,e,t,i)}class ii{constructor(t,i,s,n,c){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=c}getDrawableElement(){const t=this.plotData.data.map(s=>[this.xAxis.getScaleValue(s[0]),this.yAxis.getScaleValue(s[1])]);let i;return this.orientation==="horizontal"?i=pt().y(s=>s[0]).x(s=>s[1])(t):i=pt().x(s=>s[0]).y(s=>s[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}}class ei{constructor(t,i,s,n,c,g){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=n,this.orientation=c,this.plotIndex=g}getDrawableElement(){const t=this.barData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),s=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:this.boundingRect.x,y:n[0]-s,height:i,width:n[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:n[0]-s,y:n[1],width:i,height:this.boundingRect.y+this.boundingRect.height-n[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}}class si{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");const t=[];for(const[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{const n=new ii(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break;case"bar":{const n=new ei(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...n.getDrawableElement())}break}return t}}function ni(e,t,i){return new si(e,t,i)}class ai{constructor(t,i,s,n){this.chartConfig=t,this.chartData=i,this.componentStore={title:ti(t,i,s,n),plot:ni(t,i,s),xAxis:bt(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},n),yAxis:bt(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},n)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),g=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:c,height:g});t-=p.width,i-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),n=p.height,i-=p.height,this.componentStore.xAxis.setAxisPosition("bottom"),p=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=p.height,this.componentStore.yAxis.setAxisPosition("left"),p=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=p.width,t-=p.width,t>0&&(c+=t,t=0),i>0&&(g+=i,i=0),this.componentStore.plot.calculateSpace({width:c,height:g}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.xAxis.setRange([s,s+c]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:n+g}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(y=>ft(y))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,n=0,c=0,g=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),p=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),y=this.componentStore.plot.calculateSpace({width:g,height:p});t-=y.width,i-=y.height,y=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=y.height,i-=y.height,this.componentStore.xAxis.setAxisPosition("left"),y=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=y.width,n=y.width,this.componentStore.yAxis.setAxisPosition("top"),y=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=y.height,c=s+y.height,t>0&&(g+=t,t=0),i>0&&(p+=i,i=0),this.componentStore.plot.calculateSpace({width:g,height:p}),this.componentStore.plot.setBoundingBoxXY({x:n,y:c}),this.componentStore.yAxis.setRange([n,n+g]),this.componentStore.yAxis.setBoundingBoxXY({x:n,y:s}),this.componentStore.xAxis.setRange([c,c+p]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:c}),this.chartData.plots.some(D=>ft(D))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}}class hi{static build(t,i,s,n){return new ai(t,i,s,n).getDrawableElement()}}let O=0,Tt,X=Lt(),V=Rt(),x=Dt(),st=V.plotColorPalette.split(",").map(e=>e.trim()),j=!1,at=!1;function Rt(){const e=Gt(),t=nt();return kt(e.xyChart,t.themeVariables.xyChart)}function Lt(){const e=nt();return kt(Ht.xyChart,e.xyChart)}function Dt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function ht(e){const t=nt();return jt(e.trim(),t)}function oi(e){Tt=e}function ri(e){e==="horizontal"?X.chartOrientation="horizontal":X.chartOrientation="vertical"}function li(e){x.xAxis.title=ht(e.text)}function Pt(e,t){x.xAxis={type:"linear",title:x.xAxis.title,min:e,max:t},j=!0}function ci(e){x.xAxis={type:"band",title:x.xAxis.title,categories:e.map(t=>ht(t.text))},j=!0}function gi(e){x.yAxis.title=ht(e.text)}function ui(e,t){x.yAxis={type:"linear",title:x.yAxis.title,min:e,max:t},at=!0}function xi(e){const t=Math.min(...e),i=Math.max(...e),s=N(x.yAxis)?x.yAxis.min:1/0,n=N(x.yAxis)?x.yAxis.max:-1/0;x.yAxis={type:"linear",title:x.yAxis.title,min:Math.min(s,t),max:Math.max(n,i)}}function vt(e){let t=[];if(e.length===0)return t;if(!j){const i=N(x.xAxis)?x.xAxis.min:1/0,s=N(x.xAxis)?x.xAxis.max:-1/0;Pt(Math.min(i,1),Math.max(s,e.length))}if(at||xi(e),Ct(x.xAxis)&&(t=x.xAxis.categories.map((i,s)=>[i,e[s]])),N(x.xAxis)){const i=x.xAxis.min,s=x.xAxis.max,n=(s-i+1)/e.length,c=[];for(let g=i;g<=s;g+=n)c.push(`${g}`);t=c.map((g,p)=>[g,e[p]])}return t}function Et(e){return st[e===0?0:e%st.length]}function di(e,t){const i=vt(t);x.plots.push({type:"line",strokeFill:Et(O),strokeWidth:2,data:i}),O++}function pi(e,t){const i=vt(t);x.plots.push({type:"bar",fill:Et(O),data:i}),O++}function fi(){if(x.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return x.title=At(),hi.build(X,x,V,Tt)}function yi(){return V}function mi(){return X}const bi=function(){Yt(),O=0,X=Lt(),x=Dt(),V=Rt(),st=V.plotColorPalette.split(",").map(e=>e.trim()),j=!1,at=!1},Ai={getDrawableElem:fi,clear:bi,setAccTitle:Xt,getAccTitle:Ot,setDiagramTitle:Nt,getDiagramTitle:At,getAccDescription:Bt,setAccDescription:Ft,setOrientation:ri,setXAxisTitle:li,setXAxisRangeData:Pt,setXAxisBand:ci,setYAxisTitle:gi,setYAxisRangeData:ui,setLineData:di,setBarData:pi,setTmpSVGG:oi,getChartThemeConfig:yi,getChartConfig:mi},wi=(e,t,i,s)=>{const n=s.db,c=n.getChartThemeConfig(),g=n.getChartConfig();function p(d){return d==="top"?"text-before-edge":"middle"}function y(d){return d==="left"?"start":d==="right"?"end":"middle"}function D(d){return`translate(${d.x}, ${d.y}) rotate(${d.rotation||0})`}wt.debug(`Rendering xychart chart
|
|
7
|
+
`+e);const C=Vt(t),_=C.append("g").attr("class","main"),P=_.append("rect").attr("width",g.width).attr("height",g.height).attr("class","background");Ut(C,g.height,g.width,!0),C.attr("viewBox",`0 0 ${g.width} ${g.height}`),P.attr("fill",c.backgroundColor),n.setTmpSVGG(C.append("g").attr("class","mermaid-tmp-group"));const v=n.getDrawableElem(),S={};function E(d){let A=_,o="";for(const[T]of d.entries()){let B=_;T>0&&S[o]&&(B=S[o]),o+=d[T],A=S[o],A||(A=S[o]=B.append("g").attr("class",d[T]))}return A}for(const d of v){if(d.data.length===0)continue;const A=E(d.groupTexts);switch(d.type){case"rect":A.selectAll("rect").data(d.data).enter().append("rect").attr("x",o=>o.x).attr("y",o=>o.y).attr("width",o=>o.width).attr("height",o=>o.height).attr("fill",o=>o.fill).attr("stroke",o=>o.strokeFill).attr("stroke-width",o=>o.strokeWidth);break;case"text":A.selectAll("text").data(d.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",o=>o.fill).attr("font-size",o=>o.fontSize).attr("dominant-baseline",o=>p(o.verticalPos)).attr("text-anchor",o=>y(o.horizontalPos)).attr("transform",o=>D(o)).text(o=>o.text);break;case"path":A.selectAll("path").data(d.data).enter().append("path").attr("d",o=>o.path).attr("fill",o=>o.fill?o.fill:"none").attr("stroke",o=>o.strokeFill).attr("stroke-width",o=>o.strokeWidth);break}}},ki={draw:wi},_i={parser:Kt,db:Ai,renderer:ki};export{_i as diagram};
|
package/dist/index.html
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
14
14
|
}
|
|
15
15
|
</style>
|
|
16
|
-
<script type="module" crossorigin src="/assets/index-
|
|
17
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
16
|
+
<script type="module" crossorigin src="/assets/index-CV3ovvq1.js"></script>
|
|
17
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CfrvHiM_.css">
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
20
20
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orbitchat",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"orbitchat": "./bin/orbitchat.js"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"prepublishOnly": "npm run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@schmitech/chatbot-api": "^
|
|
29
|
-
"@schmitech/markdown-renderer": "^0.
|
|
28
|
+
"@schmitech/chatbot-api": "^2.0.0",
|
|
29
|
+
"@schmitech/markdown-renderer": "^0.4.1",
|
|
30
30
|
"@types/markdown-it": "^14.1.2",
|
|
31
31
|
"lucide-react": "^0.344.0",
|
|
32
32
|
"path": "^0.12.7",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as P}from"./index-D-8SZBhx.js";var F=Object.defineProperty,b=(o,t,e)=>t in o?F(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,m=(o,t,e)=>b(o,typeof t!="symbol"?t+"":t,e);let v=null,E=null;typeof window>"u"&&Promise.all([P(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).catch(()=>null),P(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).catch(()=>null)]).then(([o,t])=>{var e,r;(e=o==null?void 0:o.default)!=null&&e.Agent?v=new o.default.Agent({keepAlive:!0}):o!=null&&o.Agent&&(v=new o.Agent({keepAlive:!0})),(r=t==null?void 0:t.default)!=null&&r.Agent?E=new t.default.Agent({keepAlive:!0}):t!=null&&t.Agent&&(E=new t.Agent({keepAlive:!0}))}).catch(o=>{console.warn("Failed to initialize HTTP agents:",o.message)});class C{constructor(t){if(m(this,"apiUrl"),m(this,"apiKey"),m(this,"sessionId"),!t.apiUrl||typeof t.apiUrl!="string")throw new Error("API URL must be a valid string");if(t.apiKey!==void 0&&t.apiKey!==null&&typeof t.apiKey!="string")throw new Error("API key must be a valid string or null");if(t.sessionId!==void 0&&t.sessionId!==null&&typeof t.sessionId!="string")throw new Error("Session ID must be a valid string or null");this.apiUrl=t.apiUrl,this.apiKey=t.apiKey??null,this.sessionId=t.sessionId??null}setSessionId(t){if(t!==null&&typeof t!="string")throw new Error("Session ID must be a valid string or null");this.sessionId=t}getSessionId(){return this.sessionId}async validateApiKey(){var t;if(!this.apiKey)throw new Error("API key is required for validation");try{const e=await fetch(`${this.apiUrl}/admin/api-keys/${this.apiKey}/status`,{...this.getFetchOptions({method:"GET"})}).catch(s=>{throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s});if(!e.ok){let s="";try{s=await e.text()}catch{s=`HTTP ${e.status}`}let i,n;try{const a=JSON.parse(s);i=a.detail||a.message||s}catch{i=s||`HTTP ${e.status}`}switch(e.status){case 401:n="API key is invalid or expired";break;case 403:n="Access denied: API key does not have required permissions";break;case 404:n="API key not found";break;case 503:n="API key management is not available in inference-only mode";break;default:n=`Failed to validate API key: ${i}`;break}throw new Error(n)}const r=await e.json();if(!r.exists){const s="API key does not exist";throw new Error(s)}if(!r.active){const s="API key is inactive";throw new Error(s)}return r}catch(e){let r;throw e instanceof Error&&e.message?e.message.includes("API key")||e.message.includes("Access denied")||e.message.includes("invalid")||e.message.includes("expired")||e.message.includes("inactive")||e.message.includes("not found")||e.message.includes("Could not connect")?r=e.message:r=`API key validation failed: ${e.message}`:e.name==="TypeError"&&(t=e.message)!=null&&t.includes("Failed to fetch")?r="Could not connect to the server. Please check if the server is running.":r="API key validation failed. Please check your API key and try again.",console.warn(`[ApiClient] ${r}`),new Error(r)}}async getAdapterInfo(){var t;if(!this.apiKey)throw new Error("API key is required to get adapter information");try{const e=await fetch(`${this.apiUrl}/admin/api-keys/info`,{...this.getFetchOptions({method:"GET"})}).catch(r=>{throw r.name==="TypeError"&&r.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):r});if(!e.ok){let r="";try{r=await e.text()}catch{r=`HTTP ${e.status}`}let s,i;try{const n=JSON.parse(r);s=n.detail||n.message||r}catch{s=r||`HTTP ${e.status}`}switch(e.status){case 401:i="API key is invalid, disabled, or has no associated adapter";break;case 404:i="Adapter configuration not found";break;case 503:i="Service is not available";break;default:i=`Failed to get adapter info: ${s}`;break}throw new Error(i)}return await e.json()}catch(e){let r;throw e instanceof Error&&e.message?e.message.includes("API key")||e.message.includes("Adapter")||e.message.includes("invalid")||e.message.includes("disabled")||e.message.includes("not found")||e.message.includes("Could not connect")?r=e.message:r=`Failed to get adapter info: ${e.message}`:e.name==="TypeError"&&(t=e.message)!=null&&t.includes("Failed to fetch")?r="Could not connect to the server. Please check if the server is running.":r="Failed to get adapter information. Please try again.",console.warn(`[ApiClient] ${r}`),new Error(r)}}getFetchOptions(t={}){const e={};if(typeof window>"u"){const s=this.apiUrl.startsWith("https:")?E:v;s&&(e.agent=s)}else e.headers={Connection:"keep-alive"};const r={"X-Request-ID":Date.now().toString(36)+Math.random().toString(36).substring(2)};if(e.headers&&Object.assign(r,e.headers),t.headers){const s=t.headers;for(const[i,n]of Object.entries(s))(i.toLowerCase()!=="x-api-key"||!this.apiKey)&&(r[i]=n)}return this.apiKey&&(r["X-API-Key"]=this.apiKey),this.sessionId&&(r["X-Session-ID"]=this.sessionId),{...t,...e,headers:r}}createChatRequest(t,e=!0,r){const s={messages:[{role:"user",content:t}],stream:e};return r&&r.length>0&&(s.file_ids=r),s}async*streamChat(t,e=!0,r){var s,i;try{const n=new AbortController,a=setTimeout(()=>n.abort(),6e4),c=await fetch(`${this.apiUrl}/v1/chat`,{...this.getFetchOptions({method:"POST",headers:{"Content-Type":"application/json",Accept:e?"text/event-stream":"application/json"},body:JSON.stringify(this.createChatRequest(t,e,r))}),signal:n.signal});if(clearTimeout(a),!c.ok){const h=await c.text();throw new Error(`Network response was not ok: ${c.status} ${h}`)}if(!e){const h=await c.json();h.response&&(yield{text:h.response,done:!0});return}const w=(s=c.body)==null?void 0:s.getReader();if(!w)throw new Error("No reader available");const I=new TextDecoder;let l="",p=!1;try{for(;;){const{done:h,value:$}=await w.read();if(h)break;const T=I.decode($,{stream:!0});l+=T;let f=0,y;for(;(y=l.indexOf(`
|
|
2
|
-
`,f))!==-1;){const u=l.slice(f,y).trim();if(f=y+1,u&&u.startsWith("data: ")){const g=u.slice(6).trim();if(!g||g==="[DONE]"){yield{text:"",done:!0};return}try{const d=JSON.parse(g);if(d.error){const A=`Server error: ${((i=d.error)==null?void 0:i.message)||d.error||"Unknown server error"}`;throw console.warn(`[ApiClient] ${A}`),new Error(A)}if(d.response&&(p=!0,yield{text:d.response,done:d.done||!1}),d.done){yield{text:"",done:!0};return}}catch{console.warn("[ApiClient] Unable to parse server response. This may be a temporary issue.")}}else u&&(p=!0,yield{text:u,done:!1})}l=l.slice(f),l.length>1e6&&(console.warn("Buffer too large, truncating..."),l=l.slice(-5e5))}p&&(yield{text:"",done:!0})}finally{w.releaseLock()}}catch(n){throw n.name==="AbortError"?new Error("Connection timed out. Please check if the server is running."):n.name==="TypeError"&&n.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):n}}async clearConversationHistory(t){const e=t||this.sessionId;if(!e)throw new Error("No session ID provided and no current session available");if(!this.apiKey)throw new Error("API key is required for clearing conversation history");const r={"Content-Type":"application/json","X-Session-ID":e,"X-API-Key":this.apiKey};try{const s=await fetch(`${this.apiUrl}/admin/chat-history/${e}`,{...this.getFetchOptions({method:"DELETE",headers:r})});if(!s.ok){const i=await s.text();throw new Error(`Failed to clear conversation history: ${s.status} ${i}`)}return await s.json()}catch(s){throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s}}async deleteConversationWithFiles(t,e){const r=t||this.sessionId;if(!r)throw new Error("No session ID provided and no current session available");if(!this.apiKey)throw new Error("API key is required for deleting conversation");const s={"Content-Type":"application/json","X-Session-ID":r,"X-API-Key":this.apiKey},i=e&&e.length>0?`?file_ids=${e.join(",")}`:"",n=`${this.apiUrl}/admin/conversations/${r}${i}`;try{const a=await fetch(n,{...this.getFetchOptions({method:"DELETE",headers:s})});if(!a.ok){const c=await a.text();throw new Error(`Failed to delete conversation: ${a.status} ${c}`)}return await a.json()}catch(a){throw a.name==="TypeError"&&a.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):a}}async uploadFile(t){if(!this.apiKey)throw new Error("API key is required for file upload");const e=new FormData;e.append("file",t);try{const r=await fetch(`${this.apiUrl}/api/files/upload`,{...this.getFetchOptions({method:"POST",body:e})});if(!r.ok){const s=await r.text();throw new Error(`Failed to upload file: ${r.status} ${s}`)}return await r.json()}catch(r){throw r.name==="TypeError"&&r.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):r}}async listFiles(){if(!this.apiKey)throw new Error("API key is required for listing files");try{const t=await fetch(`${this.apiUrl}/api/files`,{...this.getFetchOptions({method:"GET"})});if(!t.ok){const e=await t.text();throw new Error(`Failed to list files: ${t.status} ${e}`)}return await t.json()}catch(t){throw t.name==="TypeError"&&t.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):t}}async getFileInfo(t){if(!this.apiKey)throw new Error("API key is required for getting file info");try{const e=await fetch(`${this.apiUrl}/api/files/${t}`,{...this.getFetchOptions({method:"GET"})});if(!e.ok){const r=await e.text();throw new Error(`Failed to get file info: ${e.status} ${r}`)}return await e.json()}catch(e){throw e.name==="TypeError"&&e.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):e}}async queryFile(t,e,r=10){if(!this.apiKey)throw new Error("API key is required for querying files");try{const s=await fetch(`${this.apiUrl}/api/files/${t}/query`,{...this.getFetchOptions({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,max_results:r})})});if(!s.ok){const i=await s.text();throw new Error(`Failed to query file: ${s.status} ${i}`)}return await s.json()}catch(s){throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s}}async deleteFile(t){if(!this.apiKey)throw new Error("API key is required for deleting files");const e=`${this.apiUrl}/api/files/${t}`,r=this.getFetchOptions({method:"DELETE"});try{const s=await fetch(e,r);if(!s.ok){const i=await s.text();let n;try{const a=JSON.parse(i);n=a.detail||a.message||`Failed to delete file (HTTP ${s.status})`}catch{n=`Failed to delete file (HTTP ${s.status})`}throw console.warn(`[ApiClient] ${n}`),new Error(n)}return await s.json()}catch(s){let i;throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?i="Could not connect to the server. Please check if the server is running.":s.message&&!s.message.includes("Failed to delete file")?i=s.message:i="Failed to delete file. Please try again.",console.warn(`[ApiClient] ${i}`),new Error(i)}}}let k=null;const x=(o,t=null,e=null)=>{k=new C({apiUrl:o,apiKey:t,sessionId:e})};async function*K(o,t=!0,e){if(!k)throw new Error("API not configured. Please call configureApi() with your server URL before using any API functions.");yield*k.streamChat(o,t,e)}export{C as ApiClient,x as configureApi,K as streamChat};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as P}from"./index-D-8SZBhx.js";var F=Object.defineProperty,b=(o,t,e)=>t in o?F(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,m=(o,t,e)=>b(o,typeof t!="symbol"?t+"":t,e);let v=null,E=null;typeof window>"u"&&Promise.all([P(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).catch(()=>null),P(()=>import("./__vite-browser-external-BIHI7g3E.js"),[]).catch(()=>null)]).then(([o,t])=>{var e,r;(e=o==null?void 0:o.default)!=null&&e.Agent?v=new o.default.Agent({keepAlive:!0}):o!=null&&o.Agent&&(v=new o.Agent({keepAlive:!0})),(r=t==null?void 0:t.default)!=null&&r.Agent?E=new t.default.Agent({keepAlive:!0}):t!=null&&t.Agent&&(E=new t.Agent({keepAlive:!0}))}).catch(o=>{console.warn("Failed to initialize HTTP agents:",o.message)});class C{constructor(t){if(m(this,"apiUrl"),m(this,"apiKey"),m(this,"sessionId"),!t.apiUrl||typeof t.apiUrl!="string")throw new Error("API URL must be a valid string");if(t.apiKey!==void 0&&t.apiKey!==null&&typeof t.apiKey!="string")throw new Error("API key must be a valid string or null");if(t.sessionId!==void 0&&t.sessionId!==null&&typeof t.sessionId!="string")throw new Error("Session ID must be a valid string or null");this.apiUrl=t.apiUrl,this.apiKey=t.apiKey??null,this.sessionId=t.sessionId??null}setSessionId(t){if(t!==null&&typeof t!="string")throw new Error("Session ID must be a valid string or null");this.sessionId=t}getSessionId(){return this.sessionId}async validateApiKey(){var t;if(!this.apiKey)throw new Error("API key is required for validation");try{const e=await fetch(`${this.apiUrl}/admin/api-keys/${this.apiKey}/status`,{...this.getFetchOptions({method:"GET"})}).catch(s=>{throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s});if(!e.ok){let s="";try{s=await e.text()}catch{s=`HTTP ${e.status}`}let i,n;try{const a=JSON.parse(s);i=a.detail||a.message||s}catch{i=s||`HTTP ${e.status}`}switch(e.status){case 401:n="API key is invalid or expired";break;case 403:n="Access denied: API key does not have required permissions";break;case 404:n="API key not found";break;case 503:n="API key management is not available in inference-only mode";break;default:n=`Failed to validate API key: ${i}`;break}throw new Error(n)}const r=await e.json();if(!r.exists){const s="API key does not exist";throw new Error(s)}if(!r.active){const s="API key is inactive";throw new Error(s)}return r}catch(e){let r;throw e instanceof Error&&e.message?e.message.includes("API key")||e.message.includes("Access denied")||e.message.includes("invalid")||e.message.includes("expired")||e.message.includes("inactive")||e.message.includes("not found")||e.message.includes("Could not connect")?r=e.message:r=`API key validation failed: ${e.message}`:e.name==="TypeError"&&(t=e.message)!=null&&t.includes("Failed to fetch")?r="Could not connect to the server. Please check if the server is running.":r="API key validation failed. Please check your API key and try again.",console.warn(`[ApiClient] ${r}`),new Error(r)}}async getAdapterInfo(){var t;if(!this.apiKey)throw new Error("API key is required to get adapter information");try{const e=await fetch(`${this.apiUrl}/admin/api-keys/info`,{...this.getFetchOptions({method:"GET"})}).catch(r=>{throw r.name==="TypeError"&&r.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):r});if(!e.ok){let r="";try{r=await e.text()}catch{r=`HTTP ${e.status}`}let s,i;try{const n=JSON.parse(r);s=n.detail||n.message||r}catch{s=r||`HTTP ${e.status}`}switch(e.status){case 401:i="API key is invalid, disabled, or has no associated adapter";break;case 404:i="Adapter configuration not found";break;case 503:i="Service is not available";break;default:i=`Failed to get adapter info: ${s}`;break}throw new Error(i)}return await e.json()}catch(e){let r;throw e instanceof Error&&e.message?e.message.includes("API key")||e.message.includes("Adapter")||e.message.includes("invalid")||e.message.includes("disabled")||e.message.includes("not found")||e.message.includes("Could not connect")?r=e.message:r=`Failed to get adapter info: ${e.message}`:e.name==="TypeError"&&(t=e.message)!=null&&t.includes("Failed to fetch")?r="Could not connect to the server. Please check if the server is running.":r="Failed to get adapter information. Please try again.",console.warn(`[ApiClient] ${r}`),new Error(r)}}getFetchOptions(t={}){const e={};if(typeof window>"u"){const s=this.apiUrl.startsWith("https:")?E:v;s&&(e.agent=s)}else e.headers={Connection:"keep-alive"};const r={"X-Request-ID":Date.now().toString(36)+Math.random().toString(36).substring(2)};if(e.headers&&Object.assign(r,e.headers),t.headers){const s=t.headers;for(const[i,n]of Object.entries(s))(i.toLowerCase()!=="x-api-key"||!this.apiKey)&&(r[i]=n)}return this.apiKey&&(r["X-API-Key"]=this.apiKey),this.sessionId&&(r["X-Session-ID"]=this.sessionId),{...t,...e,headers:r}}createChatRequest(t,e=!0,r){const s={messages:[{role:"user",content:t}],stream:e};return r&&r.length>0&&(s.file_ids=r),s}async*streamChat(t,e=!0,r){var s,i;try{const n=new AbortController,a=setTimeout(()=>n.abort(),6e4),c=await fetch(`${this.apiUrl}/v1/chat`,{...this.getFetchOptions({method:"POST",headers:{"Content-Type":"application/json",Accept:e?"text/event-stream":"application/json"},body:JSON.stringify(this.createChatRequest(t,e,r))}),signal:n.signal});if(clearTimeout(a),!c.ok){const h=await c.text();throw new Error(`Network response was not ok: ${c.status} ${h}`)}if(!e){const h=await c.json();h.response&&(yield{text:h.response,done:!0});return}const w=(s=c.body)==null?void 0:s.getReader();if(!w)throw new Error("No reader available");const I=new TextDecoder;let l="",p=!1;try{for(;;){const{done:h,value:$}=await w.read();if(h)break;const T=I.decode($,{stream:!0});l+=T;let f=0,y;for(;(y=l.indexOf(`
|
|
2
|
-
`,f))!==-1;){const u=l.slice(f,y).trim();if(f=y+1,u&&u.startsWith("data: ")){const g=u.slice(6).trim();if(!g||g==="[DONE]"){yield{text:"",done:!0};return}try{const d=JSON.parse(g);if(d.error){const A=`Server error: ${((i=d.error)==null?void 0:i.message)||d.error||"Unknown server error"}`;throw console.warn(`[ApiClient] ${A}`),new Error(A)}if(d.response&&(p=!0,yield{text:d.response,done:d.done||!1}),d.done){yield{text:"",done:!0};return}}catch{console.warn("[ApiClient] Unable to parse server response. This may be a temporary issue.")}}else u&&(p=!0,yield{text:u,done:!1})}l=l.slice(f),l.length>1e6&&(console.warn("Buffer too large, truncating..."),l=l.slice(-5e5))}p&&(yield{text:"",done:!0})}finally{w.releaseLock()}}catch(n){throw n.name==="AbortError"?new Error("Connection timed out. Please check if the server is running."):n.name==="TypeError"&&n.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):n}}async clearConversationHistory(t){const e=t||this.sessionId;if(!e)throw new Error("No session ID provided and no current session available");if(!this.apiKey)throw new Error("API key is required for clearing conversation history");const r={"Content-Type":"application/json","X-Session-ID":e,"X-API-Key":this.apiKey};try{const s=await fetch(`${this.apiUrl}/admin/chat-history/${e}`,{...this.getFetchOptions({method:"DELETE",headers:r})});if(!s.ok){const i=await s.text();throw new Error(`Failed to clear conversation history: ${s.status} ${i}`)}return await s.json()}catch(s){throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s}}async deleteConversationWithFiles(t,e){const r=t||this.sessionId;if(!r)throw new Error("No session ID provided and no current session available");if(!this.apiKey)throw new Error("API key is required for deleting conversation");const s={"Content-Type":"application/json","X-Session-ID":r,"X-API-Key":this.apiKey},i=e&&e.length>0?`?file_ids=${e.join(",")}`:"",n=`${this.apiUrl}/admin/conversations/${r}${i}`;try{const a=await fetch(n,{...this.getFetchOptions({method:"DELETE",headers:s})});if(!a.ok){const c=await a.text();throw new Error(`Failed to delete conversation: ${a.status} ${c}`)}return await a.json()}catch(a){throw a.name==="TypeError"&&a.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):a}}async uploadFile(t){if(!this.apiKey)throw new Error("API key is required for file upload");const e=new FormData;e.append("file",t);try{const r=await fetch(`${this.apiUrl}/api/files/upload`,{...this.getFetchOptions({method:"POST",body:e})});if(!r.ok){const s=await r.text();throw new Error(`Failed to upload file: ${r.status} ${s}`)}return await r.json()}catch(r){throw r.name==="TypeError"&&r.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):r}}async listFiles(){if(!this.apiKey)throw new Error("API key is required for listing files");try{const t=await fetch(`${this.apiUrl}/api/files`,{...this.getFetchOptions({method:"GET"})});if(!t.ok){const e=await t.text();throw new Error(`Failed to list files: ${t.status} ${e}`)}return await t.json()}catch(t){throw t.name==="TypeError"&&t.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):t}}async getFileInfo(t){if(!this.apiKey)throw new Error("API key is required for getting file info");try{const e=await fetch(`${this.apiUrl}/api/files/${t}`,{...this.getFetchOptions({method:"GET"})});if(!e.ok){const r=await e.text();throw new Error(`Failed to get file info: ${e.status} ${r}`)}return await e.json()}catch(e){throw e.name==="TypeError"&&e.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):e}}async queryFile(t,e,r=10){if(!this.apiKey)throw new Error("API key is required for querying files");try{const s=await fetch(`${this.apiUrl}/api/files/${t}/query`,{...this.getFetchOptions({method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,max_results:r})})});if(!s.ok){const i=await s.text();throw new Error(`Failed to query file: ${s.status} ${i}`)}return await s.json()}catch(s){throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?new Error("Could not connect to the server. Please check if the server is running."):s}}async deleteFile(t){if(!this.apiKey)throw new Error("API key is required for deleting files");const e=`${this.apiUrl}/api/files/${t}`,r=this.getFetchOptions({method:"DELETE"});try{const s=await fetch(e,r);if(!s.ok){const i=await s.text();let n;try{const a=JSON.parse(i);n=a.detail||a.message||`Failed to delete file (HTTP ${s.status})`}catch{n=`Failed to delete file (HTTP ${s.status})`}throw console.warn(`[ApiClient] ${n}`),new Error(n)}return await s.json()}catch(s){let i;throw s.name==="TypeError"&&s.message.includes("Failed to fetch")?i="Could not connect to the server. Please check if the server is running.":s.message&&!s.message.includes("Failed to delete file")?i=s.message:i="Failed to delete file. Please try again.",console.warn(`[ApiClient] ${i}`),new Error(i)}}}let k=null;const x=(o,t=null,e=null)=>{k=new C({apiUrl:o,apiKey:t,sessionId:e})};async function*K(o,t=!0,e){if(!k)throw new Error("API not configured. Please call configureApi() with your server URL before using any API functions.");yield*k.streamChat(o,t,e)}export{C as ApiClient,x as configureApi,K as streamChat};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aP as sn,aQ as an,aR as I,aS as _,ag as Z,aT as un,aU as l,ai as on,aV as $,aW as q,aX as cn,aY as e,aZ as en,a_ as rn,a$ as yn}from"./index-D-8SZBhx.js";function fn(s){return s.innerRadius}function ln(s){return s.outerRadius}function gn(s){return s.startAngle}function mn(s){return s.endAngle}function pn(s){return s&&s.padAngle}function xn(s,v,B,D,R,d,O,a){var K=B-s,r=D-v,n=O-R,m=a-d,u=m*K-n*r;if(!(u*u<l))return u=(n*(v-d)-m*(s-R))/u,[s+u*K,v+u*r]}function F(s,v,B,D,R,d,O){var a=s-B,K=v-D,r=(O?d:-d)/$(a*a+K*K),n=r*K,m=-r*a,u=s+n,i=v+m,y=B+n,f=D+m,Q=(u+y)/2,o=(i+f)/2,p=y-u,g=f-i,T=p*p+g*g,A=R-d,E=u*f-y*i,P=(g<0?-1:1)*$(en(0,A*A*T-E*E)),S=(E*g-p*P)/T,V=(-E*p-g*P)/T,X=(E*g+p*P)/T,x=(-E*p+g*P)/T,h=S-Q,t=V-o,c=X-Q,U=x-o;return h*h+t*t>c*c+U*U&&(S=X,V=x),{cx:S,cy:V,x01:-n,y01:-m,x11:S*(R/A-1),y11:V*(R/A-1)}}function vn(){var s=fn,v=ln,B=Z(0),D=null,R=gn,d=mn,O=pn,a=null,K=sn(r);function r(){var n,m,u=+s.apply(this,arguments),i=+v.apply(this,arguments),y=R.apply(this,arguments)-un,f=d.apply(this,arguments)-un,Q=cn(f-y),o=f>y;if(a||(a=n=K()),i<u&&(m=i,i=u,u=m),!(i>l))a.moveTo(0,0);else if(Q>on-l)a.moveTo(i*I(y),i*_(y)),a.arc(0,0,i,y,f,!o),u>l&&(a.moveTo(u*I(f),u*_(f)),a.arc(0,0,u,f,y,o));else{var p=y,g=f,T=y,A=f,E=Q,P=Q,S=O.apply(this,arguments)/2,V=S>l&&(D?+D.apply(this,arguments):$(u*u+i*i)),X=q(cn(i-u)/2,+B.apply(this,arguments)),x=X,h=X,t,c;if(V>l){var U=rn(V/u*_(S)),b=rn(V/i*_(S));(E-=U*2)>l?(U*=o?1:-1,T+=U,A-=U):(E=0,T=A=(y+f)/2),(P-=b*2)>l?(b*=o?1:-1,p+=b,g-=b):(P=0,p=g=(y+f)/2)}var L=i*I(p),Y=i*_(p),k=u*I(A),C=u*_(A);if(X>l){var M=i*I(g),N=i*_(g),G=u*I(T),H=u*_(T),W;if(Q<an)if(W=xn(L,Y,G,H,M,N,k,C)){var J=L-W[0],j=Y-W[1],w=M-W[0],z=N-W[1],nn=1/_(yn((J*w+j*z)/($(J*J+j*j)*$(w*w+z*z)))/2),tn=$(W[0]*W[0]+W[1]*W[1]);x=q(X,(u-tn)/(nn-1)),h=q(X,(i-tn)/(nn+1))}else x=h=0}P>l?h>l?(t=F(G,H,L,Y,i,h,o),c=F(M,N,k,C,i,h,o),a.moveTo(t.cx+t.x01,t.cy+t.y01),h<X?a.arc(t.cx,t.cy,h,e(t.y01,t.x01),e(c.y01,c.x01),!o):(a.arc(t.cx,t.cy,h,e(t.y01,t.x01),e(t.y11,t.x11),!o),a.arc(0,0,i,e(t.cy+t.y11,t.cx+t.x11),e(c.cy+c.y11,c.cx+c.x11),!o),a.arc(c.cx,c.cy,h,e(c.y11,c.x11),e(c.y01,c.x01),!o))):(a.moveTo(L,Y),a.arc(0,0,i,p,g,!o)):a.moveTo(L,Y),!(u>l)||!(E>l)?a.lineTo(k,C):x>l?(t=F(k,C,M,N,u,-x,o),c=F(L,Y,G,H,u,-x,o),a.lineTo(t.cx+t.x01,t.cy+t.y01),x<X?a.arc(t.cx,t.cy,x,e(t.y01,t.x01),e(c.y01,c.x01),!o):(a.arc(t.cx,t.cy,x,e(t.y01,t.x01),e(t.y11,t.x11),!o),a.arc(0,0,u,e(t.cy+t.y11,t.cx+t.x11),e(c.cy+c.y11,c.cx+c.x11),o),a.arc(c.cx,c.cy,x,e(c.y11,c.x11),e(c.y01,c.x01),!o))):a.arc(0,0,u,A,T,o)}if(a.closePath(),n)return a=null,n+""||null}return r.centroid=function(){var n=(+s.apply(this,arguments)+ +v.apply(this,arguments))/2,m=(+R.apply(this,arguments)+ +d.apply(this,arguments))/2-an/2;return[I(m)*n,_(m)*n]},r.innerRadius=function(n){return arguments.length?(s=typeof n=="function"?n:Z(+n),r):s},r.outerRadius=function(n){return arguments.length?(v=typeof n=="function"?n:Z(+n),r):v},r.cornerRadius=function(n){return arguments.length?(B=typeof n=="function"?n:Z(+n),r):B},r.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:Z(+n),r):D},r.startAngle=function(n){return arguments.length?(R=typeof n=="function"?n:Z(+n),r):R},r.endAngle=function(n){return arguments.length?(d=typeof n=="function"?n:Z(+n),r):d},r.padAngle=function(n){return arguments.length?(O=typeof n=="function"?n:Z(+n),r):O},r.context=function(n){return arguments.length?(a=n??null,r):a},r}export{vn as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b0 as t,b1 as a}from"./index-D-8SZBhx.js";const n=(o,r)=>t.lang.round(a.parse(o)[r]);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{U as o}from"./graph-Bc6U-Oet-3YUGkDrJ.js";var t=4;function n(r){return o(r,t)}export{n as a};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{O as f,b as lt,p as ot,X as w,R,P as _,r as H,M as q,br as G}from"./index-D-8SZBhx.js";import{$ as nt}from"./createText-1719965b-Cbn6MBZp-HdNLk45j.js";const dt=(a,t,e,s)=>{t.forEach(l=>{bt[l](a,e,s)})},ht=(a,t,e)=>{f.trace("Making markers for ",e),a.append("defs").append("marker").attr("id",e+"_"+t+"-extensionStart").attr("class","marker extension "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),a.append("defs").append("marker").attr("id",e+"_"+t+"-extensionEnd").attr("class","marker extension "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},ct=(a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+t+"-compositionStart").attr("class","marker composition "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),a.append("defs").append("marker").attr("id",e+"_"+t+"-compositionEnd").attr("class","marker composition "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},yt=(a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+t+"-aggregationStart").attr("class","marker aggregation "+t).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),a.append("defs").append("marker").attr("id",e+"_"+t+"-aggregationEnd").attr("class","marker aggregation "+t).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},pt=(a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+t+"-dependencyStart").attr("class","marker dependency "+t).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),a.append("defs").append("marker").attr("id",e+"_"+t+"-dependencyEnd").attr("class","marker dependency "+t).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},gt=(a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+t+"-lollipopStart").attr("class","marker lollipop "+t).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),a.append("defs").append("marker").attr("id",e+"_"+t+"-lollipopEnd").attr("class","marker lollipop "+t).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("stroke","black").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},xt=(a,t,e)=>{a.append("marker").attr("id",e+"_"+t+"-pointEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",6).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),a.append("marker").attr("id",e+"_"+t+"-pointStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},ft=(a,t,e)=>{a.append("marker").attr("id",e+"_"+t+"-circleEnd").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),a.append("marker").attr("id",e+"_"+t+"-circleStart").attr("class","marker "+t).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},ut=(a,t,e)=>{a.append("marker").attr("id",e+"_"+t+"-crossEnd").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),a.append("marker").attr("id",e+"_"+t+"-crossStart").attr("class","marker cross "+t).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},wt=(a,t,e)=>{a.append("defs").append("marker").attr("id",e+"_"+t+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","strokeWidth").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},bt={extension:ht,composition:ct,aggregation:yt,dependency:pt,lollipop:gt,point:xt,circle:ft,cross:ut,barb:wt},or=dt;function mt(a,t){t&&a.attr("style",t)}function kt(a,t){const e=_(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")),s=e.append("xhtml:div"),l=a.label,r=a.isNode?"nodeLabel":"edgeLabel";return s.html(q('<span class="'+r+'" '+(a.labelStyle?'style="'+a.labelStyle+'"':"")+">"+l+"</span>",t)),mt(s,a.labelStyle),s.style("display","inline-block"),s.style("white-space","nowrap"),s.attr("xmlns","http://www.w3.org/1999/xhtml"),e.node()}const Lt=(a,t,e,s)=>{let l=a||"";typeof l=="object"&&(l=l[0]);const r=w();if(R(r.flowchart.htmlLabels)){l=l.replace(/\\n|\n/g,"<br />"),f.debug("vertexText"+l);const n={isNode:s,label:G(l).replace(/fa[blrs]?:fa-[\w-]+/g,i=>`<i class='${i.replace(":"," ")}'></i>`),labelStyle:t.replace("fill:","color:")};return kt(n,r)}else{const n=document.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("style",t.replace("color:","fill:"));let i=[];typeof l=="string"?i=l.split(/\\n|\n|<br\s*\/?>/gi):Array.isArray(l)?i=l:i=[];for(const o of i){const h=document.createElementNS("http://www.w3.org/2000/svg","tspan");h.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),h.setAttribute("dy","1em"),h.setAttribute("x","0"),e?h.setAttribute("class","title-row"):h.setAttribute("class","row"),h.textContent=o.trim(),n.appendChild(h)}return n}},P=Lt,M=async(a,t,e,s)=>{let l;const r=t.useHtmlLabels||R(w().flowchart.htmlLabels);e?l=e:l="node default";const n=a.insert("g").attr("class",l).attr("id",t.domId||t.id),i=n.insert("g").attr("class","label").attr("style",t.labelStyle);let o;t.labelText===void 0?o="":o=typeof t.labelText=="string"?t.labelText:t.labelText[0];const h=i.node();let d;t.labelType==="markdown"?d=nt(i,q(G(o),w()),{useHtmlLabels:r,width:t.width||w().flowchart.wrappingWidth,classes:"markdown-node-label"}):d=h.appendChild(P(q(G(o),w()),t.labelStyle,!1,s));let c=d.getBBox();const p=t.padding/2;if(R(w().flowchart.htmlLabels)){const y=d.children[0],x=_(d),k=y.getElementsByTagName("img");if(k){const g=o.replace(/<img[^>]*>/g,"").trim()==="";await Promise.all([...k].map(u=>new Promise(v=>{function B(){if(u.style.display="flex",u.style.flexDirection="column",g){const C=w().fontSize?w().fontSize:window.getComputedStyle(document.body).fontSize,W=parseInt(C,10)*5+"px";u.style.minWidth=W,u.style.maxWidth=W}else u.style.width="100%";v(u)}setTimeout(()=>{u.complete&&B()}),u.addEventListener("error",B),u.addEventListener("load",B)})))}c=y.getBoundingClientRect(),x.attr("width",c.width),x.attr("height",c.height)}return r?i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"):i.attr("transform","translate(0, "+-c.height/2+")"),t.centerLabel&&i.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),i.insert("rect",":first-child"),{shapeSvg:n,bbox:c,halfPadding:p,label:i}},m=(a,t)=>{const e=t.node().getBBox();a.width=e.width,a.height=e.height};function X(a,t,e,s){return a.insert("polygon",":first-child").attr("points",s.map(function(l){return l.x+","+l.y}).join(" ")).attr("class","label-container").attr("transform","translate("+-t/2+","+e/2+")")}function St(a,t){return a.intersect(t)}function st(a,t,e,s){var l=a.x,r=a.y,n=l-s.x,i=r-s.y,o=Math.sqrt(t*t*i*i+e*e*n*n),h=Math.abs(t*e*n/o);s.x<l&&(h=-h);var d=Math.abs(t*e*i/o);return s.y<r&&(d=-d),{x:l+h,y:r+d}}function vt(a,t,e){return st(a,t,t,e)}function Mt(a,t,e,s){var l,r,n,i,o,h,d,c,p,y,x,k,g,u,v;if(l=t.y-a.y,n=a.x-t.x,o=t.x*a.y-a.x*t.y,p=l*e.x+n*e.y+o,y=l*s.x+n*s.y+o,!(p!==0&&y!==0&&J(p,y))&&(r=s.y-e.y,i=e.x-s.x,h=s.x*e.y-e.x*s.y,d=r*a.x+i*a.y+h,c=r*t.x+i*t.y+h,!(d!==0&&c!==0&&J(d,c))&&(x=l*i-r*n,x!==0)))return k=Math.abs(x/2),g=n*h-i*o,u=g<0?(g-k)/x:(g+k)/x,g=r*o-l*h,v=g<0?(g-k)/x:(g+k)/x,{x:u,y:v}}function J(a,t){return a*t>0}function Tt(a,t,e){var s=a.x,l=a.y,r=[],n=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;typeof t.forEach=="function"?t.forEach(function(x){n=Math.min(n,x.x),i=Math.min(i,x.y)}):(n=Math.min(n,t.x),i=Math.min(i,t.y));for(var o=s-a.width/2-n,h=l-a.height/2-i,d=0;d<t.length;d++){var c=t[d],p=t[d<t.length-1?d+1:0],y=Mt(a,e,{x:o+c.x,y:h+c.y},{x:o+p.x,y:h+p.y});y&&r.push(y)}return r.length?(r.length>1&&r.sort(function(x,k){var g=x.x-e.x,u=x.y-e.y,v=Math.sqrt(g*g+u*u),B=k.x-e.x,C=k.y-e.y,W=Math.sqrt(B*B+C*C);return v<W?-1:v===W?0:1}),r[0]):a}const Bt=(a,t)=>{var e=a.x,s=a.y,l=t.x-e,r=t.y-s,n=a.width/2,i=a.height/2,o,h;return Math.abs(r)*n>Math.abs(l)*i?(r<0&&(i=-i),o=r===0?0:i*l/r,h=i):(l<0&&(n=-n),o=n,h=l===0?0:n*r/l),{x:e+o,y:s+h}},_t=Bt,b={node:St,circle:vt,ellipse:st,polygon:Tt,rect:_t},Ct=async(a,t)=>{t.useHtmlLabels||w().flowchart.htmlLabels||(t.centerLabel=!0);const{shapeSvg:e,bbox:s,halfPadding:l}=await M(a,t,"node "+t.classes,!0);f.info("Classes = ",t.classes);const r=e.insert("rect",":first-child");return r.attr("rx",t.rx).attr("ry",t.ry).attr("x",-s.width/2-l).attr("y",-s.height/2-l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),m(t,r),t.intersect=function(n){return b.rect(t,n)},e},$t=Ct,Et=a=>{const t=new Set;for(const e of a)switch(e){case"x":t.add("right"),t.add("left");break;case"y":t.add("up"),t.add("down");break;default:t.add(e);break}return t},Pt=(a,t,e)=>{const s=Et(a),l=2,r=t.height+2*e.padding,n=r/l,i=t.width+2*n+e.padding,o=e.padding/2;return s.has("right")&&s.has("left")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:n,y:0},{x:i/2,y:2*o},{x:i-n,y:0},{x:i,y:0},{x:i,y:-r/3},{x:i+2*o,y:-r/2},{x:i,y:-2*r/3},{x:i,y:-r},{x:i-n,y:-r},{x:i/2,y:-r-2*o},{x:n,y:-r},{x:0,y:-r},{x:0,y:-2*r/3},{x:-2*o,y:-r/2},{x:0,y:-r/3}]:s.has("right")&&s.has("left")&&s.has("up")?[{x:n,y:0},{x:i-n,y:0},{x:i,y:-r/2},{x:i-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}]:s.has("right")&&s.has("left")&&s.has("down")?[{x:0,y:0},{x:n,y:-r},{x:i-n,y:-r},{x:i,y:0}]:s.has("right")&&s.has("up")&&s.has("down")?[{x:0,y:0},{x:i,y:-n},{x:i,y:-r+n},{x:0,y:-r}]:s.has("left")&&s.has("up")&&s.has("down")?[{x:i,y:0},{x:0,y:-n},{x:0,y:-r+n},{x:i,y:-r}]:s.has("right")&&s.has("left")?[{x:n,y:0},{x:n,y:-o},{x:i-n,y:-o},{x:i-n,y:0},{x:i,y:-r/2},{x:i-n,y:-r},{x:i-n,y:-r+o},{x:n,y:-r+o},{x:n,y:-r},{x:0,y:-r/2}]:s.has("up")&&s.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:n,y:-o},{x:n,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-n,y:-r+o},{x:i-n,y:-o},{x:i,y:-o}]:s.has("right")&&s.has("up")?[{x:0,y:0},{x:i,y:-n},{x:0,y:-r}]:s.has("right")&&s.has("down")?[{x:0,y:0},{x:i,y:0},{x:0,y:-r}]:s.has("left")&&s.has("up")?[{x:i,y:0},{x:0,y:-n},{x:i,y:-r}]:s.has("left")&&s.has("down")?[{x:i,y:0},{x:0,y:0},{x:i,y:-r}]:s.has("right")?[{x:n,y:-o},{x:n,y:-o},{x:i-n,y:-o},{x:i-n,y:0},{x:i,y:-r/2},{x:i-n,y:-r},{x:i-n,y:-r+o},{x:n,y:-r+o},{x:n,y:-r+o}]:s.has("left")?[{x:n,y:0},{x:n,y:-o},{x:i-n,y:-o},{x:i-n,y:-r+o},{x:n,y:-r+o},{x:n,y:-r},{x:0,y:-r/2}]:s.has("up")?[{x:n,y:-o},{x:n,y:-r+o},{x:0,y:-r+o},{x:i/2,y:-r},{x:i,y:-r+o},{x:i-n,y:-r+o},{x:i-n,y:-o}]:s.has("down")?[{x:i/2,y:0},{x:0,y:-o},{x:n,y:-o},{x:n,y:-r+o},{x:i-n,y:-r+o},{x:i-n,y:-o},{x:i,y:-o}]:[{x:0,y:0}]},Q=a=>a?" "+a:"",E=(a,t)=>`node default${Q(a.classes)} ${Q(a.class)}`,K=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=l+r,i=[{x:n/2,y:0},{x:n,y:-n/2},{x:n/2,y:-n},{x:0,y:-n/2}];f.info("Question main (Circle)");const o=X(e,n,n,i);return o.attr("style",t.style),m(t,o),t.intersect=function(h){return f.warn("Intersect called"),b.polygon(t,i,h)},e},Rt=(a,t)=>{const e=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=28,l=[{x:0,y:s/2},{x:s/2,y:0},{x:0,y:-s/2},{x:-s/2,y:0}];return e.insert("polygon",":first-child").attr("points",l.map(function(r){return r.x+","+r.y}).join(" ")).attr("class","state-start").attr("r",7).attr("width",28).attr("height",28),t.width=28,t.height=28,t.intersect=function(r){return b.circle(t,14,r)},e},Xt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=4,r=s.height+t.padding,n=r/l,i=s.width+2*n+t.padding,o=[{x:n,y:0},{x:i-n,y:0},{x:i,y:-r/2},{x:i-n,y:-r},{x:n,y:-r},{x:0,y:-r/2}],h=X(e,i,r,o);return h.attr("style",t.style),m(t,h),t.intersect=function(d){return b.polygon(t,o,d)},e},Ot=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,void 0,!0),l=2,r=s.height+2*t.padding,n=r/l,i=s.width+2*n+t.padding,o=Pt(t.directions,s,t),h=X(e,i,r,o);return h.attr("style",t.style),m(t,h),t.intersect=function(d){return b.polygon(t,o,d)},e},Wt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:-r/2,y:0},{x:l,y:0},{x:l,y:-r},{x:-r/2,y:-r},{x:0,y:-r/2}];return X(e,l,r,n).attr("style",t.style),t.width=l+r,t.height=r,t.intersect=function(i){return b.polygon(t,n,i)},e},Yt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:-2*r/6,y:0},{x:l-r/6,y:0},{x:l+2*r/6,y:-r},{x:r/6,y:-r}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},It=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:2*r/6,y:0},{x:l+r/6,y:0},{x:l-2*r/6,y:-r},{x:-r/6,y:-r}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},Nt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:-2*r/6,y:0},{x:l+2*r/6,y:0},{x:l-r/6,y:-r},{x:r/6,y:-r}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},Dt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:r/6,y:0},{x:l-r/6,y:0},{x:l+2*r/6,y:-r},{x:-2*r/6,y:-r}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},Ht=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:0,y:0},{x:l+r/2,y:0},{x:l,y:-r/2},{x:l+r/2,y:-r},{x:0,y:-r}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},jt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=l/2,n=r/(2.5+l/50),i=s.height+n+t.padding,o="M 0,"+n+" a "+r+","+n+" 0,0,0 "+l+" 0 a "+r+","+n+" 0,0,0 "+-l+" 0 l 0,"+i+" a "+r+","+n+" 0,0,0 "+l+" 0 l 0,"+-i,h=e.attr("label-offset-y",n).insert("path",":first-child").attr("style",t.style).attr("d",o).attr("transform","translate("+-l/2+","+-(i/2+n)+")");return m(t,h),t.intersect=function(d){const c=b.rect(t,d),p=c.x-t.x;if(r!=0&&(Math.abs(p)<t.width/2||Math.abs(p)==t.width/2&&Math.abs(c.y-t.y)>t.height/2-n)){let y=n*n*(1-p*p/(r*r));y!=0&&(y=Math.sqrt(y)),y=n-y,d.y-t.y>0&&(y=-y),c.y+=y}return c},e},Ut=async(a,t)=>{const{shapeSvg:e,bbox:s,halfPadding:l}=await M(a,t,"node "+t.classes+" "+t.class,!0),r=e.insert("rect",":first-child"),n=t.positioned?t.width:s.width+t.padding,i=t.positioned?t.height:s.height+t.padding,o=t.positioned?-n/2:-s.width/2-l,h=t.positioned?-i/2:-s.height/2-l;if(r.attr("class","basic label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",h).attr("width",n).attr("height",i),t.props){const d=new Set(Object.keys(t.props));t.props.borders&&(F(r,t.props.borders,n,i),d.delete("borders")),d.forEach(c=>{f.warn(`Unknown node property ${c}`)})}return m(t,r),t.intersect=function(d){return b.rect(t,d)},e},At=async(a,t)=>{const{shapeSvg:e,bbox:s,halfPadding:l}=await M(a,t,"node "+t.classes,!0),r=e.insert("rect",":first-child"),n=t.positioned?t.width:s.width+t.padding,i=t.positioned?t.height:s.height+t.padding,o=t.positioned?-n/2:-s.width/2-l,h=t.positioned?-i/2:-s.height/2-l;if(r.attr("class","basic cluster composite label-container").attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",o).attr("y",h).attr("width",n).attr("height",i),t.props){const d=new Set(Object.keys(t.props));t.props.borders&&(F(r,t.props.borders,n,i),d.delete("borders")),d.forEach(c=>{f.warn(`Unknown node property ${c}`)})}return m(t,r),t.intersect=function(d){return b.rect(t,d)},e},Zt=async(a,t)=>{const{shapeSvg:e}=await M(a,t,"label",!0);f.trace("Classes = ",t.class);const s=e.insert("rect",":first-child"),l=0,r=0;if(s.attr("width",l).attr("height",r),e.attr("class","label edgeLabel"),t.props){const n=new Set(Object.keys(t.props));t.props.borders&&(F(s,t.props.borders,l,r),n.delete("borders")),n.forEach(i=>{f.warn(`Unknown node property ${i}`)})}return m(t,s),t.intersect=function(n){return b.rect(t,n)},e};function F(a,t,e,s){const l=[],r=i=>{l.push(i,0)},n=i=>{l.push(0,i)};t.includes("t")?(f.debug("add top border"),r(e)):n(e),t.includes("r")?(f.debug("add right border"),r(s)):n(s),t.includes("b")?(f.debug("add bottom border"),r(e)):n(e),t.includes("l")?(f.debug("add left border"),r(s)):n(s),a.attr("stroke-dasharray",l.join(" "))}const zt=(a,t)=>{let e;t.classes?e="node "+t.classes:e="node default";const s=a.insert("g").attr("class",e).attr("id",t.domId||t.id),l=s.insert("rect",":first-child"),r=s.insert("line"),n=s.insert("g").attr("class","label"),i=t.labelText.flat?t.labelText.flat():t.labelText;let o="";typeof i=="object"?o=i[0]:o=i,f.info("Label text abc79",o,i,typeof i=="object");const h=n.node().appendChild(P(o,t.labelStyle,!0,!0));let d={width:0,height:0};if(R(w().flowchart.htmlLabels)){const k=h.children[0],g=_(h);d=k.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height)}f.info("Text 2",i);const c=i.slice(1,i.length);let p=h.getBBox();const y=n.node().appendChild(P(c.join?c.join("<br/>"):c,t.labelStyle,!0,!0));if(R(w().flowchart.htmlLabels)){const k=y.children[0],g=_(y);d=k.getBoundingClientRect(),g.attr("width",d.width),g.attr("height",d.height)}const x=t.padding/2;return _(y).attr("transform","translate( "+(d.width>p.width?0:(p.width-d.width)/2)+", "+(p.height+x+5)+")"),_(h).attr("transform","translate( "+(d.width<p.width?0:-(p.width-d.width)/2)+", 0)"),d=n.node().getBBox(),n.attr("transform","translate("+-d.width/2+", "+(-d.height/2-x+3)+")"),l.attr("class","outer title-state").attr("x",-d.width/2-x).attr("y",-d.height/2-x).attr("width",d.width+t.padding).attr("height",d.height+t.padding),r.attr("class","divider").attr("x1",-d.width/2-x).attr("x2",d.width/2+x).attr("y1",-d.height/2-x+p.height+x).attr("y2",-d.height/2-x+p.height+x),m(t,l),t.intersect=function(k){return b.rect(t,k)},s},qt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.height+t.padding,r=s.width+l/4+t.padding,n=e.insert("rect",":first-child").attr("style",t.style).attr("rx",l/2).attr("ry",l/2).attr("x",-r/2).attr("y",-l/2).attr("width",r).attr("height",l);return m(t,n),t.intersect=function(i){return b.rect(t,i)},e},Gt=async(a,t)=>{const{shapeSvg:e,bbox:s,halfPadding:l}=await M(a,t,E(t),!0),r=e.insert("circle",":first-child");return r.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),f.info("Circle main"),m(t,r),t.intersect=function(n){return f.info("Circle intersect",t,s.width/2+l,n),b.circle(t,s.width/2+l,n)},e},Ft=async(a,t)=>{const{shapeSvg:e,bbox:s,halfPadding:l}=await M(a,t,E(t),!0),r=5,n=e.insert("g",":first-child"),i=n.insert("circle"),o=n.insert("circle");return n.attr("class",t.class),i.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l+r).attr("width",s.width+t.padding+r*2).attr("height",s.height+t.padding+r*2),o.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("r",s.width/2+l).attr("width",s.width+t.padding).attr("height",s.height+t.padding),f.info("DoubleCircle main"),m(t,i),t.intersect=function(h){return f.info("DoubleCircle intersect",t,s.width/2+l+r,h),b.circle(t,s.width/2+l+r,h)},e},Vt=async(a,t)=>{const{shapeSvg:e,bbox:s}=await M(a,t,E(t),!0),l=s.width+t.padding,r=s.height+t.padding,n=[{x:0,y:0},{x:l,y:0},{x:l,y:-r},{x:0,y:-r},{x:0,y:0},{x:-8,y:0},{x:l+8,y:0},{x:l+8,y:-r},{x:-8,y:-r},{x:-8,y:0}],i=X(e,l,r,n);return i.attr("style",t.style),m(t,i),t.intersect=function(o){return b.polygon(t,n,o)},e},Jt=(a,t)=>{const e=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=e.insert("circle",":first-child");return s.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),m(t,s),t.intersect=function(l){return b.circle(t,7,l)},e},tt=(a,t,e)=>{const s=a.insert("g").attr("class","node default").attr("id",t.domId||t.id);let l=70,r=10;e==="LR"&&(l=10,r=70);const n=s.append("rect").attr("x",-1*l/2).attr("y",-1*r/2).attr("width",l).attr("height",r).attr("class","fork-join");return m(t,n),t.height=t.height+t.padding/2,t.width=t.width+t.padding/2,t.intersect=function(i){return b.rect(t,i)},s},Qt=(a,t)=>{const e=a.insert("g").attr("class","node default").attr("id",t.domId||t.id),s=e.insert("circle",":first-child"),l=e.insert("circle",":first-child");return l.attr("class","state-start").attr("r",7).attr("width",14).attr("height",14),s.attr("class","state-end").attr("r",5).attr("width",10).attr("height",10),m(t,l),t.intersect=function(r){return b.circle(t,7,r)},e},Kt=(a,t)=>{const e=t.padding/2,s=4,l=8;let r;t.classes?r="node "+t.classes:r="node default";const n=a.insert("g").attr("class",r).attr("id",t.domId||t.id),i=n.insert("rect",":first-child"),o=n.insert("line"),h=n.insert("line");let d=0,c=s;const p=n.insert("g").attr("class","label");let y=0;const x=t.classData.annotations&&t.classData.annotations[0],k=t.classData.annotations[0]?"«"+t.classData.annotations[0]+"»":"",g=p.node().appendChild(P(k,t.labelStyle,!0,!0));let u=g.getBBox();if(R(w().flowchart.htmlLabels)){const L=g.children[0],S=_(g);u=L.getBoundingClientRect(),S.attr("width",u.width),S.attr("height",u.height)}t.classData.annotations[0]&&(c+=u.height+s,d+=u.width);let v=t.classData.label;t.classData.type!==void 0&&t.classData.type!==""&&(w().flowchart.htmlLabels?v+="<"+t.classData.type+">":v+="<"+t.classData.type+">");const B=p.node().appendChild(P(v,t.labelStyle,!0,!0));_(B).attr("class","classTitle");let C=B.getBBox();if(R(w().flowchart.htmlLabels)){const L=B.children[0],S=_(B);C=L.getBoundingClientRect(),S.attr("width",C.width),S.attr("height",C.height)}c+=C.height+s,C.width>d&&(d=C.width);const W=[];t.classData.members.forEach(L=>{const S=L.getDisplayDetails();let I=S.displayText;w().flowchart.htmlLabels&&(I=I.replace(/</g,"<").replace(/>/g,">"));const O=p.node().appendChild(P(I,S.cssStyle?S.cssStyle:t.labelStyle,!0,!0));let $=O.getBBox();if(R(w().flowchart.htmlLabels)){const z=O.children[0],D=_(O);$=z.getBoundingClientRect(),D.attr("width",$.width),D.attr("height",$.height)}$.width>d&&(d=$.width),c+=$.height+s,W.push(O)}),c+=l;const V=[];if(t.classData.methods.forEach(L=>{const S=L.getDisplayDetails();let I=S.displayText;w().flowchart.htmlLabels&&(I=I.replace(/</g,"<").replace(/>/g,">"));const O=p.node().appendChild(P(I,S.cssStyle?S.cssStyle:t.labelStyle,!0,!0));let $=O.getBBox();if(R(w().flowchart.htmlLabels)){const z=O.children[0],D=_(O);$=z.getBoundingClientRect(),D.attr("width",$.width),D.attr("height",$.height)}$.width>d&&(d=$.width),c+=$.height+s,V.push(O)}),c+=l,x){let L=(d-u.width)/2;_(g).attr("transform","translate( "+(-1*d/2+L)+", "+-1*c/2+")"),y=u.height+s}let it=(d-C.width)/2;return _(B).attr("transform","translate( "+(-1*d/2+it)+", "+(-1*c/2+y)+")"),y+=C.height+s,o.attr("class","divider").attr("x1",-d/2-e).attr("x2",d/2+e).attr("y1",-c/2-e+l+y).attr("y2",-c/2-e+l+y),y+=l,W.forEach(L=>{_(L).attr("transform","translate( "+-d/2+", "+(-1*c/2+y+l/2)+")");const S=L==null?void 0:L.getBBox();y+=((S==null?void 0:S.height)??0)+s}),y+=l,h.attr("class","divider").attr("x1",-d/2-e).attr("x2",d/2+e).attr("y1",-c/2-e+l+y).attr("y2",-c/2-e+l+y),y+=l,V.forEach(L=>{_(L).attr("transform","translate( "+-d/2+", "+(-1*c/2+y)+")");const S=L==null?void 0:L.getBBox();y+=((S==null?void 0:S.height)??0)+s}),i.attr("style",t.style).attr("class","outer title-state").attr("x",-d/2-e).attr("y",-(c/2)-e).attr("width",d+t.padding).attr("height",c+t.padding),m(t,i),t.intersect=function(L){return b.rect(t,L)},n},rt={rhombus:K,composite:At,question:K,rect:Ut,labelRect:Zt,rectWithTitle:zt,choice:Rt,circle:Gt,doublecircle:Ft,stadium:qt,hexagon:Xt,block_arrow:Ot,rect_left_inv_arrow:Wt,lean_right:Yt,lean_left:It,trapezoid:Nt,inv_trapezoid:Dt,rect_right_inv_arrow:Ht,cylinder:jt,start:Jt,end:Qt,note:$t,subroutine:Vt,fork:tt,join:tt,class_box:Kt};let N={};const dr=async(a,t,e)=>{let s,l;if(t.link){let r;w().securityLevel==="sandbox"?r="_top":t.linkTarget&&(r=t.linkTarget||"_blank"),s=a.insert("svg:a").attr("xlink:href",t.link).attr("target",r),l=await rt[t.shape](s,t,e)}else l=await rt[t.shape](a,t,e),s=l;return t.tooltip&&l.attr("title",t.tooltip),t.class&&l.attr("class","node default "+t.class),s.attr("data-node","true"),s.attr("data-id",t.id),N[t.id]=s,t.haveCallback&&N[t.id].attr("class",N[t.id].attr("class")+" clickable"),s},hr=(a,t)=>{N[t.id]=a},cr=()=>{N={}},yr=a=>{const t=N[a.id];f.trace("Transforming node",a.diff,a,"translate("+(a.x-a.width/2-5)+", "+a.width/2+")");const e=8,s=a.diff||0;return a.clusterNode?t.attr("transform","translate("+(a.x+s-a.width/2)+", "+(a.y-a.height/2-e)+")"):t.attr("transform","translate("+a.x+", "+a.y+")"),s},tr=({flowchart:a})=>{var t,e;const s=((t=a==null?void 0:a.subGraphTitleMargin)==null?void 0:t.top)??0,l=((e=a==null?void 0:a.subGraphTitleMargin)==null?void 0:e.bottom)??0,r=s+l;return{subGraphTitleTopMargin:s,subGraphTitleBottomMargin:l,subGraphTitleTotalMargin:r}},Y={aggregation:18,extension:18,composition:18,dependency:6,lollipop:13.5,arrow_point:5.3};function j(a,t){if(a===void 0||t===void 0)return{angle:0,deltaX:0,deltaY:0};a=A(a),t=A(t);const[e,s]=[a.x,a.y],[l,r]=[t.x,t.y],n=l-e,i=r-s;return{angle:Math.atan(i/n),deltaX:n,deltaY:i}}const A=a=>Array.isArray(a)?{x:a[0],y:a[1]}:a,rr=a=>({x:function(t,e,s){let l=0;if(e===0&&Object.hasOwn(Y,a.arrowTypeStart)){const{angle:r,deltaX:n}=j(s[0],s[1]);l=Y[a.arrowTypeStart]*Math.cos(r)*(n>=0?1:-1)}else if(e===s.length-1&&Object.hasOwn(Y,a.arrowTypeEnd)){const{angle:r,deltaX:n}=j(s[s.length-1],s[s.length-2]);l=Y[a.arrowTypeEnd]*Math.cos(r)*(n>=0?1:-1)}return A(t).x+l},y:function(t,e,s){let l=0;if(e===0&&Object.hasOwn(Y,a.arrowTypeStart)){const{angle:r,deltaY:n}=j(s[0],s[1]);l=Y[a.arrowTypeStart]*Math.abs(Math.sin(r))*(n>=0?1:-1)}else if(e===s.length-1&&Object.hasOwn(Y,a.arrowTypeEnd)){const{angle:r,deltaY:n}=j(s[s.length-1],s[s.length-2]);l=Y[a.arrowTypeEnd]*Math.abs(Math.sin(r))*(n>=0?1:-1)}return A(t).y+l}}),er=(a,t,e,s,l)=>{t.arrowTypeStart&&et(a,"start",t.arrowTypeStart,e,s,l),t.arrowTypeEnd&&et(a,"end",t.arrowTypeEnd,e,s,l)},ar={arrow_cross:"cross",arrow_point:"point",arrow_barb:"barb",arrow_circle:"circle",aggregation:"aggregation",extension:"extension",composition:"composition",dependency:"dependency",lollipop:"lollipop"},et=(a,t,e,s,l,r)=>{const n=ar[e];if(!n){f.warn(`Unknown arrow type: ${e}`);return}const i=t==="start"?"Start":"End";a.attr(`marker-${t}`,`url(${s}#${l}_${r}-${n}${i})`)};let Z={},T={};const pr=()=>{Z={},T={}},gr=(a,t)=>{const e=R(w().flowchart.htmlLabels),s=t.labelType==="markdown"?nt(a,t.label,{style:t.labelStyle,useHtmlLabels:e,addSvgBackground:!0}):P(t.label,t.labelStyle),l=a.insert("g").attr("class","edgeLabel"),r=l.insert("g").attr("class","label");r.node().appendChild(s);let n=s.getBBox();if(e){const o=s.children[0],h=_(s);n=o.getBoundingClientRect(),h.attr("width",n.width),h.attr("height",n.height)}r.attr("transform","translate("+-n.width/2+", "+-n.height/2+")"),Z[t.id]=l,t.width=n.width,t.height=n.height;let i;if(t.startLabelLeft){const o=P(t.startLabelLeft,t.labelStyle),h=a.insert("g").attr("class","edgeTerminals"),d=h.insert("g").attr("class","inner");i=d.node().appendChild(o);const c=o.getBBox();d.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),T[t.id]||(T[t.id]={}),T[t.id].startLeft=h,U(i,t.startLabelLeft)}if(t.startLabelRight){const o=P(t.startLabelRight,t.labelStyle),h=a.insert("g").attr("class","edgeTerminals"),d=h.insert("g").attr("class","inner");i=h.node().appendChild(o),d.node().appendChild(o);const c=o.getBBox();d.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),T[t.id]||(T[t.id]={}),T[t.id].startRight=h,U(i,t.startLabelRight)}if(t.endLabelLeft){const o=P(t.endLabelLeft,t.labelStyle),h=a.insert("g").attr("class","edgeTerminals"),d=h.insert("g").attr("class","inner");i=d.node().appendChild(o);const c=o.getBBox();d.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),h.node().appendChild(o),T[t.id]||(T[t.id]={}),T[t.id].endLeft=h,U(i,t.endLabelLeft)}if(t.endLabelRight){const o=P(t.endLabelRight,t.labelStyle),h=a.insert("g").attr("class","edgeTerminals"),d=h.insert("g").attr("class","inner");i=d.node().appendChild(o);const c=o.getBBox();d.attr("transform","translate("+-c.width/2+", "+-c.height/2+")"),h.node().appendChild(o),T[t.id]||(T[t.id]={}),T[t.id].endRight=h,U(i,t.endLabelRight)}return s};function U(a,t){w().flowchart.htmlLabels&&a&&(a.style.width=t.length*9+"px",a.style.height="12px")}const xr=(a,t)=>{f.debug("Moving label abc88 ",a.id,a.label,Z[a.id],t);let e=t.updatedPath?t.updatedPath:t.originalPath;const s=w(),{subGraphTitleTotalMargin:l}=tr(s);if(a.label){const r=Z[a.id];let n=a.x,i=a.y;if(e){const o=H.calcLabelPosition(e);f.debug("Moving label "+a.label+" from (",n,",",i,") to (",o.x,",",o.y,") abc88"),t.updatedPath&&(n=o.x,i=o.y)}r.attr("transform",`translate(${n}, ${i+l/2})`)}if(a.startLabelLeft){const r=T[a.id].startLeft;let n=a.x,i=a.y;if(e){const o=H.calcTerminalLabelPosition(a.arrowTypeStart?10:0,"start_left",e);n=o.x,i=o.y}r.attr("transform",`translate(${n}, ${i})`)}if(a.startLabelRight){const r=T[a.id].startRight;let n=a.x,i=a.y;if(e){const o=H.calcTerminalLabelPosition(a.arrowTypeStart?10:0,"start_right",e);n=o.x,i=o.y}r.attr("transform",`translate(${n}, ${i})`)}if(a.endLabelLeft){const r=T[a.id].endLeft;let n=a.x,i=a.y;if(e){const o=H.calcTerminalLabelPosition(a.arrowTypeEnd?10:0,"end_left",e);n=o.x,i=o.y}r.attr("transform",`translate(${n}, ${i})`)}if(a.endLabelRight){const r=T[a.id].endRight;let n=a.x,i=a.y;if(e){const o=H.calcTerminalLabelPosition(a.arrowTypeEnd?10:0,"end_right",e);n=o.x,i=o.y}r.attr("transform",`translate(${n}, ${i})`)}},nr=(a,t)=>{const e=a.x,s=a.y,l=Math.abs(t.x-e),r=Math.abs(t.y-s),n=a.width/2,i=a.height/2;return l>=n||r>=i},sr=(a,t,e)=>{f.debug(`intersection calc abc89:
|
|
2
|
-
outsidePoint: ${JSON.stringify(t)}
|
|
3
|
-
insidePoint : ${JSON.stringify(e)}
|
|
4
|
-
node : x:${a.x} y:${a.y} w:${a.width} h:${a.height}`);const s=a.x,l=a.y,r=Math.abs(s-e.x),n=a.width/2;let i=e.x<t.x?n-r:n+r;const o=a.height/2,h=Math.abs(t.y-e.y),d=Math.abs(t.x-e.x);if(Math.abs(l-t.y)*n>Math.abs(s-t.x)*o){let c=e.y<t.y?t.y-o-l:l-o-t.y;i=d*c/h;const p={x:e.x<t.x?e.x+i:e.x-d+i,y:e.y<t.y?e.y+h-c:e.y-h+c};return i===0&&(p.x=t.x,p.y=t.y),d===0&&(p.x=t.x),h===0&&(p.y=t.y),f.debug(`abc89 topp/bott calc, Q ${h}, q ${c}, R ${d}, r ${i}`,p),p}else{e.x<t.x?i=t.x-n-s:i=s-n-t.x;let c=h*i/d,p=e.x<t.x?e.x+d-i:e.x-d+i,y=e.y<t.y?e.y+c:e.y-c;return f.debug(`sides calc abc89, Q ${h}, q ${c}, R ${d}, r ${i}`,{_x:p,_y:y}),i===0&&(p=t.x,y=t.y),d===0&&(p=t.x),h===0&&(y=t.y),{x:p,y}}},at=(a,t)=>{f.debug("abc88 cutPathAtIntersect",a,t);let e=[],s=a[0],l=!1;return a.forEach(r=>{if(!nr(t,r)&&!l){const n=sr(t,s,r);let i=!1;e.forEach(o=>{i=i||o.x===n.x&&o.y===n.y}),e.some(o=>o.x===n.x&&o.y===n.y)||e.push(n),l=!0}else s=r,l||e.push(r)}),e},fr=function(a,t,e,s,l,r,n){let i=e.points;f.debug("abc88 InsertEdge: edge=",e,"e=",t);let o=!1;const h=r.node(t.v);var d=r.node(t.w);d!=null&&d.intersect&&h!=null&&h.intersect&&(i=i.slice(1,e.points.length-1),i.unshift(h.intersect(i[0])),i.push(d.intersect(i[i.length-1]))),e.toCluster&&(f.debug("to cluster abc88",s[e.toCluster]),i=at(e.points,s[e.toCluster].node),o=!0),e.fromCluster&&(f.debug("from cluster abc88",s[e.fromCluster]),i=at(i.reverse(),s[e.fromCluster].node).reverse(),o=!0);const c=i.filter(C=>!Number.isNaN(C.y));let p=ot;e.curve&&(l==="graph"||l==="flowchart")&&(p=e.curve);const{x:y,y:x}=rr(e),k=lt().x(y).y(x).curve(p);let g;switch(e.thickness){case"normal":g="edge-thickness-normal";break;case"thick":g="edge-thickness-thick";break;case"invisible":g="edge-thickness-thick";break;default:g=""}switch(e.pattern){case"solid":g+=" edge-pattern-solid";break;case"dotted":g+=" edge-pattern-dotted";break;case"dashed":g+=" edge-pattern-dashed";break}const u=a.append("path").attr("d",k(c)).attr("id",e.id).attr("class"," "+g+(e.classes?" "+e.classes:"")).attr("style",e.style);let v="";(w().flowchart.arrowMarkerAbsolute||w().state.arrowMarkerAbsolute)&&(v=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,v=v.replace(/\(/g,"\\("),v=v.replace(/\)/g,"\\)")),er(u,e,v,n,l);let B={};return o&&(B.updatedPath=i),B.originalPath=e.points,B};export{_t as E,M,P as R,er as a,or as c,xr as d,pr as f,fr as g,dr as h,m,hr as o,yr as p,rr as r,tr as t,gr as x,cr as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o,X as e}from"./flowDb-c6c81e3f-CaVKc_SB-DZrfNATF.js";import{h as a,w as t}from"./styles-d45a18b0-7fTS_K4G-BYM8_U5l.js";import{m}from"./index-D-8SZBhx.js";import"./graph-Bc6U-Oet-3YUGkDrJ.js";import"./layout-BtHnec7v-BmEhz7Rk.js";import"./index-5325376f-DCLsNwAa-DsLbLzAP.js";import"./clone-vCPXKFeo-CwhyC9Xy.js";import"./edges-96097737-XAH6P1yX-FQjO7zBz.js";import"./createText-1719965b-Cbn6MBZp-HdNLk45j.js";import"./channel-CSC8iKVS-B3buI7Pt.js";const k={parser:e,db:o,renderer:t,styles:a,init:r=>{r.flowchart||(r.flowchart={}),r.flowchart.arrowMarkerAbsolute=r.arrowMarkerAbsolute,m({flowchart:{arrowMarkerAbsolute:r.arrowMarkerAbsolute}}),t.setConf(r.flowchart),o.clear(),o.setGen("gen-2")}};export{k as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as E,K as j}from"./graph-Bc6U-Oet-3YUGkDrJ.js";import{A,w as R}from"./layout-BtHnec7v-BmEhz7Rk.js";import{a as K}from"./clone-vCPXKFeo-CwhyC9Xy.js";import{c as H,m as W,o as q,h as z,x as Q,t as T,p as D,g as U,d as V,E as O,R as J,y as Y,f as Z}from"./edges-96097737-XAH6P1yX-FQjO7zBz.js";import{O as i,X as B,R as C,P as G}from"./index-D-8SZBhx.js";import{$ as _}from"./createText-1719965b-Cbn6MBZp-HdNLk45j.js";function y(r){var e={options:{directed:r.isDirected(),multigraph:r.isMultigraph(),compound:r.isCompound()},nodes:ee(r),edges:te(r)};return E(r.graph())||(e.value=K(r.graph())),e}function ee(r){return R(r.nodes(),function(e){var t=r.node(e),a=r.parent(e),n={v:e};return E(t)||(n.value=t),E(a)||(n.parent=a),n})}function te(r){return R(r.edges(),function(e){var t=r.edge(e),a={v:e.v,w:e.w};return E(e.name)||(a.name=e.name),E(t)||(a.value=t),a})}let l={},u={},P={};const re=()=>{u={},P={},l={}},S=(r,e)=>(i.trace("In isDescendant",e," ",r," = ",u[e].includes(r)),!!u[e].includes(r)),ne=(r,e)=>(i.info("Descendants of ",e," is ",u[e]),i.info("Edge is ",r),r.v===e||r.w===e?!1:u[e]?u[e].includes(r.v)||S(r.v,e)||S(r.w,e)||u[e].includes(r.w):(i.debug("Tilt, ",e,",not in descendants"),!1)),$=(r,e,t,a)=>{i.warn("Copying children of ",r,"root",a,"data",e.node(r),a);const n=e.children(r)||[];r!==a&&n.push(r),i.warn("Copying (nodes) clusterId",r,"nodes",n),n.forEach(o=>{if(e.children(o).length>0)$(o,e,t,a);else{const c=e.node(o);i.info("cp ",o," to ",a," with parent ",r),t.setNode(o,c),a!==e.parent(o)&&(i.warn("Setting parent",o,e.parent(o)),t.setParent(o,e.parent(o))),r!==a&&o!==r?(i.debug("Setting parent",o,r),t.setParent(o,r)):(i.info("In copy ",r,"root",a,"data",e.node(r),a),i.debug("Not Setting parent for node=",o,"cluster!==rootId",r!==a,"node!==clusterId",o!==r));const g=e.edges(o);i.debug("Copying Edges",g),g.forEach(h=>{i.info("Edge",h);const f=e.edge(h.v,h.w,h.name);i.info("Edge data",f,a);try{ne(h,a)?(i.info("Copying as ",h.v,h.w,f,h.name),t.setEdge(h.v,h.w,f,h.name),i.info("newGraph edges ",t.edges(),t.edge(t.edges()[0]))):i.info("Skipping copy of edge ",h.v,"-->",h.w," rootId: ",a," clusterId:",r)}catch(w){i.error(w)}})}i.debug("Removing node",o),e.removeNode(o)})},F=(r,e)=>{const t=e.children(r);let a=[...t];for(const n of t)P[n]=r,a=[...a,...F(n,e)];return a},X=(r,e)=>{i.trace("Searching",r);const t=e.children(r);if(i.trace("Searching children of id ",r,t),t.length<1)return i.trace("This is a valid node",r),r;for(const a of t){const n=X(a,e);if(n)return i.trace("Found replacement for",r," => ",n),n}},N=r=>!l[r]||!l[r].externalConnections?r:l[r]?l[r].id:r,ie=(r,e)=>{if(!r||e>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");r.nodes().forEach(function(t){r.children(t).length>0&&(i.warn("Cluster identified",t," Replacement id in edges: ",X(t,r)),u[t]=F(t,r),l[t]={id:X(t,r),clusterData:r.node(t)})}),r.nodes().forEach(function(t){const a=r.children(t),n=r.edges();a.length>0?(i.debug("Cluster identified",t,u),n.forEach(o=>{if(o.v!==t&&o.w!==t){const c=S(o.v,t),g=S(o.w,t);c^g&&(i.warn("Edge: ",o," leaves cluster ",t),i.warn("Descendants of XXX ",t,": ",u[t]),l[t].externalConnections=!0)}})):i.debug("Not a cluster ",t,u)});for(let t of Object.keys(l)){const a=l[t].id,n=r.parent(a);n!==t&&l[n]&&!l[n].externalConnections&&(l[t].id=n)}r.edges().forEach(function(t){const a=r.edge(t);i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),i.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(r.edge(t)));let n=t.v,o=t.w;if(i.warn("Fix XXX",l,"ids:",t.v,t.w,"Translating: ",l[t.v]," --- ",l[t.w]),l[t.v]&&l[t.w]&&l[t.v]===l[t.w]){i.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name);const c=t.w+"---"+t.v;r.setNode(c,{domId:c,id:c,labelStyle:"",labelText:a.label,padding:0,shape:"labelRect",style:""});const g=structuredClone(a),h=structuredClone(a);g.label="",g.arrowTypeEnd="none",h.label="",g.fromCluster=t.v,h.toCluster=t.v,r.setEdge(n,c,g,t.name+"-cyclic-special"),r.setEdge(c,o,h,t.name+"-cyclic-special")}else if(l[t.v]||l[t.w]){if(i.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),n=N(t.v),o=N(t.w),r.removeEdge(t.v,t.w,t.name),n!==t.v){const c=r.parent(n);l[c].externalConnections=!0,a.fromCluster=t.v}if(o!==t.w){const c=r.parent(o);l[c].externalConnections=!0,a.toCluster=t.w}i.warn("Fix Replacing with XXX",n,o,t.name),r.setEdge(n,o,a,t.name)}}),i.warn("Adjusted Graph",y(r)),I(r,0),i.trace(l)},I=(r,e)=>{if(i.warn("extractor - ",e,y(r),r.children("D")),e>10){i.error("Bailing out");return}let t=r.nodes(),a=!1;for(const n of t){const o=r.children(n);a=a||o.length>0}if(!a){i.debug("Done, no node has children",r.nodes());return}i.debug("Nodes = ",t,e);for(const n of t)if(i.debug("Extracting node",n,l,l[n]&&!l[n].externalConnections,!r.parent(n),r.node(n),r.children("D")," Depth ",e),!l[n])i.debug("Not a cluster",n,e);else if(!l[n].externalConnections&&r.children(n)&&r.children(n).length>0){i.warn("Cluster without external connections, without a parent and with children",n,e);let o=r.graph().rankdir==="TB"?"LR":"TB";l[n]&&l[n].clusterData&&l[n].clusterData.dir&&(o=l[n].clusterData.dir,i.warn("Fixing dir",l[n].clusterData.dir,o));const c=new j({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});i.warn("Old graph before copy",y(r)),$(n,r,c,n),r.setNode(n,{clusterNode:!0,id:n,clusterData:l[n].clusterData,labelText:l[n].labelText,graph:c}),i.warn("New graph after copy node: (",n,")",y(c)),i.debug("Old graph after copy",y(r))}else i.warn("Cluster ** ",n," **not meeting the criteria !externalConnections:",!l[n].externalConnections," no parent: ",!r.parent(n)," children ",r.children(n)&&r.children(n).length>0,r.children("D"),e),i.debug(l);t=r.nodes(),i.warn("New list of nodes",t);for(const n of t){const o=r.node(n);i.warn(" Now next level",n,o),o.clusterNode&&I(o.graph,e+1)}},k=(r,e)=>{if(e.length===0)return[];let t=Object.assign(e);return e.forEach(a=>{const n=r.children(a),o=k(r,n);t=[...t,...o]}),t},ae=r=>k(r,r.children()),oe=(r,e)=>{i.info("Creating subgraph rect for ",e.id,e);const t=B(),a=r.insert("g").attr("class","cluster"+(e.class?" "+e.class:"")).attr("id",e.id),n=a.insert("rect",":first-child"),o=C(t.flowchart.htmlLabels),c=a.insert("g").attr("class","cluster-label"),g=e.labelType==="markdown"?_(c,e.labelText,{style:e.labelStyle,useHtmlLabels:o}):c.node().appendChild(J(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}const f=0*e.padding,w=f/2,p=e.width<=h.width+f?h.width+f:e.width;e.width<=h.width+f?e.diff=(h.width-e.width)/2-e.padding/2:e.diff=-e.padding/2,i.trace("Data ",e,JSON.stringify(e)),n.attr("style",e.style).attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-p/2).attr("y",e.y-e.height/2-w).attr("width",p).attr("height",e.height+f);const{subGraphTitleTopMargin:x}=T(t);o?c.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2+x})`):c.attr("transform",`translate(${e.x}, ${e.y-e.height/2+x})`);const v=n.node().getBBox();return e.width=v.width,e.height=v.height,e.intersect=function(d){return O(e,d)},a},de=(r,e)=>{const t=r.insert("g").attr("class","note-cluster").attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("rx",e.rx).attr("ry",e.ry).attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2-o).attr("width",e.width+n).attr("height",e.height+n).attr("fill","none");const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.intersect=function(g){return O(e,g)},t},se=(r,e)=>{const t=B(),a=r.insert("g").attr("class",e.classes).attr("id",e.id),n=a.insert("rect",":first-child"),o=a.insert("g").attr("class","cluster-label"),c=a.append("rect"),g=o.node().appendChild(J(e.labelText,e.labelStyle,void 0,!0));let h=g.getBBox();if(C(t.flowchart.htmlLabels)){const d=g.children[0],s=G(g);h=d.getBoundingClientRect(),s.attr("width",h.width),s.attr("height",h.height)}h=g.getBBox();const f=0*e.padding,w=f/2,p=e.width<=h.width+e.padding?h.width+e.padding:e.width;e.width<=h.width+e.padding?e.diff=(h.width+e.padding*0-e.width)/2:e.diff=-e.padding/2,n.attr("class","outer").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w).attr("width",p+f).attr("height",e.height+f),c.attr("class","inner").attr("x",e.x-p/2-w).attr("y",e.y-e.height/2-w+h.height-1).attr("width",p+f).attr("height",e.height+f-h.height-3);const{subGraphTitleTopMargin:x}=T(t);o.attr("transform",`translate(${e.x-h.width/2}, ${e.y-e.height/2-e.padding/3+(C(t.flowchart.htmlLabels)?5:3)+x})`);const v=n.node().getBBox();return e.height=v.height,e.intersect=function(d){return O(e,d)},a},le=(r,e)=>{const t=r.insert("g").attr("class",e.classes).attr("id",e.id),a=t.insert("rect",":first-child"),n=0*e.padding,o=n/2;a.attr("class","divider").attr("x",e.x-e.width/2-o).attr("y",e.y-e.height/2).attr("width",e.width+n).attr("height",e.height+n);const c=a.node().getBBox();return e.width=c.width,e.height=c.height,e.diff=-e.padding/2,e.intersect=function(g){return O(e,g)},t},he={rect:oe,roundedWithTitle:se,noteGroup:de,divider:le};let L={};const ce=(r,e)=>{i.trace("Inserting cluster");const t=e.shape||"rect";L[e.id]=he[t](r,e)},ge=()=>{L={}},M=async(r,e,t,a,n,o)=>{i.info("Graph in recursive render: XXX",y(e),n);const c=e.graph().rankdir;i.trace("Dir in recursive render - dir:",c);const g=r.insert("g").attr("class","root");e.nodes()?i.info("Recursive render XXX",e.nodes()):i.info("No nodes found for",e),e.edges().length>0&&i.trace("Recursive edges",e.edge(e.edges()[0]));const h=g.insert("g").attr("class","clusters"),f=g.insert("g").attr("class","edgePaths"),w=g.insert("g").attr("class","edgeLabels"),p=g.insert("g").attr("class","nodes");await Promise.all(e.nodes().map(async function(d){const s=e.node(d);if(n!==void 0){const m=JSON.parse(JSON.stringify(n.clusterData));i.info("Setting data for cluster XXX (",d,") ",m,n),e.setNode(n.id,m),e.parent(d)||(i.trace("Setting parent",d,n.id),e.setParent(d,n.id,m))}if(i.info("(Insert) Node XXX"+d+": "+JSON.stringify(e.node(d))),s&&s.clusterNode){i.info("Cluster identified",d,s.width,e.node(d));const m=await M(p,s.graph,t,a,e.node(d),o),b=m.elem;W(s,b),s.diff=m.diff||0,i.info("Node bounds (abc123)",d,s,s.width,s.x,s.y),q(b,s),i.warn("Recursive render complete ",b,s)}else e.children(d).length>0?(i.info("Cluster - the non recursive path XXX",d,s.id,s,e),i.info(X(s.id,e)),l[s.id]={id:X(s.id,e),node:s}):(i.info("Node - the non recursive path",d,s.id,s),await z(p,e.node(d),c))})),e.edges().forEach(function(d){const s=e.edge(d.v,d.w,d.name);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d)),i.info("Edge "+d.v+" -> "+d.w+": ",d," ",JSON.stringify(e.edge(d))),i.info("Fix",l,"ids:",d.v,d.w,"Translating: ",l[d.v],l[d.w]),Q(w,s)}),e.edges().forEach(function(d){i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(d))}),i.info("#############################################"),i.info("### Layout ###"),i.info("#############################################"),i.info(e),A(e),i.info("Graph after layout:",y(e));let x=0;const{subGraphTitleTotalMargin:v}=T(o);return ae(e).forEach(function(d){const s=e.node(d);i.info("Position "+d+": "+JSON.stringify(e.node(d))),i.info("Position "+d+": ("+s.x,","+s.y,") width: ",s.width," height: ",s.height),s&&s.clusterNode?(s.y+=v,D(s)):e.children(d).length>0?(s.height+=v,ce(h,s),l[s.id].node=s):(s.y+=v/2,D(s))}),e.edges().forEach(function(d){const s=e.edge(d);i.info("Edge "+d.v+" -> "+d.w+": "+JSON.stringify(s),s),s.points.forEach(b=>b.y+=v/2);const m=U(f,d,s,l,t,e,a);V(s,m)}),e.nodes().forEach(function(d){const s=e.node(d);i.info(d,s.type,s.diff),s.type==="group"&&(x=s.diff)}),{elem:g,diff:x}},me=async(r,e,t,a,n)=>{H(r,t,a,n),Y(),Z(),ge(),re(),i.warn("Graph at first:",JSON.stringify(y(e))),ie(e),i.warn("Graph after:",JSON.stringify(y(e)));const o=B();await M(r,e,a,n,void 0,o)};export{me as b};
|