cc-viewer 1.7.6 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/README.md +20 -1
  2. package/cli.js +41 -31
  3. package/dist/assets/App-Bs6-c4Ov.css +1 -0
  4. package/dist/assets/App-DtsIVPu6.js +2 -0
  5. package/dist/assets/{MdxEditorPanel-BQ5MgI4D.js → MdxEditorPanel-DWPAEnpm.js} +1 -1
  6. package/dist/assets/Mobile-DHwMZG4N.js +1 -0
  7. package/dist/assets/ProxyStatsModal-D9lTz0-T.js +1 -0
  8. package/dist/assets/ProxyStatsModal-Dz5GuoUa.css +1 -0
  9. package/dist/assets/abnfDiagram-VRR7QNED-9ax220Vv.js +1 -0
  10. package/dist/assets/arc-Cshrl52z.js +1 -0
  11. package/dist/assets/architectureDiagram-ZJ3FMSHR-QtERolgF.js +1 -0
  12. package/dist/assets/blockDiagram-677ZJIJ3-BaCd4R0Z.js +1 -0
  13. package/dist/assets/{c4Diagram-AHTNJAMY-C7JB9PqP.js → c4Diagram-LMCZKHZV-C2QvkF2i.js} +1 -1
  14. package/dist/assets/{channel-BnzX9zBS.js → channel-ClOiNc35.js} +1 -1
  15. package/dist/assets/{chunk-QZHKN3VN-CNEAHnZV.js → chunk-2Q5K7J3B-BvZ7-Ft4.js} +1 -1
  16. package/dist/assets/{chunk-YZCP3GAM-BOlts_Dm.js → chunk-32BRIVSS-Dg3PlJIt.js} +1 -1
  17. package/dist/assets/{chunk-FMBD7UC4-CGL9Lo51.js → chunk-5VM5RSS4-CMJWLQsQ.js} +1 -1
  18. package/dist/assets/chunk-EX3LRPZG-CmoC-M2G.js +1 -0
  19. package/dist/assets/{chunk-4BX2VUAB-dVKiUtqe.js → chunk-JWPE2WC7-D5RR93-U.js} +1 -1
  20. package/dist/assets/chunk-MOJQB5TN-JXgBLjCY.js +1 -0
  21. package/dist/assets/chunk-RYQCIY6F-gT-v276m.js +1 -0
  22. package/dist/assets/chunk-V7JOEXUC-Cl-E_fxl.js +1 -0
  23. package/dist/assets/{chunk-EDXVE4YY-sk9g7szp.js → chunk-VR4S4FIN-BR0zG1Ep.js} +1 -1
  24. package/dist/assets/{chunk-55IACEB6-BZuKI6JQ.js → chunk-XXDRQBXY-Blw-tThR.js} +1 -1
  25. package/dist/assets/classDiagram-OUVF2IWQ-ClkcbuHu.js +1 -0
  26. package/dist/assets/classDiagram-v2-EOCWNBFH-ClkcbuHu.js +1 -0
  27. package/dist/assets/{cose-bilkent-S5V4N54A-DH4_YiGi.js → cose-bilkent-JH36ORCC-BnDDyyuN.js} +1 -1
  28. package/dist/assets/cynefin-VYW2F7L2-Ch8_Ihra.js +15 -0
  29. package/dist/assets/cynefinDiagram-TSTJHNR4-CuX_xTSU.js +1 -0
  30. package/dist/assets/cytoscape.esm-D0POlJZ1.js +9 -0
  31. package/dist/assets/dagre-VKFMJZFB-DHDO7DUw.js +1 -0
  32. package/dist/assets/diagram-FQU43EPY-CxDVpL25.js +1 -0
  33. package/dist/assets/diagram-G47NLZAW-DHX7L6pT.js +1 -0
  34. package/dist/assets/diagram-NH7WQ7WH-HlwtIdWA.js +1 -0
  35. package/dist/assets/diagram-OA4YK3LP-BnTSu9CG.js +1 -0
  36. package/dist/assets/diagram-WEI45ONY-C712tBJk.js +1 -0
  37. package/dist/assets/ebnfDiagram-CCIWWBDH-DzMcH3cz.js +1 -0
  38. package/dist/assets/erDiagram-Q63AITRT-0fyhQG92.js +1 -0
  39. package/dist/assets/flowDiagram-23GEKE2U-lgfs10IO.js +1 -0
  40. package/dist/assets/{ganttDiagram-T4ZO3ILL-BL_XQ958.js → ganttDiagram-NO4QXBWP-_4nnZ3ta.js} +1 -1
  41. package/dist/assets/gitGraphDiagram-IHSO6WYX-DrgEKJkZ.js +1 -0
  42. package/dist/assets/graph-CnJdn47S.js +1 -0
  43. package/dist/assets/{index-CzPHj3iF.js → index-7VeS_xrl.js} +1 -1
  44. package/dist/assets/{index-BgW_nP_0.js → index-BJ9Xm7_G.js} +1 -1
  45. package/dist/assets/{index-B3-JUU7J.js → index-BiYKFU6w.js} +1 -1
  46. package/dist/assets/index-By8aqIvN.js +2 -0
  47. package/dist/assets/{index-Do5xNTOT.js → index-CBix0zSu.js} +1 -1
  48. package/dist/assets/{index-DDlAMOiV.js → index-CPAQ767L.js} +1 -1
  49. package/dist/assets/{index-LjVy-Pzg.js → index-DuUUHxox.js} +1 -1
  50. package/dist/assets/{index-vImWXiMM.js → index-_pxC-jz_.js} +1 -1
  51. package/dist/assets/infoDiagram-FWYZ7A6U-Cki8RIbq.js +1 -0
  52. package/dist/assets/{ishikawaDiagram-UXIWVN3A-D3odpv9_.js → ishikawaDiagram-FXEZZL3T-DHHu_UGe.js} +1 -1
  53. package/dist/assets/{journeyDiagram-VCZTEJTY-Dj3NaOWF.js → journeyDiagram-5HDEW3XC-Bx06Sp3y.js} +1 -1
  54. package/dist/assets/{jszip.min-GmVScWAV.js → jszip.min-Bn5J9HN-.js} +1 -1
  55. package/dist/assets/{kanban-definition-6JOO6SKY-GKjJaLwD.js → kanban-definition-HUTT4EX6-BuEuKkQp.js} +1 -1
  56. package/dist/assets/layout-CCUE9ZRw.js +1 -0
  57. package/dist/assets/{linear-CLk9nvqn.js → linear-BJRZNsdX.js} +1 -1
  58. package/dist/assets/map-DQeg2hXV.js +1 -0
  59. package/dist/assets/mermaid.core-DH-sQJgr.js +7 -0
  60. package/dist/assets/{mindmap-definition-QFDTVHPH-DgDD6Jbu.js → mindmap-definition-LN4V7U3C-DYtgJ2f4.js} +1 -1
  61. package/dist/assets/pegDiagram-2B236MQR-BVN6OIEN.js +1 -0
  62. package/dist/assets/pieDiagram-ENE6RG2P-mVeQtQTD.js +1 -0
  63. package/dist/assets/quadrantDiagram-ABIIQ3AL-Croqf1qH.js +1 -0
  64. package/dist/assets/railroadDiagram-RFXS5EU6-jkGuNfMY.js +1 -0
  65. package/dist/assets/{requirementDiagram-MS252O5E-CtBOCtbk.js → requirementDiagram-TGXJPOKE-Cwb2FU3N.js} +1 -1
  66. package/dist/assets/sankeyDiagram-HTMAVEWB-D-HWOuX0.js +1 -0
  67. package/dist/assets/seqResourceLoaders-C-pxCjNh.js +2 -0
  68. package/dist/assets/sequenceDiagram-DBY2YBRQ-Bh3XgPxy.js +1 -0
  69. package/dist/assets/sizeCapture-X5ZJPWSS-C_acEkFf.js +1 -0
  70. package/dist/assets/stateDiagram-2N3HPSRC-CmbRj6R7.js +1 -0
  71. package/dist/assets/stateDiagram-v2-6OUMAXLB-ClrX-Ofc.js +1 -0
  72. package/dist/assets/swimlanes-5IMT3BWC-CIfoRrLM.js +2 -0
  73. package/dist/assets/swimlanesDiagram-G3AALYLV-DZuW0-dQ.js +1 -0
  74. package/dist/assets/{timeline-definition-GMOUNBTQ-B5cPasy_.js → timeline-definition-FHXFAJF6-CK8MkCLz.js} +1 -1
  75. package/dist/assets/vendor-antd-DNUTLr77.js +17 -0
  76. package/dist/assets/{vendor-codemirror-_NbrtdQc.js → vendor-codemirror-6ck0hLRU.js} +1 -1
  77. package/dist/assets/vendor-markdown-DBlfs4dR.js +3 -0
  78. package/dist/assets/vendor-mdxeditor-DT0rad22.js +2 -0
  79. package/dist/assets/vendor-qrcode-CPmWG6hm.js +6 -0
  80. package/dist/assets/vendor-virtuoso-YwK7i7L6.js +1 -0
  81. package/dist/assets/{vennDiagram-DHZGUBPP-a_ybZDST.js → vennDiagram-L72KCM5P-CWA2Gdi_.js} +1 -1
  82. package/dist/assets/wardleyDiagram-EHGQE667-U22kgZ8v.js +1 -0
  83. package/dist/assets/xychartDiagram-FW5EYKEG-BiGsMUKC.js +1 -0
  84. package/dist/index.html +4 -4
  85. package/findcc.js +281 -5
  86. package/package.json +1 -1
  87. package/server/lib/proxy-stats.js +75 -32
  88. package/server/pty-manager.js +3 -8
  89. package/server/routes/preferences.js +71 -1
  90. package/server/system-prompt-templates/presets/index.json +8 -0
  91. package/server/system-prompt-templates/presets/kimi-k3.md +68 -0
  92. package/src/utils/helpers.js +6 -1
  93. package/dist/assets/App-3VM471BO.js +0 -2
  94. package/dist/assets/App-CCDFxj11.css +0 -1
  95. package/dist/assets/Mobile-wwcXmnrU.js +0 -1
  96. package/dist/assets/UnifiedProxyRetryPage-BpcKIn9N.js +0 -1
  97. package/dist/assets/UnifiedProxyRetryPage-CFz4vOH5.css +0 -1
  98. package/dist/assets/_baseUniq-yiNE5Ckw.js +0 -1
  99. package/dist/assets/arc-M-eBYYbN.js +0 -1
  100. package/dist/assets/architectureDiagram-Q4EWVU46-CtweeLKi.js +0 -1
  101. package/dist/assets/blockDiagram-DXYQGD6D-DCVQ-go_.js +0 -1
  102. package/dist/assets/chunk-4TB4RGXK-CQjD9-fD.js +0 -1
  103. package/dist/assets/chunk-OYMX7WX6-DaN0AdQD.js +0 -1
  104. package/dist/assets/classDiagram-6PBFFD2Q-CumOMdO7.js +0 -1
  105. package/dist/assets/classDiagram-v2-HSJHXN6E-CumOMdO7.js +0 -1
  106. package/dist/assets/clone-C3SZDzs1.js +0 -1
  107. package/dist/assets/cytoscape.esm-CT1mZavR.js +0 -9
  108. package/dist/assets/dagre-KV5264BT-RqusStYI.js +0 -1
  109. package/dist/assets/diagram-5BDNPKRD-8haVbBnt.js +0 -1
  110. package/dist/assets/diagram-G4DWMVQ6-CsrJNUhT.js +0 -1
  111. package/dist/assets/diagram-MMDJMWI5-1luPOM38.js +0 -1
  112. package/dist/assets/diagram-TYMM5635-Dad1XR3W.js +0 -1
  113. package/dist/assets/erDiagram-SMLLAGMA-Br6-kbp9.js +0 -1
  114. package/dist/assets/flowDiagram-DWJPFMVM-DuX1mbA7.js +0 -1
  115. package/dist/assets/gitGraphDiagram-UUTBAWPF-DzvW5FEs.js +0 -1
  116. package/dist/assets/graph-CbUmu0Oe.js +0 -1
  117. package/dist/assets/index-BjNLFJ0z.js +0 -2
  118. package/dist/assets/infoDiagram-42DDH7IO-DGsgRji7.js +0 -1
  119. package/dist/assets/layout-Bhk66H0F.js +0 -1
  120. package/dist/assets/mermaid.core-DH-GfeNS.js +0 -7
  121. package/dist/assets/min-DQftOGfo.js +0 -1
  122. package/dist/assets/pieDiagram-DEJITSTG-jy1yFaxA.js +0 -1
  123. package/dist/assets/quadrantDiagram-34T5L4WZ-BdvMwrSD.js +0 -1
  124. package/dist/assets/sankeyDiagram-XADWPNL6-DEFlQp-h.js +0 -1
  125. package/dist/assets/seqResourceLoaders-CDRtUSxI.js +0 -2
  126. package/dist/assets/sequenceDiagram-FGHM5R23-0F2R8Ky0.js +0 -1
  127. package/dist/assets/stateDiagram-FHFEXIEX-D4xOwcSW.js +0 -1
  128. package/dist/assets/stateDiagram-v2-QKLJ7IA2-DSf_BSF8.js +0 -1
  129. package/dist/assets/vendor-antd-DeqwrDxf.js +0 -17
  130. package/dist/assets/vendor-markdown-DOJHsAxX.js +0 -3
  131. package/dist/assets/vendor-mdxeditor-DG0Nyxw5.js +0 -2
  132. package/dist/assets/vendor-qrcode-B3HN--HO.js +0 -6
  133. package/dist/assets/vendor-virtuoso-BvrezPQx.js +0 -1
  134. package/dist/assets/wardley-RL74JXVD-CKla3KF8.js +0 -1
  135. package/dist/assets/wardleyDiagram-NUSXRM2D-BKke2aih.js +0 -1
  136. package/dist/assets/xychartDiagram-5P7HB3ND-CozWtcdf.js +0 -1
@@ -1 +1 @@
1
- import{_ as __name,C as getConfig,U as isDark,V as lighten,W as darken,c as getConfig2,l as log,H as selectSvgElement,M as parseFontSize,X as setupGraphViewbox,d as select,B as __export,Y as commonDb_exports,y as clear}from"./mermaid.core-DH-GfeNS.js";import{d as d3arc}from"./arc-M-eBYYbN.js";import"./vendor-mdxeditor-DG0Nyxw5.js";import"./vendor-antd-DeqwrDxf.js";import"./vendor-codemirror-_NbrtdQc.js";import"./vendor-markdown-DOJHsAxX.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,11,13,14,15,17,19,20,23,24],$V1=[1,12],$V2=[1,13],$V3=[1,14],$V4=[1,15],$V5=[1,16],$V6=[1,19],$V7=[1,20],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 3:yy.setDirection("LR");break;case 4:yy.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 7:case 8:this.$=$$[$0];break;case 11:yy.getCommonDb().setDiagramTitle($$[$0].substr(6)),this.$=$$[$0].substr(6);break;case 12:this.$=$$[$0].trim(),yy.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=$$[$0].trim(),yy.getCommonDb().setAccDescription(this.$);break;case 15:yy.addSection($$[$0].substr(8)),this.$=$$[$0].substr(8);break;case 18:yy.addTask($$[$0],0,""),this.$=$$[$0];break;case 19:yy.addEvent($$[$0].substr(2)),this.$=$$[$0]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},o($V0,[2,5],{5:6}),o($V0,[2,2]),o($V0,[2,3]),o($V0,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,10],{1:[2,1]}),o($V0,[2,6]),{12:21,14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,11]),{16:[1,22]},{18:[1,23]},o($V0,[2,14]),o($V0,[2,15]),o($V0,[2,16]),o($V0,[2,17]),o($V0,[2,18]),o($V0,[2,19]),o($V0,[2,7]),o($V0,[2,12]),o($V0,[2,13])],defaultActions:{},parseError:__name(function(str,hash){if(!hash.recoverable){var error=new Error(str);throw error.hash=hash,error}this.trace(str)},"parseError"),parse:__name(function(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,args=lstack.slice.call(arguments,1),lexer2=Object.create(this.lexer),sharedState={yy:{}};for(var k in this.yy)Object.prototype.hasOwnProperty.call(this.yy,k)&&(sharedState.yy[k]=this.yy[k]);lexer2.setInput(input,sharedState.yy),sharedState.yy.lexer=lexer2,sharedState.yy.parser=this,void 0===lexer2.yylloc&&(lexer2.yylloc={});var yyloc=lexer2.yylloc;lstack.push(yyloc);var ranges=lexer2.options&&lexer2.options.ranges;function lex(){var token;return"number"!=typeof(token=tstack.pop()||lexer2.lex()||1)&&(token instanceof Array&&(token=(tstack=token).pop()),token=self.symbols_[token]||token),token}"function"==typeof sharedState.yy.parseError?this.parseError=sharedState.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,__name(function(n){stack.length=stack.length-2*n,vstack.length=vstack.length-n,lstack.length=lstack.length-n},"popStack"),__name(lex,"lex");for(var symbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:(null==symbol&&(symbol=lex()),action=table[state]&&table[state][symbol]),void 0===action||!action.length||!action[0]){var errStr="";for(p in expected=[],table[state])this.terminals_[p]&&p>2&&expected.push("'"+this.terminals_[p]+"'");errStr=lexer2.showPosition?"Parse error on line "+(yylineno+1)+":\n"+lexer2.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:lexer2.match,token:this.terminals_[symbol]||symbol,line:lexer2.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(lexer2.yytext),lstack.push(lexer2.yylloc),stack.push(action[1]),symbol=null,yyleng=lexer2.yyleng,yytext=lexer2.yytext,yylineno=lexer2.yylineno,yyloc=lexer2.yylloc;break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args))))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0},"parse")},lexer=function(){return{EOF:1,parseError:__name(function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},"parseError"),setInput:__name(function(input,yy){return this.yy=yy||this.yy||{},this._input=input,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:__name(function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},"input"),unput:__name(function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len),this.offset-=len;var oldLines=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),lines.length-1&&(this.yylineno-=lines.length-1);var r=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:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},"unput"),more:__name(function(){return this._more=!0,this},"more"),reject:__name(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:__name(function(n){this.unput(this.match.slice(n))},"less"),pastInput:__name(function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:__name(function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:__name(function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},"showPosition"),test_match:__name(function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={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&&(backup.yylloc.range=this.yylloc.range.slice(0))),(lines=match[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,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(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},"test_match"),next:__name(function(){if(this.done)return this.EOF;var token,match,tempMatch,index;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;i<rules.length;i++)if((tempMatch=this._input.match(this.rules[rules[i]]))&&(!match||tempMatch[0].length>match[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:__name(function(){var r=this.next();return r||this.lex()},"lex"),begin:__name(function(condition){this.conditionStack.push(condition)},"begin"),popState:__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:__name(function(n){return(n=this.conditionStack.length-1-Math.abs(n||0))>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:__name(function(condition){this.begin(condition)},"pushState"),stateStackSize:__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:__name(function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/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]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function Parser(){this.yy={}}return parser2.lexer=lexer,__name(Parser,"Parser"),Parser.prototype=parser2,parser2.Parser=Parser,new Parser}();parser.parser=parser;var timeline_default=parser,timelineDb_exports={};__export(timelineDb_exports,{addEvent:()=>addEvent,addSection:()=>addSection,addTask:()=>addTask,addTaskOrg:()=>addTaskOrg,clear:()=>clear2,default:()=>timelineDb_default,getCommonDb:()=>getCommonDb,getDirection:()=>getDirection,getSections:()=>getSections,getTasks:()=>getTasks,setDirection:()=>setDirection});var currentSection="",currentTaskId=0,direction="LR",sections=[],tasks=[],rawTasks=[],getCommonDb=__name(()=>commonDb_exports,"getCommonDb"),clear2=__name(function(){sections.length=0,tasks.length=0,currentSection="",rawTasks.length=0,direction="LR",clear()},"clear"),setDirection=__name(function(dir){direction=dir},"setDirection"),getDirection=__name(function(){return direction},"getDirection"),addSection=__name(function(txt){currentSection=txt,sections.push(txt)},"addSection"),getSections=__name(function(){return sections},"getSections"),getTasks=__name(function(){let allItemsProcessed=compileTasks();let iterationCount=0;for(;!allItemsProcessed&&iterationCount<100;)allItemsProcessed=compileTasks(),iterationCount++;return tasks.push(...rawTasks),tasks},"getTasks"),addTask=__name(function(period,length,event){const rawTask={id:currentTaskId++,section:currentSection,type:currentSection,task:period,score:length||0,events:event?[event]:[]};rawTasks.push(rawTask)},"addTask"),addEvent=__name(function(event){rawTasks.find(task=>task.id===currentTaskId-1).events.push(event)},"addEvent"),addTaskOrg=__name(function(descr){const newTask={section:currentSection,type:currentSection,description:descr,task:descr,classes:[]};tasks.push(newTask)},"addTaskOrg"),compileTasks=__name(function(){const compileTask=__name(function(pos){return rawTasks[pos].processed},"compileTask");let allProcessed=!0;for(const[i,rawTask]of rawTasks.entries())compileTask(i),allProcessed=allProcessed&&rawTask.processed;return allProcessed},"compileTasks"),timelineDb_default={clear:clear2,getCommonDb:getCommonDb,getDirection:getDirection,setDirection:setDirection,addSection:addSection,getSections:getSections,getTasks:getTasks,addTask:addTask,addTaskOrg:addTaskOrg,addEvent:addEvent},nodeCount=0,drawRect=__name(function(elem,rectData){const rectElem=elem.append("rect");return rectElem.attr("x",rectData.x),rectElem.attr("y",rectData.y),rectElem.attr("fill",rectData.fill),rectElem.attr("stroke",rectData.stroke),rectElem.attr("width",rectData.width),rectElem.attr("height",rectData.height),rectElem.attr("rx",rectData.rx),rectElem.attr("ry",rectData.ry),void 0!==rectData.class&&rectElem.attr("class",rectData.class),rectElem},"drawRect"),drawFace=__name(function(element,faceData){const circleElement=element.append("circle").attr("cx",faceData.cx).attr("cy",faceData.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),face=element.append("g");function smile(face2){const arc=d3arc().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+2)+")")}function sad(face2){const arc=d3arc().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+7)+")")}function ambivalent(face2){face2.append("line").attr("class","mouth").attr("stroke",2).attr("x1",faceData.cx-5).attr("y1",faceData.cy+7).attr("x2",faceData.cx+5).attr("y2",faceData.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return face.append("circle").attr("cx",faceData.cx-5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),face.append("circle").attr("cx",faceData.cx+5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),__name(smile,"smile"),__name(sad,"sad"),__name(ambivalent,"ambivalent"),faceData.score>3?smile(face):faceData.score<3?sad(face):ambivalent(face),circleElement},"drawFace"),drawCircle=__name(function(element,circleData){const circleElement=element.append("circle");return circleElement.attr("cx",circleData.cx),circleElement.attr("cy",circleData.cy),circleElement.attr("class","actor-"+circleData.pos),circleElement.attr("fill",circleData.fill),circleElement.attr("stroke",circleData.stroke),circleElement.attr("r",circleData.r),void 0!==circleElement.class&&circleElement.attr("class",circleElement.class),void 0!==circleData.title&&circleElement.append("title").text(circleData.title),circleElement},"drawCircle"),drawText=__name(function(elem,textData){const nText=textData.text.replace(/<br\s*\/?>/gi," "),textElem=elem.append("text");textElem.attr("x",textData.x),textElem.attr("y",textData.y),textElem.attr("class","legend"),textElem.style("text-anchor",textData.anchor),void 0!==textData.class&&textElem.attr("class",textData.class);const span=textElem.append("tspan");return span.attr("x",textData.x+2*textData.textMargin),span.text(nText),textElem},"drawText"),drawLabel=__name(function(elem,txtObject){function genPoints(x,y,width,height,cut){return x+","+y+" "+(x+width)+","+y+" "+(x+width)+","+(y+height-cut)+" "+(x+width-1.2*cut)+","+(y+height)+" "+x+","+(y+height)}__name(genPoints,"genPoints");const polygon=elem.append("polygon");polygon.attr("points",genPoints(txtObject.x,txtObject.y,50,20,7)),polygon.attr("class","labelBox"),txtObject.y=txtObject.y+txtObject.labelMargin,txtObject.x=txtObject.x+.5*txtObject.labelMargin,drawText(elem,txtObject)},"drawLabel"),drawSection=__name(function(elem,section,conf){const g=elem.append("g"),rect=getNoteRect();rect.x=section.x,rect.y=section.y,rect.fill=section.fill,rect.width=conf.width,rect.height=conf.height,rect.class="journey-section section-type-"+section.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(section.text,g,rect.x,rect.y,rect.width,rect.height,{class:"journey-section section-type-"+section.num},conf,section.colour)},"drawSection"),taskCount=-1,drawTask=__name(function(elem,task,conf,diagramId){const center=task.x+conf.width/2,g=elem.append("g");taskCount++;g.append("line").attr("id",diagramId+"-task"+taskCount).attr("x1",center).attr("y1",task.y).attr("x2",center).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),drawFace(g,{cx:center,cy:300+30*(5-task.score),score:task.score});const rect=getNoteRect();rect.x=task.x,rect.y=task.y,rect.fill=task.fill,rect.width=conf.width,rect.height=conf.height,rect.class="task task-type-"+task.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(task.task,g,rect.x,rect.y,rect.width,rect.height,{class:"task"},conf,task.colour)},"drawTask"),drawBackgroundRect=__name(function(elem,bounds){drawRect(elem,{x:bounds.startx,y:bounds.starty,width:bounds.stopx-bounds.startx,height:bounds.stopy-bounds.starty,fill:bounds.fill,class:"rect"}).lower()},"drawBackgroundRect"),getTextObj=__name(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),getNoteRect=__name(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),_drawTextCandidateFunc=function(){function byText(content,g,x,y,width,height,textAttrs,colour){_setTextAttrs(g.append("text").attr("x",x+width/2).attr("y",y+height/2+5).style("font-color",colour).style("text-anchor","middle").text(content),textAttrs)}function byTspan(content,g,x,y,width,height,textAttrs,conf,colour){const{taskFontSize:taskFontSize,taskFontFamily:taskFontFamily}=conf,lines=content.split(/<br\s*\/?>/gi);for(let i=0;i<lines.length;i++){const dy=i*taskFontSize-taskFontSize*(lines.length-1)/2,text=g.append("text").attr("x",x+width/2).attr("y",y).attr("fill",colour).style("text-anchor","middle").style("font-size",taskFontSize).style("font-family",taskFontFamily);text.append("tspan").attr("x",x+width/2).attr("dy",dy).text(lines[i]),text.attr("y",y+height/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),_setTextAttrs(text,textAttrs)}}function byFo(content,g,x,y,width,height,textAttrs,conf){const body=g.append("switch"),text=body.append("foreignObject").attr("x",x).attr("y",y).attr("width",width).attr("height",height).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");text.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(content),byTspan(content,body,x,y,width,height,textAttrs,conf),_setTextAttrs(text,textAttrs)}function _setTextAttrs(toText,fromTextAttrsDict){for(const key in fromTextAttrsDict)key in fromTextAttrsDict&&toText.attr(key,fromTextAttrsDict[key])}return __name(byText,"byText"),__name(byTspan,"byTspan"),__name(byFo,"byFo"),__name(_setTextAttrs,"_setTextAttrs"),function(conf){return"fo"===conf.textPlacement?byFo:"old"===conf.textPlacement?byText:byTspan}}(),initGraphics=__name(function(graphics,id){nodeCount=0,taskCount=-1,graphics.append("defs").append("marker").attr("id",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")},"initGraphics");function wrap(text,width){text.each(function(){var word,text2=select(this),words=text2.text().split(/(\s+|<br>)/).reverse(),line=[],y=text2.attr("y"),dy=parseFloat(text2.attr("dy")),tspan=text2.text(null).append("tspan").attr("x",0).attr("y",y).attr("dy",dy+"em");for(let j=0;j<words.length;j++)word=words[words.length-1-j],line.push(word),tspan.text(line.join(" ").trim()),(tspan.node().getComputedTextLength()>width||"<br>"===word)&&(line.pop(),tspan.text(line.join(" ").trim()),line="<br>"===word?[""]:[word],tspan=text2.append("tspan").attr("x",0).attr("y",y).attr("dy","1.1em").text(word))})}__name(wrap,"wrap");var drawNode=__name(function(elem,node,fullSection,conf,diagramId,isEvent=!1){var _a,_b,_c;const{theme:theme,look:look}=conf,isReduxTheme=null==theme?void 0:theme.includes("redux"),section=fullSection%((null==(_a=null==conf?void 0:conf.themeVariables)?void 0:_a.THEME_COLOR_LIMIT)??12)-1,nodeElem=elem.append("g");node.section=section,nodeElem.attr("class",(node.class?node.class+" ":"")+"timeline-node section-"+section);const bkgElem=nodeElem.append("g"),textElem=nodeElem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_b=conf.fontSize)?void 0:_b.replace)?conf.fontSize.replace("px",""):conf.fontSize;if(node.height=bbox.height+1.1*fontSize*.5+node.padding,node.height=Math.max(node.height,node.maxHeight),node.width=node.width+2*node.padding,textElem.attr("transform","translate("+node.width/2+", "+node.padding/2+")"),isReduxTheme&&textElem.attr("transform",`translate(${node.width/2}, ${isEvent?node.padding/2+3:node.padding})`),defaultBkg(bkgElem,node,section,diagramId,conf),"neo"===look&&(nodeElem.attr("data-look","neo"),isReduxTheme)){const isDark2=theme.includes("dark"),rootSvgNode=(null==(_c=elem.node())?void 0:_c.ownerSVGElement)??elem.node(),rootSvg=select(rootSvgNode),svgId=rootSvg.attr("id")??"",dropShadowId=svgId?`${svgId}-drop-shadow`:"drop-shadow";if(rootSvg.select(`#${dropShadowId}`).empty()){const existingDefs=rootSvg.select("defs");(existingDefs.empty()?rootSvg.append("defs"):existingDefs).append("filter").attr("id",dropShadowId).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",isDark2?"0.2":"0.06").attr("flood-color",isDark2?"#FFFFFF":"#000000")}}return node},"drawNode"),getVirtualNodeHeight=__name(function(elem,node,conf){var _a;const textElem=elem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_a=conf.fontSize)?void 0:_a.replace)?conf.fontSize.replace("px",""):conf.fontSize;return textElem.remove(),bbox.height+1.1*fontSize*.5+node.padding},"getVirtualNodeHeight"),defaultBkg=__name(function(elem,node,section,diagramId,config){const{theme:theme}=config,r=(null==theme?void 0:theme.includes("redux"))?0:5,d=r>0?`M0 ${node.height-5} v${10-node.height} q0,-${r},${r},-${r} h${node.width-10} q${r},0,${r},${r} v${node.height-5} H0 Z`:`M0 ${node.height-5} v${-(node.height-5)} h${node.width} v${node.height} H0 Z`;elem.append("path").attr("id",diagramId+"-node-"+nodeCount++).attr("class","node-bkg node-"+node.type).attr("d",d),(null==theme?void 0:theme.includes("redux"))||elem.append("line").attr("class","node-line-"+section).attr("x1",0).attr("y1",node.height).attr("x2",node.width).attr("y2",node.height)},"defaultBkg"),svgDraw_default={drawRect:drawRect,drawCircle:drawCircle,drawSection:drawSection,drawText:drawText,drawLabel:drawLabel,drawTask:drawTask,drawBackgroundRect:drawBackgroundRect,getTextObj:getTextObj,getNoteRect:getNoteRect,initGraphics:initGraphics,drawNode:drawNode,getVirtualNodeHeight:getVirtualNodeHeight},draw=__name(function(text,id,version,diagObj){var _a,_b,_c;const conf=getConfig2(),{look:look,theme:theme,themeVariables:themeVariables}=conf,{useGradient:useGradient,gradientStart:gradientStart,gradientStop:gradientStop}=themeVariables,LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const securityLevel=conf.securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const svg=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body").select("#"+id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg,id);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0,depthY=0,sectionBeginY=0,masterX=50+LEFT_MARGIN,masterY=50;sectionBeginY=50;let sectionNumber=0,hasSections=!0;sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:150,padding:20,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight+20)});let maxEventCount=0,maxEventLineLength=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:150,padding:20,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight+20),maxEventCount=Math.max(maxEventCount,task.events.length);let maxEventLineLengthTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:150,padding:20,maxHeight:50};maxEventLineLengthTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventLineLengthTemp+=10*(task.events.length-1)),maxEventLineLength=Math.max(maxEventLineLength,maxEventLineLengthTemp)}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight),sections2&&sections2.length>0?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:200*Math.max(tasksForSection.length,1)-50,padding:20,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf,id);log.debug("sectionNode output",node),sectionNodeWrapper.attr("transform",`translate(${masterX}, 50)`),masterY+=maxSectionHeight+50,tasksForSection.length>0&&drawTasks(svg,tasksForSection,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!1,id),masterX+=200*Math.max(tasksForSection.length,1),masterY=50,sectionNumber++}):(hasSections=!1,drawTasks(svg,tasks2,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!0,id));const box=svg.node().getBBox();log.debug("bounds",box),title&&svg.append("text").text(title).attr("x","neo"===look?2*box.x+LEFT_MARGIN:box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),depthY=hasSections?maxSectionHeight+maxTaskHeight+150:maxTaskHeight+100;if(svg.append("g").attr("class","lineWrapper").append("line").attr("x1",LEFT_MARGIN).attr("y1",depthY).attr("x2",box.width+3*LEFT_MARGIN).attr("y2",depthY).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${id}-arrowhead)`),"neo"===look&&useGradient&&"neutral"!==theme){const existingDefs=svg.select("defs"),gradient=(existingDefs.empty()?svg.append("defs"):existingDefs).append("linearGradient").attr("id",svg.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");gradient.append("stop").attr("offset","0%").attr("stop-color",gradientStart).attr("stop-opacity",1),gradient.append("stop").attr("offset","100%").attr("stop-color",gradientStop).attr("stop-opacity",1)}setupGraphViewbox(void 0,svg,(null==(_b=conf.timeline)?void 0:_b.padding)??50,(null==(_c=conf.timeline)?void 0:_c.useMaxWidth)??!1)},"draw"),drawTasks=__name(function(diagram2,tasks2,sectionColor,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,isWithoutSections,diagramId){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),taskHeight=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf,diagramId).height;if(log.debug("taskHeight after draw",taskHeight),taskWrapper.attr("transform",`translate(${masterX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events){const lineWrapper=diagram2.append("g").attr("class","lineWrapper");let lineLength=maxTaskHeight;masterY+=100,lineLength+=drawEvents(diagram2,task.events,sectionColor,masterX,masterY,conf,diagramId),masterY-=100,lineWrapper.append("line").attr("x1",masterX+95).attr("y1",masterY+maxTaskHeight).attr("x2",masterX+95).attr("y2",masterY+maxTaskHeight+100+maxEventLineLength+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${diagramId}-arrowhead)`).attr("stroke-dasharray","5,5")}masterX+=200,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}masterY-=10},"drawTasks"),drawEvents=__name(function(diagram2,events,sectionColor,masterX,masterY,conf,diagramId){let maxEventHeight=0;const eventBeginY=masterY;masterY+=100;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:50};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf,diagramId,!0).height;maxEventHeight+=eventHeight,eventWrapper.attr("transform",`translate(${masterX}, ${masterY})`),masterY=masterY+10+eventHeight}return masterY=eventBeginY,maxEventHeight},"drawEvents"),timelineRenderer_default={setConf:__name(()=>{},"setConf"),draw:draw},draw2=__name(function(text,id,version,diagObj){var _a,_b,_c,_d,_e;const conf=getConfig2(),LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const svg=selectSvgElement(id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0;const masterX=50+LEFT_MARGIN;let masterY=50;const contentTopY=masterY,axisX=masterX+230;let sectionNumber=0;const hasSections=sections2&&sections2.length>0,timelineX=hasSections?axisX:masterX+230,sectionWidth=Math.max(50,580);sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight)});let maxEventStackHeight=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:200,padding:5,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight);let maxEventStackHeightTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:300,padding:5,maxHeight:50};maxEventStackHeightTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventStackHeightTemp+=10*(task.events.length-1)),maxEventStackHeight=Math.max(maxEventStackHeight,maxEventStackHeightTemp)+0}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight);const taskSpacing=Math.max(maxTaskHeight,maxEventStackHeight)+30;hasSections?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf);log.debug("sectionNode output",node);const sectionX=timelineX-230;sectionNodeWrapper.attr("transform",`translate(${sectionX}, ${masterY})`);const taskStartY=masterY+node.height+20;tasksForSection.length>0&&drawTasks2(svg,tasksForSection,sectionNumber,timelineX,taskStartY,maxTaskHeight,conf,taskSpacing,!1);const taskCount2=tasksForSection.length,sectionHeight=node.height+20+taskSpacing*Math.max(taskCount2,1)-(taskCount2>0?60:0);masterY+=sectionHeight,sectionNumber++}):drawTasks2(svg,tasks2,sectionNumber,timelineX,masterY,maxTaskHeight,conf,taskSpacing,!0);let box=null==(_b=svg.node())?void 0:_b.getBBox();if(!box)throw new Error("bbox not found");if(log.debug("bounds",box),title){if(svg.append("text").text(title).attr("x",box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),box=null==(_c=svg.node())?void 0:_c.getBBox(),!box)throw new Error("bbox not found");log.debug("bounds after title",box)}const[fontSize]=parseFontSize(conf.fontSize),arrowTopOffset=2*(fontSize??16),arrowBottomPadding=.5*(fontSize??16)+20,lineWrapper=svg.append("g").attr("class","lineWrapper");lineWrapper.append("line").attr("x1",timelineX).attr("y1",contentTopY-arrowTopOffset).attr("x2",timelineX).attr("y2",box.y+box.height+arrowBottomPadding).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),lineWrapper.lower(),setupGraphViewbox(void 0,svg,(null==(_d=conf.timeline)?void 0:_d.padding)??50,(null==(_e=conf.timeline)?void 0:_e.useMaxWidth)??!1)},"draw"),drawTasks2=__name(function(diagram2,tasks2,sectionColor,timelineX,masterY,maxTaskHeight,conf,taskSpacing,isWithoutSections){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:200,padding:5,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),node=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf),taskHeight=node.height;log.debug("taskHeight after draw",taskHeight);const taskX=timelineX-20-node.width;if(taskWrapper.attr("transform",`translate(${taskX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events&&task.events.length>0){const eventsStartY=masterY,eventsX=timelineX+50;drawEvents2(diagram2,task.events,sectionColor,timelineX,eventsX,eventsStartY,conf)}masterY+=taskSpacing,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}},"drawTasks"),drawEvents2=__name(function(diagram2,events,sectionColor,axisX,eventsX,startY,conf){let currentY=startY;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:300,padding:5,maxHeight:0};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf).height;eventWrapper.attr("transform",`translate(${eventsX}, ${currentY})`);const lineY=currentY+eventHeight/2;diagram2.append("g").attr("class","lineWrapper").append("line").attr("x1",axisX).attr("y1",lineY).attr("x2",eventsX).attr("y2",lineY).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),currentY=currentY+eventHeight+10}return currentY-startY},"drawEvents"),timelineRendererVertical_default={setConf:__name(()=>{},"setConf"),draw:draw2},genReduxSections=__name(options=>{var _a;const{theme:theme}=getConfig(),isDarkTheme=null==theme?void 0:theme.includes("dark"),isColorTheme=null==theme?void 0:theme.includes("color"),rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"",scopedDropShadow=rawSvgId?`url(#${rawSvgId}-drop-shadow)`:options.dropShadow??"none";let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i),color=isColorTheme?options.borderColorArray[i]:options.mainBkg,stroke=isColorTheme?options.borderColorArray[i]:options.nodeBorder;sections2+=`\n .section-${i-1} rect,\n .section-${i-1} path,\n .section-${i-1} circle {\n fill: ${isDarkTheme&&isColorTheme?options.mainBkg:color};\n stroke: ${stroke};\n stroke-width: ${options.strokeWidth};\n filter: ${scopedDropShadow};\n }\n\n .section-${i-1} text {\n fill: ${options.nodeBorder};\n font-weight: ${options.fontWeight}\n }\n\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n\n .section-edge-${i-1} {\n stroke: ${options["cScale"+i]};\n }\n\n .edge-depth-${i-1} {\n stroke-width: ${sw};\n }\n\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${options.nodeBorder};\n stroke-width:${options.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genReduxSections"),genSections=__name(options=>{let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)options["lineColor"+i]=options["lineColor"+i]||options["cScaleInv"+i],isDark(options["lineColor"+i])?options["lineColor"+i]=lighten(options["lineColor"+i],20):options["lineColor"+i]=darken(options["lineColor"+i],20);for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i);sections2+=`\n .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} path {\n fill: ${options["cScale"+i]};\n }\n .section-${i-1} text {\n fill: ${options["cScaleLabel"+i]};\n }\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n .section-edge-${i-1}{\n stroke: ${options["cScale"+i]};\n }\n .edge-depth-${i-1}{\n stroke-width: ${sw};\n }\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${options["cScaleLabel"+i]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genSections"),styles_default=__name(options=>{var _a;const{theme:theme}=getConfig(),isReduxTheme=null==theme?void 0:theme.includes("redux"),isNeutralTheme="neutral"===theme,rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"";let gradientSections="";if(options.useGradient&&rawSvgId&&options.THEME_COLOR_LIMIT&&!isNeutralTheme)for(let i=0;i<options.THEME_COLOR_LIMIT;i++)gradientSections+=`\n .section-${i-1}[data-look="neo"] rect,\n .section-${i-1}[data-look="neo"] path,\n .section-${i-1}[data-look="neo"] circle {\n fill: ${options.mainBkg};\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }\n .section-${i-1}[data-look="neo"] line {\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${isReduxTheme?genReduxSections(options):genSections(options)}\n ${gradientSections}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${options.git0};\n }\n .section-root text {\n fill: ${options.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),diagram={db:timelineDb_exports,renderer:{setConf:__name(()=>{},"setConf"),draw:__name((text,id,version,diagObj)=>{var _a,_b;return"TD"===((null==(_b=null==(_a=null==diagObj?void 0:diagObj.db)?void 0:_a.getDirection)?void 0:_b.call(_a))??"LR")?timelineRendererVertical_default.draw(text,id,version,diagObj):timelineRenderer_default.draw(text,id,version,diagObj)},"draw")},parser:timeline_default,styles:styles_default};export{diagram};
1
+ import{_ as __name,y as getConfig,S as isDark,T as lighten,U as darken,c as getConfig2,l as log,D as selectSvgElement,K as parseFontSize,V as setupGraphViewbox,d as select,t as __export,W as commonDb_exports,p as clear}from"./mermaid.core-DH-sQJgr.js";import{d as d3arc}from"./arc-Cshrl52z.js";import"./vendor-mdxeditor-DT0rad22.js";import"./vendor-antd-DNUTLr77.js";import"./vendor-codemirror-6ck0hLRU.js";import"./vendor-markdown-DBlfs4dR.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,11,13,14,15,17,19,20,23,24],$V1=[1,12],$V2=[1,13],$V3=[1,14],$V4=[1,15],$V5=[1,16],$V6=[1,19],$V7=[1,20],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:return $$[$0-1];case 3:yy.setDirection("LR");break;case 4:yy.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 7:case 8:this.$=$$[$0];break;case 11:yy.getCommonDb().setDiagramTitle($$[$0].substr(6)),this.$=$$[$0].substr(6);break;case 12:this.$=$$[$0].trim(),yy.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=$$[$0].trim(),yy.getCommonDb().setAccDescription(this.$);break;case 15:yy.addSection($$[$0].substr(8)),this.$=$$[$0].substr(8);break;case 18:yy.addTask($$[$0],0,""),this.$=$$[$0];break;case 19:yy.addEvent($$[$0].substr(2)),this.$=$$[$0]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},o($V0,[2,5],{5:6}),o($V0,[2,2]),o($V0,[2,3]),o($V0,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,10],{1:[2,1]}),o($V0,[2,6]),{12:21,14:$V1,15:$V2,17:$V3,19:$V4,20:$V5,21:17,22:18,23:$V6,24:$V7},o($V0,[2,8]),o($V0,[2,9]),o($V0,[2,11]),{16:[1,22]},{18:[1,23]},o($V0,[2,14]),o($V0,[2,15]),o($V0,[2,16]),o($V0,[2,17]),o($V0,[2,18]),o($V0,[2,19]),o($V0,[2,7]),o($V0,[2,12]),o($V0,[2,13])],defaultActions:{},parseError:__name(function(str,hash){if(!hash.recoverable){var error=new Error(str);throw error.hash=hash,error}this.trace(str)},"parseError"),parse:__name(function(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,args=lstack.slice.call(arguments,1),lexer2=Object.create(this.lexer),sharedState={yy:{}};for(var k in this.yy)Object.prototype.hasOwnProperty.call(this.yy,k)&&(sharedState.yy[k]=this.yy[k]);lexer2.setInput(input,sharedState.yy),sharedState.yy.lexer=lexer2,sharedState.yy.parser=this,void 0===lexer2.yylloc&&(lexer2.yylloc={});var yyloc=lexer2.yylloc;lstack.push(yyloc);var ranges=lexer2.options&&lexer2.options.ranges;function lex(){var token;return"number"!=typeof(token=tstack.pop()||lexer2.lex()||1)&&(token instanceof Array&&(token=(tstack=token).pop()),token=self.symbols_[token]||token),token}"function"==typeof sharedState.yy.parseError?this.parseError=sharedState.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,__name(function(n){stack.length=stack.length-2*n,vstack.length=vstack.length-n,lstack.length=lstack.length-n},"popStack"),__name(lex,"lex");for(var symbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:(null==symbol&&(symbol=lex()),action=table[state]&&table[state][symbol]),void 0===action||!action.length||!action[0]){var errStr="";for(p in expected=[],table[state])this.terminals_[p]&&p>2&&expected.push("'"+this.terminals_[p]+"'");errStr=lexer2.showPosition?"Parse error on line "+(yylineno+1)+":\n"+lexer2.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:lexer2.match,token:this.terminals_[symbol]||symbol,line:lexer2.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(lexer2.yytext),lstack.push(lexer2.yylloc),stack.push(action[1]),symbol=null,yyleng=lexer2.yyleng,yytext=lexer2.yytext,yylineno=lexer2.yylineno,yyloc=lexer2.yylloc;break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args))))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0},"parse")},lexer=function(){return{EOF:1,parseError:__name(function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},"parseError"),setInput:__name(function(input,yy){return this.yy=yy||this.yy||{},this._input=input,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:__name(function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},"input"),unput:__name(function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len),this.offset-=len;var oldLines=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),lines.length-1&&(this.yylineno-=lines.length-1);var r=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:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},"unput"),more:__name(function(){return this._more=!0,this},"more"),reject:__name(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:__name(function(n){this.unput(this.match.slice(n))},"less"),pastInput:__name(function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:__name(function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:__name(function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},"showPosition"),test_match:__name(function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={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&&(backup.yylloc.range=this.yylloc.range.slice(0))),(lines=match[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,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(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},"test_match"),next:__name(function(){if(this.done)return this.EOF;var token,match,tempMatch,index;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;i<rules.length;i++)if((tempMatch=this._input.match(this.rules[rules[i]]))&&(!match||tempMatch[0].length>match[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:__name(function(){var r=this.next();return r||this.lex()},"lex"),begin:__name(function(condition){this.conditionStack.push(condition)},"begin"),popState:__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:__name(function(n){return(n=this.conditionStack.length-1-Math.abs(n||0))>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:__name(function(condition){this.begin(condition)},"pushState"),stateStackSize:__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:__name(function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/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]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function Parser(){this.yy={}}return parser2.lexer=lexer,__name(Parser,"Parser"),Parser.prototype=parser2,parser2.Parser=Parser,new Parser}();parser.parser=parser;var timeline_default=parser,timelineDb_exports={};__export(timelineDb_exports,{addEvent:()=>addEvent,addSection:()=>addSection,addTask:()=>addTask,addTaskOrg:()=>addTaskOrg,clear:()=>clear2,default:()=>timelineDb_default,getCommonDb:()=>getCommonDb,getDirection:()=>getDirection,getSections:()=>getSections,getTasks:()=>getTasks,setDirection:()=>setDirection});var currentSection="",currentTaskId=0,direction="LR",sections=[],tasks=[],rawTasks=[],getCommonDb=__name(()=>commonDb_exports,"getCommonDb"),clear2=__name(function(){sections.length=0,tasks.length=0,currentSection="",rawTasks.length=0,direction="LR",clear()},"clear"),setDirection=__name(function(dir){direction=dir},"setDirection"),getDirection=__name(function(){return direction},"getDirection"),addSection=__name(function(txt){currentSection=txt,sections.push(txt)},"addSection"),getSections=__name(function(){return sections},"getSections"),getTasks=__name(function(){let allItemsProcessed=compileTasks();let iterationCount=0;for(;!allItemsProcessed&&iterationCount<100;)allItemsProcessed=compileTasks(),iterationCount++;return tasks.push(...rawTasks),tasks},"getTasks"),addTask=__name(function(period,length,event){const rawTask={id:currentTaskId++,section:currentSection,type:currentSection,task:period,score:length||0,events:event?[event]:[]};rawTasks.push(rawTask)},"addTask"),addEvent=__name(function(event){rawTasks.find(task=>task.id===currentTaskId-1).events.push(event)},"addEvent"),addTaskOrg=__name(function(descr){const newTask={section:currentSection,type:currentSection,description:descr,task:descr,classes:[]};tasks.push(newTask)},"addTaskOrg"),compileTasks=__name(function(){const compileTask=__name(function(pos){return rawTasks[pos].processed},"compileTask");let allProcessed=!0;for(const[i,rawTask]of rawTasks.entries())compileTask(i),allProcessed=allProcessed&&rawTask.processed;return allProcessed},"compileTasks"),timelineDb_default={clear:clear2,getCommonDb:getCommonDb,getDirection:getDirection,setDirection:setDirection,addSection:addSection,getSections:getSections,getTasks:getTasks,addTask:addTask,addTaskOrg:addTaskOrg,addEvent:addEvent},nodeCount=0,drawRect=__name(function(elem,rectData){const rectElem=elem.append("rect");return rectElem.attr("x",rectData.x),rectElem.attr("y",rectData.y),rectElem.attr("fill",rectData.fill),rectElem.attr("stroke",rectData.stroke),rectElem.attr("width",rectData.width),rectElem.attr("height",rectData.height),rectElem.attr("rx",rectData.rx),rectElem.attr("ry",rectData.ry),void 0!==rectData.class&&rectElem.attr("class",rectData.class),rectElem},"drawRect"),drawFace=__name(function(element,faceData){const circleElement=element.append("circle").attr("cx",faceData.cx).attr("cy",faceData.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),face=element.append("g");function smile(face2){const arc=d3arc().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+2)+")")}function sad(face2){const arc=d3arc().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);face2.append("path").attr("class","mouth").attr("d",arc).attr("transform","translate("+faceData.cx+","+(faceData.cy+7)+")")}function ambivalent(face2){face2.append("line").attr("class","mouth").attr("stroke",2).attr("x1",faceData.cx-5).attr("y1",faceData.cy+7).attr("x2",faceData.cx+5).attr("y2",faceData.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return face.append("circle").attr("cx",faceData.cx-5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),face.append("circle").attr("cx",faceData.cx+5).attr("cy",faceData.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),__name(smile,"smile"),__name(sad,"sad"),__name(ambivalent,"ambivalent"),faceData.score>3?smile(face):faceData.score<3?sad(face):ambivalent(face),circleElement},"drawFace"),drawCircle=__name(function(element,circleData){const circleElement=element.append("circle");return circleElement.attr("cx",circleData.cx),circleElement.attr("cy",circleData.cy),circleElement.attr("class","actor-"+circleData.pos),circleElement.attr("fill",circleData.fill),circleElement.attr("stroke",circleData.stroke),circleElement.attr("r",circleData.r),void 0!==circleElement.class&&circleElement.attr("class",circleElement.class),void 0!==circleData.title&&circleElement.append("title").text(circleData.title),circleElement},"drawCircle"),drawText=__name(function(elem,textData){const nText=textData.text.replace(/<br\s*\/?>/gi," "),textElem=elem.append("text");textElem.attr("x",textData.x),textElem.attr("y",textData.y),textElem.attr("class","legend"),textElem.style("text-anchor",textData.anchor),void 0!==textData.class&&textElem.attr("class",textData.class);const span=textElem.append("tspan");return span.attr("x",textData.x+2*textData.textMargin),span.text(nText),textElem},"drawText"),drawLabel=__name(function(elem,txtObject){function genPoints(x,y,width,height,cut){return x+","+y+" "+(x+width)+","+y+" "+(x+width)+","+(y+height-cut)+" "+(x+width-1.2*cut)+","+(y+height)+" "+x+","+(y+height)}__name(genPoints,"genPoints");const polygon=elem.append("polygon");polygon.attr("points",genPoints(txtObject.x,txtObject.y,50,20,7)),polygon.attr("class","labelBox"),txtObject.y=txtObject.y+txtObject.labelMargin,txtObject.x=txtObject.x+.5*txtObject.labelMargin,drawText(elem,txtObject)},"drawLabel"),drawSection=__name(function(elem,section,conf){const g=elem.append("g"),rect=getNoteRect();rect.x=section.x,rect.y=section.y,rect.fill=section.fill,rect.width=conf.width,rect.height=conf.height,rect.class="journey-section section-type-"+section.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(section.text,g,rect.x,rect.y,rect.width,rect.height,{class:"journey-section section-type-"+section.num},conf,section.colour)},"drawSection"),taskCount=-1,drawTask=__name(function(elem,task,conf,diagramId){const center=task.x+conf.width/2,g=elem.append("g");taskCount++;g.append("line").attr("id",diagramId+"-task"+taskCount).attr("x1",center).attr("y1",task.y).attr("x2",center).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),drawFace(g,{cx:center,cy:300+30*(5-task.score),score:task.score});const rect=getNoteRect();rect.x=task.x,rect.y=task.y,rect.fill=task.fill,rect.width=conf.width,rect.height=conf.height,rect.class="task task-type-"+task.num,rect.rx=3,rect.ry=3,drawRect(g,rect),_drawTextCandidateFunc(conf)(task.task,g,rect.x,rect.y,rect.width,rect.height,{class:"task"},conf,task.colour)},"drawTask"),drawBackgroundRect=__name(function(elem,bounds){drawRect(elem,{x:bounds.startx,y:bounds.starty,width:bounds.stopx-bounds.startx,height:bounds.stopy-bounds.starty,fill:bounds.fill,class:"rect"}).lower()},"drawBackgroundRect"),getTextObj=__name(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),getNoteRect=__name(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),_drawTextCandidateFunc=function(){function byText(content,g,x,y,width,height,textAttrs,colour){_setTextAttrs(g.append("text").attr("x",x+width/2).attr("y",y+height/2+5).style("font-color",colour).style("text-anchor","middle").text(content),textAttrs)}function byTspan(content,g,x,y,width,height,textAttrs,conf,colour){const{taskFontSize:taskFontSize,taskFontFamily:taskFontFamily}=conf,lines=content.split(/<br\s*\/?>/gi);for(let i=0;i<lines.length;i++){const dy=i*taskFontSize-taskFontSize*(lines.length-1)/2,text=g.append("text").attr("x",x+width/2).attr("y",y).attr("fill",colour).style("text-anchor","middle").style("font-size",taskFontSize).style("font-family",taskFontFamily);text.append("tspan").attr("x",x+width/2).attr("dy",dy).text(lines[i]),text.attr("y",y+height/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),_setTextAttrs(text,textAttrs)}}function byFo(content,g,x,y,width,height,textAttrs,conf){const body=g.append("switch"),text=body.append("foreignObject").attr("x",x).attr("y",y).attr("width",width).attr("height",height).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");text.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(content),byTspan(content,body,x,y,width,height,textAttrs,conf),_setTextAttrs(text,textAttrs)}function _setTextAttrs(toText,fromTextAttrsDict){for(const key in fromTextAttrsDict)key in fromTextAttrsDict&&toText.attr(key,fromTextAttrsDict[key])}return __name(byText,"byText"),__name(byTspan,"byTspan"),__name(byFo,"byFo"),__name(_setTextAttrs,"_setTextAttrs"),function(conf){return"fo"===conf.textPlacement?byFo:"old"===conf.textPlacement?byText:byTspan}}(),initGraphics=__name(function(graphics,id){nodeCount=0,taskCount=-1,graphics.append("defs").append("marker").attr("id",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")},"initGraphics");function wrap(text,width){text.each(function(){var word,text2=select(this),words=text2.text().split(/(\s+|<br>)/).reverse(),line=[],y=text2.attr("y"),dy=parseFloat(text2.attr("dy")),tspan=text2.text(null).append("tspan").attr("x",0).attr("y",y).attr("dy",dy+"em");for(let j=0;j<words.length;j++)word=words[words.length-1-j],line.push(word),tspan.text(line.join(" ").trim()),(tspan.node().getComputedTextLength()>width||"<br>"===word)&&(line.pop(),tspan.text(line.join(" ").trim()),line="<br>"===word?[""]:[word],tspan=text2.append("tspan").attr("x",0).attr("y",y).attr("dy","1.1em").text(word))})}__name(wrap,"wrap");var drawNode=__name(function(elem,node,fullSection,conf,diagramId,isEvent=!1){var _a,_b,_c;const{theme:theme,look:look}=conf,isReduxTheme=null==theme?void 0:theme.includes("redux"),section=fullSection%((null==(_a=null==conf?void 0:conf.themeVariables)?void 0:_a.THEME_COLOR_LIMIT)??12)-1,nodeElem=elem.append("g");node.section=section,nodeElem.attr("class",(node.class?node.class+" ":"")+"timeline-node section-"+section);const bkgElem=nodeElem.append("g"),textElem=nodeElem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_b=conf.fontSize)?void 0:_b.replace)?conf.fontSize.replace("px",""):conf.fontSize;if(node.height=bbox.height+1.1*fontSize*.5+node.padding,node.height=Math.max(node.height,node.maxHeight),node.width=node.width+2*node.padding,textElem.attr("transform","translate("+node.width/2+", "+node.padding/2+")"),isReduxTheme&&textElem.attr("transform",`translate(${node.width/2}, ${isEvent?node.padding/2+3:node.padding})`),defaultBkg(bkgElem,node,section,diagramId,conf),"neo"===look&&(nodeElem.attr("data-look","neo"),isReduxTheme)){const isDark2=theme.includes("dark"),rootSvgNode=(null==(_c=elem.node())?void 0:_c.ownerSVGElement)??elem.node(),rootSvg=select(rootSvgNode),svgId=rootSvg.attr("id")??"",dropShadowId=svgId?`${svgId}-drop-shadow`:"drop-shadow";if(rootSvg.select(`#${dropShadowId}`).empty()){const existingDefs=rootSvg.select("defs");(existingDefs.empty()?rootSvg.append("defs"):existingDefs).append("filter").attr("id",dropShadowId).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",isDark2?"0.2":"0.06").attr("flood-color",isDark2?"#FFFFFF":"#000000")}}return node},"drawNode"),getVirtualNodeHeight=__name(function(elem,node,conf){var _a;const textElem=elem.append("g"),bbox=textElem.append("text").text(node.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(wrap,node.width).node().getBBox(),fontSize=(null==(_a=conf.fontSize)?void 0:_a.replace)?conf.fontSize.replace("px",""):conf.fontSize;return textElem.remove(),bbox.height+1.1*fontSize*.5+node.padding},"getVirtualNodeHeight"),defaultBkg=__name(function(elem,node,section,diagramId,config){const{theme:theme}=config,r=(null==theme?void 0:theme.includes("redux"))?0:5,d=r>0?`M0 ${node.height-5} v${10-node.height} q0,-${r},${r},-${r} h${node.width-10} q${r},0,${r},${r} v${node.height-5} H0 Z`:`M0 ${node.height-5} v${-(node.height-5)} h${node.width} v${node.height} H0 Z`;elem.append("path").attr("id",diagramId+"-node-"+nodeCount++).attr("class","node-bkg node-"+node.type).attr("d",d),(null==theme?void 0:theme.includes("redux"))||elem.append("line").attr("class","node-line-"+section).attr("x1",0).attr("y1",node.height).attr("x2",node.width).attr("y2",node.height)},"defaultBkg"),svgDraw_default={drawRect:drawRect,drawCircle:drawCircle,drawSection:drawSection,drawText:drawText,drawLabel:drawLabel,drawTask:drawTask,drawBackgroundRect:drawBackgroundRect,getTextObj:getTextObj,getNoteRect:getNoteRect,initGraphics:initGraphics,drawNode:drawNode,getVirtualNodeHeight:getVirtualNodeHeight},draw=__name(function(text,id,version,diagObj){var _a,_b,_c;const conf=getConfig2(),{look:look,theme:theme,themeVariables:themeVariables}=conf,{useGradient:useGradient,gradientStart:gradientStart,gradientStop:gradientStop}=themeVariables,LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const securityLevel=conf.securityLevel;let sandboxElement;"sandbox"===securityLevel&&(sandboxElement=select("#i"+id));const svg=select("sandbox"===securityLevel?sandboxElement.nodes()[0].contentDocument.body:"body").select("#"+id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg,id);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0,depthY=0,sectionBeginY=0,masterX=50+LEFT_MARGIN,masterY=50;sectionBeginY=50;let sectionNumber=0,hasSections=!0;sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:150,padding:20,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight+20)});let maxEventCount=0,maxEventLineLength=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:150,padding:20,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight+20),maxEventCount=Math.max(maxEventCount,task.events.length);let maxEventLineLengthTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:150,padding:20,maxHeight:50};maxEventLineLengthTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventLineLengthTemp+=10*(task.events.length-1)),maxEventLineLength=Math.max(maxEventLineLength,maxEventLineLengthTemp)}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight),sections2&&sections2.length>0?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:200*Math.max(tasksForSection.length,1)-50,padding:20,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf,id);log.debug("sectionNode output",node),sectionNodeWrapper.attr("transform",`translate(${masterX}, 50)`),masterY+=maxSectionHeight+50,tasksForSection.length>0&&drawTasks(svg,tasksForSection,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!1,id),masterX+=200*Math.max(tasksForSection.length,1),masterY=50,sectionNumber++}):(hasSections=!1,drawTasks(svg,tasks2,sectionNumber,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,!0,id));const box=svg.node().getBBox();log.debug("bounds",box),title&&svg.append("text").text(title).attr("x","neo"===look?2*box.x+LEFT_MARGIN:box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),depthY=hasSections?maxSectionHeight+maxTaskHeight+150:maxTaskHeight+100;if(svg.append("g").attr("class","lineWrapper").append("line").attr("x1",LEFT_MARGIN).attr("y1",depthY).attr("x2",box.width+3*LEFT_MARGIN).attr("y2",depthY).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${id}-arrowhead)`),"neo"===look&&useGradient&&"neutral"!==theme){const existingDefs=svg.select("defs"),gradient=(existingDefs.empty()?svg.append("defs"):existingDefs).append("linearGradient").attr("id",svg.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");gradient.append("stop").attr("offset","0%").attr("stop-color",gradientStart).attr("stop-opacity",1),gradient.append("stop").attr("offset","100%").attr("stop-color",gradientStop).attr("stop-opacity",1)}setupGraphViewbox(void 0,svg,(null==(_b=conf.timeline)?void 0:_b.padding)??50,(null==(_c=conf.timeline)?void 0:_c.useMaxWidth)??!1)},"draw"),drawTasks=__name(function(diagram2,tasks2,sectionColor,masterX,masterY,maxTaskHeight,conf,maxEventCount,maxEventLineLength,maxSectionHeight,isWithoutSections,diagramId){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),taskHeight=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf,diagramId).height;if(log.debug("taskHeight after draw",taskHeight),taskWrapper.attr("transform",`translate(${masterX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events){const lineWrapper=diagram2.append("g").attr("class","lineWrapper");let lineLength=maxTaskHeight;masterY+=100,lineLength+=drawEvents(diagram2,task.events,sectionColor,masterX,masterY,conf,diagramId),masterY-=100,lineWrapper.append("line").attr("x1",masterX+95).attr("y1",masterY+maxTaskHeight).attr("x2",masterX+95).attr("y2",masterY+maxTaskHeight+100+maxEventLineLength+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${diagramId}-arrowhead)`).attr("stroke-dasharray","5,5")}masterX+=200,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}masterY-=10},"drawTasks"),drawEvents=__name(function(diagram2,events,sectionColor,masterX,masterY,conf,diagramId){let maxEventHeight=0;const eventBeginY=masterY;masterY+=100;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:150,padding:20,maxHeight:50};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf,diagramId,!0).height;maxEventHeight+=eventHeight,eventWrapper.attr("transform",`translate(${masterX}, ${masterY})`),masterY=masterY+10+eventHeight}return masterY=eventBeginY,maxEventHeight},"drawEvents"),timelineRenderer_default={setConf:__name(()=>{},"setConf"),draw:draw},draw2=__name(function(text,id,version,diagObj){var _a,_b,_c,_d,_e;const conf=getConfig2(),LEFT_MARGIN=(null==(_a=conf.timeline)?void 0:_a.leftMargin)??50;log.debug("timeline",diagObj.db);const svg=selectSvgElement(id);svg.append("g");const tasks2=diagObj.db.getTasks(),title=diagObj.db.getCommonDb().getDiagramTitle();log.debug("task",tasks2),svgDraw_default.initGraphics(svg);const sections2=diagObj.db.getSections();log.debug("sections",sections2);let maxSectionHeight=0,maxTaskHeight=0;const masterX=50+LEFT_MARGIN;let masterY=50;const contentTopY=masterY,axisX=masterX+230;let sectionNumber=0;const hasSections=sections2&&sections2.length>0,timelineX=hasSections?axisX:masterX+230,sectionWidth=Math.max(50,580);sections2.forEach(function(section){const sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight},sectionHeight=svgDraw_default.getVirtualNodeHeight(svg,sectionNode,conf);log.debug("sectionHeight before draw",sectionHeight),maxSectionHeight=Math.max(maxSectionHeight,sectionHeight)});let maxEventStackHeight=0;log.debug("tasks.length",tasks2.length);for(const[i,task]of tasks2.entries()){const taskNode={number:i,descr:task,section:task.section,width:200,padding:5,maxHeight:maxTaskHeight},taskHeight=svgDraw_default.getVirtualNodeHeight(svg,taskNode,conf);log.debug("taskHeight before draw",taskHeight),maxTaskHeight=Math.max(maxTaskHeight,taskHeight);let maxEventStackHeightTemp=0;for(const event of task.events){const eventNode={descr:event,section:task.section,number:task.section,width:300,padding:5,maxHeight:50};maxEventStackHeightTemp+=svgDraw_default.getVirtualNodeHeight(svg,eventNode,conf)}task.events.length>0&&(maxEventStackHeightTemp+=10*(task.events.length-1)),maxEventStackHeight=Math.max(maxEventStackHeight,maxEventStackHeightTemp)+0}log.debug("maxSectionHeight before draw",maxSectionHeight),log.debug("maxTaskHeight before draw",maxTaskHeight);const taskSpacing=Math.max(maxTaskHeight,maxEventStackHeight)+30;hasSections?sections2.forEach(section=>{const tasksForSection=tasks2.filter(task=>task.section===section),sectionNode={number:sectionNumber,descr:section,section:sectionNumber,width:sectionWidth,padding:5,maxHeight:maxSectionHeight};log.debug("sectionNode",sectionNode);const sectionNodeWrapper=svg.append("g"),node=svgDraw_default.drawNode(sectionNodeWrapper,sectionNode,sectionNumber,conf);log.debug("sectionNode output",node);const sectionX=timelineX-230;sectionNodeWrapper.attr("transform",`translate(${sectionX}, ${masterY})`);const taskStartY=masterY+node.height+20;tasksForSection.length>0&&drawTasks2(svg,tasksForSection,sectionNumber,timelineX,taskStartY,maxTaskHeight,conf,taskSpacing,!1);const taskCount2=tasksForSection.length,sectionHeight=node.height+20+taskSpacing*Math.max(taskCount2,1)-(taskCount2>0?60:0);masterY+=sectionHeight,sectionNumber++}):drawTasks2(svg,tasks2,sectionNumber,timelineX,masterY,maxTaskHeight,conf,taskSpacing,!0);let box=null==(_b=svg.node())?void 0:_b.getBBox();if(!box)throw new Error("bbox not found");if(log.debug("bounds",box),title){if(svg.append("text").text(title).attr("x",box.width/2-LEFT_MARGIN).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),box=null==(_c=svg.node())?void 0:_c.getBBox(),!box)throw new Error("bbox not found");log.debug("bounds after title",box)}const[fontSize]=parseFontSize(conf.fontSize),arrowTopOffset=2*(fontSize??16),arrowBottomPadding=.5*(fontSize??16)+20,lineWrapper=svg.append("g").attr("class","lineWrapper");lineWrapper.append("line").attr("x1",timelineX).attr("y1",contentTopY-arrowTopOffset).attr("x2",timelineX).attr("y2",box.y+box.height+arrowBottomPadding).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),lineWrapper.lower(),setupGraphViewbox(void 0,svg,(null==(_d=conf.timeline)?void 0:_d.padding)??50,(null==(_e=conf.timeline)?void 0:_e.useMaxWidth)??!1)},"draw"),drawTasks2=__name(function(diagram2,tasks2,sectionColor,timelineX,masterY,maxTaskHeight,conf,taskSpacing,isWithoutSections){var _a;for(const task of tasks2){const taskNode={descr:task.task,section:sectionColor,number:sectionColor,width:200,padding:5,maxHeight:maxTaskHeight};log.debug("taskNode",taskNode);const taskWrapper=diagram2.append("g").attr("class","taskWrapper"),node=svgDraw_default.drawNode(taskWrapper,taskNode,sectionColor,conf),taskHeight=node.height;log.debug("taskHeight after draw",taskHeight);const taskX=timelineX-20-node.width;if(taskWrapper.attr("transform",`translate(${taskX}, ${masterY})`),maxTaskHeight=Math.max(maxTaskHeight,taskHeight),task.events&&task.events.length>0){const eventsStartY=masterY,eventsX=timelineX+50;drawEvents2(diagram2,task.events,sectionColor,timelineX,eventsX,eventsStartY,conf)}masterY+=taskSpacing,isWithoutSections&&!(null==(_a=conf.timeline)?void 0:_a.disableMulticolor)&&sectionColor++}},"drawTasks"),drawEvents2=__name(function(diagram2,events,sectionColor,axisX,eventsX,startY,conf){let currentY=startY;for(const event of events){const eventNode={descr:event,section:sectionColor,number:sectionColor,width:300,padding:5,maxHeight:0};log.debug("eventNode",eventNode);const eventWrapper=diagram2.append("g").attr("class","eventWrapper"),eventHeight=svgDraw_default.drawNode(eventWrapper,eventNode,sectionColor,conf).height;eventWrapper.attr("transform",`translate(${eventsX}, ${currentY})`);const lineY=currentY+eventHeight/2;diagram2.append("g").attr("class","lineWrapper").append("line").attr("x1",axisX).attr("y1",lineY).attr("x2",eventsX).attr("y2",lineY).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),currentY=currentY+eventHeight+10}return currentY-startY},"drawEvents"),timelineRendererVertical_default={setConf:__name(()=>{},"setConf"),draw:draw2},genReduxSections=__name(options=>{var _a;const{theme:theme}=getConfig(),isDarkTheme=null==theme?void 0:theme.includes("dark"),isColorTheme=null==theme?void 0:theme.includes("color"),rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"",scopedDropShadow=rawSvgId?`url(#${rawSvgId}-drop-shadow)`:options.dropShadow??"none";let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i),color=isColorTheme?options.borderColorArray[i]:options.mainBkg,stroke=isColorTheme?options.borderColorArray[i]:options.nodeBorder;sections2+=`\n .section-${i-1} rect,\n .section-${i-1} path,\n .section-${i-1} circle {\n fill: ${isDarkTheme&&isColorTheme?options.mainBkg:color};\n stroke: ${stroke};\n stroke-width: ${options.strokeWidth};\n filter: ${scopedDropShadow};\n }\n\n .section-${i-1} text {\n fill: ${options.nodeBorder};\n font-weight: ${options.fontWeight}\n }\n\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n\n .section-edge-${i-1} {\n stroke: ${options["cScale"+i]};\n }\n\n .edge-depth-${i-1} {\n stroke-width: ${sw};\n }\n\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${options.nodeBorder};\n stroke-width:${options.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genReduxSections"),genSections=__name(options=>{let sections2="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)options["lineColor"+i]=options["lineColor"+i]||options["cScaleInv"+i],isDark(options["lineColor"+i])?options["lineColor"+i]=lighten(options["lineColor"+i],20):options["lineColor"+i]=darken(options["lineColor"+i],20);for(let i=0;i<options.THEME_COLOR_LIMIT;i++){const sw=""+(17-3*i);sections2+=`\n .section-${i-1} rect, .section-${i-1} path, .section-${i-1} circle, .section-${i-1} path {\n fill: ${options["cScale"+i]};\n }\n .section-${i-1} text {\n fill: ${options["cScaleLabel"+i]};\n }\n .node-icon-${i-1} {\n font-size: 40px;\n color: ${options["cScaleLabel"+i]};\n }\n .section-edge-${i-1}{\n stroke: ${options["cScale"+i]};\n }\n .edge-depth-${i-1}{\n stroke-width: ${sw};\n }\n .section-${i-1} line {\n stroke: ${options["cScaleInv"+i]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${options["cScaleLabel"+i]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${options.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${options.clusterBorder??"#efefef"};\n }\n `}return sections2},"genSections"),styles_default=__name(options=>{var _a;const{theme:theme}=getConfig(),isReduxTheme=null==theme?void 0:theme.includes("redux"),isNeutralTheme="neutral"===theme,rawSvgId=(null==(_a=options.svgId)?void 0:_a.replace(/^#/,""))??"";let gradientSections="";if(options.useGradient&&rawSvgId&&options.THEME_COLOR_LIMIT&&!isNeutralTheme)for(let i=0;i<options.THEME_COLOR_LIMIT;i++)gradientSections+=`\n .section-${i-1}[data-look="neo"] rect,\n .section-${i-1}[data-look="neo"] path,\n .section-${i-1}[data-look="neo"] circle {\n fill: ${options.mainBkg};\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }\n .section-${i-1}[data-look="neo"] line {\n stroke: url(#${rawSvgId}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${isReduxTheme?genReduxSections(options):genSections(options)}\n ${gradientSections}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${options.git0};\n }\n .section-root text {\n fill: ${options.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),diagram={db:timelineDb_exports,renderer:{setConf:__name(()=>{},"setConf"),draw:__name((text,id,version,diagObj)=>{var _a,_b;return"TD"===((null==(_b=null==(_a=null==diagObj?void 0:diagObj.db)?void 0:_a.getDirection)?void 0:_b.call(_a))??"LR")?timelineRendererVertical_default.draw(text,id,version,diagObj):timelineRenderer_default.draw(text,id,version,diagObj)},"draw")},parser:timeline_default,styles:styles_default};export{diagram};