import{p as Ze}from"./chunk-JWPE2WC7.C9webpn6.js";import{b7 as qe,_ as gt,F as Qe,ad as Je,l as Fe,b as Ke,a as je,o as _e,p as tr,g as er,s as rr,q as ir,B as ar,z as nr,D as or,c as Ee,a$ as Te,ai as pe,i as sr,d as hr,r as lr,aj as fr,b8 as cr}from"./mermaid.core.TSSz6aZW.js";import{p as gr}from"./cynefin-VYW2F7L2.DDB6TQyK.js";import{c as be}from"./cytoscape.esm.OyMbaexL.js";import"./framework.C2AwuPrQ.js";var he={exports:{}},le={exports:{}},fe={exports:{}},ur=fe.exports,Oe;function dr(){return Oe||(Oe=1,(function(x,A){(function(R,N){x.exports=N()})(ur,function(){return(function(C){var R={};function N(v){if(R[v])return R[v].exports;var h=R[v]={i:v,l:!1,exports:{}};return C[v].call(h.exports,h,h.exports,N),h.l=!0,h.exports}return N.m=C,N.c=R,N.i=function(v){return v},N.d=function(v,h,a){N.o(v,h)||Object.defineProperty(v,h,{configurable:!1,enumerable:!0,get:a})},N.n=function(v){var h=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(h,"a",h),h},N.o=function(v,h){return Object.prototype.hasOwnProperty.call(v,h)},N.p="",N(N.s=28)})([(function(C,R,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,C.exports=v}),(function(C,R,N){var v=N(2),h=N(8),a=N(9);function r(f,e,g){v.call(this,g),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=g,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var i in v)r[i]=v[i];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var g=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(g.getOwner()==e)return g;if(g.getOwner()==t)break;g=g.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=h.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},C.exports=r}),(function(C,R,N){function v(h){this.vGraphObject=h}C.exports=v}),(function(C,R,N){var v=N(2),h=N(10),a=N(13),r=N(0),i=N(16),f=N(5);function e(t,s,n,c){n==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=h.MIN_VALUE,this.inclusionTreeDepth=h.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,n!=null&&s!=null?this.rect=new a(s.x,s.y,n.width,n.height):this.rect=new a}e.prototype=Object.create(v.prototype);for(var g in v)e[g]=v[g];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],n=this;return n.edges.forEach(function(c){if(c.target==t){if(c.source!=n)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],n=this;return n.edges.forEach(function(c){if(!(c.source==n||c.target==n))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(n){if(n.source==s)t.add(n.target);else{if(n.target!=s)throw"Incorrect incidency!";t.add(n.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,n;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),l=0;ls?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(n+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>n?(this.rect.y-=(this.labelHeight-n)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(n+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var n=this.rect.y;n>r.WORLD_BOUNDARY?n=r.WORLD_BOUNDARY:n<-r.WORLD_BOUNDARY&&(n=-r.WORLD_BOUNDARY);var c=new f(s,n),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},C.exports=e}),(function(C,R,N){var v=N(0);function h(){}for(var a in v)h[a]=v[a];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,C.exports=h}),(function(C,R,N){function v(h,a){h==null&&a==null?(this.x=0,this.y=0):(this.x=h,this.y=a)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(h){this.x=h},v.prototype.setY=function(h){this.y=h},v.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},C.exports=v}),(function(C,R,N){var v=N(2),h=N(10),a=N(0),r=N(7),i=N(3),f=N(1),e=N(13),g=N(12),t=N(11);function s(c,l,T){v.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(v.prototype);for(var n in v)s[n]=v[n];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,l,T){if(l==null&&T==null){var u=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var d=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(d.source=l,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),l.edges.push(d),T!=l&&T.edges.push(d),d)}},s.prototype.remove=function(c){var l=c;if(c instanceof i){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),u,d=T.length,L=0;L-1&&G>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(w,1),u.target!=u.source&&u.target.edges.splice(G,1);var b=u.source.owner.getEdges().indexOf(u);if(b==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(b,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,u,d,L=this.getNodes(),b=L.length,w=0;wT&&(c=T),l>u&&(l=u)}return c==h.MAX_VALUE?null:(L[0].getParent().paddingLeft!=null?d=L[0].getParent().paddingLeft:d=this.margin,this.left=l-d,this.top=c-d,new g(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,u=h.MAX_VALUE,d=-h.MAX_VALUE,L,b,w,G,B,U=this.nodes,V=U.length,M=0;ML&&(l=L),Tw&&(u=w),dL&&(l=L),Tw&&(u=w),d=this.nodes.length){var V=0;T.forEach(function(M){M.owner==c&&V++}),V==this.nodes.length&&(this.isConnected=!0)}},C.exports=s}),(function(C,R,N){var v,h=N(1);function a(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var r=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(r,i);return this.setRootGraph(f),this.rootGraph},a.prototype.add=function(r,i,f,e,g){if(f==null&&e==null&&g==null){if(r==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return r.parent=i,i.child=r,r}else{g=f,e=i,f=r;var t=e.getOwner(),s=g.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,g);if(f.isInterGraph=!0,f.source=e,f.target=g,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},a.prototype.remove=function(r){if(r instanceof v){var i=r;if(i.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(i==this.rootGraph||i.parent!=null&&i.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(i.getEdges());for(var e,g=f.length,t=0;t=r.getRight()?i[0]+=Math.min(r.getX()-a.getX(),a.getRight()-r.getRight()):r.getX()<=a.getX()&&r.getRight()>=a.getRight()&&(i[0]+=Math.min(a.getX()-r.getX(),r.getRight()-a.getRight())),a.getY()<=r.getY()&&a.getBottom()>=r.getBottom()?i[1]+=Math.min(r.getY()-a.getY(),a.getBottom()-r.getBottom()):r.getY()<=a.getY()&&r.getBottom()>=a.getBottom()&&(i[1]+=Math.min(a.getY()-r.getY(),r.getBottom()-a.getBottom()));var g=Math.abs((r.getCenterY()-a.getCenterY())/(r.getCenterX()-a.getCenterX()));r.getCenterY()===a.getCenterY()&&r.getCenterX()===a.getCenterX()&&(g=1);var t=g*i[0],s=i[1]/g;i[0]t)return i[0]=f,i[1]=n,i[2]=g,i[3]=U,!1;if(eg)return i[0]=s,i[1]=e,i[2]=G,i[3]=t,!1;if(fg?(i[0]=l,i[1]=T,o=!0):(i[0]=c,i[1]=n,o=!0):p===y&&(f>g?(i[0]=s,i[1]=n,o=!0):(i[0]=u,i[1]=T,o=!0)),-m===y?g>f?(i[2]=B,i[3]=U,E=!0):(i[2]=G,i[3]=w,E=!0):m===y&&(g>f?(i[2]=b,i[3]=w,E=!0):(i[2]=V,i[3]=U,E=!0)),o&&E)return!1;if(f>g?e>t?(S=this.getCardinalDirection(p,y,4),O=this.getCardinalDirection(m,y,2)):(S=this.getCardinalDirection(-p,y,3),O=this.getCardinalDirection(-m,y,1)):e>t?(S=this.getCardinalDirection(-p,y,1),O=this.getCardinalDirection(-m,y,3)):(S=this.getCardinalDirection(p,y,2),O=this.getCardinalDirection(m,y,4)),!o)switch(S){case 1:W=n,F=f+-L/y,i[0]=F,i[1]=W;break;case 2:F=u,W=e+d*y,i[0]=F,i[1]=W;break;case 3:W=T,F=f+L/y,i[0]=F,i[1]=W;break;case 4:F=l,W=e+-d*y,i[0]=F,i[1]=W;break}if(!E)switch(O){case 1:Q=w,I=g+-_/y,i[2]=I,i[3]=Q;break;case 2:I=V,Q=t+M*y,i[2]=I,i[3]=Q;break;case 3:Q=U,I=g+_/y,i[2]=I,i[3]=Q;break;case 4:I=B,Q=t+-M*y,i[2]=I,i[3]=Q;break}}return!1},h.getCardinalDirection=function(a,r,i){return a>r?i:1+i%4},h.getIntersection=function(a,r,i,f){if(f==null)return this.getIntersection2(a,r,i);var e=a.x,g=a.y,t=r.x,s=r.y,n=i.x,c=i.y,l=f.x,T=f.y,u=void 0,d=void 0,L=void 0,b=void 0,w=void 0,G=void 0,B=void 0,U=void 0,V=void 0;return L=s-g,w=e-t,B=t*g-e*s,b=T-c,G=n-l,U=l*c-n*T,V=L*G-b*w,V===0?null:(u=(w*U-G*B)/V,d=(b*B-L*U)/V,new v(u,d))},h.angleOfVector=function(a,r,i,f){var e=void 0;return a!==i?(e=Math.atan((f-r)/(i-a)),i=0){var T=(-n+Math.sqrt(n*n-4*s*c))/(2*s),u=(-n-Math.sqrt(n*n-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:u>=0&&u<=1?[u]:d}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,C.exports=h}),(function(C,R,N){function v(){}v.sign=function(h){return h>0?1:h<0?-1:0},v.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},v.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},C.exports=v}),(function(C,R,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,C.exports=v}),(function(C,R,N){var v=(function(){function e(g,t){for(var s=0;s"u"?"undefined":v(a);return a==null||r!="object"&&r!="function"},C.exports=h}),(function(C,R,N){function v(n){if(Array.isArray(n)){for(var c=0,l=Array(n.length);c0&&c;){for(L.push(w[0]);L.length>0&&c;){var G=L[0];L.splice(0,1),d.add(G);for(var B=G.getEdges(),u=0;u-1&&w.splice(_,1)}d=new Set,b=new Map}}return n},s.prototype.createDummyNodesForBendpoints=function(n){for(var c=[],l=n.source,T=this.graphManager.calcLowestCommonAncestor(n.source,n.target),u=0;u0){for(var T=this.edgeToDummyNodes.get(l),u=0;u=0&&c.splice(U,1);var V=b.getNeighborsList();V.forEach(function(o){if(l.indexOf(o)<0){var E=T.get(o),p=E-1;p==1&&G.push(o),T.set(o,p)}})}l=l.concat(G),(c.length==1||c.length==2)&&(u=!0,d=c[0])}return d},s.prototype.setGraphManager=function(n){this.graphManager=n},C.exports=s}),(function(C,R,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},C.exports=v}),(function(C,R,N){var v=N(5);function h(a,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(a){this.lworldExtX=a},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(a){this.lworldExtY=a},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},h.prototype.transformX=function(a){var r=0,i=this.lworldExtX;return i!=0&&(r=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/i),r},h.prototype.transformY=function(a){var r=0,i=this.lworldExtY;return i!=0&&(r=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/i),r},h.prototype.inverseTransformX=function(a){var r=0,i=this.ldeviceExtX;return i!=0&&(r=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/i),r},h.prototype.inverseTransformY=function(a){var r=0,i=this.ldeviceExtY;return i!=0&&(r=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/i),r},h.prototype.inverseTransformPoint=function(a){var r=new v(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return r},C.exports=h}),(function(C,R,N){function v(t){if(Array.isArray(t)){for(var s=0,n=Array(t.length);sa.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(t-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,n=0;n0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,c,l,T,u=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,n=0;nL||d>L)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(L=s.getEstimatedSize()*this.compoundGravityRangeFactor,(u>L||d>L)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=u.length||L>=u[0].length)){for(var b=0;be}}]),i})();C.exports=r}),(function(C,R,N){function v(){}v.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var a=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function Bt(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),i=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,e=Math.min(this.m-1,this.n),g=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,Ct){return Tt&&Ct})(z0;){var J=void 0,It=void 0;for(J=o-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===o-2)It=4;else{var Nt=void 0;for(Nt=o-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==o?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===o-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[o-2];r[o-2]=0;for(var ut=o-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),wt=this.s[ut]/Et,Ot=it/Et;this.s[ut]=Et,ut!==J&&(it=-Ot*r[ut-1],r[ut-1]=wt*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(a)?(r=a/h,r=Math.abs(h)*Math.sqrt(1+r*r)):a!=0?(r=h/a,r=Math.abs(a)*Math.sqrt(1+r*r)):r=0,r},C.exports=v}),(function(C,R,N){var v=(function(){function r(i,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,r),this.sequence1=i,this.sequence2=f,this.match_score=e,this.mismatch_penalty=g,this.gap_penalty=t,this.iMax=i.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;i--){var f=this.listeners[i];f.event===a&&f.callback===r&&this.listeners.splice(i,1)}},h.emit=function(a,r){for(var i=0;i{var R={45:((a,r,i)=>{var f={};f.layoutBase=i(551),f.CoSEConstants=i(806),f.CoSEEdge=i(767),f.CoSEGraph=i(880),f.CoSEGraphManager=i(578),f.CoSELayout=i(765),f.CoSENode=i(991),f.ConstraintHandler=i(902),a.exports=f}),806:((a,r,i)=>{var f=i(551).FDLayoutConstants;function e(){}for(var g in f)e[g]=f[g];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,a.exports=e}),767:((a,r,i)=>{var f=i(551).FDLayoutEdge;function e(t,s,n){f.call(this,t,s,n)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];a.exports=e}),880:((a,r,i)=>{var f=i(551).LGraph;function e(t,s,n){f.call(this,t,s,n)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];a.exports=e}),578:((a,r,i)=>{var f=i(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var g in f)e[g]=f[g];a.exports=e}),765:((a,r,i)=>{var f=i(551).FDLayout,e=i(578),g=i(880),t=i(991),s=i(767),n=i(806),c=i(902),l=i(551).FDLayoutConstants,T=i(551).LayoutConstants,u=i(551).Point,d=i(551).PointD,L=i(551).DimensionD,b=i(551).Layout,w=i(551).Integer,G=i(551).IGeometry,B=i(551).LGraph,U=i(551).Transform,V=i(551).LinkedList;function M(){f.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(f.prototype);for(var _ in f)M[_]=f[_];M.prototype.newGraphManager=function(){var o=new e(this);return this.graphManager=o,o},M.prototype.newGraph=function(o){return new g(null,this.graphManager,o)},M.prototype.newNode=function(o){return new t(this.graphManager,o)},M.prototype.newEdge=function(o){return new s(null,null,o)},M.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(n.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=n.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var o=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return o&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(n.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(S){return E.has(S)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var o=this.getFlatForest();if(o.length>0)this.positionNodesRadially(o);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),n.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var o=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return o.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),n.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),n.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var o=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=S)}}if(this.constraints.relativePlacementConstraint){var O=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(D){o.fixedNodesOnHorizontal.add(D),o.fixedNodesOnVertical.add(D)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*D.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=D[tt],D[tt]=D[H],D[H]=k;return D},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;o.nodesInRelativeHorizontal.includes(H)||(o.nodesInRelativeHorizontal.push(H),o.nodeToRelativeConstraintMapHorizontal.set(H,[]),o.dummyToNodeForVerticalAlignment.has(H)?o.nodeToTempPositionMapHorizontal.set(H,o.idToNodeMap.get(o.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):o.nodeToTempPositionMapHorizontal.set(H,o.idToNodeMap.get(H).getCenterX())),o.nodesInRelativeHorizontal.includes(k)||(o.nodesInRelativeHorizontal.push(k),o.nodeToRelativeConstraintMapHorizontal.set(k,[]),o.dummyToNodeForVerticalAlignment.has(k)?o.nodeToTempPositionMapHorizontal.set(k,o.idToNodeMap.get(o.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):o.nodeToTempPositionMapHorizontal.set(k,o.idToNodeMap.get(k).getCenterX())),o.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:D.gap}),o.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:D.gap})}else{var tt=F.has(D.top)?F.get(D.top):D.top,ht=F.has(D.bottom)?F.get(D.bottom):D.bottom;o.nodesInRelativeVertical.includes(tt)||(o.nodesInRelativeVertical.push(tt),o.nodeToRelativeConstraintMapVertical.set(tt,[]),o.dummyToNodeForHorizontalAlignment.has(tt)?o.nodeToTempPositionMapVertical.set(tt,o.idToNodeMap.get(o.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):o.nodeToTempPositionMapVertical.set(tt,o.idToNodeMap.get(tt).getCenterY())),o.nodesInRelativeVertical.includes(ht)||(o.nodesInRelativeVertical.push(ht),o.nodeToRelativeConstraintMapVertical.set(ht,[]),o.dummyToNodeForHorizontalAlignment.has(ht)?o.nodeToTempPositionMapVertical.set(ht,o.idToNodeMap.get(o.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):o.nodeToTempPositionMapVertical.set(ht,o.idToNodeMap.get(ht).getCenterY())),o.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:D.gap}),o.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:D.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=F.has(D.top)?F.get(D.top):D.top,ht=F.has(D.bottom)?F.get(D.bottom):D.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new V,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(wt){It.has(wt)||(J.push(wt),It.add(wt),tt[Nt].push(wt))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,o.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,o.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},M.prototype.updateDisplacements=function(){var o=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var D=o.idToNodeMap.get($.nodeId);D.displacementX=0,D.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var F;for(F=0;Fm&&(m=Math.floor(O.y)),S=Math.floor(O.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-O.x/2,T.WORLD_CENTER_Y-O.y/2))},M.radialLayout=function(o,E,p){var m=Math.max(this.maxDiagonalInTree(o),n.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(E,null,0,359,0,m);var y=B.calculateBounds(o),S=new U;S.setDeviceOrgX(y.getMinX()),S.setDeviceOrgY(y.getMinY()),S.setWorldOrgX(p.x),S.setWorldOrgY(p.y);for(var O=0;O1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?D=(z.indexOf(H[0])+1)%$:D=0;for(var ht=Math.abs(m-p)/X,J=D;rt!=X;J=++J%$){var It=z[J].getOtherEnd(o);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;M.branchRadialLayout(It,o,Nt,vt,y+S,S),rt++}}},M.maxDiagonalInTree=function(o){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var o=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[F]=[]),E[F]=E[F].concat(S)}Object.keys(E).forEach(function(W){if(E[W].length>1){var I="DummyCompound_"+W;o.memberGroups[I]=E[W];var Q=E[W][0].getParent(),z=new t(o.graphManager);z.id=I,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,o.idToDummyNode[I]=z;var X=o.getGraphManager().add(o.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(S+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>S?(m.rect.y-=(m.labelHeight-S)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-S)/2):m.labelPosVertical=="bottom"&&m.setHeight(S+m.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var o=this.compoundOrder.length-1;o>=0;o--){var E=this.compoundOrder[o],p=E.id,m=E.paddingLeft,y=E.paddingTop,S=E.labelMarginLeft,O=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,S,O)}},M.prototype.repopulateZeroDegreeMembers=function(){var o=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=o.idToDummyNode[p],y=m.paddingLeft,S=m.paddingTop,O=m.labelMarginLeft,F=m.labelMarginTop;o.adjustLocations(E[p],m.rect.x,m.rect.y,y,S,O,F)})},M.prototype.getToBeTiled=function(o){var E=o.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=o.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},M.prototype.getNodeDegree=function(o){o.id;for(var E=o.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+o.verticalPadding}},M.prototype.tileCompoundMembers=function(o,E){var p=this;this.tiledMemberPack=[],Object.keys(o).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(o[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,n.NODE_DIMENSIONS_INCLUDE_LABELS){var S=y.rect.width,O=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(S+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>S?(y.rect.x-=(y.labelWidth-S)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-S)/2):y.labelPosHorizontal=="right"&&y.setWidth(S+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(O+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>O?(y.rect.y-=(y.labelHeight-O)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-O)/2):y.labelPosVertical=="bottom"&&y.setHeight(O+y.labelHeight))}})},M.prototype.tileNodes=function(o,E){var p=this.tileNodesByFavoringDim(o,E,!0),m=this.tileNodesByFavoringDim(o,E,!1),y=this.getOrgRatio(p),S=this.getOrgRatio(m),O;return SF&&(F=$.getWidth())});var W=S/y,I=O/y,Q=Math.pow(p-m,2)+4*(W+m)*(I+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return F>rt&&(rt=F),rt+=m*2,rt},M.prototype.tileNodesByFavoringDim=function(o,E,p){var m=n.TILING_PADDING_VERTICAL,y=n.TILING_PADDING_HORIZONTAL,S=n.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};S&&(O.idealRowWidth=this.calcIdealRowWidth(o,p));var F=function(D){return D.rect.width*D.rect.height},W=function(D,H){return F(H)-F(D)};o.sort(function($,D){var H=W;return O.idealRowWidth?(H=S,H($.id,D.id)):H($,D)});for(var I=0,Q=0,z=0;z0&&(O+=o.horizontalPadding),o.rowWidth[p]=O,o.width0&&(F+=o.verticalPadding);var W=0;F>o.rowHeight[p]&&(W=o.rowHeight[p],o.rowHeight[p]=F,W=o.rowHeight[p]-W),o.height+=W,o.rows[p].push(E)},M.prototype.getShortestRowIndex=function(o){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=o.rowWidth[m]);return E},M.prototype.canAddHorizontal=function(o,E,p){if(o.idealRowWidth){var m=o.rows.length-1,y=o.rowWidth[m];return y+E+o.horizontalPadding<=o.idealRowWidth}var S=this.getShortestRowIndex(o);if(S<0)return!0;var O=o.rowWidth[S];if(O+o.horizontalPadding+E<=o.width)return!0;var F=0;o.rowHeight[S]0&&(F=p+o.verticalPadding-o.rowHeight[S]);var W;o.width-O>=E+o.horizontalPadding?W=(o.height+F)/(O+E+o.horizontalPadding):W=(o.height+F)/o.width,F=p+o.verticalPadding;var I;return o.widthS&&E!=p){m.splice(-1,1),o.rows[p].push(y),o.rowWidth[E]=o.rowWidth[E]-S,o.rowWidth[p]=o.rowWidth[p]+S,o.width=o.rowWidth[instance.getLongestRowIndex(o)];for(var O=Number.MIN_VALUE,F=0;FO&&(O=m[F].height);E>0&&(O+=o.verticalPadding);var W=o.rowHeight[E]+o.rowHeight[p];o.rowHeight[E]=O,o.rowHeight[p]0)for(var rt=y;rt<=S;rt++)X[0]+=this.grid[rt][O-1].length+this.grid[rt][O].length-1;if(S0)for(var rt=O;rt<=F;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,D,H,k=0;k{var f=i(551).FDLayoutNode,e=i(551).IMath;function g(s,n,c,l){f.call(this,s,n,c,l)}g.prototype=Object.create(f.prototype);for(var t in f)g[t]=f[t];g.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},g.prototype.propogateDisplacementToChildren=function(s,n){for(var c=this.getChild().getNodes(),l,T=0;T{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,u.has(st)?d[u.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,u.has(st)?L[u.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=u.has(st)?d[u.get(st)]:q.get(st):ft+=u.has(st)?L[u.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var At=function(){var ot=dt.shift(),Lt=Y.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,Bt=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw Bt}}var ce=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),oe;!(Qt=(oe=Jt.next()).done);Qt=!0){var te=oe.value;et.set(te,et.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},_=function(Y){var Z=0,K=0,q=0,at=0;if(Y.forEach(function(j){j.left?d[u.get(j.left)]-d[u.get(j.right)]>=0?Z++:K++:L[u.get(j.top)]-L[u.get(j.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var et=0;et1)l.fixedNodeConstraint.forEach(function(P,Y){m[Y]=[P.position.x,P.position.y],y[Y]=[d[u.get(P.nodeId)],L[u.get(P.nodeId)]]}),S=!0;else if(l.alignmentConstraint)(function(){var P=0;if(l.alignmentConstraint.vertical){for(var Y=l.alignmentConstraint.vertical,Z=function(et){var j=new Set;Y[et].forEach(function(pt){j.add(pt)});var dt=new Set([].concat(f(j)).filter(function(pt){return F.has(pt)})),At=void 0;dt.size>0?At=d[u.get(dt.values().next().value)]:At=V(j).x,Y[et].forEach(function(pt){m[P]=[At,L[u.get(pt)]],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},K=0;K0?At=d[u.get(dt.values().next().value)]:At=V(j).y,q[et].forEach(function(pt){m[P]=[d[u.get(pt)],At],y[P]=[d[u.get(pt)],L[u.get(pt)]],P++})},ct=0;ctz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(P,Y){var Z={x:d[u.get(P.nodeId)],y:L[u.get(P.nodeId)]},K=P.position,q=U(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,d.forEach(function(P,Y){d[Y]+=mt.x}),L.forEach(function(P,Y){L[Y]+=mt.y}),l.fixedNodeConstraint.forEach(function(P){d[u.get(P.nodeId)]=P.position.x,L[u.get(P.nodeId)]=P.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(Y){var Z=new Set;Dt[Y].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return F.has(at)})),q=void 0;K.size>0?q=d[u.get(K.values().next().value)]:q=V(Z).x,Z.forEach(function(at){F.has(at)||(d[u.get(at)]=q)})},Ht=0;Ht0?q=L[u.get(K.values().next().value)]:q=V(Z).y,Z.forEach(function(at){F.has(at)||(L[u.get(at)]=q)})},Ft=0;Ft{a.exports=C})},N={};function v(a){var r=N[a];if(r!==void 0)return r.exports;var i=N[a]={exports:{}};return R[a](i,i.exports,v),i.exports}var h=v(45);return h})()})})(le)),le.exports}var yr=he.exports,xe;function mr(){return xe||(xe=1,(function(x,A){(function(R,N){x.exports=N(pr())})(yr,function(C){return(()=>{var R={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var i=arguments.length,f=Array(i>1?i-1:0),e=1;e{var f=(function(){function t(s,n){var c=[],l=!0,T=!1,u=void 0;try{for(var d=s[Symbol.iterator](),L;!(l=(L=d.next()).done)&&(c.push(L.value),!(n&&c.length===n));l=!0);}catch(b){T=!0,u=b}finally{try{!l&&d.return&&d.return()}finally{if(T)throw u}}return c}return function(s,n){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=i(140).layoutBase.LinkedList,g={};g.getTopMostNodes=function(t){for(var s={},n=0;n0&&S.merge(I)});for(var O=0;O1){L=u[0],b=L.connectedEdges().length,u.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),B),U},g.relocateComponent=function(t,s,n){if(!n.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;if(n.quality=="draft"){var d=!0,L=!1,b=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),G;!(d=(G=w.next()).done);d=!0){var B=G.value,U=f(B,2),V=U[0],M=U[1],_=n.cy.getElementById(V);if(_){var o=_.boundingBox(),E=s.xCoords[M]-o.w/2,p=s.xCoords[M]+o.w/2,m=s.yCoords[M]-o.h/2,y=s.yCoords[M]+o.h/2;El&&(l=p),mu&&(u=y)}}}catch(I){L=!0,b=I}finally{try{!d&&w.return&&w.return()}finally{if(L)throw b}}var S=t.x-(l+c)/2,O=t.y-(u+T)/2;s.xCoords=s.xCoords.map(function(I){return I+S}),s.yCoords=s.yCoords.map(function(I){return I+O})}else{Object.keys(s).forEach(function(I){var Q=s[I],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zl&&(l=X),rtu&&(u=$)});var F=t.x-(l+c)/2,W=t.y-(u+T)/2;Object.keys(s).forEach(function(I){var Q=s[I];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+W)})}}},g.calcBoundingBox=function(t,s,n,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,u=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,L=void 0,b=void 0,w=void 0,G=void 0,B=t.descendants().not(":parent"),U=B.length,V=0;VL&&(l=L),Tw&&(u=w),d{var f=i(548),e=i(140).CoSELayout,g=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,n=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,l=i(140).CoSEConstants,T=function(d,L){var b=d.cy,w=d.eles,G=w.nodes(),B=w.edges(),U=void 0,V=void 0,M=void 0,_={};d.randomize&&(U=L.nodeIndexes,V=L.xCoords,M=L.yCoords);var o=function(I){return typeof I=="function"},E=function(I,Q){return o(I)?I(Q):I},p=f.calcParentsWithoutChildren(b,w),m=function W(I,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(I,Q,z){for(var X=0,rt=0,$=0;$0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:o(d.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},S=function(I,Q){Q.fixedNodeConstraint&&(I.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(I.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(I.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?n.QUALITY=2:n.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!d.randomize,l.ANIMATE=c.ANIMATE=n.ANIMATE=d.animate,l.TILE=d.tile,l.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!d.randomize,n.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),d.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),d.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new e,F=O.newGraphManager();return m(F.addRoot(),f.getTopMostNodes(G),O,d),y(O,F,B),S(O,d),O.runLayout(),_};a.exports={coseLayout:T}}),212:((a,r,i)=>{var f=(function(){function d(L,b){for(var w=0;w0)if(p){var S=t.getTopMostNodes(w.eles.nodes());if(M=t.connectComponents(G,w.eles,S),M.forEach(function(vt){var it=vt.boundingBox();_.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&M.forEach(function(vt){w.eles=vt,U.push(n(w))}),w.quality=="default"||w.quality=="proof"){var O=G.collection();if(w.tile){var F=new Map,W=[],I=[],Q=0,z={nodeIndexes:F,xCoords:W,yCoords:I},X=[];if(M.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){O.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),O.length>1){var rt=O.boundingBox();_.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),M.push(O),U.push(z);for(var $=X.length-1;$>=0;$--)M.splice(X[$],1),U.splice(X[$],1),_.splice(X[$],1)}}M.forEach(function(vt,it){w.eles=vt,V.push(l(w,U[it])),t.relocateComponent(_[it],V[it],w)})}else M.forEach(function(vt,it){t.relocateComponent(_[it],U[it],w)});var D=new Set;if(M.length>1){var H=[],k=B.filter(function(vt){return vt.css("display")=="none"});M.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=U[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var wt=void 0;vt.nodes().not(k).forEach(function(Ot){if(w.quality=="draft")if(!Ot.isParent())wt=ut.get(Ot.id()),Et.nodes.push({x:U[it].xCoords[wt]-Ot.boundingbox().w/2,y:U[it].yCoords[wt]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var mt=t.calcBoundingBox(Ot,U[it].xCoords,U[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else V[it][Ot.id()]&&Et.nodes.push({x:V[it][Ot.id()].getLeft(),y:V[it][Ot.id()].getTop(),width:V[it][Ot.id()].getWidth(),height:V[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var mt=Ot.source(),Dt=Ot.target();if(mt.css("display")!="none"&&Dt.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Dt.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,U[it].xCoords,U[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[it].xCoords[Rt]),Ut.push(U[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[it].xCoords,U[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[it].xCoords[Ht]),Pt.push(U[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else V[it][mt.id()]&&V[it][Dt.id()]&&Et.edges.push({startX:V[it][mt.id()].getCenterX(),startY:V[it][mt.id()].getCenterY(),endX:V[it][Dt.id()].getCenterX(),endY:V[it][Dt.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),D.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")U.forEach(function(vt,it){var ut=vt.xCoords.map(function(wt){return wt+tt[it].dx}),Et=vt.yCoords.map(function(wt){return wt+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;D.forEach(function(vt){Object.keys(V[vt]).forEach(function(it){var ut=V[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(_.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=n(w);U.push(y)}w.quality=="default"||w.quality=="proof"?(V.push(l(w,U[0])),t.relocateComponent(_[0],V[0],w)):t.relocateComponent(_[0],U[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,wt=void 0,Ot=it.data("id");return V.forEach(function(Dt){Ot in Dt&&(Et={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},wt=Dt[Ot])}),w.nodeDimensionsIncludeLabels&&(wt.labelWidth&&(wt.labelPosHorizontal=="left"?Et.x+=wt.labelWidth/2:wt.labelPosHorizontal=="right"&&(Et.x-=wt.labelWidth/2)),wt.labelHeight&&(wt.labelPosVertical=="top"?Et.y+=wt.labelHeight/2:wt.labelPosVertical=="bottom"&&(Et.y-=wt.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(G,B),Nt=B.filter(function(vt){return vt.css("display")=="none"});w.eles=B.not(Nt),B.nodes().not(":parent").not(Nt).layoutPositions(b,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();a.exports=u}),657:((a,r,i)=>{var f=i(548),e=i(140).layoutBase.Matrix,g=i(140).layoutBase.SVD,t=function(n){var c=n.cy,l=n.eles,T=l.nodes(),u=l.nodes(":parent"),d=new Map,L=new Map,b=new Map,w=[],G=[],B=[],U=[],V=[],M=[],_=[],o=[],E=void 0,p=1e8,m=1e-9,y=n.piTol,S=n.samplingType,O=n.nodeSeparation,F=void 0,W=function(){for(var Y=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=V[Lt],At=Lt)}return At},Q=function(Y){var Z=void 0;if(Y){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;j=et}for(var pt=0;pt=1)break;j=et}for(var lt=0;lt0&&(Z.isParent()?w[Y].push(b.get(Z.id())):w[Y].push(Z.id()))})});var Nt=function(Y){var Z=L.get(Y),K=void 0;d.get(Y).forEach(function(q){c.getElementById(q).isParent()?K=b.get(q):K=q,w[Z].push(K),w[L.get(K)].push(Y)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),wt;!(vt=(wt=Et.next()).done);vt=!0){var Ot=wt.value;Nt(Ot)}}catch(P){it=!0,ut=P}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=L.size;var mt=void 0;if(E>2){F=E{var f=i(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),a.exports=e}),140:(a=>{a.exports=C})},N={};function v(a){var r=N[a];if(r!==void 0)return r.exports;var i=N[a]={exports:{}};return R[a](i,i.exports,v),i.exports}var h=v(579);return h})()})})(he)),he.exports}var Er=mr();const Tr=qe(Er);var Ie={L:"left",R:"right",T:"top",B:"bottom"},Re={L:gt(x=>`${x},${x/2} 0,${x} 0,0`,"L"),R:gt(x=>`0,${x/2} ${x},0 ${x},${x}`,"R"),T:gt(x=>`0,0 ${x},0 ${x/2},${x}`,"T"),B:gt(x=>`${x/2},0 ${x},${x} 0,${x}`,"B")},se={L:gt((x,A)=>x-A+2,"L"),R:gt((x,A)=>x-2,"R"),T:gt((x,A)=>x-A+2,"T"),B:gt((x,A)=>x-2,"B")},Nr=gt(function(x){return Wt(x)?x==="L"?"R":"L":x==="T"?"B":"T"},"getOppositeArchitectureDirection"),Se=gt(function(x){const A=x;return A==="L"||A==="R"||A==="T"||A==="B"},"isArchitectureDirection"),Wt=gt(function(x){const A=x;return A==="L"||A==="R"},"isArchitectureDirectionX"),qt=gt(function(x){const A=x;return A==="T"||A==="B"},"isArchitectureDirectionY"),Ne=gt(function(x,A){const C=Wt(x)&&qt(A),R=qt(x)&&Wt(A);return C||R},"isArchitectureDirectionXY"),Lr=gt(function(x){const A=x[0],C=x[1],R=Wt(A)&&qt(C),N=qt(A)&&Wt(C);return R||N},"isArchitecturePairXY"),Cr=gt(function(x){return x!=="LL"&&x!=="RR"&&x!=="TT"&&x!=="BB"},"isValidArchitectureDirectionPair"),ye=gt(function(x,A){const C=`${x}${A}`;return Cr(C)?C:void 0},"getArchitectureDirectionPair"),wr=gt(function([x,A],C){const R=C[0],N=C[1];return Wt(R)?qt(N)?[x+(R==="L"?-1:1),A+(N==="T"?1:-1)]:[x+(R==="L"?-1:1),A]:Wt(N)?[x+(N==="L"?1:-1),A+(R==="T"?1:-1)]:[x,A+(R==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=gt(function(x){return x==="LT"||x==="TL"?[1,1]:x==="BL"||x==="LB"?[1,-1]:x==="BR"||x==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Mr=gt(function(x,A){return Ne(x,A)?"bend":Wt(x)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Or=gt(function(x){return x.type==="service"},"isArchitectureService"),Dr=gt(function(x){return x.type==="junction"},"isArchitectureJunction"),Pe=gt(x=>x.data(),"edgeData"),ie=gt(x=>x.data(),"nodeData"),xr=or.architecture,ae,Ge=(ae=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Ke,this.getAccTitle=je,this.setDiagramTitle=_e,this.getDiagramTitle=tr,this.getAccDescription=er,this.setAccDescription=rr,this.clear()}setDiagramId(A){this.diagramId=A}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",ir()}addService({id:A,icon:C,in:R,title:N,iconText:v}){if(this.registeredIds[A]!==void 0)throw new Error(`The service id [${A}] is already in use by another ${this.registeredIds[A]}`);if(R!==void 0){if(A===R)throw new Error(`The service [${A}] cannot be placed within itself`);if(this.registeredIds[R]===void 0)throw new Error(`The service [${A}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[R]==="node")throw new Error(`The service [${A}]'s parent is not a group`)}this.registeredIds[A]="node",this.nodes[A]={id:A,type:"service",icon:C,iconText:v,title:N,edges:[],in:R}}getServices(){return Object.values(this.nodes).filter(Or)}addJunction({id:A,in:C}){if(this.registeredIds[A]!==void 0)throw new Error(`The junction id [${A}] is already in use by another ${this.registeredIds[A]}`);if(C!==void 0){if(A===C)throw new Error(`The junction [${A}] cannot be placed within itself`);if(this.registeredIds[C]===void 0)throw new Error(`The junction [${A}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[C]==="node")throw new Error(`The junction [${A}]'s parent is not a group`)}this.registeredIds[A]="node",this.nodes[A]={id:A,type:"junction",edges:[],in:C}}getJunctions(){return Object.values(this.nodes).filter(Dr)}getNodes(){return Object.values(this.nodes)}getNode(A){return this.nodes[A]??null}addGroup({id:A,icon:C,in:R,title:N}){if(this.registeredIds?.[A]!==void 0)throw new Error(`The group id [${A}] is already in use by another ${this.registeredIds[A]}`);if(R!==void 0){if(A===R)throw new Error(`The group [${A}] cannot be placed within itself`);if(this.registeredIds?.[R]===void 0)throw new Error(`The group [${A}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[R]==="node")throw new Error(`The group [${A}]'s parent is not a group`)}this.registeredIds[A]="group",this.groups[A]={id:A,icon:C,title:N,in:R}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:A,rhsId:C,lhsDir:R,rhsDir:N,lhsInto:v,rhsInto:h,lhsGroup:a,rhsGroup:r,title:i}){if(!Se(R))throw new Error(`Invalid direction given for left hand side of edge ${A}--${C}. Expected (L,R,T,B) got ${String(R)}`);if(!Se(N))throw new Error(`Invalid direction given for right hand side of edge ${A}--${C}. Expected (L,R,T,B) got ${String(N)}`);if(this.nodes[A]===void 0&&this.groups[A]===void 0)throw new Error(`The left-hand id [${A}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[C]===void 0&&this.groups[C]===void 0)throw new Error(`The right-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes[A].in,e=this.nodes[C].in;if(a&&f&&e&&f==e)throw new Error(`The left-hand id [${A}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(r&&f&&e&&f==e)throw new Error(`The right-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const g={lhsId:A,lhsDir:R,lhsInto:v,lhsGroup:a,rhsId:C,rhsDir:N,rhsInto:h,rhsGroup:r,title:i};this.edges.push(g),this.nodes[A]&&this.nodes[C]&&(this.nodes[A].edges.push(this.edges[this.edges.length-1]),this.nodes[C].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(A){if(A.members.length<2)throw new Error(`An align directive requires at least two members; got ${A.members.length}`);const C=new Set;A.members.forEach(R=>{if(this.registeredIds[R]!=="node")throw new Error(`align ${A.direction} references [${R}], which is not a service or junction`);if(C.has(R))throw new Error(`align ${A.direction} lists [${R}] more than once`);C.add(R)}),this.layoutHints.push(A)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const A={},C=Object.entries(this.nodes).reduce((r,[i,f])=>(r[i]=f.edges.reduce((e,g)=>{const t=this.getNode(g.lhsId)?.in,s=this.getNode(g.rhsId)?.in;if(t&&s&&t!==s){const n=Mr(g.lhsDir,g.rhsDir);n!=="bend"&&(A[t]??={},A[t][s]=n,A[s]??={},A[s][t]=n)}if(g.lhsId===i){const n=ye(g.lhsDir,g.rhsDir);n&&(e[n]=g.rhsId)}else{const n=ye(g.rhsDir,g.lhsDir);n&&(e[n]=g.lhsId)}return e},{}),r),{}),R=Object.keys(C)[0],N={[R]:1},v=Object.keys(C).reduce((r,i)=>i===R?r:{...r,[i]:1},{}),h=gt(r=>{const i={[r]:[0,0]},f=[r];for(;f.length>0;){const e=f.shift();if(e){N[e]=1,delete v[e];const g=C[e],[t,s]=i[e];Object.entries(g).forEach(([n,c])=>{N[c]||(i[c]=wr([t,s],n),f.push(c))})}}return i},"BFS"),a=[h(R)];for(;Object.keys(v).length>0;)a.push(h(Object.keys(v)[0]));this.dataStructures={adjList:C,spatialMaps:a,groupAlignments:A}}return this.dataStructures}setElementForId(A,C){this.elements[A]=C}getElementById(A){return this.elements[A]}getConfig(){return ar({...xr,...nr().architecture})}getConfigField(A){return this.getConfig()[A]}},gt(ae,"ArchitectureDB"),ae),Ir=gt((x,A)=>{Ze(x,A),x.groups.map(C=>A.addGroup(C)),x.services.map(C=>A.addService({...C,type:"service"})),x.junctions.map(C=>A.addJunction({...C,type:"junction"})),x.edges.map(C=>A.addEdge(C)),x.alignments?.map(C=>A.addLayoutHint({direction:C.direction,members:[...C.members]}))},"populateDb"),Ue={parser:{yy:void 0},parse:gt(async x=>{const A=await gr("architecture",x);Fe.debug(A);const C=Ue.parser?.yy;if(!(C instanceof Ge))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ir(A,C)},"parse")},Rr=gt(x=>` .edge { stroke-width: ${x.archEdgeWidth}; stroke: ${x.archEdgeColor}; fill: none; } .arrow { fill: ${x.archEdgeArrowColor}; } .node-bkg { fill: none; stroke: ${x.archGroupBorderColor}; stroke-width: ${x.archGroupBorderWidth}; stroke-dasharray: 8; } .node-icon-text { display: flex; align-items: center; } .node-icon-text > div { color: #fff; margin: 1px; height: fit-content; text-align: center; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; } `,"getStyles"),Sr=Rr;function me(x,A){if(x===0)return A();const C=Math.random;let R=x>>>0;Math.random=function(){R=R+1831565813>>>0;let N=R;return N=Math.imul(N^N>>>15,N|1),N^=N+Math.imul(N^N>>>7,N|61),((N^N>>>14)>>>0)/4294967296};try{return A()}finally{Math.random=C}}gt(me,"withSeededRandom");var re=gt(x=>`${x}`,"wrapIcon"),ne={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:re('')},server:{body:re('')},disk:{body:re('')},internet:{body:re('')},cloud:{body:re('')},unknown:cr,blank:{body:re("")}}},Fr=gt(async function(x,A,C,R){const N=C.getConfigField("padding"),v=C.getConfigField("iconSize"),h=v/2,a=v/6,r=a/2;await Promise.all(A.edges().map(async i=>{const{source:f,sourceDir:e,sourceArrow:g,sourceGroup:t,target:s,targetDir:n,targetArrow:c,targetGroup:l,label:T}=Pe(i);let{x:u,y:d}=i[0].sourceEndpoint();const{x:L,y:b}=i[0].midpoint();let{x:w,y:G}=i[0].targetEndpoint();const B=N+4;if(t&&(Wt(e)?u+=e==="L"?-B:B:d+=e==="T"?-B:B+18),l&&(Wt(n)?w+=n==="L"?-B:B:G+=n==="T"?-B:B+18),!t&&C.getNode(f)?.type==="junction"&&(Wt(e)?u+=e==="L"?h:-h:d+=e==="T"?h:-h),!l&&C.getNode(s)?.type==="junction"&&(Wt(n)?w+=n==="L"?h:-h:G+=n==="T"?h:-h),i[0]._private.rscratch){const U=x.insert("g");if(U.insert("path").attr("d",`M ${u},${d} L ${L},${b} L${w},${G} `).attr("class","edge").attr("id",`${R}-${lr(f,s,{prefix:"L"})}`),g){const V=Wt(e)?se[e](u,a):u-r,M=qt(e)?se[e](d,a):d-r;U.insert("polygon").attr("points",Re[e](a)).attr("transform",`translate(${V},${M})`).attr("class","arrow")}if(c){const V=Wt(n)?se[n](w,a):w-r,M=qt(n)?se[n](G,a):G-r;U.insert("polygon").attr("points",Re[n](a)).attr("transform",`translate(${V},${M})`).attr("class","arrow")}if(T){const V=Ne(e,n)?"XY":Wt(e)?"X":"Y";let M=0;V==="X"?M=Math.abs(u-w):V==="Y"?M=Math.abs(d-G)/1.5:M=Math.abs(u-w)/2;const _=U.append("g");if(await Te(_,T,{useHtmlLabels:!1,width:M,classes:"architecture-service-label"},Ee()),_.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),V==="X")_.attr("transform","translate("+L+", "+b+")");else if(V==="Y")_.attr("transform","translate("+L+", "+b+") rotate(-90)");else if(V==="XY"){const o=ye(e,n);if(o&&Lr(o)){const E=_.node().getBoundingClientRect(),[p,m]=Ar(o);_.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*p*m*45})`);const y=_.node().getBoundingClientRect();_.attr("transform",` translate(${L}, ${b-E.height/2}) translate(${p*y.width/2}, ${m*y.height/2}) rotate(${-1*p*m*45}, 0, ${E.height/2}) `)}}}}}))},"drawEdges"),br=gt(async function(x,A,C,R){const v=C.getConfigField("padding")*.75,h=C.getConfigField("fontSize"),r=C.getConfigField("iconSize")/2;await Promise.all(A.nodes().map(async i=>{const f=ie(i);if(f.type==="group"){const{h:e,w:g,x1:t,y1:s}=i.boundingBox(),n=x.append("rect");n.attr("id",`${R}-group-${f.id}`).attr("x",t+r).attr("y",s+r).attr("width",g).attr("height",e).attr("class","node-bkg");const c=x.append("g");let l=t,T=s;if(f.icon){const u=c.append("g");u.html(`${await pe(f.icon,{height:v,width:v,fallbackPrefix:ne.prefix})}`),u.attr("transform","translate("+(l+r+1)+", "+(T+r+1)+")"),l+=v,T+=h/2-1-2}if(f.label){const u=c.append("g");await Te(u,f.label,{useHtmlLabels:!1,width:g,classes:"architecture-service-label"},Ee()),u.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),u.attr("transform","translate("+(l+r+4)+", "+(T+r+2)+")")}C.setElementForId(f.id,n)}}))},"drawGroups"),Pr=gt(async function(x,A,C,R){const N=Ee();for(const v of C){const h=A.append("g"),a=x.getConfigField("iconSize");if(v.title){const e=h.append("g");await Te(e,v.title,{useHtmlLabels:!1,width:a*1.5,classes:"architecture-service-label"},N),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),e.attr("transform","translate("+a/2+", "+a+")")}const r=h.append("g");if(v.icon)r.html(`${await pe(v.icon,{height:a,width:a,fallbackPrefix:ne.prefix})}`);else if(v.iconText){r.html(`${await pe("blank",{height:a,width:a,fallbackPrefix:ne.prefix})}`);const t=r.append("g").append("foreignObject").attr("width",a).attr("height",a).append("div").attr("class","node-icon-text").attr("style",`height: ${a}px;`).append("div").html(sr(v.iconText,N)),s=parseInt(window.getComputedStyle(t.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;t.attr("style",`-webkit-line-clamp: ${Math.floor((a-2)/s)};`)}else r.append("path").attr("class","node-bkg").attr("id",`${R}-node-${v.id}`).attr("d",`M0,${a} V5 Q0,0 5,0 H${a-5} Q${a},0 ${a},5 V${a} Z`);h.attr("id",`${R}-service-${v.id}`).attr("class","architecture-service");const{width:i,height:f}=h.node().getBBox();v.width=i,v.height=f,x.setElementForId(v.id,h)}return 0},"drawServices"),Gr=gt(function(x,A,C,R){C.forEach(N=>{const v=A.append("g"),h=x.getConfigField("iconSize");v.append("g").append("rect").attr("id",`${R}-node-${N.id}`).attr("fill-opacity","0").attr("width",h).attr("height",h),v.attr("class","architecture-junction");const{width:r,height:i}=v._groups[0][0].getBBox();v.width=r,v.height=i,x.setElementForId(N.id,v)})},"drawJunctions");fr([{name:ne.prefix,icons:ne}]);be.use(Tr);function Ye(x,A,C){x.forEach(R=>{A.add({group:"nodes",data:{type:"service",id:R.id,icon:R.icon,label:R.title,parent:R.in,width:C.getConfigField("iconSize"),height:C.getConfigField("iconSize")},classes:"node-service"})})}gt(Ye,"addServices");function Xe(x,A,C){x.forEach(R=>{A.add({group:"nodes",data:{type:"junction",id:R.id,parent:R.in,width:C.getConfigField("iconSize"),height:C.getConfigField("iconSize")},classes:"node-junction"})})}gt(Xe,"addJunctions");function He(x,A){A.nodes().map(C=>{const R=ie(C);if(R.type==="group")return;R.x=C.position().x,R.y=C.position().y,x.getElementById(R.id).attr("transform","translate("+(R.x||0)+","+(R.y||0)+")")})}gt(He,"positionNodes");function We(x,A){x.forEach(C=>{A.add({group:"nodes",data:{type:"group",id:C.id,icon:C.icon,label:C.title,parent:C.in},classes:"node-group"})})}gt(We,"addGroups");function Ve(x,A){x.forEach(C=>{const{lhsId:R,rhsId:N,lhsInto:v,lhsGroup:h,rhsInto:a,lhsDir:r,rhsDir:i,rhsGroup:f,title:e}=C,g=Ne(C.lhsDir,C.rhsDir)?"segments":"straight",t={id:`${R}-${N}`,label:e,source:R,sourceDir:r,sourceArrow:v,sourceGroup:h,sourceEndpoint:r==="L"?"0 50%":r==="R"?"100% 50%":r==="T"?"50% 0":"50% 100%",target:N,targetDir:i,targetArrow:a,targetGroup:f,targetEndpoint:i==="L"?"0 50%":i==="R"?"100% 50%":i==="T"?"50% 0":"50% 100%"};A.add({group:"edges",data:t,classes:g})})}gt(Ve,"addEdges");function ze(x,A,C,R=[]){const N=gt((g,t)=>Object.entries(g).reduce((s,[n,c])=>{let l=0;const T=Object.entries(c);if(T.length===1)return s[n]=T[0][1],s;for(let u=0;u{const t={},s={};return Object.entries(g).forEach(([n,[c,l]])=>{const T=x.getNode(n)?.in??"default";t[l]??={},t[l][T]??=[],t[l][T].push(n),s[c]??={},s[c][T]??=[],s[c][T].push(n)}),{horiz:Object.values(N(t,"horizontal")).filter(n=>n.length>1),vert:Object.values(N(s,"vertical")).filter(n=>n.length>1)}}),[h,a]=v.reduce(([g,t],{horiz:s,vert:n})=>[[...g,...s],[...t,...n]],[[],[]]),r=new Set;R.forEach(g=>g.members.forEach(t=>r.add(t)));const i=gt(g=>g.filter(t=>!t.some(s=>r.has(s))),"dropOverlapping"),f=i(h),e=i(a);return R.forEach(g=>{g.members.length<2||(g.direction==="row"?f.push([...g.members]):e.push([...g.members]))}),{horizontal:f,vertical:e}}gt(ze,"getAlignments");function Be(x,A,C=[]){const R=[],N=A.getConfigField("iconSize"),v=A.getConfigField("idealEdgeLengthMultiplier"),h=v*N,a=new Set;C.forEach(f=>{for(let e=0;e`${f[0]},${f[1]}`,"posToStr"),i=gt(f=>f.split(",").map(e=>parseInt(e)),"strToPos");return x.forEach(f=>{const e=Object.fromEntries(Object.entries(f).map(([n,c])=>[r(c),n])),g=[r([0,0])],t={},s={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;g.length>0;){const n=g.shift();if(n){t[n]=1;const c=e[n];if(c){const l=i(n);Object.entries(s).forEach(([T,u])=>{const d=r([l[0]+u[0],l[1]+u[1]]),L=e[d];if(L&&!t[d]){if(g.push(d),a.has(`${c}|${L}`))return;R.push({[Ie[T]]:L,[Ie[Nr(T)]]:c,gap:v*N})}})}}}}),R}gt(Be,"getRelativeConstraints");function $e(x,A,C,R,N,{spatialMaps:v,groupAlignments:h}){return new Promise(a=>{const r=hr("body").append("div").attr("id","cy").attr("style","display:none"),i=be({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge[label]",style:{label:"data(label)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${N.getConfigField("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${N.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});r.remove(),We(C,i),Ye(x,i,N),Xe(A,i,N),Ve(R,i);const f=N.getLayoutHints(),e=ze(N,v,h,f),g=Be(v,N,f),t=N.getConfigField("iconSize"),s=N.getConfigField("idealEdgeLengthMultiplier")*t,n=.5*t,c=N.getConfigField("edgeElasticity"),l=N.getConfigField("seed"),T=i.layout({name:"fcose",quality:"proof",randomize:N.getConfigField("randomize"),nodeSeparation:N.getConfigField("nodeSeparation"),numIter:N.getConfigField("numIter"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(u){const[d,L]=u.connectedNodes(),{parent:b}=ie(d),{parent:w}=ie(L);return b===w?s:n},edgeElasticity(u){const[d,L]=u.connectedNodes(),{parent:b}=ie(d),{parent:w}=ie(L);return b===w?c:.001},alignmentConstraint:e,relativePlacementConstraint:g});T.one("layoutstop",()=>{function u(d,L,b,w){let G,B;const{x:U,y:V}=d,{x:M,y:_}=L;B=(w-V+(U-b)*(V-_)/(U-M))/Math.sqrt(1+Math.pow((V-_)/(U-M),2)),G=Math.sqrt(Math.pow(w-V,2)+Math.pow(b-U,2)-Math.pow(B,2));const o=Math.sqrt(Math.pow(M-U,2)+Math.pow(_-V,2));G=G/o;let E=(M-U)*(w-V)-(_-V)*(b-U);switch(!0){case E>=0:E=1;break;case E<0:E=-1;break}let p=(M-U)*(b-U)+(_-V)*(w-V);switch(!0){case p>=0:p=1;break;case p<0:p=-1;break}return B=Math.abs(B)*E,G=G*p,{distances:B,weights:G}}gt(u,"getSegmentWeights"),i.startBatch();for(const d of Object.values(i.edges()))if(d.data?.()){const{x:L,y:b}=d.source().position(),{x:w,y:G}=d.target().position();if(L!==w&&b!==G){const B=d.sourceEndpoint(),U=d.targetEndpoint(),{sourceDir:V}=Pe(d),[M,_]=qt(V)?[B.x,U.y]:[U.x,B.y],{weights:o,distances:E}=u(B,U,M,_);d.style("segment-distances",E),d.style("segment-weights",o)}}i.endBatch(),me(l,()=>T.run())});try{me(l,()=>T.run())}catch(u){throw u instanceof RangeError&&u.message.includes("Invalid array length")?new Error("Architecture layout failed: a declared `align row|column` directive likely contradicts the edge directions, or two declared alignments overlap on a shared node. Check that the order of members in each `align` chain is consistent with the edges between them, and that no node appears in two `align` directives along the same axis."):u}i.ready(u=>{Fe.info("Ready",u),a(i)})})}gt($e,"layoutArchitecture");var Ur=gt(async(x,A,C,R)=>{const N=R.db;N.setDiagramId(A);const v=N.getServices(),h=N.getJunctions(),a=N.getGroups(),r=N.getEdges(),i=N.getDataStructures(),f=Qe(A),e=f.append("g");e.attr("class","architecture-edges");const g=f.append("g");g.attr("class","architecture-services");const t=f.append("g");t.attr("class","architecture-groups"),await Pr(N,g,v,A),Gr(N,g,h,A);const s=await $e(v,h,a,r,N,i);await Fr(e,s,N,A),await br(t,s,N,A),He(N,s),Je(void 0,f,N.getConfigField("padding"),N.getConfigField("useMaxWidth"))},"draw"),Yr={draw:Ur},Br={parser:Ue,get db(){return new Ge},renderer:Yr,styles:Sr};export{Br as diagram};