docusaurus/assets/js/97027.99518f5f.js
2024-08-29 14:32:18 +00:00

1 line
No EOL
11 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[97027],{46591:(e,t,n)=>{n.d(t,{M:()=>a});var r=n(31454),i=n(24359),l=n(23480);function a(e){var t,n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:l.A(e.nodes(),function(t){var n=e.node(t),i=e.parent(t),l={v:t};return r.A(n)||(l.value=n),r.A(i)||(l.parent=i),l}),edges:l.A(e.edges(),function(t){var n=e.edge(t),i={v:t.v,w:t.w};return r.A(t.name)||(i.name=t.name),r.A(n)||(i.value=n),i})};return r.A(e.graph())||(n.value=(t=e.graph(),(0,i.A)(t,4))),n}n(47740)},97027:(e,t,n)=>{n.d(t,{r:()=>B});var r=n(51822),i=n(46591),l=n(24053),a=n(17367),d=n(62499),o=n(11336),s=n(93126);let h={},g={},c={},f=()=>{g={},c={},h={}},u=(e,t)=>(a.l.trace("In isDecendant",t," ",e," = ",g[t].includes(e)),!!g[t].includes(e)),w=(e,t)=>(a.l.info("Decendants of ",t," is ",g[t]),a.l.info("Edge is ",e),e.v!==t&&e.w!==t&&(g[t]?g[t].includes(e.v)||u(e.v,t)||u(e.w,t)||g[t].includes(e.w):(a.l.debug("Tilt, ",t,",not in decendants"),!1))),p=(e,t,n,r)=>{a.l.warn("Copying children of ",e,"root",r,"data",t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),a.l.warn("Copying (nodes) clusterId",e,"nodes",i),i.forEach(i=>{if(t.children(i).length>0)p(i,t,n,r);else{let l=t.node(i);a.l.info("cp ",i," to ",r," with parent ",e),n.setNode(i,l),r!==t.parent(i)&&(a.l.warn("Setting parent",i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(a.l.debug("Setting parent",i,e),n.setParent(i,e)):(a.l.info("In copy ",e,"root",r,"data",t.node(e),r),a.l.debug("Not Setting parent for node=",i,"cluster!==rootId",e!==r,"node!==clusterId",i!==e));let d=t.edges(i);a.l.debug("Copying Edges",d),d.forEach(i=>{a.l.info("Edge",i);let l=t.edge(i.v,i.w,i.name);a.l.info("Edge data",l,r);try{w(i,r)?(a.l.info("Copying as ",i.v,i.w,l,i.name),n.setEdge(i.v,i.w,l,i.name),a.l.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):a.l.info("Skipping copy of edge ",i.v,"-->",i.w," rootId: ",r," clusterId:",e)}catch(e){a.l.error(e)}})}a.l.debug("Removing node",i),t.removeNode(i)})},v=(e,t)=>{let n=t.children(e),r=[...n];for(let i of n)c[i]=e,r=[...r,...v(i,t)];return r},y=(e,t)=>{a.l.trace("Searching",e);let n=t.children(e);if(a.l.trace("Searching children of id ",e,n),n.length<1)return a.l.trace("This is a valid node",e),e;for(let r of n){let n=y(r,t);if(n)return a.l.trace("Found replacement for",e," => ",n),n}},x=e=>h[e]&&h[e].externalConnections&&h[e]?h[e].id:e,b=(e,t)=>{if(!e||t>10){a.l.debug("Opting out, no graph ");return}a.l.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(a.l.warn("Cluster identified",t," Replacement id in edges: ",y(t,e)),g[t]=v(t,e),h[t]={id:y(t,e),clusterData:e.node(t)})}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(a.l.debug("Cluster identified",t,g),r.forEach(e=>{e.v!==t&&e.w!==t&&u(e.v,t)^u(e.w,t)&&(a.l.warn("Edge: ",e," leaves cluster ",t),a.l.warn("Decendants of XXX ",t,": ",g[t]),h[t].externalConnections=!0)})):a.l.debug("Not a cluster ",t,g)}),e.edges().forEach(function(t){let n=e.edge(t);a.l.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),a.l.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(a.l.warn("Fix XXX",h,"ids:",t.v,t.w,"Translating: ",h[t.v]," --- ",h[t.w]),h[t.v]&&h[t.w]&&h[t.v]===h[t.w]){a.l.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),a.l.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),r=x(t.v),i=x(t.w),e.removeEdge(t.v,t.w,t.name);let l=t.w+"---"+t.v;e.setNode(l,{domId:l,id:l,labelStyle:"",labelText:n.label,padding:0,shape:"labelRect",style:""});let d=JSON.parse(JSON.stringify(n)),o=JSON.parse(JSON.stringify(n));d.label="",d.arrowTypeEnd="none",o.label="",d.fromCluster=t.v,o.toCluster=t.v,e.setEdge(r,l,d,t.name+"-cyclic-special"),e.setEdge(l,i,o,t.name+"-cyclic-special")}else(h[t.v]||h[t.w])&&(a.l.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),r=x(t.v),i=x(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v&&(n.fromCluster=t.v),i!==t.w&&(n.toCluster=t.w),a.l.warn("Fix Replacing with XXX",r,i,t.name),e.setEdge(r,i,n,t.name))}),a.l.warn("Adjusted Graph",i.M(e)),m(e,0),a.l.trace(h)},m=(e,t)=>{if(a.l.warn("extractor - ",t,i.M(e),e.children("D")),t>10){a.l.error("Bailing out");return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r=r||n.length>0}if(!r){a.l.debug("Done, no node has children",e.nodes());return}for(let r of(a.l.debug("Nodes = ",n,t),n))if(a.l.debug("Extracting node",r,h,h[r]&&!h[r].externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",t),h[r]){if(!h[r].externalConnections&&e.children(r)&&e.children(r).length>0){a.l.warn("Cluster without external connections, without a parent and with children",r,t);let n="TB"===e.graph().rankdir?"LR":"TB";h[r]&&h[r].clusterData&&h[r].clusterData.dir&&(n=h[r].clusterData.dir,a.l.warn("Fixing dir",h[r].clusterData.dir,n));let l=new d.T({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});a.l.warn("Old graph before copy",i.M(e)),p(r,e,l,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:h[r].clusterData,labelText:h[r].labelText,graph:l}),a.l.warn("New graph after copy node: (",r,")",i.M(l)),a.l.debug("Old graph after copy",i.M(e))}else a.l.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!h[r].externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),t),a.l.debug(h)}else a.l.debug("Not a cluster",r,t);for(let r of(n=e.nodes(),a.l.warn("New list of nodes",n),n)){let n=e.node(r);a.l.warn(" Now next level",r,n),n.clusterNode&&m(n.graph,t+1)}},N=(e,t)=>{if(0===t.length)return[];let n=Object.assign(t);return t.forEach(t=>{let r=e.children(t),i=N(e,r);n=[...n,...i]}),n},X=e=>N(e,e.children()),E={rect:(e,t)=>{a.l.info("Creating subgraph rect for ",t.id,t);let n=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),r=n.insert("rect",":first-child"),i=(0,a.n)((0,a.c)().flowchart.htmlLabels),d=n.insert("g").attr("class","cluster-label"),h="markdown"===t.labelType?(0,o.c)(d,t.labelText,{style:t.labelStyle,useHtmlLabels:i}):d.node().appendChild((0,l.c)(t.labelText,t.labelStyle,void 0,!0)),g=h.getBBox();if((0,a.n)((0,a.c)().flowchart.htmlLabels)){let e=h.children[0],t=(0,s.Ltv)(h);g=e.getBoundingClientRect(),t.attr("width",g.width),t.attr("height",g.height)}let c=0*t.padding,f=t.width<=g.width+c?g.width+c:t.width;t.width<=g.width+c?t.diff=(g.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,a.l.trace("Data ",t,JSON.stringify(t)),r.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-f/2).attr("y",t.y-t.height/2-c/2).attr("width",f).attr("height",t.height+c),i?d.attr("transform","translate("+(t.x-g.width/2)+", "+(t.y-t.height/2)+")"):d.attr("transform","translate("+t.x+", "+(t.y-t.height/2)+")");let u=r.node().getBBox();return t.width=u.width,t.height=u.height,t.intersect=function(e){return(0,l.i)(t,e)},n},roundedWithTitle:(e,t)=>{let n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=n.insert("g").attr("class","cluster-label"),d=n.append("rect"),o=i.node().appendChild((0,l.c)(t.labelText,t.labelStyle,void 0,!0)),h=o.getBBox();if((0,a.n)((0,a.c)().flowchart.htmlLabels)){let e=o.children[0],t=(0,s.Ltv)(o);h=e.getBoundingClientRect(),t.attr("width",h.width),t.attr("height",h.height)}h=o.getBBox();let g=0*t.padding,c=g/2,f=t.width<=h.width+t.padding?h.width+t.padding:t.width;t.width<=h.width+t.padding?t.diff=(h.width+0*t.padding-t.width)/2:t.diff=-t.padding/2,r.attr("class","outer").attr("x",t.x-f/2-c).attr("y",t.y-t.height/2-c).attr("width",f+g).attr("height",t.height+g),d.attr("class","inner").attr("x",t.x-f/2-c).attr("y",t.y-t.height/2-c+h.height-1).attr("width",f+g).attr("height",t.height+g-h.height-3),i.attr("transform","translate("+(t.x-h.width/2)+", "+(t.y-t.height/2-t.padding/3+((0,a.n)((0,a.c)().flowchart.htmlLabels)?5:3))+")");let u=r.node().getBBox();return t.height=u.height,t.intersect=function(e){return(0,l.i)(t,e)},n},noteGroup:(e,t)=>{let n=e.insert("g").attr("class","note-cluster").attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding,a=i/2;r.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-a).attr("y",t.y-t.height/2-a).attr("width",t.width+i).attr("height",t.height+i).attr("fill","none");let d=r.node().getBBox();return t.width=d.width,t.height=d.height,t.intersect=function(e){return(0,l.i)(t,e)},n},divider:(e,t)=>{let n=e.insert("g").attr("class",t.classes).attr("id",t.id),r=n.insert("rect",":first-child"),i=0*t.padding;r.attr("class","divider").attr("x",t.x-t.width/2-i/2).attr("y",t.y-t.height/2).attr("width",t.width+i).attr("height",t.height+i);let a=r.node().getBBox();return t.width=a.width,t.height=a.height,t.diff=-t.padding/2,t.intersect=function(e){return(0,l.i)(t,e)},n}},C={},S=(e,t)=>{a.l.trace("Inserting cluster");let n=t.shape||"rect";C[t.id]=E[n](e,t)},D=()=>{C={}},O=async(e,t,n,d)=>{a.l.info("Graph in recursive render: XXX",i.M(t),d);let o=t.graph().rankdir;a.l.trace("Dir in recursive render - dir:",o);let s=e.insert("g").attr("class","root");t.nodes()?a.l.info("Recursive render XXX",t.nodes()):a.l.info("No nodes found for",t),t.edges().length>0&&a.l.trace("Recursive edges",t.edge(t.edges()[0]));let g=s.insert("g").attr("class","clusters"),c=s.insert("g").attr("class","edgePaths"),f=s.insert("g").attr("class","edgeLabels"),u=s.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(e){let r=t.node(e);if(void 0!==d){let n=JSON.parse(JSON.stringify(d.clusterData));a.l.info("Setting data for cluster XXX (",e,") ",n,d),t.setNode(d.id,n),t.parent(e)||(a.l.trace("Setting parent",e,d.id),t.setParent(e,d.id,n))}if(a.l.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),r&&r.clusterNode){a.l.info("Cluster identified",e,r.width,t.node(e));let i=await O(u,r.graph,n,t.node(e)),d=i.elem;(0,l.u)(r,d),r.diff=i.diff||0,a.l.info("Node bounds (abc123)",e,r,r.width,r.x,r.y),(0,l.s)(d,r),a.l.warn("Recursive render complete ",d,r)}else t.children(e).length>0?(a.l.info("Cluster - the non recursive path XXX",e,r.id,r,t),a.l.info(y(r.id,t)),h[r.id]={id:y(r.id,t),node:r}):(a.l.info("Node - the non recursive path",e,r.id,r),await (0,l.e)(u,t.node(e),o))})),t.edges().forEach(function(e){let n=t.edge(e.v,e.w,e.name);a.l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),a.l.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),a.l.info("Fix",h,"ids:",e.v,e.w,"Translateing: ",h[e.v],h[e.w]),(0,l.f)(f,n)}),t.edges().forEach(function(e){a.l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e))}),a.l.info("#############################################"),a.l.info("### Layout ###"),a.l.info("#############################################"),a.l.info(t),(0,r.Zp)(t),a.l.info("Graph after layout:",i.M(t));let w=0;return X(t).forEach(function(e){let n=t.node(e);a.l.info("Position "+e+": "+JSON.stringify(t.node(e))),a.l.info("Position "+e+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n&&n.clusterNode?(0,l.p)(n):t.children(e).length>0?(S(g,n),h[n.id].node=n):(0,l.p)(n)}),t.edges().forEach(function(e){let r=t.edge(e);a.l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(r),r);let i=(0,l.g)(c,e,r,h,n,t);(0,l.h)(r,i)}),t.nodes().forEach(function(e){let n=t.node(e);a.l.info(e,n.type,n.diff),"group"===n.type&&(w=n.diff)}),{elem:s,diff:w}},B=async(e,t,n,r,d)=>{(0,l.a)(e,n,r,d),(0,l.b)(),(0,l.d)(),D(),f(),a.l.warn("Graph at first:",i.M(t)),b(t),a.l.warn("Graph after:",i.M(t)),await O(e,t,r)}}}]);