@codragraph/cli 2.1.4 → 2.1.6

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 (109) hide show
  1. package/README.md +36 -7
  2. package/dist/cli/ai-context.js +297 -0
  3. package/dist/cli/analyze.d.ts +9 -4
  4. package/dist/cli/analyze.js +37 -13
  5. package/dist/cli/index.js +40 -14
  6. package/dist/cli/status.d.ts +1 -1
  7. package/dist/cli/status.js +8 -0
  8. package/dist/cli/tool.d.ts +10 -2
  9. package/dist/cli/tool.js +100 -39
  10. package/dist/config/ignore-service.js +1 -0
  11. package/dist/core/adaptive-profile.d.ts +52 -0
  12. package/dist/core/adaptive-profile.js +180 -0
  13. package/dist/core/cgdb/cgdb-adapter.d.ts +34 -5
  14. package/dist/core/cgdb/cgdb-adapter.js +418 -5
  15. package/dist/core/cgdb/pool-adapter.js +130 -20
  16. package/dist/core/ingestion/parsing-processor.js +7 -1
  17. package/dist/core/ingestion/pipeline-phases/parse-impl.js +7 -1
  18. package/dist/core/ingestion/pipeline-phases/structure.js +19 -3
  19. package/dist/core/ingestion/pipeline.d.ts +10 -0
  20. package/dist/core/ingestion/workers/parse-worker.js +1 -1
  21. package/dist/core/ingestion/workers/worker-pool.d.ts +14 -1
  22. package/dist/core/ingestion/workers/worker-pool.js +33 -17
  23. package/dist/core/run-analyze.d.ts +27 -2
  24. package/dist/core/run-analyze.js +626 -32
  25. package/dist/core/search/bm25-index.d.ts +16 -8
  26. package/dist/core/search/bm25-index.js +72 -110
  27. package/dist/mcp/local/local-backend.d.ts +2 -0
  28. package/dist/mcp/local/local-backend.js +241 -21
  29. package/dist/storage/repo-manager.d.ts +29 -0
  30. package/dist/web/assets/__vite-browser-external-BIHI7g3E.js +1 -0
  31. package/dist/web/assets/agent-DcdaQnmu.js +1104 -0
  32. package/dist/web/assets/architectureDiagram-UL44E2DR-DFSpa3Hb.js +36 -0
  33. package/dist/web/assets/blockDiagram-7IZFK4PR-DlFaxH1b.js +132 -0
  34. package/dist/web/assets/{c4Diagram-DFAF54RM-C4Hl3J2U.js → c4Diagram-Y2BXMSZH-BjJ_Yrim.js} +1 -1
  35. package/dist/web/assets/{chunk-7RZVMHOQ-BitYcNVR.js → chunk-3SSMPTDK-KGZSzG3Y.js} +1 -1
  36. package/dist/web/assets/{chunk-TBF5ZNIQ-DL5stGM1.js → chunk-6764PJDD-p1sGJgVm.js} +1 -1
  37. package/dist/web/assets/{chunk-KSICW3F5-BYzvDLNI.js → chunk-AZZRMDJM-DIDkQA4V.js} +1 -1
  38. package/dist/web/assets/{chunk-AEOMTBSW-BgTIXPsY.js → chunk-JQRUD6KW-DAwg-yCU.js} +1 -1
  39. package/dist/web/assets/chunk-KRXBNO2N-ChVO_XdS.js +1 -0
  40. package/dist/web/assets/chunk-LCXTWHL2-DGYdb_Eh.js +231 -0
  41. package/dist/web/assets/{chunk-O5ABG6QK-dHwHzA6n.js → chunk-LII3EMHJ-Bzh9SNgD.js} +1 -1
  42. package/dist/web/assets/chunk-RG4AUYOV-Bcl7U_IV.js +206 -0
  43. package/dist/web/assets/{chunk-TU3PZOEN-RLyvLcv-.js → chunk-T5OCTHI4-CZYMg5sc.js} +1 -1
  44. package/dist/web/assets/chunk-W44A43WB-REOI67PN.js +13 -0
  45. package/dist/web/assets/{chunk-RWUO3TPN-BgRTY0_k.js → chunk-ZXARS5L4-BfFdV1tf.js} +1 -1
  46. package/dist/web/assets/classDiagram-KGZ6W3CR-B-qkKMYi.js +1 -0
  47. package/dist/web/assets/classDiagram-v2-72OJOZXJ-B-qkKMYi.js +1 -0
  48. package/dist/web/assets/{cose-bilkent-PNC4W37J-DVhePRYg.js → cose-bilkent-UX7MHV2Q-D6vANJGG.js} +1 -1
  49. package/dist/web/assets/dagre-ND4H6XIP-BiHe5Lal.js +4 -0
  50. package/dist/web/assets/diagram-3NCE3AQN-CEutBCOW.js +43 -0
  51. package/dist/web/assets/diagram-GF46GFSD-CZns6HPQ.js +24 -0
  52. package/dist/web/assets/diagram-HNR7UZ2L-Vz8fE5of.js +3 -0
  53. package/dist/web/assets/diagram-QXG6HAR7-D60HKZ_y.js +24 -0
  54. package/dist/web/assets/diagram-WEQXMOUZ-vGAf1p3E.js +10 -0
  55. package/dist/web/assets/{erDiagram-GCSMX5X6-C3dhDFA8.js → erDiagram-L5TCEMPS-DZaplJA6.js} +5 -5
  56. package/dist/web/assets/{flowDiagram-OTCZ4VVT-CWSFWmhr.js → flowDiagram-H6V6AXG4-BqUqeAsI.js} +9 -9
  57. package/dist/web/assets/ganttDiagram-JCBTUEKG-XEB6H-0G.js +292 -0
  58. package/dist/web/assets/gitGraphDiagram-S2ZK5IYY-7G50u1Cd.js +106 -0
  59. package/dist/web/assets/index-B5WxtMpv.js +1415 -0
  60. package/dist/web/assets/infoDiagram-3YFTVSEB-Cut_rzaf.js +2 -0
  61. package/dist/web/assets/{ishikawaDiagram-YMYX4NHK-DUoJvNP2.js → ishikawaDiagram-BNXS4ZKH-B4DGfGi3.js} +3 -3
  62. package/dist/web/assets/{journeyDiagram-SO5T7YLQ-RMFPNNqz.js → journeyDiagram-M6C3CM3L-BBFhsL3E.js} +1 -1
  63. package/dist/web/assets/{kanban-definition-LJHFXRCJ-BzpDs1K9.js → kanban-definition-75IXJCU3-DarGRyn3.js} +4 -4
  64. package/dist/web/assets/{katex-GD7MH7QM-DBQvrix-.js → katex-K3KEBU37-W5XTYMhr.js} +1 -1
  65. package/dist/web/assets/mindmap-definition-2TDM6QVE-BgeczIJM.js +96 -0
  66. package/dist/web/assets/pieDiagram-CU6KROY3-Kkoo-Noq.js +30 -0
  67. package/dist/web/assets/quadrantDiagram-VICAPDV7-CDQFeRWN.js +7 -0
  68. package/dist/web/assets/{requirementDiagram-M5DCFWZL-DLHOVTSv.js → requirementDiagram-JXO7QTGE-Cz9-XnkA.js} +2 -2
  69. package/dist/web/assets/sankeyDiagram-URQDO5SZ-CU26z0n7.js +40 -0
  70. package/dist/web/assets/sequenceDiagram-VS2MUI6T-OGK1FLOt.js +162 -0
  71. package/dist/web/assets/stateDiagram-7D4R322I-DJ9brq0U.js +1 -0
  72. package/dist/web/assets/stateDiagram-v2-36443NZ5-DhJ4Ky-7.js +1 -0
  73. package/dist/web/assets/{timeline-definition-5SPVSISX-TRSDRgPw.js → timeline-definition-O6YCAMPW-XZvnjqTT.js} +4 -4
  74. package/dist/web/assets/{vennDiagram-IE5QUKF5-DNy7HRBM.js → vennDiagram-MWXL3ELB-CJUssEjA.js} +6 -6
  75. package/dist/web/assets/wardley-L42UT6IY-5TKZOOLJ-DZr11zBG.js +173 -0
  76. package/dist/web/assets/wardleyDiagram-CUQ6CDDI-C276iqrN.js +78 -0
  77. package/dist/web/assets/{xychartDiagram-ZHJ5623Y-Dr9r7a35.js → xychartDiagram-N2JHSOCM-B9-uCZyP.js} +4 -4
  78. package/dist/web/index.html +1 -1
  79. package/hooks/claude/codragraph-hook.cjs +15 -122
  80. package/package.json +1 -1
  81. package/vendor/node_modules/node-addon-api/node_addon_api_except.stamp +0 -0
  82. package/dist/web/assets/agent-D5lb0zXz.js +0 -1089
  83. package/dist/web/assets/architectureDiagram-EMZXCZ2Q-CZtc99v_.js +0 -36
  84. package/dist/web/assets/blockDiagram-IGV67L2C-BtoUp-6Y.js +0 -132
  85. package/dist/web/assets/chunk-3GS5O3IE-DkUjU0WD.js +0 -231
  86. package/dist/web/assets/chunk-3YCYZ6SJ-CQkVgT_z.js +0 -1
  87. package/dist/web/assets/chunk-H3VCZNTA-Cx5XV_aC.js +0 -13
  88. package/dist/web/assets/chunk-HN6EAY2L-BBnyTNdB.js +0 -1
  89. package/dist/web/assets/chunk-PK6DOVAG-CvsEnugt.js +0 -206
  90. package/dist/web/assets/classDiagram-PPOCWD7C-DTr8QIOf.js +0 -1
  91. package/dist/web/assets/classDiagram-v2-23LJLIIU-DTr8QIOf.js +0 -1
  92. package/dist/web/assets/dagre-E77IOHMT-Dzx0A6ZU.js +0 -4
  93. package/dist/web/assets/diagram-H7BISOXX-CC9pRew1.js +0 -43
  94. package/dist/web/assets/diagram-JC5VWROH-Bau_i9tf.js +0 -24
  95. package/dist/web/assets/diagram-LXUTUG65-D9_FM2Gt.js +0 -10
  96. package/dist/web/assets/diagram-WEHSV5V5-BMlayouL.js +0 -24
  97. package/dist/web/assets/ganttDiagram-MUNLMDZQ-D3a67Yol.js +0 -292
  98. package/dist/web/assets/gitGraphDiagram-3HKGZ4G3-7jmry-vM.js +0 -106
  99. package/dist/web/assets/index-BgeqpYgd.js +0 -1415
  100. package/dist/web/assets/infoDiagram-MN7RKWGX-G7lhP0Ib.js +0 -2
  101. package/dist/web/assets/mindmap-definition-2EUWGEK5-Bk0O4roa.js +0 -96
  102. package/dist/web/assets/pieDiagram-3IATQBI2-DKU7kpgS.js +0 -30
  103. package/dist/web/assets/quadrantDiagram-E256RVCF-BY0TGWCS.js +0 -7
  104. package/dist/web/assets/sankeyDiagram-L3NBLAOT-DVMj5rX2.js +0 -10
  105. package/dist/web/assets/sequenceDiagram-ZOUHS735-CJC73bV-.js +0 -157
  106. package/dist/web/assets/stateDiagram-MLPALWAM-BCFyESls.js +0 -1
  107. package/dist/web/assets/stateDiagram-v2-B5LQ5ZB2-DahzzIca.js +0 -1
  108. package/dist/web/assets/wardley-RL74JXVD-BCRCBASE-B-eZEzf9.js +0 -161
  109. package/dist/web/assets/wardleyDiagram-XU3VSMPF-BP-r1xzR.js +0 -20
@@ -0,0 +1,78 @@
1
+ import{c as zt}from"./chunk-JQRUD6KW-DAwg-yCU.js";import{d as Lt}from"./wardley-L42UT6IY-5TKZOOLJ-DZr11zBG.js";import{l as Tt,a as At,o as It,n as Et,s as Rt,e as Bt,m as u,ac as Ft,I as Xt,L as U,p as et,a7 as Ot,b as Yt,u as Dt,q as H}from"./index-B5WxtMpv.js";var W=u((a,o)=>{let e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),I=u((a,o,e)=>({x:W(o,`${e} evolution`),y:W(a,`${e} visibility`)}),"toCoordinates"),tt=u(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),qt=u(a=>{var e;if(!(a!=null&&a.startsWith("+")))return{};let o=(e=/^\+'([^']*)'/.exec(a))==null?void 0:e[1];return a.includes("<>")?{flow:"bidirectional",label:o}:a.includes("<")?{flow:"backward",label:o}:a.includes(">")?{flow:"forward",label:o}:{label:o}},"extractFlowFromArrow"),Wt=u((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){let e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),x=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:x})}if(a.anchors.forEach(e=>{let x=I(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,x.x,x.y,"anchor")}),a.components.forEach(e=>{var v;let x=I(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,s=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,x.x,x.y,"component",r,s,e.inertia,m)}),a.notes.forEach(e=>{let x=I(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,x.x,x.y)}),a.pipelines.forEach(e=>{let x=o.getNode(e.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=x.y;o.startPipeline(e.parent),e.components.forEach(s=>{let m=`${e.parent}_${s.name}`,v=s.label?(s.label.negX?-1:1)*s.label.offsetX:void 0,y=s.label?(s.label.negY?-1:1)*s.label.offsetY:void 0,z=W(s.evolution,`Pipeline component "${s.name}" evolution`);o.addNode(m,s.name,z,r,"pipeline-component",v,y),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{let x=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-.")),r=tt(e.fromPort)??tt(e.toPort),{flow:s,label:m}=qt(e.arrow);!r&&s&&(r=s);let v=e.linkLabel,y=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),x,y,r)}),a.evolves.forEach(e=>{let x=o.getNode(e.component);if((x==null?void 0:x.y)!==void 0){let r=W(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,x.y)}}),a.annotations.length>0){let e=a.annotations[0],x=I(e.x,e.y,"Annotations box");o.setAnnotationsBox(x.x,x.y)}a.annotation.forEach(e=>{let x=I(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:x.x,y:x.y}],e.text)}),a.accelerators.forEach(e=>{let x=I(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,x.x,x.y)}),a.deaccelerators.forEach(e=>{let x=I(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,x.x,x.y)})},"populateDb"),at={parser:{yy:void 0},parse:u(async a=>{var x;let o=await Lt("wardley",a);et.debug(o);let e=(x=at.parser)==null?void 0:x.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Wt(o,e)},"parse")},B,jt=(B=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){let e=this.nodes.get(o.id)??{id:o.id,label:o.label},x={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,x)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});let e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){let x=this.pipelines.get(o);x&&x.componentIds.push(e);let r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(let[e,x]of this.nodes)if(x.label===o)return e;return o}build(){let o=[];for(let e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},u(B,"WardleyBuilder"),B),b=new jt;function rt(){return H()["wardley-beta"]}u(rt,"getConfig");function ot(a,o,e,x,r,s,m,v,y){b.addNode({id:a,label:o,x:e,y:x,className:r,labelOffsetX:s,labelOffsetY:m,inertia:v,sourceStrategy:y})}u(ot,"addNode");function it(a,o,e=!1,x,r){b.addLink({source:a,target:o,dashed:e,label:x,flow:r})}u(it,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}u(nt,"addTrend");function lt(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}u(lt,"addAnnotation");function st(a,o,e){b.addNote({text:a,x:o,y:e})}u(st,"addNote");function dt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}u(dt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}u(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}u(pt,"setAnnotationsBox");function xt(a,o){b.setSize(a,o)}u(xt,"setSize");function ht(a){b.startPipeline(a)}u(ht,"startPipeline");function yt(a,o){b.addPipelineComponent(a,o)}u(yt,"addPipelineComponent");function gt(a){b.setAxes(a)}u(gt,"updateAxes");function ft(a){return b.getNode(a)}u(ft,"getNode");function ut(a){return b.resolveNodeId(a)}u(ut,"resolveNodeId");function mt(){return b.build()}u(mt,"getWardleyData");function wt(){b.clear(),Dt()}u(wt,"clear");var Vt={getConfig:rt,addNode:ot,addLink:it,addTrend:nt,addAnnotation:lt,addNote:st,addAccelerator:dt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:xt,startPipeline:ht,addPipelineComponent:yt,updateAxes:gt,getNode:ft,resolveNodeId:ut,getWardleyData:mt,clear:wt,setAccTitle:Bt,getAccTitle:Rt,setDiagramTitle:Et,getDiagramTitle:It,getAccDescription:At,setAccDescription:Tt},Gt=["Genesis","Custom Built","Product","Commodity"],Ht=u(()=>{var o,e,x,r,s,m,v,y,z,M,k,P;let{themeVariables:a}=H();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((x=a.wardley)==null?void 0:x.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((s=a.wardley)==null?void 0:s.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((y=a.wardley)==null?void 0:y.linkStroke)??"#000",evolutionStroke:((z=a.wardley)==null?void 0:z.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((P=a.wardley)==null?void 0:P.annotationFill)??a.background??"#fff"}},"getTheme"),Zt=u(()=>{let a=H()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),_t=u((a,o,e,x)=>{var K,Q;et.debug(`Rendering Wardley map
2
+ `+a);let r=Zt(),s=Ht(),m=r.nodeRadius*1.6,v=x.db,y=v.getWardleyData(),z=v.getDiagramTitle(),M=((K=y.size)==null?void 0:K.width)??r.width,k=((Q=y.size)==null?void 0:Q.height)??r.height,P=Ot(o);P.selectAll("*").remove(),Yt(P,k,M,r.useMaxWidth),P.attr("viewBox",`0 0 ${M} ${k}`);let S=P.append("g").attr("class","wardley-map"),j=P.append("defs");j.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",s.evolutionStroke).attr("stroke","none"),j.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",s.linkStroke).attr("stroke","none"),j.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",s.linkStroke).attr("stroke","none"),S.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",s.backgroundColor);let F=M-r.padding*2,X=k-r.padding*2;z&&S.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",s.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(z);let L=u(t=>r.padding+t/100*F,"projectX"),T=u(t=>k-r.padding-t/100*X,"projectY"),Y=S.append("g").attr("class","wardley-axes");Y.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",s.axisColor).attr("stroke-width",1),Y.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",s.axisColor).attr("stroke-width",1);let kt=y.axes.xLabel??"Evolution",bt=y.axes.yLabel??"Visibility";Y.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+F/2).attr("y",k-r.padding/4).attr("fill",s.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),Y.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+X/2).attr("fill",s.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+X/2})`).text(bt);let O=y.axes.stages&&y.axes.stages.length>0?y.axes.stages:Gt;if(O.length>0){let t=S.append("g").attr("class","wardley-stages"),n=y.axes.stageBoundaries,i=[];if(n&&n.length===O.length){let l=0;n.forEach(d=>{i.push({start:l,end:d}),l=d})}else{let l=1/O.length;O.forEach((d,c)=>{i.push({start:c*l,end:(c+1)*l})})}O.forEach((l,d)=>{let c=i[d],g=r.padding+c.start*F,h=r.padding+c.end*F,f=(g+h)/2;d>0&&t.append("line").attr("x1",g).attr("x2",g).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",f).attr("y",k-r.padding/1.5).attr("fill",s.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(l)})}if(r.showGrid){let t=S.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){let i=n/4,l=r.padding+F*i;t.append("line").attr("x1",l).attr("x2",l).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",s.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-X*i).attr("y2",k-r.padding-X*i).attr("stroke",s.gridColor).attr("stroke-dasharray","2 6")}}let p=new Map;if(y.nodes.forEach(t=>{p.set(t.id,{x:L(t.x),y:T(t.y),node:t})}),y.pipelines.length>0){let t=S.append("g").attr("class","wardley-pipelines"),n=S.append("g").attr("class","wardley-pipeline-links");y.pipelines.forEach(i=>{if(i.componentIds.length===0)return;let l=i.componentIds.map(h=>({id:h,pos:p.get(h),node:y.nodes.find(f=>f.id===h)})).filter(h=>h.pos&&h.node).sort((h,f)=>h.node.x-f.node.x);for(let h=0;h<l.length-1;h++){let f=l[h],w=l[h+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",f.pos.x).attr("y1",f.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",s.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let d=1/0,c=-1/0,g=0;if(i.componentIds.forEach(h=>{let f=p.get(h);f&&(d=Math.min(d,f.x),c=Math.max(c,f.x),g=f.y)}),d!==1/0&&c!==-1/0){let h=r.nodeRadius*4,f=g-h/2,w=p.get(i.nodeId);if(w){let C=(d+c)/2;w.x=C,w.y=f-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",d-15).attr("y",f).attr("width",c-d+30).attr("height",h).attr("fill","none").attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let Z=S.append("g").attr("class","wardley-links"),_=new Map;y.pipelines.forEach(t=>{_.set(t.nodeId,new Set(t.componentIds))});let J=y.links.filter(t=>{var n;return!(!p.has(t.source)||!p.has(t.target)||(n=_.get(t.target))!=null&&n.has(t.source))});Z.selectAll("line").data(J).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{let n=p.get(t.source),i=p.get(t.target),l=y.nodes.find(h=>h.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,d=i.x-n.x,c=i.y-n.y,g=Math.sqrt(d*d+c*c);return n.x+d/g*l}).attr("y1",t=>{let n=p.get(t.source),i=p.get(t.target),l=y.nodes.find(h=>h.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,d=i.x-n.x,c=i.y-n.y,g=Math.sqrt(d*d+c*c);return n.y+c/g*l}).attr("x2",t=>{let n=p.get(t.source),i=p.get(t.target),l=y.nodes.find(h=>h.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,d=n.x-i.x,c=n.y-i.y,g=Math.sqrt(d*d+c*c);return i.x+d/g*l}).attr("y2",t=>{let n=p.get(t.source),i=p.get(t.target),l=y.nodes.find(h=>h.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,d=n.x-i.x,c=n.y-i.y,g=Math.sqrt(d*d+c*c);return i.y+c/g*l}).attr("stroke",s.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),Z.selectAll("text").data(J.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{let n=p.get(t.source),i=p.get(t.target),l=(n.x+i.x)/2,d=i.y-n.y,c=i.x-n.x,g=Math.sqrt(c*c+d*d),h=8,f=d/g;return l+f*h}).attr("y",t=>{let n=p.get(t.source),i=p.get(t.target),l=(n.y+i.y)/2,d=i.x-n.x,c=i.y-n.y,g=Math.sqrt(d*d+c*c),h=8,f=-d/g;return l+f*h}).attr("fill",s.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{let n=p.get(t.source),i=p.get(t.target),l=(n.x+i.x)/2,d=(n.y+i.y)/2,c=i.x-n.x,g=i.y-n.y,h=Math.sqrt(c*c+g*g),f=8,w=g/h,C=-c/h,E=l+w*f,D=d+C*f,R=Math.atan2(g,c)*180/Math.PI;return(R>90||R<-90)&&(R+=180),`rotate(${R} ${E} ${D})`}).text(t=>t.label);let $t=S.append("g").attr("class","wardley-trends"),vt=y.trends.map(t=>{let n=p.get(t.nodeId);if(!n)return null;let i=L(t.targetX),l=T(t.targetY),d=i-n.x,c=l-n.y,g=Math.sqrt(d*d+c*c),h=r.nodeRadius+2,f=g>h?i-d/g*h:i,w=g>h?l-c/g*h:l;return{origin:n,targetX:i,targetY:l,adjustedX2:f,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",s.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);let N=S.append("g").attr("class","wardley-nodes").selectAll("g").data(y.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));N.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",s.componentStroke).attr("stroke-width",1),N.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",s.componentStroke).attr("stroke-width",1),N.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let A=N.filter(t=>t.sourceStrategy==="market");A.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),N.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y).attr("r",r.nodeRadius).attr("fill",s.componentFill).attr("stroke",s.componentStroke).attr("stroke-width",1);let V=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(A.append("line").attr("class","wardley-market-line").attr("x1",t=>p.get(t.id).x).attr("y1",t=>p.get(t.id).y-$).attr("x2",t=>p.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",s.componentStroke).attr("stroke-width",1),A.append("line").attr("class","wardley-market-line").attr("x1",t=>p.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>p.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",s.componentStroke).attr("stroke-width",1),A.append("line").attr("class","wardley-market-line").attr("x1",t=>p.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>p.get(t.id).x).attr("y2",t=>p.get(t.id).y-$).attr("stroke",s.componentStroke).attr("stroke-width",1),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>p.get(t.id).x).attr("cy",t=>p.get(t.id).y-$).attr("r",V).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>p.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",V).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>p.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>p.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",V).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",2),N.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>p.get(t.id).x-m/2).attr("y",t=>p.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",s.componentFill).attr("stroke",s.componentStroke).attr("stroke-width",1),N.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{let n=p.get(t.id),i=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(i+=r.nodeRadius+10),n.x+i}).attr("y1",t=>{let n=p.get(t.id),i=t.isPipelineParent?m:r.nodeRadius*2;return n.y-i/2}).attr("x2",t=>{let n=p.get(t.id),i=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(i+=r.nodeRadius+10),n.x+i}).attr("y2",t=>{let n=p.get(t.id),i=t.isPipelineParent?m:r.nodeRadius*2;return n.y+i/2}).attr("stroke",s.componentStroke).attr("stroke-width",6),N.append("text").attr("x",t=>{let n=p.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let i=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(i+=10);let l=t.labelOffsetX??i;return n.x+l}).attr("y",t=>{let n=p.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let i=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(i-=10);let l=t.labelOffsetY??i;return n.y+l}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?s.evolutionStroke:t.className==="anchor"?"#000":s.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),y.annotations.length>0){let t=S.append("g").attr("class","wardley-annotations");if(y.annotations.forEach(n=>{let i=n.coordinates.map(l=>({x:L(l.x),y:T(l.y)}));if(i.length>1)for(let l=0;l<i.length-1;l++)t.append("line").attr("class","wardley-annotation-line").attr("x1",i[l].x).attr("y1",i[l].y).attr("x2",i[l+1].x).attr("y2",i[l+1].y).attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");i.forEach(l=>{let d=t.append("g").attr("class","wardley-annotation");d.append("circle").attr("cx",l.x).attr("cy",l.y).attr("r",10).attr("fill","white").attr("stroke",s.axisColor).attr("stroke-width",1.5),d.append("text").attr("x",l.x).attr("y",l.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(n.number)})}),y.annotationsBox){let n=L(y.annotationsBox.x),i=T(y.annotationsBox.y),l=10,d=16,c=11,g=t.append("g").attr("class","wardley-annotations-box"),h=[...y.annotations].filter(w=>w.text).sort((w,C)=>w.number-C.number),f=[];if(h.forEach((w,C)=>{let E=g.append("text").attr("x",n+l).attr("y",i+l+(C+1)*d).attr("font-size",c).attr("fill",s.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);f.push(E)}),f.length>0){let w=0,C=0;f.forEach(G=>{let q=G.node(),Pt=q.getComputedTextLength();w=Math.max(w,Pt);let Nt=q.getBBox();C=Math.max(C,Nt.height)});let E=w+l*2+105,D=h.length*d+l*2+C/2,R=r.padding,St=M-r.padding-E,Mt=r.padding,Ct=k-r.padding-D;n=Math.max(R,Math.min(n,St)),i=Math.max(Mt,Math.min(i,Ct)),f.forEach((G,q)=>{G.attr("x",n+l).attr("y",i+l+(q+1)*d)}),g.insert("rect","text").attr("x",n).attr("y",i).attr("width",E).attr("height",D).attr("fill","white").attr("stroke",s.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(y.notes.length>0){let t=S.append("g").attr("class","wardley-notes");y.notes.forEach(n=>{let i=L(n.x),l=T(n.y);t.append("text").attr("x",i).attr("y",l).attr("text-anchor","start").attr("font-size",11).attr("fill",s.axisTextColor).attr("font-weight","bold").text(n.text)})}if(y.accelerators.length>0){let t=S.append("g").attr("class","wardley-accelerators");y.accelerators.forEach(n=>{let i=L(n.x),l=T(n.y),d=60,c=30,g=20,h=`
3
+ M ${i} ${l-c/2}
4
+ L ${i+d-g} ${l-c/2}
5
+ L ${i+d-g} ${l-c/2-8}
6
+ L ${i+d} ${l}
7
+ L ${i+d-g} ${l+c/2+8}
8
+ L ${i+d-g} ${l+c/2}
9
+ L ${i} ${l+c/2}
10
+ Z
11
+ `;t.append("path").attr("d",h).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),t.append("text").attr("x",i+d/2).attr("y",l+c/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(n.name)})}if(y.deaccelerators.length>0){let t=S.append("g").attr("class","wardley-deaccelerators");y.deaccelerators.forEach(n=>{let i=L(n.x),l=T(n.y),d=60,c=30,g=20,h=`
12
+ M ${i+d} ${l-c/2}
13
+ L ${i+g} ${l-c/2}
14
+ L ${i+g} ${l-c/2-8}
15
+ L ${i} ${l}
16
+ L ${i+g} ${l+c/2+8}
17
+ L ${i+g} ${l+c/2}
18
+ L ${i+d} ${l+c/2}
19
+ Z
20
+ `;t.append("path").attr("d",h).attr("fill","white").attr("stroke",s.componentStroke).attr("stroke-width",1),t.append("text").attr("x",i+d/2).attr("y",l+c/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",s.axisTextColor).attr("font-weight","bold").text(n.name)})}},"draw"),Jt={draw:_t},Kt=u(({wardley:a}={})=>{let o=Ft(),e=Xt(),x=U(o,e.themeVariables),r=U(x.wardley,a);return`
21
+ .wardley-background {
22
+ fill: ${r.backgroundColor};
23
+ }
24
+ .wardley-axes line, .wardley-axes path {
25
+ stroke: ${r.axisColor};
26
+ }
27
+ .wardley-axis-label {
28
+ fill: ${r.axisTextColor};
29
+ }
30
+ .wardley-stage-label {
31
+ fill: ${r.axisTextColor};
32
+ }
33
+ .wardley-grid line {
34
+ stroke: ${r.gridColor};
35
+ }
36
+ .wardley-node circle {
37
+ fill: ${r.componentFill};
38
+ stroke: ${r.componentStroke};
39
+ }
40
+ .wardley-node-label {
41
+ fill: ${r.componentLabelColor};
42
+ }
43
+ .wardley-link {
44
+ stroke: ${r.linkStroke};
45
+ }
46
+ .wardley-link--dashed {
47
+ stroke-dasharray: 4 4;
48
+ }
49
+ .wardley-link-label {
50
+ fill: ${r.axisTextColor};
51
+ }
52
+ .wardley-trend line {
53
+ stroke: ${r.evolutionStroke};
54
+ }
55
+ .wardley-annotation-line {
56
+ stroke: ${r.annotationStroke};
57
+ }
58
+ .wardley-annotation circle {
59
+ fill: ${r.annotationFill};
60
+ stroke: ${r.annotationStroke};
61
+ }
62
+ .wardley-annotation text {
63
+ fill: ${r.annotationTextColor};
64
+ }
65
+ .wardley-annotations-box rect {
66
+ fill: ${r.annotationFill};
67
+ stroke: ${r.annotationStroke};
68
+ }
69
+ .wardley-annotations-box text {
70
+ fill: ${r.annotationTextColor};
71
+ }
72
+ .wardley-pipeline-box {
73
+ stroke: ${r.componentStroke};
74
+ }
75
+ .wardley-notes text {
76
+ fill: ${r.axisTextColor};
77
+ }
78
+ `},"styles"),ee={parser:at,db:Vt,renderer:Jt,styles:Kt};export{ee as diagram};
@@ -1,7 +1,7 @@
1
- import{a as gi,l as ui,n as Wt,h as xi,s as di,e as pi,m as n,p as Nt,a7 as fi,b as yi,o as mi,O as kt,c as bi,L as Vt,y as Ai,ac as wi,ad as Bt,Z as zt,ae as Ci,af as Ot}from"./index-BgeqpYgd.js";var bt=function(){var s=n(function(P,o,l,c){for(l=l||{},c=P.length;c--;l[P[c]]=o);return l},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],e=[1,3],a=[1,5],g=[1,6],u=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],b=[1,25],E=[1,26],B=[1,28],R=[1,29],$=[1,30],W=[1,31],N=[1,32],D=[1,33],z=[1,34],p=[1,35],C=[1,36],r=[1,37],I=[1,43],O=[1,42],U=[1,47],Y=[1,50],A=[1,10,12,14,16,18,19,21,23,34,35,36],x=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],w=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],L=[1,64],k={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:n(function(P,o,l,c,f,h,T){var d=h.length-1;switch(f){case 5:c.setOrientation(h[d]);break;case 9:c.setDiagramTitle(h[d].text.trim());break;case 12:c.setLineData({text:"",type:"text"},h[d]);break;case 13:c.setLineData(h[d-1],h[d]);break;case 14:c.setBarData({text:"",type:"text"},h[d]);break;case 15:c.setBarData(h[d-1],h[d]);break;case 16:this.$=h[d].trim(),c.setAccTitle(this.$);break;case 17:case 18:this.$=h[d].trim(),c.setAccDescription(this.$);break;case 19:this.$=h[d-1];break;case 20:this.$=[Number(h[d-2]),...h[d]];break;case 21:this.$=[Number(h[d])];break;case 22:c.setXAxisTitle(h[d]);break;case 23:c.setXAxisTitle(h[d-1]);break;case 24:c.setXAxisTitle({type:"text",text:""});break;case 25:c.setXAxisBand(h[d]);break;case 26:c.setXAxisRangeData(Number(h[d-2]),Number(h[d]));break;case 27:this.$=h[d-1];break;case 28:this.$=[h[d-2],...h[d]];break;case 29:this.$=[h[d]];break;case 30:c.setYAxisTitle(h[d]);break;case 31:c.setYAxisTitle(h[d-1]);break;case 32:c.setYAxisTitle({type:"text",text:""});break;case 33:c.setYAxisRangeData(Number(h[d-2]),Number(h[d]));break;case 37:this.$={text:h[d],type:"text"};break;case 38:this.$={text:h[d],type:"text"};break;case 39:this.$={text:h[d],type:"markdown"};break;case 40:this.$=h[d];break;case 41:this.$=h[d-1]+""+h[d];break}},"anonymous"),table:[s(t,i,{3:1,4:2,7:4,5:e,34:a,35:g,36:u}),{1:[3]},s(t,i,{4:2,7:4,3:8,5:e,34:a,35:g,36:u}),s(t,i,{4:2,7:4,6:9,3:10,5:e,8:[1,11],34:a,35:g,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},s(m,[2,34]),s(m,[2,35]),s(m,[2,36]),{1:[2,1]},s(t,i,{4:2,7:4,3:21,5:e,34:a,35:g,36:u}),{1:[2,3]},s(m,[2,5]),s(t,[2,7],{4:22,34:a,35:g,36:u}),{11:23,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:39,13:38,24:I,27:O,29:40,30:41,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:45,15:44,27:U,33:46,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:49,17:48,24:Y,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:52,17:51,24:Y,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{20:[1,53]},{22:[1,54]},s(A,[2,18]),{1:[2,2]},s(A,[2,8]),s(A,[2,9]),s(x,[2,37],{40:55,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r}),s(x,[2,38]),s(x,[2,39]),s(w,[2,40]),s(w,[2,42]),s(w,[2,43]),s(w,[2,44]),s(w,[2,45]),s(w,[2,46]),s(w,[2,47]),s(w,[2,48]),s(w,[2,49]),s(w,[2,50]),s(w,[2,51]),s(A,[2,10]),s(A,[2,22],{30:41,29:56,24:I,27:O}),s(A,[2,24]),s(A,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},s(A,[2,11]),s(A,[2,30],{33:60,27:U}),s(A,[2,32]),{31:[1,61]},s(A,[2,12]),{17:62,24:Y},{25:63,27:L},s(A,[2,14]),{17:65,24:Y},s(A,[2,16]),s(A,[2,17]),s(w,[2,41]),s(A,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},s(A,[2,31]),{27:[1,69]},s(A,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},s(A,[2,15]),s(A,[2,26]),s(A,[2,27]),{11:59,32:72,37:24,38:b,39:E,40:27,41:B,42:R,43:$,44:W,45:N,46:D,47:z,48:p,49:C,50:r},s(A,[2,33]),s(A,[2,19]),{25:73,27:L},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(P,o){if(o.recoverable)this.trace(P);else{var l=new Error(P);throw l.hash=o,l}},"parseError"),parse:n(function(P){var o=this,l=[0],c=[],f=[null],h=[],T=this.table,d="",rt=0,Et=0,hi=0,oi=2,$t=1,ri=h.slice.call(arguments,1),S=Object.create(this.lexer),X={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(X.yy[dt]=this.yy[dt]);S.setInput(P,X.yy),X.yy.lexer=S,X.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var pt=S.yylloc;h.push(pt);var li=S.options&&S.options.ranges;typeof X.yy.parseError=="function"?this.parseError=X.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ci(v){l.length=l.length-2*v,f.length=f.length-v,h.length=h.length-v}n(ci,"popStack");function It(){var v;return v=c.pop()||S.lex()||$t,typeof v!="number"&&(v instanceof Array&&(c=v,v=c.pop()),v=o.symbols_[v]||v),v}n(It,"lex");for(var _,ft,H,M,Bi,yt,G={},lt,V,Mt,ct;;){if(H=l[l.length-1],this.defaultActions[H]?M=this.defaultActions[H]:((_===null||typeof _>"u")&&(_=It()),M=T[H]&&T[H][_]),typeof M>"u"||!M.length||!M[0]){var mt="";ct=[];for(lt in T[H])this.terminals_[lt]&&lt>oi&&ct.push("'"+this.terminals_[lt]+"'");S.showPosition?mt="Parse error on line "+(rt+1)+`:
1
+ import{l as gi,a as ui,o as Wt,n as xi,s as di,e as pi,m as n,p as Nt,a7 as fi,b as yi,u as mi,I as kt,d as bi,L as Vt,E as Ai,ac as wi,ad as Bt,Z as zt,ae as Ci,af as Ot}from"./index-B5WxtMpv.js";var bt=function(){var s=n(function(P,o,l,c){for(l=l||{},c=P.length;c--;l[P[c]]=o);return l},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],e=[1,3],a=[1,5],g=[1,6],u=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],b=[1,25],E=[1,26],B=[1,28],R=[1,29],I=[1,30],W=[1,31],N=[1,32],D=[1,33],z=[1,34],p=[1,35],C=[1,36],r=[1,37],$=[1,43],O=[1,42],U=[1,47],Y=[1,50],A=[1,10,12,14,16,18,19,21,23,34,35,36],x=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],w=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],L=[1,64],k={trace:n(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:n(function(P,o,l,c,f,h,T){var d=h.length-1;switch(f){case 5:c.setOrientation(h[d]);break;case 9:c.setDiagramTitle(h[d].text.trim());break;case 12:c.setLineData({text:"",type:"text"},h[d]);break;case 13:c.setLineData(h[d-1],h[d]);break;case 14:c.setBarData({text:"",type:"text"},h[d]);break;case 15:c.setBarData(h[d-1],h[d]);break;case 16:this.$=h[d].trim(),c.setAccTitle(this.$);break;case 17:case 18:this.$=h[d].trim(),c.setAccDescription(this.$);break;case 19:this.$=h[d-1];break;case 20:this.$=[Number(h[d-2]),...h[d]];break;case 21:this.$=[Number(h[d])];break;case 22:c.setXAxisTitle(h[d]);break;case 23:c.setXAxisTitle(h[d-1]);break;case 24:c.setXAxisTitle({type:"text",text:""});break;case 25:c.setXAxisBand(h[d]);break;case 26:c.setXAxisRangeData(Number(h[d-2]),Number(h[d]));break;case 27:this.$=h[d-1];break;case 28:this.$=[h[d-2],...h[d]];break;case 29:this.$=[h[d]];break;case 30:c.setYAxisTitle(h[d]);break;case 31:c.setYAxisTitle(h[d-1]);break;case 32:c.setYAxisTitle({type:"text",text:""});break;case 33:c.setYAxisRangeData(Number(h[d-2]),Number(h[d]));break;case 37:this.$={text:h[d],type:"text"};break;case 38:this.$={text:h[d],type:"text"};break;case 39:this.$={text:h[d],type:"markdown"};break;case 40:this.$=h[d];break;case 41:this.$=h[d-1]+""+h[d];break}},"anonymous"),table:[s(t,i,{3:1,4:2,7:4,5:e,34:a,35:g,36:u}),{1:[3]},s(t,i,{4:2,7:4,3:8,5:e,34:a,35:g,36:u}),s(t,i,{4:2,7:4,6:9,3:10,5:e,8:[1,11],34:a,35:g,36:u}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},s(m,[2,34]),s(m,[2,35]),s(m,[2,36]),{1:[2,1]},s(t,i,{4:2,7:4,3:21,5:e,34:a,35:g,36:u}),{1:[2,3]},s(m,[2,5]),s(t,[2,7],{4:22,34:a,35:g,36:u}),{11:23,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:39,13:38,24:$,27:O,29:40,30:41,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:45,15:44,27:U,33:46,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:49,17:48,24:Y,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{11:52,17:51,24:Y,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},{20:[1,53]},{22:[1,54]},s(A,[2,18]),{1:[2,2]},s(A,[2,8]),s(A,[2,9]),s(x,[2,37],{40:55,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r}),s(x,[2,38]),s(x,[2,39]),s(w,[2,40]),s(w,[2,42]),s(w,[2,43]),s(w,[2,44]),s(w,[2,45]),s(w,[2,46]),s(w,[2,47]),s(w,[2,48]),s(w,[2,49]),s(w,[2,50]),s(w,[2,51]),s(A,[2,10]),s(A,[2,22],{30:41,29:56,24:$,27:O}),s(A,[2,24]),s(A,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},s(A,[2,11]),s(A,[2,30],{33:60,27:U}),s(A,[2,32]),{31:[1,61]},s(A,[2,12]),{17:62,24:Y},{25:63,27:L},s(A,[2,14]),{17:65,24:Y},s(A,[2,16]),s(A,[2,17]),s(w,[2,41]),s(A,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},s(A,[2,31]),{27:[1,69]},s(A,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},s(A,[2,15]),s(A,[2,26]),s(A,[2,27]),{11:59,32:72,37:24,38:b,39:E,40:27,41:B,42:R,43:I,44:W,45:N,46:D,47:z,48:p,49:C,50:r},s(A,[2,33]),s(A,[2,19]),{25:73,27:L},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:n(function(P,o){if(o.recoverable)this.trace(P);else{var l=new Error(P);throw l.hash=o,l}},"parseError"),parse:n(function(P){var o=this,l=[0],c=[],f=[null],h=[],T=this.table,d="",rt=0,Et=0,hi=0,oi=2,It=1,ri=h.slice.call(arguments,1),S=Object.create(this.lexer),X={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(X.yy[dt]=this.yy[dt]);S.setInput(P,X.yy),X.yy.lexer=S,X.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var pt=S.yylloc;h.push(pt);var li=S.options&&S.options.ranges;typeof X.yy.parseError=="function"?this.parseError=X.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ci(v){l.length=l.length-2*v,f.length=f.length-v,h.length=h.length-v}n(ci,"popStack");function $t(){var v;return v=c.pop()||S.lex()||It,typeof v!="number"&&(v instanceof Array&&(c=v,v=c.pop()),v=o.symbols_[v]||v),v}n($t,"lex");for(var _,ft,H,M,Bi,yt,j={},lt,V,Mt,ct;;){if(H=l[l.length-1],this.defaultActions[H]?M=this.defaultActions[H]:((_===null||typeof _>"u")&&(_=$t()),M=T[H]&&T[H][_]),typeof M>"u"||!M.length||!M[0]){var mt="";ct=[];for(lt in T[H])this.terminals_[lt]&&lt>oi&&ct.push("'"+this.terminals_[lt]+"'");S.showPosition?mt="Parse error on line "+(rt+1)+`:
2
2
  `+S.showPosition()+`
3
- Expecting `+ct.join(", ")+", got '"+(this.terminals_[_]||_)+"'":mt="Parse error on line "+(rt+1)+": Unexpected "+(_==$t?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(mt,{text:S.match,token:this.terminals_[_]||_,line:S.yylineno,loc:pt,expected:ct})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+_);switch(M[0]){case 1:l.push(_),f.push(S.yytext),h.push(S.yylloc),l.push(M[1]),_=null,ft?(_=ft,ft=null):(Et=S.yyleng,d=S.yytext,rt=S.yylineno,pt=S.yylloc,hi>0);break;case 2:if(V=this.productions_[M[1]][1],G.$=f[f.length-V],G._$={first_line:h[h.length-(V||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(V||1)].first_column,last_column:h[h.length-1].last_column},li&&(G._$.range=[h[h.length-(V||1)].range[0],h[h.length-1].range[1]]),yt=this.performAction.apply(G,[d,Et,rt,X.yy,M[1],f,h].concat(ri)),typeof yt<"u")return yt;V&&(l=l.slice(0,-1*V*2),f=f.slice(0,-1*V),h=h.slice(0,-1*V)),l.push(this.productions_[M[1]][0]),f.push(G.$),h.push(G._$),Mt=T[l[l.length-2]][l[l.length-1]],l.push(Mt);break;case 3:return!0}}return!0},"parse")},xt=function(){var P={EOF:1,parseError:n(function(o,l){if(this.yy.parser)this.yy.parser.parseError(o,l);else throw new Error(o)},"parseError"),setInput:n(function(o,l){return this.yy=l||this.yy||{},this._input=o,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:n(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:n(function(o){var l=o.length,c=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var h=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:c?(c.length===f.length?this.yylloc.first_column:0)+f[f.length-c.length].length-c[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
3
+ Expecting `+ct.join(", ")+", got '"+(this.terminals_[_]||_)+"'":mt="Parse error on line "+(rt+1)+": Unexpected "+(_==It?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(mt,{text:S.match,token:this.terminals_[_]||_,line:S.yylineno,loc:pt,expected:ct})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+_);switch(M[0]){case 1:l.push(_),f.push(S.yytext),h.push(S.yylloc),l.push(M[1]),_=null,ft?(_=ft,ft=null):(Et=S.yyleng,d=S.yytext,rt=S.yylineno,pt=S.yylloc,hi>0);break;case 2:if(V=this.productions_[M[1]][1],j.$=f[f.length-V],j._$={first_line:h[h.length-(V||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(V||1)].first_column,last_column:h[h.length-1].last_column},li&&(j._$.range=[h[h.length-(V||1)].range[0],h[h.length-1].range[1]]),yt=this.performAction.apply(j,[d,Et,rt,X.yy,M[1],f,h].concat(ri)),typeof yt<"u")return yt;V&&(l=l.slice(0,-1*V*2),f=f.slice(0,-1*V),h=h.slice(0,-1*V)),l.push(this.productions_[M[1]][0]),f.push(j.$),h.push(j._$),Mt=T[l[l.length-2]][l[l.length-1]],l.push(Mt);break;case 3:return!0}}return!0},"parse")},xt=function(){var P={EOF:1,parseError:n(function(o,l){if(this.yy.parser)this.yy.parser.parseError(o,l);else throw new Error(o)},"parseError"),setInput:n(function(o,l){return this.yy=l||this.yy||{},this._input=o,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:n(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var l=o.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:n(function(o){var l=o.length,c=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var h=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:c?(c.length===f.length?this.yylloc.first_column:0)+f[f.length-c.length].length-c[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[h[0],h[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(o){this.unput(this.match.slice(o))},"less"),pastInput:n(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var o=this.pastInput(),l=new Array(o.length+1).join("-");return o+this.upcomingInput()+`
5
5
  `+l+"^"},"showPosition"),test_match:n(function(o,l){var c,f,h;if(this.options.backtrack_lexer&&(h={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&&(h.yylloc.range=this.yylloc.range.slice(0))),f=o[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,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(o[0].length),this.matched+=o[0],c=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var T in h)this[T]=h[T];return!1}return!1},"test_match"),next:n(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var o,l,c,f;this._more||(this.yytext="",this.match="");for(var h=this._currentRules(),T=0;T<h.length;T++)if(c=this._input.match(this.rules[h[T]]),c&&(!l||c[0].length>l[0].length)){if(l=c,f=T,this.options.backtrack_lexer){if(o=this.test_match(c,h[T]),o!==!1)return o;if(this._backtrack){l=!1;continue}else return!1}else if(!this.options.flex)break}return l?(o=this.test_match(l,h[f]),o!==!1?o:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:n(function(){var o=this.next();return o||this.lex()},"lex"),begin:n(function(o){this.conditionStack.push(o)},"begin"),popState:n(function(){var o=this.conditionStack.length-1;return o>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n(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:n(function(o){return o=this.conditionStack.length-1-Math.abs(o||0),o>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:n(function(o){this.begin(o)},"pushState"),stateStackSize:n(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:n(function(o,l,c,f){switch(c){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 31;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return P}();k.lexer=xt;function F(){this.yy={}}return n(F,"Parser"),F.prototype=k,k.Parser=F,new F}();bt.parser=bt;var ki=bt;function At(s){return s.type==="bar"}n(At,"isBarPlot");function St(s){return s.type==="band"}n(St,"isBandAxisData");function j(s){return s.type==="linear"}n(j,"isLinearAxisData");var Q,Yt=(Q=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((g,u)=>Math.max(u.length,g),0)*i,height:i};let e={width:0,height:0},a=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let g of t){let u=Ci(a,1,g),m=u?u.width:g.length*i,b=u?u.height:i;e.width=Math.max(e.width,m),e.height=Math.max(e.height,b)}return a.remove(),e}},n(Q,"TextDimensionCalculatorWithFont"),Q),Z,Ft=(Z=class{constructor(t,i,e,a){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),a=.2*t.width;this.outerPadding=Math.min(e.width/2,a);let g=e.height+this.axisConfig.labelPadding*2;this.labelTextHeight=e.height,g<=i&&(i-=g,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),a=.2*t.height;this.outerPadding=Math.min(e.height/2,a);let g=e.width+this.axisConfig.labelPadding*2;g<=i&&(i-=g,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${i},${this.getScaleValue(e)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(e)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i} L ${this.getScaleValue(e)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(e)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},n(Z,"BaseAxis"),Z),K,Si=(K=class extends Ft{constructor(t,i,e,a,g){super(t,a,g,i),this.categories=e,this.scale=Bt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=Bt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Nt.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},n(K,"BandAxis"),K),J,_i=(J=class extends Ft{constructor(t,i,e,a,g){super(t,a,g,i),this.domain=e,this.scale=zt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=zt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},n(J,"LinearAxis"),J);function wt(s,t,i,e){let a=new Yt(e);return St(s)?new Si(t,i,s.categories,s.title,a):new _i(t,i,[s.min,s.max],s.title,a)}n(wt,"getAxis");var q,Ti=(q=class{constructor(t,i,e,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),a=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=a&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=a,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},n(q,"ChartTitle"),q);function Xt(s,t,i,e){let a=new Yt(e);return new Ti(a,s,t,i)}n(Xt,"getChartTitleComponent");var tt,Ri=(tt=class{constructor(t,i,e,a,g){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=a,this.plotIndex=g}getDrawableElement(){let t=this.plotData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),i;return this.orientation==="horizontal"?i=Ot().y(e=>e[0]).x(e=>e[1])(t):i=Ot().x(e=>e[0]).y(e=>e[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},n(tt,"LinePlot"),tt),it,Di=(it=class{constructor(t,i,e,a,g,u){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=a,this.orientation=g,this.plotIndex=u}getDrawableElement(){let t=this.barData.data.map(a=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),e=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:this.boundingRect.x,y:a[0]-e,height:i,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:a[0]-e,y:a[1],width:i,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},n(it,"BarPlot"),it),et,Li=(et=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{let a=new Ri(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break;case"bar":{let a=new Di(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break}return t}},n(et,"BasePlot"),et);function Ht(s,t,i){return new Li(s,t,i)}n(Ht,"getPlotComponent");var st,Pi=(st=class{constructor(t,i,e,a){this.chartConfig=t,this.chartData=i,this.componentStore={title:Xt(t,i,e,a),plot:Ht(t,i,e),xAxis:wt(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},a),yAxis:wt(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},a)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,a=0,g=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),u=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),m=this.componentStore.plot.calculateSpace({width:g,height:u});t-=m.width,i-=m.height,m=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),a=m.height,i-=m.height,this.componentStore.xAxis.setAxisPosition("bottom"),m=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=m.height,this.componentStore.yAxis.setAxisPosition("left"),m=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=m.width,t-=m.width,t>0&&(g+=t,t=0),i>0&&(u+=i,i=0),this.componentStore.plot.calculateSpace({width:g,height:u}),this.componentStore.plot.setBoundingBoxXY({x:e,y:a}),this.componentStore.xAxis.setRange([e,e+g]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:a+u}),this.componentStore.yAxis.setRange([a,a+u]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(b=>At(b))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,a=0,g=0,u=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),m=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),b=this.componentStore.plot.calculateSpace({width:u,height:m});t-=b.width,i-=b.height,b=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=b.height,i-=b.height,this.componentStore.xAxis.setAxisPosition("left"),b=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=b.width,a=b.width,this.componentStore.yAxis.setAxisPosition("top"),b=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=b.height,g=e+b.height,t>0&&(u+=t,t=0),i>0&&(m+=i,i=0),this.componentStore.plot.calculateSpace({width:u,height:m}),this.componentStore.plot.setBoundingBoxXY({x:a,y:g}),this.componentStore.yAxis.setRange([a,a+u]),this.componentStore.yAxis.setBoundingBoxXY({x:a,y:e}),this.componentStore.xAxis.setRange([g,g+m]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:g}),this.chartData.plots.some(E=>At(E))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},n(st,"Orchestrator"),st),at,vi=(at=class{static build(t,i,e,a){return new Pi(t,i,e,a).getDrawableElement()}},n(at,"XYChartBuilder"),at),nt=0,Ut,ht=Rt(),ot=Tt(),y=Dt(),Ct=ot.plotColorPalette.split(",").map(s=>s.trim()),gt=!1,_t=!1;function Tt(){let s=wi(),t=kt();return Vt(s.xyChart,t.themeVariables.xyChart)}n(Tt,"getChartDefaultThemeConfig");function Rt(){let s=kt();return Vt(Ai.xyChart,s.xyChart)}n(Rt,"getChartDefaultConfig");function Dt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}n(Dt,"getChartDefaultData");function ut(s){let t=kt();return bi(s.trim(),t)}n(ut,"textSanitizer");function Gt(s){Ut=s}n(Gt,"setTmpSVGG");function jt(s){s==="horizontal"?ht.chartOrientation="horizontal":ht.chartOrientation="vertical"}n(jt,"setOrientation");function Qt(s){y.xAxis.title=ut(s.text)}n(Qt,"setXAxisTitle");function Lt(s,t){y.xAxis={type:"linear",title:y.xAxis.title,min:s,max:t},gt=!0}n(Lt,"setXAxisRangeData");function Zt(s){y.xAxis={type:"band",title:y.xAxis.title,categories:s.map(t=>ut(t.text))},gt=!0}n(Zt,"setXAxisBand");function Kt(s){y.yAxis.title=ut(s.text)}n(Kt,"setYAxisTitle");function Jt(s,t){y.yAxis={type:"linear",title:y.yAxis.title,min:s,max:t},_t=!0}n(Jt,"setYAxisRangeData");function qt(s){let t=Math.min(...s),i=Math.max(...s),e=j(y.yAxis)?y.yAxis.min:1/0,a=j(y.yAxis)?y.yAxis.max:-1/0;y.yAxis={type:"linear",title:y.yAxis.title,min:Math.min(e,t),max:Math.max(a,i)}}n(qt,"setYAxisRangeFromPlotData");function Pt(s){let t=[];if(s.length===0)return t;if(!gt){let i=j(y.xAxis)?y.xAxis.min:1/0,e=j(y.xAxis)?y.xAxis.max:-1/0;Lt(Math.min(i,1),Math.max(e,s.length))}if(_t||qt(s),St(y.xAxis)&&(t=y.xAxis.categories.map((i,e)=>[i,s[e]])),j(y.xAxis)){let i=y.xAxis.min,e=y.xAxis.max,a=(e-i)/(s.length-1),g=[];for(let u=i;u<=e;u+=a)g.push(`${u}`);t=g.map((u,m)=>[u,s[m]])}return t}n(Pt,"transformDataWithoutCategory");function vt(s){return Ct[s===0?0:s%Ct.length]}n(vt,"getPlotColorFromPalette");function ti(s,t){let i=Pt(t);y.plots.push({type:"line",strokeFill:vt(nt),strokeWidth:2,data:i}),nt++}n(ti,"setLineData");function ii(s,t){let i=Pt(t);y.plots.push({type:"bar",fill:vt(nt),data:i}),nt++}n(ii,"setBarData");function ei(){if(y.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return y.title=Wt(),vi.build(ht,y,ot,Ut)}n(ei,"getDrawableElem");function si(){return ot}n(si,"getChartThemeConfig");function ai(){return ht}n(ai,"getChartConfig");function ni(){return y}n(ni,"getXYChartData");var Ei=n(function(){mi(),nt=0,ht=Rt(),y=Dt(),ot=Tt(),Ct=ot.plotColorPalette.split(",").map(s=>s.trim()),gt=!1,_t=!1},"clear"),$i={getDrawableElem:ei,clear:Ei,setAccTitle:pi,getAccTitle:di,setDiagramTitle:xi,getDiagramTitle:Wt,getAccDescription:ui,setAccDescription:gi,setOrientation:jt,setXAxisTitle:Qt,setXAxisRangeData:Lt,setXAxisBand:Zt,setYAxisTitle:Kt,setYAxisRangeData:Jt,setLineData:ti,setBarData:ii,setTmpSVGG:Gt,getChartThemeConfig:si,getChartConfig:ai,getXYChartData:ni},Ii=n((s,t,i,e)=>{let a=e.db,g=a.getChartThemeConfig(),u=a.getChartConfig(),m=a.getXYChartData().plots[0].data.map(p=>p[1]);function b(p){return p==="top"?"text-before-edge":"middle"}n(b,"getDominantBaseLine");function E(p){return p==="left"?"start":p==="right"?"end":"middle"}n(E,"getTextAnchor");function B(p){return`translate(${p.x}, ${p.y}) rotate(${p.rotation||0})`}n(B,"getTextTransformation"),Nt.debug(`Rendering xychart chart
7
- `+s);let R=fi(t),$=R.append("g").attr("class","main"),W=$.append("rect").attr("width",u.width).attr("height",u.height).attr("class","background");yi(R,u.height,u.width,!0),R.attr("viewBox",`0 0 ${u.width} ${u.height}`),W.attr("fill",g.backgroundColor),a.setTmpSVGG(R.append("g").attr("class","mermaid-tmp-group"));let N=a.getDrawableElem(),D={};function z(p){let C=$,r="";for(let[I]of p.entries()){let O=$;I>0&&D[r]&&(O=D[r]),r+=p[I],C=D[r],C||(C=D[r]=O.append("g").attr("class",p[I]))}return C}n(z,"getGroup");for(let p of N){if(p.data.length===0)continue;let C=z(p.groupTexts);switch(p.type){case"rect":if(C.selectAll("rect").data(p.data).enter().append("rect").attr("x",r=>r.x).attr("y",r=>r.y).attr("width",r=>r.width).attr("height",r=>r.height).attr("fill",r=>r.fill).attr("stroke",r=>r.strokeFill).attr("stroke-width",r=>r.strokeWidth),u.showDataLabel){let r=u.showDataLabelOutsideBar;if(u.chartOrientation==="horizontal"){let I=function(x,w){let{data:L,label:k}=x;return w*k.length*.7<=L.width-10};n(I,"fitsHorizontally");let O=p.data.map((x,w)=>({data:x,label:m[w].toString()})).filter(x=>x.data.width>0&&x.data.height>0),U=O.map(x=>{let{data:w}=x,L=w.height*.7;for(;!I(x,L)&&L>0;)L-=1;return L}),Y=Math.floor(Math.min(...U)),A=n(x=>r?x.data.x+x.data.width+10:x.data.x+x.data.width-10,"determineLabelXPosition");C.selectAll("text").data(O).enter().append("text").attr("x",A).attr("y",x=>x.data.y+x.data.height/2).attr("text-anchor",r?"start":"end").attr("dominant-baseline","middle").attr("fill",g.dataLabelColor).attr("font-size",`${Y}px`).text(x=>x.label)}else{let I=function(x,w,L){let{data:k,label:xt}=x,F=w*xt.length*.7,P=k.x+k.width/2,o=P-F/2,l=P+F/2,c=o>=k.x&&l<=k.x+k.width,f=k.y+L+w<=k.y+k.height;return c&&f};n(I,"fitsInBar");let O=p.data.map((x,w)=>({data:x,label:m[w].toString()})).filter(x=>x.data.width>0&&x.data.height>0),U=O.map(x=>{let{data:w,label:L}=x,k=w.width/(L.length*.7);for(;!I(x,k,10)&&k>0;)k-=1;return k}),Y=Math.floor(Math.min(...U)),A=n(x=>r?x.data.y-10:x.data.y+10,"determineLabelYPosition");C.selectAll("text").data(O).enter().append("text").attr("x",x=>x.data.x+x.data.width/2).attr("y",A).attr("text-anchor","middle").attr("dominant-baseline",r?"auto":"hanging").attr("fill",g.dataLabelColor).attr("font-size",`${Y}px`).text(x=>x.label)}}break;case"text":C.selectAll("text").data(p.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",r=>r.fill).attr("font-size",r=>r.fontSize).attr("dominant-baseline",r=>b(r.verticalPos)).attr("text-anchor",r=>E(r.horizontalPos)).attr("transform",r=>B(r)).text(r=>r.text);break;case"path":C.selectAll("path").data(p.data).enter().append("path").attr("d",r=>r.path).attr("fill",r=>r.fill?r.fill:"none").attr("stroke",r=>r.strokeFill).attr("stroke-width",r=>r.strokeWidth);break}}},"draw"),Mi={draw:Ii},Oi={parser:ki,db:$i,renderer:Mi};export{Oi as diagram};
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:n(function(){var o=this.next();return o||this.lex()},"lex"),begin:n(function(o){this.conditionStack.push(o)},"begin"),popState:n(function(){var o=this.conditionStack.length-1;return o>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:n(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:n(function(o){return o=this.conditionStack.length-1-Math.abs(o||0),o>=0?this.conditionStack[o]:"INITIAL"},"topState"),pushState:n(function(o){this.begin(o)},"pushState"),stateStackSize:n(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:n(function(o,l,c,f){switch(c){case 0:break;case 1:break;case 2:return this.popState(),34;case 3:return this.popState(),34;case 4:return 34;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 31;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 27;case 25:return this.popState(),26;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 44:break;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return P}();k.lexer=xt;function F(){this.yy={}}return n(F,"Parser"),F.prototype=k,k.Parser=F,new F}();bt.parser=bt;var ki=bt;function At(s){return s.type==="bar"}n(At,"isBarPlot");function St(s){return s.type==="band"}n(St,"isBandAxisData");function G(s){return s.type==="linear"}n(G,"isLinearAxisData");var Q,Yt=(Q=class{constructor(t){this.parentGroup=t}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((g,u)=>Math.max(u.length,g),0)*i,height:i};let e={width:0,height:0},a=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let g of t){let u=Ci(a,1,g),m=u?u.width:g.length*i,b=u?u.height:i;e.width=Math.max(e.width,m),e.height=Math.max(e.height,b)}return a.remove(),e}},n(Q,"TextDimensionCalculatorWithFont"),Q),Z,Ft=(Z=class{constructor(t,i,e,a){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),a=.2*t.width;this.outerPadding=Math.min(e.width/2,a);let g=e.height+this.axisConfig.labelPadding*2;this.labelTextHeight=e.height,g<=i&&(i-=g,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),a=.2*t.height;this.outerPadding=Math.min(e.height/2,a);let g=e.width+this.axisConfig.labelPadding*2;g<=i&&(i-=g,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let e=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=e.height+this.axisConfig.titlePadding*2;this.titleTextHeight=e.height,a<=i&&(i-=a,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${i},${this.getScaleValue(e)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(e)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i} L ${this.getScaleValue(e)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(i=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(e=>({path:`M ${this.getScaleValue(e)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(e)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},n(Z,"BaseAxis"),Z),K,Si=(K=class extends Ft{constructor(t,i,e,a,g){super(t,a,g,i),this.categories=e,this.scale=Bt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=Bt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),Nt.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},n(K,"BandAxis"),K),J,_i=(J=class extends Ft{constructor(t,i,e,a,g){super(t,a,g,i),this.domain=e,this.scale=zt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=zt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}},n(J,"LinearAxis"),J);function wt(s,t,i,e){let a=new Yt(e);return St(s)?new Si(t,i,s.categories,s.title,a):new _i(t,i,[s.min,s.max],s.title,a)}n(wt,"getAxis");var q,Ti=(q=class{constructor(t,i,e,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),a=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=a&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=a,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}},n(q,"ChartTitle"),q);function Xt(s,t,i,e){let a=new Yt(e);return new Ti(a,s,t,i)}n(Xt,"getChartTitleComponent");var tt,Ri=(tt=class{constructor(t,i,e,a,g){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=a,this.plotIndex=g}getDrawableElement(){let t=this.plotData.data.map(e=>[this.xAxis.getScaleValue(e[0]),this.yAxis.getScaleValue(e[1])]),i;return this.orientation==="horizontal"?i=Ot().y(e=>e[0]).x(e=>e[1])(t):i=Ot().x(e=>e[0]).y(e=>e[1])(t),i?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},n(tt,"LinePlot"),tt),it,Di=(it=class{constructor(t,i,e,a,g,u){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=a,this.orientation=g,this.plotIndex=u}getDrawableElement(){let t=this.barData.data.map(a=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),e=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:this.boundingRect.x,y:a[0]-e,height:i,width:a[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(a=>({x:a[0]-e,y:a[1],width:i,height:this.boundingRect.y+this.boundingRect.height-a[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},n(it,"BarPlot"),it),et,Li=(et=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{let a=new Ri(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break;case"bar":{let a=new Di(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break}return t}},n(et,"BasePlot"),et);function Ht(s,t,i){return new Li(s,t,i)}n(Ht,"getPlotComponent");var st,Pi=(st=class{constructor(t,i,e,a){this.chartConfig=t,this.chartData=i,this.componentStore={title:Xt(t,i,e,a),plot:Ht(t,i,e),xAxis:wt(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},a),yAxis:wt(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},a)}}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,a=0,g=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),u=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),m=this.componentStore.plot.calculateSpace({width:g,height:u});t-=m.width,i-=m.height,m=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),a=m.height,i-=m.height,this.componentStore.xAxis.setAxisPosition("bottom"),m=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=m.height,this.componentStore.yAxis.setAxisPosition("left"),m=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=m.width,t-=m.width,t>0&&(g+=t,t=0),i>0&&(u+=i,i=0),this.componentStore.plot.calculateSpace({width:g,height:u}),this.componentStore.plot.setBoundingBoxXY({x:e,y:a}),this.componentStore.xAxis.setRange([e,e+g]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:a+u}),this.componentStore.yAxis.setRange([a,a+u]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(b=>At(b))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,a=0,g=0,u=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),m=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),b=this.componentStore.plot.calculateSpace({width:u,height:m});t-=b.width,i-=b.height,b=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=b.height,i-=b.height,this.componentStore.xAxis.setAxisPosition("left"),b=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=b.width,a=b.width,this.componentStore.yAxis.setAxisPosition("top"),b=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=b.height,g=e+b.height,t>0&&(u+=t,t=0),i>0&&(m+=i,i=0),this.componentStore.plot.calculateSpace({width:u,height:m}),this.componentStore.plot.setBoundingBoxXY({x:a,y:g}),this.componentStore.yAxis.setRange([a,a+u]),this.componentStore.yAxis.setBoundingBoxXY({x:a,y:e}),this.componentStore.xAxis.setRange([g,g+m]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:g}),this.chartData.plots.some(E=>At(E))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},n(st,"Orchestrator"),st),at,vi=(at=class{static build(t,i,e,a){return new Pi(t,i,e,a).getDrawableElement()}},n(at,"XYChartBuilder"),at),nt=0,Ut,ht=Rt(),ot=Tt(),y=Dt(),Ct=ot.plotColorPalette.split(",").map(s=>s.trim()),gt=!1,_t=!1;function Tt(){let s=wi(),t=kt();return Vt(s.xyChart,t.themeVariables.xyChart)}n(Tt,"getChartDefaultThemeConfig");function Rt(){let s=kt();return Vt(Ai.xyChart,s.xyChart)}n(Rt,"getChartDefaultConfig");function Dt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}n(Dt,"getChartDefaultData");function ut(s){let t=kt();return bi(s.trim(),t)}n(ut,"textSanitizer");function jt(s){Ut=s}n(jt,"setTmpSVGG");function Gt(s){s==="horizontal"?ht.chartOrientation="horizontal":ht.chartOrientation="vertical"}n(Gt,"setOrientation");function Qt(s){y.xAxis.title=ut(s.text)}n(Qt,"setXAxisTitle");function Lt(s,t){y.xAxis={type:"linear",title:y.xAxis.title,min:s,max:t},gt=!0}n(Lt,"setXAxisRangeData");function Zt(s){y.xAxis={type:"band",title:y.xAxis.title,categories:s.map(t=>ut(t.text))},gt=!0}n(Zt,"setXAxisBand");function Kt(s){y.yAxis.title=ut(s.text)}n(Kt,"setYAxisTitle");function Jt(s,t){y.yAxis={type:"linear",title:y.yAxis.title,min:s,max:t},_t=!0}n(Jt,"setYAxisRangeData");function qt(s){let t=Math.min(...s),i=Math.max(...s),e=G(y.yAxis)?y.yAxis.min:1/0,a=G(y.yAxis)?y.yAxis.max:-1/0;y.yAxis={type:"linear",title:y.yAxis.title,min:Math.min(e,t),max:Math.max(a,i)}}n(qt,"setYAxisRangeFromPlotData");function Pt(s){let t=[];if(s.length===0)return t;if(!gt){let i=G(y.xAxis)?y.xAxis.min:1/0,e=G(y.xAxis)?y.xAxis.max:-1/0;Lt(Math.min(i,1),Math.max(e,s.length))}if(_t||qt(s),St(y.xAxis)&&(t=y.xAxis.categories.map((i,e)=>[i,s[e]])),G(y.xAxis)){let i=y.xAxis.min,e=y.xAxis.max,a=(e-i)/(s.length-1),g=[];for(let u=i;u<=e;u+=a)g.push(`${u}`);t=g.map((u,m)=>[u,s[m]])}return t}n(Pt,"transformDataWithoutCategory");function vt(s){return Ct[s===0?0:s%Ct.length]}n(vt,"getPlotColorFromPalette");function ti(s,t){let i=Pt(t);y.plots.push({type:"line",strokeFill:vt(nt),strokeWidth:2,data:i}),nt++}n(ti,"setLineData");function ii(s,t){let i=Pt(t);y.plots.push({type:"bar",fill:vt(nt),data:i}),nt++}n(ii,"setBarData");function ei(){if(y.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return y.title=Wt(),vi.build(ht,y,ot,Ut)}n(ei,"getDrawableElem");function si(){return ot}n(si,"getChartThemeConfig");function ai(){return ht}n(ai,"getChartConfig");function ni(){return y}n(ni,"getXYChartData");var Ei=n(function(){mi(),nt=0,ht=Rt(),y=Dt(),ot=Tt(),Ct=ot.plotColorPalette.split(",").map(s=>s.trim()),gt=!1,_t=!1},"clear"),Ii={getDrawableElem:ei,clear:Ei,setAccTitle:pi,getAccTitle:di,setDiagramTitle:xi,getDiagramTitle:Wt,getAccDescription:ui,setAccDescription:gi,setOrientation:Gt,setXAxisTitle:Qt,setXAxisRangeData:Lt,setXAxisBand:Zt,setYAxisTitle:Kt,setYAxisRangeData:Jt,setLineData:ti,setBarData:ii,setTmpSVGG:jt,getChartThemeConfig:si,getChartConfig:ai,getXYChartData:ni},$i=n((s,t,i,e)=>{let a=e.db,g=a.getChartThemeConfig(),u=a.getChartConfig(),m=a.getXYChartData().plots[0].data.map(p=>p[1]);function b(p){return p==="top"?"text-before-edge":"middle"}n(b,"getDominantBaseLine");function E(p){return p==="left"?"start":p==="right"?"end":"middle"}n(E,"getTextAnchor");function B(p){return`translate(${p.x}, ${p.y}) rotate(${p.rotation||0})`}n(B,"getTextTransformation"),Nt.debug(`Rendering xychart chart
7
+ `+s);let R=fi(t),I=R.append("g").attr("class","main"),W=I.append("rect").attr("width",u.width).attr("height",u.height).attr("class","background");yi(R,u.height,u.width,!0),R.attr("viewBox",`0 0 ${u.width} ${u.height}`),W.attr("fill",g.backgroundColor),a.setTmpSVGG(R.append("g").attr("class","mermaid-tmp-group"));let N=a.getDrawableElem(),D={};function z(p){let C=I,r="";for(let[$]of p.entries()){let O=I;$>0&&D[r]&&(O=D[r]),r+=p[$],C=D[r],C||(C=D[r]=O.append("g").attr("class",p[$]))}return C}n(z,"getGroup");for(let p of N){if(p.data.length===0)continue;let C=z(p.groupTexts);switch(p.type){case"rect":if(C.selectAll("rect").data(p.data).enter().append("rect").attr("x",r=>r.x).attr("y",r=>r.y).attr("width",r=>r.width).attr("height",r=>r.height).attr("fill",r=>r.fill).attr("stroke",r=>r.strokeFill).attr("stroke-width",r=>r.strokeWidth),u.showDataLabel){let r=u.showDataLabelOutsideBar;if(u.chartOrientation==="horizontal"){let $=function(x,w){let{data:L,label:k}=x;return w*k.length*.7<=L.width-10};n($,"fitsHorizontally");let O=p.data.map((x,w)=>({data:x,label:m[w].toString()})).filter(x=>x.data.width>0&&x.data.height>0),U=O.map(x=>{let{data:w}=x,L=w.height*.7;for(;!$(x,L)&&L>0;)L-=1;return L}),Y=Math.floor(Math.min(...U)),A=n(x=>r?x.data.x+x.data.width+10:x.data.x+x.data.width-10,"determineLabelXPosition");C.selectAll("text").data(O).enter().append("text").attr("x",A).attr("y",x=>x.data.y+x.data.height/2).attr("text-anchor",r?"start":"end").attr("dominant-baseline","middle").attr("fill",g.dataLabelColor).attr("font-size",`${Y}px`).text(x=>x.label)}else{let $=function(x,w,L){let{data:k,label:xt}=x,F=w*xt.length*.7,P=k.x+k.width/2,o=P-F/2,l=P+F/2,c=o>=k.x&&l<=k.x+k.width,f=k.y+L+w<=k.y+k.height;return c&&f};n($,"fitsInBar");let O=p.data.map((x,w)=>({data:x,label:m[w].toString()})).filter(x=>x.data.width>0&&x.data.height>0),U=O.map(x=>{let{data:w,label:L}=x,k=w.width/(L.length*.7);for(;!$(x,k,10)&&k>0;)k-=1;return k}),Y=Math.floor(Math.min(...U)),A=n(x=>r?x.data.y-10:x.data.y+10,"determineLabelYPosition");C.selectAll("text").data(O).enter().append("text").attr("x",x=>x.data.x+x.data.width/2).attr("y",A).attr("text-anchor","middle").attr("dominant-baseline",r?"auto":"hanging").attr("fill",g.dataLabelColor).attr("font-size",`${Y}px`).text(x=>x.label)}}break;case"text":C.selectAll("text").data(p.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",r=>r.fill).attr("font-size",r=>r.fontSize).attr("dominant-baseline",r=>b(r.verticalPos)).attr("text-anchor",r=>E(r.horizontalPos)).attr("transform",r=>B(r)).text(r=>r.text);break;case"path":C.selectAll("path").data(p.data).enter().append("path").attr("d",r=>r.path).attr("fill",r=>r.fill?r.fill:"none").attr("stroke",r=>r.strokeFill).attr("stroke-width",r=>r.strokeWidth);break}}},"draw"),Mi={draw:$i},Oi={parser:ki,db:Ii,renderer:Mi};export{Oi as diagram};
@@ -27,7 +27,7 @@
27
27
  }
28
28
  })();
29
29
  </script>
30
- <script type="module" crossorigin src="/assets/index-BgeqpYgd.js"></script>
30
+ <script type="module" crossorigin src="/assets/index-B5WxtMpv.js"></script>
31
31
  <link rel="stylesheet" crossorigin href="/assets/index-CT0GtFLZ.css">
32
32
  </head>
33
33
  <body>
@@ -12,27 +12,8 @@
12
12
  */
13
13
 
14
14
  const fs = require('fs');
15
- const os = require('os');
16
15
  const path = require('path');
17
- const { spawnSync, spawn } = require('child_process');
18
-
19
- /**
20
- * Decide whether background auto-reindex is opted in. Two equivalent signals:
21
- * 1. CODRAGRAPH_AUTO_REINDEX=1 in env (good for shells, CI)
22
- * 2. `{ "autoReindex": true }` in ~/.codragraph/config.json (good for GUI
23
- * editor launches on Windows, where shell env doesn't propagate to
24
- * hook child processes reliably)
25
- */
26
- function isAutoReindexEnabled() {
27
- if (process.env.CODRAGRAPH_AUTO_REINDEX === '1') return true;
28
- try {
29
- const configPath = path.join(os.homedir(), '.codragraph', 'config.json');
30
- const config = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
31
- return config && config.autoReindex === true;
32
- } catch {
33
- return false;
34
- }
35
- }
16
+ const { spawnSync } = require('child_process');
36
17
 
37
18
  /**
38
19
  * Read JSON input from stdin synchronously.
@@ -52,7 +33,7 @@ function readInput() {
52
33
  */
53
34
  function findCodraGraphDir(startDir) {
54
35
  let dir = startDir || process.cwd();
55
- for (let i = 0; i < 5; i++) {
36
+ for (let i = 0; i < 8; i++) {
56
37
  const candidate = path.join(dir, '.codragraph');
57
38
  if (fs.existsSync(candidate)) return candidate;
58
39
  const parent = path.dirname(dir);
@@ -138,21 +119,9 @@ function resolveCliPath() {
138
119
  return cliPath;
139
120
  }
140
121
 
141
- function isRunningUnderBun() {
142
- const userAgent = (process.env.npm_config_user_agent || '').toLowerCase();
143
- const execBase = path.basename(process.env.npm_execpath || '').toLowerCase();
144
- return userAgent.startsWith('bun/') || execBase === 'bun' || execBase === 'bun.exe';
145
- }
146
-
147
- function getPackageRunnerArgs(args) {
148
- const useBun = isRunningUnderBun();
149
- if (useBun) return { bin: 'bunx', args: ['@codragraph/cli', ...args] };
150
- return { bin: 'npx', args: ['-y', '@codragraph/cli', ...args] };
151
- }
152
-
153
122
  /**
154
123
  * Spawn a codragraph CLI command synchronously.
155
- * Returns the stderr output (KuzuDB captures stdout at OS level).
124
+ * Returns the stderr output (native graph bindings may capture stdout).
156
125
  */
157
126
  function runCodraGraphCli(cliPath, args, cwd, timeout) {
158
127
  const isWin = process.platform === 'win32';
@@ -164,20 +133,20 @@ function runCodraGraphCli(cliPath, args, cwd, timeout) {
164
133
  stdio: ['pipe', 'pipe', 'pipe'],
165
134
  });
166
135
  }
167
- // Package-runner fallback: on Windows, Node 22's spawn refuses to launch
168
- // `.cmd` shims directly, so route through `cmd /c`. POSIX direct-spawn is fine.
169
- const runner = getPackageRunnerArgs(args);
136
+ // Hot-path hook fallback: try an already-installed binary only. Never invoke
137
+ // npx/bunx from a hook because that can fetch/install packages and make the
138
+ // agent appear hung.
170
139
  if (isWin) {
171
- return spawnSync('cmd', ['/c', runner.bin, ...runner.args], {
140
+ return spawnSync('cmd', ['/c', 'codragraph', ...args], {
172
141
  encoding: 'utf-8',
173
- timeout: timeout + 5000,
142
+ timeout,
174
143
  cwd,
175
144
  stdio: ['pipe', 'pipe', 'pipe'],
176
145
  });
177
146
  }
178
- return spawnSync(runner.bin, runner.args, {
147
+ return spawnSync('codragraph', args, {
179
148
  encoding: 'utf-8',
180
- timeout: timeout + 5000,
149
+ timeout,
181
150
  cwd,
182
151
  stdio: ['pipe', 'pipe', 'pipe'],
183
152
  });
@@ -229,11 +198,10 @@ function sendHookResponse(hookEventName, message) {
229
198
  /**
230
199
  * PostToolUse handler — detect index staleness after git mutations.
231
200
  *
232
- * Instead of spawning a full `codragraph analyze` synchronously (which blocks
233
- * the agent for up to 120s and risks KuzuDB corruption on timeout), we do a
234
- * lightweight staleness check: compare `git rev-parse HEAD` against the
235
- * lastCommit stored in `.codragraph/meta.json`. If they differ, notify the
236
- * agent so it can decide when to reindex.
201
+ * Hooks must not own writes to `.codragraph`. They run inside the agent's hot
202
+ * path, so starting analyze from here can contend with MCP/LadybugDB and make
203
+ * normal edits feel hung. Keep this to a cheap metadata comparison and let the
204
+ * user or agent run the CLI explicitly when fresh graph context is required.
237
205
  */
238
206
  function handlePostToolUse(input) {
239
207
  const toolName = input.tool_name || '';
@@ -283,85 +251,10 @@ function handlePostToolUse(input) {
283
251
  const analyzeArgs = `analyze${hadEmbeddings ? ' --embeddings' : ''}`;
284
252
  const analyzeCmd = `npx @codragraph/cli ${analyzeArgs} (or bunx @codragraph/cli ${analyzeArgs})`;
285
253
 
286
- // Opt-in background auto-reindex.
287
- // Default stays as notification-only because spawning analyze while an MCP
288
- // server holds LadybugDB will fail with a database-busy error — the
289
- // notification path lets the agent reindex at a quiet moment instead.
290
- // Power users who run MCP outside Claude Code's lifecycle can opt in via
291
- // CODRAGRAPH_AUTO_REINDEX=1 or `{ "autoReindex": true }` in
292
- // ~/.codragraph/config.json.
293
- if (isAutoReindexEnabled()) {
294
- // The "coalesce" file is a single-process gate: it exists only while a
295
- // reindex is in flight. The spawned analyze removes it on exit (success or
296
- // failure) via CODRAGRAPH_REINDEX_LOCK_PATH; the 10-min mtime fallback
297
- // catches the rare crash that bypasses analyze's exit handler.
298
- const coalescePath = path.join(codragraphDir, '.reindex.coalesce');
299
- const crashSafetyTtlMs = 10 * 60 * 1000;
300
- let inFlight = false;
301
- try {
302
- const stat = fs.statSync(coalescePath);
303
- if (Date.now() - stat.mtimeMs < crashSafetyTtlMs) inFlight = true;
304
- } catch {
305
- /* no coalesce file — no reindex in flight */
306
- }
307
-
308
- if (!inFlight) {
309
- try {
310
- fs.writeFileSync(coalescePath, String(process.pid));
311
- } catch {
312
- /* best-effort — gate is for coalescing, not correctness */
313
- }
314
-
315
- const cliPath = resolveCliPath();
316
- const reindexArgs = hadEmbeddings
317
- ? ['analyze', '--embeddings', '--no-setup']
318
- : ['analyze', '--no-setup'];
319
- const spawnEnv = { ...process.env, CODRAGRAPH_REINDEX_LOCK_PATH: coalescePath };
320
- const spawnOpts = {
321
- cwd,
322
- detached: true,
323
- stdio: 'ignore',
324
- windowsHide: true,
325
- env: spawnEnv,
326
- };
327
- try {
328
- let child;
329
- if (cliPath) {
330
- child = spawn(process.execPath, [cliPath, ...reindexArgs], spawnOpts);
331
- } else if (process.platform === 'win32') {
332
- const runner = getPackageRunnerArgs(reindexArgs);
333
- child = spawn('cmd', ['/c', runner.bin, ...runner.args], spawnOpts);
334
- } else {
335
- const runner = getPackageRunnerArgs(reindexArgs);
336
- child = spawn(runner.bin, runner.args, spawnOpts);
337
- }
338
- child.unref();
339
- } catch {
340
- /* spawn failed — fall through to notification */
341
- }
342
-
343
- sendHookResponse(
344
- 'PostToolUse',
345
- `CodraGraph: auto-reindex started in background ` +
346
- `(HEAD ${lastCommit ? lastCommit.slice(0, 7) : 'never'} → ${currentHead.slice(0, 7)}). ` +
347
- `If an MCP server is currently holding the database, the reindex will fail silently — ` +
348
- `run \`${analyzeCmd}\` manually after closing the agent session.`,
349
- );
350
- return;
351
- }
352
-
353
- sendHookResponse(
354
- 'PostToolUse',
355
- `CodraGraph: auto-reindex coalesced — another reindex is in flight (will pick up your latest commit when it finishes).`,
356
- );
357
- return;
358
- }
359
-
360
254
  sendHookResponse(
361
255
  'PostToolUse',
362
256
  `CodraGraph index is stale (last indexed: ${lastCommit ? lastCommit.slice(0, 7) : 'never'}). ` +
363
- `Run \`${analyzeCmd}\` to update the knowledge graph. ` +
364
- `Set CODRAGRAPH_AUTO_REINDEX=1 (or autoReindex: true in ~/.codragraph/config.json) for background auto-reindex.`,
257
+ `Run \`${analyzeCmd}\` when you need fresh graph context. Hooks never start analyze in the background.`,
365
258
  );
366
259
  }
367
260
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codragraph/cli",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Graph-powered code intelligence for AI agents. Index any codebase, query via MCP or CLI.",
5
5
  "author": {
6
6
  "name": "Thinqmesh Technologies",