import{aJ as ke,_ as dt,L as Ze,af as qe,l as Se,b as Qe,a as Je,q as Ke,t as je,g as _e,s as tr,A as er,H as rr,F as ir,I as ar,c as Ee,am as me,aK as pe,i as nr,d as or,y as sr,aL as hr,aM as lr}from"./mermaid.core.FcP8wBwW.js";import{p as fr}from"./chunk-4BX2VUAB.DRMGnluz.js";import{p as cr}from"./wardley-RL74JXVD.BA-8CGC6.js";import{c as Fe}from"./cytoscape.esm.BM_eiZzj.js";import"./framework.C2AwuPrQ.js";import"./min.CT2il0xb.js";import"./baseUniq.CeiE9d8M.js";var he={exports:{}},le={exports:{}},fe={exports:{}},gr=fe.exports,Me;function ur(){return Me||(Me=1,(function(I,O){(function(b,L){I.exports=L()})(gr,function(){return(function(A){var b={};function L(u){if(b[u])return b[u].exports;var h=b[u]={i:u,l:!1,exports:{}};return A[u].call(h.exports,h,h.exports,L),h.l=!0,h.exports}return L.m=A,L.c=b,L.i=function(u){return u},L.d=function(u,h,a){L.o(u,h)||Object.defineProperty(u,h,{configurable:!1,enumerable:!0,get:a})},L.n=function(u){var h=u&&u.__esModule?function(){return u.default}:function(){return u};return L.d(h,"a",h),h},L.o=function(u,h){return Object.prototype.hasOwnProperty.call(u,h)},L.p="",L(L.s=28)})([(function(A,b,L){function u(){}u.QUALITY=1,u.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,u.DEFAULT_INCREMENTAL=!1,u.DEFAULT_ANIMATION_ON_LAYOUT=!0,u.DEFAULT_ANIMATION_DURING_LAYOUT=!1,u.DEFAULT_ANIMATION_PERIOD=50,u.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,u.DEFAULT_GRAPH_MARGIN=15,u.NODE_DIMENSIONS_INCLUDE_LABELS=!1,u.SIMPLE_NODE_SIZE=40,u.SIMPLE_NODE_HALF_SIZE=u.SIMPLE_NODE_SIZE/2,u.EMPTY_COMPOUND_NODE_SIZE=40,u.MIN_EDGE_LENGTH=1,u.WORLD_BOUNDARY=1e6,u.INITIAL_WORLD_BOUNDARY=u.WORLD_BOUNDARY/1e3,u.WORLD_CENTER_X=1200,u.WORLD_CENTER_Y=900,A.exports=u}),(function(A,b,L){var u=L(2),h=L(8),a=L(9);function e(f,r,d){u.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=f,this.target=r}e.prototype=Object.create(u.prototype);for(var i in u)e[i]=u[i];e.prototype.getSource=function(){return this.source},e.prototype.getTarget=function(){return this.target},e.prototype.isInterGraph=function(){return this.isInterGraph},e.prototype.getLength=function(){return this.length},e.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},e.prototype.getBendpoints=function(){return this.bendpoints},e.prototype.getLca=function(){return this.lca},e.prototype.getSourceInLca=function(){return this.sourceInLca},e.prototype.getTargetInLca=function(){return this.targetInLca},e.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"},e.prototype.getOtherEndInGraph=function(f,r){for(var d=this.getOtherEnd(f),t=r.getGraphManager().getRoot();;){if(d.getOwner()==r)return d;if(d.getOwner()==t)break;d=d.getOwner().getParent()}return null},e.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))},e.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)},A.exports=e}),(function(A,b,L){function u(h){this.vGraphObject=h}A.exports=u}),(function(A,b,L){var u=L(2),h=L(10),a=L(13),e=L(0),i=L(16),f=L(5);function r(t,s,o,c){o==null&&c==null&&(c=s),u.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,o!=null&&s!=null?this.rect=new a(s.x,s.y,o.width,o.height):this.rect=new a}r.prototype=Object.create(u.prototype);for(var d in u)r[d]=u[d];r.prototype.getEdges=function(){return this.edges},r.prototype.getChild=function(){return this.child},r.prototype.getOwner=function(){return this.owner},r.prototype.getWidth=function(){return this.rect.width},r.prototype.setWidth=function(t){this.rect.width=t},r.prototype.getHeight=function(){return this.rect.height},r.prototype.setHeight=function(t){this.rect.height=t},r.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},r.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},r.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},r.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},r.prototype.getRect=function(){return this.rect},r.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},r.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},r.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},r.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},r.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},r.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},r.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},r.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},r.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},r.prototype.withChildren=function(){var t=new Set,s,o;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(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},r.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},r.prototype.transform=function(t){var s=this.rect.x;s>e.WORLD_BOUNDARY?s=e.WORLD_BOUNDARY:s<-e.WORLD_BOUNDARY&&(s=-e.WORLD_BOUNDARY);var o=this.rect.y;o>e.WORLD_BOUNDARY?o=e.WORLD_BOUNDARY:o<-e.WORLD_BOUNDARY&&(o=-e.WORLD_BOUNDARY);var c=new f(s,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},r.prototype.getLeft=function(){return this.rect.x},r.prototype.getRight=function(){return this.rect.x+this.rect.width},r.prototype.getTop=function(){return this.rect.y},r.prototype.getBottom=function(){return this.rect.y+this.rect.height},r.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=r}),(function(A,b,L){var u=L(0);function h(){}for(var a in u)h[a]=u[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,A.exports=h}),(function(A,b,L){function u(h,a){h==null&&a==null?(this.x=0,this.y=0):(this.x=h,this.y=a)}u.prototype.getX=function(){return this.x},u.prototype.getY=function(){return this.y},u.prototype.setX=function(h){this.x=h},u.prototype.setY=function(h){this.y=h},u.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},u.prototype.getCopy=function(){return new u(this.x,this.y)},u.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},A.exports=u}),(function(A,b,L){var u=L(2),h=L(10),a=L(0),e=L(7),i=L(3),f=L(1),r=L(13),d=L(12),t=L(11);function s(c,l,T){u.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 e?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(u.prototype);for(var o in u)s[o]=u[o];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 g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var v=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:(v.source=l,v.target=T,v.isInterGraph=!1,this.getEdges().push(v),l.edges.push(v),T!=l&&T.edges.push(v),v)}},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(),g,v=T.length,N=0;N-1&&U>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(C,1),g.target!=g.source&&g.target.edges.splice(U,1);var P=g.source.owner.getEdges().indexOf(g);if(P==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(P,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,g,v,N=this.getNodes(),P=N.length,C=0;CT&&(c=T),l>g&&(l=g)}return c==h.MAX_VALUE?null:(N[0].getParent().paddingLeft!=null?v=N[0].getParent().paddingLeft:v=this.margin,this.left=l-v,this.top=c-v,new d(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,v=-h.MAX_VALUE,N,P,C,U,k,X=this.nodes,J=X.length,D=0;DN&&(l=N),TC&&(g=C),vN&&(l=N),TC&&(g=C),v=this.nodes.length){var J=0;T.forEach(function(D){D.owner==c&&J++}),J==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,b,L){var u,h=L(1);function a(e){u=L(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),i=this.layout.newNode(null),f=this.add(e,i);return this.setRootGraph(f),this.rootGraph},a.prototype.add=function(e,i,f,r,d){if(f==null&&r==null&&d==null){if(e==null)throw"Graph is null!";if(i==null)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),e.parent!=null)throw"Already has a parent!";if(i.child!=null)throw"Already has a child!";return e.parent=i,i.child=e,e}else{d=f,r=i,f=e;var t=r.getOwner(),s=d.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,r,d);if(f.isInterGraph=!0,f.source=r,f.target=d,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(e){if(e instanceof u){var i=e;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 r,d=f.length,t=0;t=e.getRight()?i[0]+=Math.min(e.getX()-a.getX(),a.getRight()-e.getRight()):e.getX()<=a.getX()&&e.getRight()>=a.getRight()&&(i[0]+=Math.min(a.getX()-e.getX(),e.getRight()-a.getRight())),a.getY()<=e.getY()&&a.getBottom()>=e.getBottom()?i[1]+=Math.min(e.getY()-a.getY(),a.getBottom()-e.getBottom()):e.getY()<=a.getY()&&e.getBottom()>=a.getBottom()&&(i[1]+=Math.min(a.getY()-e.getY(),e.getBottom()-a.getBottom()));var d=Math.abs((e.getCenterY()-a.getCenterY())/(e.getCenterX()-a.getCenterX()));e.getCenterY()===a.getCenterY()&&e.getCenterX()===a.getCenterX()&&(d=1);var t=d*i[0],s=i[1]/d;i[0]t)return i[0]=f,i[1]=o,i[2]=d,i[3]=X,!1;if(rd)return i[0]=s,i[1]=r,i[2]=U,i[3]=t,!1;if(fd?(i[0]=l,i[1]=T,n=!0):(i[0]=c,i[1]=o,n=!0):p===y&&(f>d?(i[0]=s,i[1]=o,n=!0):(i[0]=g,i[1]=T,n=!0)),-E===y?d>f?(i[2]=k,i[3]=X,m=!0):(i[2]=U,i[3]=C,m=!0):E===y&&(d>f?(i[2]=P,i[3]=C,m=!0):(i[2]=J,i[3]=X,m=!0)),n&&m)return!1;if(f>d?r>t?(R=this.getCardinalDirection(p,y,4),w=this.getCardinalDirection(E,y,2)):(R=this.getCardinalDirection(-p,y,3),w=this.getCardinalDirection(-E,y,1)):r>t?(R=this.getCardinalDirection(-p,y,1),w=this.getCardinalDirection(-E,y,3)):(R=this.getCardinalDirection(p,y,2),w=this.getCardinalDirection(E,y,4)),!n)switch(R){case 1:W=o,S=f+-N/y,i[0]=S,i[1]=W;break;case 2:S=g,W=r+v*y,i[0]=S,i[1]=W;break;case 3:W=T,S=f+N/y,i[0]=S,i[1]=W;break;case 4:S=l,W=r+-v*y,i[0]=S,i[1]=W;break}if(!m)switch(w){case 1:q=C,x=d+-rt/y,i[2]=x,i[3]=q;break;case 2:x=J,q=t+D*y,i[2]=x,i[3]=q;break;case 3:q=X,x=d+rt/y,i[2]=x,i[3]=q;break;case 4:x=k,q=t+-D*y,i[2]=x,i[3]=q;break}}return!1},h.getCardinalDirection=function(a,e,i){return a>e?i:1+i%4},h.getIntersection=function(a,e,i,f){if(f==null)return this.getIntersection2(a,e,i);var r=a.x,d=a.y,t=e.x,s=e.y,o=i.x,c=i.y,l=f.x,T=f.y,g=void 0,v=void 0,N=void 0,P=void 0,C=void 0,U=void 0,k=void 0,X=void 0,J=void 0;return N=s-d,C=r-t,k=t*d-r*s,P=T-c,U=o-l,X=l*c-o*T,J=N*U-P*C,J===0?null:(g=(C*X-U*k)/J,v=(P*k-N*X)/J,new u(g,v))},h.angleOfVector=function(a,e,i,f){var r=void 0;return a!==i?(r=Math.atan((f-e)/(i-a)),i=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),g=(-o-Math.sqrt(o*o-4*s*c))/(2*s),v=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:v}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,A.exports=h}),(function(A,b,L){function u(){}u.sign=function(h){return h>0?1:h<0?-1:0},u.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},u.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},A.exports=u}),(function(A,b,L){function u(){}u.MAX_VALUE=2147483647,u.MIN_VALUE=-2147483648,A.exports=u}),(function(A,b,L){var u=(function(){function r(d,t){for(var s=0;s"u"?"undefined":u(a);return a==null||e!="object"&&e!="function"},A.exports=h}),(function(A,b,L){function u(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c0&&c;){for(N.push(C[0]);N.length>0&&c;){var U=N[0];N.splice(0,1),v.add(U);for(var k=U.getEdges(),g=0;g-1&&C.splice(rt,1)}v=new Set,P=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(l),g=0;g=0&&c.splice(X,1);var J=P.getNeighborsList();J.forEach(function(n){if(l.indexOf(n)<0){var m=T.get(n),p=m-1;p==1&&U.push(n),T.set(n,p)}})}l=l.concat(U),(c.length==1||c.length==2)&&(g=!0,v=c[0])}return v},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,b,L){function u(){}u.seed=1,u.x=0,u.nextDouble=function(){return u.x=Math.sin(u.seed++)*1e4,u.x-Math.floor(u.x)},A.exports=u}),(function(A,b,L){var u=L(5);function h(a,e){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 e=0,i=this.lworldExtX;return i!=0&&(e=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/i),e},h.prototype.transformY=function(a){var e=0,i=this.lworldExtY;return i!=0&&(e=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/i),e},h.prototype.inverseTransformX=function(a){var e=0,i=this.ldeviceExtX;return i!=0&&(e=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/i),e},h.prototype.inverseTransformY=function(a){var e=0,i=this.ldeviceExtY;return i!=0&&(e=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/i),e},h.prototype.inverseTransformPoint=function(a){var e=new u(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return e},A.exports=h}),(function(A,b,L){function u(t){if(Array.isArray(t)){for(var s=0,o=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()},r.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,g=this.getAllNodes(),v;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),v=new Set,o=0;oN||v>N)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(N=s.getEstimatedSize()*this.compoundGravityRangeFactor,(g>N||v>N)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},r.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||N>=g[0].length)){for(var P=0;Pr}}]),i})();A.exports=e}),(function(A,b,L){function u(){}u.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,r=Math.min(this.m-1,this.n),d=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;E--)if(this.s[E]!==0){for(var y=E+1;y=0;V--){if((function(Tt,Ct){return Tt&&Ct})(V0;){var Q=void 0,It=void 0;for(Q=n-2;Q>=-1&&Q!==-1;Q--)if(Math.abs(e[Q])<=ht+_*(Math.abs(this.s[Q])+Math.abs(this.s[Q+1]))){e[Q]=0;break}if(Q===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=Q&&Nt!==Q;Nt--){var vt=(Nt!==n?Math.abs(e[Nt]):0)+(Nt!==Q+1?Math.abs(e[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+_*vt){this.s[Nt]=0;break}}Nt===Q?It=3:Nt===n-1?It=1:(It=2,Q=Nt)}switch(Q++,It){case 1:{var it=e[n-2];e[n-2]=0;for(var gt=n-2;gt>=Q;gt--){var mt=u.hypot(this.s[gt],it),At=this.s[gt]/mt,Ot=it/mt;this.s[gt]=mt,gt!==Q&&(it=-Ot*e[gt-1],e[gt-1]=At*e[gt-1]);for(var Et=0;Et=this.s[Q+1]);){var Lt=this.s[Q];if(this.s[Q]=this.s[Q+1],this.s[Q+1]=Lt,QMath.abs(a)?(e=a/h,e=Math.abs(h)*Math.sqrt(1+e*e)):a!=0?(e=h/a,e=Math.abs(a)*Math.sqrt(1+e*e)):e=0,e},A.exports=u}),(function(A,b,L){var u=(function(){function e(i,f){for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,e),this.sequence1=i,this.sequence2=f,this.match_score=r,this.mismatch_penalty=d,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===e&&this.listeners.splice(i,1)}},h.emit=function(a,e){for(var i=0;i{var b={45:((a,e,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,e,i)=>{var f=i(551).FDLayoutConstants;function r(){}for(var d in f)r[d]=f[d];r.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,r.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,r.DEFAULT_COMPONENT_SEPERATION=60,r.TILE=!0,r.TILING_PADDING_VERTICAL=10,r.TILING_PADDING_HORIZONTAL=10,r.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,r.ENFORCE_CONSTRAINTS=!0,r.APPLY_LAYOUT=!0,r.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,r.TREE_REDUCTION_ON_INCREMENTAL=!0,r.PURE_INCREMENTAL=r.DEFAULT_INCREMENTAL,a.exports=r}),767:((a,e,i)=>{var f=i(551).FDLayoutEdge;function r(t,s,o){f.call(this,t,s,o)}r.prototype=Object.create(f.prototype);for(var d in f)r[d]=f[d];a.exports=r}),880:((a,e,i)=>{var f=i(551).LGraph;function r(t,s,o){f.call(this,t,s,o)}r.prototype=Object.create(f.prototype);for(var d in f)r[d]=f[d];a.exports=r}),578:((a,e,i)=>{var f=i(551).LGraphManager;function r(t){f.call(this,t)}r.prototype=Object.create(f.prototype);for(var d in f)r[d]=f[d];a.exports=r}),765:((a,e,i)=>{var f=i(551).FDLayout,r=i(578),d=i(880),t=i(991),s=i(767),o=i(806),c=i(902),l=i(551).FDLayoutConstants,T=i(551).LayoutConstants,g=i(551).Point,v=i(551).PointD,N=i(551).DimensionD,P=i(551).Layout,C=i(551).Integer,U=i(551).IGeometry,k=i(551).LGraph,X=i(551).Transform,J=i(551).LinkedList;function D(){f.call(this),this.toBeTiled={},this.constraints={}}D.prototype=Object.create(f.prototype);for(var rt in f)D[rt]=f[rt];D.prototype.newGraphManager=function(){var n=new r(this);return this.graphManager=n,n},D.prototype.newGraph=function(n){return new d(null,this.graphManager,n)},D.prototype.newNode=function(n){return new t(this.graphManager,n)},D.prototype.newEdge=function(n){return new s(null,null,n)},D.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.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)},D.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},D.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},D.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(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(R){return m.has(R)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(E){return m.has(E)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},D.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 n=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),o.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()),o.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,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),m={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(E.fixedNodeWeight=R)}}if(this.constraints.relativePlacementConstraint){var w=new Map,S=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(M){n.fixedNodesOnHorizontal.add(M),n.fixedNodesOnVertical.add(M)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*M.length/3;_--)H=Math.floor(Math.random()*(_+1)),B=M[_],M[_]=M[H],M[H]=B;return M},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(M){if(M.left){var H=w.has(M.left)?w.get(M.left):M.left,B=w.has(M.right)?w.get(M.right):M.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes(B)||(n.nodesInRelativeHorizontal.push(B),n.nodeToRelativeConstraintMapHorizontal.set(B,[]),n.dummyToNodeForVerticalAlignment.has(B)?n.nodeToTempPositionMapHorizontal.set(B,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(B)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(B,n.idToNodeMap.get(B).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:B,gap:M.gap}),n.nodeToRelativeConstraintMapHorizontal.get(B).push({left:H,gap:M.gap})}else{var _=S.has(M.top)?S.get(M.top):M.top,ht=S.has(M.bottom)?S.get(M.bottom):M.bottom;n.nodesInRelativeVertical.includes(_)||(n.nodesInRelativeVertical.push(_),n.nodeToRelativeConstraintMapVertical.set(_,[]),n.dummyToNodeForHorizontalAlignment.has(_)?n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(_,n.idToNodeMap.get(_).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(_).push({bottom:ht,gap:M.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:_,gap:M.gap})}});else{var q=new Map,V=new Map;this.constraints.relativePlacementConstraint.forEach(function(M){if(M.left){var H=w.has(M.left)?w.get(M.left):M.left,B=w.has(M.right)?w.get(M.right):M.right;q.has(H)?q.get(H).push(B):q.set(H,[B]),q.has(B)?q.get(B).push(H):q.set(B,[H])}else{var _=S.has(M.top)?S.get(M.top):M.top,ht=S.has(M.bottom)?S.get(M.bottom):M.bottom;V.has(_)?V.get(_).push(ht):V.set(_,[ht]),V.has(ht)?V.get(ht).push(_):V.set(ht,[_])}});var Y=function(H,B){var _=[],ht=[],Q=new J,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){_[Nt]=[],ht[Nt]=!1;var gt=it;for(Q.push(gt),It.add(gt),_[Nt].push(gt);Q.length!=0;){gt=Q.shift(),B.has(gt)&&(ht[Nt]=!0);var mt=H.get(gt);mt.forEach(function(At){It.has(At)||(Q.push(At),It.add(At),_[Nt].push(At))})}Nt++}}),{components:_,isFixed:ht}},et=Y(q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=et.components,this.fixedComponentsOnHorizontal=et.isFixed;var z=Y(V,n.fixedNodesOnVertical);this.componentsOnVertical=z.components,this.fixedComponentsOnVertical=z.isFixed}}},D.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(z){var M=n.idToNodeMap.get(z.nodeId);M.displacementX=0,M.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var m=this.constraints.alignmentConstraint.vertical,p=0;p1){var S;for(S=0;SE&&(E=Math.floor(w.y)),R=Math.floor(w.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(T.WORLD_CENTER_X-w.x/2,T.WORLD_CENTER_Y-w.y/2))},D.radialLayout=function(n,m,p){var E=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(m,null,0,359,0,E);var y=k.calculateBounds(n),R=new X;R.setDeviceOrgX(y.getMinX()),R.setDeviceOrgY(y.getMinY()),R.setWorldOrgX(p.x),R.setWorldOrgY(p.y);for(var w=0;w1;){var B=H[0];H.splice(0,1);var _=V.indexOf(B);_>=0&&V.splice(_,1),z--,Y--}m!=null?M=(V.indexOf(H[0])+1)%z:M=0;for(var ht=Math.abs(E-p)/Y,Q=M;et!=Y;Q=++Q%z){var It=V[Q].getOtherEnd(n);if(It!=m){var Nt=(p+et*ht)%360,vt=(Nt+ht)%360;D.branchRadialLayout(It,n,Nt,vt,y+R,R),et++}}},D.maxDiagonalInTree=function(n){for(var m=C.MIN_VALUE,p=0;pm&&(m=y)}return m},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var n=this,m={};this.memberGroups={},this.idToDummyNode={};for(var p=[],E=this.graphManager.getAllNodes(),y=0;y"u"&&(m[S]=[]),m[S]=m[S].concat(R)}Object.keys(m).forEach(function(W){if(m[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=m[W];var q=m[W][0].getParent(),V=new t(n.graphManager);V.id=x,V.paddingLeft=q.paddingLeft||0,V.paddingRight=q.paddingRight||0,V.paddingBottom=q.paddingBottom||0,V.paddingTop=q.paddingTop||0,n.idToDummyNode[x]=V;var Y=n.getGraphManager().add(n.newGraph(),V),et=q.getChild();et.add(V);for(var z=0;zy?(E.rect.x-=(E.labelWidth-y)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-y)/2):E.labelPosHorizontal=="right"&&E.setWidth(y+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(R+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>R?(E.rect.y-=(E.labelHeight-R)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-R)/2):E.labelPosVertical=="bottom"&&E.setHeight(R+E.labelHeight))}})},D.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var m=this.compoundOrder[n],p=m.id,E=m.paddingLeft,y=m.paddingTop,R=m.labelMarginLeft,w=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],m.rect.x,m.rect.y,E,y,R,w)}},D.prototype.repopulateZeroDegreeMembers=function(){var n=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(p){var E=n.idToDummyNode[p],y=E.paddingLeft,R=E.paddingTop,w=E.labelMarginLeft,S=E.labelMarginTop;n.adjustLocations(m[p],E.rect.x,E.rect.y,y,R,w,S)})},D.prototype.getToBeTiled=function(n){var m=n.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var p=n.getChild();if(p==null)return this.toBeTiled[m]=!1,!1;for(var E=p.getNodes(),y=0;y0)return this.toBeTiled[m]=!1,!1;if(R.getChild()==null){this.toBeTiled[R.id]=!1;continue}if(!this.getToBeTiled(R))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},D.prototype.getNodeDegree=function(n){n.id;for(var m=n.getEdges(),p=0,E=0;Eq&&(q=Y.rect.height)}p+=q+n.verticalPadding}},D.prototype.tileCompoundMembers=function(n,m){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(E){var y=m[E];if(p.tiledMemberPack[E]=p.tileNodes(n[E],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[E].width,y.rect.height=p.tiledMemberPack[E].height,y.setCenter(p.tiledMemberPack[E].centerX,p.tiledMemberPack[E].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var R=y.rect.width,w=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(R+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>R?(y.rect.x-=(y.labelWidth-R)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-R)/2):y.labelPosHorizontal=="right"&&y.setWidth(R+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(w+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>w?(y.rect.y-=(y.labelHeight-w)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-w)/2):y.labelPosVertical=="bottom"&&y.setHeight(w+y.labelHeight))}})},D.prototype.tileNodes=function(n,m){var p=this.tileNodesByFavoringDim(n,m,!0),E=this.tileNodesByFavoringDim(n,m,!1),y=this.getOrgRatio(p),R=this.getOrgRatio(E),w;return RS&&(S=z.getWidth())});var W=R/y,x=w/y,q=Math.pow(p-E,2)+4*(W+E)*(x+p)*y,V=(E-p+Math.sqrt(q))/(2*(W+E)),Y;m?(Y=Math.ceil(V),Y==V&&Y++):Y=Math.floor(V);var et=Y*(W+E)-E;return S>et&&(et=S),et+=E*2,et},D.prototype.tileNodesByFavoringDim=function(n,m,p){var E=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,R=o.TILING_COMPARE_BY,w={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:y,centerX:0,centerY:0};R&&(w.idealRowWidth=this.calcIdealRowWidth(n,p));var S=function(M){return M.rect.width*M.rect.height},W=function(M,H){return S(H)-S(M)};n.sort(function(z,M){var H=W;return w.idealRowWidth?(H=R,H(z.id,M.id)):H(z,M)});for(var x=0,q=0,V=0;V0&&(w+=n.horizontalPadding),n.rowWidth[p]=w,n.width0&&(S+=n.verticalPadding);var W=0;S>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=S,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(m)},D.prototype.getShortestRowIndex=function(n){for(var m=-1,p=Number.MAX_VALUE,E=0;Ep&&(m=E,p=n.rowWidth[E]);return m},D.prototype.canAddHorizontal=function(n,m,p){if(n.idealRowWidth){var E=n.rows.length-1,y=n.rowWidth[E];return y+m+n.horizontalPadding<=n.idealRowWidth}var R=this.getShortestRowIndex(n);if(R<0)return!0;var w=n.rowWidth[R];if(w+n.horizontalPadding+m<=n.width)return!0;var S=0;n.rowHeight[R]0&&(S=p+n.verticalPadding-n.rowHeight[R]);var W;n.width-w>=m+n.horizontalPadding?W=(n.height+S)/(w+m+n.horizontalPadding):W=(n.height+S)/n.width,S=p+n.verticalPadding;var x;return n.widthR&&m!=p){E.splice(-1,1),n.rows[p].push(y),n.rowWidth[m]=n.rowWidth[m]-R,n.rowWidth[p]=n.rowWidth[p]+R,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var w=Number.MIN_VALUE,S=0;Sw&&(w=E[S].height);m>0&&(w+=n.verticalPadding);var W=n.rowHeight[m]+n.rowHeight[p];n.rowHeight[m]=w,n.rowHeight[p]0)for(var et=y;et<=R;et++)Y[0]+=this.grid[et][w-1].length+this.grid[et][w].length-1;if(R0)for(var et=w;et<=S;et++)Y[3]+=this.grid[y-1][et].length+this.grid[y][et].length-1;for(var z=C.MAX_VALUE,M,H,B=0;B{var f=i(551).FDLayoutNode,r=i(551).IMath;function d(s,o,c,l){f.call(this,s,o,c,l)}d.prototype=Object.create(f.prototype);for(var t in f)d[t]=f[t];d.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*r.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*r.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},d.prototype.propogateDisplacementToChildren=function(s,o){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){$=="horizontal"?(tt.set(st,g.has(st)?v[g.get(st)]:Z.get(st)),Lt+=tt.get(st)):(tt.set(st,g.has(st)?N[g.get(st)]:Z.get(st)),Lt+=tt.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||tt.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){$=="horizontal"?ft+=g.has(st)?v[g.get(st)]:Z.get(st):ft+=g.has(st)?N[g.get(st)]:Z.get(st)}),ft=ft/lt.length,lt.forEach(function(st){tt.set(st,ft)})}});for(var wt=function(){var ot=ut.shift(),Lt=G.get(ot);Lt.forEach(function(ft){if(tt.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;tt.set(te,tt.get(te)+ce)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return tt},rt=function(G){var $=0,K=0,Z=0,at=0;if(G.forEach(function(j){j.left?v[g.get(j.left)]-v[g.get(j.right)]>=0?$++:K++:N[g.get(j.top)]-N[g.get(j.bottom)]>=0?Z++:at++}),$>K&&Z>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var tt=0;tt1)l.fixedNodeConstraint.forEach(function(F,G){E[G]=[F.position.x,F.position.y],y[G]=[v[g.get(F.nodeId)],N[g.get(F.nodeId)]]}),R=!0;else if(l.alignmentConstraint)(function(){var F=0;if(l.alignmentConstraint.vertical){for(var G=l.alignmentConstraint.vertical,$=function(tt){var j=new Set;G[tt].forEach(function(pt){j.add(pt)});var ut=new Set([].concat(f(j)).filter(function(pt){return S.has(pt)})),wt=void 0;ut.size>0?wt=v[g.get(ut.values().next().value)]:wt=J(j).x,G[tt].forEach(function(pt){E[F]=[wt,N[g.get(pt)]],y[F]=[v[g.get(pt)],N[g.get(pt)]],F++})},K=0;K0?wt=v[g.get(ut.values().next().value)]:wt=J(j).y,Z[tt].forEach(function(pt){E[F]=[v[g.get(pt)],wt],y[F]=[v[g.get(pt)],N[g.get(pt)]],F++})},ct=0;ctV&&(V=q[et].length,Y=et);if(V0){var Et={x:0,y:0};l.fixedNodeConstraint.forEach(function(F,G){var $={x:v[g.get(F.nodeId)],y:N[g.get(F.nodeId)]},K=F.position,Z=X(K,$);Et.x+=Z.x,Et.y+=Z.y}),Et.x/=l.fixedNodeConstraint.length,Et.y/=l.fixedNodeConstraint.length,v.forEach(function(F,G){v[G]+=Et.x}),N.forEach(function(F,G){N[G]+=Et.y}),l.fixedNodeConstraint.forEach(function(F){v[g.get(F.nodeId)]=F.position.x,N[g.get(F.nodeId)]=F.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(G){var $=new Set;Dt[G].forEach(function(at){$.add(at)});var K=new Set([].concat(f($)).filter(function(at){return S.has(at)})),Z=void 0;K.size>0?Z=v[g.get(K.values().next().value)]:Z=J($).x,$.forEach(function(at){S.has(at)||(v[g.get(at)]=Z)})},Ht=0;Ht0?Z=N[g.get(K.values().next().value)]:Z=J($).y,$.forEach(function(at){S.has(at)||(N[g.get(at)]=Z)})},Ft=0;Ft{a.exports=A})},L={};function u(a){var e=L[a];if(e!==void 0)return e.exports;var i=L[a]={exports:{}};return b[a](i,i.exports,u),i.exports}var h=u(45);return h})()})})(le)),le.exports}var pr=he.exports,De;function yr(){return De||(De=1,(function(I,O){(function(b,L){I.exports=L(vr())})(pr,function(A){return(()=>{var b={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(e){for(var i=arguments.length,f=Array(i>1?i-1:0),r=1;r{var f=(function(){function t(s,o){var c=[],l=!0,T=!1,g=void 0;try{for(var v=s[Symbol.iterator](),N;!(l=(N=v.next()).done)&&(c.push(N.value),!(o&&c.length===o));l=!0);}catch(P){T=!0,g=P}finally{try{!l&&v.return&&v.return()}finally{if(T)throw g}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),r=i(140).layoutBase.LinkedList,d={};d.getTopMostNodes=function(t){for(var s={},o=0;o0&&R.merge(x)});for(var w=0;w1){N=g[0],P=N.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),k),X},d.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var v=!0,N=!1,P=void 0;try{for(var C=s.nodeIndexes[Symbol.iterator](),U;!(v=(U=C.next()).done);v=!0){var k=U.value,X=f(k,2),J=X[0],D=X[1],rt=o.cy.getElementById(J);if(rt){var n=rt.boundingBox(),m=s.xCoords[D]-n.w/2,p=s.xCoords[D]+n.w/2,E=s.yCoords[D]-n.h/2,y=s.yCoords[D]+n.h/2;ml&&(l=p),Eg&&(g=y)}}}catch(x){N=!0,P=x}finally{try{!v&&C.return&&C.return()}finally{if(N)throw P}}var R=t.x-(l+c)/2,w=t.y-(g+T)/2;s.xCoords=s.xCoords.map(function(x){return x+R}),s.yCoords=s.yCoords.map(function(x){return x+w})}else{Object.keys(s).forEach(function(x){var q=s[x],V=q.getRect().x,Y=q.getRect().x+q.getRect().width,et=q.getRect().y,z=q.getRect().y+q.getRect().height;Vl&&(l=Y),etg&&(g=z)});var S=t.x-(l+c)/2,W=t.y-(g+T)/2;Object.keys(s).forEach(function(x){var q=s[x];q.setCenter(q.getCenterX()+S,q.getCenterY()+W)})}}},d.calcBoundingBox=function(t,s,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,v=Number.MIN_SAFE_INTEGER,N=void 0,P=void 0,C=void 0,U=void 0,k=t.descendants().not(":parent"),X=k.length,J=0;JN&&(l=N),TC&&(g=C),v{var f=i(548),r=i(140).CoSELayout,d=i(140).CoSENode,t=i(140).layoutBase.PointD,s=i(140).layoutBase.DimensionD,o=i(140).layoutBase.LayoutConstants,c=i(140).layoutBase.FDLayoutConstants,l=i(140).CoSEConstants,T=function(v,N){var P=v.cy,C=v.eles,U=C.nodes(),k=C.edges(),X=void 0,J=void 0,D=void 0,rt={};v.randomize&&(X=N.nodeIndexes,J=N.xCoords,D=N.yCoords);var n=function(x){return typeof x=="function"},m=function(x,q){return n(x)?x(q):x},p=f.calcParentsWithoutChildren(P,C),E=function W(x,q,V,Y){for(var et=q.length,z=0;z0){var Q=void 0;Q=V.getGraphManager().add(V.newGraph(),B),W(Q,H,V,Y)}}},y=function(x,q,V){for(var Y=0,et=0,z=0;z0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=Y/et:n(v.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=v.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},R=function(x,q){q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=q.fixedNodeConstraint),q.alignmentConstraint&&(x.constraints.alignmentConstraint=q.alignmentConstraint),q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=q.relativePlacementConstraint)};v.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=v.nestingFactor),v.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=v.gravity),v.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=v.numIter),v.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=v.gravityRange),v.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=v.gravityCompound),v.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=v.gravityRangeCompound),v.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=v.initialEnergyOnIncremental),v.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=v.tilingCompareBy),v.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=v.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!v.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=v.animate,l.TILE=v.tile,l.TILING_PADDING_VERTICAL=typeof v.tilingPaddingVertical=="function"?v.tilingPaddingVertical.call():v.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof v.tilingPaddingHorizontal=="function"?v.tilingPaddingHorizontal.call():v.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!v.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=v.uniformNodeDimensions,v.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),v.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),v.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),v.step=="all"&&(v.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),v.fixedNodeConstraint||v.alignmentConstraint||v.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var w=new r,S=w.newGraphManager();return E(S.addRoot(),f.getTopMostNodes(U),w,v),y(w,S,k),R(w,v),w.runLayout(),rt};a.exports={coseLayout:T}}),212:((a,e,i)=>{var f=(function(){function v(N,P){for(var C=0;C0)if(p){var R=t.getTopMostNodes(C.eles.nodes());if(D=t.connectComponents(U,C.eles,R),D.forEach(function(vt){var it=vt.boundingBox();rt.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),C.randomize&&D.forEach(function(vt){C.eles=vt,X.push(o(C))}),C.quality=="default"||C.quality=="proof"){var w=U.collection();if(C.tile){var S=new Map,W=[],x=[],q=0,V={nodeIndexes:S,xCoords:W,yCoords:x},Y=[];if(D.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(gt,mt){w.merge(vt.nodes()[mt]),gt.isParent()||(V.nodeIndexes.set(vt.nodes()[mt].id(),q++),V.xCoords.push(vt.nodes()[0].position().x),V.yCoords.push(vt.nodes()[0].position().y))}),Y.push(it))}),w.length>1){var et=w.boundingBox();rt.push({x:et.x1+et.w/2,y:et.y1+et.h/2}),D.push(w),X.push(V);for(var z=Y.length-1;z>=0;z--)D.splice(Y[z],1),X.splice(Y[z],1),rt.splice(Y[z],1)}}D.forEach(function(vt,it){C.eles=vt,J.push(l(C,X[it])),t.relocateComponent(rt[it],J[it],C)})}else D.forEach(function(vt,it){t.relocateComponent(rt[it],X[it],C)});var M=new Set;if(D.length>1){var H=[],B=k.filter(function(vt){return vt.css("display")=="none"});D.forEach(function(vt,it){var gt=void 0;if(C.quality=="draft"&&(gt=X[it].nodeIndexes),vt.nodes().not(B).length>0){var mt={};mt.edges=[],mt.nodes=[];var At=void 0;vt.nodes().not(B).forEach(function(Ot){if(C.quality=="draft")if(!Ot.isParent())At=gt.get(Ot.id()),mt.nodes.push({x:X[it].xCoords[At]-Ot.boundingbox().w/2,y:X[it].yCoords[At]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var Et=t.calcBoundingBox(Ot,X[it].xCoords,X[it].yCoords,gt);mt.nodes.push({x:Et.topLeftX,y:Et.topLeftY,width:Et.width,height:Et.height})}else J[it][Ot.id()]&&mt.nodes.push({x:J[it][Ot.id()].getLeft(),y:J[it][Ot.id()].getTop(),width:J[it][Ot.id()].getWidth(),height:J[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var Et=Ot.source(),Dt=Ot.target();if(Et.css("display")!="none"&&Dt.css("display")!="none")if(C.quality=="draft"){var Rt=gt.get(Et.id()),Ht=gt.get(Dt.id()),Ut=[],Pt=[];if(Et.isParent()){var Ft=t.calcBoundingBox(Et,X[it].xCoords,X[it].yCoords,gt);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(X[it].xCoords[Rt]),Ut.push(X[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,X[it].xCoords,X[it].yCoords,gt);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(X[it].xCoords[Ht]),Pt.push(X[it].yCoords[Ht]);mt.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else J[it][Et.id()]&&J[it][Dt.id()]&&mt.edges.push({startX:J[it][Et.id()].getCenterX(),startY:J[it][Et.id()].getCenterY(),endX:J[it][Dt.id()].getCenterX(),endY:J[it][Dt.id()].getCenterY()})}),mt.nodes.length>0&&(H.push(mt),M.add(it))}});var _=m.packComponents(H,C.randomize).shifts;if(C.quality=="draft")X.forEach(function(vt,it){var gt=vt.xCoords.map(function(At){return At+_[it].dx}),mt=vt.yCoords.map(function(At){return At+_[it].dy});vt.xCoords=gt,vt.yCoords=mt});else{var ht=0;M.forEach(function(vt){Object.keys(J[vt]).forEach(function(it){var gt=J[vt][it];gt.setCenter(gt.getCenterX()+_[ht].dx,gt.getCenterY()+_[ht].dy)}),ht++})}}}else{var E=C.eles.boundingBox();if(rt.push({x:E.x1+E.w/2,y:E.y1+E.h/2}),C.randomize){var y=o(C);X.push(y)}C.quality=="default"||C.quality=="proof"?(J.push(l(C,X[0])),t.relocateComponent(rt[0],J[0],C)):t.relocateComponent(rt[0],X[0],C)}var Q=function(it,gt){if(C.quality=="default"||C.quality=="proof"){typeof it=="number"&&(it=gt);var mt=void 0,At=void 0,Ot=it.data("id");return J.forEach(function(Dt){Ot in Dt&&(mt={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},At=Dt[Ot])}),C.nodeDimensionsIncludeLabels&&(At.labelWidth&&(At.labelPosHorizontal=="left"?mt.x+=At.labelWidth/2:At.labelPosHorizontal=="right"&&(mt.x-=At.labelWidth/2)),At.labelHeight&&(At.labelPosVertical=="top"?mt.y+=At.labelHeight/2:At.labelPosVertical=="bottom"&&(mt.y-=At.labelHeight/2))),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}else{var Et=void 0;return X.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(Et={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}};if(C.quality=="default"||C.quality=="proof"||C.randomize){var It=t.calcParentsWithoutChildren(U,k),Nt=k.filter(function(vt){return vt.css("display")=="none"});C.eles=k.not(Nt),k.nodes().not(":parent").not(Nt).layoutPositions(P,C,Q),It.length>0&&It.forEach(function(vt){vt.position(Q(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),v})();a.exports=g}),657:((a,e,i)=>{var f=i(548),r=i(140).layoutBase.Matrix,d=i(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),g=l.nodes(":parent"),v=new Map,N=new Map,P=new Map,C=[],U=[],k=[],X=[],J=[],D=[],rt=[],n=[],m=void 0,p=1e8,E=1e-9,y=o.piTol,R=o.samplingType,w=o.nodeSeparation,S=void 0,W=function(){for(var G=0,$=0,K=!1;$=at;){nt=Z[at++];for(var xt=C[nt],lt=0;ltut&&(ut=J[Lt],wt=Lt)}return wt},q=function(G){var $=void 0;if(G){$=Math.floor(Math.random()*m);for(var Z=0;Z=1)break;j=tt}for(var pt=0;pt=1)break;j=tt}for(var lt=0;lt0&&($.isParent()?C[G].push(P.get($.id())):C[G].push($.id()))})});var Nt=function(G){var $=N.get(G),K=void 0;v.get(G).forEach(function(Z){c.getElementById(Z).isParent()?K=P.get(Z):K=Z,C[$].push(K),C[N.get(K)].push(G)})},vt=!0,it=!1,gt=void 0;try{for(var mt=v.keys()[Symbol.iterator](),At;!(vt=(At=mt.next()).done);vt=!0){var Ot=At.value;Nt(Ot)}}catch(F){it=!0,gt=F}finally{try{!vt&&mt.return&&mt.return()}finally{if(it)throw gt}}m=N.size;var Et=void 0;if(m>2){S=m{var f=i(212),r=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&r(cytoscape),a.exports=r}),140:(a=>{a.exports=A})},L={};function u(a){var e=L[a];if(e!==void 0)return e.exports;var i=L[a]={exports:{}};return b[a](i,i.exports,u),i.exports}var h=u(579);return h})()})})(he)),he.exports}var Er=yr();const mr=ke(Er);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:dt(I=>`${I},${I/2} 0,${I} 0,0`,"L"),R:dt(I=>`0,${I/2} ${I},0 ${I},${I}`,"R"),T:dt(I=>`0,0 ${I},0 ${I/2},${I}`,"T"),B:dt(I=>`${I/2},0 ${I},${I} 0,${I}`,"B")},se={L:dt((I,O)=>I-O+2,"L"),R:dt((I,O)=>I-2,"R"),T:dt((I,O)=>I-O+2,"T"),B:dt((I,O)=>I-2,"B")},Tr=dt(function(I){return Wt(I)?I==="L"?"R":"L":I==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=dt(function(I){const O=I;return O==="L"||O==="R"||O==="T"||O==="B"},"isArchitectureDirection"),Wt=dt(function(I){const O=I;return O==="L"||O==="R"},"isArchitectureDirectionX"),qt=dt(function(I){const O=I;return O==="T"||O==="B"},"isArchitectureDirectionY"),Te=dt(function(I,O){const A=Wt(I)&&qt(O),b=qt(I)&&Wt(O);return A||b},"isArchitectureDirectionXY"),Nr=dt(function(I){const O=I[0],A=I[1],b=Wt(O)&&qt(A),L=qt(O)&&Wt(A);return b||L},"isArchitecturePairXY"),Lr=dt(function(I){return I!=="LL"&&I!=="RR"&&I!=="TT"&&I!=="BB"},"isValidArchitectureDirectionPair"),ye=dt(function(I,O){const A=`${I}${O}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=dt(function([I,O],A){const b=A[0],L=A[1];return Wt(b)?qt(L)?[I+(b==="L"?-1:1),O+(L==="T"?1:-1)]:[I+(b==="L"?-1:1),O]:Wt(L)?[I+(L==="L"?1:-1),O+(b==="T"?1:-1)]:[I,O+(b==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),Ar=dt(function(I){return I==="LT"||I==="TL"?[1,1]:I==="BL"||I==="LB"?[1,-1]:I==="BR"||I==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),wr=dt(function(I,O){return Te(I,O)?"bend":Wt(I)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=dt(function(I){return I.type==="service"},"isArchitectureService"),Or=dt(function(I){return I.type==="junction"},"isArchitectureJunction"),be=dt(I=>I.data(),"edgeData"),ie=dt(I=>I.data(),"nodeData"),Dr=ar.architecture,ae,Pe=(ae=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Qe,this.getAccTitle=Je,this.setDiagramTitle=Ke,this.getDiagramTitle=je,this.getAccDescription=_e,this.setAccDescription=tr,this.clear()}setDiagramId(O){this.diagramId=O}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",er()}addService({id:O,icon:A,in:b,title:L,iconText:u}){if(this.registeredIds[O]!==void 0)throw new Error(`The service id [${O}] is already in use by another ${this.registeredIds[O]}`);if(b!==void 0){if(O===b)throw new Error(`The service [${O}] cannot be placed within itself`);if(this.registeredIds[b]===void 0)throw new Error(`The service [${O}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[b]==="node")throw new Error(`The service [${O}]'s parent is not a group`)}this.registeredIds[O]="node",this.nodes[O]={id:O,type:"service",icon:A,iconText:u,title:L,edges:[],in:b}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:O,in:A}){if(this.registeredIds[O]!==void 0)throw new Error(`The junction id [${O}] is already in use by another ${this.registeredIds[O]}`);if(A!==void 0){if(O===A)throw new Error(`The junction [${O}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The junction [${O}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[A]==="node")throw new Error(`The junction [${O}]'s parent is not a group`)}this.registeredIds[O]="node",this.nodes[O]={id:O,type:"junction",edges:[],in:A}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(O){return this.nodes[O]??null}addGroup({id:O,icon:A,in:b,title:L}){if(this.registeredIds?.[O]!==void 0)throw new Error(`The group id [${O}] is already in use by another ${this.registeredIds[O]}`);if(b!==void 0){if(O===b)throw new Error(`The group [${O}] cannot be placed within itself`);if(this.registeredIds?.[b]===void 0)throw new Error(`The group [${O}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[b]==="node")throw new Error(`The group [${O}]'s parent is not a group`)}this.registeredIds[O]="group",this.groups[O]={id:O,icon:A,title:L,in:b}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:O,rhsId:A,lhsDir:b,rhsDir:L,lhsInto:u,rhsInto:h,lhsGroup:a,rhsGroup:e,title:i}){if(!Re(b))throw new Error(`Invalid direction given for left hand side of edge ${O}--${A}. Expected (L,R,T,B) got ${String(b)}`);if(!Re(L))throw new Error(`Invalid direction given for right hand side of edge ${O}--${A}. Expected (L,R,T,B) got ${String(L)}`);if(this.nodes[O]===void 0&&this.groups[O]===void 0)throw new Error(`The left-hand id [${O}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[A]===void 0&&this.groups[A]===void 0)throw new Error(`The right-hand id [${A}] does not yet exist. Please create the service/group before declaring an edge to it.`);const f=this.nodes[O].in,r=this.nodes[A].in;if(a&&f&&r&&f==r)throw new Error(`The left-hand id [${O}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(e&&f&&r&&f==r)throw new Error(`The right-hand id [${A}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const d={lhsId:O,lhsDir:b,lhsInto:u,lhsGroup:a,rhsId:A,rhsDir:L,rhsInto:h,rhsGroup:e,title:i};this.edges.push(d),this.nodes[O]&&this.nodes[A]&&(this.nodes[O].edges.push(this.edges[this.edges.length-1]),this.nodes[A].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){const O={},A=Object.entries(this.nodes).reduce((e,[i,f])=>(e[i]=f.edges.reduce((r,d)=>{const t=this.getNode(d.lhsId)?.in,s=this.getNode(d.rhsId)?.in;if(t&&s&&t!==s){const o=wr(d.lhsDir,d.rhsDir);o!=="bend"&&(O[t]??={},O[t][s]=o,O[s]??={},O[s][t]=o)}if(d.lhsId===i){const o=ye(d.lhsDir,d.rhsDir);o&&(r[o]=d.rhsId)}else{const o=ye(d.rhsDir,d.lhsDir);o&&(r[o]=d.lhsId)}return r},{}),e),{}),b=Object.keys(A)[0],L={[b]:1},u=Object.keys(A).reduce((e,i)=>i===b?e:{...e,[i]:1},{}),h=dt(e=>{const i={[e]:[0,0]},f=[e];for(;f.length>0;){const r=f.shift();if(r){L[r]=1,delete u[r];const d=A[r],[t,s]=i[r];Object.entries(d).forEach(([o,c])=>{L[c]||(i[c]=Cr([t,s],o),f.push(c))})}}return i},"BFS"),a=[h(b)];for(;Object.keys(u).length>0;)a.push(h(Object.keys(u)[0]));this.dataStructures={adjList:A,spatialMaps:a,groupAlignments:O}}return this.dataStructures}setElementForId(O,A){this.elements[O]=A}getElementById(O){return this.elements[O]}getConfig(){return rr({...Dr,...ir().architecture})}getConfigField(O){return this.getConfig()[O]}},dt(ae,"ArchitectureDB"),ae),xr=dt((I,O)=>{fr(I,O),I.groups.map(A=>O.addGroup(A)),I.services.map(A=>O.addService({...A,type:"service"})),I.junctions.map(A=>O.addJunction({...A,type:"junction"})),I.edges.map(A=>O.addEdge(A))},"populateDb"),Ge={parser:{yy:void 0},parse:dt(async I=>{const O=await cr("architecture",I);Se.debug(O);const A=Ge.parser?.yy;if(!(A instanceof Pe))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.");xr(O,A)},"parse")},Ir=dt(I=>` .edge { stroke-width: ${I.archEdgeWidth}; stroke: ${I.archEdgeColor}; fill: none; } .arrow { fill: ${I.archEdgeArrowColor}; } .node-bkg { fill: none; stroke: ${I.archGroupBorderColor}; stroke-width: ${I.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"),Rr=Ir,re=dt(I=>`${I}`,"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:lr,blank:{body:re("")}}},Sr=dt(async function(I,O,A,b){const L=A.getConfigField("padding"),u=A.getConfigField("iconSize"),h=u/2,a=u/6,e=a/2;await Promise.all(O.edges().map(async i=>{const{source:f,sourceDir:r,sourceArrow:d,sourceGroup:t,target:s,targetDir:o,targetArrow:c,targetGroup:l,label:T}=be(i);let{x:g,y:v}=i[0].sourceEndpoint();const{x:N,y:P}=i[0].midpoint();let{x:C,y:U}=i[0].targetEndpoint();const k=L+4;if(t&&(Wt(r)?g+=r==="L"?-k:k:v+=r==="T"?-k:k+18),l&&(Wt(o)?C+=o==="L"?-k:k:U+=o==="T"?-k:k+18),!t&&A.getNode(f)?.type==="junction"&&(Wt(r)?g+=r==="L"?h:-h:v+=r==="T"?h:-h),!l&&A.getNode(s)?.type==="junction"&&(Wt(o)?C+=o==="L"?h:-h:U+=o==="T"?h:-h),i[0]._private.rscratch){const X=I.insert("g");if(X.insert("path").attr("d",`M ${g},${v} L ${N},${P} L${C},${U} `).attr("class","edge").attr("id",`${b}-${sr(f,s,{prefix:"L"})}`),d){const J=Wt(r)?se[r](g,a):g-e,D=qt(r)?se[r](v,a):v-e;X.insert("polygon").attr("points",Ie[r](a)).attr("transform",`translate(${J},${D})`).attr("class","arrow")}if(c){const J=Wt(o)?se[o](C,a):C-e,D=qt(o)?se[o](U,a):U-e;X.insert("polygon").attr("points",Ie[o](a)).attr("transform",`translate(${J},${D})`).attr("class","arrow")}if(T){const J=Te(r,o)?"XY":Wt(r)?"X":"Y";let D=0;J==="X"?D=Math.abs(g-C):J==="Y"?D=Math.abs(v-U)/1.5:D=Math.abs(g-C)/2;const rt=X.append("g");if(await me(rt,T,{useHtmlLabels:!1,width:D,classes:"architecture-service-label"},Ee()),rt.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),J==="X")rt.attr("transform","translate("+N+", "+P+")");else if(J==="Y")rt.attr("transform","translate("+N+", "+P+") rotate(-90)");else if(J==="XY"){const n=ye(r,o);if(n&&Nr(n)){const m=rt.node().getBoundingClientRect(),[p,E]=Ar(n);rt.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*p*E*45})`);const y=rt.node().getBoundingClientRect();rt.attr("transform",` translate(${N}, ${P-m.height/2}) translate(${p*y.width/2}, ${E*y.height/2}) rotate(${-1*p*E*45}, 0, ${m.height/2}) `)}}}}}))},"drawEdges"),Fr=dt(async function(I,O,A,b){const u=A.getConfigField("padding")*.75,h=A.getConfigField("fontSize"),e=A.getConfigField("iconSize")/2;await Promise.all(O.nodes().map(async i=>{const f=ie(i);if(f.type==="group"){const{h:r,w:d,x1:t,y1:s}=i.boundingBox(),o=I.append("rect");o.attr("id",`${b}-group-${f.id}`).attr("x",t+e).attr("y",s+e).attr("width",d).attr("height",r).attr("class","node-bkg");const c=I.append("g");let l=t,T=s;if(f.icon){const g=c.append("g");g.html(`${await pe(f.icon,{height:u,width:u,fallbackPrefix:ne.prefix})}`),g.attr("transform","translate("+(l+e+1)+", "+(T+e+1)+")"),l+=u,T+=h/2-1-2}if(f.label){const g=c.append("g");await me(g,f.label,{useHtmlLabels:!1,width:d,classes:"architecture-service-label"},Ee()),g.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),g.attr("transform","translate("+(l+e+4)+", "+(T+e+2)+")")}A.setElementForId(f.id,o)}}))},"drawGroups"),br=dt(async function(I,O,A,b){const L=Ee();for(const u of A){const h=O.append("g"),a=I.getConfigField("iconSize");if(u.title){const r=h.append("g");await me(r,u.title,{useHtmlLabels:!1,width:a*1.5,classes:"architecture-service-label"},L),r.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),r.attr("transform","translate("+a/2+", "+a+")")}const e=h.append("g");if(u.icon)e.html(`${await pe(u.icon,{height:a,width:a,fallbackPrefix:ne.prefix})}`);else if(u.iconText){e.html(`${await pe("blank",{height:a,width:a,fallbackPrefix:ne.prefix})}`);const t=e.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(nr(u.iconText,L)),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 e.append("path").attr("class","node-bkg").attr("id",`${b}-node-${u.id}`).attr("d",`M0,${a} V5 Q0,0 5,0 H${a-5} Q${a},0 ${a},5 V${a} Z`);h.attr("id",`${b}-service-${u.id}`).attr("class","architecture-service");const{width:i,height:f}=h.node().getBBox();u.width=i,u.height=f,I.setElementForId(u.id,h)}return 0},"drawServices"),Pr=dt(function(I,O,A,b){A.forEach(L=>{const u=O.append("g"),h=I.getConfigField("iconSize");u.append("g").append("rect").attr("id",`${b}-node-${L.id}`).attr("fill-opacity","0").attr("width",h).attr("height",h),u.attr("class","architecture-junction");const{width:e,height:i}=u._groups[0][0].getBBox();u.width=e,u.height=i,I.setElementForId(L.id,u)})},"drawJunctions");hr([{name:ne.prefix,icons:ne}]);Fe.use(mr);function Ue(I,O,A){I.forEach(b=>{O.add({group:"nodes",data:{type:"service",id:b.id,icon:b.icon,label:b.title,parent:b.in,width:A.getConfigField("iconSize"),height:A.getConfigField("iconSize")},classes:"node-service"})})}dt(Ue,"addServices");function Ye(I,O,A){I.forEach(b=>{O.add({group:"nodes",data:{type:"junction",id:b.id,parent:b.in,width:A.getConfigField("iconSize"),height:A.getConfigField("iconSize")},classes:"node-junction"})})}dt(Ye,"addJunctions");function Xe(I,O){O.nodes().map(A=>{const b=ie(A);if(b.type==="group")return;b.x=A.position().x,b.y=A.position().y,I.getElementById(b.id).attr("transform","translate("+(b.x||0)+","+(b.y||0)+")")})}dt(Xe,"positionNodes");function He(I,O){I.forEach(A=>{O.add({group:"nodes",data:{type:"group",id:A.id,icon:A.icon,label:A.title,parent:A.in},classes:"node-group"})})}dt(He,"addGroups");function We(I,O){I.forEach(A=>{const{lhsId:b,rhsId:L,lhsInto:u,lhsGroup:h,rhsInto:a,lhsDir:e,rhsDir:i,rhsGroup:f,title:r}=A,d=Te(A.lhsDir,A.rhsDir)?"segments":"straight",t={id:`${b}-${L}`,label:r,source:b,sourceDir:e,sourceArrow:u,sourceGroup:h,sourceEndpoint:e==="L"?"0 50%":e==="R"?"100% 50%":e==="T"?"50% 0":"50% 100%",target:L,targetDir:i,targetArrow:a,targetGroup:f,targetEndpoint:i==="L"?"0 50%":i==="R"?"100% 50%":i==="T"?"50% 0":"50% 100%"};O.add({group:"edges",data:t,classes:d})})}dt(We,"addEdges");function Ve(I,O,A){const b=dt((a,e)=>Object.entries(a).reduce((i,[f,r])=>{let d=0;const t=Object.entries(r);if(t.length===1)return i[f]=t[0][1],i;for(let s=0;s{const e={},i={};return Object.entries(a).forEach(([f,[r,d]])=>{const t=I.getNode(f)?.in??"default";e[d]??={},e[d][t]??=[],e[d][t].push(f),i[r]??={},i[r][t]??=[],i[r][t].push(f)}),{horiz:Object.values(b(e,"horizontal")).filter(f=>f.length>1),vert:Object.values(b(i,"vertical")).filter(f=>f.length>1)}}),[u,h]=L.reduce(([a,e],{horiz:i,vert:f})=>[[...a,...i],[...e,...f]],[[],[]]);return{horizontal:u,vertical:h}}dt(Ve,"getAlignments");function ze(I,O){const A=[],b=dt(u=>`${u[0]},${u[1]}`,"posToStr"),L=dt(u=>u.split(",").map(h=>parseInt(h)),"strToPos");return I.forEach(u=>{const h=Object.fromEntries(Object.entries(u).map(([f,r])=>[b(r),f])),a=[b([0,0])],e={},i={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;a.length>0;){const f=a.shift();if(f){e[f]=1;const r=h[f];if(r){const d=L(f);Object.entries(i).forEach(([t,s])=>{const o=b([d[0]+s[0],d[1]+s[1]]),c=h[o];c&&!e[o]&&(a.push(o),A.push({[xe[t]]:c,[xe[Tr(t)]]:r,gap:1.5*O.getConfigField("iconSize")}))})}}}}),A}dt(ze,"getRelativeConstraints");function Be(I,O,A,b,L,{spatialMaps:u,groupAlignments:h}){return new Promise(a=>{const e=or("body").append("div").attr("id","cy").attr("style","display:none"),i=Fe({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":`${L.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:`${L.getConfigField("padding")}px`}}],layout:{name:"grid",boundingBox:{x1:0,x2:100,y1:0,y2:100}}});e.remove(),He(A,i),Ue(I,i,L),Ye(O,i,L),We(b,i);const f=Ve(L,u,h),r=ze(u,L),d=i.layout({name:"fcose",quality:"proof",randomize:L.getConfigField("randomize"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(t){const[s,o]=t.connectedNodes(),{parent:c}=ie(s),{parent:l}=ie(o);return c===l?1.5*L.getConfigField("iconSize"):.5*L.getConfigField("iconSize")},edgeElasticity(t){const[s,o]=t.connectedNodes(),{parent:c}=ie(s),{parent:l}=ie(o);return c===l?.45:.001},alignmentConstraint:f,relativePlacementConstraint:r});d.one("layoutstop",()=>{function t(s,o,c,l){let T,g;const{x:v,y:N}=s,{x:P,y:C}=o;g=(l-N+(v-c)*(N-C)/(v-P))/Math.sqrt(1+Math.pow((N-C)/(v-P),2)),T=Math.sqrt(Math.pow(l-N,2)+Math.pow(c-v,2)-Math.pow(g,2));const U=Math.sqrt(Math.pow(P-v,2)+Math.pow(C-N,2));T=T/U;let k=(P-v)*(l-N)-(C-N)*(c-v);switch(!0){case k>=0:k=1;break;case k<0:k=-1;break}let X=(P-v)*(c-v)+(C-N)*(l-N);switch(!0){case X>=0:X=1;break;case X<0:X=-1;break}return g=Math.abs(g)*k,T=T*X,{distances:g,weights:T}}dt(t,"getSegmentWeights"),i.startBatch();for(const s of Object.values(i.edges()))if(s.data?.()){const{x:o,y:c}=s.source().position(),{x:l,y:T}=s.target().position();if(o!==l&&c!==T){const g=s.sourceEndpoint(),v=s.targetEndpoint(),{sourceDir:N}=be(s),[P,C]=qt(N)?[g.x,v.y]:[v.x,g.y],{weights:U,distances:k}=t(g,v,P,C);s.style("segment-distances",k),s.style("segment-weights",U)}}i.endBatch(),d.run()}),d.run(),i.ready(t=>{Se.info("Ready",t),a(i)})})}dt(Be,"layoutArchitecture");var Gr=dt(async(I,O,A,b)=>{const L=b.db;L.setDiagramId(O);const u=L.getServices(),h=L.getJunctions(),a=L.getGroups(),e=L.getEdges(),i=L.getDataStructures(),f=Ze(O),r=f.append("g");r.attr("class","architecture-edges");const d=f.append("g");d.attr("class","architecture-services");const t=f.append("g");t.attr("class","architecture-groups"),await br(L,d,u,O),Pr(L,d,h,O);const s=await Be(u,h,a,e,L,i);await Sr(r,s,L,O),await Fr(t,s,L,O),Xe(L,s),qe(void 0,f,L.getConfigField("padding"),L.getConfigField("useMaxWidth"))},"draw"),Ur={draw:Gr},$r={parser:Ge,get db(){return new Pe},renderer:Ur,styles:Rr};export{$r as diagram};