cc-viewer 1.6.271 → 1.6.272

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 (78) hide show
  1. package/dist/assets/App-KL1CbE6B.js +1 -0
  2. package/dist/assets/App-TGGslOeT.css +1 -0
  3. package/dist/assets/{MdxEditorPanel-B7oOvR3k.js → MdxEditorPanel-B9-2mx30.js} +1 -1
  4. package/dist/assets/Mobile-BzYULksa.js +1 -0
  5. package/dist/assets/{_baseUniq-Dgkw4IXM.js → _baseUniq-CPJrFyUF.js} +1 -1
  6. package/dist/assets/{arc-AiHQLijx.js → arc-BLBrFElt.js} +1 -1
  7. package/dist/assets/{architectureDiagram-Q4EWVU46-CPRvAIHK.js → architectureDiagram-Q4EWVU46-CbnBsMiQ.js} +1 -1
  8. package/dist/assets/{blockDiagram-DXYQGD6D-CK2cwrfX.js → blockDiagram-DXYQGD6D-0mYr6-Fl.js} +1 -1
  9. package/dist/assets/{c4Diagram-AHTNJAMY-BP-UBbgv.js → c4Diagram-AHTNJAMY-CS7vcr0z.js} +1 -1
  10. package/dist/assets/{channel-Ny3Nm_-t.js → channel-CF3zZzSR.js} +1 -1
  11. package/dist/assets/{chunk-4BX2VUAB-DdsULqPZ.js → chunk-4BX2VUAB-1FZYtnJ7.js} +1 -1
  12. package/dist/assets/{chunk-4TB4RGXK-BDSjQHh0.js → chunk-4TB4RGXK-COs1qui5.js} +1 -1
  13. package/dist/assets/{chunk-55IACEB6-DrKr3wBa.js → chunk-55IACEB6-p77Qw3wN.js} +1 -1
  14. package/dist/assets/{chunk-EDXVE4YY-o_0SUbAB.js → chunk-EDXVE4YY-5qaIrQKg.js} +1 -1
  15. package/dist/assets/{chunk-FMBD7UC4-Ca_AgqWi.js → chunk-FMBD7UC4-DmCR8mDZ.js} +1 -1
  16. package/dist/assets/{chunk-OYMX7WX6-CyWWbq5o.js → chunk-OYMX7WX6-D6xDfgW3.js} +1 -1
  17. package/dist/assets/{chunk-QZHKN3VN-5rXHErSL.js → chunk-QZHKN3VN-B6cmUU0N.js} +1 -1
  18. package/dist/assets/{chunk-YZCP3GAM-DznXBadU.js → chunk-YZCP3GAM-l-OyOqnn.js} +1 -1
  19. package/dist/assets/classDiagram-6PBFFD2Q-BiCYgTHO.js +1 -0
  20. package/dist/assets/classDiagram-v2-HSJHXN6E-BiCYgTHO.js +1 -0
  21. package/dist/assets/clone-ChTCnPsO.js +1 -0
  22. package/dist/assets/{cose-bilkent-S5V4N54A-BhGyix0v.js → cose-bilkent-S5V4N54A-CEzaS8XS.js} +1 -1
  23. package/dist/assets/{dagre-KV5264BT-CzzHxIvc.js → dagre-KV5264BT-B3U2njWW.js} +1 -1
  24. package/dist/assets/{diagram-5BDNPKRD-tu3BXl0c.js → diagram-5BDNPKRD-BRSDbyBr.js} +1 -1
  25. package/dist/assets/{diagram-G4DWMVQ6-C6WkK7sj.js → diagram-G4DWMVQ6-BZfOi9B7.js} +1 -1
  26. package/dist/assets/{diagram-MMDJMWI5-DBeD_WW-.js → diagram-MMDJMWI5-CWpb3Cg0.js} +1 -1
  27. package/dist/assets/{diagram-TYMM5635-BXUyHHJ4.js → diagram-TYMM5635-CTJyBSVj.js} +1 -1
  28. package/dist/assets/{erDiagram-SMLLAGMA-Bye5tnW2.js → erDiagram-SMLLAGMA-CHtTRd5S.js} +1 -1
  29. package/dist/assets/{flowDiagram-DWJPFMVM-C3pYOs38.js → flowDiagram-DWJPFMVM-Bda8X-WJ.js} +1 -1
  30. package/dist/assets/{ganttDiagram-T4ZO3ILL-DxXkI_FW.js → ganttDiagram-T4ZO3ILL-CPfnGu5V.js} +1 -1
  31. package/dist/assets/{gitGraphDiagram-UUTBAWPF-nsxsXsGX.js → gitGraphDiagram-UUTBAWPF-B5QxesQg.js} +1 -1
  32. package/dist/assets/{graph-Da-Z9hB7.js → graph-ChltdhTU.js} +1 -1
  33. package/dist/assets/{index-4gmR7Eun.js → index-B7lK5fJz.js} +1 -1
  34. package/dist/assets/{index-C8w5Sxw3.js → index-BK4sui_O.js} +1 -1
  35. package/dist/assets/{index-CA8JGh5J.js → index-C2fhupP6.js} +1 -1
  36. package/dist/assets/{index-D7XF7UJ8.js → index-C5PA4OJg.js} +1 -1
  37. package/dist/assets/{index-C0PhJcXG.js → index-CfEkC3bc.js} +1 -1
  38. package/dist/assets/{index-Brh2V8V0.js → index-DyGa-jNv.js} +1 -1
  39. package/dist/assets/{index-CLfbZzwF.js → index-Yhf-Rgbr.js} +2 -2
  40. package/dist/assets/{index-CsuhosSl.js → index-yClPXlMf.js} +1 -1
  41. package/dist/assets/{infoDiagram-42DDH7IO-Ca9j90t5.js → infoDiagram-42DDH7IO-CD4TS4O2.js} +1 -1
  42. package/dist/assets/{ishikawaDiagram-UXIWVN3A-DhjV0XPD.js → ishikawaDiagram-UXIWVN3A-jhiYabQ7.js} +1 -1
  43. package/dist/assets/{journeyDiagram-VCZTEJTY-CRSHLZPV.js → journeyDiagram-VCZTEJTY-BDzIXxxt.js} +1 -1
  44. package/dist/assets/{jszip.min-CcCCdMNW.js → jszip.min-CuGGBMI4.js} +1 -1
  45. package/dist/assets/{kanban-definition-6JOO6SKY-Bg0CUwgc.js → kanban-definition-6JOO6SKY-D34MYATQ.js} +1 -1
  46. package/dist/assets/{layout-CWNu13XT.js → layout-D6sLAapX.js} +1 -1
  47. package/dist/assets/{linear-Dcmw1639.js → linear-CFV4P-wn.js} +1 -1
  48. package/dist/assets/{mermaid.core-1heNIJ5f.js → mermaid.core-YmJi7T-s.js} +2 -2
  49. package/dist/assets/{min-CC9CkAxn.js → min-akJQqRMn.js} +1 -1
  50. package/dist/assets/{mindmap-definition-QFDTVHPH-Gr0ex_Ny.js → mindmap-definition-QFDTVHPH-w5zaJyrN.js} +1 -1
  51. package/dist/assets/{pieDiagram-DEJITSTG-D7P3sUJY.js → pieDiagram-DEJITSTG-B6EM4Ow6.js} +1 -1
  52. package/dist/assets/{quadrantDiagram-34T5L4WZ-Bov3lcpV.js → quadrantDiagram-34T5L4WZ-2TmBxFy-.js} +1 -1
  53. package/dist/assets/{requirementDiagram-MS252O5E-BcLptaOU.js → requirementDiagram-MS252O5E-EOjvbxUy.js} +1 -1
  54. package/dist/assets/{sankeyDiagram-XADWPNL6-B2qAUsON.js → sankeyDiagram-XADWPNL6-BmTQD5eT.js} +1 -1
  55. package/dist/assets/seqResourceLoaders-B2bHcUzO.js +2 -0
  56. package/dist/assets/{seqResourceLoaders-N07Gfom9.css → seqResourceLoaders-CaZOVtSc.css} +1 -1
  57. package/dist/assets/{sequenceDiagram-FGHM5R23-Do62Uz-a.js → sequenceDiagram-FGHM5R23-CLjtqA1D.js} +1 -1
  58. package/dist/assets/{stateDiagram-FHFEXIEX-Wu8aqa8C.js → stateDiagram-FHFEXIEX-Cbq90iZ8.js} +1 -1
  59. package/dist/assets/{stateDiagram-v2-QKLJ7IA2-BfYq7Jgo.js → stateDiagram-v2-QKLJ7IA2-BKDg-3t_.js} +1 -1
  60. package/dist/assets/{timeline-definition-GMOUNBTQ-DYfz5xD6.js → timeline-definition-GMOUNBTQ-f3kEDay0.js} +1 -1
  61. package/dist/assets/{vendor-antd-BG1SvzuN.js → vendor-antd-5xE7sz6B.js} +1 -1
  62. package/dist/assets/{vendor-codemirror-8NDhydlF.js → vendor-codemirror-ib-jPbXC.js} +1 -1
  63. package/dist/assets/{vendor-mdxeditor-BB4hhpxM.js → vendor-mdxeditor-BdKMdw6O.js} +2 -2
  64. package/dist/assets/{vendor-qrcode-DMsNGQ10.js → vendor-qrcode-vKlE-WYu.js} +1 -1
  65. package/dist/assets/{vendor-virtuoso-BUT96ALa.js → vendor-virtuoso-DOIfjLfU.js} +1 -1
  66. package/dist/assets/{vennDiagram-DHZGUBPP-CGr-cc7e.js → vennDiagram-DHZGUBPP-0GDSFVnH.js} +1 -1
  67. package/dist/assets/{wardley-RL74JXVD-BN899vMf.js → wardley-RL74JXVD-B2rj5j7G.js} +1 -1
  68. package/dist/assets/{wardleyDiagram-NUSXRM2D-xUsI1E7h.js → wardleyDiagram-NUSXRM2D-COVTciJP.js} +1 -1
  69. package/dist/assets/{xychartDiagram-5P7HB3ND-woQrslzB.js → xychartDiagram-5P7HB3ND-DXoLnGxX.js} +1 -1
  70. package/dist/index.html +4 -4
  71. package/package.json +1 -1
  72. package/dist/assets/App-DOYmReD4.css +0 -1
  73. package/dist/assets/App-LEYaH-CM.js +0 -1
  74. package/dist/assets/Mobile-Cwf21Pmq.js +0 -1
  75. package/dist/assets/classDiagram-6PBFFD2Q-CLYcbnwx.js +0 -1
  76. package/dist/assets/classDiagram-v2-HSJHXN6E-CLYcbnwx.js +0 -1
  77. package/dist/assets/clone-5GFhU8Pv.js +0 -1
  78. package/dist/assets/seqResourceLoaders-CmFg0jyW.js +0 -2
@@ -1 +1 @@
1
- import{_ as __name,as as markers_default,at as clear2,au as clear,av as clear$1,l as log,c as getConfig2,aw as updateNodeBounds,ax as setNodeElem,af as insertNode,al as getSubGraphTitleMargins,ag as positionNode,ae as insertCluster,ay as insertEdge,az as positionEdgeLabel,aA as insertEdgeLabel}from"./mermaid.core-1heNIJ5f.js";import{i as isUndefined,G as Graph}from"./graph-Da-Z9hB7.js";import{l as layout}from"./layout-CWNu13XT.js";import{c as clone}from"./clone-5GFhU8Pv.js";import{m as map}from"./min-CC9CkAxn.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";import"./_baseUniq-Dgkw4IXM.js";function write(g){var json={options:{directed:g.isDirected(),multigraph:g.isMultigraph(),compound:g.isCompound()},nodes:writeNodes(g),edges:writeEdges(g)};return isUndefined(g.graph())||(json.value=clone(g.graph())),json}function writeNodes(g){return map(g.nodes(),function(v){var nodeValue=g.node(v),parent=g.parent(v),node={v:v};return isUndefined(nodeValue)||(node.value=nodeValue),isUndefined(parent)||(node.parent=parent),node})}function writeEdges(g){return map(g.edges(),function(e){var edgeValue=g.edge(e),edge={v:e.v,w:e.w};return isUndefined(e.name)||(edge.name=e.name),isUndefined(edgeValue)||(edge.value=edgeValue),edge})}var clusterDb=new Map,descendants=new Map,parents=new Map,clear4=__name(()=>{descendants.clear(),parents.clear(),clusterDb.clear()},"clear"),isDescendant=__name((id,ancestorId)=>{const ancestorDescendants=descendants.get(ancestorId)||[];return log.trace("In isDescendant",ancestorId," ",id," = ",ancestorDescendants.includes(id)),ancestorDescendants.includes(id)},"isDescendant"),edgeInCluster=__name((edge,clusterId)=>{const clusterDescendants=descendants.get(clusterId)||[];return log.info("Descendants of ",clusterId," is ",clusterDescendants),log.info("Edge is ",edge),edge.v!==clusterId&&edge.w!==clusterId&&(clusterDescendants?clusterDescendants.includes(edge.v)||isDescendant(edge.v,clusterId)||isDescendant(edge.w,clusterId)||clusterDescendants.includes(edge.w):(log.debug("Tilt, ",clusterId,",not in descendants"),!1))},"edgeInCluster"),copy=__name((clusterId,graph,newGraph,rootId)=>{log.warn("Copying children of ",clusterId,"root",rootId,"data",graph.node(clusterId),rootId);const nodes=graph.children(clusterId)||[];clusterId!==rootId&&nodes.push(clusterId),log.warn("Copying (nodes) clusterId",clusterId,"nodes",nodes),nodes.forEach(node=>{if(graph.children(node).length>0)copy(node,graph,newGraph,rootId);else{const data=graph.node(node);log.info("cp ",node," to ",rootId," with parent ",clusterId),newGraph.setNode(node,data),rootId!==graph.parent(node)&&(log.warn("Setting parent",node,graph.parent(node)),newGraph.setParent(node,graph.parent(node))),clusterId!==rootId&&node!==clusterId?(log.debug("Setting parent",node,clusterId),newGraph.setParent(node,clusterId)):(log.info("In copy ",clusterId,"root",rootId,"data",graph.node(clusterId),rootId),log.debug("Not Setting parent for node=",node,"cluster!==rootId",clusterId!==rootId,"node!==clusterId",node!==clusterId));const edges=graph.edges(node);log.debug("Copying Edges",edges),edges.forEach(edge=>{log.info("Edge",edge);const data2=graph.edge(edge.v,edge.w,edge.name);log.info("Edge data",data2,rootId);try{edgeInCluster(edge,rootId)?(log.info("Copying as ",edge.v,edge.w,data2,edge.name),newGraph.setEdge(edge.v,edge.w,data2,edge.name),log.info("newGraph edges ",newGraph.edges(),newGraph.edge(newGraph.edges()[0]))):log.info("Skipping copy of edge ",edge.v,"--\x3e",edge.w," rootId: ",rootId," clusterId:",clusterId)}catch(e){log.error(e)}})}log.debug("Removing node",node),graph.removeNode(node)})},"copy"),extractDescendants=__name((id,graph)=>{const children=graph.children(id);let res=[...children];for(const child of children)parents.set(child,id),res=[...res,...extractDescendants(child,graph)];return res},"extractDescendants"),findCommonEdges=__name((graph,id1,id2)=>{const edges1=graph.edges().filter(edge=>edge.v===id1||edge.w===id1),edges2=graph.edges().filter(edge=>edge.v===id2||edge.w===id2),edges1Prim=edges1.map(edge=>({v:edge.v===id1?id2:edge.v,w:edge.w===id1?id1:edge.w})),edges2Prim=edges2.map(edge=>({v:edge.v,w:edge.w}));return edges1Prim.filter(edgeIn1=>edges2Prim.some(edge=>edgeIn1.v===edge.v&&edgeIn1.w===edge.w))},"findCommonEdges"),findNonClusterChild=__name((id,graph,clusterId)=>{const children=graph.children(id);if(log.trace("Searching children of id ",id,children),children.length<1)return id;let reserve;for(const child of children){const _id=findNonClusterChild(child,graph,clusterId),commonEdges=findCommonEdges(graph,clusterId,_id);if(_id){if(!(commonEdges.length>0))return _id;reserve=_id}}return reserve},"findNonClusterChild"),getAnchorId=__name(id=>clusterDb.has(id)&&clusterDb.get(id).externalConnections&&clusterDb.has(id)?clusterDb.get(id).id:id,"getAnchorId"),adjustClustersAndEdges=__name((graph,depth)=>{if(!graph||depth>10)log.debug("Opting out, no graph ");else{log.debug("Opting in, graph "),graph.nodes().forEach(function(id){graph.children(id).length>0&&(log.warn("Cluster identified",id," Replacement id in edges: ",findNonClusterChild(id,graph,id)),descendants.set(id,extractDescendants(id,graph)),clusterDb.set(id,{id:findNonClusterChild(id,graph,id),clusterData:graph.node(id)}))}),graph.nodes().forEach(function(id){const children=graph.children(id),edges=graph.edges();children.length>0?(log.debug("Cluster identified",id,descendants),edges.forEach(edge=>{isDescendant(edge.v,id)^isDescendant(edge.w,id)&&(log.warn("Edge: ",edge," leaves cluster ",id),log.warn("Descendants of XXX ",id,": ",descendants.get(id)),clusterDb.get(id).externalConnections=!0)})):log.debug("Not a cluster ",id,descendants)});for(let id of clusterDb.keys()){const nonClusterChild=clusterDb.get(id).id,parent=graph.parent(nonClusterChild);parent!==id&&clusterDb.has(parent)&&!clusterDb.get(parent).externalConnections&&(clusterDb.get(id).id=parent)}graph.edges().forEach(function(e){const edge=graph.edge(e);log.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),log.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(graph.edge(e)));let v=e.v,w=e.w;if(log.warn("Fix XXX",clusterDb,"ids:",e.v,e.w,"Translating: ",clusterDb.get(e.v)," --- ",clusterDb.get(e.w)),clusterDb.get(e.v)||clusterDb.get(e.w)){if(log.warn("Fixing and trying - removing XXX",e.v,e.w,e.name),v=getAnchorId(e.v),w=getAnchorId(e.w),graph.removeEdge(e.v,e.w,e.name),v!==e.v){const parent=graph.parent(v);clusterDb.get(parent).externalConnections=!0,edge.fromCluster=e.v}if(w!==e.w){const parent=graph.parent(w);clusterDb.get(parent).externalConnections=!0,edge.toCluster=e.w}log.warn("Fix Replacing with XXX",v,w,e.name),graph.setEdge(v,w,edge,e.name)}}),log.warn("Adjusted Graph",write(graph)),extractor(graph,0),log.trace(clusterDb)}},"adjustClustersAndEdges"),extractor=__name((graph,depth)=>{var _a,_b;if(log.warn("extractor - ",depth,write(graph),graph.children("D")),depth>10)return void log.error("Bailing out");let nodes=graph.nodes(),hasChildren=!1;for(const node of nodes){const children=graph.children(node);hasChildren=hasChildren||children.length>0}if(hasChildren){log.debug("Nodes = ",nodes,depth);for(const node of nodes)if(log.debug("Extracting node",node,clusterDb,clusterDb.has(node)&&!clusterDb.get(node).externalConnections,!graph.parent(node),graph.node(node),graph.children("D")," Depth ",depth),clusterDb.has(node))if(!clusterDb.get(node).externalConnections&&graph.children(node)&&graph.children(node).length>0){log.warn("Cluster without external connections, without a parent and with children",node,depth);let dir="TB"===graph.graph().rankdir?"LR":"TB";(null==(_b=null==(_a=clusterDb.get(node))?void 0:_a.clusterData)?void 0:_b.dir)&&(dir=clusterDb.get(node).clusterData.dir,log.warn("Fixing dir",clusterDb.get(node).clusterData.dir,dir));const clusterGraph=new Graph({multigraph:!0,compound:!0}).setGraph({rankdir:dir,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});log.warn("Old graph before copy",write(graph)),copy(node,graph,clusterGraph,node),graph.setNode(node,{clusterNode:!0,id:node,clusterData:clusterDb.get(node).clusterData,label:clusterDb.get(node).label,graph:clusterGraph}),log.warn("New graph after copy node: (",node,")",write(clusterGraph)),log.debug("Old graph after copy",write(graph))}else log.warn("Cluster ** ",node," **not meeting the criteria !externalConnections:",!clusterDb.get(node).externalConnections," no parent: ",!graph.parent(node)," children ",graph.children(node)&&graph.children(node).length>0,graph.children("D"),depth),log.debug(clusterDb);else log.debug("Not a cluster",node,depth);nodes=graph.nodes(),log.warn("New list of nodes",nodes);for(const node of nodes){const data=graph.node(node);log.warn(" Now next level",node,data),(null==data?void 0:data.clusterNode)&&extractor(data.graph,depth+1)}}else log.debug("Done, no node has children",graph.nodes())},"extractor"),sorter=__name((graph,nodes)=>{if(0===nodes.length)return[];let result=Object.assign([],nodes);return nodes.forEach(node=>{const children=graph.children(node),sorted=sorter(graph,children);result=[...result,...sorted]}),result},"sorter"),sortNodesByHierarchy=__name(graph=>sorter(graph,graph.children()),"sortNodesByHierarchy"),recursiveRender=__name(async(_elem,graph,diagramType,id,parentCluster,siteConfig)=>{log.warn("Graph in recursive render:XAX",write(graph),parentCluster);const dir=graph.graph().rankdir;log.trace("Dir in recursive render - dir:",dir);const elem=_elem.insert("g").attr("class","root");graph.nodes()?log.info("Recursive render XXX",graph.nodes()):log.info("No nodes found for",graph),graph.edges().length>0&&log.info("Recursive edges",graph.edge(graph.edges()[0]));const clusters=elem.insert("g").attr("class","clusters"),edgePaths=elem.insert("g").attr("class","edgePaths"),edgeLabels=elem.insert("g").attr("class","edgeLabels"),nodes=elem.insert("g").attr("class","nodes");await Promise.all(graph.nodes().map(async function(v){const node=graph.node(v);if(void 0!==parentCluster){const data=JSON.parse(JSON.stringify(parentCluster.clusterData));log.trace("Setting data for parent cluster XXX\n Node.id = ",v,"\n data=",data.height,"\nParent cluster",parentCluster.height),graph.setNode(parentCluster.id,data),graph.parent(v)||(log.trace("Setting parent",v,parentCluster.id),graph.setParent(v,parentCluster.id,data))}if(log.info("(Insert) Node XXX"+v+": "+JSON.stringify(graph.node(v))),null==node?void 0:node.clusterNode){log.info("Cluster identified XBX",v,node.width,graph.node(v));const{ranksep:ranksep,nodesep:nodesep}=graph.graph();node.graph.setGraph({...node.graph.graph(),ranksep:ranksep+25,nodesep:nodesep});const o=await recursiveRender(nodes,node.graph,diagramType,id,graph.node(v),siteConfig),newEl=o.elem;updateNodeBounds(node,newEl),node.diff=o.diff||0,log.info("New compound node after recursive render XAX",v,"width",node.width,"height",node.height),setNodeElem(newEl,node)}else graph.children(v).length>0?(log.trace("Cluster - the non recursive path XBX",v,node.id,node,node.width,"Graph:",graph),log.trace(findNonClusterChild(node.id,graph)),clusterDb.set(node.id,{id:findNonClusterChild(node.id,graph),node:node})):(log.trace("Node - the non recursive path XAX",v,nodes,graph.node(v),dir),await insertNode(nodes,graph.node(v),{config:siteConfig,dir:dir}))}));const processEdges=__name(async()=>{const edgePromises=graph.edges().map(async function(e){const edge=graph.edge(e.v,e.w,e.name);log.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),log.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(graph.edge(e))),log.info("Fix",clusterDb,"ids:",e.v,e.w,"Translating: ",clusterDb.get(e.v),clusterDb.get(e.w)),await insertEdgeLabel(edgeLabels,edge)});await Promise.all(edgePromises)},"processEdges");await processEdges(),log.info("Graph before layout:",JSON.stringify(write(graph))),log.info("############################################# XXX"),log.info("### Layout ### XXX"),log.info("############################################# XXX"),layout(graph),log.info("Graph after layout:",JSON.stringify(write(graph)));let diff=0,{subGraphTitleTotalMargin:subGraphTitleTotalMargin}=getSubGraphTitleMargins(siteConfig);return await Promise.all(sortNodesByHierarchy(graph).map(async function(v){var _a;const node=graph.node(v);if(log.info("Position XBX => "+v+": ("+node.x,","+node.y,") width: ",node.width," height: ",node.height),null==node?void 0:node.clusterNode)node.y+=subGraphTitleTotalMargin,log.info("A tainted cluster node XBX1",v,node.id,node.width,node.height,node.x,node.y,graph.parent(v)),clusterDb.get(node.id).node=node,positionNode(node);else if(graph.children(v).length>0){log.info("A pure cluster node XBX1",v,node.id,node.x,node.y,node.width,node.height,graph.parent(v)),node.height+=subGraphTitleTotalMargin,graph.node(node.parentId);const halfPadding=(null==node?void 0:node.padding)/2||0,labelHeight=(null==(_a=null==node?void 0:node.labelBBox)?void 0:_a.height)||0,offsetY=labelHeight-halfPadding||0;log.debug("OffsetY",offsetY,"labelHeight",labelHeight,"halfPadding",halfPadding),await insertCluster(clusters,node),clusterDb.get(node.id).node=node}else{const parent=graph.node(node.parentId);node.y+=subGraphTitleTotalMargin/2,log.info("A regular node XBX1 - using the padding",node.id,"parent",node.parentId,node.width,node.height,node.x,node.y,"offsetY",node.offsetY,"parent",parent,null==parent?void 0:parent.offsetY,node),positionNode(node)}})),graph.edges().forEach(function(e){const edge=graph.edge(e);log.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(edge),edge),edge.points.forEach(point=>point.y+=subGraphTitleTotalMargin/2);const startNode=graph.node(e.v);var endNode=graph.node(e.w);const paths=insertEdge(edgePaths,edge,clusterDb,diagramType,startNode,endNode,id);positionEdgeLabel(edge,paths)}),graph.nodes().forEach(function(v){const n=graph.node(v);log.info(v,n.type,n.diff),n.isGroup&&(diff=n.diff)}),log.warn("Returning from recursive render XAX",elem,diff),{elem:elem,diff:diff}},"recursiveRender"),render=__name(async(data4Layout,svg)=>{var _a,_b,_c,_d,_e,_f;const graph=new Graph({multigraph:!0,compound:!0}).setGraph({rankdir:data4Layout.direction,nodesep:(null==(_a=data4Layout.config)?void 0:_a.nodeSpacing)||(null==(_c=null==(_b=data4Layout.config)?void 0:_b.flowchart)?void 0:_c.nodeSpacing)||data4Layout.nodeSpacing,ranksep:(null==(_d=data4Layout.config)?void 0:_d.rankSpacing)||(null==(_f=null==(_e=data4Layout.config)?void 0:_e.flowchart)?void 0:_f.rankSpacing)||data4Layout.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),element=svg.select("g");markers_default(element,data4Layout.markers,data4Layout.type,data4Layout.diagramId),clear2(),clear(),clear$1(),clear4(),data4Layout.nodes.forEach(node=>{graph.setNode(node.id,{...node}),node.parentId&&graph.setParent(node.id,node.parentId)}),log.debug("Edges:",data4Layout.edges),data4Layout.edges.forEach(edge=>{if(edge.start===edge.end){const nodeId=edge.start,specialId1=nodeId+"---"+nodeId+"---1",specialId2=nodeId+"---"+nodeId+"---2",node=graph.node(nodeId);graph.setNode(specialId1,{domId:specialId1,id:specialId1,parentId:node.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),graph.setParent(specialId1,node.parentId),graph.setNode(specialId2,{domId:specialId2,id:specialId2,parentId:node.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),graph.setParent(specialId2,node.parentId);const edge1=structuredClone(edge),edgeMid=structuredClone(edge),edge2=structuredClone(edge);edge1.label="",edge1.arrowTypeEnd="none",edge1.id=nodeId+"-cyclic-special-1",edgeMid.arrowTypeStart="none",edgeMid.arrowTypeEnd="none",edgeMid.id=nodeId+"-cyclic-special-mid",edge2.label="",node.isGroup&&(edge1.fromCluster=nodeId,edge2.toCluster=nodeId),edge2.id=nodeId+"-cyclic-special-2",edge2.arrowTypeStart="none",graph.setEdge(nodeId,specialId1,edge1,nodeId+"-cyclic-special-0"),graph.setEdge(specialId1,specialId2,edgeMid,nodeId+"-cyclic-special-1"),graph.setEdge(specialId2,nodeId,edge2,nodeId+"-cyc<lic-special-2")}else graph.setEdge(edge.start,edge.end,{...edge},edge.id)}),log.warn("Graph at first:",JSON.stringify(write(graph))),adjustClustersAndEdges(graph),log.warn("Graph after XAX:",JSON.stringify(write(graph)));const siteConfig=getConfig2();await recursiveRender(element,graph,data4Layout.type,data4Layout.diagramId,void 0,siteConfig)},"render");export{render};
1
+ import{_ as __name,as as markers_default,at as clear2,au as clear,av as clear$1,l as log,c as getConfig2,aw as updateNodeBounds,ax as setNodeElem,af as insertNode,al as getSubGraphTitleMargins,ag as positionNode,ae as insertCluster,ay as insertEdge,az as positionEdgeLabel,aA as insertEdgeLabel}from"./mermaid.core-YmJi7T-s.js";import{i as isUndefined,G as Graph}from"./graph-ChltdhTU.js";import{l as layout}from"./layout-D6sLAapX.js";import{c as clone}from"./clone-ChTCnPsO.js";import{m as map}from"./min-akJQqRMn.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";import"./_baseUniq-CPJrFyUF.js";function write(g){var json={options:{directed:g.isDirected(),multigraph:g.isMultigraph(),compound:g.isCompound()},nodes:writeNodes(g),edges:writeEdges(g)};return isUndefined(g.graph())||(json.value=clone(g.graph())),json}function writeNodes(g){return map(g.nodes(),function(v){var nodeValue=g.node(v),parent=g.parent(v),node={v:v};return isUndefined(nodeValue)||(node.value=nodeValue),isUndefined(parent)||(node.parent=parent),node})}function writeEdges(g){return map(g.edges(),function(e){var edgeValue=g.edge(e),edge={v:e.v,w:e.w};return isUndefined(e.name)||(edge.name=e.name),isUndefined(edgeValue)||(edge.value=edgeValue),edge})}var clusterDb=new Map,descendants=new Map,parents=new Map,clear4=__name(()=>{descendants.clear(),parents.clear(),clusterDb.clear()},"clear"),isDescendant=__name((id,ancestorId)=>{const ancestorDescendants=descendants.get(ancestorId)||[];return log.trace("In isDescendant",ancestorId," ",id," = ",ancestorDescendants.includes(id)),ancestorDescendants.includes(id)},"isDescendant"),edgeInCluster=__name((edge,clusterId)=>{const clusterDescendants=descendants.get(clusterId)||[];return log.info("Descendants of ",clusterId," is ",clusterDescendants),log.info("Edge is ",edge),edge.v!==clusterId&&edge.w!==clusterId&&(clusterDescendants?clusterDescendants.includes(edge.v)||isDescendant(edge.v,clusterId)||isDescendant(edge.w,clusterId)||clusterDescendants.includes(edge.w):(log.debug("Tilt, ",clusterId,",not in descendants"),!1))},"edgeInCluster"),copy=__name((clusterId,graph,newGraph,rootId)=>{log.warn("Copying children of ",clusterId,"root",rootId,"data",graph.node(clusterId),rootId);const nodes=graph.children(clusterId)||[];clusterId!==rootId&&nodes.push(clusterId),log.warn("Copying (nodes) clusterId",clusterId,"nodes",nodes),nodes.forEach(node=>{if(graph.children(node).length>0)copy(node,graph,newGraph,rootId);else{const data=graph.node(node);log.info("cp ",node," to ",rootId," with parent ",clusterId),newGraph.setNode(node,data),rootId!==graph.parent(node)&&(log.warn("Setting parent",node,graph.parent(node)),newGraph.setParent(node,graph.parent(node))),clusterId!==rootId&&node!==clusterId?(log.debug("Setting parent",node,clusterId),newGraph.setParent(node,clusterId)):(log.info("In copy ",clusterId,"root",rootId,"data",graph.node(clusterId),rootId),log.debug("Not Setting parent for node=",node,"cluster!==rootId",clusterId!==rootId,"node!==clusterId",node!==clusterId));const edges=graph.edges(node);log.debug("Copying Edges",edges),edges.forEach(edge=>{log.info("Edge",edge);const data2=graph.edge(edge.v,edge.w,edge.name);log.info("Edge data",data2,rootId);try{edgeInCluster(edge,rootId)?(log.info("Copying as ",edge.v,edge.w,data2,edge.name),newGraph.setEdge(edge.v,edge.w,data2,edge.name),log.info("newGraph edges ",newGraph.edges(),newGraph.edge(newGraph.edges()[0]))):log.info("Skipping copy of edge ",edge.v,"--\x3e",edge.w," rootId: ",rootId," clusterId:",clusterId)}catch(e){log.error(e)}})}log.debug("Removing node",node),graph.removeNode(node)})},"copy"),extractDescendants=__name((id,graph)=>{const children=graph.children(id);let res=[...children];for(const child of children)parents.set(child,id),res=[...res,...extractDescendants(child,graph)];return res},"extractDescendants"),findCommonEdges=__name((graph,id1,id2)=>{const edges1=graph.edges().filter(edge=>edge.v===id1||edge.w===id1),edges2=graph.edges().filter(edge=>edge.v===id2||edge.w===id2),edges1Prim=edges1.map(edge=>({v:edge.v===id1?id2:edge.v,w:edge.w===id1?id1:edge.w})),edges2Prim=edges2.map(edge=>({v:edge.v,w:edge.w}));return edges1Prim.filter(edgeIn1=>edges2Prim.some(edge=>edgeIn1.v===edge.v&&edgeIn1.w===edge.w))},"findCommonEdges"),findNonClusterChild=__name((id,graph,clusterId)=>{const children=graph.children(id);if(log.trace("Searching children of id ",id,children),children.length<1)return id;let reserve;for(const child of children){const _id=findNonClusterChild(child,graph,clusterId),commonEdges=findCommonEdges(graph,clusterId,_id);if(_id){if(!(commonEdges.length>0))return _id;reserve=_id}}return reserve},"findNonClusterChild"),getAnchorId=__name(id=>clusterDb.has(id)&&clusterDb.get(id).externalConnections&&clusterDb.has(id)?clusterDb.get(id).id:id,"getAnchorId"),adjustClustersAndEdges=__name((graph,depth)=>{if(!graph||depth>10)log.debug("Opting out, no graph ");else{log.debug("Opting in, graph "),graph.nodes().forEach(function(id){graph.children(id).length>0&&(log.warn("Cluster identified",id," Replacement id in edges: ",findNonClusterChild(id,graph,id)),descendants.set(id,extractDescendants(id,graph)),clusterDb.set(id,{id:findNonClusterChild(id,graph,id),clusterData:graph.node(id)}))}),graph.nodes().forEach(function(id){const children=graph.children(id),edges=graph.edges();children.length>0?(log.debug("Cluster identified",id,descendants),edges.forEach(edge=>{isDescendant(edge.v,id)^isDescendant(edge.w,id)&&(log.warn("Edge: ",edge," leaves cluster ",id),log.warn("Descendants of XXX ",id,": ",descendants.get(id)),clusterDb.get(id).externalConnections=!0)})):log.debug("Not a cluster ",id,descendants)});for(let id of clusterDb.keys()){const nonClusterChild=clusterDb.get(id).id,parent=graph.parent(nonClusterChild);parent!==id&&clusterDb.has(parent)&&!clusterDb.get(parent).externalConnections&&(clusterDb.get(id).id=parent)}graph.edges().forEach(function(e){const edge=graph.edge(e);log.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),log.warn("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(graph.edge(e)));let v=e.v,w=e.w;if(log.warn("Fix XXX",clusterDb,"ids:",e.v,e.w,"Translating: ",clusterDb.get(e.v)," --- ",clusterDb.get(e.w)),clusterDb.get(e.v)||clusterDb.get(e.w)){if(log.warn("Fixing and trying - removing XXX",e.v,e.w,e.name),v=getAnchorId(e.v),w=getAnchorId(e.w),graph.removeEdge(e.v,e.w,e.name),v!==e.v){const parent=graph.parent(v);clusterDb.get(parent).externalConnections=!0,edge.fromCluster=e.v}if(w!==e.w){const parent=graph.parent(w);clusterDb.get(parent).externalConnections=!0,edge.toCluster=e.w}log.warn("Fix Replacing with XXX",v,w,e.name),graph.setEdge(v,w,edge,e.name)}}),log.warn("Adjusted Graph",write(graph)),extractor(graph,0),log.trace(clusterDb)}},"adjustClustersAndEdges"),extractor=__name((graph,depth)=>{var _a,_b;if(log.warn("extractor - ",depth,write(graph),graph.children("D")),depth>10)return void log.error("Bailing out");let nodes=graph.nodes(),hasChildren=!1;for(const node of nodes){const children=graph.children(node);hasChildren=hasChildren||children.length>0}if(hasChildren){log.debug("Nodes = ",nodes,depth);for(const node of nodes)if(log.debug("Extracting node",node,clusterDb,clusterDb.has(node)&&!clusterDb.get(node).externalConnections,!graph.parent(node),graph.node(node),graph.children("D")," Depth ",depth),clusterDb.has(node))if(!clusterDb.get(node).externalConnections&&graph.children(node)&&graph.children(node).length>0){log.warn("Cluster without external connections, without a parent and with children",node,depth);let dir="TB"===graph.graph().rankdir?"LR":"TB";(null==(_b=null==(_a=clusterDb.get(node))?void 0:_a.clusterData)?void 0:_b.dir)&&(dir=clusterDb.get(node).clusterData.dir,log.warn("Fixing dir",clusterDb.get(node).clusterData.dir,dir));const clusterGraph=new Graph({multigraph:!0,compound:!0}).setGraph({rankdir:dir,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});log.warn("Old graph before copy",write(graph)),copy(node,graph,clusterGraph,node),graph.setNode(node,{clusterNode:!0,id:node,clusterData:clusterDb.get(node).clusterData,label:clusterDb.get(node).label,graph:clusterGraph}),log.warn("New graph after copy node: (",node,")",write(clusterGraph)),log.debug("Old graph after copy",write(graph))}else log.warn("Cluster ** ",node," **not meeting the criteria !externalConnections:",!clusterDb.get(node).externalConnections," no parent: ",!graph.parent(node)," children ",graph.children(node)&&graph.children(node).length>0,graph.children("D"),depth),log.debug(clusterDb);else log.debug("Not a cluster",node,depth);nodes=graph.nodes(),log.warn("New list of nodes",nodes);for(const node of nodes){const data=graph.node(node);log.warn(" Now next level",node,data),(null==data?void 0:data.clusterNode)&&extractor(data.graph,depth+1)}}else log.debug("Done, no node has children",graph.nodes())},"extractor"),sorter=__name((graph,nodes)=>{if(0===nodes.length)return[];let result=Object.assign([],nodes);return nodes.forEach(node=>{const children=graph.children(node),sorted=sorter(graph,children);result=[...result,...sorted]}),result},"sorter"),sortNodesByHierarchy=__name(graph=>sorter(graph,graph.children()),"sortNodesByHierarchy"),recursiveRender=__name(async(_elem,graph,diagramType,id,parentCluster,siteConfig)=>{log.warn("Graph in recursive render:XAX",write(graph),parentCluster);const dir=graph.graph().rankdir;log.trace("Dir in recursive render - dir:",dir);const elem=_elem.insert("g").attr("class","root");graph.nodes()?log.info("Recursive render XXX",graph.nodes()):log.info("No nodes found for",graph),graph.edges().length>0&&log.info("Recursive edges",graph.edge(graph.edges()[0]));const clusters=elem.insert("g").attr("class","clusters"),edgePaths=elem.insert("g").attr("class","edgePaths"),edgeLabels=elem.insert("g").attr("class","edgeLabels"),nodes=elem.insert("g").attr("class","nodes");await Promise.all(graph.nodes().map(async function(v){const node=graph.node(v);if(void 0!==parentCluster){const data=JSON.parse(JSON.stringify(parentCluster.clusterData));log.trace("Setting data for parent cluster XXX\n Node.id = ",v,"\n data=",data.height,"\nParent cluster",parentCluster.height),graph.setNode(parentCluster.id,data),graph.parent(v)||(log.trace("Setting parent",v,parentCluster.id),graph.setParent(v,parentCluster.id,data))}if(log.info("(Insert) Node XXX"+v+": "+JSON.stringify(graph.node(v))),null==node?void 0:node.clusterNode){log.info("Cluster identified XBX",v,node.width,graph.node(v));const{ranksep:ranksep,nodesep:nodesep}=graph.graph();node.graph.setGraph({...node.graph.graph(),ranksep:ranksep+25,nodesep:nodesep});const o=await recursiveRender(nodes,node.graph,diagramType,id,graph.node(v),siteConfig),newEl=o.elem;updateNodeBounds(node,newEl),node.diff=o.diff||0,log.info("New compound node after recursive render XAX",v,"width",node.width,"height",node.height),setNodeElem(newEl,node)}else graph.children(v).length>0?(log.trace("Cluster - the non recursive path XBX",v,node.id,node,node.width,"Graph:",graph),log.trace(findNonClusterChild(node.id,graph)),clusterDb.set(node.id,{id:findNonClusterChild(node.id,graph),node:node})):(log.trace("Node - the non recursive path XAX",v,nodes,graph.node(v),dir),await insertNode(nodes,graph.node(v),{config:siteConfig,dir:dir}))}));const processEdges=__name(async()=>{const edgePromises=graph.edges().map(async function(e){const edge=graph.edge(e.v,e.w,e.name);log.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),log.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(graph.edge(e))),log.info("Fix",clusterDb,"ids:",e.v,e.w,"Translating: ",clusterDb.get(e.v),clusterDb.get(e.w)),await insertEdgeLabel(edgeLabels,edge)});await Promise.all(edgePromises)},"processEdges");await processEdges(),log.info("Graph before layout:",JSON.stringify(write(graph))),log.info("############################################# XXX"),log.info("### Layout ### XXX"),log.info("############################################# XXX"),layout(graph),log.info("Graph after layout:",JSON.stringify(write(graph)));let diff=0,{subGraphTitleTotalMargin:subGraphTitleTotalMargin}=getSubGraphTitleMargins(siteConfig);return await Promise.all(sortNodesByHierarchy(graph).map(async function(v){var _a;const node=graph.node(v);if(log.info("Position XBX => "+v+": ("+node.x,","+node.y,") width: ",node.width," height: ",node.height),null==node?void 0:node.clusterNode)node.y+=subGraphTitleTotalMargin,log.info("A tainted cluster node XBX1",v,node.id,node.width,node.height,node.x,node.y,graph.parent(v)),clusterDb.get(node.id).node=node,positionNode(node);else if(graph.children(v).length>0){log.info("A pure cluster node XBX1",v,node.id,node.x,node.y,node.width,node.height,graph.parent(v)),node.height+=subGraphTitleTotalMargin,graph.node(node.parentId);const halfPadding=(null==node?void 0:node.padding)/2||0,labelHeight=(null==(_a=null==node?void 0:node.labelBBox)?void 0:_a.height)||0,offsetY=labelHeight-halfPadding||0;log.debug("OffsetY",offsetY,"labelHeight",labelHeight,"halfPadding",halfPadding),await insertCluster(clusters,node),clusterDb.get(node.id).node=node}else{const parent=graph.node(node.parentId);node.y+=subGraphTitleTotalMargin/2,log.info("A regular node XBX1 - using the padding",node.id,"parent",node.parentId,node.width,node.height,node.x,node.y,"offsetY",node.offsetY,"parent",parent,null==parent?void 0:parent.offsetY,node),positionNode(node)}})),graph.edges().forEach(function(e){const edge=graph.edge(e);log.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(edge),edge),edge.points.forEach(point=>point.y+=subGraphTitleTotalMargin/2);const startNode=graph.node(e.v);var endNode=graph.node(e.w);const paths=insertEdge(edgePaths,edge,clusterDb,diagramType,startNode,endNode,id);positionEdgeLabel(edge,paths)}),graph.nodes().forEach(function(v){const n=graph.node(v);log.info(v,n.type,n.diff),n.isGroup&&(diff=n.diff)}),log.warn("Returning from recursive render XAX",elem,diff),{elem:elem,diff:diff}},"recursiveRender"),render=__name(async(data4Layout,svg)=>{var _a,_b,_c,_d,_e,_f;const graph=new Graph({multigraph:!0,compound:!0}).setGraph({rankdir:data4Layout.direction,nodesep:(null==(_a=data4Layout.config)?void 0:_a.nodeSpacing)||(null==(_c=null==(_b=data4Layout.config)?void 0:_b.flowchart)?void 0:_c.nodeSpacing)||data4Layout.nodeSpacing,ranksep:(null==(_d=data4Layout.config)?void 0:_d.rankSpacing)||(null==(_f=null==(_e=data4Layout.config)?void 0:_e.flowchart)?void 0:_f.rankSpacing)||data4Layout.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),element=svg.select("g");markers_default(element,data4Layout.markers,data4Layout.type,data4Layout.diagramId),clear2(),clear(),clear$1(),clear4(),data4Layout.nodes.forEach(node=>{graph.setNode(node.id,{...node}),node.parentId&&graph.setParent(node.id,node.parentId)}),log.debug("Edges:",data4Layout.edges),data4Layout.edges.forEach(edge=>{if(edge.start===edge.end){const nodeId=edge.start,specialId1=nodeId+"---"+nodeId+"---1",specialId2=nodeId+"---"+nodeId+"---2",node=graph.node(nodeId);graph.setNode(specialId1,{domId:specialId1,id:specialId1,parentId:node.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),graph.setParent(specialId1,node.parentId),graph.setNode(specialId2,{domId:specialId2,id:specialId2,parentId:node.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),graph.setParent(specialId2,node.parentId);const edge1=structuredClone(edge),edgeMid=structuredClone(edge),edge2=structuredClone(edge);edge1.label="",edge1.arrowTypeEnd="none",edge1.id=nodeId+"-cyclic-special-1",edgeMid.arrowTypeStart="none",edgeMid.arrowTypeEnd="none",edgeMid.id=nodeId+"-cyclic-special-mid",edge2.label="",node.isGroup&&(edge1.fromCluster=nodeId,edge2.toCluster=nodeId),edge2.id=nodeId+"-cyclic-special-2",edge2.arrowTypeStart="none",graph.setEdge(nodeId,specialId1,edge1,nodeId+"-cyclic-special-0"),graph.setEdge(specialId1,specialId2,edgeMid,nodeId+"-cyclic-special-1"),graph.setEdge(specialId2,nodeId,edge2,nodeId+"-cyc<lic-special-2")}else graph.setEdge(edge.start,edge.end,{...edge},edge.id)}),log.warn("Graph at first:",JSON.stringify(write(graph))),adjustClustersAndEdges(graph),log.warn("Graph after XAX:",JSON.stringify(write(graph)));const siteConfig=getConfig2();await recursiveRender(element,graph,data4Layout.type,data4Layout.diagramId,void 0,siteConfig)},"render");export{render};
@@ -1 +1 @@
1
- import{p as setDiagramTitle,b as setAccTitle,s as setAccDescription,q as getDiagramTitle,g as getAccDescription,a as getAccTitle,_ as __name,E as cleanAndMerge,l as log,H as selectSvgElement,e as configureSvgSize,C as getConfig,F as defaultConfig_default,y as clear}from"./mermaid.core-1heNIJ5f.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-DdsULqPZ.js";import{I as ImperativeState}from"./chunk-QZHKN3VN-5rXHErSL.js";import{p as parse}from"./wardley-RL74JXVD-BN899vMf.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-CC9CkAxn.js";import"./_baseUniq-Dgkw4IXM.js";var state=new ImperativeState(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),clear2=__name(()=>{state.reset(),clear()},"clear"),getRoot=__name(()=>state.records.stack[0],"getRoot"),getCount=__name(()=>state.records.cnt,"getCount"),defaultConfig=defaultConfig_default.treeView,getConfig2=__name(()=>cleanAndMerge(defaultConfig,getConfig().treeView),"getConfig"),db_default={clear:clear2,addNode:__name((level,name)=>{for(;level<=state.records.stack[state.records.stack.length-1].level;)state.records.stack.pop();const node={id:state.records.cnt++,level:level,name:name,children:[]};state.records.stack[state.records.stack.length-1].children.push(node),state.records.stack.push(node)},"addNode"),getRoot:getRoot,getCount:getCount,getConfig:getConfig2,getAccTitle:getAccTitle,getAccDescription:getAccDescription,getDiagramTitle:getDiagramTitle,setAccDescription:setAccDescription,setAccTitle:setAccTitle,setDiagramTitle:setDiagramTitle},populate=__name(ast=>{populateCommonDb(ast,db_default),ast.nodes.map(node=>db_default.addNode(node.indent?parseInt(node.indent):0,node.name))},"populate"),parser={parse:__name(async input=>{const ast=await parse("treeView",input);log.debug(ast),populate(ast)},"parse")},positionLabel=__name((x,y,node,domElem,config)=>{const label=domElem.append("text").text(node.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:labelHeight,width:labelWidth}=label.node().getBBox(),height=labelHeight+2*config.paddingY,width=labelWidth+2*config.paddingX;label.attr("x",x+config.paddingX),label.attr("y",y+height/2),node.BBox={x:x,y:y,width:width,height:height}},"positionLabel"),positionLine=__name((domElem,x1,y1,x2,y2,lineThickness)=>domElem.append("line").attr("x1",x1).attr("y1",y1).attr("x2",x2).attr("y2",y2).attr("stroke-width",lineThickness).attr("class","treeView-node-line"),"positionLine"),drawTree=__name((elem,root,config)=>{let totalHeight=0,totalWidth=0;const drawNode=__name((elem2,node,config2,depth)=>{const indent=depth*(config2.rowIndent+config2.paddingX);positionLabel(indent,totalHeight,node,elem2,config2);const{height:height,width:width}=node.BBox;positionLine(elem2,indent-config2.rowIndent,totalHeight+height/2,indent,totalHeight+height/2,config2.lineThickness),totalWidth=Math.max(totalWidth,indent+width),totalHeight+=height},"drawNode"),processNode=__name((node,depth=0)=>{drawNode(elem,node,config,depth),node.children.forEach(child=>{processNode(child,depth+1)});const{x:x,y:y,height:height}=node.BBox;if(node.children.length){const{y:endY,height:endHeight}=node.children[node.children.length-1].BBox;positionLine(elem,x+config.paddingX,y+height,x+config.paddingX,endY+endHeight/2+config.lineThickness/2,config.lineThickness)}},"processNode");return processNode(root),{totalHeight:totalHeight,totalWidth:totalWidth}},"drawTree"),defaultTreeViewDiagramStyles={labelFontSize:"16px",labelColor:"black",lineColor:"black"},diagram={db:db_default,renderer:{draw:__name((text,id,_ver,diagObj)=>{log.debug("Rendering treeView diagram\n"+text);const db2=diagObj.db,root=db2.getRoot(),config=db2.getConfig(),svg=selectSvgElement(id),treeElem=svg.append("g");treeElem.attr("class","tree-view");const{totalHeight:totalHeight,totalWidth:totalWidth}=drawTree(treeElem,root,config);svg.attr("viewBox",`-${config.lineThickness/2} 0 ${totalWidth} ${totalHeight}`),configureSvgSize(svg,totalHeight,totalWidth,config.useMaxWidth)},"draw")},parser:parser,styles:__name(({treeView:treeView})=>{const{labelFontSize:labelFontSize,labelColor:labelColor,lineColor:lineColor}=cleanAndMerge(defaultTreeViewDiagramStyles,treeView);return`\n .treeView-node-label {\n font-size: ${labelFontSize};\n fill: ${labelColor};\n }\n .treeView-node-line {\n stroke: ${lineColor};\n }\n `},"styles")};export{diagram};
1
+ import{p as setDiagramTitle,b as setAccTitle,s as setAccDescription,q as getDiagramTitle,g as getAccDescription,a as getAccTitle,_ as __name,E as cleanAndMerge,l as log,H as selectSvgElement,e as configureSvgSize,C as getConfig,F as defaultConfig_default,y as clear}from"./mermaid.core-YmJi7T-s.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-1FZYtnJ7.js";import{I as ImperativeState}from"./chunk-QZHKN3VN-B6cmUU0N.js";import{p as parse}from"./wardley-RL74JXVD-B2rj5j7G.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-akJQqRMn.js";import"./_baseUniq-CPJrFyUF.js";var state=new ImperativeState(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",children:[]}]})),clear2=__name(()=>{state.reset(),clear()},"clear"),getRoot=__name(()=>state.records.stack[0],"getRoot"),getCount=__name(()=>state.records.cnt,"getCount"),defaultConfig=defaultConfig_default.treeView,getConfig2=__name(()=>cleanAndMerge(defaultConfig,getConfig().treeView),"getConfig"),db_default={clear:clear2,addNode:__name((level,name)=>{for(;level<=state.records.stack[state.records.stack.length-1].level;)state.records.stack.pop();const node={id:state.records.cnt++,level:level,name:name,children:[]};state.records.stack[state.records.stack.length-1].children.push(node),state.records.stack.push(node)},"addNode"),getRoot:getRoot,getCount:getCount,getConfig:getConfig2,getAccTitle:getAccTitle,getAccDescription:getAccDescription,getDiagramTitle:getDiagramTitle,setAccDescription:setAccDescription,setAccTitle:setAccTitle,setDiagramTitle:setDiagramTitle},populate=__name(ast=>{populateCommonDb(ast,db_default),ast.nodes.map(node=>db_default.addNode(node.indent?parseInt(node.indent):0,node.name))},"populate"),parser={parse:__name(async input=>{const ast=await parse("treeView",input);log.debug(ast),populate(ast)},"parse")},positionLabel=__name((x,y,node,domElem,config)=>{const label=domElem.append("text").text(node.name).attr("dominant-baseline","middle").attr("class","treeView-node-label"),{height:labelHeight,width:labelWidth}=label.node().getBBox(),height=labelHeight+2*config.paddingY,width=labelWidth+2*config.paddingX;label.attr("x",x+config.paddingX),label.attr("y",y+height/2),node.BBox={x:x,y:y,width:width,height:height}},"positionLabel"),positionLine=__name((domElem,x1,y1,x2,y2,lineThickness)=>domElem.append("line").attr("x1",x1).attr("y1",y1).attr("x2",x2).attr("y2",y2).attr("stroke-width",lineThickness).attr("class","treeView-node-line"),"positionLine"),drawTree=__name((elem,root,config)=>{let totalHeight=0,totalWidth=0;const drawNode=__name((elem2,node,config2,depth)=>{const indent=depth*(config2.rowIndent+config2.paddingX);positionLabel(indent,totalHeight,node,elem2,config2);const{height:height,width:width}=node.BBox;positionLine(elem2,indent-config2.rowIndent,totalHeight+height/2,indent,totalHeight+height/2,config2.lineThickness),totalWidth=Math.max(totalWidth,indent+width),totalHeight+=height},"drawNode"),processNode=__name((node,depth=0)=>{drawNode(elem,node,config,depth),node.children.forEach(child=>{processNode(child,depth+1)});const{x:x,y:y,height:height}=node.BBox;if(node.children.length){const{y:endY,height:endHeight}=node.children[node.children.length-1].BBox;positionLine(elem,x+config.paddingX,y+height,x+config.paddingX,endY+endHeight/2+config.lineThickness/2,config.lineThickness)}},"processNode");return processNode(root),{totalHeight:totalHeight,totalWidth:totalWidth}},"drawTree"),defaultTreeViewDiagramStyles={labelFontSize:"16px",labelColor:"black",lineColor:"black"},diagram={db:db_default,renderer:{draw:__name((text,id,_ver,diagObj)=>{log.debug("Rendering treeView diagram\n"+text);const db2=diagObj.db,root=db2.getRoot(),config=db2.getConfig(),svg=selectSvgElement(id),treeElem=svg.append("g");treeElem.attr("class","tree-view");const{totalHeight:totalHeight,totalWidth:totalWidth}=drawTree(treeElem,root,config);svg.attr("viewBox",`-${config.lineThickness/2} 0 ${totalWidth} ${totalHeight}`),configureSvgSize(svg,totalHeight,totalWidth,config.useMaxWidth)},"draw")},parser:parser,styles:__name(({treeView:treeView})=>{const{labelFontSize:labelFontSize,labelColor:labelColor,lineColor:lineColor}=cleanAndMerge(defaultTreeViewDiagramStyles,treeView);return`\n .treeView-node-label {\n font-size: ${labelFontSize};\n fill: ${labelColor};\n }\n .treeView-node-line {\n stroke: ${lineColor};\n }\n `},"styles")};export{diagram};
@@ -1 +1 @@
1
- var _a;import{_ as __name,I as getThemeVariables3,C as getConfig,E as cleanAndMerge,H as selectSvgElement,e as configureSvgSize,l as log,ba as styles2String,d as select,b as setAccTitle,a as getAccTitle,p as setDiagramTitle,q as getDiagramTitle,g as getAccDescription,s as setAccDescription,F as defaultConfig_default,bb as isLabelStyle,y as clear}from"./mermaid.core-1heNIJ5f.js";import{s as setupViewPortForSVG}from"./chunk-EDXVE4YY-o_0SUbAB.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-DdsULqPZ.js";import{p as parse}from"./wardley-RL74JXVD-BN899vMf.js";import{b as format}from"./defaultLocale-DZ7E7S9R.js";import{o as ordinal}from"./ordinal-DA-_8pMy.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-CC9CkAxn.js";import"./_baseUniq-Dgkw4IXM.js";import"./init-DMZMl1PR.js";function count(node){var sum=0,children=node.children,i=children&&children.length;if(i)for(;--i>=0;)sum+=children[i].value;else sum=1;node.value=sum}function hierarchy(data,children){data instanceof Map?(data=[void 0,data],void 0===children&&(children=mapChildren)):void 0===children&&(children=objectChildren);for(var node,child,childs,i,n,root=new Node(data),nodes=[root];node=nodes.pop();)if((childs=children(node.data))&&(n=(childs=Array.from(childs)).length))for(node.children=childs,i=n-1;i>=0;--i)nodes.push(child=childs[i]=new Node(childs[i])),child.parent=node,child.depth=node.depth+1;return root.eachBefore(computeHeight)}function objectChildren(d){return d.children}function mapChildren(d){return Array.isArray(d)?d[1]:null}function copyData(node){void 0!==node.data.value&&(node.value=node.data.value),node.data=node.data.data}function computeHeight(node){var height=0;do{node.height=height}while((node=node.parent)&&node.height<++height)}function Node(data){this.data=data,this.depth=this.height=0,this.parent=null}function constantZero(){return 0}function constant(x){return function(){return x}}function roundNode(node){node.x0=Math.round(node.x0),node.y0=Math.round(node.y0),node.x1=Math.round(node.x1),node.y1=Math.round(node.y1)}function treemapDice(parent,x0,y0,x1,y1){for(var node,nodes=parent.children,i=-1,n=nodes.length,k=parent.value&&(x1-x0)/parent.value;++i<n;)(node=nodes[i]).y0=y0,node.y1=y1,node.x0=x0,node.x1=x0+=node.value*k}function treemapSlice(parent,x0,y0,x1,y1){for(var node,nodes=parent.children,i=-1,n=nodes.length,k=parent.value&&(y1-y0)/parent.value;++i<n;)(node=nodes[i]).x0=x0,node.x1=x1,node.y0=y0,node.y1=y0+=node.value*k}Node.prototype=hierarchy.prototype={constructor:Node,count:function(){return this.eachAfter(count)},each:function(callback,that){let index=-1;for(const node of this)callback.call(that,node,++index,this);return this},eachAfter:function(callback,that){for(var children,i,n,node=this,nodes=[node],next=[],index=-1;node=nodes.pop();)if(next.push(node),children=node.children)for(i=0,n=children.length;i<n;++i)nodes.push(children[i]);for(;node=next.pop();)callback.call(that,node,++index,this);return this},eachBefore:function(callback,that){for(var children,i,node=this,nodes=[node],index=-1;node=nodes.pop();)if(callback.call(that,node,++index,this),children=node.children)for(i=children.length-1;i>=0;--i)nodes.push(children[i]);return this},find:function(callback,that){let index=-1;for(const node of this)if(callback.call(that,node,++index,this))return node},sum:function(value){return this.eachAfter(function(node){for(var sum=+value(node.data)||0,children=node.children,i=children&&children.length;--i>=0;)sum+=children[i].value;node.value=sum})},sort:function(compare){return this.eachBefore(function(node){node.children&&node.children.sort(compare)})},path:function(end){for(var start=this,ancestor=function(a,b){if(a===b)return a;var aNodes=a.ancestors(),bNodes=b.ancestors(),c=null;a=aNodes.pop(),b=bNodes.pop();for(;a===b;)c=a,a=aNodes.pop(),b=bNodes.pop();return c}(start,end),nodes=[start];start!==ancestor;)start=start.parent,nodes.push(start);for(var k=nodes.length;end!==ancestor;)nodes.splice(k,0,end),end=end.parent;return nodes},ancestors:function(){for(var node=this,nodes=[node];node=node.parent;)nodes.push(node);return nodes},descendants:function(){return Array.from(this)},leaves:function(){var leaves=[];return this.eachBefore(function(node){node.children||leaves.push(node)}),leaves},links:function(){var root=this,links=[];return root.each(function(node){node!==root&&links.push({source:node.parent,target:node})}),links},copy:function(){return hierarchy(this).eachBefore(copyData)},[Symbol.iterator]:function*(){var current,children,i,n,node=this,next=[node];do{for(current=next.reverse(),next=[];node=current.pop();)if(yield node,children=node.children)for(i=0,n=children.length;i<n;++i)next.push(children[i])}while(next.length)}};const squarify=function custom(ratio){function squarify2(parent,x0,y0,x1,y1){!function(ratio,parent,x0,y0,x1,y1){for(var row,nodeValue,dx,dy,sumValue,minValue,maxValue,newRatio,minRatio,alpha,beta,rows=[],nodes=parent.children,i0=0,i1=0,n=nodes.length,value=parent.value;i0<n;){dx=x1-x0,dy=y1-y0;do{sumValue=nodes[i1++].value}while(!sumValue&&i1<n);for(minValue=maxValue=sumValue,beta=sumValue*sumValue*(alpha=Math.max(dy/dx,dx/dy)/(value*ratio)),minRatio=Math.max(maxValue/beta,beta/minValue);i1<n;++i1){if(sumValue+=nodeValue=nodes[i1].value,nodeValue<minValue&&(minValue=nodeValue),nodeValue>maxValue&&(maxValue=nodeValue),beta=sumValue*sumValue*alpha,(newRatio=Math.max(maxValue/beta,beta/minValue))>minRatio){sumValue-=nodeValue;break}minRatio=newRatio}rows.push(row={value:sumValue,dice:dx<dy,children:nodes.slice(i0,i1)}),row.dice?treemapDice(row,x0,y0,x1,value?y0+=dy*sumValue/value:y1):treemapSlice(row,x0,y0,value?x0+=dx*sumValue/value:x1,y1),value-=sumValue,i0=i1}}(ratio,parent,x0,y0,x1,y1)}return squarify2.ratio=function(x){return custom((x=+x)>1?x:1)},squarify2}((1+Math.sqrt(5))/2);function treemap(){var tile=squarify,round=!1,dx=1,dy=1,paddingStack=[0],paddingInner=constantZero,paddingTop=constantZero,paddingRight=constantZero,paddingBottom=constantZero,paddingLeft=constantZero;function treemap2(root){return root.x0=root.y0=0,root.x1=dx,root.y1=dy,root.eachBefore(positionNode),paddingStack=[0],round&&root.eachBefore(roundNode),root}function positionNode(node){var p=paddingStack[node.depth],x0=node.x0+p,y0=node.y0+p,x1=node.x1-p,y1=node.y1-p;x1<x0&&(x0=x1=(x0+x1)/2),y1<y0&&(y0=y1=(y0+y1)/2),node.x0=x0,node.y0=y0,node.x1=x1,node.y1=y1,node.children&&(p=paddingStack[node.depth+1]=paddingInner(node)/2,x0+=paddingLeft(node)-p,y0+=paddingTop(node)-p,(x1-=paddingRight(node)-p)<x0&&(x0=x1=(x0+x1)/2),(y1-=paddingBottom(node)-p)<y0&&(y0=y1=(y0+y1)/2),tile(node,x0,y0,x1,y1))}return treemap2.round=function(x){return arguments.length?(round=!!x,treemap2):round},treemap2.size=function(x){return arguments.length?(dx=+x[0],dy=+x[1],treemap2):[dx,dy]},treemap2.tile=function(x){return arguments.length?(tile=function(f){if("function"!=typeof f)throw new Error;return f}(x),treemap2):tile},treemap2.padding=function(x){return arguments.length?treemap2.paddingInner(x).paddingOuter(x):treemap2.paddingInner()},treemap2.paddingInner=function(x){return arguments.length?(paddingInner="function"==typeof x?x:constant(+x),treemap2):paddingInner},treemap2.paddingOuter=function(x){return arguments.length?treemap2.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x):treemap2.paddingTop()},treemap2.paddingTop=function(x){return arguments.length?(paddingTop="function"==typeof x?x:constant(+x),treemap2):paddingTop},treemap2.paddingRight=function(x){return arguments.length?(paddingRight="function"==typeof x?x:constant(+x),treemap2):paddingRight},treemap2.paddingBottom=function(x){return arguments.length?(paddingBottom="function"==typeof x?x:constant(+x),treemap2):paddingBottom},treemap2.paddingLeft=function(x){return arguments.length?(paddingLeft="function"==typeof x?x:constant(+x),treemap2):paddingLeft},treemap2}var TreeMapDB=(__name(_a=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getAccDescription=getAccDescription,this.setAccDescription=setAccDescription}getNodes(){return this.nodes}getConfig(){const defaultConfig=defaultConfig_default,userConfig=getConfig();return cleanAndMerge({...defaultConfig.treemap,...userConfig.treemap??{}})}addNode(node,level){this.nodes.push(node),this.levels.set(node,level),0===level&&(this.outerNodes.push(node),this.root??(this.root=node))}getRoot(){return{name:"",children:this.outerNodes}}addClass(id,_style){const styleClass=this.classes.get(id)??{id:id,styles:[],textStyles:[]},styles=_style.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");styles&&styles.forEach(s=>{isLabelStyle(s)&&((null==styleClass?void 0:styleClass.textStyles)?styleClass.textStyles.push(s):styleClass.textStyles=[s]),(null==styleClass?void 0:styleClass.styles)?styleClass.styles.push(s):styleClass.styles=[s]}),this.classes.set(id,styleClass)}getClasses(){return this.classes}getStylesForClass(classSelector){var _a2;return(null==(_a2=this.classes.get(classSelector))?void 0:_a2.styles)??[]}clear(){clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},"TreeMapDB"),_a);function buildHierarchy(items){if(!items.length)return[];const root=[],stack=[];return items.forEach(item=>{const node={name:item.name,children:"Leaf"===item.type?void 0:[]};for(node.classSelector=null==item?void 0:item.classSelector,(null==item?void 0:item.cssCompiledStyles)&&(node.cssCompiledStyles=item.cssCompiledStyles),"Leaf"===item.type&&void 0!==item.value&&(node.value=item.value);stack.length>0&&stack[stack.length-1].level>=item.level;)stack.pop();if(0===stack.length)root.push(node);else{const parent=stack[stack.length-1].node;parent.children?parent.children.push(node):parent.children=[node]}"Leaf"!==item.type&&stack.push({node:node,level:item.level})}),root}__name(buildHierarchy,"buildHierarchy");var populate=__name((ast,db)=>{populateCommonDb(ast,db);const items=[];for(const row of ast.TreemapRows??[])"ClassDefStatement"===row.$type&&db.addClass(row.className??"",row.styleText??"");for(const row of ast.TreemapRows??[]){const item=row.item;if(!item)continue;const level=row.indent?parseInt(row.indent):0,name=getItemName(item),styles=item.classSelector?db.getStylesForClass(item.classSelector):[],cssCompiledStyles=styles.length>0?styles:void 0,itemData={level:level,name:name,type:item.$type,value:item.value,classSelector:item.classSelector,cssCompiledStyles:cssCompiledStyles};items.push(itemData)}const hierarchyNodes=buildHierarchy(items),addNodesRecursively=__name((nodes,level)=>{for(const node of nodes)db.addNode(node,level),node.children&&node.children.length>0&&addNodesRecursively(node.children,level+1)},"addNodesRecursively");addNodesRecursively(hierarchyNodes,0)},"populate"),getItemName=__name(item=>item.name?String(item.name):"","getItemName"),parser={parser:{yy:void 0},parse:__name(async text=>{var _a2;try{const parseFunc=parse,ast=await parseFunc("treemap",text);log.debug("Treemap AST:",ast);const db=null==(_a2=parser.parser)?void 0:_a2.yy;if(!(db instanceof TreeMapDB))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");populate(ast,db)}catch(error){throw log.error("Error parsing treemap:",error),error}},"parse")},renderer={draw:__name((_text,id,_version,diagram2)=>{const treemapDb=diagram2.db,config=treemapDb.getConfig(),treemapInnerPadding=config.padding??10,title=treemapDb.getDiagramTitle(),root=treemapDb.getRoot(),{themeVariables:themeVariables}=getConfig();if(!root)return;const titleHeight=title?30:0,svg=selectSvgElement(id),width=config.nodeWidth?10*config.nodeWidth:960,height=config.nodeHeight?10*config.nodeHeight:500,svgWidth=width,svgHeight=height+titleHeight;let valueFormat;svg.attr("viewBox",`0 0 ${svgWidth} ${svgHeight}`),configureSvgSize(svg,svgHeight,svgWidth,config.useMaxWidth);try{const formatStr=config.valueFormat||",";if("$0,0"===formatStr)valueFormat=__name(value=>"$"+format(",")(value),"valueFormat");else if(formatStr.startsWith("$")&&formatStr.includes(",")){const precision=/\.\d+/.exec(formatStr),precisionStr=precision?precision[0]:"";valueFormat=__name(value=>"$"+format(","+precisionStr)(value),"valueFormat")}else if(formatStr.startsWith("$")){const restOfFormat=formatStr.substring(1);valueFormat=__name(value=>"$"+format(restOfFormat||"")(value),"valueFormat")}else valueFormat=format(formatStr)}catch(error){log.error("Error creating format function:",error),valueFormat=format(",")}const colorScale=ordinal().range(["transparent",themeVariables.cScale0,themeVariables.cScale1,themeVariables.cScale2,themeVariables.cScale3,themeVariables.cScale4,themeVariables.cScale5,themeVariables.cScale6,themeVariables.cScale7,themeVariables.cScale8,themeVariables.cScale9,themeVariables.cScale10,themeVariables.cScale11]),colorScalePeer=ordinal().range(["transparent",themeVariables.cScalePeer0,themeVariables.cScalePeer1,themeVariables.cScalePeer2,themeVariables.cScalePeer3,themeVariables.cScalePeer4,themeVariables.cScalePeer5,themeVariables.cScalePeer6,themeVariables.cScalePeer7,themeVariables.cScalePeer8,themeVariables.cScalePeer9,themeVariables.cScalePeer10,themeVariables.cScalePeer11]),colorScaleLabel=ordinal().range([themeVariables.cScaleLabel0,themeVariables.cScaleLabel1,themeVariables.cScaleLabel2,themeVariables.cScaleLabel3,themeVariables.cScaleLabel4,themeVariables.cScaleLabel5,themeVariables.cScaleLabel6,themeVariables.cScaleLabel7,themeVariables.cScaleLabel8,themeVariables.cScaleLabel9,themeVariables.cScaleLabel10,themeVariables.cScaleLabel11]);title&&svg.append("text").attr("x",svgWidth/2).attr("y",titleHeight/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(title);const g=svg.append("g").attr("transform",`translate(0, ${titleHeight})`).attr("class","treemapContainer"),hierarchyRoot=hierarchy(root).sum(d=>d.value??0).sort((a,b)=>(b.value??0)-(a.value??0)),treemapData=treemap().size([width,height]).paddingTop(d=>d.children&&d.children.length>0?35:0).paddingInner(treemapInnerPadding).paddingLeft(d=>d.children&&d.children.length>0?10:0).paddingRight(d=>d.children&&d.children.length>0?10:0).paddingBottom(d=>d.children&&d.children.length>0?10:0).round(!0)(hierarchyRoot),branchNodes=treemapData.descendants().filter(d=>d.children&&d.children.length>0),sections=g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class","treemapSection").attr("transform",d=>`translate(${d.x0},${d.y0})`);sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",d=>0===d.depth?"display: none;":""),sections.append("clipPath").attr("id",(_d,i)=>`clip-section-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-12)).attr("height",25),sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class",(_d,i)=>`treemapSection section${i}`).attr("fill",d=>colorScale(d.data.name)).attr("fill-opacity",.6).attr("stroke",d=>colorScalePeer(d.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",d=>{if(0===d.depth)return"display: none;";const styles=styles2String({cssCompiledStyles:d.data.cssCompiledStyles});return styles.nodeStyles+";"+styles.borderStyles.join(";")}),sections.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(d=>0===d.depth?"":d.data.name).attr("font-weight","bold").attr("style",d=>{if(0===d.depth)return"display: none;";return"dominant-baseline: middle; font-size: 12px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")}).each(function(d){if(0===d.depth)return;const self=select(this),originalText=d.data.name;self.text(originalText);const totalHeaderWidth=d.x1-d.x0;let spaceForTextContent;if(!1!==config.showValues&&d.value){spaceForTextContent=totalHeaderWidth-10-30-10-6}else{spaceForTextContent=totalHeaderWidth-6-6}const actualAvailableWidth=Math.max(15,spaceForTextContent),textNode=self.node();if(textNode.getComputedTextLength()>actualAvailableWidth){const ellipsis="...";let currentTruncatedText=originalText;for(;currentTruncatedText.length>0;){if(currentTruncatedText=originalText.substring(0,currentTruncatedText.length-1),0===currentTruncatedText.length){self.text(ellipsis),textNode.getComputedTextLength()>actualAvailableWidth&&self.text("");break}if(self.text(currentTruncatedText+ellipsis),textNode.getComputedTextLength()<=actualAvailableWidth)break}}}),!1!==config.showValues&&sections.append("text").attr("class","treemapSectionValue").attr("x",d=>d.x1-d.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(d=>d.value?valueFormat(d.value):"").attr("font-style","italic").attr("style",d=>{if(0===d.depth)return"display: none;";return"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")});const leafNodes=treemapData.leaves(),cell=g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class",(d,i)=>`treemapNode treemapLeafGroup leaf${i}${d.data.classSelector?` ${d.data.classSelector}`:""}x`).attr("transform",d=>`translate(${d.x0},${d.y0})`);cell.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class","treemapLeaf").attr("fill",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("style",d=>styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("stroke-width",3),cell.append("clipPath").attr("id",(_d,i)=>`clip-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-4)).attr("height",d=>Math.max(0,d.y1-d.y0-4));if(cell.append("text").attr("class","treemapLabel").attr("x",d=>(d.x1-d.x0)/2).attr("y",d=>(d.y1-d.y0)/2).attr("style",d=>"text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.data.name).each(function(d){const self=select(this),nodeWidth=d.x1-d.x0,nodeHeight=d.y1-d.y0,textNode=self.node(),availableWidth=nodeWidth-8,availableHeight=nodeHeight-8;if(availableWidth<10||availableHeight<10)return void self.style("display","none");let currentLabelFontSize=parseInt(self.style("font-size"),10);for(;textNode.getComputedTextLength()>availableWidth&&currentLabelFontSize>8;)currentLabelFontSize--,self.style("font-size",`${currentLabelFontSize}px`);let prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;for(;combinedHeight>availableHeight&&currentLabelFontSize>8&&(currentLabelFontSize--,prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),!(prospectiveValueFontSize<6&&8===currentLabelFontSize));)self.style("font-size",`${currentLabelFontSize}px`),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;self.style("font-size",`${currentLabelFontSize}px`),(textNode.getComputedTextLength()>availableWidth||currentLabelFontSize<8||availableHeight<currentLabelFontSize)&&self.style("display","none")}),!1!==config.showValues){cell.append("text").attr("class","treemapValue").attr("x",d=>(d.x1-d.x0)/2).attr("y",function(d){return(d.y1-d.y0)/2}).attr("style",d=>"text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.value?valueFormat(d.value):"").each(function(d){const valueTextElement=select(this),parentCellNode=this.parentNode;if(!parentCellNode)return void valueTextElement.style("display","none");const labelElement=select(parentCellNode).select(".treemapLabel");if(labelElement.empty()||"none"===labelElement.style("display"))return void valueTextElement.style("display","none");const finalLabelFontSize=parseFloat(labelElement.style("font-size")),actualValueFontSize=Math.max(6,Math.min(28,Math.round(.6*finalLabelFontSize)));valueTextElement.style("font-size",`${actualValueFontSize}px`);const valueTopActualY=(d.y1-d.y0)/2+finalLabelFontSize/2+2;valueTextElement.attr("y",valueTopActualY);const nodeWidth=d.x1-d.x0,maxValueBottomY=d.y1-d.y0-4,availableWidthForValue=nodeWidth-8;valueTextElement.node().getComputedTextLength()>availableWidthForValue||valueTopActualY+actualValueFontSize>maxValueBottomY||actualValueFontSize<6?valueTextElement.style("display","none"):valueTextElement.style("display",null)})}const diagramPadding=config.diagramPadding??8;setupViewPortForSVG(svg,diagramPadding,"flowchart",(null==config?void 0:config.useMaxWidth)||!1)},"draw"),getClasses:__name(function(_text,diagramObj){return diagramObj.db.getClasses()},"getClasses")},defaultTreemapStyleOptions={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},styles_default=__name(({treemap:treemap2}={})=>{const defaultThemeVariables=getThemeVariables3(),currentConfig=getConfig(),themeVariables=cleanAndMerge(defaultThemeVariables,currentConfig.themeVariables),options=cleanAndMerge(defaultTreemapStyleOptions,treemap2),titleColor=options.titleColor??themeVariables.titleColor,labelColor=options.labelColor??themeVariables.textColor,valueColor=options.valueColor??themeVariables.textColor;return`\n .treemapNode.section {\n stroke: ${options.sectionStrokeColor};\n stroke-width: ${options.sectionStrokeWidth};\n fill: ${options.sectionFillColor};\n }\n .treemapNode.leaf {\n stroke: ${options.leafStrokeColor};\n stroke-width: ${options.leafStrokeWidth};\n fill: ${options.leafFillColor};\n }\n .treemapLabel {\n fill: ${labelColor};\n font-size: ${options.labelFontSize};\n }\n .treemapValue {\n fill: ${valueColor};\n font-size: ${options.valueFontSize};\n }\n .treemapTitle {\n fill: ${titleColor};\n font-size: ${options.titleFontSize};\n }\n `},"getStyles"),diagram={parser:parser,get db(){return new TreeMapDB},renderer:renderer,styles:styles_default};export{diagram};
1
+ var _a;import{_ as __name,I as getThemeVariables3,C as getConfig,E as cleanAndMerge,H as selectSvgElement,e as configureSvgSize,l as log,ba as styles2String,d as select,b as setAccTitle,a as getAccTitle,p as setDiagramTitle,q as getDiagramTitle,g as getAccDescription,s as setAccDescription,F as defaultConfig_default,bb as isLabelStyle,y as clear}from"./mermaid.core-YmJi7T-s.js";import{s as setupViewPortForSVG}from"./chunk-EDXVE4YY-5qaIrQKg.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-1FZYtnJ7.js";import{p as parse}from"./wardley-RL74JXVD-B2rj5j7G.js";import{b as format}from"./defaultLocale-DZ7E7S9R.js";import{o as ordinal}from"./ordinal-DA-_8pMy.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-akJQqRMn.js";import"./_baseUniq-CPJrFyUF.js";import"./init-DMZMl1PR.js";function count(node){var sum=0,children=node.children,i=children&&children.length;if(i)for(;--i>=0;)sum+=children[i].value;else sum=1;node.value=sum}function hierarchy(data,children){data instanceof Map?(data=[void 0,data],void 0===children&&(children=mapChildren)):void 0===children&&(children=objectChildren);for(var node,child,childs,i,n,root=new Node(data),nodes=[root];node=nodes.pop();)if((childs=children(node.data))&&(n=(childs=Array.from(childs)).length))for(node.children=childs,i=n-1;i>=0;--i)nodes.push(child=childs[i]=new Node(childs[i])),child.parent=node,child.depth=node.depth+1;return root.eachBefore(computeHeight)}function objectChildren(d){return d.children}function mapChildren(d){return Array.isArray(d)?d[1]:null}function copyData(node){void 0!==node.data.value&&(node.value=node.data.value),node.data=node.data.data}function computeHeight(node){var height=0;do{node.height=height}while((node=node.parent)&&node.height<++height)}function Node(data){this.data=data,this.depth=this.height=0,this.parent=null}function constantZero(){return 0}function constant(x){return function(){return x}}function roundNode(node){node.x0=Math.round(node.x0),node.y0=Math.round(node.y0),node.x1=Math.round(node.x1),node.y1=Math.round(node.y1)}function treemapDice(parent,x0,y0,x1,y1){for(var node,nodes=parent.children,i=-1,n=nodes.length,k=parent.value&&(x1-x0)/parent.value;++i<n;)(node=nodes[i]).y0=y0,node.y1=y1,node.x0=x0,node.x1=x0+=node.value*k}function treemapSlice(parent,x0,y0,x1,y1){for(var node,nodes=parent.children,i=-1,n=nodes.length,k=parent.value&&(y1-y0)/parent.value;++i<n;)(node=nodes[i]).x0=x0,node.x1=x1,node.y0=y0,node.y1=y0+=node.value*k}Node.prototype=hierarchy.prototype={constructor:Node,count:function(){return this.eachAfter(count)},each:function(callback,that){let index=-1;for(const node of this)callback.call(that,node,++index,this);return this},eachAfter:function(callback,that){for(var children,i,n,node=this,nodes=[node],next=[],index=-1;node=nodes.pop();)if(next.push(node),children=node.children)for(i=0,n=children.length;i<n;++i)nodes.push(children[i]);for(;node=next.pop();)callback.call(that,node,++index,this);return this},eachBefore:function(callback,that){for(var children,i,node=this,nodes=[node],index=-1;node=nodes.pop();)if(callback.call(that,node,++index,this),children=node.children)for(i=children.length-1;i>=0;--i)nodes.push(children[i]);return this},find:function(callback,that){let index=-1;for(const node of this)if(callback.call(that,node,++index,this))return node},sum:function(value){return this.eachAfter(function(node){for(var sum=+value(node.data)||0,children=node.children,i=children&&children.length;--i>=0;)sum+=children[i].value;node.value=sum})},sort:function(compare){return this.eachBefore(function(node){node.children&&node.children.sort(compare)})},path:function(end){for(var start=this,ancestor=function(a,b){if(a===b)return a;var aNodes=a.ancestors(),bNodes=b.ancestors(),c=null;a=aNodes.pop(),b=bNodes.pop();for(;a===b;)c=a,a=aNodes.pop(),b=bNodes.pop();return c}(start,end),nodes=[start];start!==ancestor;)start=start.parent,nodes.push(start);for(var k=nodes.length;end!==ancestor;)nodes.splice(k,0,end),end=end.parent;return nodes},ancestors:function(){for(var node=this,nodes=[node];node=node.parent;)nodes.push(node);return nodes},descendants:function(){return Array.from(this)},leaves:function(){var leaves=[];return this.eachBefore(function(node){node.children||leaves.push(node)}),leaves},links:function(){var root=this,links=[];return root.each(function(node){node!==root&&links.push({source:node.parent,target:node})}),links},copy:function(){return hierarchy(this).eachBefore(copyData)},[Symbol.iterator]:function*(){var current,children,i,n,node=this,next=[node];do{for(current=next.reverse(),next=[];node=current.pop();)if(yield node,children=node.children)for(i=0,n=children.length;i<n;++i)next.push(children[i])}while(next.length)}};const squarify=function custom(ratio){function squarify2(parent,x0,y0,x1,y1){!function(ratio,parent,x0,y0,x1,y1){for(var row,nodeValue,dx,dy,sumValue,minValue,maxValue,newRatio,minRatio,alpha,beta,rows=[],nodes=parent.children,i0=0,i1=0,n=nodes.length,value=parent.value;i0<n;){dx=x1-x0,dy=y1-y0;do{sumValue=nodes[i1++].value}while(!sumValue&&i1<n);for(minValue=maxValue=sumValue,beta=sumValue*sumValue*(alpha=Math.max(dy/dx,dx/dy)/(value*ratio)),minRatio=Math.max(maxValue/beta,beta/minValue);i1<n;++i1){if(sumValue+=nodeValue=nodes[i1].value,nodeValue<minValue&&(minValue=nodeValue),nodeValue>maxValue&&(maxValue=nodeValue),beta=sumValue*sumValue*alpha,(newRatio=Math.max(maxValue/beta,beta/minValue))>minRatio){sumValue-=nodeValue;break}minRatio=newRatio}rows.push(row={value:sumValue,dice:dx<dy,children:nodes.slice(i0,i1)}),row.dice?treemapDice(row,x0,y0,x1,value?y0+=dy*sumValue/value:y1):treemapSlice(row,x0,y0,value?x0+=dx*sumValue/value:x1,y1),value-=sumValue,i0=i1}}(ratio,parent,x0,y0,x1,y1)}return squarify2.ratio=function(x){return custom((x=+x)>1?x:1)},squarify2}((1+Math.sqrt(5))/2);function treemap(){var tile=squarify,round=!1,dx=1,dy=1,paddingStack=[0],paddingInner=constantZero,paddingTop=constantZero,paddingRight=constantZero,paddingBottom=constantZero,paddingLeft=constantZero;function treemap2(root){return root.x0=root.y0=0,root.x1=dx,root.y1=dy,root.eachBefore(positionNode),paddingStack=[0],round&&root.eachBefore(roundNode),root}function positionNode(node){var p=paddingStack[node.depth],x0=node.x0+p,y0=node.y0+p,x1=node.x1-p,y1=node.y1-p;x1<x0&&(x0=x1=(x0+x1)/2),y1<y0&&(y0=y1=(y0+y1)/2),node.x0=x0,node.y0=y0,node.x1=x1,node.y1=y1,node.children&&(p=paddingStack[node.depth+1]=paddingInner(node)/2,x0+=paddingLeft(node)-p,y0+=paddingTop(node)-p,(x1-=paddingRight(node)-p)<x0&&(x0=x1=(x0+x1)/2),(y1-=paddingBottom(node)-p)<y0&&(y0=y1=(y0+y1)/2),tile(node,x0,y0,x1,y1))}return treemap2.round=function(x){return arguments.length?(round=!!x,treemap2):round},treemap2.size=function(x){return arguments.length?(dx=+x[0],dy=+x[1],treemap2):[dx,dy]},treemap2.tile=function(x){return arguments.length?(tile=function(f){if("function"!=typeof f)throw new Error;return f}(x),treemap2):tile},treemap2.padding=function(x){return arguments.length?treemap2.paddingInner(x).paddingOuter(x):treemap2.paddingInner()},treemap2.paddingInner=function(x){return arguments.length?(paddingInner="function"==typeof x?x:constant(+x),treemap2):paddingInner},treemap2.paddingOuter=function(x){return arguments.length?treemap2.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x):treemap2.paddingTop()},treemap2.paddingTop=function(x){return arguments.length?(paddingTop="function"==typeof x?x:constant(+x),treemap2):paddingTop},treemap2.paddingRight=function(x){return arguments.length?(paddingRight="function"==typeof x?x:constant(+x),treemap2):paddingRight},treemap2.paddingBottom=function(x){return arguments.length?(paddingBottom="function"==typeof x?x:constant(+x),treemap2):paddingBottom},treemap2.paddingLeft=function(x){return arguments.length?(paddingLeft="function"==typeof x?x:constant(+x),treemap2):paddingLeft},treemap2}var TreeMapDB=(__name(_a=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getAccDescription=getAccDescription,this.setAccDescription=setAccDescription}getNodes(){return this.nodes}getConfig(){const defaultConfig=defaultConfig_default,userConfig=getConfig();return cleanAndMerge({...defaultConfig.treemap,...userConfig.treemap??{}})}addNode(node,level){this.nodes.push(node),this.levels.set(node,level),0===level&&(this.outerNodes.push(node),this.root??(this.root=node))}getRoot(){return{name:"",children:this.outerNodes}}addClass(id,_style){const styleClass=this.classes.get(id)??{id:id,styles:[],textStyles:[]},styles=_style.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");styles&&styles.forEach(s=>{isLabelStyle(s)&&((null==styleClass?void 0:styleClass.textStyles)?styleClass.textStyles.push(s):styleClass.textStyles=[s]),(null==styleClass?void 0:styleClass.styles)?styleClass.styles.push(s):styleClass.styles=[s]}),this.classes.set(id,styleClass)}getClasses(){return this.classes}getStylesForClass(classSelector){var _a2;return(null==(_a2=this.classes.get(classSelector))?void 0:_a2.styles)??[]}clear(){clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},"TreeMapDB"),_a);function buildHierarchy(items){if(!items.length)return[];const root=[],stack=[];return items.forEach(item=>{const node={name:item.name,children:"Leaf"===item.type?void 0:[]};for(node.classSelector=null==item?void 0:item.classSelector,(null==item?void 0:item.cssCompiledStyles)&&(node.cssCompiledStyles=item.cssCompiledStyles),"Leaf"===item.type&&void 0!==item.value&&(node.value=item.value);stack.length>0&&stack[stack.length-1].level>=item.level;)stack.pop();if(0===stack.length)root.push(node);else{const parent=stack[stack.length-1].node;parent.children?parent.children.push(node):parent.children=[node]}"Leaf"!==item.type&&stack.push({node:node,level:item.level})}),root}__name(buildHierarchy,"buildHierarchy");var populate=__name((ast,db)=>{populateCommonDb(ast,db);const items=[];for(const row of ast.TreemapRows??[])"ClassDefStatement"===row.$type&&db.addClass(row.className??"",row.styleText??"");for(const row of ast.TreemapRows??[]){const item=row.item;if(!item)continue;const level=row.indent?parseInt(row.indent):0,name=getItemName(item),styles=item.classSelector?db.getStylesForClass(item.classSelector):[],cssCompiledStyles=styles.length>0?styles:void 0,itemData={level:level,name:name,type:item.$type,value:item.value,classSelector:item.classSelector,cssCompiledStyles:cssCompiledStyles};items.push(itemData)}const hierarchyNodes=buildHierarchy(items),addNodesRecursively=__name((nodes,level)=>{for(const node of nodes)db.addNode(node,level),node.children&&node.children.length>0&&addNodesRecursively(node.children,level+1)},"addNodesRecursively");addNodesRecursively(hierarchyNodes,0)},"populate"),getItemName=__name(item=>item.name?String(item.name):"","getItemName"),parser={parser:{yy:void 0},parse:__name(async text=>{var _a2;try{const parseFunc=parse,ast=await parseFunc("treemap",text);log.debug("Treemap AST:",ast);const db=null==(_a2=parser.parser)?void 0:_a2.yy;if(!(db instanceof TreeMapDB))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");populate(ast,db)}catch(error){throw log.error("Error parsing treemap:",error),error}},"parse")},renderer={draw:__name((_text,id,_version,diagram2)=>{const treemapDb=diagram2.db,config=treemapDb.getConfig(),treemapInnerPadding=config.padding??10,title=treemapDb.getDiagramTitle(),root=treemapDb.getRoot(),{themeVariables:themeVariables}=getConfig();if(!root)return;const titleHeight=title?30:0,svg=selectSvgElement(id),width=config.nodeWidth?10*config.nodeWidth:960,height=config.nodeHeight?10*config.nodeHeight:500,svgWidth=width,svgHeight=height+titleHeight;let valueFormat;svg.attr("viewBox",`0 0 ${svgWidth} ${svgHeight}`),configureSvgSize(svg,svgHeight,svgWidth,config.useMaxWidth);try{const formatStr=config.valueFormat||",";if("$0,0"===formatStr)valueFormat=__name(value=>"$"+format(",")(value),"valueFormat");else if(formatStr.startsWith("$")&&formatStr.includes(",")){const precision=/\.\d+/.exec(formatStr),precisionStr=precision?precision[0]:"";valueFormat=__name(value=>"$"+format(","+precisionStr)(value),"valueFormat")}else if(formatStr.startsWith("$")){const restOfFormat=formatStr.substring(1);valueFormat=__name(value=>"$"+format(restOfFormat||"")(value),"valueFormat")}else valueFormat=format(formatStr)}catch(error){log.error("Error creating format function:",error),valueFormat=format(",")}const colorScale=ordinal().range(["transparent",themeVariables.cScale0,themeVariables.cScale1,themeVariables.cScale2,themeVariables.cScale3,themeVariables.cScale4,themeVariables.cScale5,themeVariables.cScale6,themeVariables.cScale7,themeVariables.cScale8,themeVariables.cScale9,themeVariables.cScale10,themeVariables.cScale11]),colorScalePeer=ordinal().range(["transparent",themeVariables.cScalePeer0,themeVariables.cScalePeer1,themeVariables.cScalePeer2,themeVariables.cScalePeer3,themeVariables.cScalePeer4,themeVariables.cScalePeer5,themeVariables.cScalePeer6,themeVariables.cScalePeer7,themeVariables.cScalePeer8,themeVariables.cScalePeer9,themeVariables.cScalePeer10,themeVariables.cScalePeer11]),colorScaleLabel=ordinal().range([themeVariables.cScaleLabel0,themeVariables.cScaleLabel1,themeVariables.cScaleLabel2,themeVariables.cScaleLabel3,themeVariables.cScaleLabel4,themeVariables.cScaleLabel5,themeVariables.cScaleLabel6,themeVariables.cScaleLabel7,themeVariables.cScaleLabel8,themeVariables.cScaleLabel9,themeVariables.cScaleLabel10,themeVariables.cScaleLabel11]);title&&svg.append("text").attr("x",svgWidth/2).attr("y",titleHeight/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(title);const g=svg.append("g").attr("transform",`translate(0, ${titleHeight})`).attr("class","treemapContainer"),hierarchyRoot=hierarchy(root).sum(d=>d.value??0).sort((a,b)=>(b.value??0)-(a.value??0)),treemapData=treemap().size([width,height]).paddingTop(d=>d.children&&d.children.length>0?35:0).paddingInner(treemapInnerPadding).paddingLeft(d=>d.children&&d.children.length>0?10:0).paddingRight(d=>d.children&&d.children.length>0?10:0).paddingBottom(d=>d.children&&d.children.length>0?10:0).round(!0)(hierarchyRoot),branchNodes=treemapData.descendants().filter(d=>d.children&&d.children.length>0),sections=g.selectAll(".treemapSection").data(branchNodes).enter().append("g").attr("class","treemapSection").attr("transform",d=>`translate(${d.x0},${d.y0})`);sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",25).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",d=>0===d.depth?"display: none;":""),sections.append("clipPath").attr("id",(_d,i)=>`clip-section-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-12)).attr("height",25),sections.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class",(_d,i)=>`treemapSection section${i}`).attr("fill",d=>colorScale(d.data.name)).attr("fill-opacity",.6).attr("stroke",d=>colorScalePeer(d.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",d=>{if(0===d.depth)return"display: none;";const styles=styles2String({cssCompiledStyles:d.data.cssCompiledStyles});return styles.nodeStyles+";"+styles.borderStyles.join(";")}),sections.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",12.5).attr("dominant-baseline","middle").text(d=>0===d.depth?"":d.data.name).attr("font-weight","bold").attr("style",d=>{if(0===d.depth)return"display: none;";return"dominant-baseline: middle; font-size: 12px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")}).each(function(d){if(0===d.depth)return;const self=select(this),originalText=d.data.name;self.text(originalText);const totalHeaderWidth=d.x1-d.x0;let spaceForTextContent;if(!1!==config.showValues&&d.value){spaceForTextContent=totalHeaderWidth-10-30-10-6}else{spaceForTextContent=totalHeaderWidth-6-6}const actualAvailableWidth=Math.max(15,spaceForTextContent),textNode=self.node();if(textNode.getComputedTextLength()>actualAvailableWidth){const ellipsis="...";let currentTruncatedText=originalText;for(;currentTruncatedText.length>0;){if(currentTruncatedText=originalText.substring(0,currentTruncatedText.length-1),0===currentTruncatedText.length){self.text(ellipsis),textNode.getComputedTextLength()>actualAvailableWidth&&self.text("");break}if(self.text(currentTruncatedText+ellipsis),textNode.getComputedTextLength()<=actualAvailableWidth)break}}}),!1!==config.showValues&&sections.append("text").attr("class","treemapSectionValue").attr("x",d=>d.x1-d.x0-10).attr("y",12.5).attr("text-anchor","end").attr("dominant-baseline","middle").text(d=>d.value?valueFormat(d.value):"").attr("font-style","italic").attr("style",d=>{if(0===d.depth)return"display: none;";return"text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+colorScaleLabel(d.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")});const leafNodes=treemapData.leaves(),cell=g.selectAll(".treemapLeafGroup").data(leafNodes).enter().append("g").attr("class",(d,i)=>`treemapNode treemapLeafGroup leaf${i}${d.data.classSelector?` ${d.data.classSelector}`:""}x`).attr("transform",d=>`translate(${d.x0},${d.y0})`);cell.append("rect").attr("width",d=>d.x1-d.x0).attr("height",d=>d.y1-d.y0).attr("class","treemapLeaf").attr("fill",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("style",d=>styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",d=>d.parent?colorScale(d.parent.data.name):colorScale(d.data.name)).attr("stroke-width",3),cell.append("clipPath").attr("id",(_d,i)=>`clip-${id}-${i}`).append("rect").attr("width",d=>Math.max(0,d.x1-d.x0-4)).attr("height",d=>Math.max(0,d.y1-d.y0-4));if(cell.append("text").attr("class","treemapLabel").attr("x",d=>(d.x1-d.x0)/2).attr("y",d=>(d.y1-d.y0)/2).attr("style",d=>"text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.data.name).each(function(d){const self=select(this),nodeWidth=d.x1-d.x0,nodeHeight=d.y1-d.y0,textNode=self.node(),availableWidth=nodeWidth-8,availableHeight=nodeHeight-8;if(availableWidth<10||availableHeight<10)return void self.style("display","none");let currentLabelFontSize=parseInt(self.style("font-size"),10);for(;textNode.getComputedTextLength()>availableWidth&&currentLabelFontSize>8;)currentLabelFontSize--,self.style("font-size",`${currentLabelFontSize}px`);let prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;for(;combinedHeight>availableHeight&&currentLabelFontSize>8&&(currentLabelFontSize--,prospectiveValueFontSize=Math.max(6,Math.min(28,Math.round(.6*currentLabelFontSize))),!(prospectiveValueFontSize<6&&8===currentLabelFontSize));)self.style("font-size",`${currentLabelFontSize}px`),combinedHeight=currentLabelFontSize+2+prospectiveValueFontSize;self.style("font-size",`${currentLabelFontSize}px`),(textNode.getComputedTextLength()>availableWidth||currentLabelFontSize<8||availableHeight<currentLabelFontSize)&&self.style("display","none")}),!1!==config.showValues){cell.append("text").attr("class","treemapValue").attr("x",d=>(d.x1-d.x0)/2).attr("y",function(d){return(d.y1-d.y0)/2}).attr("style",d=>"text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+colorScaleLabel(d.data.name)+";"+styles2String({cssCompiledStyles:d.data.cssCompiledStyles}).labelStyles.replace("color:","fill:")).attr("clip-path",(_d,i)=>`url(#clip-${id}-${i})`).text(d=>d.value?valueFormat(d.value):"").each(function(d){const valueTextElement=select(this),parentCellNode=this.parentNode;if(!parentCellNode)return void valueTextElement.style("display","none");const labelElement=select(parentCellNode).select(".treemapLabel");if(labelElement.empty()||"none"===labelElement.style("display"))return void valueTextElement.style("display","none");const finalLabelFontSize=parseFloat(labelElement.style("font-size")),actualValueFontSize=Math.max(6,Math.min(28,Math.round(.6*finalLabelFontSize)));valueTextElement.style("font-size",`${actualValueFontSize}px`);const valueTopActualY=(d.y1-d.y0)/2+finalLabelFontSize/2+2;valueTextElement.attr("y",valueTopActualY);const nodeWidth=d.x1-d.x0,maxValueBottomY=d.y1-d.y0-4,availableWidthForValue=nodeWidth-8;valueTextElement.node().getComputedTextLength()>availableWidthForValue||valueTopActualY+actualValueFontSize>maxValueBottomY||actualValueFontSize<6?valueTextElement.style("display","none"):valueTextElement.style("display",null)})}const diagramPadding=config.diagramPadding??8;setupViewPortForSVG(svg,diagramPadding,"flowchart",(null==config?void 0:config.useMaxWidth)||!1)},"draw"),getClasses:__name(function(_text,diagramObj){return diagramObj.db.getClasses()},"getClasses")},defaultTreemapStyleOptions={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},styles_default=__name(({treemap:treemap2}={})=>{const defaultThemeVariables=getThemeVariables3(),currentConfig=getConfig(),themeVariables=cleanAndMerge(defaultThemeVariables,currentConfig.themeVariables),options=cleanAndMerge(defaultTreemapStyleOptions,treemap2),titleColor=options.titleColor??themeVariables.titleColor,labelColor=options.labelColor??themeVariables.textColor,valueColor=options.valueColor??themeVariables.textColor;return`\n .treemapNode.section {\n stroke: ${options.sectionStrokeColor};\n stroke-width: ${options.sectionStrokeWidth};\n fill: ${options.sectionFillColor};\n }\n .treemapNode.leaf {\n stroke: ${options.leafStrokeColor};\n stroke-width: ${options.leafStrokeWidth};\n fill: ${options.leafFillColor};\n }\n .treemapLabel {\n fill: ${labelColor};\n font-size: ${options.labelFontSize};\n }\n .treemapValue {\n fill: ${valueColor};\n font-size: ${options.valueFontSize};\n }\n .treemapTitle {\n fill: ${titleColor};\n font-size: ${options.titleFontSize};\n }\n `},"getStyles"),diagram={parser:parser,get db(){return new TreeMapDB},renderer:renderer,styles:styles_default};export{diagram};
@@ -1 +1 @@
1
- import{s as setAccDescription,g as getAccDescription,q as getDiagramTitle,p as setDiagramTitle,a as getAccTitle,b as setAccTitle,_ as __name,H as selectSvgElement,y as clear,E as cleanAndMerge,F as defaultConfig_default,C as getConfig,l as log,I as getThemeVariables3,e as configureSvgSize}from"./mermaid.core-1heNIJ5f.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-DdsULqPZ.js";import{p as parse}from"./wardley-RL74JXVD-BN899vMf.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-CC9CkAxn.js";import"./_baseUniq-Dgkw4IXM.js";var defaultOptions={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},defaultRadarData={axes:[],curves:[],options:defaultOptions},data=structuredClone(defaultRadarData),DEFAULT_RADAR_CONFIG=defaultConfig_default.radar,getConfig2=__name(()=>cleanAndMerge({...DEFAULT_RADAR_CONFIG,...getConfig().radar}),"getConfig"),getAxes=__name(()=>data.axes,"getAxes"),getCurves=__name(()=>data.curves,"getCurves"),getOptions=__name(()=>data.options,"getOptions"),setAxes=__name(axes=>{data.axes=axes.map(axis=>({name:axis.name,label:axis.label??axis.name}))},"setAxes"),setCurves=__name(curves=>{data.curves=curves.map(curve=>({name:curve.name,label:curve.label??curve.name,entries:computeCurveEntries(curve.entries)}))},"setCurves"),computeCurveEntries=__name(entries=>{if(null==entries[0].axis)return entries.map(entry=>entry.value);const axes=getAxes();if(0===axes.length)throw new Error("Axes must be populated before curves for reference entries");return axes.map(axis=>{const entry=entries.find(entry2=>{var _a;return(null==(_a=entry2.axis)?void 0:_a.$refText)===axis.name});if(void 0===entry)throw new Error("Missing entry for axis "+axis.label);return entry.value})},"computeCurveEntries"),db={getAxes:getAxes,getCurves:getCurves,getOptions:getOptions,setAxes:setAxes,setCurves:setCurves,setOptions:__name(options=>{var _a,_b,_c,_d,_e;const optionMap=options.reduce((acc,option)=>(acc[option.name]=option,acc),{});data.options={showLegend:(null==(_a=optionMap.showLegend)?void 0:_a.value)??defaultOptions.showLegend,ticks:(null==(_b=optionMap.ticks)?void 0:_b.value)??defaultOptions.ticks,max:(null==(_c=optionMap.max)?void 0:_c.value)??defaultOptions.max,min:(null==(_d=optionMap.min)?void 0:_d.value)??defaultOptions.min,graticule:(null==(_e=optionMap.graticule)?void 0:_e.value)??defaultOptions.graticule}},"setOptions"),getConfig:getConfig2,clear:__name(()=>{clear(),data=structuredClone(defaultRadarData)},"clear"),setAccTitle:setAccTitle,getAccTitle:getAccTitle,setDiagramTitle:setDiagramTitle,getDiagramTitle:getDiagramTitle,getAccDescription:getAccDescription,setAccDescription:setAccDescription},populate=__name(ast=>{populateCommonDb(ast,db);const{axes:axes,curves:curves,options:options}=ast;db.setAxes(axes),db.setCurves(curves),db.setOptions(options)},"populate"),parser={parse:__name(async input=>{const ast=await parse("radar",input);log.debug(ast),populate(ast)},"parse")},draw=__name((_text,id,_version,diagram2)=>{const db2=diagram2.db,axes=db2.getAxes(),curves=db2.getCurves(),options=db2.getOptions(),config=db2.getConfig(),title=db2.getDiagramTitle(),svg=selectSvgElement(id),g=drawFrame(svg,config),maxValue=options.max??Math.max(...curves.map(curve=>Math.max(...curve.entries))),minValue=options.min,radius=Math.min(config.width,config.height)/2;drawGraticule(g,axes,radius,options.ticks,options.graticule),drawAxes(g,axes,radius,config),drawCurves(g,axes,curves,minValue,maxValue,options.graticule,config),drawLegend(g,curves,options.showLegend,config),g.append("text").attr("class","radarTitle").text(title).attr("x",0).attr("y",-config.height/2-config.marginTop)},"draw"),drawFrame=__name((svg,config)=>{const totalWidth=config.width+config.marginLeft+config.marginRight,totalHeight=config.height+config.marginTop+config.marginBottom,center_x=config.marginLeft+config.width/2,center_y=config.marginTop+config.height/2;return configureSvgSize(svg,totalHeight,totalWidth,config.useMaxWidth??!0),svg.attr("viewBox",`0 0 ${totalWidth} ${totalHeight}`),svg.append("g").attr("transform",`translate(${center_x}, ${center_y})`)},"drawFrame"),drawGraticule=__name((g,axes,radius,ticks,graticule)=>{if("circle"===graticule)for(let i=0;i<ticks;i++){const r=radius*(i+1)/ticks;g.append("circle").attr("r",r).attr("class","radarGraticule")}else if("polygon"===graticule){const numAxes=axes.length;for(let i=0;i<ticks;i++){const r=radius*(i+1)/ticks,points=axes.map((_,j)=>{const angle=2*j*Math.PI/numAxes-Math.PI/2;return`${r*Math.cos(angle)},${r*Math.sin(angle)}`}).join(" ");g.append("polygon").attr("points",points).attr("class","radarGraticule")}}},"drawGraticule"),drawAxes=__name((g,axes,radius,config)=>{const numAxes=axes.length;for(let i=0;i<numAxes;i++){const label=axes[i].label,angle=2*i*Math.PI/numAxes-Math.PI/2;g.append("line").attr("x1",0).attr("y1",0).attr("x2",radius*config.axisScaleFactor*Math.cos(angle)).attr("y2",radius*config.axisScaleFactor*Math.sin(angle)).attr("class","radarAxisLine"),g.append("text").text(label).attr("x",radius*config.axisLabelFactor*Math.cos(angle)).attr("y",radius*config.axisLabelFactor*Math.sin(angle)).attr("class","radarAxisLabel")}},"drawAxes");function drawCurves(g,axes,curves,minValue,maxValue,graticule,config){const numAxes=axes.length,radius=Math.min(config.width,config.height)/2;curves.forEach((curve,index)=>{if(curve.entries.length!==numAxes)return;const points=curve.entries.map((entry,i)=>{const angle=2*Math.PI*i/numAxes-Math.PI/2,r=relativeRadius(entry,minValue,maxValue,radius);return{x:r*Math.cos(angle),y:r*Math.sin(angle)}});"circle"===graticule?g.append("path").attr("d",closedRoundCurve(points,config.curveTension)).attr("class",`radarCurve-${index}`):"polygon"===graticule&&g.append("polygon").attr("points",points.map(p=>`${p.x},${p.y}`).join(" ")).attr("class",`radarCurve-${index}`)})}function relativeRadius(value,minValue,maxValue,radius){return radius*(Math.min(Math.max(value,minValue),maxValue)-minValue)/(maxValue-minValue)}function closedRoundCurve(points,tension){const numPoints=points.length;let d=`M${points[0].x},${points[0].y}`;for(let i=0;i<numPoints;i++){const p0=points[(i-1+numPoints)%numPoints],p1=points[i],p2=points[(i+1)%numPoints],p3=points[(i+2)%numPoints],cp1={x:p1.x+(p2.x-p0.x)*tension,y:p1.y+(p2.y-p0.y)*tension},cp2={x:p2.x-(p3.x-p1.x)*tension,y:p2.y-(p3.y-p1.y)*tension};d+=` C${cp1.x},${cp1.y} ${cp2.x},${cp2.y} ${p2.x},${p2.y}`}return`${d} Z`}function drawLegend(g,curves,showLegend,config){if(!showLegend)return;const legendX=3*(config.width/2+config.marginRight)/4,legendY=3*-(config.height/2+config.marginTop)/4;curves.forEach((curve,index)=>{const itemGroup=g.append("g").attr("transform",`translate(${legendX}, ${legendY+20*index})`);itemGroup.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${index}`),itemGroup.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(curve.label)})}__name(drawCurves,"drawCurves"),__name(relativeRadius,"relativeRadius"),__name(closedRoundCurve,"closedRoundCurve"),__name(drawLegend,"drawLegend");var renderer={draw:draw},genIndexStyles=__name((themeVariables,radarOptions)=>{let sections="";for(let i=0;i<themeVariables.THEME_COLOR_LIMIT;i++){const indexColor=themeVariables[`cScale${i}`];sections+=`\n\t\t.radarCurve-${i} {\n\t\t\tcolor: ${indexColor};\n\t\t\tfill: ${indexColor};\n\t\t\tfill-opacity: ${radarOptions.curveOpacity};\n\t\t\tstroke: ${indexColor};\n\t\t\tstroke-width: ${radarOptions.curveStrokeWidth};\n\t\t}\n\t\t.radarLegendBox-${i} {\n\t\t\tfill: ${indexColor};\n\t\t\tfill-opacity: ${radarOptions.curveOpacity};\n\t\t\tstroke: ${indexColor};\n\t\t}\n\t\t`}return sections},"genIndexStyles"),buildRadarStyleOptions=__name(radar=>{const defaultThemeVariables=getThemeVariables3(),currentConfig=getConfig(),themeVariables=cleanAndMerge(defaultThemeVariables,currentConfig.themeVariables);return{themeVariables:themeVariables,radarOptions:cleanAndMerge(themeVariables.radar,radar)}},"buildRadarStyleOptions"),diagram={parser:parser,db:db,renderer:renderer,styles:__name(({radar:radar}={})=>{const{themeVariables:themeVariables,radarOptions:radarOptions}=buildRadarStyleOptions(radar);return`\n\t.radarTitle {\n\t\tfont-size: ${themeVariables.fontSize};\n\t\tcolor: ${themeVariables.titleColor};\n\t\tdominant-baseline: hanging;\n\t\ttext-anchor: middle;\n\t}\n\t.radarAxisLine {\n\t\tstroke: ${radarOptions.axisColor};\n\t\tstroke-width: ${radarOptions.axisStrokeWidth};\n\t}\n\t.radarAxisLabel {\n\t\tdominant-baseline: middle;\n\t\ttext-anchor: middle;\n\t\tfont-size: ${radarOptions.axisLabelFontSize}px;\n\t\tcolor: ${radarOptions.axisColor};\n\t}\n\t.radarGraticule {\n\t\tfill: ${radarOptions.graticuleColor};\n\t\tfill-opacity: ${radarOptions.graticuleOpacity};\n\t\tstroke: ${radarOptions.graticuleColor};\n\t\tstroke-width: ${radarOptions.graticuleStrokeWidth};\n\t}\n\t.radarLegendText {\n\t\ttext-anchor: start;\n\t\tfont-size: ${radarOptions.legendFontSize}px;\n\t\tdominant-baseline: hanging;\n\t}\n\t${genIndexStyles(themeVariables,radarOptions)}\n\t`},"styles")};export{diagram};
1
+ import{s as setAccDescription,g as getAccDescription,q as getDiagramTitle,p as setDiagramTitle,a as getAccTitle,b as setAccTitle,_ as __name,H as selectSvgElement,y as clear,E as cleanAndMerge,F as defaultConfig_default,C as getConfig,l as log,I as getThemeVariables3,e as configureSvgSize}from"./mermaid.core-YmJi7T-s.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-1FZYtnJ7.js";import{p as parse}from"./wardley-RL74JXVD-B2rj5j7G.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-akJQqRMn.js";import"./_baseUniq-CPJrFyUF.js";var defaultOptions={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},defaultRadarData={axes:[],curves:[],options:defaultOptions},data=structuredClone(defaultRadarData),DEFAULT_RADAR_CONFIG=defaultConfig_default.radar,getConfig2=__name(()=>cleanAndMerge({...DEFAULT_RADAR_CONFIG,...getConfig().radar}),"getConfig"),getAxes=__name(()=>data.axes,"getAxes"),getCurves=__name(()=>data.curves,"getCurves"),getOptions=__name(()=>data.options,"getOptions"),setAxes=__name(axes=>{data.axes=axes.map(axis=>({name:axis.name,label:axis.label??axis.name}))},"setAxes"),setCurves=__name(curves=>{data.curves=curves.map(curve=>({name:curve.name,label:curve.label??curve.name,entries:computeCurveEntries(curve.entries)}))},"setCurves"),computeCurveEntries=__name(entries=>{if(null==entries[0].axis)return entries.map(entry=>entry.value);const axes=getAxes();if(0===axes.length)throw new Error("Axes must be populated before curves for reference entries");return axes.map(axis=>{const entry=entries.find(entry2=>{var _a;return(null==(_a=entry2.axis)?void 0:_a.$refText)===axis.name});if(void 0===entry)throw new Error("Missing entry for axis "+axis.label);return entry.value})},"computeCurveEntries"),db={getAxes:getAxes,getCurves:getCurves,getOptions:getOptions,setAxes:setAxes,setCurves:setCurves,setOptions:__name(options=>{var _a,_b,_c,_d,_e;const optionMap=options.reduce((acc,option)=>(acc[option.name]=option,acc),{});data.options={showLegend:(null==(_a=optionMap.showLegend)?void 0:_a.value)??defaultOptions.showLegend,ticks:(null==(_b=optionMap.ticks)?void 0:_b.value)??defaultOptions.ticks,max:(null==(_c=optionMap.max)?void 0:_c.value)??defaultOptions.max,min:(null==(_d=optionMap.min)?void 0:_d.value)??defaultOptions.min,graticule:(null==(_e=optionMap.graticule)?void 0:_e.value)??defaultOptions.graticule}},"setOptions"),getConfig:getConfig2,clear:__name(()=>{clear(),data=structuredClone(defaultRadarData)},"clear"),setAccTitle:setAccTitle,getAccTitle:getAccTitle,setDiagramTitle:setDiagramTitle,getDiagramTitle:getDiagramTitle,getAccDescription:getAccDescription,setAccDescription:setAccDescription},populate=__name(ast=>{populateCommonDb(ast,db);const{axes:axes,curves:curves,options:options}=ast;db.setAxes(axes),db.setCurves(curves),db.setOptions(options)},"populate"),parser={parse:__name(async input=>{const ast=await parse("radar",input);log.debug(ast),populate(ast)},"parse")},draw=__name((_text,id,_version,diagram2)=>{const db2=diagram2.db,axes=db2.getAxes(),curves=db2.getCurves(),options=db2.getOptions(),config=db2.getConfig(),title=db2.getDiagramTitle(),svg=selectSvgElement(id),g=drawFrame(svg,config),maxValue=options.max??Math.max(...curves.map(curve=>Math.max(...curve.entries))),minValue=options.min,radius=Math.min(config.width,config.height)/2;drawGraticule(g,axes,radius,options.ticks,options.graticule),drawAxes(g,axes,radius,config),drawCurves(g,axes,curves,minValue,maxValue,options.graticule,config),drawLegend(g,curves,options.showLegend,config),g.append("text").attr("class","radarTitle").text(title).attr("x",0).attr("y",-config.height/2-config.marginTop)},"draw"),drawFrame=__name((svg,config)=>{const totalWidth=config.width+config.marginLeft+config.marginRight,totalHeight=config.height+config.marginTop+config.marginBottom,center_x=config.marginLeft+config.width/2,center_y=config.marginTop+config.height/2;return configureSvgSize(svg,totalHeight,totalWidth,config.useMaxWidth??!0),svg.attr("viewBox",`0 0 ${totalWidth} ${totalHeight}`),svg.append("g").attr("transform",`translate(${center_x}, ${center_y})`)},"drawFrame"),drawGraticule=__name((g,axes,radius,ticks,graticule)=>{if("circle"===graticule)for(let i=0;i<ticks;i++){const r=radius*(i+1)/ticks;g.append("circle").attr("r",r).attr("class","radarGraticule")}else if("polygon"===graticule){const numAxes=axes.length;for(let i=0;i<ticks;i++){const r=radius*(i+1)/ticks,points=axes.map((_,j)=>{const angle=2*j*Math.PI/numAxes-Math.PI/2;return`${r*Math.cos(angle)},${r*Math.sin(angle)}`}).join(" ");g.append("polygon").attr("points",points).attr("class","radarGraticule")}}},"drawGraticule"),drawAxes=__name((g,axes,radius,config)=>{const numAxes=axes.length;for(let i=0;i<numAxes;i++){const label=axes[i].label,angle=2*i*Math.PI/numAxes-Math.PI/2;g.append("line").attr("x1",0).attr("y1",0).attr("x2",radius*config.axisScaleFactor*Math.cos(angle)).attr("y2",radius*config.axisScaleFactor*Math.sin(angle)).attr("class","radarAxisLine"),g.append("text").text(label).attr("x",radius*config.axisLabelFactor*Math.cos(angle)).attr("y",radius*config.axisLabelFactor*Math.sin(angle)).attr("class","radarAxisLabel")}},"drawAxes");function drawCurves(g,axes,curves,minValue,maxValue,graticule,config){const numAxes=axes.length,radius=Math.min(config.width,config.height)/2;curves.forEach((curve,index)=>{if(curve.entries.length!==numAxes)return;const points=curve.entries.map((entry,i)=>{const angle=2*Math.PI*i/numAxes-Math.PI/2,r=relativeRadius(entry,minValue,maxValue,radius);return{x:r*Math.cos(angle),y:r*Math.sin(angle)}});"circle"===graticule?g.append("path").attr("d",closedRoundCurve(points,config.curveTension)).attr("class",`radarCurve-${index}`):"polygon"===graticule&&g.append("polygon").attr("points",points.map(p=>`${p.x},${p.y}`).join(" ")).attr("class",`radarCurve-${index}`)})}function relativeRadius(value,minValue,maxValue,radius){return radius*(Math.min(Math.max(value,minValue),maxValue)-minValue)/(maxValue-minValue)}function closedRoundCurve(points,tension){const numPoints=points.length;let d=`M${points[0].x},${points[0].y}`;for(let i=0;i<numPoints;i++){const p0=points[(i-1+numPoints)%numPoints],p1=points[i],p2=points[(i+1)%numPoints],p3=points[(i+2)%numPoints],cp1={x:p1.x+(p2.x-p0.x)*tension,y:p1.y+(p2.y-p0.y)*tension},cp2={x:p2.x-(p3.x-p1.x)*tension,y:p2.y-(p3.y-p1.y)*tension};d+=` C${cp1.x},${cp1.y} ${cp2.x},${cp2.y} ${p2.x},${p2.y}`}return`${d} Z`}function drawLegend(g,curves,showLegend,config){if(!showLegend)return;const legendX=3*(config.width/2+config.marginRight)/4,legendY=3*-(config.height/2+config.marginTop)/4;curves.forEach((curve,index)=>{const itemGroup=g.append("g").attr("transform",`translate(${legendX}, ${legendY+20*index})`);itemGroup.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${index}`),itemGroup.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(curve.label)})}__name(drawCurves,"drawCurves"),__name(relativeRadius,"relativeRadius"),__name(closedRoundCurve,"closedRoundCurve"),__name(drawLegend,"drawLegend");var renderer={draw:draw},genIndexStyles=__name((themeVariables,radarOptions)=>{let sections="";for(let i=0;i<themeVariables.THEME_COLOR_LIMIT;i++){const indexColor=themeVariables[`cScale${i}`];sections+=`\n\t\t.radarCurve-${i} {\n\t\t\tcolor: ${indexColor};\n\t\t\tfill: ${indexColor};\n\t\t\tfill-opacity: ${radarOptions.curveOpacity};\n\t\t\tstroke: ${indexColor};\n\t\t\tstroke-width: ${radarOptions.curveStrokeWidth};\n\t\t}\n\t\t.radarLegendBox-${i} {\n\t\t\tfill: ${indexColor};\n\t\t\tfill-opacity: ${radarOptions.curveOpacity};\n\t\t\tstroke: ${indexColor};\n\t\t}\n\t\t`}return sections},"genIndexStyles"),buildRadarStyleOptions=__name(radar=>{const defaultThemeVariables=getThemeVariables3(),currentConfig=getConfig(),themeVariables=cleanAndMerge(defaultThemeVariables,currentConfig.themeVariables);return{themeVariables:themeVariables,radarOptions:cleanAndMerge(themeVariables.radar,radar)}},"buildRadarStyleOptions"),diagram={parser:parser,db:db,renderer:renderer,styles:__name(({radar:radar}={})=>{const{themeVariables:themeVariables,radarOptions:radarOptions}=buildRadarStyleOptions(radar);return`\n\t.radarTitle {\n\t\tfont-size: ${themeVariables.fontSize};\n\t\tcolor: ${themeVariables.titleColor};\n\t\tdominant-baseline: hanging;\n\t\ttext-anchor: middle;\n\t}\n\t.radarAxisLine {\n\t\tstroke: ${radarOptions.axisColor};\n\t\tstroke-width: ${radarOptions.axisStrokeWidth};\n\t}\n\t.radarAxisLabel {\n\t\tdominant-baseline: middle;\n\t\ttext-anchor: middle;\n\t\tfont-size: ${radarOptions.axisLabelFontSize}px;\n\t\tcolor: ${radarOptions.axisColor};\n\t}\n\t.radarGraticule {\n\t\tfill: ${radarOptions.graticuleColor};\n\t\tfill-opacity: ${radarOptions.graticuleOpacity};\n\t\tstroke: ${radarOptions.graticuleColor};\n\t\tstroke-width: ${radarOptions.graticuleStrokeWidth};\n\t}\n\t.radarLegendText {\n\t\ttext-anchor: start;\n\t\tfont-size: ${radarOptions.legendFontSize}px;\n\t\tdominant-baseline: hanging;\n\t}\n\t${genIndexStyles(themeVariables,radarOptions)}\n\t`},"styles")};export{diagram};
@@ -1 +1 @@
1
- var _a;import{_ as __name,E as cleanAndMerge,H as selectSvgElement,e as configureSvgSize,l as log,b as setAccTitle,a as getAccTitle,p as setDiagramTitle,q as getDiagramTitle,g as getAccDescription,s as setAccDescription,F as defaultConfig_default,C as getConfig,y as clear}from"./mermaid.core-1heNIJ5f.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-DdsULqPZ.js";import{p as parse}from"./wardley-RL74JXVD-BN899vMf.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-CC9CkAxn.js";import"./_baseUniq-Dgkw4IXM.js";var DEFAULT_PACKET_CONFIG=defaultConfig_default.packet,PacketDB=(__name(_a=class{constructor(){this.packet=[],this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getAccDescription=getAccDescription,this.setAccDescription=setAccDescription}getConfig(){const config=cleanAndMerge({...DEFAULT_PACKET_CONFIG,...getConfig().packet});return config.showBits&&(config.paddingY+=10),config}getPacket(){return this.packet}pushWord(word){word.length>0&&this.packet.push(word)}clear(){clear(),this.packet=[]}},"PacketDB"),_a),populate=__name((ast,db)=>{populateCommonDb(ast,db);let lastBit=-1,word=[],row=1;const{bitsPerRow:bitsPerRow}=db.getConfig();for(let{start:start,end:end,bits:bits,label:label}of ast.blocks){if(void 0!==start&&void 0!==end&&end<start)throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);if(start??(start=lastBit+1),start!==lastBit+1)throw new Error(`Packet block ${start} - ${end??start} is not contiguous. It should start from ${lastBit+1}.`);if(0===bits)throw new Error(`Packet block ${start} is invalid. Cannot have a zero bit field.`);for(end??(end=start+(bits??1)-1),bits??(bits=end-start+1),lastBit=end,log.debug(`Packet block ${start} - ${lastBit} with label ${label}`);word.length<=bitsPerRow+1&&db.getPacket().length<1e4;){const[block,nextBlock]=getNextFittingBlock({start:start,end:end,bits:bits,label:label},row,bitsPerRow);if(word.push(block),block.end+1===row*bitsPerRow&&(db.pushWord(word),word=[],row++),!nextBlock)break;({start:start,end:end,bits:bits,label:label}=nextBlock)}}db.pushWord(word)},"populate"),getNextFittingBlock=__name((block,row,bitsPerRow)=>{if(void 0===block.start)throw new Error("start should have been set during first phase");if(void 0===block.end)throw new Error("end should have been set during first phase");if(block.start>block.end)throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);if(block.end+1<=row*bitsPerRow)return[block,void 0];const rowEnd=row*bitsPerRow-1,rowStart=row*bitsPerRow;return[{start:block.start,end:rowEnd,label:block.label,bits:rowEnd-block.start},{start:rowStart,end:block.end,label:block.label,bits:block.end-rowStart}]},"getNextFittingBlock"),parser={parser:{yy:void 0},parse:__name(async input=>{var _a2;const ast=await parse("packet",input),db=null==(_a2=parser.parser)?void 0:_a2.yy;if(!(db instanceof PacketDB))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");log.debug(ast),populate(ast,db)},"parse")},draw=__name((_text,id,_version,diagram2)=>{const db=diagram2.db,config=db.getConfig(),{rowHeight:rowHeight,paddingY:paddingY,bitWidth:bitWidth,bitsPerRow:bitsPerRow}=config,words=db.getPacket(),title=db.getDiagramTitle(),totalRowHeight=rowHeight+paddingY,svgHeight=totalRowHeight*(words.length+1)-(title?0:rowHeight),svgWidth=bitWidth*bitsPerRow+2,svg=selectSvgElement(id);svg.attr("viewBox",`0 0 ${svgWidth} ${svgHeight}`),configureSvgSize(svg,svgHeight,svgWidth,config.useMaxWidth);for(const[word,packet]of words.entries())drawWord(svg,packet,word,config);svg.append("text").text(title).attr("x",svgWidth/2).attr("y",svgHeight-totalRowHeight/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),drawWord=__name((svg,word,rowNumber,{rowHeight:rowHeight,paddingX:paddingX,paddingY:paddingY,bitWidth:bitWidth,bitsPerRow:bitsPerRow,showBits:showBits})=>{const group=svg.append("g"),wordY=rowNumber*(rowHeight+paddingY)+paddingY;for(const block of word){const blockX=block.start%bitsPerRow*bitWidth+1,width=(block.end-block.start+1)*bitWidth-paddingX;if(group.append("rect").attr("x",blockX).attr("y",wordY).attr("width",width).attr("height",rowHeight).attr("class","packetBlock"),group.append("text").attr("x",blockX+width/2).attr("y",wordY+rowHeight/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(block.label),!showBits)continue;const isSingleBlock=block.end===block.start,bitNumberY=wordY-2;group.append("text").attr("x",blockX+(isSingleBlock?width/2:0)).attr("y",bitNumberY).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",isSingleBlock?"middle":"start").text(block.start),isSingleBlock||group.append("text").attr("x",blockX+width).attr("y",bitNumberY).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(block.end)}},"drawWord"),renderer={draw:draw},defaultPacketStyleOptions={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},styles=__name(({packet:packet}={})=>{const options=cleanAndMerge(defaultPacketStyleOptions,packet);return`\n\t.packetByte {\n\t\tfont-size: ${options.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${options.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${options.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${options.labelColor};\n\t\tfont-size: ${options.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${options.titleColor};\n\t\tfont-size: ${options.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${options.blockStrokeColor};\n\t\tstroke-width: ${options.blockStrokeWidth};\n\t\tfill: ${options.blockFillColor};\n\t}\n\t`},"styles"),diagram={parser:parser,get db(){return new PacketDB},renderer:renderer,styles:styles};export{diagram};
1
+ var _a;import{_ as __name,E as cleanAndMerge,H as selectSvgElement,e as configureSvgSize,l as log,b as setAccTitle,a as getAccTitle,p as setDiagramTitle,q as getDiagramTitle,g as getAccDescription,s as setAccDescription,F as defaultConfig_default,C as getConfig,y as clear}from"./mermaid.core-YmJi7T-s.js";import{p as populateCommonDb}from"./chunk-4BX2VUAB-1FZYtnJ7.js";import{p as parse}from"./wardley-RL74JXVD-B2rj5j7G.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";import"./min-akJQqRMn.js";import"./_baseUniq-CPJrFyUF.js";var DEFAULT_PACKET_CONFIG=defaultConfig_default.packet,PacketDB=(__name(_a=class{constructor(){this.packet=[],this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getAccDescription=getAccDescription,this.setAccDescription=setAccDescription}getConfig(){const config=cleanAndMerge({...DEFAULT_PACKET_CONFIG,...getConfig().packet});return config.showBits&&(config.paddingY+=10),config}getPacket(){return this.packet}pushWord(word){word.length>0&&this.packet.push(word)}clear(){clear(),this.packet=[]}},"PacketDB"),_a),populate=__name((ast,db)=>{populateCommonDb(ast,db);let lastBit=-1,word=[],row=1;const{bitsPerRow:bitsPerRow}=db.getConfig();for(let{start:start,end:end,bits:bits,label:label}of ast.blocks){if(void 0!==start&&void 0!==end&&end<start)throw new Error(`Packet block ${start} - ${end} is invalid. End must be greater than start.`);if(start??(start=lastBit+1),start!==lastBit+1)throw new Error(`Packet block ${start} - ${end??start} is not contiguous. It should start from ${lastBit+1}.`);if(0===bits)throw new Error(`Packet block ${start} is invalid. Cannot have a zero bit field.`);for(end??(end=start+(bits??1)-1),bits??(bits=end-start+1),lastBit=end,log.debug(`Packet block ${start} - ${lastBit} with label ${label}`);word.length<=bitsPerRow+1&&db.getPacket().length<1e4;){const[block,nextBlock]=getNextFittingBlock({start:start,end:end,bits:bits,label:label},row,bitsPerRow);if(word.push(block),block.end+1===row*bitsPerRow&&(db.pushWord(word),word=[],row++),!nextBlock)break;({start:start,end:end,bits:bits,label:label}=nextBlock)}}db.pushWord(word)},"populate"),getNextFittingBlock=__name((block,row,bitsPerRow)=>{if(void 0===block.start)throw new Error("start should have been set during first phase");if(void 0===block.end)throw new Error("end should have been set during first phase");if(block.start>block.end)throw new Error(`Block start ${block.start} is greater than block end ${block.end}.`);if(block.end+1<=row*bitsPerRow)return[block,void 0];const rowEnd=row*bitsPerRow-1,rowStart=row*bitsPerRow;return[{start:block.start,end:rowEnd,label:block.label,bits:rowEnd-block.start},{start:rowStart,end:block.end,label:block.label,bits:block.end-rowStart}]},"getNextFittingBlock"),parser={parser:{yy:void 0},parse:__name(async input=>{var _a2;const ast=await parse("packet",input),db=null==(_a2=parser.parser)?void 0:_a2.yy;if(!(db instanceof PacketDB))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");log.debug(ast),populate(ast,db)},"parse")},draw=__name((_text,id,_version,diagram2)=>{const db=diagram2.db,config=db.getConfig(),{rowHeight:rowHeight,paddingY:paddingY,bitWidth:bitWidth,bitsPerRow:bitsPerRow}=config,words=db.getPacket(),title=db.getDiagramTitle(),totalRowHeight=rowHeight+paddingY,svgHeight=totalRowHeight*(words.length+1)-(title?0:rowHeight),svgWidth=bitWidth*bitsPerRow+2,svg=selectSvgElement(id);svg.attr("viewBox",`0 0 ${svgWidth} ${svgHeight}`),configureSvgSize(svg,svgHeight,svgWidth,config.useMaxWidth);for(const[word,packet]of words.entries())drawWord(svg,packet,word,config);svg.append("text").text(title).attr("x",svgWidth/2).attr("y",svgHeight-totalRowHeight/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),drawWord=__name((svg,word,rowNumber,{rowHeight:rowHeight,paddingX:paddingX,paddingY:paddingY,bitWidth:bitWidth,bitsPerRow:bitsPerRow,showBits:showBits})=>{const group=svg.append("g"),wordY=rowNumber*(rowHeight+paddingY)+paddingY;for(const block of word){const blockX=block.start%bitsPerRow*bitWidth+1,width=(block.end-block.start+1)*bitWidth-paddingX;if(group.append("rect").attr("x",blockX).attr("y",wordY).attr("width",width).attr("height",rowHeight).attr("class","packetBlock"),group.append("text").attr("x",blockX+width/2).attr("y",wordY+rowHeight/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(block.label),!showBits)continue;const isSingleBlock=block.end===block.start,bitNumberY=wordY-2;group.append("text").attr("x",blockX+(isSingleBlock?width/2:0)).attr("y",bitNumberY).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",isSingleBlock?"middle":"start").text(block.start),isSingleBlock||group.append("text").attr("x",blockX+width).attr("y",bitNumberY).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(block.end)}},"drawWord"),renderer={draw:draw},defaultPacketStyleOptions={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},styles=__name(({packet:packet}={})=>{const options=cleanAndMerge(defaultPacketStyleOptions,packet);return`\n\t.packetByte {\n\t\tfont-size: ${options.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${options.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${options.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${options.labelColor};\n\t\tfont-size: ${options.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${options.titleColor};\n\t\tfont-size: ${options.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${options.blockStrokeColor};\n\t\tstroke-width: ${options.blockStrokeWidth};\n\t\tfill: ${options.blockFillColor};\n\t}\n\t`},"styles"),diagram={parser:parser,get db(){return new PacketDB},renderer:renderer,styles:styles};export{diagram};
@@ -1 +1 @@
1
- var _a;import{g as getDiagramElement}from"./chunk-55IACEB6-DrKr3wBa.js";import{s as setupViewPortForSVG}from"./chunk-EDXVE4YY-o_0SUbAB.js";import{_ as __name,b as setAccTitle,a as getAccTitle,s as setAccDescription,g as getAccDescription,p as setDiagramTitle,q as getDiagramTitle,c as getConfig2,l as log,y as clear,x as getEdgeId,A as rgba,B as __export,o as getRegisteredLayoutAlgorithm,r as render,d as select,u as utils_default}from"./mermaid.core-1heNIJ5f.js";import{c as channel}from"./channel-Ny3Nm_-t.js";import"./vendor-mdxeditor-BB4hhpxM.js";import"./vendor-antd-BG1SvzuN.js";import"./vendor-codemirror-8NDhydlF.js";import"./vendor-markdown-BFrYfpb0.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],$V1=[1,10],$V2=[1,11],$V3=[1,12],$V4=[1,13],$V5=[1,23],$V6=[1,24],$V7=[1,25],$V8=[1,26],$V9=[1,27],$Va=[1,19],$Vb=[1,28],$Vc=[1,29],$Vd=[1,20],$Ve=[1,18],$Vf=[1,21],$Vg=[1,22],$Vh=[1,36],$Vi=[1,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],$Vn=[1,45],$Vo=[1,46],$Vp=[1,55],$Vq=[40,48,50,51,52,70,71],$Vr=[1,66],$Vs=[1,64],$Vt=[1,61],$Vu=[1,65],$Vv=[1,67],$Vw=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],$Vx=[65,66,67,68,69],$Vy=[1,84],$Vz=[1,83],$VA=[1,81],$VB=[1,82],$VC=[6,10,42,47],$VD=[6,10,13,41,42,47,48,49],$VE=[1,92],$VF=[1,91],$VG=[1,90],$VH=[19,58],$VI=[1,101],$VJ=[1,100],$VK=[19,58,60,62],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",60:",",61:"ATTRIBUTE_KEY",62:"COMMENT",65:"ZERO_OR_ONE",66:"ZERO_OR_MORE",67:"ONE_OR_MORE",68:"ONLY_ONE",69:"MD_PARENT",70:"NON_IDENTIFYING",71:"IDENTIFYING",72:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:break;case 2:case 6:case 7:this.$=[];break;case 3:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 4:case 5:case 55:case 56:case 57:case 58:case 81:case 65:case 66:case 69:this.$=$$[$0];break;case 8:yy.addEntity($$[$0-4]),yy.addEntity($$[$0-2]),yy.addRelationship($$[$0-4],$$[$0],$$[$0-2],$$[$0-3]);break;case 9:yy.addEntity($$[$0-8]),yy.addEntity($$[$0-4]),yy.addRelationship($$[$0-8],$$[$0],$$[$0-4],$$[$0-5]),yy.setClass([$$[$0-8]],$$[$0-6]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 10:yy.addEntity($$[$0-6]),yy.addEntity($$[$0-2]),yy.addRelationship($$[$0-6],$$[$0],$$[$0-2],$$[$0-3]),yy.setClass([$$[$0-6]],$$[$0-4]);break;case 11:yy.addEntity($$[$0-6]),yy.addEntity($$[$0-4]),yy.addRelationship($$[$0-6],$$[$0],$$[$0-4],$$[$0-5]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 12:yy.addEntity($$[$0-3]),yy.addAttributes($$[$0-3],$$[$0-1]);break;case 13:yy.addEntity($$[$0-5]),yy.addAttributes($$[$0-5],$$[$0-1]),yy.setClass([$$[$0-5]],$$[$0-3]);break;case 14:yy.addEntity($$[$0-2]);break;case 15:yy.addEntity($$[$0-4]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 16:yy.addEntity($$[$0]);break;case 17:yy.addEntity($$[$0-2]),yy.setClass([$$[$0-2]],$$[$0]);break;case 18:yy.addEntity($$[$0-6],$$[$0-4]),yy.addAttributes($$[$0-6],$$[$0-1]);break;case 19:yy.addEntity($$[$0-8],$$[$0-6]),yy.addAttributes($$[$0-8],$$[$0-1]),yy.setClass([$$[$0-8]],$$[$0-3]);break;case 20:yy.addEntity($$[$0-5],$$[$0-3]);break;case 21:yy.addEntity($$[$0-7],$$[$0-5]),yy.setClass([$$[$0-7]],$$[$0-2]);break;case 22:yy.addEntity($$[$0-3],$$[$0-1]);break;case 23:yy.addEntity($$[$0-5],$$[$0-3]),yy.setClass([$$[$0-5]],$$[$0]);break;case 24:case 25:this.$=$$[$0].trim(),yy.setAccTitle(this.$);break;case 26:case 27:this.$=$$[$0].trim(),yy.setAccDescription(this.$);break;case 32:yy.setDirection("TB");break;case 33:yy.setDirection("BT");break;case 34:yy.setDirection("RL");break;case 35:yy.setDirection("LR");break;case 36:this.$=$$[$0-3],yy.addClass($$[$0-2],$$[$0-1]);break;case 37:case 38:case 59:case 67:case 43:this.$=[$$[$0]];break;case 39:case 40:this.$=$$[$0-2].concat([$$[$0]]);break;case 41:this.$=$$[$0-2],yy.setClass($$[$0-1],$$[$0]);break;case 42:this.$=$$[$0-3],yy.addCssStyles($$[$0-2],$$[$0-1]);break;case 44:case 68:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 46:this.$=$$[$0-1]+$$[$0];break;case 54:case 79:case 80:case 70:this.$=$$[$0].replace(/"/g,"");break;case 60:$$[$0].push($$[$0-1]),this.$=$$[$0];break;case 61:this.$={type:$$[$0-1],name:$$[$0]};break;case 62:this.$={type:$$[$0-2],name:$$[$0-1],keys:$$[$0]};break;case 63:this.$={type:$$[$0-2],name:$$[$0-1],comment:$$[$0]};break;case 64:this.$={type:$$[$0-3],name:$$[$0-2],keys:$$[$0-1],comment:$$[$0]};break;case 71:this.$={cardA:$$[$0],relType:$$[$0-1],cardB:$$[$0-2]};break;case 72:this.$=yy.Cardinality.ZERO_OR_ONE;break;case 73:this.$=yy.Cardinality.ZERO_OR_MORE;break;case 74:this.$=yy.Cardinality.ONE_OR_MORE;break;case 75:this.$=yy.Cardinality.ONLY_ONE;break;case 76:this.$=yy.Cardinality.MD_PARENT;break;case 77:this.$=yy.Identification.NON_IDENTIFYING;break;case 78:this.$=yy.Identification.IDENTIFYING}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,48:$Vd,50:$Ve,51:$Vf,52:$Vg},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:30,11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,48:$Vd,50:$Ve,51:$Vf,52:$Vg},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl}),{23:[1,41]},{25:[1,42]},{27:[1,43]},o($V0,[2,27]),o($V0,[2,28]),o($V0,[2,29]),o($V0,[2,30]),o($V0,[2,31]),o($Vm,[2,54]),o($Vm,[2,55]),o($Vm,[2,56]),o($Vm,[2,57]),o($Vm,[2,58]),o($V0,[2,32]),o($V0,[2,33]),o($V0,[2,34]),o($V0,[2,35]),{16:44,40:$Vn,41:$Vo},{16:47,40:$Vn,41:$Vo},{16:48,40:$Vn,41:$Vo},o($V0,[2,4]),{11:49,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{16:50,40:$Vn,41:$Vo},{18:51,19:[1,52],53:53,54:54,58:$Vp},{11:56,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{64:57,70:[1,58],71:[1,59]},o($Vq,[2,72]),o($Vq,[2,73]),o($Vq,[2,74]),o($Vq,[2,75]),o($Vq,[2,76]),o($V0,[2,24]),o($V0,[2,25]),o($V0,[2,26]),{13:$Vr,38:60,41:$Vs,42:$Vt,45:62,46:63,48:$Vu,49:$Vv},o($Vw,[2,37]),o($Vw,[2,38]),{16:68,40:$Vn,41:$Vo,42:$Vt},{13:$Vr,38:69,41:$Vs,42:$Vt,45:62,46:63,48:$Vu,49:$Vv},{13:[1,70],15:[1,71]},o($V0,[2,17],{63:35,12:72,17:[1,73],42:$Vt,65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl}),{19:[1,74]},o($V0,[2,14]),{18:75,19:[2,59],53:53,54:54,58:$Vp},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl},o($Vx,[2,77]),o($Vx,[2,78]),{6:$Vy,10:$Vz,39:80,42:$VA,47:$VB},{40:[1,85],41:[1,86]},o($VC,[2,43],{46:87,13:$Vr,41:$Vs,48:$Vu,49:$Vv}),o($VD,[2,45]),o($VD,[2,50]),o($VD,[2,51]),o($VD,[2,52]),o($VD,[2,53]),o($V0,[2,41],{42:$Vt}),{6:$Vy,10:$Vz,39:88,42:$VA,47:$VB},{14:89,40:$VE,50:$VF,72:$VG},{16:93,40:$Vn,41:$Vo},{11:94,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{18:95,19:[1,96],53:53,54:54,58:$Vp},o($V0,[2,12]),{19:[2,60]},o($VH,[2,61],{56:97,57:98,59:99,61:$VI,62:$VJ}),o([19,58,61,62],[2,66]),o($V0,[2,22],{15:[1,103],17:[1,102]}),o([40,48,50,51,52],[2,71]),o($V0,[2,36]),{13:$Vr,41:$Vs,45:104,46:63,48:$Vu,49:$Vv},o($V0,[2,47]),o($V0,[2,48]),o($V0,[2,49]),o($Vw,[2,39]),o($Vw,[2,40]),o($VD,[2,46]),o($V0,[2,42]),o($V0,[2,8]),o($V0,[2,79]),o($V0,[2,80]),o($V0,[2,81]),{13:[1,105],42:$Vt},{13:[1,107],15:[1,106]},{19:[1,108]},o($V0,[2,15]),o($VH,[2,62],{57:109,60:[1,110],62:$VJ}),o($VH,[2,63]),o($VK,[2,67]),o($VH,[2,70]),o($VK,[2,69]),{18:111,19:[1,112],53:53,54:54,58:$Vp},{16:113,40:$Vn,41:$Vo},o($VC,[2,44],{46:87,13:$Vr,41:$Vs,48:$Vu,49:$Vv}),{14:114,40:$VE,50:$VF,72:$VG},{16:115,40:$Vn,41:$Vo},{14:116,40:$VE,50:$VF,72:$VG},o($V0,[2,13]),o($VH,[2,64]),{59:117,61:$VI},{19:[1,118]},o($V0,[2,20]),o($V0,[2,23],{17:[1,119],42:$Vt}),o($V0,[2,11]),{13:[1,120],42:$Vt},o($V0,[2,10]),o($VK,[2,68]),o($V0,[2,18]),{18:121,19:[1,122],53:53,54:54,58:$Vp},{14:123,40:$VE,50:$VF,72:$VG},{19:[1,124]},o($V0,[2,21]),o($V0,[2,9]),o($V0,[2,19])],defaultActions:{55:[2,65],75:[2,60]},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:return this.begin("acc_title"),24;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),26;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:case 23:case 28:case 35:break;case 13:return 8;case 14:return 50;case 15:return 72;case 16:return 4;case 17:return this.begin("block"),17;case 18:case 19:case 38:return 49;case 20:case 37:return 42;case 21:return 15;case 22:case 36:return 13;case 24:return 61;case 25:case 26:return 58;case 27:return 62;case 29:return this.popState(),19;case 30:case 77:return yy_.yytext[0];case 31:return 20;case 32:return 21;case 33:return this.begin("style"),44;case 34:return this.popState(),10;case 39:return this.begin("style"),37;case 40:return 43;case 41:case 45:case 46:case 64:return 65;case 42:case 43:case 44:case 52:case 54:case 66:return 67;case 47:case 48:case 49:case 50:case 51:case 53:case 65:return 66;case 55:case 56:case 58:case 59:case 60:case 63:return 68;case 57:return 51;case 61:return 52;case 62:return 48;case 67:return 69;case 68:case 71:case 72:case 73:return 70;case 69:case 70:return 71;case 74:return 41;case 75:return 47;case 76:return 40;case 78:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[34,35,36,37,38,74,75],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,76,77,78],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 erDiagram_default=parser,ErDB=(__name(_a=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setAccDescription=setAccDescription,this.getAccDescription=getAccDescription,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getConfig=__name(()=>getConfig2().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}addEntity(name,alias=""){var _a2;return this.entities.has(name)?!(null==(_a2=this.entities.get(name))?void 0:_a2.alias)&&alias&&(this.entities.get(name).alias=alias,log.info(`Add alias '${alias}' to entity '${name}'`)):(this.entities.set(name,{id:`entity-${name}-${this.entities.size}`,label:name,attributes:[],alias:alias,shape:"erBox",look:getConfig2().look??"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),log.info("Added new entity :",name)),this.entities.get(name)}getEntity(name){return this.entities.get(name)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(entityName,attribs){const entity=this.addEntity(entityName);let i;for(i=attribs.length-1;i>=0;i--)attribs[i].keys||(attribs[i].keys=[]),attribs[i].comment||(attribs[i].comment=""),entity.attributes.push(attribs[i]),log.debug("Added attribute ",attribs[i].name)}addRelationship(entA,rolA,entB,rSpec){const entityA=this.entities.get(entA),entityB=this.entities.get(entB);if(!entityA||!entityB)return;const rel={entityA:entityA.id,roleA:rolA,entityB:entityB.id,relSpec:rSpec};this.relationships.push(rel),log.debug("Added new relationship :",rel)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(dir){this.direction=dir}getCompiledStyles(classDefs){let compiledStyles=[];for(const customClass of classDefs){const cssClass=this.classes.get(customClass);(null==cssClass?void 0:cssClass.styles)&&(compiledStyles=[...compiledStyles,...cssClass.styles??[]].map(s=>s.trim())),(null==cssClass?void 0:cssClass.textStyles)&&(compiledStyles=[...compiledStyles,...cssClass.textStyles??[]].map(s=>s.trim()))}return compiledStyles}addCssStyles(ids,styles){for(const id of ids){const entity=this.entities.get(id);if(!styles||!entity)return;for(const style of styles)entity.cssStyles.push(style)}}addClass(ids,style){ids.forEach(id=>{let classNode=this.classes.get(id);void 0===classNode&&(classNode={id:id,styles:[],textStyles:[]},this.classes.set(id,classNode)),style&&style.forEach(function(s){if(/color/.exec(s)){const newStyle=s.replace("fill","bgFill");classNode.textStyles.push(newStyle)}classNode.styles.push(s)})})}setClass(ids,classNames){for(const id of ids){const entity=this.entities.get(id);if(entity)for(const className of classNames)entity.cssClasses+=" "+className}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],clear()}getData(){const nodes=[],edges=[],config=getConfig2();let colorIndex=0;for(const entityKey of this.entities.keys()){const entityNode=this.entities.get(entityKey);entityNode&&(entityNode.cssCompiledStyles=this.getCompiledStyles(entityNode.cssClasses.split(" ")),entityNode.colorIndex=colorIndex++,nodes.push(entityNode))}let count=0;for(const relationship of this.relationships){const edge={id:getEdgeId(relationship.entityA,relationship.entityB,{prefix:"id",counter:count++}),type:"normal",curve:"basis",start:relationship.entityA,end:relationship.entityB,label:relationship.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:relationship.relSpec.cardB.toLowerCase(),arrowTypeEnd:relationship.relSpec.cardA.toLowerCase(),pattern:"IDENTIFYING"==relationship.relSpec.relType?"solid":"dashed",look:config.look,labelType:"markdown"};edges.push(edge)}return{nodes:nodes,edges:edges,other:{},config:config,direction:"TB"}}},"ErDB"),_a),erRenderer_unified_exports={};__export(erRenderer_unified_exports,{draw:()=>draw});var draw=__name(async function(text,id,_version,diag){log.info("REF0:"),log.info("Drawing er diagram (unified)",id);const{securityLevel:securityLevel,er:conf,layout:layout}=getConfig2(),data4Layout=diag.db.getData(),svg=getDiagramElement(id,securityLevel);data4Layout.type=diag.type,data4Layout.layoutAlgorithm=getRegisteredLayoutAlgorithm(layout),data4Layout.config.flowchart.nodeSpacing=(null==conf?void 0:conf.nodeSpacing)||140,data4Layout.config.flowchart.rankSpacing=(null==conf?void 0:conf.rankSpacing)||80,data4Layout.direction=diag.db.getDirection();const{config:config}=data4Layout,{look:look}=config;data4Layout.markers="neo"===look?["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:["only_one","zero_or_one","one_or_more","zero_or_more"],data4Layout.diagramId=id,await render(data4Layout,svg),"elk"===data4Layout.layoutAlgorithm&&svg.select(".edges").lower();const backgroundNodes=svg.selectAll('[id*="-background"]');Array.from(backgroundNodes).length>0&&backgroundNodes.each(function(){const backgroundNode=select(this),nonBackgroundId=backgroundNode.attr("id").replace("-background",""),nonBackgroundNode=svg.select(`#${CSS.escape(nonBackgroundId)}`);if(!nonBackgroundNode.empty()){const transform=nonBackgroundNode.attr("transform");backgroundNode.attr("transform",transform)}});utils_default.insertTitle(svg,"erDiagramTitleText",(null==conf?void 0:conf.titleTopMargin)??25,diag.db.getDiagramTitle()),setupViewPortForSVG(svg,8,"erDiagram",(null==conf?void 0:conf.useMaxWidth)??!0)},"draw"),fade=__name((color,opacity)=>{const channel2=channel,r=channel2(color,"r"),g=channel2(color,"g"),b=channel2(color,"b");return rgba(r,g,b,opacity)},"fade"),COLOR_THEMES=new Set(["redux-color","redux-dark-color"]),genColor=__name(options=>{const{theme:theme,look:look,bkgColorArray:bkgColorArray,borderColorArray:borderColorArray}=options;if(!COLOR_THEMES.has(theme))return"";const hasBkgColors=(null==bkgColorArray?void 0:bkgColorArray.length)>0;let sections="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)sections+=`\n\n [data-look="${look}"][data-color-id="color-${i}"].node path {\n stroke: ${borderColorArray[i]};\n ${hasBkgColors?`fill: ${bkgColorArray[i]};`:""}\n }\n\n [data-look="${look}"][data-color-id="color-${i}"].node rect {\n stroke: ${borderColorArray[i]};\n ${hasBkgColors?`fill: ${bkgColorArray[i]};`:""}\n }\n `;return sections},"genColor"),styles_default=__name(options=>{const{look:look,theme:theme,erEdgeLabelBackground:erEdgeLabelBackground,strokeWidth:strokeWidth}=options;return`\n ${genColor(options)}\n .entityBox {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n }\n\n .relationshipLabelBox {\n fill: ${options.tertiaryColor};\n opacity: 0.7;\n background-color: ${options.tertiaryColor};\n rect {\n opacity: 0.5;\n }\n }\n\n .labelBkg {\n background-color: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:fade(options.tertiaryColor,.5)};\n }\n\n .edgeLabel {\n background-color: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:options.edgeLabelBackground};\n }\n .edgeLabel .label rect {\n fill: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:options.edgeLabelBackground};\n }\n .edgeLabel .label text {\n fill: ${options.textColor};\n }\n\n .edgeLabel .label {\n fill: ${options.nodeBorder};\n font-size: 14px;\n }\n\n .label {\n font-family: ${options.fontFamily};\n color: ${options.nodeTextColor||options.textColor};\n }\n\n .edge-pattern-dashed {\n stroke-dasharray: 8,8;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon\n {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n stroke-width: ${"neo"===look?strokeWidth:"1px"};\n }\n\n .relationshipLine {\n stroke: ${options.lineColor};\n stroke-width: ${"neo"===look?strokeWidth:"1px"};\n fill: none;\n }\n\n .marker {\n fill: none !important;\n stroke: ${options.lineColor} !important;\n stroke-width: 1;\n }\n [data-look=neo].labelBkg {\n background-color: ${fade(options.tertiaryColor,.5)};\n }\n`},"getStyles"),diagram={parser:erDiagram_default,get db(){return new ErDB},renderer:erRenderer_unified_exports,styles:styles_default};export{diagram};
1
+ var _a;import{g as getDiagramElement}from"./chunk-55IACEB6-p77Qw3wN.js";import{s as setupViewPortForSVG}from"./chunk-EDXVE4YY-5qaIrQKg.js";import{_ as __name,b as setAccTitle,a as getAccTitle,s as setAccDescription,g as getAccDescription,p as setDiagramTitle,q as getDiagramTitle,c as getConfig2,l as log,y as clear,x as getEdgeId,A as rgba,B as __export,o as getRegisteredLayoutAlgorithm,r as render,d as select,u as utils_default}from"./mermaid.core-YmJi7T-s.js";import{c as channel}from"./channel-CF3zZzSR.js";import"./vendor-mdxeditor-BdKMdw6O.js";import"./vendor-antd-5xE7sz6B.js";import"./vendor-codemirror-ib-jPbXC.js";import"./vendor-markdown-BFrYfpb0.js";var parser=function(){var o=__name(function(k,v,o2,l){for(o2=o2||{},l=k.length;l--;o2[k[l]]=v);return o2},"o"),$V0=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],$V1=[1,10],$V2=[1,11],$V3=[1,12],$V4=[1,13],$V5=[1,23],$V6=[1,24],$V7=[1,25],$V8=[1,26],$V9=[1,27],$Va=[1,19],$Vb=[1,28],$Vc=[1,29],$Vd=[1,20],$Ve=[1,18],$Vf=[1,21],$Vg=[1,22],$Vh=[1,36],$Vi=[1,37],$Vj=[1,38],$Vk=[1,39],$Vl=[1,40],$Vm=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,65,66,67,68,69],$Vn=[1,45],$Vo=[1,46],$Vp=[1,55],$Vq=[40,48,50,51,52,70,71],$Vr=[1,66],$Vs=[1,64],$Vt=[1,61],$Vu=[1,65],$Vv=[1,67],$Vw=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,65,66,67,68,69],$Vx=[65,66,67,68,69],$Vy=[1,84],$Vz=[1,83],$VA=[1,81],$VB=[1,82],$VC=[6,10,42,47],$VD=[6,10,13,41,42,47,48,49],$VE=[1,92],$VF=[1,91],$VG=[1,90],$VH=[19,58],$VI=[1,101],$VJ=[1,100],$VK=[19,58,60,62],parser2={trace:__name(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,attributeKeyType:59,",":60,ATTRIBUTE_KEY:61,COMMENT:62,cardinality:63,relType:64,ZERO_OR_ONE:65,ZERO_OR_MORE:66,ONE_OR_MORE:67,ONLY_ONE:68,MD_PARENT:69,NON_IDENTIFYING:70,IDENTIFYING:71,WORD:72,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",60:",",61:"ATTRIBUTE_KEY",62:"COMMENT",65:"ZERO_OR_ONE",66:"ZERO_OR_MORE",67:"ONE_OR_MORE",68:"ONLY_ONE",69:"MD_PARENT",70:"NON_IDENTIFYING",71:"IDENTIFYING",72:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[55,1],[56,1],[56,3],[59,1],[57,1],[12,3],[63,1],[63,1],[63,1],[63,1],[63,1],[64,1],[64,1],[14,1],[14,1],[14,1]],performAction:__name(function(yytext,yyleng,yylineno,yy,yystate,$$,_$){var $0=$$.length-1;switch(yystate){case 1:break;case 2:case 6:case 7:this.$=[];break;case 3:$$[$0-1].push($$[$0]),this.$=$$[$0-1];break;case 4:case 5:case 55:case 56:case 57:case 58:case 81:case 65:case 66:case 69:this.$=$$[$0];break;case 8:yy.addEntity($$[$0-4]),yy.addEntity($$[$0-2]),yy.addRelationship($$[$0-4],$$[$0],$$[$0-2],$$[$0-3]);break;case 9:yy.addEntity($$[$0-8]),yy.addEntity($$[$0-4]),yy.addRelationship($$[$0-8],$$[$0],$$[$0-4],$$[$0-5]),yy.setClass([$$[$0-8]],$$[$0-6]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 10:yy.addEntity($$[$0-6]),yy.addEntity($$[$0-2]),yy.addRelationship($$[$0-6],$$[$0],$$[$0-2],$$[$0-3]),yy.setClass([$$[$0-6]],$$[$0-4]);break;case 11:yy.addEntity($$[$0-6]),yy.addEntity($$[$0-4]),yy.addRelationship($$[$0-6],$$[$0],$$[$0-4],$$[$0-5]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 12:yy.addEntity($$[$0-3]),yy.addAttributes($$[$0-3],$$[$0-1]);break;case 13:yy.addEntity($$[$0-5]),yy.addAttributes($$[$0-5],$$[$0-1]),yy.setClass([$$[$0-5]],$$[$0-3]);break;case 14:yy.addEntity($$[$0-2]);break;case 15:yy.addEntity($$[$0-4]),yy.setClass([$$[$0-4]],$$[$0-2]);break;case 16:yy.addEntity($$[$0]);break;case 17:yy.addEntity($$[$0-2]),yy.setClass([$$[$0-2]],$$[$0]);break;case 18:yy.addEntity($$[$0-6],$$[$0-4]),yy.addAttributes($$[$0-6],$$[$0-1]);break;case 19:yy.addEntity($$[$0-8],$$[$0-6]),yy.addAttributes($$[$0-8],$$[$0-1]),yy.setClass([$$[$0-8]],$$[$0-3]);break;case 20:yy.addEntity($$[$0-5],$$[$0-3]);break;case 21:yy.addEntity($$[$0-7],$$[$0-5]),yy.setClass([$$[$0-7]],$$[$0-2]);break;case 22:yy.addEntity($$[$0-3],$$[$0-1]);break;case 23:yy.addEntity($$[$0-5],$$[$0-3]),yy.setClass([$$[$0-5]],$$[$0]);break;case 24:case 25:this.$=$$[$0].trim(),yy.setAccTitle(this.$);break;case 26:case 27:this.$=$$[$0].trim(),yy.setAccDescription(this.$);break;case 32:yy.setDirection("TB");break;case 33:yy.setDirection("BT");break;case 34:yy.setDirection("RL");break;case 35:yy.setDirection("LR");break;case 36:this.$=$$[$0-3],yy.addClass($$[$0-2],$$[$0-1]);break;case 37:case 38:case 59:case 67:case 43:this.$=[$$[$0]];break;case 39:case 40:this.$=$$[$0-2].concat([$$[$0]]);break;case 41:this.$=$$[$0-2],yy.setClass($$[$0-1],$$[$0]);break;case 42:this.$=$$[$0-3],yy.addCssStyles($$[$0-2],$$[$0-1]);break;case 44:case 68:$$[$0-2].push($$[$0]),this.$=$$[$0-2];break;case 46:this.$=$$[$0-1]+$$[$0];break;case 54:case 79:case 80:case 70:this.$=$$[$0].replace(/"/g,"");break;case 60:$$[$0].push($$[$0-1]),this.$=$$[$0];break;case 61:this.$={type:$$[$0-1],name:$$[$0]};break;case 62:this.$={type:$$[$0-2],name:$$[$0-1],keys:$$[$0]};break;case 63:this.$={type:$$[$0-2],name:$$[$0-1],comment:$$[$0]};break;case 64:this.$={type:$$[$0-3],name:$$[$0-2],keys:$$[$0-1],comment:$$[$0]};break;case 71:this.$={cardA:$$[$0],relType:$$[$0-1],cardB:$$[$0-2]};break;case 72:this.$=yy.Cardinality.ZERO_OR_ONE;break;case 73:this.$=yy.Cardinality.ZERO_OR_MORE;break;case 74:this.$=yy.Cardinality.ONE_OR_MORE;break;case 75:this.$=yy.Cardinality.ONLY_ONE;break;case 76:this.$=yy.Cardinality.MD_PARENT;break;case 77:this.$=yy.Identification.NON_IDENTIFYING;break;case 78:this.$=yy.Identification.IDENTIFYING}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},o($V0,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,48:$Vd,50:$Ve,51:$Vf,52:$Vg},o($V0,[2,7],{1:[2,1]}),o($V0,[2,3]),{9:30,11:9,22:$V1,24:$V2,26:$V3,28:$V4,29:14,30:15,31:16,32:17,33:$V5,34:$V6,35:$V7,36:$V8,37:$V9,40:$Va,43:$Vb,44:$Vc,48:$Vd,50:$Ve,51:$Vf,52:$Vg},o($V0,[2,5]),o($V0,[2,6]),o($V0,[2,16],{12:31,63:35,15:[1,32],17:[1,33],20:[1,34],65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl}),{23:[1,41]},{25:[1,42]},{27:[1,43]},o($V0,[2,27]),o($V0,[2,28]),o($V0,[2,29]),o($V0,[2,30]),o($V0,[2,31]),o($Vm,[2,54]),o($Vm,[2,55]),o($Vm,[2,56]),o($Vm,[2,57]),o($Vm,[2,58]),o($V0,[2,32]),o($V0,[2,33]),o($V0,[2,34]),o($V0,[2,35]),{16:44,40:$Vn,41:$Vo},{16:47,40:$Vn,41:$Vo},{16:48,40:$Vn,41:$Vo},o($V0,[2,4]),{11:49,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{16:50,40:$Vn,41:$Vo},{18:51,19:[1,52],53:53,54:54,58:$Vp},{11:56,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{64:57,70:[1,58],71:[1,59]},o($Vq,[2,72]),o($Vq,[2,73]),o($Vq,[2,74]),o($Vq,[2,75]),o($Vq,[2,76]),o($V0,[2,24]),o($V0,[2,25]),o($V0,[2,26]),{13:$Vr,38:60,41:$Vs,42:$Vt,45:62,46:63,48:$Vu,49:$Vv},o($Vw,[2,37]),o($Vw,[2,38]),{16:68,40:$Vn,41:$Vo,42:$Vt},{13:$Vr,38:69,41:$Vs,42:$Vt,45:62,46:63,48:$Vu,49:$Vv},{13:[1,70],15:[1,71]},o($V0,[2,17],{63:35,12:72,17:[1,73],42:$Vt,65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl}),{19:[1,74]},o($V0,[2,14]),{18:75,19:[2,59],53:53,54:54,58:$Vp},{55:76,58:[1,77]},{58:[2,65]},{21:[1,78]},{63:79,65:$Vh,66:$Vi,67:$Vj,68:$Vk,69:$Vl},o($Vx,[2,77]),o($Vx,[2,78]),{6:$Vy,10:$Vz,39:80,42:$VA,47:$VB},{40:[1,85],41:[1,86]},o($VC,[2,43],{46:87,13:$Vr,41:$Vs,48:$Vu,49:$Vv}),o($VD,[2,45]),o($VD,[2,50]),o($VD,[2,51]),o($VD,[2,52]),o($VD,[2,53]),o($V0,[2,41],{42:$Vt}),{6:$Vy,10:$Vz,39:88,42:$VA,47:$VB},{14:89,40:$VE,50:$VF,72:$VG},{16:93,40:$Vn,41:$Vo},{11:94,40:$Va,48:$Vd,50:$Ve,51:$Vf,52:$Vg},{18:95,19:[1,96],53:53,54:54,58:$Vp},o($V0,[2,12]),{19:[2,60]},o($VH,[2,61],{56:97,57:98,59:99,61:$VI,62:$VJ}),o([19,58,61,62],[2,66]),o($V0,[2,22],{15:[1,103],17:[1,102]}),o([40,48,50,51,52],[2,71]),o($V0,[2,36]),{13:$Vr,41:$Vs,45:104,46:63,48:$Vu,49:$Vv},o($V0,[2,47]),o($V0,[2,48]),o($V0,[2,49]),o($Vw,[2,39]),o($Vw,[2,40]),o($VD,[2,46]),o($V0,[2,42]),o($V0,[2,8]),o($V0,[2,79]),o($V0,[2,80]),o($V0,[2,81]),{13:[1,105],42:$Vt},{13:[1,107],15:[1,106]},{19:[1,108]},o($V0,[2,15]),o($VH,[2,62],{57:109,60:[1,110],62:$VJ}),o($VH,[2,63]),o($VK,[2,67]),o($VH,[2,70]),o($VK,[2,69]),{18:111,19:[1,112],53:53,54:54,58:$Vp},{16:113,40:$Vn,41:$Vo},o($VC,[2,44],{46:87,13:$Vr,41:$Vs,48:$Vu,49:$Vv}),{14:114,40:$VE,50:$VF,72:$VG},{16:115,40:$Vn,41:$Vo},{14:116,40:$VE,50:$VF,72:$VG},o($V0,[2,13]),o($VH,[2,64]),{59:117,61:$VI},{19:[1,118]},o($V0,[2,20]),o($V0,[2,23],{17:[1,119],42:$Vt}),o($V0,[2,11]),{13:[1,120],42:$Vt},o($V0,[2,10]),o($VK,[2,68]),o($V0,[2,18]),{18:121,19:[1,122],53:53,54:54,58:$Vp},{14:123,40:$VE,50:$VF,72:$VG},{19:[1,124]},o($V0,[2,21]),o($V0,[2,9]),o($V0,[2,19])],defaultActions:{55:[2,65],75:[2,60]},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:return this.begin("acc_title"),24;case 1:return this.popState(),"acc_title_value";case 2:return this.begin("acc_descr"),26;case 3:return this.popState(),"acc_descr_value";case 4:this.begin("acc_descr_multiline");break;case 5:this.popState();break;case 6:return"acc_descr_multiline_value";case 7:return 33;case 8:return 34;case 9:return 35;case 10:return 36;case 11:return 10;case 12:case 23:case 28:case 35:break;case 13:return 8;case 14:return 50;case 15:return 72;case 16:return 4;case 17:return this.begin("block"),17;case 18:case 19:case 38:return 49;case 20:case 37:return 42;case 21:return 15;case 22:case 36:return 13;case 24:return 61;case 25:case 26:return 58;case 27:return 62;case 29:return this.popState(),19;case 30:case 77:return yy_.yytext[0];case 31:return 20;case 32:return 21;case 33:return this.begin("style"),44;case 34:return this.popState(),10;case 39:return this.begin("style"),37;case 40:return 43;case 41:case 45:case 46:case 64:return 65;case 42:case 43:case 44:case 52:case 54:case 66:return 67;case 47:case 48:case 49:case 50:case 51:case 53:case 65:return 66;case 55:case 56:case 58:case 59:case 60:case 63:return 68;case 57:return 51;case 61:return 52;case 62:return 48;case 67:return 69;case 68:case 71:case 72:case 73:return 70;case 69:case 70:return 71;case 74:return 41;case 75:return 47;case 76:return 40;case 78:return 6}},"anonymous"),rules:[/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:[\s]+)/i,/^(?:"[^"%\r\n\v\b\\]+")/i,/^(?:"[^"]*")/i,/^(?:erDiagram\b)/i,/^(?:\{)/i,/^(?:#)/i,/^(?:#)/i,/^(?:,)/i,/^(?::::)/i,/^(?::)/i,/^(?:\s+)/i,/^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i,/^(?:([^\s]*)[~].*[~]([^\s]*))/i,/^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i,/^(?:"[^"]*")/i,/^(?:[\n]+)/i,/^(?:\})/i,/^(?:.)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:style\b)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?::)/i,/^(?:,)/i,/^(?:#)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:one or zero\b)/i,/^(?:one or more\b)/i,/^(?:one or many\b)/i,/^(?:1\+)/i,/^(?:\|o\b)/i,/^(?:zero or one\b)/i,/^(?:zero or more\b)/i,/^(?:zero or many\b)/i,/^(?:0\+)/i,/^(?:\}o\b)/i,/^(?:many\(0\))/i,/^(?:many\(1\))/i,/^(?:many\b)/i,/^(?:\}\|)/i,/^(?:one\b)/i,/^(?:only one\b)/i,/^(?:[0-9]+\.[0-9]+)/i,/^(?:1(?=\s+[A-Za-z_"']))/i,/^(?:1(?=\s+[0-9]))/i,/^(?:1(?=(--|\.\.|\.-|-\.)))/i,/^(?:1\b)/i,/^(?:[0-9]+)/i,/^(?:\|\|)/i,/^(?:o\|)/i,/^(?:o\{)/i,/^(?:\|\{)/i,/^(?:u(?=[\.\-\|]))/i,/^(?:\.\.)/i,/^(?:--)/i,/^(?:to\b)/i,/^(?:optionally to\b)/i,/^(?:\.-)/i,/^(?:-\.)/i,/^(?:([^\x00-\x7F]|\w|-|\*)+)/i,/^(?:;)/i,/^(?:([^\x00-\x7F]|\w|-|\*|\.)+)/i,/^(?:.)/i,/^(?:$)/i],conditions:{style:{rules:[34,35,36,37,38,74,75],inclusive:!1},acc_descr_multiline:{rules:[5,6],inclusive:!1},acc_descr:{rules:[3],inclusive:!1},acc_title:{rules:[1],inclusive:!1},block:{rules:[23,24,25,26,27,28,29,30],inclusive:!1},INITIAL:{rules:[0,2,4,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,31,32,33,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,76,77,78],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 erDiagram_default=parser,ErDB=(__name(_a=class{constructor(){this.entities=new Map,this.relationships=[],this.classes=new Map,this.direction="TB",this.Cardinality={ZERO_OR_ONE:"ZERO_OR_ONE",ZERO_OR_MORE:"ZERO_OR_MORE",ONE_OR_MORE:"ONE_OR_MORE",ONLY_ONE:"ONLY_ONE",MD_PARENT:"MD_PARENT"},this.Identification={NON_IDENTIFYING:"NON_IDENTIFYING",IDENTIFYING:"IDENTIFYING"},this.setAccTitle=setAccTitle,this.getAccTitle=getAccTitle,this.setAccDescription=setAccDescription,this.getAccDescription=getAccDescription,this.setDiagramTitle=setDiagramTitle,this.getDiagramTitle=getDiagramTitle,this.getConfig=__name(()=>getConfig2().er,"getConfig"),this.clear(),this.addEntity=this.addEntity.bind(this),this.addAttributes=this.addAttributes.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setDirection=this.setDirection.bind(this),this.addCssStyles=this.addCssStyles.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}addEntity(name,alias=""){var _a2;return this.entities.has(name)?!(null==(_a2=this.entities.get(name))?void 0:_a2.alias)&&alias&&(this.entities.get(name).alias=alias,log.info(`Add alias '${alias}' to entity '${name}'`)):(this.entities.set(name,{id:`entity-${name}-${this.entities.size}`,label:name,attributes:[],alias:alias,shape:"erBox",look:getConfig2().look??"default",cssClasses:"default",cssStyles:[],labelType:"markdown"}),log.info("Added new entity :",name)),this.entities.get(name)}getEntity(name){return this.entities.get(name)}getEntities(){return this.entities}getClasses(){return this.classes}addAttributes(entityName,attribs){const entity=this.addEntity(entityName);let i;for(i=attribs.length-1;i>=0;i--)attribs[i].keys||(attribs[i].keys=[]),attribs[i].comment||(attribs[i].comment=""),entity.attributes.push(attribs[i]),log.debug("Added attribute ",attribs[i].name)}addRelationship(entA,rolA,entB,rSpec){const entityA=this.entities.get(entA),entityB=this.entities.get(entB);if(!entityA||!entityB)return;const rel={entityA:entityA.id,roleA:rolA,entityB:entityB.id,relSpec:rSpec};this.relationships.push(rel),log.debug("Added new relationship :",rel)}getRelationships(){return this.relationships}getDirection(){return this.direction}setDirection(dir){this.direction=dir}getCompiledStyles(classDefs){let compiledStyles=[];for(const customClass of classDefs){const cssClass=this.classes.get(customClass);(null==cssClass?void 0:cssClass.styles)&&(compiledStyles=[...compiledStyles,...cssClass.styles??[]].map(s=>s.trim())),(null==cssClass?void 0:cssClass.textStyles)&&(compiledStyles=[...compiledStyles,...cssClass.textStyles??[]].map(s=>s.trim()))}return compiledStyles}addCssStyles(ids,styles){for(const id of ids){const entity=this.entities.get(id);if(!styles||!entity)return;for(const style of styles)entity.cssStyles.push(style)}}addClass(ids,style){ids.forEach(id=>{let classNode=this.classes.get(id);void 0===classNode&&(classNode={id:id,styles:[],textStyles:[]},this.classes.set(id,classNode)),style&&style.forEach(function(s){if(/color/.exec(s)){const newStyle=s.replace("fill","bgFill");classNode.textStyles.push(newStyle)}classNode.styles.push(s)})})}setClass(ids,classNames){for(const id of ids){const entity=this.entities.get(id);if(entity)for(const className of classNames)entity.cssClasses+=" "+className}}clear(){this.entities=new Map,this.classes=new Map,this.relationships=[],clear()}getData(){const nodes=[],edges=[],config=getConfig2();let colorIndex=0;for(const entityKey of this.entities.keys()){const entityNode=this.entities.get(entityKey);entityNode&&(entityNode.cssCompiledStyles=this.getCompiledStyles(entityNode.cssClasses.split(" ")),entityNode.colorIndex=colorIndex++,nodes.push(entityNode))}let count=0;for(const relationship of this.relationships){const edge={id:getEdgeId(relationship.entityA,relationship.entityB,{prefix:"id",counter:count++}),type:"normal",curve:"basis",start:relationship.entityA,end:relationship.entityB,label:relationship.roleA,labelpos:"c",thickness:"normal",classes:"relationshipLine",arrowTypeStart:relationship.relSpec.cardB.toLowerCase(),arrowTypeEnd:relationship.relSpec.cardA.toLowerCase(),pattern:"IDENTIFYING"==relationship.relSpec.relType?"solid":"dashed",look:config.look,labelType:"markdown"};edges.push(edge)}return{nodes:nodes,edges:edges,other:{},config:config,direction:"TB"}}},"ErDB"),_a),erRenderer_unified_exports={};__export(erRenderer_unified_exports,{draw:()=>draw});var draw=__name(async function(text,id,_version,diag){log.info("REF0:"),log.info("Drawing er diagram (unified)",id);const{securityLevel:securityLevel,er:conf,layout:layout}=getConfig2(),data4Layout=diag.db.getData(),svg=getDiagramElement(id,securityLevel);data4Layout.type=diag.type,data4Layout.layoutAlgorithm=getRegisteredLayoutAlgorithm(layout),data4Layout.config.flowchart.nodeSpacing=(null==conf?void 0:conf.nodeSpacing)||140,data4Layout.config.flowchart.rankSpacing=(null==conf?void 0:conf.rankSpacing)||80,data4Layout.direction=diag.db.getDirection();const{config:config}=data4Layout,{look:look}=config;data4Layout.markers="neo"===look?["only_one_neo","zero_or_one_neo","one_or_more_neo","zero_or_more_neo"]:["only_one","zero_or_one","one_or_more","zero_or_more"],data4Layout.diagramId=id,await render(data4Layout,svg),"elk"===data4Layout.layoutAlgorithm&&svg.select(".edges").lower();const backgroundNodes=svg.selectAll('[id*="-background"]');Array.from(backgroundNodes).length>0&&backgroundNodes.each(function(){const backgroundNode=select(this),nonBackgroundId=backgroundNode.attr("id").replace("-background",""),nonBackgroundNode=svg.select(`#${CSS.escape(nonBackgroundId)}`);if(!nonBackgroundNode.empty()){const transform=nonBackgroundNode.attr("transform");backgroundNode.attr("transform",transform)}});utils_default.insertTitle(svg,"erDiagramTitleText",(null==conf?void 0:conf.titleTopMargin)??25,diag.db.getDiagramTitle()),setupViewPortForSVG(svg,8,"erDiagram",(null==conf?void 0:conf.useMaxWidth)??!0)},"draw"),fade=__name((color,opacity)=>{const channel2=channel,r=channel2(color,"r"),g=channel2(color,"g"),b=channel2(color,"b");return rgba(r,g,b,opacity)},"fade"),COLOR_THEMES=new Set(["redux-color","redux-dark-color"]),genColor=__name(options=>{const{theme:theme,look:look,bkgColorArray:bkgColorArray,borderColorArray:borderColorArray}=options;if(!COLOR_THEMES.has(theme))return"";const hasBkgColors=(null==bkgColorArray?void 0:bkgColorArray.length)>0;let sections="";for(let i=0;i<options.THEME_COLOR_LIMIT;i++)sections+=`\n\n [data-look="${look}"][data-color-id="color-${i}"].node path {\n stroke: ${borderColorArray[i]};\n ${hasBkgColors?`fill: ${bkgColorArray[i]};`:""}\n }\n\n [data-look="${look}"][data-color-id="color-${i}"].node rect {\n stroke: ${borderColorArray[i]};\n ${hasBkgColors?`fill: ${bkgColorArray[i]};`:""}\n }\n `;return sections},"genColor"),styles_default=__name(options=>{const{look:look,theme:theme,erEdgeLabelBackground:erEdgeLabelBackground,strokeWidth:strokeWidth}=options;return`\n ${genColor(options)}\n .entityBox {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n }\n\n .relationshipLabelBox {\n fill: ${options.tertiaryColor};\n opacity: 0.7;\n background-color: ${options.tertiaryColor};\n rect {\n opacity: 0.5;\n }\n }\n\n .labelBkg {\n background-color: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:fade(options.tertiaryColor,.5)};\n }\n\n .edgeLabel {\n background-color: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:options.edgeLabelBackground};\n }\n .edgeLabel .label rect {\n fill: ${COLOR_THEMES.has(theme)&&erEdgeLabelBackground?erEdgeLabelBackground:options.edgeLabelBackground};\n }\n .edgeLabel .label text {\n fill: ${options.textColor};\n }\n\n .edgeLabel .label {\n fill: ${options.nodeBorder};\n font-size: 14px;\n }\n\n .label {\n font-family: ${options.fontFamily};\n color: ${options.nodeTextColor||options.textColor};\n }\n\n .edge-pattern-dashed {\n stroke-dasharray: 8,8;\n }\n\n .node rect,\n .node circle,\n .node ellipse,\n .node polygon\n {\n fill: ${options.mainBkg};\n stroke: ${options.nodeBorder};\n stroke-width: ${"neo"===look?strokeWidth:"1px"};\n }\n\n .relationshipLine {\n stroke: ${options.lineColor};\n stroke-width: ${"neo"===look?strokeWidth:"1px"};\n fill: none;\n }\n\n .marker {\n fill: none !important;\n stroke: ${options.lineColor} !important;\n stroke-width: 1;\n }\n [data-look=neo].labelBkg {\n background-color: ${fade(options.tertiaryColor,.5)};\n }\n`},"getStyles"),diagram={parser:erDiagram_default,get db(){return new ErDB},renderer:erRenderer_unified_exports,styles:styles_default};export{diagram};