mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-31 18:07:00 +02:00
1 line
No EOL
17 KiB
JavaScript
1 line
No EOL
17 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[94228],{35141:(e,t,n)=>{n.d(t,{M:()=>d});var i=n(31454),r=n(86847),a=n(23480);function d(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:a.A(e.nodes(),function(t){var n=e.node(t),r=e.parent(t),a={v:t};return i.A(n)||(a.value=n),i.A(r)||(a.parent=r),a}),edges:a.A(e.edges(),function(t){var n=e.edge(t),r={v:t.v,w:t.w};return i.A(t.name)||(r.name=t.name),i.A(n)||(r.value=n),r})};return i.A(e.graph())||(t.value=r.A(e.graph())),t}n(3735)},94228:(e,t,n)=>{n.d(t,{diagram:()=>j});var i=n(92834),r=n(30102),a=n(82648),d=n(16470),l=n(27923),o=n(67027),s=n(72912),c=n(89601),h=n(62499),g=n(62628),f=n(35141),u={},p={},m={},w=(0,s.K2)(()=>{p={},m={},u={}},"clear"),y=(0,s.K2)((e,t)=>(s.Rm.trace("In isDescendant",t," ",e," = ",p[t].includes(e)),!!p[t].includes(e)),"isDescendant"),R=(0,s.K2)((e,t)=>(s.Rm.info("Descendants of ",t," is ",p[t]),s.Rm.info("Edge is ",e),e.v!==t&&e.w!==t&&(p[t]?p[t].includes(e.v)||y(e.v,t)||y(e.w,t)||p[t].includes(e.w):(s.Rm.debug("Tilt, ",t,",not in descendants"),!1))),"edgeInCluster"),b=(0,s.K2)((e,t,n,i)=>{s.Rm.warn("Copying children of ",e,"root",i,"data",t.node(e),i);let r=t.children(e)||[];e!==i&&r.push(e),s.Rm.warn("Copying (nodes) clusterId",e,"nodes",r),r.forEach(r=>{if(t.children(r).length>0)b(r,t,n,i);else{let a=t.node(r);s.Rm.info("cp ",r," to ",i," with parent ",e),n.setNode(r,a),i!==t.parent(r)&&(s.Rm.warn("Setting parent",r,t.parent(r)),n.setParent(r,t.parent(r))),e!==i&&r!==e?(s.Rm.debug("Setting parent",r,e),n.setParent(r,e)):(s.Rm.info("In copy ",e,"root",i,"data",t.node(e),i),s.Rm.debug("Not Setting parent for node=",r,"cluster!==rootId",e!==i,"node!==clusterId",r!==e));let d=t.edges(r);s.Rm.debug("Copying Edges",d),d.forEach(r=>{s.Rm.info("Edge",r);let a=t.edge(r.v,r.w,r.name);s.Rm.info("Edge data",a,i);try{R(r,i)?(s.Rm.info("Copying as ",r.v,r.w,a,r.name),n.setEdge(r.v,r.w,a,r.name),s.Rm.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):s.Rm.info("Skipping copy of edge ",r.v,"-->",r.w," rootId: ",i," clusterId:",e)}catch(e){s.Rm.error(e)}})}s.Rm.debug("Removing node",r),t.removeNode(r)})},"copy"),v=(0,s.K2)((e,t)=>{let n=t.children(e),i=[...n];for(let r of n)m[r]=e,i=[...i,...v(r,t)];return i},"extractDescendants"),x=(0,s.K2)((e,t)=>{s.Rm.trace("Searching",e);let n=t.children(e);if(s.Rm.trace("Searching children of id ",e,n),n.length<1)return s.Rm.trace("This is a valid node",e),e;for(let i of n){let n=x(i,t);if(n)return s.Rm.trace("Found replacement for",e," => ",n),n}},"findNonClusterChild"),N=(0,s.K2)(e=>u[e]&&u[e].externalConnections&&u[e]?u[e].id:e,"getAnchorId"),D=(0,s.K2)((e,t)=>{if(!e||t>10){s.Rm.debug("Opting out, no graph ");return}for(let t of(s.Rm.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(s.Rm.warn("Cluster identified",t," Replacement id in edges: ",x(t,e)),p[t]=v(t,e),u[t]={id:x(t,e),clusterData:e.node(t)})}),e.nodes().forEach(function(t){let n=e.children(t),i=e.edges();n.length>0?(s.Rm.debug("Cluster identified",t,p),i.forEach(e=>{e.v!==t&&e.w!==t&&y(e.v,t)^y(e.w,t)&&(s.Rm.warn("Edge: ",e," leaves cluster ",t),s.Rm.warn("Descendants of XXX ",t,": ",p[t]),u[t].externalConnections=!0)})):s.Rm.debug("Not a cluster ",t,p)}),Object.keys(u))){let n=u[t].id,i=e.parent(n);i!==t&&u[i]&&!u[i].externalConnections&&(u[t].id=i)}e.edges().forEach(function(t){let n=e.edge(t);s.Rm.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),s.Rm.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let i=t.v,r=t.w;if(s.Rm.warn("Fix XXX",u,"ids:",t.v,t.w,"Translating: ",u[t.v]," --- ",u[t.w]),u[t.v]&&u[t.w]&&u[t.v]===u[t.w]){s.Rm.warn("Fixing and trixing link to self - removing XXX",t.v,t.w,t.name),s.Rm.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),i=N(t.v),r=N(t.w),e.removeEdge(t.v,t.w,t.name);let a=t.w+"---"+t.v;e.setNode(a,{domId:a,id:a,labelStyle:"",labelText:n.label,padding:0,shape:"labelRect",style:""});let d=structuredClone(n),l=structuredClone(n);d.label="",d.arrowTypeEnd="none",l.label="",d.fromCluster=t.v,l.toCluster=t.v,e.setEdge(i,a,d,t.name+"-cyclic-special"),e.setEdge(a,r,l,t.name+"-cyclic-special")}else(u[t.v]||u[t.w])&&(s.Rm.warn("Fixing and trixing - removing XXX",t.v,t.w,t.name),i=N(t.v),r=N(t.w),e.removeEdge(t.v,t.w,t.name),i!==t.v&&(u[e.parent(i)].externalConnections=!0,n.fromCluster=t.v),r!==t.w&&(u[e.parent(r)].externalConnections=!0,n.toCluster=t.w),s.Rm.warn("Fix Replacing with XXX",i,r,t.name),e.setEdge(i,r,n,t.name))}),s.Rm.warn("Adjusted Graph",f.M(e)),C(e,0),s.Rm.trace(u)},"adjustClustersAndEdges"),C=(0,s.K2)((e,t)=>{if(s.Rm.warn("extractor - ",t,f.M(e),e.children("D")),t>10){s.Rm.error("Bailing out");return}let n=e.nodes(),i=!1;for(let t of n){let n=e.children(t);i=i||n.length>0}if(!i){s.Rm.debug("Done, no node has children",e.nodes());return}for(let i of(s.Rm.debug("Nodes = ",n,t),n))if(s.Rm.debug("Extracting node",i,u,u[i]&&!u[i].externalConnections,!e.parent(i),e.node(i),e.children("D")," Depth ",t),u[i]){if(!u[i].externalConnections&&e.children(i)&&e.children(i).length>0){s.Rm.warn("Cluster without external connections, without a parent and with children",i,t);let n="TB"===e.graph().rankdir?"LR":"TB";u[i]?.clusterData?.dir&&(n=u[i].clusterData.dir,s.Rm.warn("Fixing dir",u[i].clusterData.dir,n));let r=new h.T({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});s.Rm.warn("Old graph before copy",f.M(e)),b(i,e,r,i),e.setNode(i,{clusterNode:!0,id:i,clusterData:u[i].clusterData,labelText:u[i].labelText,graph:r}),s.Rm.warn("New graph after copy node: (",i,")",f.M(r)),s.Rm.debug("Old graph after copy",f.M(e))}else s.Rm.warn("Cluster ** ",i," **not meeting the criteria !externalConnections:",!u[i].externalConnections," no parent: ",!e.parent(i)," children ",e.children(i)&&e.children(i).length>0,e.children("D"),t),s.Rm.debug(u)}else s.Rm.debug("Not a cluster",i,t);for(let i of(n=e.nodes(),s.Rm.warn("New list of nodes",n),n)){let n=e.node(i);s.Rm.warn(" Now next level",i,n),n.clusterNode&&C(n.graph,t+1)}},"extractor"),S=(0,s.K2)((e,t)=>{if(0===t.length)return[];let n=Object.assign(t);return t.forEach(t=>{let i=e.children(t),r=S(e,i);n=[...n,...r]}),n},"sorter"),E=(0,s.K2)(e=>S(e,e.children()),"sortNodesByHierarchy"),T=(0,s.K2)((e,t)=>{s.Rm.info("Creating subgraph rect for ",t.id,t);let n=(0,s.D7)(),i=e.insert("g").attr("class","cluster"+(t.class?" "+t.class:"")).attr("id",t.id),r=i.insert("rect",":first-child"),o=(0,s._3)(n.flowchart.htmlLabels),h=i.insert("g").attr("class","cluster-label"),g="markdown"===t.labelType?(0,l.GZ)(h,t.labelText,{style:t.labelStyle,useHtmlLabels:o},n):h.node().appendChild((0,a.DA)(t.labelText,t.labelStyle,void 0,!0)),f=g.getBBox();if((0,s._3)(n.flowchart.htmlLabels)){let e=g.children[0],t=(0,c.Ltv)(g);f=e.getBoundingClientRect(),t.attr("width",f.width),t.attr("height",f.height)}let u=0*t.padding,p=t.width<=f.width+u?f.width+u:t.width;t.width<=f.width+u?t.diff=(f.width-t.width)/2-t.padding/2:t.diff=-t.padding/2,s.Rm.trace("Data ",t,JSON.stringify(t)),r.attr("style",t.style).attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-p/2).attr("y",t.y-t.height/2-u/2).attr("width",p).attr("height",t.height+u);let{subGraphTitleTopMargin:m}=(0,d.O)(n);o?h.attr("transform",`translate(${t.x-f.width/2}, ${t.y-t.height/2+m})`):h.attr("transform",`translate(${t.x}, ${t.y-t.height/2+m})`);let w=r.node().getBBox();return t.width=w.width,t.height=w.height,t.intersect=function(e){return(0,a.nM)(t,e)},i},"rect"),k=(0,s.K2)((e,t)=>{let n=e.insert("g").attr("class","note-cluster").attr("id",t.id),i=n.insert("rect",":first-child"),r=0*t.padding,d=r/2;i.attr("rx",t.rx).attr("ry",t.ry).attr("x",t.x-t.width/2-d).attr("y",t.y-t.height/2-d).attr("width",t.width+r).attr("height",t.height+r).attr("fill","none");let l=i.node().getBBox();return t.width=l.width,t.height=l.height,t.intersect=function(e){return(0,a.nM)(t,e)},n},"noteGroup"),X={rect:T,roundedWithTitle:(0,s.K2)((e,t)=>{let n=(0,s.D7)(),i=e.insert("g").attr("class",t.classes).attr("id",t.id),r=i.insert("rect",":first-child"),l=i.insert("g").attr("class","cluster-label"),o=i.append("rect"),h=l.node().appendChild((0,a.DA)(t.labelText,t.labelStyle,void 0,!0)),g=h.getBBox();if((0,s._3)(n.flowchart.htmlLabels)){let e=h.children[0],t=(0,c.Ltv)(h);g=e.getBoundingClientRect(),t.attr("width",g.width),t.attr("height",g.height)}g=h.getBBox();let f=0*t.padding,u=f/2,p=t.width<=g.width+t.padding?g.width+t.padding:t.width;t.width<=g.width+t.padding?t.diff=(g.width+0*t.padding-t.width)/2:t.diff=-t.padding/2,r.attr("class","outer").attr("x",t.x-p/2-u).attr("y",t.y-t.height/2-u).attr("width",p+f).attr("height",t.height+f),o.attr("class","inner").attr("x",t.x-p/2-u).attr("y",t.y-t.height/2-u+g.height-1).attr("width",p+f).attr("height",t.height+f-g.height-3);let{subGraphTitleTopMargin:m}=(0,d.O)(n);l.attr("transform",`translate(${t.x-g.width/2}, ${t.y-t.height/2-t.padding/3+((0,s._3)(n.flowchart.htmlLabels)?5:3)+m})`);let w=r.node().getBBox();return t.height=w.height,t.intersect=function(e){return(0,a.nM)(t,e)},i},"roundedWithTitle"),noteGroup:k,divider:(0,s.K2)((e,t)=>{let n=e.insert("g").attr("class",t.classes).attr("id",t.id),i=n.insert("rect",":first-child"),r=0*t.padding;i.attr("class","divider").attr("x",t.x-t.width/2-r/2).attr("y",t.y-t.height/2).attr("width",t.width+r).attr("height",t.height+r);let d=i.node().getBBox();return t.width=d.width,t.height=d.height,t.diff=-t.padding/2,t.intersect=function(e){return(0,a.nM)(t,e)},n},"divider")},K={},B=(0,s.K2)((e,t)=>{s.Rm.trace("Inserting cluster");let n=t.shape||"rect";K[t.id]=X[n](e,t)},"insertCluster"),L=(0,s.K2)(()=>{K={}},"clear"),M=(0,s.K2)(async(e,t,n,r,l,o)=>{s.Rm.info("Graph in recursive render: XXX",f.M(t),l);let c=t.graph().rankdir;s.Rm.trace("Dir in recursive render - dir:",c);let h=e.insert("g").attr("class","root");t.nodes()?s.Rm.info("Recursive render XXX",t.nodes()):s.Rm.info("No nodes found for",t),t.edges().length>0&&s.Rm.trace("Recursive edges",t.edge(t.edges()[0]));let p=h.insert("g").attr("class","clusters"),m=h.insert("g").attr("class","edgePaths"),w=h.insert("g").attr("class","edgeLabels"),y=h.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(e){let i=t.node(e);if(void 0!==l){let n=JSON.parse(JSON.stringify(l.clusterData));s.Rm.info("Setting data for cluster XXX (",e,") ",n,l),t.setNode(l.id,n),t.parent(e)||(s.Rm.trace("Setting parent",e,l.id),t.setParent(e,l.id,n))}if(s.Rm.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),i?.clusterNode){s.Rm.info("Cluster identified",e,i.width,t.node(e));let{ranksep:d,nodesep:l}=t.graph();i.graph.setGraph({...i.graph.graph(),ranksep:d,nodesep:l});let c=await M(y,i.graph,n,r,t.node(e),o),h=c.elem;(0,a.lC)(i,h),i.diff=c.diff||0,s.Rm.info("Node bounds (abc123)",e,i,i.width,i.x,i.y),(0,a.U7)(h,i),s.Rm.warn("Recursive render complete ",h,i)}else t.children(e).length>0?(s.Rm.info("Cluster - the non recursive path XXX",e,i.id,i,t),s.Rm.info(x(i.id,t)),u[i.id]={id:x(i.id,t),node:i}):(s.Rm.info("Node - the non recursive path",e,i.id,i),await (0,a.on)(y,t.node(e),c))})),t.edges().forEach(async function(e){let n=t.edge(e.v,e.w,e.name);s.Rm.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),s.Rm.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),s.Rm.info("Fix",u,"ids:",e.v,e.w,"Translating: ",u[e.v],u[e.w]),await (0,i.jP)(w,n)}),t.edges().forEach(function(e){s.Rm.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e))}),s.Rm.info("Graph before layout:",JSON.stringify(f.M(t))),s.Rm.info("#############################################"),s.Rm.info("### Layout ###"),s.Rm.info("#############################################"),s.Rm.info(t),(0,g.Zp)(t),s.Rm.info("Graph after layout:",JSON.stringify(f.M(t)));let R=0,{subGraphTitleTotalMargin:b}=(0,d.O)(o);return E(t).forEach(function(e){let n=t.node(e);s.Rm.info("Position "+e+": "+JSON.stringify(t.node(e))),s.Rm.info("Position "+e+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n?.clusterNode?(n.y+=b,(0,a.U_)(n)):t.children(e).length>0?(n.height+=b,B(p,n),u[n.id].node=n):(n.y+=b/2,(0,a.U_)(n))}),t.edges().forEach(function(e){let a=t.edge(e);s.Rm.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(a),a),a.points.forEach(e=>e.y+=b/2);let d=(0,i.Jo)(m,e,a,u,n,t,r);(0,i.T_)(a,d)}),t.nodes().forEach(function(e){let n=t.node(e);s.Rm.info(e,n.type,n.diff),"group"===n.type&&(R=n.diff)}),{elem:h,diff:R}},"recursiveRender"),O=(0,s.K2)(async(e,t,n,r,d)=>{(0,i.g0)(e,n,r,d),(0,a.IU)(),(0,i.IU)(),L(),w(),s.Rm.warn("Graph at first:",JSON.stringify(f.M(t))),D(t),s.Rm.warn("Graph after:",JSON.stringify(f.M(t)));let l=(0,s.D7)();await M(e,t,r,d,void 0,l)},"render"),A=(0,s.K2)(e=>s.Y2.sanitizeText(e,(0,s.D7)()),"sanitizeText"),I={dividerMargin:10,padding:5,textHeight:10,curve:void 0},J=(0,s.K2)(function(e,t,n,i){s.Rm.info("keys:",[...e.keys()]),s.Rm.info(e),e.forEach(function(e){let r={shape:"rect",id:e.id,domId:e.domId,labelText:A(e.id),labelStyle:"",style:"fill: none; stroke: black",padding:s.D7().flowchart?.padding??s.D7().class?.padding};t.setNode(e.id,r),G(e.classes,t,n,i,e.id),s.Rm.info("setNode",r)})},"addNamespaces"),G=(0,s.K2)(function(e,t,n,i,r){s.Rm.info("keys:",[...e.keys()]),s.Rm.info(e),[...e.values()].filter(e=>e.parent===r).forEach(function(e){let n=e.cssClasses.join(" "),a=(0,o.sM)(e.styles),d=e.label??e.id,l={labelStyle:a.labelStyle,shape:"class_box",labelText:A(d),classData:e,rx:0,ry:0,class:n,style:a.style,id:e.id,domId:e.domId,tooltip:i.db.getTooltip(e.id,r)||"",haveCallback:e.haveCallback,link:e.link,width:"group"===e.type?500:void 0,type:e.type,padding:s.D7().flowchart?.padding??s.D7().class?.padding};t.setNode(e.id,l),r&&t.setParent(e.id,r),s.Rm.info("setNode",l)})},"addClasses"),_=(0,s.K2)(function(e,t,n,i){s.Rm.info(e),e.forEach(function(e,r){let a={labelStyle:"",shape:"note",labelText:A(e.text),noteData:e,rx:0,ry:0,class:"",style:"",id:e.id,domId:e.id,tooltip:"",type:"note",padding:s.D7().flowchart?.padding??s.D7().class?.padding};if(t.setNode(e.id,a),s.Rm.info("setNode",a),!e.class||!i.has(e.class))return;let d=n+r,l={id:`edgeNote${d}`,classes:"relation",pattern:"dotted",arrowhead:"none",startLabelRight:"",endLabelLeft:"",arrowTypeStart:"none",arrowTypeEnd:"none",style:"fill:none",labelStyle:"",curve:(0,o.Ib)(I.curve,c.lUB)};t.setEdge(e.id,e.class,l,d)})},"addNotes"),P=(0,s.K2)(function(e,t){let n=(0,s.D7)().flowchart,i=0;e.forEach(function(e){i++;let r={classes:"relation",pattern:1==e.relation.lineType?"dashed":"solid",id:(0,o.rY)(e.id1,e.id2,{prefix:"id",counter:i}),arrowhead:"arrow_open"===e.type?"none":"normal",startLabelRight:"none"===e.relationTitle1?"":e.relationTitle1,endLabelLeft:"none"===e.relationTitle2?"":e.relationTitle2,arrowTypeStart:U(e.relation.type1),arrowTypeEnd:U(e.relation.type2),style:"fill:none",labelStyle:"",curve:(0,o.Ib)(n?.curve,c.lUB)};if(s.Rm.info(r,e),void 0!==e.style){let t=(0,o.sM)(e.style);r.style=t.style,r.labelStyle=t.labelStyle}e.text=e.title,void 0===e.text?void 0!==e.style&&(r.arrowheadStyle="fill: #333"):(r.arrowheadStyle="fill: #333",r.labelpos="c",s.D7().flowchart?.htmlLabels??(0,s.D7)().htmlLabels?(r.labelType="html",r.label='<span class="edgeLabel">'+e.text+"</span>"):(r.labelType="text",r.label=e.text.replace(s.Y2.lineBreakRegex,"\n"),void 0===e.style&&(r.style=r.style||"stroke: #333; stroke-width: 1.5px;fill:none"),r.labelStyle=r.labelStyle.replace("color:","fill:"))),t.setEdge(e.id1,e.id2,r,i)})},"addRelations"),$=(0,s.K2)(function(e){I={...I,...e}},"setConf"),F=(0,s.K2)(async function(e,t,n,i){let r;s.Rm.info("Drawing class - ",t);let a=(0,s.D7)().flowchart??(0,s.D7)().class,d=(0,s.D7)().securityLevel;s.Rm.info("config:",a);let l=a?.nodeSpacing??50,g=a?.rankSpacing??50,f=new h.T({multigraph:!0,compound:!0}).setGraph({rankdir:i.db.getDirection(),nodesep:l,ranksep:g,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),u=i.db.getNamespaces(),p=i.db.getClasses(),m=i.db.getRelations(),w=i.db.getNotes();s.Rm.info(m),J(u,f,t,i),G(p,f,t,i),P(m,f),_(w,f,m.length+1,p),"sandbox"===d&&(r=(0,c.Ltv)("#i"+t));let y="sandbox"===d?(0,c.Ltv)(r.nodes()[0].contentDocument.body):(0,c.Ltv)("body"),R=y.select(`[id="${t}"]`),b=y.select("#"+t+" g");if(await O(b,f,["aggregation","extension","composition","dependency","lollipop"],"classDiagram",t),o._K.insertTitle(R,"classTitleText",a?.titleTopMargin??5,i.db.getDiagramTitle()),(0,s.ot)(f,R,a?.diagramPadding,a?.useMaxWidth),!a?.htmlLabels){let e="sandbox"===d?r.nodes()[0].contentDocument:document;for(let n of e.querySelectorAll('[id="'+t+'"] .edgeLabel .label')){let t=n.getBBox(),i=e.createElementNS("http://www.w3.org/2000/svg","rect");i.setAttribute("rx",0),i.setAttribute("ry",0),i.setAttribute("width",t.width),i.setAttribute("height",t.height),n.insertBefore(i,n.firstChild)}}},"draw");function U(e){let t;switch(e){case 0:t="aggregation";break;case 1:t="extension";break;case 2:t="composition";break;case 3:t="dependency";break;case 4:t="lollipop";break;default:t="none"}return t}(0,s.K2)(U,"getArrowMarker");var j={parser:r._$,db:r.z2,renderer:{setConf:$,draw:F},styles:r.tM,init:(0,s.K2)(e=>{e.class||(e.class={}),e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute,r.z2.clear()},"init")}}}]); |