cc-viewer 1.7.7 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/App-Bs6-c4Ov.css +1 -0
  3. package/dist/assets/App-DtsIVPu6.js +2 -0
  4. package/dist/assets/{MdxEditorPanel-BAE_5ssH.js → MdxEditorPanel-DWPAEnpm.js} +1 -1
  5. package/dist/assets/Mobile-DHwMZG4N.js +1 -0
  6. package/dist/assets/ProxyStatsModal-D9lTz0-T.js +1 -0
  7. package/dist/assets/ProxyStatsModal-Dz5GuoUa.css +1 -0
  8. package/dist/assets/abnfDiagram-VRR7QNED-9ax220Vv.js +1 -0
  9. package/dist/assets/arc-Cshrl52z.js +1 -0
  10. package/dist/assets/architectureDiagram-ZJ3FMSHR-QtERolgF.js +1 -0
  11. package/dist/assets/blockDiagram-677ZJIJ3-BaCd4R0Z.js +1 -0
  12. package/dist/assets/{c4Diagram-AHTNJAMY-DigIDzhn.js → c4Diagram-LMCZKHZV-C2QvkF2i.js} +1 -1
  13. package/dist/assets/{channel-5ajs7xDK.js → channel-ClOiNc35.js} +1 -1
  14. package/dist/assets/{chunk-QZHKN3VN-Bg3VPGcJ.js → chunk-2Q5K7J3B-BvZ7-Ft4.js} +1 -1
  15. package/dist/assets/{chunk-YZCP3GAM-BV1RGRqK.js → chunk-32BRIVSS-Dg3PlJIt.js} +1 -1
  16. package/dist/assets/{chunk-FMBD7UC4-DmdCml-0.js → chunk-5VM5RSS4-CMJWLQsQ.js} +1 -1
  17. package/dist/assets/chunk-EX3LRPZG-CmoC-M2G.js +1 -0
  18. package/dist/assets/{chunk-4BX2VUAB-BvwhA1RA.js → chunk-JWPE2WC7-D5RR93-U.js} +1 -1
  19. package/dist/assets/chunk-MOJQB5TN-JXgBLjCY.js +1 -0
  20. package/dist/assets/chunk-RYQCIY6F-gT-v276m.js +1 -0
  21. package/dist/assets/chunk-V7JOEXUC-Cl-E_fxl.js +1 -0
  22. package/dist/assets/{chunk-EDXVE4YY-0ycrM2oE.js → chunk-VR4S4FIN-BR0zG1Ep.js} +1 -1
  23. package/dist/assets/{chunk-55IACEB6-DWO0TwNe.js → chunk-XXDRQBXY-Blw-tThR.js} +1 -1
  24. package/dist/assets/classDiagram-OUVF2IWQ-ClkcbuHu.js +1 -0
  25. package/dist/assets/classDiagram-v2-EOCWNBFH-ClkcbuHu.js +1 -0
  26. package/dist/assets/{cose-bilkent-S5V4N54A-CjAVlyw6.js → cose-bilkent-JH36ORCC-BnDDyyuN.js} +1 -1
  27. package/dist/assets/cynefin-VYW2F7L2-Ch8_Ihra.js +15 -0
  28. package/dist/assets/cynefinDiagram-TSTJHNR4-CuX_xTSU.js +1 -0
  29. package/dist/assets/cytoscape.esm-D0POlJZ1.js +9 -0
  30. package/dist/assets/dagre-VKFMJZFB-DHDO7DUw.js +1 -0
  31. package/dist/assets/diagram-FQU43EPY-CxDVpL25.js +1 -0
  32. package/dist/assets/diagram-G47NLZAW-DHX7L6pT.js +1 -0
  33. package/dist/assets/diagram-NH7WQ7WH-HlwtIdWA.js +1 -0
  34. package/dist/assets/diagram-OA4YK3LP-BnTSu9CG.js +1 -0
  35. package/dist/assets/diagram-WEI45ONY-C712tBJk.js +1 -0
  36. package/dist/assets/ebnfDiagram-CCIWWBDH-DzMcH3cz.js +1 -0
  37. package/dist/assets/erDiagram-Q63AITRT-0fyhQG92.js +1 -0
  38. package/dist/assets/flowDiagram-23GEKE2U-lgfs10IO.js +1 -0
  39. package/dist/assets/{ganttDiagram-T4ZO3ILL-BIxQMxEL.js → ganttDiagram-NO4QXBWP-_4nnZ3ta.js} +1 -1
  40. package/dist/assets/gitGraphDiagram-IHSO6WYX-DrgEKJkZ.js +1 -0
  41. package/dist/assets/graph-CnJdn47S.js +1 -0
  42. package/dist/assets/{index-Batfx707.js → index-7VeS_xrl.js} +1 -1
  43. package/dist/assets/{index-BbuqKcgW.js → index-BJ9Xm7_G.js} +1 -1
  44. package/dist/assets/{index-BVkdlwjO.js → index-BiYKFU6w.js} +1 -1
  45. package/dist/assets/{index-Bp83Qa3f.js → index-By8aqIvN.js} +2 -2
  46. package/dist/assets/{index-CaTBBfzw.js → index-CBix0zSu.js} +1 -1
  47. package/dist/assets/{index-BsRFLaCT.js → index-CPAQ767L.js} +1 -1
  48. package/dist/assets/{index-CyMcZjWq.js → index-DuUUHxox.js} +1 -1
  49. package/dist/assets/{index-BrmFDbRb.js → index-_pxC-jz_.js} +1 -1
  50. package/dist/assets/infoDiagram-FWYZ7A6U-Cki8RIbq.js +1 -0
  51. package/dist/assets/{ishikawaDiagram-UXIWVN3A-B631W1wW.js → ishikawaDiagram-FXEZZL3T-DHHu_UGe.js} +1 -1
  52. package/dist/assets/{journeyDiagram-VCZTEJTY-ChtGieBW.js → journeyDiagram-5HDEW3XC-Bx06Sp3y.js} +1 -1
  53. package/dist/assets/{jszip.min-MLKd3flP.js → jszip.min-Bn5J9HN-.js} +1 -1
  54. package/dist/assets/{kanban-definition-6JOO6SKY-hLAy-WRt.js → kanban-definition-HUTT4EX6-BuEuKkQp.js} +1 -1
  55. package/dist/assets/layout-CCUE9ZRw.js +1 -0
  56. package/dist/assets/{linear-lKN6YVn3.js → linear-BJRZNsdX.js} +1 -1
  57. package/dist/assets/map-DQeg2hXV.js +1 -0
  58. package/dist/assets/mermaid.core-DH-sQJgr.js +7 -0
  59. package/dist/assets/{mindmap-definition-QFDTVHPH-DLmLjuqG.js → mindmap-definition-LN4V7U3C-DYtgJ2f4.js} +1 -1
  60. package/dist/assets/pegDiagram-2B236MQR-BVN6OIEN.js +1 -0
  61. package/dist/assets/pieDiagram-ENE6RG2P-mVeQtQTD.js +1 -0
  62. package/dist/assets/quadrantDiagram-ABIIQ3AL-Croqf1qH.js +1 -0
  63. package/dist/assets/railroadDiagram-RFXS5EU6-jkGuNfMY.js +1 -0
  64. package/dist/assets/{requirementDiagram-MS252O5E-CfCJaJBw.js → requirementDiagram-TGXJPOKE-Cwb2FU3N.js} +1 -1
  65. package/dist/assets/sankeyDiagram-HTMAVEWB-D-HWOuX0.js +1 -0
  66. package/dist/assets/seqResourceLoaders-C-pxCjNh.js +2 -0
  67. package/dist/assets/sequenceDiagram-DBY2YBRQ-Bh3XgPxy.js +1 -0
  68. package/dist/assets/sizeCapture-X5ZJPWSS-C_acEkFf.js +1 -0
  69. package/dist/assets/stateDiagram-2N3HPSRC-CmbRj6R7.js +1 -0
  70. package/dist/assets/stateDiagram-v2-6OUMAXLB-ClrX-Ofc.js +1 -0
  71. package/dist/assets/swimlanes-5IMT3BWC-CIfoRrLM.js +2 -0
  72. package/dist/assets/swimlanesDiagram-G3AALYLV-DZuW0-dQ.js +1 -0
  73. package/dist/assets/{timeline-definition-GMOUNBTQ-Bm3Lk96s.js → timeline-definition-FHXFAJF6-CK8MkCLz.js} +1 -1
  74. package/dist/assets/vendor-antd-DNUTLr77.js +17 -0
  75. package/dist/assets/{vendor-codemirror-BD02EJx5.js → vendor-codemirror-6ck0hLRU.js} +1 -1
  76. package/dist/assets/vendor-markdown-DBlfs4dR.js +3 -0
  77. package/dist/assets/vendor-mdxeditor-DT0rad22.js +2 -0
  78. package/dist/assets/vendor-qrcode-CPmWG6hm.js +6 -0
  79. package/dist/assets/vendor-virtuoso-YwK7i7L6.js +1 -0
  80. package/dist/assets/{vennDiagram-DHZGUBPP-CA8MWsbD.js → vennDiagram-L72KCM5P-CWA2Gdi_.js} +1 -1
  81. package/dist/assets/wardleyDiagram-EHGQE667-U22kgZ8v.js +1 -0
  82. package/dist/assets/xychartDiagram-FW5EYKEG-BiGsMUKC.js +1 -0
  83. package/dist/index.html +4 -4
  84. package/findcc.js +96 -4
  85. package/package.json +1 -1
  86. package/server/lib/proxy-stats.js +75 -32
  87. package/dist/assets/App-BfzeNwOB.css +0 -1
  88. package/dist/assets/App-Bqz6Y5h4.js +0 -2
  89. package/dist/assets/Mobile-2LDWfaUe.js +0 -1
  90. package/dist/assets/UnifiedProxyRetryPage-CFz4vOH5.css +0 -1
  91. package/dist/assets/UnifiedProxyRetryPage-DFyS9doh.js +0 -1
  92. package/dist/assets/_baseUniq-BkQkqbX3.js +0 -1
  93. package/dist/assets/arc-BKY9CS7c.js +0 -1
  94. package/dist/assets/architectureDiagram-Q4EWVU46-f8VVp6F9.js +0 -1
  95. package/dist/assets/blockDiagram-DXYQGD6D-3h2PkZUH.js +0 -1
  96. package/dist/assets/chunk-4TB4RGXK-GHcSNG2k.js +0 -1
  97. package/dist/assets/chunk-OYMX7WX6-fg2n9B_W.js +0 -1
  98. package/dist/assets/classDiagram-6PBFFD2Q-CnUCTEpg.js +0 -1
  99. package/dist/assets/classDiagram-v2-HSJHXN6E-CnUCTEpg.js +0 -1
  100. package/dist/assets/clone-D0NlqTo0.js +0 -1
  101. package/dist/assets/cytoscape.esm-CT1mZavR.js +0 -9
  102. package/dist/assets/dagre-KV5264BT-DZV42aOy.js +0 -1
  103. package/dist/assets/diagram-5BDNPKRD-DpDA9ZeE.js +0 -1
  104. package/dist/assets/diagram-G4DWMVQ6-86vmHGG_.js +0 -1
  105. package/dist/assets/diagram-MMDJMWI5-CzLVfy9C.js +0 -1
  106. package/dist/assets/diagram-TYMM5635-C1n6QVNv.js +0 -1
  107. package/dist/assets/erDiagram-SMLLAGMA-BWST8PqT.js +0 -1
  108. package/dist/assets/flowDiagram-DWJPFMVM-zfku-qzI.js +0 -1
  109. package/dist/assets/gitGraphDiagram-UUTBAWPF-E7gXMGl0.js +0 -1
  110. package/dist/assets/graph-Chi_Do3A.js +0 -1
  111. package/dist/assets/infoDiagram-42DDH7IO-CJSIzH2A.js +0 -1
  112. package/dist/assets/layout-cxTukSs_.js +0 -1
  113. package/dist/assets/mermaid.core-BYpzUgET.js +0 -7
  114. package/dist/assets/min-BvhzyJ7G.js +0 -1
  115. package/dist/assets/pieDiagram-DEJITSTG-CpQId_ss.js +0 -1
  116. package/dist/assets/quadrantDiagram-34T5L4WZ-B2xWOHsh.js +0 -1
  117. package/dist/assets/sankeyDiagram-XADWPNL6-CSClMzTh.js +0 -1
  118. package/dist/assets/seqResourceLoaders-DIUJh1ym.js +0 -2
  119. package/dist/assets/sequenceDiagram-FGHM5R23-D5WoARR1.js +0 -1
  120. package/dist/assets/stateDiagram-FHFEXIEX-DC1_JCl1.js +0 -1
  121. package/dist/assets/stateDiagram-v2-QKLJ7IA2-BOndcGRp.js +0 -1
  122. package/dist/assets/vendor-antd-CyudKxuD.js +0 -17
  123. package/dist/assets/vendor-markdown-DOJHsAxX.js +0 -3
  124. package/dist/assets/vendor-mdxeditor-C3Q4i3LX.js +0 -2
  125. package/dist/assets/vendor-qrcode-DK9W5Ghb.js +0 -6
  126. package/dist/assets/vendor-virtuoso-C82iSAZx.js +0 -1
  127. package/dist/assets/wardley-RL74JXVD-Dw7GlJWj.js +0 -1
  128. package/dist/assets/wardleyDiagram-NUSXRM2D-woq7iHEC.js +0 -1
  129. package/dist/assets/xychartDiagram-5P7HB3ND-B4JCiFF4.js +0 -1
@@ -0,0 +1 @@
1
+ var _a;import{p as populateCommonDb}from"./chunk-JWPE2WC7-D5RR93-U.js";import{s as setAccDescription,g as getAccDescription,o as getDiagramTitle,n as setDiagramTitle,a as getAccTitle,b as setAccTitle,_ as __name,E as getThemeVariables3,y as getConfig,A as cleanAndMerge,l as log,D as selectSvgElement,e as configureSvgSize,p as clear,c as getConfig2}from"./mermaid.core-DH-sQJgr.js";import{p as parse}from"./cynefin-VYW2F7L2-Ch8_Ihra.js";import"./vendor-mdxeditor-DT0rad22.js";import"./vendor-antd-DNUTLr77.js";import"./vendor-codemirror-6ck0hLRU.js";import"./vendor-markdown-DBlfs4dR.js";var toPercent=__name((value,context)=>{const normalized=value<=1?100*value:value;if(normalized<0||normalized>100)throw new Error(`${context} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${value}`);return normalized},"toPercent"),toCoordinates=__name((visibility,evolution,context)=>({x:toPercent(evolution,`${context} evolution`),y:toPercent(visibility,`${context} visibility`)}),"toCoordinates"),getFlowFromPort=__name(port=>{if(port)return"+<>"===port?"bidirectional":"+<"===port?"backward":"+>"===port?"forward":void 0},"getFlowFromPort"),extractFlowFromArrow=__name(arrow=>{if(!(null==arrow?void 0:arrow.startsWith("+")))return{};const labelMatch=/^\+'([^']*)'/.exec(arrow),flowLabel=null==labelMatch?void 0:labelMatch[1];return arrow.includes("<>")?{flow:"bidirectional",label:flowLabel}:arrow.includes("<")?{flow:"backward",label:flowLabel}:arrow.includes(">")?{flow:"forward",label:flowLabel}:{label:flowLabel}},"extractFlowFromArrow"),populateDb=__name((ast,db)=>{if(populateCommonDb(ast,db),ast.size&&db.setSize(ast.size.width,ast.size.height),ast.evolution){const stages=ast.evolution.stages.map(stage=>stage.secondName?`${stage.name.trim()} / ${stage.secondName.trim()}`:stage.name.trim()),stageBoundaries=ast.evolution.stages.filter(stage=>void 0!==stage.boundary).map(stage=>stage.boundary);db.updateAxes({stages:stages,stageBoundaries:stageBoundaries})}if(ast.anchors.forEach(anchor=>{const coords=toCoordinates(anchor.visibility,anchor.evolution,`Anchor "${anchor.name}"`);db.addNode(anchor.name,anchor.name,coords.x,coords.y,"anchor")}),ast.components.forEach(component=>{var _a2;const coords=toCoordinates(component.visibility,component.evolution,`Component "${component.name}"`),labelOffsetX=component.label?(component.label.negX?-1:1)*component.label.offsetX:void 0,labelOffsetY=component.label?(component.label.negY?-1:1)*component.label.offsetY:void 0,sourceStrategy=null==(_a2=component.decorator)?void 0:_a2.strategy;db.addNode(component.name,component.name,coords.x,coords.y,"component",labelOffsetX,labelOffsetY,component.inertia,sourceStrategy)}),ast.notes.forEach(note=>{const coords=toCoordinates(note.visibility,note.evolution,`Note "${note.text}"`);db.addNote(note.text,coords.x,coords.y)}),ast.pipelines.forEach(pipeline=>{const parentNode=db.getNode(pipeline.parent);if(!parentNode||"number"!=typeof parentNode.y)throw new Error(`Pipeline "${pipeline.parent}" must reference an existing component with coordinates.`);const parentY=parentNode.y;db.startPipeline(pipeline.parent),pipeline.components.forEach(component=>{const componentId=`${pipeline.parent}_${component.name}`,labelOffsetX=component.label?(component.label.negX?-1:1)*component.label.offsetX:void 0,labelOffsetY=component.label?(component.label.negY?-1:1)*component.label.offsetY:void 0,x=toPercent(component.evolution,`Pipeline component "${component.name}" evolution`);db.addNode(componentId,component.name,x,parentY,"pipeline-component",labelOffsetX,labelOffsetY),db.addPipelineComponent(pipeline.parent,componentId)})}),ast.links.forEach(link=>{const isDashed=!!link.arrow&&(link.arrow.includes("-.->")||link.arrow.includes(".-."));let flow=getFlowFromPort(link.fromPort)??getFlowFromPort(link.toPort);const{flow:arrowFlow,label:flowLabel}=extractFlowFromArrow(link.arrow);!flow&&arrowFlow&&(flow=arrowFlow);const annotation=link.linkLabel,label=flowLabel??annotation;db.addLink(db.resolveNodeId(link.from),db.resolveNodeId(link.to),isDashed,label,flow)}),ast.evolves.forEach(evolve=>{const node=db.getNode(evolve.component);if(void 0!==(null==node?void 0:node.y)){const target=toPercent(evolve.target,`Evolve target for "${evolve.component}"`);db.addTrend(evolve.component,target,node.y)}}),ast.annotations.length>0){const annotationsBox=ast.annotations[0],coords=toCoordinates(annotationsBox.x,annotationsBox.y,"Annotations box");db.setAnnotationsBox(coords.x,coords.y)}ast.annotation.forEach(annotation=>{const coords=toCoordinates(annotation.x,annotation.y,`Annotation ${annotation.number}`);db.addAnnotation(annotation.number,[{x:coords.x,y:coords.y}],annotation.text)}),ast.accelerators.forEach(accelerator=>{const coords=toCoordinates(accelerator.x,accelerator.y,`Accelerator "${accelerator.name}"`);db.addAccelerator(accelerator.name,coords.x,coords.y)}),ast.deaccelerators.forEach(deaccelerator=>{const coords=toCoordinates(deaccelerator.x,deaccelerator.y,`Deaccelerator "${deaccelerator.name}"`);db.addDeaccelerator(deaccelerator.name,coords.x,coords.y)})},"populateDb"),parser={parser:{yy:void 0},parse:__name(async input=>{var _a2;const ast=await parse("wardley",input);log.debug(ast);const db=null==(_a2=parser.parser)?void 0:_a2.yy;if(!db||"function"!=typeof db.addNode)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.");populateDb(ast,db)},"parse")},builder=new(__name(_a=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(node){const existing=this.nodes.get(node.id)??{id:node.id,label:node.label},merged={...existing,...node,className:node.className??existing.className,labelOffsetX:node.labelOffsetX??existing.labelOffsetX,labelOffsetY:node.labelOffsetY??existing.labelOffsetY};this.nodes.set(node.id,merged)}addLink(link){this.links.push(link)}addTrend(trend){this.trends.set(trend.nodeId,trend)}startPipeline(nodeId){this.pipelines.set(nodeId,{nodeId:nodeId,componentIds:[]});const node=this.nodes.get(nodeId);node&&(node.isPipelineParent=!0)}addPipelineComponent(pipelineNodeId,componentId){const pipeline=this.pipelines.get(pipelineNodeId);pipeline&&pipeline.componentIds.push(componentId);const node=this.nodes.get(componentId);node&&(node.inPipeline=!0)}addAnnotation(annotation){this.annotations.push(annotation)}addNote(note){this.notes.push(note)}addAccelerator(accelerator){this.accelerators.push(accelerator)}addDeaccelerator(deaccelerator){this.deaccelerators.push(deaccelerator)}setAnnotationsBox(x,y){this.annotationsBox={x:x,y:y}}setAxes(partial){this.axes={...this.axes,...partial}}setSize(width,height){this.size={width:width,height:height}}getNode(id){return this.nodes.get(id)}resolveNodeId(name){if(this.nodes.has(name))return name;for(const[id,node]of this.nodes)if(node.label===name)return id;return name}build(){const nodes=[];for(const node of this.nodes.values()){if("number"!=typeof node.x||"number"!=typeof node.y)throw new Error(`Node "${node.label}" is missing coordinates`);nodes.push(node)}return{nodes:nodes,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}},"WardleyBuilder"),_a);function getConfig3(){return getConfig2()["wardley-beta"]}function addNode(id,label,x,y,className,labelOffsetX,labelOffsetY,inertia,sourceStrategy){builder.addNode({id:id,label:label,x:x,y:y,className:className,labelOffsetX:labelOffsetX,labelOffsetY:labelOffsetY,inertia:inertia,sourceStrategy:sourceStrategy})}function addLink(sourceId,targetId,dashed=!1,label,flow){builder.addLink({source:sourceId,target:targetId,dashed:dashed,label:label,flow:flow})}function addTrend(nodeId,targetX,targetY){builder.addTrend({nodeId:nodeId,targetX:targetX,targetY:targetY})}function addAnnotation(number,coordinates,text){builder.addAnnotation({number:number,coordinates:coordinates,text:text})}function addNote(text,x,y){builder.addNote({text:text,x:x,y:y})}function addAccelerator(name,x,y){builder.addAccelerator({name:name,x:x,y:y})}function addDeaccelerator(name,x,y){builder.addDeaccelerator({name:name,x:x,y:y})}function setAnnotationsBox(x,y){builder.setAnnotationsBox(x,y)}function setSize(width,height){builder.setSize(width,height)}function startPipeline(nodeId){builder.startPipeline(nodeId)}function addPipelineComponent(pipelineNodeId,componentId){builder.addPipelineComponent(pipelineNodeId,componentId)}function updateAxes(partial){builder.setAxes(partial)}function getNode(id){return builder.getNode(id)}function resolveNodeId(name){return builder.resolveNodeId(name)}function getWardleyData(){return builder.build()}function clear2(){builder.clear(),clear()}__name(getConfig3,"getConfig"),__name(addNode,"addNode"),__name(addLink,"addLink"),__name(addTrend,"addTrend"),__name(addAnnotation,"addAnnotation"),__name(addNote,"addNote"),__name(addAccelerator,"addAccelerator"),__name(addDeaccelerator,"addDeaccelerator"),__name(setAnnotationsBox,"setAnnotationsBox"),__name(setSize,"setSize"),__name(startPipeline,"startPipeline"),__name(addPipelineComponent,"addPipelineComponent"),__name(updateAxes,"updateAxes"),__name(getNode,"getNode"),__name(resolveNodeId,"resolveNodeId"),__name(getWardleyData,"getWardleyData"),__name(clear2,"clear");var wardleyDb_default={getConfig:getConfig3,addNode:addNode,addLink:addLink,addTrend:addTrend,addAnnotation:addAnnotation,addNote:addNote,addAccelerator:addAccelerator,addDeaccelerator:addDeaccelerator,setAnnotationsBox:setAnnotationsBox,setSize:setSize,startPipeline:startPipeline,addPipelineComponent:addPipelineComponent,updateAxes:updateAxes,getNode:getNode,resolveNodeId:resolveNodeId,getWardleyData:getWardleyData,clear:clear2,setAccTitle:setAccTitle,getAccTitle:getAccTitle,setDiagramTitle:setDiagramTitle,getDiagramTitle:getDiagramTitle,getAccDescription:getAccDescription,setAccDescription:setAccDescription},DEFAULT_STAGES=["Genesis","Custom Built","Product","Commodity"],getTheme=__name(()=>{var _a2,_b,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l;const{themeVariables:themeVariables}=getConfig2();return{backgroundColor:(null==(_a2=themeVariables.wardley)?void 0:_a2.backgroundColor)??themeVariables.background??"#fff",axisColor:(null==(_b=themeVariables.wardley)?void 0:_b.axisColor)??"#000",axisTextColor:(null==(_c=themeVariables.wardley)?void 0:_c.axisTextColor)??themeVariables.primaryTextColor??"#222",gridColor:(null==(_d=themeVariables.wardley)?void 0:_d.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:(null==(_e=themeVariables.wardley)?void 0:_e.componentFill)??"#fff",componentStroke:(null==(_f=themeVariables.wardley)?void 0:_f.componentStroke)??"#000",componentLabelColor:(null==(_g=themeVariables.wardley)?void 0:_g.componentLabelColor)??themeVariables.primaryTextColor??"#222",linkStroke:(null==(_h=themeVariables.wardley)?void 0:_h.linkStroke)??"#000",evolutionStroke:(null==(_i=themeVariables.wardley)?void 0:_i.evolutionStroke)??"#dc3545",annotationStroke:(null==(_j=themeVariables.wardley)?void 0:_j.annotationStroke)??"#000",annotationTextColor:(null==(_k=themeVariables.wardley)?void 0:_k.annotationTextColor)??themeVariables.primaryTextColor??"#222",annotationFill:(null==(_l=themeVariables.wardley)?void 0:_l.annotationFill)??themeVariables.background??"#fff"}},"getTheme"),getConfigValues=__name(()=>{const wardleyConfig=getConfig2()["wardley-beta"];return{width:(null==wardleyConfig?void 0:wardleyConfig.width)??900,height:(null==wardleyConfig?void 0:wardleyConfig.height)??600,padding:(null==wardleyConfig?void 0:wardleyConfig.padding)??48,nodeRadius:(null==wardleyConfig?void 0:wardleyConfig.nodeRadius)??6,nodeLabelOffset:(null==wardleyConfig?void 0:wardleyConfig.nodeLabelOffset)??8,axisFontSize:(null==wardleyConfig?void 0:wardleyConfig.axisFontSize)??12,labelFontSize:(null==wardleyConfig?void 0:wardleyConfig.labelFontSize)??10,showGrid:(null==wardleyConfig?void 0:wardleyConfig.showGrid)??!1,useMaxWidth:(null==wardleyConfig?void 0:wardleyConfig.useMaxWidth)??!0}},"getConfigValues"),diagram={parser:parser,db:wardleyDb_default,renderer:{draw:__name((text,id,_version,diagObj)=>{var _a2,_b;log.debug("Rendering Wardley map\n"+text);const configValues=getConfigValues(),theme=getTheme(),squareSize=1.6*configValues.nodeRadius,db=diagObj.db,data=db.getWardleyData(),title=db.getDiagramTitle(),width=(null==(_a2=data.size)?void 0:_a2.width)??configValues.width,height=(null==(_b=data.size)?void 0:_b.height)??configValues.height,svg=selectSvgElement(id);svg.selectAll("*").remove(),configureSvgSize(svg,height,width,configValues.useMaxWidth),svg.attr("viewBox",`0 0 ${width} ${height}`);const root=svg.append("g").attr("class","wardley-map"),defs=svg.append("defs");defs.append("marker").attr("id",`arrow-${id}`).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",theme.evolutionStroke).attr("stroke","none"),defs.append("marker").attr("id",`link-arrow-end-${id}`).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",theme.linkStroke).attr("stroke","none"),defs.append("marker").attr("id",`link-arrow-start-${id}`).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",theme.linkStroke).attr("stroke","none"),root.append("rect").attr("class","wardley-background").attr("width",width).attr("height",height).attr("fill",theme.backgroundColor);const chartWidth=width-2*configValues.padding,chartHeight=height-2*configValues.padding;title&&root.append("text").attr("class","wardley-title").attr("x",width/2).attr("y",configValues.padding/2).attr("fill",theme.axisTextColor).attr("font-size",1.05*configValues.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(title);const projectX=__name(value=>configValues.padding+value/100*chartWidth,"projectX"),projectY=__name(value=>height-configValues.padding-value/100*chartHeight,"projectY"),axisGroup=root.append("g").attr("class","wardley-axes");axisGroup.append("line").attr("x1",configValues.padding).attr("x2",width-configValues.padding).attr("y1",height-configValues.padding).attr("y2",height-configValues.padding).attr("stroke",theme.axisColor).attr("stroke-width",1),axisGroup.append("line").attr("x1",configValues.padding).attr("x2",configValues.padding).attr("y1",configValues.padding).attr("y2",height-configValues.padding).attr("stroke",theme.axisColor).attr("stroke-width",1);const xLabel=data.axes.xLabel??"Evolution",yLabel=data.axes.yLabel??"Visibility";axisGroup.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",configValues.padding+chartWidth/2).attr("y",height-configValues.padding/4).attr("fill",theme.axisTextColor).attr("font-size",configValues.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(xLabel),axisGroup.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",configValues.padding/3).attr("y",configValues.padding+chartHeight/2).attr("fill",theme.axisTextColor).attr("font-size",configValues.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${configValues.padding/3} ${configValues.padding+chartHeight/2})`).text(yLabel);const stages=data.axes.stages&&data.axes.stages.length>0?data.axes.stages:DEFAULT_STAGES;if(stages.length>0){const stageGroup=root.append("g").attr("class","wardley-stages"),boundaries=data.axes.stageBoundaries,stagePositions=[];if(boundaries&&boundaries.length===stages.length){let prevBoundary=0;boundaries.forEach(boundary=>{stagePositions.push({start:prevBoundary,end:boundary}),prevBoundary=boundary})}else{const stageWidth=1/stages.length;stages.forEach((_,index)=>{stagePositions.push({start:index*stageWidth,end:(index+1)*stageWidth})})}stages.forEach((stage,index)=>{const pos=stagePositions[index],startX=configValues.padding+pos.start*chartWidth,centerX=(startX+(configValues.padding+pos.end*chartWidth))/2;index>0&&stageGroup.append("line").attr("x1",startX).attr("x2",startX).attr("y1",configValues.padding).attr("y2",height-configValues.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),stageGroup.append("text").attr("class","wardley-stage-label").attr("x",centerX).attr("y",height-configValues.padding/1.5).attr("fill",theme.axisTextColor).attr("font-size",configValues.axisFontSize-2).attr("text-anchor","middle").text(stage)})}if(configValues.showGrid){const gridGroup=root.append("g").attr("class","wardley-grid");for(let i=1;i<4;i++){const ratio=i/4,x=configValues.padding+chartWidth*ratio;gridGroup.append("line").attr("x1",x).attr("x2",x).attr("y1",configValues.padding).attr("y2",height-configValues.padding).attr("stroke",theme.gridColor).attr("stroke-dasharray","2 6"),gridGroup.append("line").attr("x1",configValues.padding).attr("x2",width-configValues.padding).attr("y1",height-configValues.padding-chartHeight*ratio).attr("y2",height-configValues.padding-chartHeight*ratio).attr("stroke",theme.gridColor).attr("stroke-dasharray","2 6")}}const positions=new Map;if(data.nodes.forEach(node=>{positions.set(node.id,{x:projectX(node.x),y:projectY(node.y),node:node})}),data.pipelines.length>0){const pipelineGroup=root.append("g").attr("class","wardley-pipelines"),pipelineLinksGroup=root.append("g").attr("class","wardley-pipeline-links");data.pipelines.forEach(pipeline=>{if(0===pipeline.componentIds.length)return;const sortedComponents=pipeline.componentIds.map(id2=>({id:id2,pos:positions.get(id2),node:data.nodes.find(n=>n.id===id2)})).filter(c=>c.pos&&c.node).sort((a,b)=>a.node.x-b.node.x);for(let i=0;i<sortedComponents.length-1;i++){const current=sortedComponents[i],next=sortedComponents[i+1];pipelineLinksGroup.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",current.pos.x).attr("y1",current.pos.y).attr("x2",next.pos.x).attr("y2",next.pos.y).attr("stroke",theme.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let minX=1/0,maxX=-1/0,y=0;if(pipeline.componentIds.forEach(componentId=>{const pos=positions.get(componentId);pos&&(minX=Math.min(minX,pos.x),maxX=Math.max(maxX,pos.x),y=pos.y)}),minX!==1/0&&maxX!==-1/0){const padding=15,height2=4*configValues.nodeRadius,boxTop=y-height2/2,parentPos=positions.get(pipeline.nodeId);if(parentPos){const centerX=(minX+maxX)/2;parentPos.x=centerX,parentPos.y=boxTop-squareSize/6}pipelineGroup.append("rect").attr("class","wardley-pipeline-box").attr("x",minX-padding).attr("y",boxTop).attr("width",maxX-minX+2*padding).attr("height",height2).attr("fill","none").attr("stroke",theme.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const linksGroup=root.append("g").attr("class","wardley-links"),pipelineMap=new Map;data.pipelines.forEach(pipeline=>{pipelineMap.set(pipeline.nodeId,new Set(pipeline.componentIds))});const validLinks=data.links.filter(link=>{if(!positions.has(link.source)||!positions.has(link.target))return!1;const pipelineComponents=pipelineMap.get(link.target);return!(null==pipelineComponents?void 0:pipelineComponents.has(link.source))});linksGroup.selectAll("line").data(validLinks).enter().append("line").attr("class",link=>"wardley-link"+(link.dashed?" wardley-link--dashed":"")).attr("x1",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),radius=data.nodes.find(n=>n.id===link.source).isPipelineParent?squareSize/Math.sqrt(2):configValues.nodeRadius,dx=targetPos.x-sourcePos.x,dy=targetPos.y-sourcePos.y,distance=Math.sqrt(dx*dx+dy*dy);return sourcePos.x+dx/distance*radius}).attr("y1",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),radius=data.nodes.find(n=>n.id===link.source).isPipelineParent?squareSize/Math.sqrt(2):configValues.nodeRadius,dx=targetPos.x-sourcePos.x,dy=targetPos.y-sourcePos.y,distance=Math.sqrt(dx*dx+dy*dy);return sourcePos.y+dy/distance*radius}).attr("x2",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),radius=data.nodes.find(n=>n.id===link.target).isPipelineParent?squareSize/Math.sqrt(2):configValues.nodeRadius,dx=sourcePos.x-targetPos.x,dy=sourcePos.y-targetPos.y,distance=Math.sqrt(dx*dx+dy*dy);return targetPos.x+dx/distance*radius}).attr("y2",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),radius=data.nodes.find(n=>n.id===link.target).isPipelineParent?squareSize/Math.sqrt(2):configValues.nodeRadius,dx=sourcePos.x-targetPos.x,dy=sourcePos.y-targetPos.y,distance=Math.sqrt(dx*dx+dy*dy);return targetPos.y+dy/distance*radius}).attr("stroke",theme.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",link=>link.dashed?"6 6":null).attr("marker-end",link=>"forward"===link.flow||"bidirectional"===link.flow?`url(#link-arrow-end-${id})`:null).attr("marker-start",link=>"backward"===link.flow||"bidirectional"===link.flow?`url(#link-arrow-start-${id})`:null),linksGroup.selectAll("text").data(validLinks.filter(link=>link.label)).enter().append("text").attr("class","wardley-link-label").attr("x",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),midX=(sourcePos.x+targetPos.x)/2,dy=targetPos.y-sourcePos.y,dx=targetPos.x-sourcePos.x;return midX+8*(dy/Math.sqrt(dx*dx+dy*dy))}).attr("y",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),midY=(sourcePos.y+targetPos.y)/2,dx=targetPos.x-sourcePos.x,dy=targetPos.y-sourcePos.y;return midY+8*(-dx/Math.sqrt(dx*dx+dy*dy))}).attr("fill",theme.axisTextColor).attr("font-size",configValues.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",link=>{const sourcePos=positions.get(link.source),targetPos=positions.get(link.target),midX=(sourcePos.x+targetPos.x)/2,midY=(sourcePos.y+targetPos.y)/2,dx=targetPos.x-sourcePos.x,dy=targetPos.y-sourcePos.y,distance=Math.sqrt(dx*dx+dy*dy),labelX=midX+8*(dy/distance),labelY=midY+8*(-dx/distance);let angle=180*Math.atan2(dy,dx)/Math.PI;return(angle>90||angle<-90)&&(angle+=180),`rotate(${angle} ${labelX} ${labelY})`}).text(link=>link.label);const trendGroup=root.append("g").attr("class","wardley-trends"),trendsWithPositions=data.trends.map(trend=>{const origin=positions.get(trend.nodeId);if(!origin)return null;const targetX=projectX(trend.targetX),targetY=projectY(trend.targetY),dx=targetX-origin.x,dy=targetY-origin.y,distance=Math.sqrt(dx*dx+dy*dy),shortenBy=configValues.nodeRadius+2;return{origin:origin,targetX:targetX,targetY:targetY,adjustedX2:distance>shortenBy?targetX-dx/distance*shortenBy:targetX,adjustedY2:distance>shortenBy?targetY-dy/distance*shortenBy:targetY}}).filter(trend=>null!==trend);trendGroup.selectAll("line").data(trendsWithPositions).enter().append("line").attr("class","wardley-trend").attr("x1",trend=>trend.origin.x).attr("y1",trend=>trend.origin.y).attr("x2",trend=>trend.adjustedX2).attr("y2",trend=>trend.adjustedY2).attr("stroke",theme.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${id})`);const nodeEnter=root.append("g").attr("class","wardley-nodes").selectAll("g").data(data.nodes).enter().append("g").attr("class",node=>["wardley-node",node.className?`wardley-node--${node.className}`:""].filter(Boolean).join(" "));nodeEnter.filter(node=>"outsource"===node.sourceStrategy).append("circle").attr("class","wardley-outsource-overlay").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y).attr("r",2*configValues.nodeRadius).attr("fill","#666").attr("stroke",theme.componentStroke).attr("stroke-width",1),nodeEnter.filter(node=>"buy"===node.sourceStrategy).append("circle").attr("class","wardley-buy-overlay").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y).attr("r",2*configValues.nodeRadius).attr("fill","#ccc").attr("stroke",theme.componentStroke).attr("stroke-width",1),nodeEnter.filter(node=>"build"===node.sourceStrategy).append("circle").attr("class","wardley-build-overlay").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y).attr("r",2*configValues.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const marketNodes=nodeEnter.filter(node=>"market"===node.sourceStrategy);marketNodes.append("circle").attr("class","wardley-market-overlay").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y).attr("r",2*configValues.nodeRadius).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",1),nodeEnter.filter(node=>!node.isPipelineParent&&"market"!==node.sourceStrategy&&"anchor"!==node.className).append("circle").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y).attr("r",configValues.nodeRadius).attr("fill",theme.componentFill).attr("stroke",theme.componentStroke).attr("stroke-width",1);const smallCircleRadius=.7*configValues.nodeRadius,triangleRadius=1.2*configValues.nodeRadius;if(marketNodes.append("line").attr("class","wardley-market-line").attr("x1",node=>positions.get(node.id).x).attr("y1",node=>positions.get(node.id).y-triangleRadius).attr("x2",node=>positions.get(node.id).x-triangleRadius*Math.cos(Math.PI/6)).attr("y2",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("stroke",theme.componentStroke).attr("stroke-width",1),marketNodes.append("line").attr("class","wardley-market-line").attr("x1",node=>positions.get(node.id).x-triangleRadius*Math.cos(Math.PI/6)).attr("y1",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("x2",node=>positions.get(node.id).x+triangleRadius*Math.cos(Math.PI/6)).attr("y2",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("stroke",theme.componentStroke).attr("stroke-width",1),marketNodes.append("line").attr("class","wardley-market-line").attr("x1",node=>positions.get(node.id).x+triangleRadius*Math.cos(Math.PI/6)).attr("y1",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("x2",node=>positions.get(node.id).x).attr("y2",node=>positions.get(node.id).y-triangleRadius).attr("stroke",theme.componentStroke).attr("stroke-width",1),marketNodes.append("circle").attr("class","wardley-market-dot").attr("cx",node=>positions.get(node.id).x).attr("cy",node=>positions.get(node.id).y-triangleRadius).attr("r",smallCircleRadius).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",2),marketNodes.append("circle").attr("class","wardley-market-dot").attr("cx",node=>positions.get(node.id).x-triangleRadius*Math.cos(Math.PI/6)).attr("cy",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("r",smallCircleRadius).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",2),marketNodes.append("circle").attr("class","wardley-market-dot").attr("cx",node=>positions.get(node.id).x+triangleRadius*Math.cos(Math.PI/6)).attr("cy",node=>positions.get(node.id).y+triangleRadius*Math.sin(Math.PI/6)).attr("r",smallCircleRadius).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",2),nodeEnter.filter(node=>!0===node.isPipelineParent).append("rect").attr("x",node=>positions.get(node.id).x-squareSize/2).attr("y",node=>positions.get(node.id).y-squareSize/2).attr("width",squareSize).attr("height",squareSize).attr("fill",theme.componentFill).attr("stroke",theme.componentStroke).attr("stroke-width",1),nodeEnter.filter(node=>!0===node.inertia).append("line").attr("class","wardley-inertia").attr("x1",node=>{const pos=positions.get(node.id);let offset=node.isPipelineParent?squareSize/2+15:configValues.nodeRadius+15;return node.sourceStrategy&&(offset+=configValues.nodeRadius+10),pos.x+offset}).attr("y1",node=>{const pos=positions.get(node.id),lineHeight=node.isPipelineParent?squareSize:2*configValues.nodeRadius;return pos.y-lineHeight/2}).attr("x2",node=>{const pos=positions.get(node.id);let offset=node.isPipelineParent?squareSize/2+15:configValues.nodeRadius+15;return node.sourceStrategy&&(offset+=configValues.nodeRadius+10),pos.x+offset}).attr("y2",node=>{const pos=positions.get(node.id),lineHeight=node.isPipelineParent?squareSize:2*configValues.nodeRadius;return pos.y+lineHeight/2}).attr("stroke",theme.componentStroke).attr("stroke-width",6),nodeEnter.append("text").attr("x",node=>{const pos=positions.get(node.id);if("anchor"===node.className)return void 0!==node.labelOffsetX?pos.x+node.labelOffsetX:pos.x;let defaultOffset=configValues.nodeLabelOffset;node.sourceStrategy&&void 0===node.labelOffsetX&&(defaultOffset+=10);const customOffset=node.labelOffsetX??defaultOffset;return pos.x+customOffset}).attr("y",node=>{const pos=positions.get(node.id);if("anchor"===node.className)return void 0!==node.labelOffsetY?pos.y+node.labelOffsetY:pos.y-3;let defaultOffset=-configValues.nodeLabelOffset;node.sourceStrategy&&void 0===node.labelOffsetY&&(defaultOffset-=10);const customOffset=node.labelOffsetY??defaultOffset;return pos.y+customOffset}).attr("class","wardley-node-label").attr("fill",node=>"evolved"===node.className?theme.evolutionStroke:"anchor"===node.className?"#000":theme.componentLabelColor).attr("font-size",configValues.labelFontSize).attr("font-weight",node=>"anchor"===node.className?"bold":"normal").attr("text-anchor",node=>"anchor"===node.className?"middle":"start").attr("dominant-baseline",node=>"anchor"===node.className?"middle":"auto").text(node=>node.label),data.annotations.length>0){const annotationsGroup=root.append("g").attr("class","wardley-annotations");if(data.annotations.forEach(annotation=>{const projectedCoords=annotation.coordinates.map(coord=>({x:projectX(coord.x),y:projectY(coord.y)}));if(projectedCoords.length>1)for(let i=0;i<projectedCoords.length-1;i++)annotationsGroup.append("line").attr("class","wardley-annotation-line").attr("x1",projectedCoords[i].x).attr("y1",projectedCoords[i].y).attr("x2",projectedCoords[i+1].x).attr("y2",projectedCoords[i+1].y).attr("stroke",theme.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");projectedCoords.forEach(coord=>{const annotationNode=annotationsGroup.append("g").attr("class","wardley-annotation");annotationNode.append("circle").attr("cx",coord.x).attr("cy",coord.y).attr("r",10).attr("fill","white").attr("stroke",theme.axisColor).attr("stroke-width",1.5),annotationNode.append("text").attr("x",coord.x).attr("y",coord.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",theme.axisTextColor).attr("font-weight","bold").text(annotation.number)})}),data.annotationsBox){let boxX=projectX(data.annotationsBox.x),boxY=projectY(data.annotationsBox.y);const padding=10,lineHeight=16,fontSize=11,textBoxGroup=annotationsGroup.append("g").attr("class","wardley-annotations-box"),sortedAnnotations=[...data.annotations].filter(a=>a.text).sort((a,b)=>a.number-b.number),textElements=[];if(sortedAnnotations.forEach((annotation,idx)=>{const text2=textBoxGroup.append("text").attr("x",boxX+padding).attr("y",boxY+padding+(idx+1)*lineHeight).attr("font-size",fontSize).attr("fill",theme.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${annotation.number}. ${annotation.text}`);textElements.push(text2)}),textElements.length>0){let maxWidth=0,maxHeight=0;textElements.forEach(text2=>{const textNode=text2.node(),textWidth=textNode.getComputedTextLength();maxWidth=Math.max(maxWidth,textWidth);const bbox=textNode.getBBox();maxHeight=Math.max(maxHeight,bbox.height)});const boxWidth=maxWidth+2*padding+105,boxHeight=sortedAnnotations.length*lineHeight+2*padding+maxHeight/2,minX=configValues.padding,maxX=width-configValues.padding-boxWidth,minY=configValues.padding,maxY=height-configValues.padding-boxHeight;boxX=Math.max(minX,Math.min(boxX,maxX)),boxY=Math.max(minY,Math.min(boxY,maxY)),textElements.forEach((text2,idx)=>{text2.attr("x",boxX+padding).attr("y",boxY+padding+(idx+1)*lineHeight)}),textBoxGroup.insert("rect","text").attr("x",boxX).attr("y",boxY).attr("width",boxWidth).attr("height",boxHeight).attr("fill","white").attr("stroke",theme.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(data.notes.length>0){const notesGroup=root.append("g").attr("class","wardley-notes");data.notes.forEach(note=>{const noteX=projectX(note.x),noteY=projectY(note.y);notesGroup.append("text").attr("x",noteX).attr("y",noteY).attr("text-anchor","start").attr("font-size",11).attr("fill",theme.axisTextColor).attr("font-weight","bold").text(note.text)})}if(data.accelerators.length>0){const acceleratorsGroup=root.append("g").attr("class","wardley-accelerators");data.accelerators.forEach(accelerator=>{const accX=projectX(accelerator.x),accY=projectY(accelerator.y),arrowPath=`\n M ${accX} ${accY-15}\n L ${accX+60-20} ${accY-15}\n L ${accX+60-20} ${accY-15-8}\n L ${accX+60} ${accY}\n L ${accX+60-20} ${accY+15+8}\n L ${accX+60-20} ${accY+15}\n L ${accX} ${accY+15}\n Z\n `;acceleratorsGroup.append("path").attr("d",arrowPath).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",1),acceleratorsGroup.append("text").attr("x",accX+30).attr("y",accY+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",theme.axisTextColor).attr("font-weight","bold").text(accelerator.name)})}if(data.deaccelerators.length>0){const deacceleratorsGroup=root.append("g").attr("class","wardley-deaccelerators");data.deaccelerators.forEach(deaccelerator=>{const decX=projectX(deaccelerator.x),decY=projectY(deaccelerator.y),arrowPath=`\n M ${decX+60} ${decY-15}\n L ${decX+20} ${decY-15}\n L ${decX+20} ${decY-15-8}\n L ${decX} ${decY}\n L ${decX+20} ${decY+15+8}\n L ${decX+20} ${decY+15}\n L ${decX+60} ${decY+15}\n Z\n `;deacceleratorsGroup.append("path").attr("d",arrowPath).attr("fill","white").attr("stroke",theme.componentStroke).attr("stroke-width",1),deacceleratorsGroup.append("text").attr("x",decX+30).attr("y",decY+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",theme.axisTextColor).attr("font-weight","bold").text(deaccelerator.name)})}},"draw")},styles:__name(({wardley:wardley}={})=>{const defaultThemeVariables=getThemeVariables3(),currentConfig=getConfig(),themeVariables=cleanAndMerge(defaultThemeVariables,currentConfig.themeVariables),w=cleanAndMerge(themeVariables.wardley,wardley);return`\n .wardley-background {\n fill: ${w.backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${w.axisColor};\n }\n .wardley-axis-label {\n fill: ${w.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${w.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${w.gridColor};\n }\n .wardley-node circle {\n fill: ${w.componentFill};\n stroke: ${w.componentStroke};\n }\n .wardley-node-label {\n fill: ${w.componentLabelColor};\n }\n .wardley-link {\n stroke: ${w.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${w.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${w.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${w.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${w.annotationFill};\n stroke: ${w.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${w.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${w.annotationFill};\n stroke: ${w.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${w.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${w.componentStroke};\n }\n .wardley-notes text {\n fill: ${w.axisTextColor};\n }\n `},"styles")};export{diagram};
@@ -0,0 +1 @@
1
+ var _a,_b,_c,_d,_e,_f,_g,_h,_i,_j;import{s as setAccDescription,g as getAccDescription,o as getDiagramTitle,n as setDiagramTitle,a as getAccTitle,b as setAccTitle,_ as __name,l as log,D as selectSvgElement,e as configureSvgSize,p as clear,y as getConfig,i as sanitizeText,A as cleanAndMerge,B as defaultConfig_default,E as getThemeVariables3,ay as computeDimensionOfText,O as line}from"./mermaid.core-DH-sQJgr.js";import{i as initRange}from"./init-DMZMl1PR.js";import{o as ordinal}from"./ordinal-DA-_8pMy.js";import{l as linear}from"./linear-BJRZNsdX.js";import"./vendor-mdxeditor-DT0rad22.js";import"./vendor-antd-DNUTLr77.js";import"./vendor-codemirror-6ck0hLRU.js";import"./vendor-markdown-DBlfs4dR.js";import"./defaultLocale-DZ7E7S9R.js";function band(){var step,bandwidth,scale=ordinal().unknown(void 0),domain=scale.domain,ordinalRange=scale.range,r0=0,r1=1,round=!1,paddingInner=0,paddingOuter=0,align=.5;function rescale(){var n=domain().length,reverse=r1<r0,start=reverse?r1:r0,stop=reverse?r0:r1;step=(stop-start)/Math.max(1,n-paddingInner+2*paddingOuter),round&&(step=Math.floor(step)),start+=(stop-start-step*(n-paddingInner))*align,bandwidth=step*(1-paddingInner),round&&(start=Math.round(start),bandwidth=Math.round(bandwidth));var values=function(start,stop,step){start=+start,stop=+stop,step=(n=arguments.length)<2?(stop=start,start=0,1):n<3?1:+step;for(var i=-1,n=0|Math.max(0,Math.ceil((stop-start)/step)),range2=new Array(n);++i<n;)range2[i]=start+i*step;return range2}(n).map(function(i){return start+step*i});return ordinalRange(reverse?values.reverse():values)}return delete scale.unknown,scale.domain=function(_){return arguments.length?(domain(_),rescale()):domain()},scale.range=function(_){return arguments.length?([r0,r1]=_,r0=+r0,r1=+r1,rescale()):[r0,r1]},scale.rangeRound=function(_){return[r0,r1]=_,r0=+r0,r1=+r1,round=!0,rescale()},scale.bandwidth=function(){return bandwidth},scale.step=function(){return step},scale.round=function(_){return arguments.length?(round=!!_,rescale()):round},scale.padding=function(_){return arguments.length?(paddingInner=Math.min(1,paddingOuter=+_),rescale()):paddingInner},scale.paddingInner=function(_){return arguments.length?(paddingInner=Math.min(1,_),rescale()):paddingInner},scale.paddingOuter=function(_){return arguments.length?(paddingOuter=+_,rescale()):paddingOuter},scale.align=function(_){return arguments.length?(align=Math.max(0,Math.min(1,_)),rescale()):align},scale.copy=function(){return band(domain(),[r0,r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align)},initRange.apply(rescale(),arguments)}var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[1,10,12,14,16,18,19,21,23],$V1=[2,6],$V2=[1,3],$V3=[1,5],$V4=[1,6],$V5=[1,7],$V6=[1,5,10,12,14,16,18,19,21,23,36,37,38],$V7=[1,25],$V8=[1,26],$V9=[1,28],$Va=[1,29],$Vb=[1,30],$Vc=[1,31],$Vd=[1,32],$Ve=[1,33],$Vf=[1,34],$Vg=[1,35],$Vh=[1,36],$Vi=[1,37],$Vj=[1,43],$Vk=[1,42],$Vl=[1,47],$Vm=[1,50],$Vn=[1,10,12,14,16,18,19,21,23,36,37,38],$Vo=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],$Vp=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],$Vq=[1,65],$Vr=[26,28],parser2={trace:__name(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,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$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",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"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],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 5:yy.setOrientation($$[$0]);break;case 9:yy.setDiagramTitle($$[$0].text.trim());break;case 12:yy.setLineData({text:"",type:"text"},$$[$0]);break;case 13:yy.setLineData($$[$0-1],$$[$0]);break;case 14:yy.setBarData({text:"",type:"text"},$$[$0]);break;case 15:yy.setBarData($$[$0-1],$$[$0]);break;case 16:this.$=$$[$0].trim(),yy.setAccTitle(this.$);break;case 17:case 18:this.$=$$[$0].trim(),yy.setAccDescription(this.$);break;case 19:case 29:this.$=$$[$0-1];break;case 20:case 30:this.$=[$$[$0-2],...$$[$0]];break;case 21:case 31:this.$=[$$[$0]];break;case 22:this.$={value:Number($$[$0-1]),label:$$[$0]};break;case 23:this.$={value:Number($$[$0]),label:""};break;case 24:yy.setXAxisTitle($$[$0]);break;case 25:yy.setXAxisTitle($$[$0-1]);break;case 26:yy.setXAxisTitle({type:"text",text:""});break;case 27:yy.setXAxisBand($$[$0]);break;case 28:yy.setXAxisRangeData(Number($$[$0-2]),Number($$[$0]));break;case 32:yy.setYAxisTitle($$[$0]);break;case 33:yy.setYAxisTitle($$[$0-1]);break;case 34:yy.setYAxisTitle({type:"text",text:""});break;case 35:yy.setYAxisRangeData(Number($$[$0-2]),Number($$[$0]));break;case 39:case 40:this.$={text:$$[$0],type:"text"};break;case 41:this.$={text:$$[$0],type:"markdown"};break;case 42:this.$=$$[$0];break;case 43:this.$=$$[$0-1]+""+$$[$0]}},"anonymous"),table:[o($V0,$V1,{3:1,4:2,7:4,5:$V2,36:$V3,37:$V4,38:$V5}),{1:[3]},o($V0,$V1,{4:2,7:4,3:8,5:$V2,36:$V3,37:$V4,38:$V5}),o($V0,$V1,{4:2,7:4,6:9,3:10,5:$V2,8:[1,11],36:$V3,37:$V4,38:$V5}),{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]},o($V6,[2,36]),o($V6,[2,37]),o($V6,[2,38]),{1:[2,1]},o($V0,$V1,{4:2,7:4,3:21,5:$V2,36:$V3,37:$V4,38:$V5}),{1:[2,3]},o($V6,[2,5]),o($V0,[2,7],{4:22,36:$V3,37:$V4,38:$V5}),{11:23,30:$V7,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},{11:39,13:38,24:$Vj,29:$Vk,30:$V7,31:40,32:41,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},{11:45,15:44,29:$Vl,30:$V7,35:46,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},{11:49,17:48,24:$Vm,30:$V7,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},{11:52,17:51,24:$Vm,30:$V7,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},{20:[1,53]},{22:[1,54]},o($Vn,[2,18]),{1:[2,2]},o($Vn,[2,8]),o($Vn,[2,9]),o($Vo,[2,39],{41:55,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi}),o($Vo,[2,40]),o($Vo,[2,41]),o($Vp,[2,42]),o($Vp,[2,44]),o($Vp,[2,45]),o($Vp,[2,46]),o($Vp,[2,47]),o($Vp,[2,48]),o($Vp,[2,49]),o($Vp,[2,50]),o($Vp,[2,51]),o($Vp,[2,52]),o($Vp,[2,53]),o($Vn,[2,10]),o($Vn,[2,24],{32:41,31:56,24:$Vj,29:$Vk}),o($Vn,[2,26]),o($Vn,[2,27]),{33:[1,57]},{11:59,30:$V7,34:58,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},o($Vn,[2,11]),o($Vn,[2,32],{35:60,29:$Vl}),o($Vn,[2,34]),{33:[1,61]},o($Vn,[2,12]),{17:62,24:$Vm},{25:63,27:64,29:$Vq},o($Vn,[2,14]),{17:66,24:$Vm},o($Vn,[2,16]),o($Vn,[2,17]),o($Vp,[2,43]),o($Vn,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},o($Vn,[2,33]),{29:[1,70]},o($Vn,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},o($Vr,[2,23],{30:[1,73]}),o($Vn,[2,15]),o($Vn,[2,28]),o($Vn,[2,29]),{11:59,30:$V7,34:74,39:24,40:$V8,41:27,42:$V9,43:$Va,44:$Vb,45:$Vc,46:$Vd,47:$Ve,48:$Vf,49:$Vg,50:$Vh,51:$Vi},o($Vn,[2,35]),o($Vn,[2,19]),{25:75,27:64,29:$Vq},o($Vr,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:__name(function(str,hash){if(!hash.recoverable){var error=new Error(str);throw error.hash=hash,error}this.trace(str)},"parseError"),parse:__name(function(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,args=lstack.slice.call(arguments,1),lexer2=Object.create(this.lexer),sharedState={yy:{}};for(var k in this.yy)Object.prototype.hasOwnProperty.call(this.yy,k)&&(sharedState.yy[k]=this.yy[k]);lexer2.setInput(input,sharedState.yy),sharedState.yy.lexer=lexer2,sharedState.yy.parser=this,void 0===lexer2.yylloc&&(lexer2.yylloc={});var yyloc=lexer2.yylloc;lstack.push(yyloc);var ranges=lexer2.options&&lexer2.options.ranges;function lex(){var token;return"number"!=typeof(token=tstack.pop()||lexer2.lex()||1)&&(token instanceof Array&&(token=(tstack=token).pop()),token=self.symbols_[token]||token),token}"function"==typeof sharedState.yy.parseError?this.parseError=sharedState.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,__name(function(n){stack.length=stack.length-2*n,vstack.length=vstack.length-n,lstack.length=lstack.length-n},"popStack"),__name(lex,"lex");for(var symbol,state,action,r,p,len,newState,expected,yyval={};;){if(state=stack[stack.length-1],this.defaultActions[state]?action=this.defaultActions[state]:(null==symbol&&(symbol=lex()),action=table[state]&&table[state][symbol]),void 0===action||!action.length||!action[0]){var errStr="";for(p in expected=[],table[state])this.terminals_[p]&&p>2&&expected.push("'"+this.terminals_[p]+"'");errStr=lexer2.showPosition?"Parse error on line "+(yylineno+1)+":\n"+lexer2.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'":"Parse error on line "+(yylineno+1)+": Unexpected "+(1==symbol?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'"),this.parseError(errStr,{text:lexer2.match,token:this.terminals_[symbol]||symbol,line:lexer2.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1)throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol);switch(action[0]){case 1:stack.push(symbol),vstack.push(lexer2.yytext),lstack.push(lexer2.yylloc),stack.push(action[1]),symbol=null,yyleng=lexer2.yyleng,yytext=lexer2.yytext,yylineno=lexer2.yylineno,yyloc=lexer2.yylloc;break;case 2:if(len=this.productions_[action[1]][1],yyval.$=vstack[vstack.length-len],yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column},ranges&&(yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]),void 0!==(r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args))))return r;len&&(stack=stack.slice(0,-1*len*2),vstack=vstack.slice(0,-1*len),lstack=lstack.slice(0,-1*len)),stack.push(this.productions_[action[1]][0]),vstack.push(yyval.$),lstack.push(yyval._$),newState=table[stack[stack.length-2]][stack[stack.length-1]],stack.push(newState);break;case 3:return!0}}return!0},"parse")},lexer=function(){return{EOF:1,parseError:__name(function(str,hash){if(!this.yy.parser)throw new Error(str);this.yy.parser.parseError(str,hash)},"parseError"),setInput:__name(function(input,yy){return this.yy=yy||this.yy||{},this._input=input,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:__name(function(){var ch=this._input[0];return this.yytext+=ch,this.yyleng++,this.offset++,this.match+=ch,this.matched+=ch,ch.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),ch},"input"),unput:__name(function(ch){var len=ch.length,lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-len),this.offset-=len;var oldLines=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),lines.length-1&&(this.yylineno-=lines.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-len]),this.yyleng=this.yytext.length,this},"unput"),more:__name(function(){return this._more=!0,this},"more"),reject:__name(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:__name(function(n){this.unput(this.match.slice(n))},"less"),pastInput:__name(function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:__name(function(){var next=this.match;return next.length<20&&(next+=this._input.substr(0,20-next.length)),(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:__name(function(){var pre=this.pastInput(),c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},"showPosition"),test_match:__name(function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer&&(backup={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(backup.yylloc.range=this.yylloc.range.slice(0))),(lines=match[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=lines.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length},this.yytext+=match[0],this.match+=match[0],this.matches=match,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(match[0].length),this.matched+=match[0],token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),token)return token;if(this._backtrack){for(var k in backup)this[k]=backup[k];return!1}return!1},"test_match"),next:__name(function(){if(this.done)return this.EOF;var token,match,tempMatch,index;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var rules=this._currentRules(),i=0;i<rules.length;i++)if((tempMatch=this._input.match(this.rules[rules[i]]))&&(!match||tempMatch[0].length>match[0].length)){if(match=tempMatch,index=i,this.options.backtrack_lexer){if(!1!==(token=this.test_match(tempMatch,rules[i])))return token;if(this._backtrack){match=!1;continue}return!1}if(!this.options.flex)break}return match?!1!==(token=this.test_match(match,rules[index]))&&token:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:__name(function(){var r=this.next();return r||this.lex()},"lex"),begin:__name(function(condition){this.conditionStack.push(condition)},"begin"),popState:__name(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:__name(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:__name(function(n){return(n=this.conditionStack.length-1-Math.abs(n||0))>=0?this.conditionStack[n]:"INITIAL"},"topState"),pushState:__name(function(condition){this.begin(condition)},"pushState"),stateStackSize:__name(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:__name(function(yy,yy_,$avoiding_name_collisions,YY_START){switch($avoiding_name_collisions){case 0:case 1:case 5:case 44:break;case 2:case 3:return this.popState(),36;case 4:return 36;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:case 26:case 28:this.popState();break;case 13:return"acc_descr_multiline_value";case 14: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 33;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 29;case 25:return this.popState(),26;case 27:this.pushState("string");break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 45:return 37;case 46:return 38}},"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}}}}();function Parser(){this.yy={}}return parser2.lexer=lexer,__name(Parser,"Parser"),Parser.prototype=parser2,parser2.Parser=Parser,new Parser}();parser.parser=parser;var xychart_default=parser;function isBarPlot(data){return"bar"===data.type}function isBandAxisData(data){return"band"===data.type}function isLinearAxisData(data){return"linear"===data.type}__name(isBarPlot,"isBarPlot"),__name(isBandAxisData,"isBandAxisData"),__name(isLinearAxisData,"isLinearAxisData");var TextDimensionCalculatorWithFont=(__name(_a=class{constructor(parentGroup){this.parentGroup=parentGroup}getMaxDimension(texts,fontSize){if(!this.parentGroup)return{width:texts.reduce((acc,cur)=>Math.max(cur.length,acc),0)*fontSize,height:fontSize};const dimension={width:0,height:0},elem=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",fontSize);for(const t of texts){const bbox=computeDimensionOfText(elem,1,t),width=bbox?bbox.width:t.length*fontSize,height=bbox?bbox.height:fontSize;dimension.width=Math.max(dimension.width,width),dimension.height=Math.max(dimension.height,height)}return elem.remove(),dimension}},"TextDimensionCalculatorWithFont"),_a),BaseAxis=(__name(_b=class{constructor(axisConfig,title,textDimensionCalculator,axisThemeConfig){this.axisConfig=axisConfig,this.title=title,this.textDimensionCalculator=textDimensionCalculator,this.axisThemeConfig=axisThemeConfig,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.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}setRange(range2){this.range=range2,"left"===this.axisPosition||"right"===this.axisPosition?this.boundingRect.height=range2[1]-range2[0]:this.boundingRect.width=range2[1]-range2[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(axisPosition){this.axisPosition=axisPosition,this.setRange(this.range)}getTickDistance(){const range2=this.getRange();return Math.abs(range2[0]-range2[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(tick=>tick.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(availableSpace){let availableHeight=availableSpace.height;if(this.axisConfig.showAxisLine&&availableHeight>this.axisConfig.axisLineWidth&&(availableHeight-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const spaceRequired=this.getLabelDimension(),maxPadding=.2*availableSpace.width;this.outerPadding=Math.min(spaceRequired.width/2,maxPadding);let heightRequired=spaceRequired.height;"bottom"===this.axisPosition&&0!==this.normalizedLabelRotationInRad&&(heightRequired=Math.max(heightRequired,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*spaceRequired.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*spaceRequired.height))),heightRequired+=2*this.axisConfig.labelPadding,this.labelTextHeight=spaceRequired.height,heightRequired<=availableHeight&&(availableHeight-=heightRequired,this.showLabel=!0)}if(this.axisConfig.showTick&&availableHeight>=this.axisConfig.tickLength&&(this.showTick=!0,availableHeight-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const spaceRequired=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),heightRequired=spaceRequired.height+2*this.axisConfig.titlePadding;this.titleTextHeight=spaceRequired.height,heightRequired<=availableHeight&&(availableHeight-=heightRequired,this.showTitle=!0)}this.boundingRect.width=availableSpace.width,this.boundingRect.height=availableSpace.height-availableHeight}calculateSpaceIfDrawnVertical(availableSpace){let availableWidth=availableSpace.width;if(this.axisConfig.showAxisLine&&availableWidth>this.axisConfig.axisLineWidth&&(availableWidth-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const spaceRequired=this.getLabelDimension(),maxPadding=.2*availableSpace.height;this.outerPadding=Math.min(spaceRequired.height/2,maxPadding);const widthRequired=spaceRequired.width+2*this.axisConfig.labelPadding;widthRequired<=availableWidth&&(availableWidth-=widthRequired,this.showLabel=!0)}if(this.axisConfig.showTick&&availableWidth>=this.axisConfig.tickLength&&(this.showTick=!0,availableWidth-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const spaceRequired=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),widthRequired=spaceRequired.height+2*this.axisConfig.titlePadding;this.titleTextHeight=spaceRequired.height,widthRequired<=availableWidth&&(availableWidth-=widthRequired,this.showTitle=!0)}this.boundingRect.width=availableSpace.width-availableWidth,this.boundingRect.height=availableSpace.height}calculateSpace(availableSpace){return"left"===this.axisPosition||"right"===this.axisPosition?this.calculateSpaceIfDrawnVertical(availableSpace):this.calculateSpaceIfDrawnHorizontally(availableSpace),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(point){this.boundingRect.x=point.x,this.boundingRect.y=point.y}calculateOffsetByRotation(reference){const rotation=this.normalizedLabelRotationInRad;return 0===rotation?0:Math.sin(rotation)*this.getLabelDimension()[reference]/2}getDrawableElementsForLeftAxis(){const drawableElement=[];if(this.showAxisLine){const x=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;drawableElement.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${x},${this.boundingRect.y} L ${x},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&drawableElement.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(tick=>({text:tick.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(tick),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const x=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);drawableElement.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(tick=>({path:`M ${x},${this.getScaleValue(tick)} L ${x-this.axisConfig.tickLength},${this.getScaleValue(tick)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&drawableElement.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"}]}),drawableElement}getDrawableElementsForBottomAxis(){const drawableElement=[];if(this.showAxisLine){const y=this.boundingRect.y+this.axisConfig.axisLineWidth/2;drawableElement.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${y} L ${this.boundingRect.x+this.boundingRect.width},${y}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&drawableElement.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(tick=>({text:tick.toString(),x:this.getScaleValue(tick)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:180*this.normalizedLabelRotationInRad/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const y=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);drawableElement.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(tick=>({path:`M ${this.getScaleValue(tick)},${y} L ${this.getScaleValue(tick)},${y+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&drawableElement.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"}]}),drawableElement}getDrawableElementsForTopAxis(){const drawableElement=[];if(this.showAxisLine){const y=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;drawableElement.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${y} L ${this.boundingRect.x+this.boundingRect.width},${y}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&drawableElement.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(tick=>({text:tick.toString(),x:this.getScaleValue(tick),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const y=this.boundingRect.y;drawableElement.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(tick=>({path:`M ${this.getScaleValue(tick)},${y+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(tick)},${y+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&drawableElement.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"}]}),drawableElement}getDrawableElements(){if("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},"BaseAxis"),_b),BandAxis=(__name(_c=class extends BaseAxis{constructor(axisConfig,axisThemeConfig,categories,title,textDimensionCalculator){super(axisConfig,title,textDimensionCalculator,axisThemeConfig),this.categories=categories,this.scale=band().domain(this.categories).range(this.getRange())}setRange(range2){super.setRange(range2)}recalculateScale(){this.scale=band().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),log.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(value){return this.scale(value)??this.getRange()[0]}},"BandAxis"),_c),LinearAxis=(__name(_d=class extends BaseAxis{constructor(axisConfig,axisThemeConfig,domain,title,textDimensionCalculator){super(axisConfig,title,textDimensionCalculator,axisThemeConfig),this.domain=domain,this.scale=linear().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const domain=[...this.domain];"left"===this.axisPosition&&domain.reverse(),this.scale=linear().domain(domain).range(this.getRange())}getScaleValue(value){return this.scale(value)}},"LinearAxis"),_d);function getAxis(data,axisConfig,axisThemeConfig,tmpSVGGroup2){const textDimensionCalculator=new TextDimensionCalculatorWithFont(tmpSVGGroup2);return isBandAxisData(data)?new BandAxis(axisConfig,axisThemeConfig,data.categories,data.title,textDimensionCalculator):new LinearAxis(axisConfig,axisThemeConfig,[data.min,data.max],data.title,textDimensionCalculator)}__name(getAxis,"getAxis");var ChartTitle=(__name(_e=class{constructor(textDimensionCalculator,chartConfig,chartData,chartThemeConfig){this.textDimensionCalculator=textDimensionCalculator,this.chartConfig=chartConfig,this.chartData=chartData,this.chartThemeConfig=chartThemeConfig,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}setBoundingBoxXY(point){this.boundingRect.x=point.x,this.boundingRect.y=point.y}calculateSpace(availableSpace){const titleDimension=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),widthRequired=Math.max(titleDimension.width,availableSpace.width),heightRequired=titleDimension.height+2*this.chartConfig.titlePadding;return titleDimension.width<=widthRequired&&titleDimension.height<=heightRequired&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=widthRequired,this.boundingRect.height=heightRequired,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const drawableElem=[];return this.showChartTitle&&drawableElem.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}]}),drawableElem}},"ChartTitle"),_e);function getChartTitleComponent(chartConfig,chartData,chartThemeConfig,tmpSVGGroup2){const textDimensionCalculator=new TextDimensionCalculatorWithFont(tmpSVGGroup2);return new ChartTitle(textDimensionCalculator,chartConfig,chartData,chartThemeConfig)}__name(getChartTitleComponent,"getChartTitleComponent");var LinePlot=(__name(_f=class{constructor(plotData,xAxis,yAxis,orientation,plotIndex2){this.plotData=plotData,this.xAxis=xAxis,this.yAxis=yAxis,this.orientation=orientation,this.plotIndex=plotIndex2}getDrawableElement(){const finalData=this.plotData.data.map(d=>[this.xAxis.getScaleValue(d[0]),this.yAxis.getScaleValue(d[1])]);let path;if(path="horizontal"===this.orientation?line().y(d=>d[0]).x(d=>d[1])(finalData):line().x(d=>d[0]).y(d=>d[1])(finalData),!path)return[];const elements=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:path,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){const labelOffset=10,fontSize=12,textData=[];for(const[i,[px,py]]of finalData.entries()){const label=this.plotData.pointLabels[i];label&&("horizontal"===this.orientation?textData.push({x:py+labelOffset,y:px,text:label,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:fontSize,rotation:0}):textData.push({x:px,y:py-labelOffset,text:label,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:fontSize,rotation:0}))}textData.length>0&&elements.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:textData})}return elements}},"LinePlot"),_f),BarPlot=(__name(_g=class{constructor(barData,boundingRect,xAxis,yAxis,orientation,plotIndex2){this.barData=barData,this.boundingRect=boundingRect,this.xAxis=xAxis,this.yAxis=yAxis,this.orientation=orientation,this.plotIndex=plotIndex2}getDrawableElement(){const finalData=this.barData.data.map(d=>[this.xAxis.getScaleValue(d[0]),this.yAxis.getScaleValue(d[1])]),barWidth=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),barWidthHalf=barWidth/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:finalData.map(data=>({x:this.boundingRect.x,y:data[0]-barWidthHalf,height:barWidth,width:data[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:finalData.map(data=>({x:data[0]-barWidthHalf,y:data[1],width:barWidth,height:this.boundingRect.y+this.boundingRect.height-data[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},"BarPlot"),_g),BasePlot=(__name(_h=class{constructor(chartConfig,chartData,chartThemeConfig){this.chartConfig=chartConfig,this.chartData=chartData,this.chartThemeConfig=chartThemeConfig,this.boundingRect={x:0,y:0,width:0,height:0}}setAxes(xAxis,yAxis){this.xAxis=xAxis,this.yAxis=yAxis}setBoundingBoxXY(point){this.boundingRect.x=point.x,this.boundingRect.y=point.y}calculateSpace(availableSpace){return this.boundingRect.width=availableSpace.width,this.boundingRect.height=availableSpace.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!this.xAxis||!this.yAxis)throw Error("Axes must be passed to render Plots");const drawableElem=[];for(const[i,plot]of this.chartData.plots.entries())switch(plot.type){case"line":{const linePlot=new LinePlot(plot,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);drawableElem.push(...linePlot.getDrawableElement())}break;case"bar":{const barPlot=new BarPlot(plot,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);drawableElem.push(...barPlot.getDrawableElement())}}return drawableElem}},"BasePlot"),_h);function getPlotComponent(chartConfig,chartData,chartThemeConfig){return new BasePlot(chartConfig,chartData,chartThemeConfig)}__name(getPlotComponent,"getPlotComponent");var tmpSVGGroup,Orchestrator=(__name(_i=class{constructor(chartConfig,chartData,chartThemeConfig,tmpSVGGroup2){this.chartConfig=chartConfig,this.chartData=chartData,this.componentStore={title:getChartTitleComponent(chartConfig,chartData,chartThemeConfig,tmpSVGGroup2),plot:getPlotComponent(chartConfig,chartData,chartThemeConfig),xAxis:getAxis(chartData.xAxis,chartConfig.xAxis,{titleColor:chartThemeConfig.xAxisTitleColor,labelColor:chartThemeConfig.xAxisLabelColor,tickColor:chartThemeConfig.xAxisTickColor,axisLineColor:chartThemeConfig.xAxisLineColor},tmpSVGGroup2),yAxis:getAxis(chartData.yAxis,chartConfig.yAxis,{titleColor:chartThemeConfig.yAxisTitleColor,labelColor:chartThemeConfig.yAxisLabelColor,tickColor:chartThemeConfig.yAxisTickColor,axisLineColor:chartThemeConfig.yAxisLineColor},tmpSVGGroup2)}}calculateVerticalSpace(){let availableWidth=this.chartConfig.width,availableHeight=this.chartConfig.height,plotX=0,plotY=0,chartWidth=Math.floor(availableWidth*this.chartConfig.plotReservedSpacePercent/100),chartHeight=Math.floor(availableHeight*this.chartConfig.plotReservedSpacePercent/100),spaceUsed=this.componentStore.plot.calculateSpace({width:chartWidth,height:chartHeight});availableWidth-=spaceUsed.width,availableHeight-=spaceUsed.height,spaceUsed=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:availableHeight}),plotY=spaceUsed.height,availableHeight-=spaceUsed.height,this.componentStore.xAxis.setAxisPosition("bottom"),spaceUsed=this.componentStore.xAxis.calculateSpace({width:availableWidth,height:availableHeight}),availableHeight-=spaceUsed.height,this.componentStore.yAxis.setAxisPosition("left"),spaceUsed=this.componentStore.yAxis.calculateSpace({width:availableWidth,height:availableHeight}),plotX=spaceUsed.width,availableWidth-=spaceUsed.width,availableWidth>0&&(chartWidth+=availableWidth,availableWidth=0),availableHeight>0&&(chartHeight+=availableHeight,availableHeight=0),this.componentStore.plot.calculateSpace({width:chartWidth,height:chartHeight}),this.componentStore.plot.setBoundingBoxXY({x:plotX,y:plotY}),this.componentStore.xAxis.setRange([plotX,plotX+chartWidth]),this.componentStore.xAxis.setBoundingBoxXY({x:plotX,y:plotY+chartHeight}),this.componentStore.yAxis.setRange([plotY,plotY+chartHeight]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:plotY}),this.chartData.plots.some(p=>isBarPlot(p))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let availableWidth=this.chartConfig.width,availableHeight=this.chartConfig.height,titleYEnd=0,plotX=0,plotY=0,chartWidth=Math.floor(availableWidth*this.chartConfig.plotReservedSpacePercent/100),chartHeight=Math.floor(availableHeight*this.chartConfig.plotReservedSpacePercent/100),spaceUsed=this.componentStore.plot.calculateSpace({width:chartWidth,height:chartHeight});availableWidth-=spaceUsed.width,availableHeight-=spaceUsed.height,spaceUsed=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:availableHeight}),titleYEnd=spaceUsed.height,availableHeight-=spaceUsed.height,this.componentStore.xAxis.setAxisPosition("left"),spaceUsed=this.componentStore.xAxis.calculateSpace({width:availableWidth,height:availableHeight}),availableWidth-=spaceUsed.width,plotX=spaceUsed.width,this.componentStore.yAxis.setAxisPosition("top"),spaceUsed=this.componentStore.yAxis.calculateSpace({width:availableWidth,height:availableHeight}),availableHeight-=spaceUsed.height,plotY=titleYEnd+spaceUsed.height,availableWidth>0&&(chartWidth+=availableWidth,availableWidth=0),availableHeight>0&&(chartHeight+=availableHeight,availableHeight=0),this.componentStore.plot.calculateSpace({width:chartWidth,height:chartHeight}),this.componentStore.plot.setBoundingBoxXY({x:plotX,y:plotY}),this.componentStore.yAxis.setRange([plotX,plotX+chartWidth]),this.componentStore.yAxis.setBoundingBoxXY({x:plotX,y:titleYEnd}),this.componentStore.xAxis.setRange([plotY,plotY+chartHeight]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:plotY}),this.chartData.plots.some(p=>isBarPlot(p))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const drawableElem=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const component of Object.values(this.componentStore))drawableElem.push(...component.getDrawableElements());return drawableElem}},"Orchestrator"),_i),XYChartBuilder=(__name(_j=class{static build(config,chartData,chartThemeConfig,tmpSVGGroup2){return new Orchestrator(config,chartData,chartThemeConfig,tmpSVGGroup2).getDrawableElement()}},"XYChartBuilder"),_j),plotIndex=0,xyChartConfig=getChartDefaultConfig(),xyChartThemeConfig=getChartDefaultThemeConfig(),xyChartData=getChartDefaultData(),plotColorPalette=xyChartThemeConfig.plotColorPalette.split(",").map(color=>color.trim()),hasSetXAxis=!1,hasSetYAxis=!1;function getChartDefaultThemeConfig(){const defaultThemeVariables=getThemeVariables3(),config=getConfig();return cleanAndMerge(defaultThemeVariables.xyChart,config.themeVariables.xyChart)}function getChartDefaultConfig(){const config=getConfig();return cleanAndMerge(defaultConfig_default.xyChart,config.xyChart)}function getChartDefaultData(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function textSanitizer(text){const config=getConfig();return sanitizeText(text.trim(),config)}function setTmpSVGG(SVGG){tmpSVGGroup=SVGG}function setOrientation(orientation){xyChartConfig.chartOrientation="horizontal"===orientation?"horizontal":"vertical"}function setXAxisTitle(title){xyChartData.xAxis.title=textSanitizer(title.text)}function setXAxisRangeData(min,max){xyChartData.xAxis={type:"linear",title:xyChartData.xAxis.title,min:min,max:max},hasSetXAxis=!0}function setXAxisBand(categories){xyChartData.xAxis={type:"band",title:xyChartData.xAxis.title,categories:categories.map(c=>textSanitizer(c.text))},hasSetXAxis=!0}function setYAxisTitle(title){xyChartData.yAxis.title=textSanitizer(title.text)}function setYAxisRangeData(min,max){xyChartData.yAxis={type:"linear",title:xyChartData.yAxis.title,min:min,max:max},hasSetYAxis=!0}function setYAxisRangeFromPlotData(data){const minValue=Math.min(...data),maxValue=Math.max(...data),prevMinValue=isLinearAxisData(xyChartData.yAxis)?xyChartData.yAxis.min:1/0,prevMaxValue=isLinearAxisData(xyChartData.yAxis)?xyChartData.yAxis.max:-1/0;xyChartData.yAxis={type:"linear",title:xyChartData.yAxis.title,min:Math.min(prevMinValue,minValue),max:Math.max(prevMaxValue,maxValue)}}function transformDataWithoutCategory(data){let retData=[];if(0===data.length)return retData;if(!hasSetXAxis){const prevMinValue=isLinearAxisData(xyChartData.xAxis)?xyChartData.xAxis.min:1/0,prevMaxValue=isLinearAxisData(xyChartData.xAxis)?xyChartData.xAxis.max:-1/0;setXAxisRangeData(Math.min(prevMinValue,1),Math.max(prevMaxValue,data.length))}if(isBandAxisData(xyChartData.xAxis)&&data.length>xyChartData.xAxis.categories.length&&(data=data.slice(0,xyChartData.xAxis.categories.length)),hasSetYAxis||setYAxisRangeFromPlotData(data),isBandAxisData(xyChartData.xAxis)&&(retData=xyChartData.xAxis.categories.map((c,i)=>[c,data[i]])),isLinearAxisData(xyChartData.xAxis)){const min=xyChartData.xAxis.min,max=xyChartData.xAxis.max,step=(max-min)/(data.length-1),categories=[];for(let i=min;i<=max;i+=step)categories.push(`${i}`);retData=categories.map((c,i)=>[c,data[i]])}return retData}function getPlotColorFromPalette(plotIndex2){return plotColorPalette[0===plotIndex2?0:plotIndex2%plotColorPalette.length]}function setLineData(title,data){const values=data.map(d=>d.value),labels=data.map(d=>d.label?textSanitizer(d.label):""),plotData=transformDataWithoutCategory(values),hasAnyLabel=labels.some(l=>""!==l);xyChartData.plots.push({type:"line",strokeFill:getPlotColorFromPalette(plotIndex),strokeWidth:2,data:plotData,...hasAnyLabel?{pointLabels:labels}:{}}),plotIndex++}function setBarData(title,data){const plotData=transformDataWithoutCategory(data.map(d=>d.value));xyChartData.plots.push({type:"bar",fill:getPlotColorFromPalette(plotIndex),data:plotData}),plotIndex++}function getDrawableElem(){if(0===xyChartData.plots.length)throw Error("No Plot to render, please provide a plot with some data");return xyChartData.title=getDiagramTitle(),XYChartBuilder.build(xyChartConfig,xyChartData,xyChartThemeConfig,tmpSVGGroup)}function getChartThemeConfig(){return xyChartThemeConfig}function getChartConfig(){return xyChartConfig}function getXYChartData(){return xyChartData}__name(getChartDefaultThemeConfig,"getChartDefaultThemeConfig"),__name(getChartDefaultConfig,"getChartDefaultConfig"),__name(getChartDefaultData,"getChartDefaultData"),__name(textSanitizer,"textSanitizer"),__name(setTmpSVGG,"setTmpSVGG"),__name(setOrientation,"setOrientation"),__name(setXAxisTitle,"setXAxisTitle"),__name(setXAxisRangeData,"setXAxisRangeData"),__name(setXAxisBand,"setXAxisBand"),__name(setYAxisTitle,"setYAxisTitle"),__name(setYAxisRangeData,"setYAxisRangeData"),__name(setYAxisRangeFromPlotData,"setYAxisRangeFromPlotData"),__name(transformDataWithoutCategory,"transformDataWithoutCategory"),__name(getPlotColorFromPalette,"getPlotColorFromPalette"),__name(setLineData,"setLineData"),__name(setBarData,"setBarData"),__name(getDrawableElem,"getDrawableElem"),__name(getChartThemeConfig,"getChartThemeConfig"),__name(getChartConfig,"getChartConfig"),__name(getXYChartData,"getXYChartData");var diagram={parser:xychart_default,db:{getDrawableElem:getDrawableElem,clear:__name(function(){clear(),plotIndex=0,xyChartConfig=getChartDefaultConfig(),xyChartData={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},xyChartThemeConfig=getChartDefaultThemeConfig(),plotColorPalette=xyChartThemeConfig.plotColorPalette.split(",").map(color=>color.trim()),hasSetXAxis=!1,hasSetYAxis=!1},"clear"),setAccTitle:setAccTitle,getAccTitle:getAccTitle,setDiagramTitle:setDiagramTitle,getDiagramTitle:getDiagramTitle,getAccDescription:getAccDescription,setAccDescription:setAccDescription,setOrientation:setOrientation,setXAxisTitle:setXAxisTitle,setXAxisRangeData:setXAxisRangeData,setXAxisBand:setXAxisBand,setYAxisTitle:setYAxisTitle,setYAxisRangeData:setYAxisRangeData,setLineData:setLineData,setBarData:setBarData,setTmpSVGG:setTmpSVGG,getChartThemeConfig:getChartThemeConfig,getChartConfig:getChartConfig,getXYChartData:getXYChartData},renderer:{draw:__name((txt,id,_version,diagObj)=>{const db=diagObj.db,themeConfig=db.getChartThemeConfig(),chartConfig=db.getChartConfig(),labelData=db.getXYChartData().plots[0].data.map(data=>data[1]);function getDominantBaseLine(horizontalPos){return"top"===horizontalPos?"text-before-edge":"middle"}function getTextAnchor(verticalPos){return"left"===verticalPos?"start":"right"===verticalPos?"end":"middle"}function getTextTransformation(data){return`translate(${data.x}, ${data.y}) rotate(${data.rotation||0})`}__name(getDominantBaseLine,"getDominantBaseLine"),__name(getTextAnchor,"getTextAnchor"),__name(getTextTransformation,"getTextTransformation"),log.debug("Rendering xychart chart\n"+txt);const svg=selectSvgElement(id),group=svg.append("g").attr("class","main"),background=group.append("rect").attr("width",chartConfig.width).attr("height",chartConfig.height).attr("class","background");configureSvgSize(svg,chartConfig.height,chartConfig.width,!0),svg.attr("viewBox",`0 0 ${chartConfig.width} ${chartConfig.height}`),background.attr("fill",themeConfig.backgroundColor),db.setTmpSVGG(svg.append("g").attr("class","mermaid-tmp-group"));const shapes=db.getDrawableElem(),groups={};function getGroup(gList){let elem=group,prefix="";for(const[i]of gList.entries()){let parent=group;i>0&&groups[prefix]&&(parent=groups[prefix]),prefix+=gList[i],elem=groups[prefix],elem||(elem=groups[prefix]=parent.append("g").attr("class",gList[i]))}return elem}__name(getGroup,"getGroup");for(const shape of shapes){if(0===shape.data.length)continue;const shapeGroup=getGroup(shape.groupTexts);switch(shape.type){case"rect":if(shapeGroup.selectAll("rect").data(shape.data).enter().append("rect").attr("x",data=>data.x).attr("y",data=>data.y).attr("width",data=>data.width).attr("height",data=>data.height).attr("fill",data=>data.fill).attr("stroke",data=>data.strokeFill).attr("stroke-width",data=>data.strokeWidth),chartConfig.showDataLabel){const showDataLabelOutsideBar=chartConfig.showDataLabelOutsideBar;if("horizontal"===chartConfig.chartOrientation){let fitsHorizontally2=function(item,fontSize){const{data:data,label:label}=item;return fontSize*label.length*charWidthFactor<=data.width-rightMargin};__name(fitsHorizontally2,"fitsHorizontally");const charWidthFactor=.7,rightMargin=10,validItems=shape.data.map((d,i)=>({data:d,label:labelData[i].toString()})).filter(item=>item.data.width>0&&item.data.height>0),candidateFontSizes=validItems.map(item=>{const{data:data}=item;let fontSize=.7*data.height;for(;!fitsHorizontally2(item,fontSize)&&fontSize>0;)fontSize-=1;return fontSize}),uniformFontSize=Math.floor(Math.min(...candidateFontSizes)),determineLabelXPosition=__name(item=>showDataLabelOutsideBar?item.data.x+item.data.width+rightMargin:item.data.x+item.data.width-rightMargin,"determineLabelXPosition");shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x",determineLabelXPosition).attr("y",item=>item.data.y+item.data.height/2).attr("text-anchor",showDataLabelOutsideBar?"start":"end").attr("dominant-baseline","middle").attr("fill",themeConfig.dataLabelColor).attr("font-size",`${uniformFontSize}px`).text(item=>item.label)}else{let fitsInBar2=function(item,fontSize,yOffset2){const{data:data,label:label}=item,textWidth=fontSize*label.length*.7,centerX=data.x+data.width/2,rightEdge=centerX+textWidth/2,horizontalFits=centerX-textWidth/2>=data.x&&rightEdge<=data.x+data.width,verticalFits=data.y+yOffset2+fontSize<=data.y+data.height;return horizontalFits&&verticalFits};__name(fitsInBar2,"fitsInBar");const yOffset=10,validItems=shape.data.map((d,i)=>({data:d,label:labelData[i].toString()})).filter(item=>item.data.width>0&&item.data.height>0),candidateFontSizes=validItems.map(item=>{const{data:data,label:label}=item;let fontSize=data.width/(.7*label.length);for(;!fitsInBar2(item,fontSize,yOffset)&&fontSize>0;)fontSize-=1;return fontSize}),uniformFontSize=Math.floor(Math.min(...candidateFontSizes)),determineLabelYPosition=__name(item=>showDataLabelOutsideBar?item.data.y-yOffset:item.data.y+yOffset,"determineLabelYPosition");shapeGroup.selectAll("text").data(validItems).enter().append("text").attr("x",item=>item.data.x+item.data.width/2).attr("y",determineLabelYPosition).attr("text-anchor","middle").attr("dominant-baseline",showDataLabelOutsideBar?"auto":"hanging").attr("fill",themeConfig.dataLabelColor).attr("font-size",`${uniformFontSize}px`).text(item=>item.label)}}break;case"text":shapeGroup.selectAll("text").data(shape.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",data=>data.fill).attr("font-size",data=>data.fontSize).attr("dominant-baseline",data=>getDominantBaseLine(data.verticalPos)).attr("text-anchor",data=>getTextAnchor(data.horizontalPos)).attr("transform",data=>getTextTransformation(data)).text(data=>data.text);break;case"path":shapeGroup.selectAll("path").data(shape.data).enter().append("path").attr("d",data=>data.path).attr("fill",data=>data.fill?data.fill:"none").attr("stroke",data=>data.strokeFill).attr("stroke-width",data=>data.strokeWidth)}}},"draw")}};export{diagram};
package/dist/index.html CHANGED
@@ -21,10 +21,10 @@
21
21
  // 整体显示大小已弃用 CSS zoom:Electron 改用 webFrame.setZoomFactor(首屏抢占见
22
22
  // electron/tab-content-preload.js),纯浏览器交由用户用浏览器自带快捷键缩放,故此处不再设 zoom。
23
23
  </script>
24
- <script type="module" crossorigin src="./assets/index-Bp83Qa3f.js"></script>
25
- <link rel="modulepreload" crossorigin href="./assets/vendor-antd-CyudKxuD.js">
26
- <link rel="modulepreload" crossorigin href="./assets/vendor-codemirror-BD02EJx5.js">
27
- <link rel="modulepreload" crossorigin href="./assets/vendor-mdxeditor-C3Q4i3LX.js">
24
+ <script type="module" crossorigin src="./assets/index-By8aqIvN.js"></script>
25
+ <link rel="modulepreload" crossorigin href="./assets/vendor-antd-DNUTLr77.js">
26
+ <link rel="modulepreload" crossorigin href="./assets/vendor-codemirror-6ck0hLRU.js">
27
+ <link rel="modulepreload" crossorigin href="./assets/vendor-mdxeditor-DT0rad22.js">
28
28
  <link rel="stylesheet" crossorigin href="./assets/index-f4nPU7KM.css">
29
29
  </head>
30
30
  <body>
package/findcc.js CHANGED
@@ -301,19 +301,111 @@ export function isBrowserOpenSuppressed() {
301
301
  }
302
302
  // ████████████████████████████████████████████████████████████████████████████
303
303
 
304
+ // `npm root -g` — the single source of truth for the global node_modules root.
305
+ //
306
+ // Windows: npm ships as `npm.cmd`, and since the CVE-2024-27980 fix (Node
307
+ // 18.20.2 / 20.12.2 / 22.0.0) handing a `.cmd`/`.bat` target to execFileSync
308
+ // throws EINVAL *synchronously*. That threw straight into the catch below and
309
+ // returned null, so every Claude-discovery path that depends on the global root
310
+ // silently missed an `npm i -g @anthropic-ai/claude-code` install and `ccv`
311
+ // died with "cli.js not found" (issue #137).
312
+ //
313
+ // `cmd.exe /c npm root -g` is the doc-sanctioned non-shell route: the executed
314
+ // image is cmd.exe (a real PE), and the argv is a fixed literal — no caller or
315
+ // user input is ever interpolated, so there is no command-injection surface.
316
+ // Exported for unit tests: the win32 branch must be assertable off-Windows.
317
+ export function buildNpmRootCommand(platform = process.platform, env = process.env) {
318
+ if (platform === 'win32') {
319
+ return {
320
+ cmd: env.COMSPEC || 'cmd.exe',
321
+ args: ['/d', '/s', '/c', 'npm root -g'],
322
+ // cmd.exe must receive `npm root -g` as one token; Node's default quoting
323
+ // would wrap it in quotes that cmd then fails to parse.
324
+ windowsVerbatimArguments: true,
325
+ };
326
+ }
327
+ return { cmd: 'npm', args: ['root', '-g'], windowsVerbatimArguments: false };
328
+ }
329
+
330
+ // npm may prepend warnings (funding/update notices) to stdout; the resolved path
331
+ // is the last non-empty line. Exported for unit tests.
332
+ export function parseNpmRootOutput(raw) {
333
+ const lines = String(raw ?? '').split(/\r?\n/).map(s => s.trim()).filter(Boolean);
334
+ return lines.length ? lines[lines.length - 1] : null;
335
+ }
336
+
304
337
  export function getGlobalNodeModulesDir() {
338
+ const { cmd, args, windowsVerbatimArguments } = buildNpmRootCommand();
305
339
  try {
306
- return execFileSync(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['root', '-g'], {
340
+ const out = execFileSync(cmd, args, {
307
341
  encoding: 'utf-8',
308
342
  windowsHide: true,
309
- timeout: 2000,
343
+ // npm on Windows (cmd.exe + Defender) is routinely slower than 2s; a
344
+ // premature timeout was itself a source of "claude not found".
345
+ timeout: 10000,
310
346
  maxBuffer: 1024 * 1024,
311
- }).trim();
347
+ stdio: ['ignore', 'pipe', 'ignore'],
348
+ windowsVerbatimArguments,
349
+ });
350
+ const dir = parseNpmRootOutput(out);
351
+ if (dir && existsSync(dir)) return dir;
352
+ return dir || inferGlobalNodeModulesDir();
312
353
  } catch {
313
- return null;
354
+ // npm missing, not on PATH, or slower than the timeout — fall back to the
355
+ // well-known layouts so discovery still works without ever running npm.
356
+ return inferGlobalNodeModulesDir();
314
357
  }
315
358
  }
316
359
 
360
+ // Ordered candidate list for the npm-free global-root fallback. Pure (no fs
361
+ // access) and parameterized so tests can assert the win32 ordering off-Windows.
362
+ export function globalNodeModulesCandidates(platform = process.platform, env = process.env, home = homedir()) {
363
+ // Use the target platform's separator so the win32 branch is assertable from a
364
+ // POSIX test run (at runtime on Windows this is exactly what `join` does).
365
+ const pj = platform === 'win32' ? win32.join : join;
366
+ const candidates = [];
367
+ const prefix = env.NPM_CONFIG_PREFIX || env.npm_config_prefix;
368
+ if (prefix) {
369
+ // Windows installs land directly in <prefix>/node_modules; POSIX adds lib/.
370
+ candidates.push(pj(prefix, 'node_modules'), pj(prefix, 'lib', 'node_modules'));
371
+ }
372
+ if (platform === 'win32') {
373
+ // The default `npm i -g` target for the official Node installer.
374
+ if (env.APPDATA) candidates.push(pj(env.APPDATA, 'npm', 'node_modules'));
375
+ if (env.ProgramFiles) candidates.push(pj(env.ProgramFiles, 'nodejs', 'node_modules'));
376
+ if (env.LOCALAPPDATA) {
377
+ candidates.push(pj(env.LOCALAPPDATA, 'nvm', 'node_modules'));
378
+ candidates.push(pj(env.LOCALAPPDATA, 'Volta', 'tools', 'image', 'node_modules'));
379
+ }
380
+ } else {
381
+ candidates.push(
382
+ pj(home, '.npm-global', 'lib', 'node_modules'),
383
+ '/usr/local/lib/node_modules',
384
+ '/opt/homebrew/lib/node_modules',
385
+ pj(home, '.volta', 'tools', 'image', 'node_modules'),
386
+ );
387
+ }
388
+ // The dir holding cc-viewer itself IS a global node_modules when ccv was
389
+ // installed with `npm i -g` — a reliable last resort on any platform.
390
+ candidates.push(NODE_MODULES);
391
+ return candidates.filter(Boolean);
392
+ }
393
+
394
+ // npm-free fallback for the global node_modules root. `npm root -g` can fail for
395
+ // reasons that have nothing to do with whether Claude Code is installed (npm not
396
+ // on a GUI process's PATH, a corporate shim that is slow to start, EINVAL as
397
+ // above). These are the canonical global prefixes; the first one that exists wins.
398
+ // L7: these are absolute machine paths that ignore PATH/HOME isolation exactly
399
+ // like the raw NATIVE_CANDIDATES — blocked under test context, where `npm root -g`
400
+ // (real or fixture) remains the only sanctioned seam.
401
+ export function inferGlobalNodeModulesDir() {
402
+ if (isRealClaudeLookupBlocked()) return null;
403
+ for (const dir of globalNodeModulesCandidates()) {
404
+ if (existsSync(dir)) return dir;
405
+ }
406
+ return null;
407
+ }
408
+
317
409
  export function resolveCliPath() {
318
410
  // Candidate base directories: local node_modules (cc-viewer's sibling) + global node_modules.
319
411
  // L7: under test context the NODE_MODULES sibling scan is blocked — on 1.x-layout machines it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-viewer",
3
- "version": "1.7.7",
3
+ "version": "1.7.8",
4
4
  "description": "Claude Code logging, visualization, and management toolkit — launch a web viewer alongside Claude Code with full request/response tracing, proxy, and mobile support",
5
5
  "license": "MIT",
6
6
  "main": "server.js",
@@ -9,6 +9,7 @@
9
9
  import { mkdirSync } from 'node:fs';
10
10
  import { join } from 'node:path';
11
11
  import { AsyncWriteQueue } from './async-write-queue.js';
12
+ import { reportSwallowed } from './error-report.js';
12
13
 
13
14
  // ── Detail record schema ──────────────────────────────────────────────
14
15
  // Appends one JSON line after each proxied LLM API request completes. Fields align with llm-retry-proxy's retry records.
@@ -120,7 +121,11 @@ export function appendRecord(filePath, record, onDone) {
120
121
  try {
121
122
  mkdirSync(dir, { recursive: true });
122
123
  _dirsEnsured.add(dir);
123
- } catch { /* No permission — the queued append will surface the failure as a silent no-op */ }
124
+ } catch (err) {
125
+ // No permission / read-only fs — the queued append will surface the failure
126
+ // as a silent no-op. Record it so the cause isn't fully invisible.
127
+ reportSwallowed('proxyStats.mkdir', err);
128
+ }
124
129
  }
125
130
  _statsWriteQueue.appendTo(filePath, JSON.stringify(record) + '\n', onDone);
126
131
  }
@@ -147,9 +152,9 @@ export function emitProxyStatsUpdate(fileName) {
147
152
  try {
148
153
  _statsUpdateListener(fileName);
149
154
  } catch (err) {
150
- if (process.env.CCV_DEBUG) {
151
- console.error('[CC-Viewer Proxy] proxy stats notify failed:', err?.message);
152
- }
155
+ // A throwing listener would silently break stats propagation (the SSE push,
156
+ // recompute trigger, etc.). Record it instead of swallowing silently.
157
+ reportSwallowed('proxyStats.emit', err);
153
158
  }
154
159
  }
155
160
 
@@ -196,6 +201,37 @@ export function computeStreak(records) {
196
201
  return { current: { type: curType || 'success', count: curCount }, worstFailure };
197
202
  }
198
203
 
204
+ /**
205
+ * Retry-burden bucket definitions: turns the raw retry-count distribution into
206
+ * actionable buckets (0 / 1-5 / 6-20 / 21-50 / >50). Aligned with llm-retry-proxy's
207
+ * renderBurdenChart buckets. `key` is the stable i18n id (ui.proxyStats.retryBurdenBuckets.<key>).
208
+ *
209
+ * `range` is [min, max] with `max: null` meaning "open ended". Deliberately not
210
+ * `Infinity`: this table's shape is mirrored into the stats JSON, and
211
+ * JSON.stringify(Infinity) is `null` anyway — spelling it null keeps the
212
+ * in-process value and the serialized value identical.
213
+ *
214
+ * Exposed for tests that want to assert the frozen bucket contract without re-typing
215
+ * the boundaries.
216
+ */
217
+ export const RETRY_BURDEN_BUCKETS = [
218
+ { key: '0', range: [0, 0] },
219
+ { key: '1_5', range: [1, 5] },
220
+ { key: '6_20', range: [6, 20] },
221
+ { key: '21_50', range: [21, 50] },
222
+ { key: 'over50', range: [51, null] },
223
+ ];
224
+
225
+ // Bump the bucket whose range covers `retries`. Buckets are ordered low→high
226
+ // and non-overlapping, so the first match wins; returns void (mutates `counts`).
227
+ // A null upper bound is open ended.
228
+ function bumpBurden(counts, retries) {
229
+ for (const b of counts) {
230
+ const [min, max] = b.range;
231
+ if (retries >= min && (max === null || retries <= max)) { b.count++; return; }
232
+ }
233
+ }
234
+
199
235
  /**
200
236
  * Aggregate a batch of detail records into a stats structure. Called by stats-worker, also used directly by /api/proxy-stats.
201
237
  *
@@ -233,6 +269,8 @@ export function aggregateRecords(records, opts = {}) {
233
269
  const byModelMap = new Map();
234
270
  const byPathMap = new Map();
235
271
  const byProfileMap = new Map();
272
+ // Retry-burden buckets bumped inline during the main loop (avoids a second O(n) pass).
273
+ const retryBurdenCounts = RETRY_BURDEN_BUCKETS.map(b => ({ ...b, count: 0 }));
236
274
  let slowest = null;
237
275
  let fastest = null;
238
276
 
@@ -249,21 +287,22 @@ export function aggregateRecords(records, opts = {}) {
249
287
  }
250
288
  durations.push(dur);
251
289
  retryDist.set(retries, (retryDist.get(retries) || 0) + 1);
290
+ bumpBurden(retryBurdenCounts, retries);
252
291
  for (const c of (r.retry_codes || [])) {
253
292
  retryCodeCounts.set(c, (retryCodeCounts.get(c) || 0) + 1);
254
293
  }
255
294
  // by model
256
295
  const model = r.model || '(unknown)';
257
296
  if (!byModelMap.has(model)) byModelMap.set(model, newBucket());
258
- accBucket(byModelMap.get(model), retries, ok, dur);
297
+ accBucket(byModelMap.get(model), retries, ok, dur, r.retry_codes);
259
298
  // by path
260
299
  const path = r.path || '/';
261
300
  if (!byPathMap.has(path)) byPathMap.set(path, newBucket());
262
- accBucket(byPathMap.get(path), retries, ok, dur);
301
+ accBucket(byPathMap.get(path), retries, ok, dur, r.retry_codes);
263
302
  // by profile
264
303
  const profileKey = r.profile_id || 'default';
265
304
  if (!byProfileMap.has(profileKey)) byProfileMap.set(profileKey, { ...newBucket(), profile_name: r.profile_name || 'Default' });
266
- accBucket(byProfileMap.get(profileKey), retries, ok, dur);
305
+ accBucket(byProfileMap.get(profileKey), retries, ok, dur, r.retry_codes);
267
306
  // slowest / fastest (fastest only counts successes with dur>0)
268
307
  const candidate = { ts: r.ts, path, model, attempts: r.attempts, retries, duration_ms: dur, final_status: r.final_status, retry_codes: r.retry_codes || [] };
269
308
  if (!slowest || dur > slowest.duration_ms) slowest = candidate;
@@ -301,10 +340,11 @@ export function aggregateRecords(records, opts = {}) {
301
340
  },
302
341
  byModel: mapToSortedArray(byModelMap, 'model'),
303
342
  byPath: mapToSortedArray(byPathMap, 'path').slice(0, 10), // Top 10 path
304
- byProfile: mapToSortedArrayWithExtra(byProfileMap, 'profile_id', 'profile_name'),
343
+ byProfile: mapToSortedArray(byProfileMap, 'profile_id', 'profile_name'),
305
344
  retryDistribution: [...retryDist.entries()]
306
345
  .sort((a, b) => a[0] - b[0])
307
346
  .map(([retries, count]) => ({ retries, count })),
347
+ retryBurden: retryBurdenCounts,
308
348
  retryCodes: [...retryCodeCounts.entries()]
309
349
  .sort((a, b) => b[1] - a[1])
310
350
  .map(([code, count]) => ({ code, count })),
@@ -315,10 +355,10 @@ export function aggregateRecords(records, opts = {}) {
315
355
  }
316
356
 
317
357
  function newBucket() {
318
- return { requests: 0, retries: 0, succeeded: 0, firstOk: 0, failed: 0, durations: [] };
358
+ return { requests: 0, retries: 0, succeeded: 0, firstOk: 0, failed: 0, durations: [], retryCodeCounts: new Map() };
319
359
  }
320
360
 
321
- function accBucket(b, retries, ok, dur) {
361
+ function accBucket(b, retries, ok, dur, retryCodes) {
322
362
  b.requests++;
323
363
  b.retries += retries;
324
364
  if (ok) {
@@ -328,46 +368,48 @@ function accBucket(b, retries, ok, dur) {
328
368
  b.failed++;
329
369
  }
330
370
  b.durations.push(dur);
371
+ for (const c of (retryCodes || [])) {
372
+ if (Number.isFinite(c)) b.retryCodeCounts.set(c, (b.retryCodeCounts.get(c) || 0) + 1);
373
+ }
331
374
  }
332
375
 
333
- function mapToSortedArray(map, keyName) {
334
- const arr = [];
335
- for (const [k, b] of map.entries()) {
336
- b.durations.sort((a, c) => a - c);
337
- const entry = {
338
- [keyName]: k,
339
- requests: b.requests,
340
- retries: b.retries,
341
- succeeded: b.succeeded,
342
- firstOk: b.firstOk,
343
- failed: b.failed,
344
- availabilityPct: b.requests ? round2(b.succeeded / b.requests * 100) : 0,
345
- upstreamAvailabilityPct: b.requests ? round2(b.firstOk / b.requests * 100) : 0,
346
- p95Ms: round3(percentile(b.durations, 0.95)),
347
- };
348
- arr.push(entry);
349
- }
350
- arr.sort((a, b) => b.requests - a.requests);
351
- return arr;
376
+ // Finalize a bucket's per-bucket retry-code map into top-5 array + dominant fail code.
377
+ function finalizeRetryCodes(b) {
378
+ const arr = [...(b.retryCodeCounts?.entries() || [])]
379
+ .sort((a, c) => c[1] - a[1])
380
+ .slice(0, 5)
381
+ .map(([code, count]) => ({ code, count }));
382
+ const top = arr[0] || null;
383
+ return {
384
+ retryCodeCounts: arr,
385
+ dominantFailStatus: top ? top.code : null,
386
+ dominantFailCount: top ? top.count : 0,
387
+ };
352
388
  }
353
389
 
354
- // byProfile-specific: the bucket carries an extra profile_name field, included in the output
355
- function mapToSortedArrayWithExtra(map, keyName, extraName) {
390
+ // Flatten a dimension's bucket map into a sorted entry array.
391
+ // `extraName` (optional, used by byProfile) emits an extra `[extraName]: bucket[extraName] || k`
392
+ // field — the only structural difference between the byModel/byPath and byProfile outputs.
393
+ function mapToSortedArray(map, keyName, extraName) {
356
394
  const arr = [];
357
395
  for (const [k, b] of map.entries()) {
358
396
  b.durations.sort((a, c) => a - c);
397
+ const fin = finalizeRetryCodes(b);
359
398
  const entry = {
360
399
  [keyName]: k,
361
- [extraName]: b[extraName] || k,
362
400
  requests: b.requests,
363
401
  retries: b.retries,
364
402
  succeeded: b.succeeded,
365
403
  firstOk: b.firstOk,
366
404
  failed: b.failed,
405
+ retryCodeCounts: fin.retryCodeCounts,
406
+ dominantFailStatus: fin.dominantFailStatus,
407
+ dominantFailCount: fin.dominantFailCount,
367
408
  availabilityPct: b.requests ? round2(b.succeeded / b.requests * 100) : 0,
368
409
  upstreamAvailabilityPct: b.requests ? round2(b.firstOk / b.requests * 100) : 0,
369
410
  p95Ms: round3(percentile(b.durations, 0.95)),
370
411
  };
412
+ if (extraName) entry[extraName] = b[extraName] || k;
371
413
  arr.push(entry);
372
414
  }
373
415
  arr.sort((a, b) => b.requests - a.requests);
@@ -386,6 +428,7 @@ function emptyStats() {
386
428
  byPath: [],
387
429
  byProfile: [],
388
430
  retryDistribution: [],
431
+ retryBurden: [],
389
432
  retryCodes: [],
390
433
  slowest: null,
391
434
  fastest: null,