import{a as tr}from"./chunk-AEOMTBSW.mjs";import{a as _e}from"./chunk-DKKBVRCY.mjs";import"./chunk-DU5LTGQ6.mjs";import"./chunk-6NTNNK5N.mjs";import"./chunk-RNJOYNJ4.mjs";import"./chunk-XGPFEOL4.mjs";import"./chunk-A34GCYZU.mjs";import"./chunk-W7ZLLLMY.mjs";import"./chunk-WSB5WSVC.mjs";import"./chunk-DJ7UZH7F.mjs";import{a as er}from"./chunk-267PNR3T.mjs";import{a as Ne}from"./chunk-7RZVMHOQ.mjs";import{a as He,b as We,c as ue,f as de}from"./chunk-BWNR3NKH.mjs";import{l as Ke,p as je}from"./chunk-2HR5LOFI.mjs";import"./chunk-XBXGYYE5.mjs";import{O as Ve,Q as ze,R as Be,S as $e,T as ke,U as Ze,V as Je,W as qe,Y as ge,j as Ye,s as Ue,z as Xe}from"./chunk-5YUVU3PZ.mjs";import{b as fe,h as Qe}from"./chunk-MGPAVIPZ.mjs";import"./chunk-TYMNRAUI.mjs";import"./chunk-FXACKDTF.mjs";import"./chunk-H3VCZNTA.mjs";import"./chunk-QU3B7NT4.mjs";import"./chunk-JIN56HTB.mjs";import{a as L,c as Ae,f as mr}from"./chunk-VELTKBKT.mjs";var xe=Ae((se,Me)=>{"use strict";L((function(C,T){typeof se=="object"&&typeof Me=="object"?Me.exports=T():typeof define=="function"&&define.amd?define([],T):typeof se=="object"?se.layoutBase=T():C.layoutBase=T()}),"webpackUniversalModuleDefinition")(se,function(){return(function(D){var C={};function T(g){if(C[g])return C[g].exports;var l=C[g]={i:g,l:!1,exports:{}};return D[g].call(l.exports,l,l.exports,T),l.l=!0,l.exports}return L(T,"__webpack_require__"),T.m=D,T.c=C,T.i=function(g){return g},T.d=function(g,l,a){T.o(g,l)||Object.defineProperty(g,l,{configurable:!1,enumerable:!0,get:a})},T.n=function(g){var l=g&&g.__esModule?L(function(){return g.default},"getDefault"):L(function(){return g},"getModuleExports");return T.d(l,"a",l),l},T.o=function(g,l){return Object.prototype.hasOwnProperty.call(g,l)},T.p="",T(T.s=28)})([(function(D,C,T){"use strict";function g(){}L(g,"LayoutConstants"),g.QUALITY=1,g.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,g.DEFAULT_INCREMENTAL=!1,g.DEFAULT_ANIMATION_ON_LAYOUT=!0,g.DEFAULT_ANIMATION_DURING_LAYOUT=!1,g.DEFAULT_ANIMATION_PERIOD=50,g.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,g.DEFAULT_GRAPH_MARGIN=15,g.NODE_DIMENSIONS_INCLUDE_LABELS=!1,g.SIMPLE_NODE_SIZE=40,g.SIMPLE_NODE_HALF_SIZE=g.SIMPLE_NODE_SIZE/2,g.EMPTY_COMPOUND_NODE_SIZE=40,g.MIN_EDGE_LENGTH=1,g.WORLD_BOUNDARY=1e6,g.INITIAL_WORLD_BOUNDARY=g.WORLD_BOUNDARY/1e3,g.WORLD_CENTER_X=1200,g.WORLD_CENTER_Y=900,D.exports=g}),(function(D,C,T){"use strict";var g=T(2),l=T(8),a=T(9);function i(c,t,u){g.call(this,u),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=u,this.bendpoints=[],this.source=c,this.target=t}L(i,"LEdge"),i.prototype=Object.create(g.prototype);for(var n in g)i[n]=g[n];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(c,t){for(var u=this.getOtherEnd(c),e=t.getGraphManager().getRoot();;){if(u.getOwner()==t)return u;if(u.getOwner()==e)break;u=u.getOwner().getParent()}return null},i.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=l.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[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))},i.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)},D.exports=i}),(function(D,C,T){"use strict";function g(l){this.vGraphObject=l}L(g,"LGraphObject"),D.exports=g}),(function(D,C,T){"use strict";var g=T(2),l=T(10),a=T(13),i=T(0),n=T(16),c=T(5);function t(e,r,h,f){h==null&&f==null&&(f=r),g.call(this,f),e.graphManager!=null&&(e=e.graphManager),this.estimatedSize=l.MIN_VALUE,this.inclusionTreeDepth=l.MAX_VALUE,this.vGraphObject=f,this.edges=[],this.graphManager=e,h!=null&&r!=null?this.rect=new a(r.x,r.y,h.width,h.height):this.rect=new a}L(t,"LNode"),t.prototype=Object.create(g.prototype);for(var u in g)t[u]=g[u];t.prototype.getEdges=function(){return this.edges},t.prototype.getChild=function(){return this.child},t.prototype.getOwner=function(){return this.owner},t.prototype.getWidth=function(){return this.rect.width},t.prototype.setWidth=function(e){this.rect.width=e},t.prototype.getHeight=function(){return this.rect.height},t.prototype.setHeight=function(e){this.rect.height=e},t.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},t.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},t.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},t.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},t.prototype.getRect=function(){return this.rect},t.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},t.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},t.prototype.setRect=function(e,r){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=r.width,this.rect.height=r.height},t.prototype.setCenter=function(e,r){this.rect.x=e-this.rect.width/2,this.rect.y=r-this.rect.height/2},t.prototype.setLocation=function(e,r){this.rect.x=e,this.rect.y=r},t.prototype.moveBy=function(e,r){this.rect.x+=e,this.rect.y+=r},t.prototype.getEdgeListToNode=function(e){var r=[],h,f=this;return f.edges.forEach(function(o){if(o.target==e){if(o.source!=f)throw"Incorrect edge source!";r.push(o)}}),r},t.prototype.getEdgesBetween=function(e){var r=[],h,f=this;return f.edges.forEach(function(o){if(!(o.source==f||o.target==f))throw"Incorrect edge source and/or target";(o.target==e||o.source==e)&&r.push(o)}),r},t.prototype.getNeighborsList=function(){var e=new Set,r=this;return r.edges.forEach(function(h){if(h.source==r)e.add(h.target);else{if(h.target!=r)throw"Incorrect incidency!";e.add(h.source)}}),e},t.prototype.withChildren=function(){var e=new Set,r,h;if(e.add(this),this.child!=null)for(var f=this.child.getNodes(),o=0;or?(this.rect.x-=(this.labelWidth-r)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(r+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(h+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>h?(this.rect.y-=(this.labelHeight-h)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(h+this.labelHeight))}}},t.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==l.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},t.prototype.transform=function(e){var r=this.rect.x;r>i.WORLD_BOUNDARY?r=i.WORLD_BOUNDARY:r<-i.WORLD_BOUNDARY&&(r=-i.WORLD_BOUNDARY);var h=this.rect.y;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var f=new c(r,h),o=e.inverseTransformPoint(f);this.setLocation(o.x,o.y)},t.prototype.getLeft=function(){return this.rect.x},t.prototype.getRight=function(){return this.rect.x+this.rect.width},t.prototype.getTop=function(){return this.rect.y},t.prototype.getBottom=function(){return this.rect.y+this.rect.height},t.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},D.exports=t}),(function(D,C,T){"use strict";var g=T(0);function l(){}L(l,"FDLayoutConstants");for(var a in g)l[a]=g[a];l.MAX_ITERATIONS=2500,l.DEFAULT_EDGE_LENGTH=50,l.DEFAULT_SPRING_STRENGTH=.45,l.DEFAULT_REPULSION_STRENGTH=4500,l.DEFAULT_GRAVITY_STRENGTH=.4,l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,l.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,l.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,l.COOLING_ADAPTATION_FACTOR=.33,l.ADAPTATION_LOWER_NODE_LIMIT=1e3,l.ADAPTATION_UPPER_NODE_LIMIT=5e3,l.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,l.MAX_NODE_DISPLACEMENT=l.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,l.MIN_REPULSION_DIST=l.DEFAULT_EDGE_LENGTH/10,l.CONVERGENCE_CHECK_PERIOD=100,l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,l.MIN_EDGE_LENGTH=1,l.GRID_CALCULATION_CHECK_PERIOD=10,D.exports=l}),(function(D,C,T){"use strict";function g(l,a){l==null&&a==null?(this.x=0,this.y=0):(this.x=l,this.y=a)}L(g,"PointD"),g.prototype.getX=function(){return this.x},g.prototype.getY=function(){return this.y},g.prototype.setX=function(l){this.x=l},g.prototype.setY=function(l){this.y=l},g.prototype.getDifference=function(l){return new DimensionD(this.x-l.x,this.y-l.y)},g.prototype.getCopy=function(){return new g(this.x,this.y)},g.prototype.translate=function(l){return this.x+=l.width,this.y+=l.height,this},D.exports=g}),(function(D,C,T){"use strict";var g=T(2),l=T(10),a=T(0),i=T(7),n=T(3),c=T(1),t=T(13),u=T(12),e=T(11);function r(f,o,A){g.call(this,A),this.estimatedSize=l.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=f,o!=null&&o instanceof i?this.graphManager=o:o!=null&&o instanceof Layout&&(this.graphManager=o.graphManager)}L(r,"LGraph"),r.prototype=Object.create(g.prototype);for(var h in g)r[h]=g[h];r.prototype.getNodes=function(){return this.nodes},r.prototype.getEdges=function(){return this.edges},r.prototype.getGraphManager=function(){return this.graphManager},r.prototype.getParent=function(){return this.parent},r.prototype.getLeft=function(){return this.left},r.prototype.getRight=function(){return this.right},r.prototype.getTop=function(){return this.top},r.prototype.getBottom=function(){return this.bottom},r.prototype.isConnected=function(){return this.isConnected},r.prototype.add=function(f,o,A){if(o==null&&A==null){var v=f;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(v)>-1)throw"Node already in graph!";return v.owner=this,this.getNodes().push(v),v}else{var y=f;if(!(this.getNodes().indexOf(o)>-1&&this.getNodes().indexOf(A)>-1))throw"Source or target not in graph!";if(!(o.owner==A.owner&&o.owner==this))throw"Both owners must be this graph!";return o.owner!=A.owner?null:(y.source=o,y.target=A,y.isInterGraph=!1,this.getEdges().push(y),o.edges.push(y),A!=o&&A.edges.push(y),y)}},r.prototype.remove=function(f){var o=f;if(f instanceof n){if(o==null)throw"Node is null!";if(!(o.owner!=null&&o.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var A=o.edges.slice(),v,y=A.length,N=0;N-1&&P>-1))throw"Source and/or target doesn't know this edge!";v.source.edges.splice(w,1),v.target!=v.source&&v.target.edges.splice(P,1);var S=v.source.owner.getEdges().indexOf(v);if(S==-1)throw"Not in owner's edge list!";v.source.owner.getEdges().splice(S,1)}},r.prototype.updateLeftTop=function(){for(var f=l.MAX_VALUE,o=l.MAX_VALUE,A,v,y,N=this.getNodes(),S=N.length,w=0;wA&&(f=A),o>v&&(o=v)}return f==l.MAX_VALUE?null:(N[0].getParent().paddingLeft!=null?y=N[0].getParent().paddingLeft:y=this.margin,this.left=o-y,this.top=f-y,new u(this.left,this.top))},r.prototype.updateBounds=function(f){for(var o=l.MAX_VALUE,A=-l.MAX_VALUE,v=l.MAX_VALUE,y=-l.MAX_VALUE,N,S,w,P,$,X=this.nodes,_=X.length,R=0;R<_;R++){var J=X[R];f&&J.child!=null&&J.updateBounds(),N=J.getLeft(),S=J.getRight(),w=J.getTop(),P=J.getBottom(),o>N&&(o=N),Aw&&(v=w),yN&&(o=N),Aw&&(v=w),y=this.nodes.length){var _=0;A.forEach(function(R){R.owner==f&&_++}),_==this.nodes.length&&(this.isConnected=!0)}},D.exports=r}),(function(D,C,T){"use strict";var g,l=T(1);function a(i){g=T(6),this.layout=i,this.graphs=[],this.edges=[]}L(a,"LGraphManager"),a.prototype.addRoot=function(){var i=this.layout.newGraph(),n=this.layout.newNode(null),c=this.add(i,n);return this.setRootGraph(c),this.rootGraph},a.prototype.add=function(i,n,c,t,u){if(c==null&&t==null&&u==null){if(i==null)throw"Graph is null!";if(n==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(n.child!=null)throw"Already has a child!";return i.parent=n,n.child=i,i}else{u=c,t=n,c=i;var e=t.getOwner(),r=u.getOwner();if(!(e!=null&&e.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(r!=null&&r.getGraphManager()==this))throw"Target not in this graph mgr!";if(e==r)return c.isInterGraph=!1,e.add(c,t,u);if(c.isInterGraph=!0,c.source=t,c.target=u,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},a.prototype.remove=function(i){if(i instanceof g){var n=i;if(n.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(n==this.rootGraph||n.parent!=null&&n.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(n.getEdges());for(var t,u=c.length,e=0;e=i.getRight()?n[0]+=Math.min(i.getX()-a.getX(),a.getRight()-i.getRight()):i.getX()<=a.getX()&&i.getRight()>=a.getRight()&&(n[0]+=Math.min(a.getX()-i.getX(),i.getRight()-a.getRight())),a.getY()<=i.getY()&&a.getBottom()>=i.getBottom()?n[1]+=Math.min(i.getY()-a.getY(),a.getBottom()-i.getBottom()):i.getY()<=a.getY()&&i.getBottom()>=a.getBottom()&&(n[1]+=Math.min(a.getY()-i.getY(),i.getBottom()-a.getBottom()));var u=Math.abs((i.getCenterY()-a.getCenterY())/(i.getCenterX()-a.getCenterX()));i.getCenterY()===a.getCenterY()&&i.getCenterX()===a.getCenterX()&&(u=1);var e=u*n[0],r=n[1]/u;n[0]e)return n[0]=c,n[1]=h,n[2]=u,n[3]=X,!1;if(tu)return n[0]=r,n[1]=t,n[2]=P,n[3]=e,!1;if(cu?(n[0]=o,n[1]=A,s=!0):(n[0]=f,n[1]=h,s=!0):p===d&&(c>u?(n[0]=r,n[1]=h,s=!0):(n[0]=v,n[1]=A,s=!0)),-E===d?u>c?(n[2]=$,n[3]=X,m=!0):(n[2]=P,n[3]=w,m=!0):E===d&&(u>c?(n[2]=S,n[3]=w,m=!0):(n[2]=_,n[3]=X,m=!0)),s&&m)return!1;if(c>u?t>e?(O=this.getCardinalDirection(p,d,4),x=this.getCardinalDirection(E,d,2)):(O=this.getCardinalDirection(-p,d,3),x=this.getCardinalDirection(-E,d,1)):t>e?(O=this.getCardinalDirection(-p,d,1),x=this.getCardinalDirection(-E,d,3)):(O=this.getCardinalDirection(p,d,2),x=this.getCardinalDirection(E,d,4)),!s)switch(O){case 1:b=h,G=c+-N/d,n[0]=G,n[1]=b;break;case 2:G=v,b=t+y*d,n[0]=G,n[1]=b;break;case 3:b=A,G=c+N/d,n[0]=G,n[1]=b;break;case 4:G=o,b=t+-y*d,n[0]=G,n[1]=b;break}if(!m)switch(x){case 1:Z=w,I=u+-J/d,n[2]=I,n[3]=Z;break;case 2:I=_,Z=e+R*d,n[2]=I,n[3]=Z;break;case 3:Z=X,I=u+J/d,n[2]=I,n[3]=Z;break;case 4:I=$,Z=e+-R*d,n[2]=I,n[3]=Z;break}}return!1},l.getCardinalDirection=function(a,i,n){return a>i?n:1+n%4},l.getIntersection=function(a,i,n,c){if(c==null)return this.getIntersection2(a,i,n);var t=a.x,u=a.y,e=i.x,r=i.y,h=n.x,f=n.y,o=c.x,A=c.y,v=void 0,y=void 0,N=void 0,S=void 0,w=void 0,P=void 0,$=void 0,X=void 0,_=void 0;return N=r-u,w=t-e,$=e*u-t*r,S=A-f,P=h-o,X=o*f-h*A,_=N*P-S*w,_===0?null:(v=(w*X-P*$)/_,y=(S*$-N*X)/_,new g(v,y))},l.angleOfVector=function(a,i,n,c){var t=void 0;return a!==n?(t=Math.atan((c-i)/(n-a)),n=0){var A=(-h+Math.sqrt(h*h-4*r*f))/(2*r),v=(-h-Math.sqrt(h*h-4*r*f))/(2*r),y=null;return A>=0&&A<=1?[A]:v>=0&&v<=1?[v]:y}else return null},l.HALF_PI=.5*Math.PI,l.ONE_AND_HALF_PI=1.5*Math.PI,l.TWO_PI=2*Math.PI,l.THREE_PI=3*Math.PI,D.exports=l}),(function(D,C,T){"use strict";function g(){}L(g,"IMath"),g.sign=function(l){return l>0?1:l<0?-1:0},g.floor=function(l){return l<0?Math.ceil(l):Math.floor(l)},g.ceil=function(l){return l<0?Math.floor(l):Math.ceil(l)},D.exports=g}),(function(D,C,T){"use strict";function g(){}L(g,"Integer"),g.MAX_VALUE=2147483647,g.MIN_VALUE=-2147483648,D.exports=g}),(function(D,C,T){"use strict";var g=(function(){function t(u,e){for(var r=0;r"u"?"undefined":g(a);return a==null||i!="object"&&i!="function"},D.exports=l}),(function(D,C,T){"use strict";function g(h){if(Array.isArray(h)){for(var f=0,o=Array(h.length);f0&&f;){for(N.push(w[0]);N.length>0&&f;){var P=N[0];N.splice(0,1),y.add(P);for(var $=P.getEdges(),v=0;v<$.length;v++){var X=$[v].getOtherEnd(P);if(S.get(P)!=X)if(!y.has(X))N.push(X),S.set(X,P);else{f=!1;break}}}if(!f)h=[];else{var _=[].concat(g(y));h.push(_);for(var v=0;v<_.length;v++){var R=_[v],J=w.indexOf(R);J>-1&&w.splice(J,1)}y=new Set,S=new Map}}return h},r.prototype.createDummyNodesForBendpoints=function(h){for(var f=[],o=h.source,A=this.graphManager.calcLowestCommonAncestor(h.source,h.target),v=0;v0){for(var A=this.edgeToDummyNodes.get(o),v=0;v=0&&f.splice(X,1);var _=S.getNeighborsList();_.forEach(function(s){if(o.indexOf(s)<0){var m=A.get(s),p=m-1;p==1&&P.push(s),A.set(s,p)}})}o=o.concat(P),(f.length==1||f.length==2)&&(v=!0,y=f[0])}return y},r.prototype.setGraphManager=function(h){this.graphManager=h},D.exports=r}),(function(D,C,T){"use strict";function g(){}L(g,"RandomSeed"),g.seed=1,g.x=0,g.nextDouble=function(){return g.x=Math.sin(g.seed++)*1e4,g.x-Math.floor(g.x)},D.exports=g}),(function(D,C,T){"use strict";var g=T(5);function l(a,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}L(l,"Transform"),l.prototype.getWorldOrgX=function(){return this.lworldOrgX},l.prototype.setWorldOrgX=function(a){this.lworldOrgX=a},l.prototype.getWorldOrgY=function(){return this.lworldOrgY},l.prototype.setWorldOrgY=function(a){this.lworldOrgY=a},l.prototype.getWorldExtX=function(){return this.lworldExtX},l.prototype.setWorldExtX=function(a){this.lworldExtX=a},l.prototype.getWorldExtY=function(){return this.lworldExtY},l.prototype.setWorldExtY=function(a){this.lworldExtY=a},l.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},l.prototype.setDeviceOrgX=function(a){this.ldeviceOrgX=a},l.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},l.prototype.setDeviceOrgY=function(a){this.ldeviceOrgY=a},l.prototype.getDeviceExtX=function(){return this.ldeviceExtX},l.prototype.setDeviceExtX=function(a){this.ldeviceExtX=a},l.prototype.getDeviceExtY=function(){return this.ldeviceExtY},l.prototype.setDeviceExtY=function(a){this.ldeviceExtY=a},l.prototype.transformX=function(a){var i=0,n=this.lworldExtX;return n!=0&&(i=this.ldeviceOrgX+(a-this.lworldOrgX)*this.ldeviceExtX/n),i},l.prototype.transformY=function(a){var i=0,n=this.lworldExtY;return n!=0&&(i=this.ldeviceOrgY+(a-this.lworldOrgY)*this.ldeviceExtY/n),i},l.prototype.inverseTransformX=function(a){var i=0,n=this.ldeviceExtX;return n!=0&&(i=this.lworldOrgX+(a-this.ldeviceOrgX)*this.lworldExtX/n),i},l.prototype.inverseTransformY=function(a){var i=0,n=this.ldeviceExtY;return n!=0&&(i=this.lworldOrgY+(a-this.ldeviceOrgY)*this.lworldExtY/n),i},l.prototype.inverseTransformPoint=function(a){var i=new g(this.inverseTransformX(a.x),this.inverseTransformY(a.y));return i},D.exports=l}),(function(D,C,T){"use strict";function g(e){if(Array.isArray(e)){for(var r=0,h=Array(e.length);ra.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-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):(e>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(e-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()},t.prototype.calcSpringForces=function(){for(var e=this.getAllEdges(),r,h=0;h0&&arguments[0]!==void 0?arguments[0]:!0,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,h,f,o,A,v=this.getAllNodes(),y;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&e&&this.updateGrid(),y=new Set,h=0;hN||y>N)&&(e.gravitationForceX=-this.gravityConstant*o,e.gravitationForceY=-this.gravityConstant*A)):(N=r.getEstimatedSize()*this.compoundGravityRangeFactor,(v>N||y>N)&&(e.gravitationForceX=-this.gravityConstant*o*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*A*this.compoundGravityConstant))},t.prototype.isConverged=function(){var e,r=!1;return this.totalIterations>this.maxIterations/3&&(r=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement=v.length||N>=v[0].length)){for(var S=0;St},"_defaultCompareFunction")}]),n})();D.exports=i}),(function(D,C,T){"use strict";function g(){}L(g,"SVD"),g.svd=function(l){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=l.length,this.n=l[0].length;var a=Math.min(this.m,this.n);this.s=(function(xt){for(var At=[];xt-- >0;)At.push(0);return At})(Math.min(this.m+1,this.n)),this.U=(function(xt){var At=L(function $t(Rt){if(Rt.length==0)return 0;for(var Xt=[],zt=0;zt0;)At.push(0);return At})(this.n),n=(function(xt){for(var At=[];xt-- >0;)At.push(0);return At})(this.m),c=!0,t=!0,u=Math.min(this.m-1,this.n),e=Math.max(0,Math.min(this.n-2,this.m)),r=0;r=0;d--)if(this.s[d]!==0){for(var O=d+1;O=0;F--){if((function(xt,At){return xt&&At})(F0;){var Q=void 0,Yt=void 0;for(Q=m-2;Q>=-1&&Q!==-1;Q--)if(Math.abs(i[Q])<=St+Nt*(Math.abs(this.s[Q])+Math.abs(this.s[Q+1]))){i[Q]=0;break}if(Q===m-2)Yt=4;else{var wt=void 0;for(wt=m-1;wt>=Q&&wt!==Q;wt--){var ot=(wt!==m?Math.abs(i[wt]):0)+(wt!==Q+1?Math.abs(i[wt-1]):0);if(Math.abs(this.s[wt])<=St+Nt*ot){this.s[wt]=0;break}}wt===Q?Yt=3:wt===m-1?Yt=1:(Yt=2,Q=wt)}switch(Q++,Yt){case 1:{var rt=i[m-2];i[m-2]=0;for(var vt=m-2;vt>=Q;vt--){var mt=g.hypot(this.s[vt],rt),Lt=this.s[vt]/mt,Et=rt/mt;if(this.s[vt]=mt,vt!==Q&&(rt=-Et*i[vt-1],i[vt-1]=Lt*i[vt-1]),t)for(var Tt=0;Tt=this.s[Q+1]);){var ct=this.s[Q];if(this.s[Q]=this.s[Q+1],this.s[Q+1]=ct,t&&QMath.abs(a)?(i=a/l,i=Math.abs(l)*Math.sqrt(1+i*i)):a!=0?(i=l/a,i=Math.abs(a)*Math.sqrt(1+i*i)):i=0,i},D.exports=g}),(function(D,C,T){"use strict";var g=(function(){function i(n,c){for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,e=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;l(this,i),this.sequence1=n,this.sequence2=c,this.match_score=t,this.mismatch_penalty=u,this.gap_penalty=e,this.iMax=n.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var r=0;r=0;n--){var c=this.listeners[n];c.event===a&&c.callback===i&&this.listeners.splice(n,1)}},l.emit=function(a,i){for(var n=0;n{"use strict";L((function(C,T){typeof he=="object"&&typeof Oe=="object"?Oe.exports=T(xe()):typeof define=="function"&&define.amd?define(["layout-base"],T):typeof he=="object"?he.coseBase=T(xe()):C.coseBase=T(C.layoutBase)}),"webpackUniversalModuleDefinition")(he,function(D){return(()=>{"use strict";var C={45:((a,i,n)=>{var c={};c.layoutBase=n(551),c.CoSEConstants=n(806),c.CoSEEdge=n(767),c.CoSEGraph=n(880),c.CoSEGraphManager=n(578),c.CoSELayout=n(765),c.CoSENode=n(991),c.ConstraintHandler=n(902),a.exports=c}),806:((a,i,n)=>{var c=n(551).FDLayoutConstants;function t(){}L(t,"CoSEConstants");for(var u in c)t[u]=c[u];t.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,t.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH,t.DEFAULT_COMPONENT_SEPERATION=60,t.TILE=!0,t.TILING_PADDING_VERTICAL=10,t.TILING_PADDING_HORIZONTAL=10,t.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,t.ENFORCE_CONSTRAINTS=!0,t.APPLY_LAYOUT=!0,t.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,t.TREE_REDUCTION_ON_INCREMENTAL=!0,t.PURE_INCREMENTAL=t.DEFAULT_INCREMENTAL,a.exports=t}),767:((a,i,n)=>{var c=n(551).FDLayoutEdge;function t(e,r,h){c.call(this,e,r,h)}L(t,"CoSEEdge"),t.prototype=Object.create(c.prototype);for(var u in c)t[u]=c[u];a.exports=t}),880:((a,i,n)=>{var c=n(551).LGraph;function t(e,r,h){c.call(this,e,r,h)}L(t,"CoSEGraph"),t.prototype=Object.create(c.prototype);for(var u in c)t[u]=c[u];a.exports=t}),578:((a,i,n)=>{var c=n(551).LGraphManager;function t(e){c.call(this,e)}L(t,"CoSEGraphManager"),t.prototype=Object.create(c.prototype);for(var u in c)t[u]=c[u];a.exports=t}),765:((a,i,n)=>{var c=n(551).FDLayout,t=n(578),u=n(880),e=n(991),r=n(767),h=n(806),f=n(902),o=n(551).FDLayoutConstants,A=n(551).LayoutConstants,v=n(551).Point,y=n(551).PointD,N=n(551).DimensionD,S=n(551).Layout,w=n(551).Integer,P=n(551).IGeometry,$=n(551).LGraph,X=n(551).Transform,_=n(551).LinkedList;function R(){c.call(this),this.toBeTiled={},this.constraints={}}L(R,"CoSELayout"),R.prototype=Object.create(c.prototype);for(var J in c)R[J]=c[J];R.prototype.newGraphManager=function(){var s=new t(this);return this.graphManager=s,s},R.prototype.newGraph=function(s){return new u(null,this.graphManager,s)},R.prototype.newNode=function(s){return new e(this.graphManager,s)},R.prototype.newEdge=function(s){return new r(null,null,s)},R.prototype.initParameters=function(){c.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=o.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=o.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=o.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},R.prototype.initSpringEmbedder=function(){c.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/o.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},R.prototype.layout=function(){var s=A.DEFAULT_CREATE_BENDS_AS_NEEDED;return s&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},R.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(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var m=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(O){return m.has(O)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var s=this.getFlatForest();if(s.length>0)this.positionNodesRadially(s);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&&(f.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),h.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},R.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%o.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 s=new Set(this.getAllNodes()),m=this.nodesWithGravity.filter(function(d){return s.has(d)});this.graphManager.setAllNodesToApplyGravitation(m),this.graphManager.updateBounds(),this.updateGrid(),h.PURE_INCREMENTAL?this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=o.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()),h.PURE_INCREMENTAL?this.coolingFactor=o.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=o.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},R.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),m={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(E.fixedNodeWeight=O)}}if(this.constraints.relativePlacementConstraint){var x=new Map,G=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(M){s.fixedNodesOnHorizontal.add(M),s.fixedNodesOnVertical.add(M)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var b=this.constraints.alignmentConstraint.vertical,p=0;p=2*M.length/3;K--)U=Math.floor(Math.random()*(K+1)),H=M[K],M[K]=M[U],M[U]=H;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 U=x.has(M.left)?x.get(M.left):M.left,H=x.has(M.right)?x.get(M.right):M.right;s.nodesInRelativeHorizontal.includes(U)||(s.nodesInRelativeHorizontal.push(U),s.nodeToRelativeConstraintMapHorizontal.set(U,[]),s.dummyToNodeForVerticalAlignment.has(U)?s.nodeToTempPositionMapHorizontal.set(U,s.idToNodeMap.get(s.dummyToNodeForVerticalAlignment.get(U)[0]).getCenterX()):s.nodeToTempPositionMapHorizontal.set(U,s.idToNodeMap.get(U).getCenterX())),s.nodesInRelativeHorizontal.includes(H)||(s.nodesInRelativeHorizontal.push(H),s.nodeToRelativeConstraintMapHorizontal.set(H,[]),s.dummyToNodeForVerticalAlignment.has(H)?s.nodeToTempPositionMapHorizontal.set(H,s.idToNodeMap.get(s.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):s.nodeToTempPositionMapHorizontal.set(H,s.idToNodeMap.get(H).getCenterX())),s.nodeToRelativeConstraintMapHorizontal.get(U).push({right:H,gap:M.gap}),s.nodeToRelativeConstraintMapHorizontal.get(H).push({left:U,gap:M.gap})}else{var K=G.has(M.top)?G.get(M.top):M.top,ht=G.has(M.bottom)?G.get(M.bottom):M.bottom;s.nodesInRelativeVertical.includes(K)||(s.nodesInRelativeVertical.push(K),s.nodeToRelativeConstraintMapVertical.set(K,[]),s.dummyToNodeForHorizontalAlignment.has(K)?s.nodeToTempPositionMapVertical.set(K,s.idToNodeMap.get(s.dummyToNodeForHorizontalAlignment.get(K)[0]).getCenterY()):s.nodeToTempPositionMapVertical.set(K,s.idToNodeMap.get(K).getCenterY())),s.nodesInRelativeVertical.includes(ht)||(s.nodesInRelativeVertical.push(ht),s.nodeToRelativeConstraintMapVertical.set(ht,[]),s.dummyToNodeForHorizontalAlignment.has(ht)?s.nodeToTempPositionMapVertical.set(ht,s.idToNodeMap.get(s.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):s.nodeToTempPositionMapVertical.set(ht,s.idToNodeMap.get(ht).getCenterY())),s.nodeToRelativeConstraintMapVertical.get(K).push({bottom:ht,gap:M.gap}),s.nodeToRelativeConstraintMapVertical.get(ht).push({top:K,gap:M.gap})}});else{var Z=new Map,et=new Map;this.constraints.relativePlacementConstraint.forEach(function(M){if(M.left){var U=x.has(M.left)?x.get(M.left):M.left,H=x.has(M.right)?x.get(M.right):M.right;Z.has(U)?Z.get(U).push(H):Z.set(U,[H]),Z.has(H)?Z.get(H).push(U):Z.set(H,[U])}else{var K=G.has(M.top)?G.get(M.top):M.top,ht=G.has(M.bottom)?G.get(M.bottom):M.bottom;et.has(K)?et.get(K).push(ht):et.set(K,[ht]),et.has(ht)?et.get(ht).push(K):et.set(ht,[K])}});var F=L(function(U,H){var K=[],ht=[],Nt=new _,St=new Set,Q=0;return U.forEach(function(Yt,wt){if(!St.has(wt)){K[Q]=[],ht[Q]=!1;var ot=wt;for(Nt.push(ot),St.add(ot),K[Q].push(ot);Nt.length!=0;){ot=Nt.shift(),H.has(ot)&&(ht[Q]=!0);var rt=U.get(ot);rt.forEach(function(vt){St.has(vt)||(Nt.push(vt),St.add(vt),K[Q].push(vt))})}Q++}}),{components:K,isFixed:ht}},"constructComponents"),tt=F(Z,s.fixedNodesOnHorizontal);this.componentsOnHorizontal=tt.components,this.fixedComponentsOnHorizontal=tt.isFixed;var z=F(et,s.fixedNodesOnVertical);this.componentsOnVertical=z.components,this.fixedComponentsOnVertical=z.isFixed}}},R.prototype.updateDisplacements=function(){var s=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(z){var M=s.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 G;for(G=0;GE&&(E=Math.floor(x.y)),O=Math.floor(x.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new y(A.WORLD_CENTER_X-x.x/2,A.WORLD_CENTER_Y-x.y/2))},R.radialLayout=function(s,m,p){var E=Math.max(this.maxDiagonalInTree(s),h.DEFAULT_RADIAL_SEPARATION);R.branchRadialLayout(m,null,0,359,0,E);var d=$.calculateBounds(s),O=new X;O.setDeviceOrgX(d.getMinX()),O.setDeviceOrgY(d.getMinY()),O.setWorldOrgX(p.x),O.setWorldOrgY(p.y);for(var x=0;x1;){var K=H[0];H.splice(0,1);var ht=F.indexOf(K);ht>=0&&F.splice(ht,1),M--,tt--}m!=null?U=(F.indexOf(H[0])+1)%M:U=0;for(var Nt=Math.abs(E-p)/tt,St=U;z!=tt;St=++St%M){var Q=F[St].getOtherEnd(s);if(Q!=m){var Yt=(p+z*Nt)%360,wt=(Yt+Nt)%360;R.branchRadialLayout(Q,s,Yt,wt,d+O,O),z++}}},R.maxDiagonalInTree=function(s){for(var m=w.MIN_VALUE,p=0;pm&&(m=d)}return m},R.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},R.prototype.groupZeroDegreeMembers=function(){var s=this,m={};this.memberGroups={},this.idToDummyNode={};for(var p=[],E=this.graphManager.getAllNodes(),d=0;d"u"&&(m[G]=[]),m[G]=m[G].concat(O)}Object.keys(m).forEach(function(b){if(m[b].length>1){var I="DummyCompound_"+b;s.memberGroups[I]=m[b];var Z=m[b][0].getParent(),et=new e(s.graphManager);et.id=I,et.paddingLeft=Z.paddingLeft||0,et.paddingRight=Z.paddingRight||0,et.paddingBottom=Z.paddingBottom||0,et.paddingTop=Z.paddingTop||0,s.idToDummyNode[I]=et;var F=s.getGraphManager().add(s.newGraph(),et),tt=Z.getChild();tt.add(et);for(var z=0;zd?(E.rect.x-=(E.labelWidth-d)/2,E.setWidth(E.labelWidth),E.labelMarginLeft=(E.labelWidth-d)/2):E.labelPosHorizontal=="right"&&E.setWidth(d+E.labelWidth)),E.labelHeight&&(E.labelPosVertical=="top"?(E.rect.y-=E.labelHeight,E.setHeight(O+E.labelHeight),E.labelMarginTop=E.labelHeight):E.labelPosVertical=="center"&&E.labelHeight>O?(E.rect.y-=(E.labelHeight-O)/2,E.setHeight(E.labelHeight),E.labelMarginTop=(E.labelHeight-O)/2):E.labelPosVertical=="bottom"&&E.setHeight(O+E.labelHeight))}})},R.prototype.repopulateCompounds=function(){for(var s=this.compoundOrder.length-1;s>=0;s--){var m=this.compoundOrder[s],p=m.id,E=m.paddingLeft,d=m.paddingTop,O=m.labelMarginLeft,x=m.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],m.rect.x,m.rect.y,E,d,O,x)}},R.prototype.repopulateZeroDegreeMembers=function(){var s=this,m=this.tiledZeroDegreePack;Object.keys(m).forEach(function(p){var E=s.idToDummyNode[p],d=E.paddingLeft,O=E.paddingTop,x=E.labelMarginLeft,G=E.labelMarginTop;s.adjustLocations(m[p],E.rect.x,E.rect.y,d,O,x,G)})},R.prototype.getToBeTiled=function(s){var m=s.id;if(this.toBeTiled[m]!=null)return this.toBeTiled[m];var p=s.getChild();if(p==null)return this.toBeTiled[m]=!1,!1;for(var E=p.getNodes(),d=0;d0)return this.toBeTiled[m]=!1,!1;if(O.getChild()==null){this.toBeTiled[O.id]=!1;continue}if(!this.getToBeTiled(O))return this.toBeTiled[m]=!1,!1}return this.toBeTiled[m]=!0,!0},R.prototype.getNodeDegree=function(s){for(var m=s.id,p=s.getEdges(),E=0,d=0;dZ&&(Z=F.rect.height)}p+=Z+s.verticalPadding}},R.prototype.tileCompoundMembers=function(s,m){var p=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var d=m[E];if(p.tiledMemberPack[E]=p.tileNodes(s[E],d.paddingLeft+d.paddingRight),d.rect.width=p.tiledMemberPack[E].width,d.rect.height=p.tiledMemberPack[E].height,d.setCenter(p.tiledMemberPack[E].centerX,p.tiledMemberPack[E].centerY),d.labelMarginLeft=0,d.labelMarginTop=0,h.NODE_DIMENSIONS_INCLUDE_LABELS){var O=d.rect.width,x=d.rect.height;d.labelWidth&&(d.labelPosHorizontal=="left"?(d.rect.x-=d.labelWidth,d.setWidth(O+d.labelWidth),d.labelMarginLeft=d.labelWidth):d.labelPosHorizontal=="center"&&d.labelWidth>O?(d.rect.x-=(d.labelWidth-O)/2,d.setWidth(d.labelWidth),d.labelMarginLeft=(d.labelWidth-O)/2):d.labelPosHorizontal=="right"&&d.setWidth(O+d.labelWidth)),d.labelHeight&&(d.labelPosVertical=="top"?(d.rect.y-=d.labelHeight,d.setHeight(x+d.labelHeight),d.labelMarginTop=d.labelHeight):d.labelPosVertical=="center"&&d.labelHeight>x?(d.rect.y-=(d.labelHeight-x)/2,d.setHeight(d.labelHeight),d.labelMarginTop=(d.labelHeight-x)/2):d.labelPosVertical=="bottom"&&d.setHeight(x+d.labelHeight))}})},R.prototype.tileNodes=function(s,m){var p=this.tileNodesByFavoringDim(s,m,!0),E=this.tileNodesByFavoringDim(s,m,!1),d=this.getOrgRatio(p),O=this.getOrgRatio(E),x;return OG&&(G=z.getWidth())});var b=O/d,I=x/d,Z=Math.pow(p-E,2)+4*(b+E)*(I+p)*d,et=(E-p+Math.sqrt(Z))/(2*(b+E)),F;m?(F=Math.ceil(et),F==et&&F++):F=Math.floor(et);var tt=F*(b+E)-E;return G>tt&&(tt=G),tt+=E*2,tt},R.prototype.tileNodesByFavoringDim=function(s,m,p){var E=h.TILING_PADDING_VERTICAL,d=h.TILING_PADDING_HORIZONTAL,O=h.TILING_COMPARE_BY,x={rows:[],rowWidth:[],rowHeight:[],width:0,height:m,verticalPadding:E,horizontalPadding:d,centerX:0,centerY:0};O&&(x.idealRowWidth=this.calcIdealRowWidth(s,p));var G=L(function(M){return M.rect.width*M.rect.height},"getNodeArea"),b=L(function(M,U){return G(U)-G(M)},"areaCompareFcn");s.sort(function(z,M){var U=b;return x.idealRowWidth?(U=O,U(z.id,M.id)):U(z,M)});for(var I=0,Z=0,et=0;et0&&(x+=s.horizontalPadding),s.rowWidth[p]=x,s.width0&&(G+=s.verticalPadding);var b=0;G>s.rowHeight[p]&&(b=s.rowHeight[p],s.rowHeight[p]=G,b=s.rowHeight[p]-b),s.height+=b,s.rows[p].push(m)},R.prototype.getShortestRowIndex=function(s){for(var m=-1,p=Number.MAX_VALUE,E=0;Ep&&(m=E,p=s.rowWidth[E]);return m},R.prototype.canAddHorizontal=function(s,m,p){if(s.idealRowWidth){var E=s.rows.length-1,d=s.rowWidth[E];return d+m+s.horizontalPadding<=s.idealRowWidth}var O=this.getShortestRowIndex(s);if(O<0)return!0;var x=s.rowWidth[O];if(x+s.horizontalPadding+m<=s.width)return!0;var G=0;s.rowHeight[O]0&&(G=p+s.verticalPadding-s.rowHeight[O]);var b;s.width-x>=m+s.horizontalPadding?b=(s.height+G)/(x+m+s.horizontalPadding):b=(s.height+G)/s.width,G=p+s.verticalPadding;var I;return s.widthO&&m!=p){E.splice(-1,1),s.rows[p].push(d),s.rowWidth[m]=s.rowWidth[m]-O,s.rowWidth[p]=s.rowWidth[p]+O,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var x=Number.MIN_VALUE,G=0;Gx&&(x=E[G].height);m>0&&(x+=s.verticalPadding);var b=s.rowHeight[m]+s.rowHeight[p];s.rowHeight[m]=x,s.rowHeight[p]0)for(var tt=d;tt<=O;tt++)F[0]+=this.grid[tt][x-1].length+this.grid[tt][x].length-1;if(O0)for(var tt=x;tt<=G;tt++)F[3]+=this.grid[d-1][tt].length+this.grid[d][tt].length-1;for(var z=w.MAX_VALUE,M,U,H=0;H{var c=n(551).FDLayoutNode,t=n(551).IMath;function u(r,h,f,o){c.call(this,r,h,f,o)}L(u,"CoSENode"),u.prototype=Object.create(c.prototype);for(var e in c)u[e]=c[e];u.prototype.calculateDisplacement=function(){var r=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=r.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=r.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=r.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=r.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>r.coolingFactor*r.maxNodeDisplacement&&(this.displacementX=r.coolingFactor*r.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>r.coolingFactor*r.maxNodeDisplacement&&(this.displacementY=r.coolingFactor*r.maxNodeDisplacement*t.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(r,h){for(var f=this.getChild().getNodes(),o,A=0;A{function c(f){if(Array.isArray(f)){for(var o=0,A=Array(f.length);o0){var dt=0;nt.forEach(function(ct){V=="horizontal"?(q.set(ct,v.has(ct)?y[v.get(ct)]:k.get(ct)),dt+=q.get(ct)):(q.set(ct,v.has(ct)?N[v.get(ct)]:k.get(ct)),dt+=q.get(ct))}),dt=dt/nt.length,st.forEach(function(ct){B.has(ct)||q.set(ct,dt)})}else{var at=0;st.forEach(function(ct){V=="horizontal"?at+=v.has(ct)?y[v.get(ct)]:k.get(ct):at+=v.has(ct)?N[v.get(ct)]:k.get(ct)}),at=at/st.length,st.forEach(function(ct){q.set(ct,at)})}});for(var it=L(function(){var nt=ut.shift(),dt=W.get(nt);dt.forEach(function(at){if(q.get(at.id)ct&&(ct=Xt),ztbt&&(bt=zt)}}catch(ee){Vt=!0,xt=ee}finally{try{!Ot&&At.return&&At.return()}finally{if(Vt)throw xt}}var ve=(dt+ct)/2-(at+bt)/2,qt=!0,jt=!1,_t=void 0;try{for(var Qt=st[Symbol.iterator](),ce;!(qt=(ce=Qt.next()).done);qt=!0){var te=ce.value;q.set(te,q.get(te)+ve)}}catch(ee){jt=!0,_t=ee}finally{try{!qt&&Qt.return&&Qt.return()}finally{if(jt)throw _t}}})}return q},"findAppropriatePositionForRelativePlacement"),J=L(function(W){var V=0,B=0,k=0,j=0;if(W.forEach(function(lt){lt.left?y[v.get(lt.left)]-y[v.get(lt.right)]>=0?V++:B++:N[v.get(lt.top)]-N[v.get(lt.bottom)]>=0?k++:j++}),V>B&&k>j)for(var gt=0;gtB)for(var ft=0;ftj)for(var q=0;q1)o.fixedNodeConstraint.forEach(function(Y,W){E[W]=[Y.position.x,Y.position.y],d[W]=[y[v.get(Y.nodeId)],N[v.get(Y.nodeId)]]}),O=!0;else if(o.alignmentConstraint)(function(){var Y=0;if(o.alignmentConstraint.vertical){for(var W=o.alignmentConstraint.vertical,V=L(function(q){var lt=new Set;W[q].forEach(function(pt){lt.add(pt)});var ut=new Set([].concat(c(lt)).filter(function(pt){return G.has(pt)})),it=void 0;ut.size>0?it=y[v.get(ut.values().next().value)]:it=_(lt).x,W[q].forEach(function(pt){E[Y]=[it,N[v.get(pt)]],d[Y]=[y[v.get(pt)],N[v.get(pt)]],Y++})},"_loop2"),B=0;B0?it=y[v.get(ut.values().next().value)]:it=_(lt).y,k[q].forEach(function(pt){E[Y]=[y[v.get(pt)],it],d[Y]=[y[v.get(pt)],N[v.get(pt)]],Y++})},"_loop3"),gt=0;gtet&&(et=Z[tt].length,F=tt);if(et0){var Lt={x:0,y:0};o.fixedNodeConstraint.forEach(function(Y,W){var V={x:y[v.get(Y.nodeId)],y:N[v.get(Y.nodeId)]},B=Y.position,k=X(B,V);Lt.x+=k.x,Lt.y+=k.y}),Lt.x/=o.fixedNodeConstraint.length,Lt.y/=o.fixedNodeConstraint.length,y.forEach(function(Y,W){y[W]+=Lt.x}),N.forEach(function(Y,W){N[W]+=Lt.y}),o.fixedNodeConstraint.forEach(function(Y){y[v.get(Y.nodeId)]=Y.position.x,N[v.get(Y.nodeId)]=Y.position.y})}if(o.alignmentConstraint){if(o.alignmentConstraint.vertical)for(var Et=o.alignmentConstraint.vertical,Tt=L(function(W){var V=new Set;Et[W].forEach(function(j){V.add(j)});var B=new Set([].concat(c(V)).filter(function(j){return G.has(j)})),k=void 0;B.size>0?k=y[v.get(B.values().next().value)]:k=_(V).x,V.forEach(function(j){G.has(j)||(y[v.get(j)]=k)})},"_loop4"),Mt=0;Mt0?k=N[v.get(B.values().next().value)]:k=_(V).y,V.forEach(function(j){G.has(j)||(N[v.get(j)]=k)})},"_loop5"),Pt=0;Pt{a.exports=D})},T={};function g(a){var i=T[a];if(i!==void 0)return i.exports;var n=T[a]={exports:{}};return C[a](n,n.exports,g),n.exports}L(g,"__webpack_require__");var l=g(45);return l})()})});var cr=Ae((le,Re)=>{"use strict";L((function(C,T){typeof le=="object"&&typeof Re=="object"?Re.exports=T(Ie()):typeof define=="function"&&define.amd?define(["cose-base"],T):typeof le=="object"?le.cytoscapeFcose=T(Ie()):C.cytoscapeFcose=T(C.coseBase)}),"webpackUniversalModuleDefinition")(le,function(D){return(()=>{"use strict";var C={658:(a=>{a.exports=Object.assign!=null?Object.assign.bind(Object):function(i){for(var n=arguments.length,c=Array(n>1?n-1:0),t=1;t{var c=(function(){function e(r,h){var f=[],o=!0,A=!1,v=void 0;try{for(var y=r[Symbol.iterator](),N;!(o=(N=y.next()).done)&&(f.push(N.value),!(h&&f.length===h));o=!0);}catch(S){A=!0,v=S}finally{try{!o&&y.return&&y.return()}finally{if(A)throw v}}return f}return L(e,"sliceIterator"),function(r,h){if(Array.isArray(r))return r;if(Symbol.iterator in Object(r))return e(r,h);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),t=n(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(e){for(var r={},h=0;h0&&O.merge(I)});for(var x=0;x1){N=v[0],S=N.connectedEdges().length,v.forEach(function(d){d.connectedEdges().length0&&f.set("dummy"+(f.size+1),$),X},u.relocateComponent=function(e,r,h){if(!h.fixedNodeConstraint){var f=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY;if(h.quality=="draft"){var y=!0,N=!1,S=void 0;try{for(var w=r.nodeIndexes[Symbol.iterator](),P;!(y=(P=w.next()).done);y=!0){var $=P.value,X=c($,2),_=X[0],R=X[1],J=h.cy.getElementById(_);if(J){var s=J.boundingBox(),m=r.xCoords[R]-s.w/2,p=r.xCoords[R]+s.w/2,E=r.yCoords[R]-s.h/2,d=r.yCoords[R]+s.h/2;mo&&(o=p),Ev&&(v=d)}}}catch(I){N=!0,S=I}finally{try{!y&&w.return&&w.return()}finally{if(N)throw S}}var O=e.x-(o+f)/2,x=e.y-(v+A)/2;r.xCoords=r.xCoords.map(function(I){return I+O}),r.yCoords=r.yCoords.map(function(I){return I+x})}else{Object.keys(r).forEach(function(I){var Z=r[I],et=Z.getRect().x,F=Z.getRect().x+Z.getRect().width,tt=Z.getRect().y,z=Z.getRect().y+Z.getRect().height;eto&&(o=F),ttv&&(v=z)});var G=e.x-(o+f)/2,b=e.y-(v+A)/2;Object.keys(r).forEach(function(I){var Z=r[I];Z.setCenter(Z.getCenterX()+G,Z.getCenterY()+b)})}}},u.calcBoundingBox=function(e,r,h,f){for(var o=Number.MAX_SAFE_INTEGER,A=Number.MIN_SAFE_INTEGER,v=Number.MAX_SAFE_INTEGER,y=Number.MIN_SAFE_INTEGER,N=void 0,S=void 0,w=void 0,P=void 0,$=e.descendants().not(":parent"),X=$.length,_=0;_N&&(o=N),Aw&&(v=w),y{var c=n(548),t=n(140).CoSELayout,u=n(140).CoSENode,e=n(140).layoutBase.PointD,r=n(140).layoutBase.DimensionD,h=n(140).layoutBase.LayoutConstants,f=n(140).layoutBase.FDLayoutConstants,o=n(140).CoSEConstants,A=L(function(y,N){var S=y.cy,w=y.eles,P=w.nodes(),$=w.edges(),X=void 0,_=void 0,R=void 0,J={};y.randomize&&(X=N.nodeIndexes,_=N.xCoords,R=N.yCoords);var s=L(function(I){return typeof I=="function"},"isFn"),m=L(function(I,Z){return s(I)?I(Z):I},"optFn"),p=c.calcParentsWithoutChildren(S,w),E=L(function b(I,Z,et,F){for(var tt=Z.length,z=0;z0){var Nt=void 0;Nt=et.getGraphManager().add(et.newGraph(),H),b(Nt,U,et,F)}}},"processChildrenList"),d=L(function(I,Z,et){for(var F=0,tt=0,z=0;z0?o.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=F/tt:s(y.idealEdgeLength)?o.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=50:o.DEFAULT_EDGE_LENGTH=f.DEFAULT_EDGE_LENGTH=y.idealEdgeLength,o.MIN_REPULSION_DIST=f.MIN_REPULSION_DIST=f.DEFAULT_EDGE_LENGTH/10,o.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH)},"processEdges"),O=L(function(I,Z){Z.fixedNodeConstraint&&(I.constraints.fixedNodeConstraint=Z.fixedNodeConstraint),Z.alignmentConstraint&&(I.constraints.alignmentConstraint=Z.alignmentConstraint),Z.relativePlacementConstraint&&(I.constraints.relativePlacementConstraint=Z.relativePlacementConstraint)},"processConstraints");y.nestingFactor!=null&&(o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=f.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.nestingFactor),y.gravity!=null&&(o.DEFAULT_GRAVITY_STRENGTH=f.DEFAULT_GRAVITY_STRENGTH=y.gravity),y.numIter!=null&&(o.MAX_ITERATIONS=f.MAX_ITERATIONS=y.numIter),y.gravityRange!=null&&(o.DEFAULT_GRAVITY_RANGE_FACTOR=f.DEFAULT_GRAVITY_RANGE_FACTOR=y.gravityRange),y.gravityCompound!=null&&(o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.gravityCompound),y.gravityRangeCompound!=null&&(o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.gravityRangeCompound),y.initialEnergyOnIncremental!=null&&(o.DEFAULT_COOLING_FACTOR_INCREMENTAL=f.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.initialEnergyOnIncremental),y.tilingCompareBy!=null&&(o.TILING_COMPARE_BY=y.tilingCompareBy),y.quality=="proof"?h.QUALITY=2:h.QUALITY=0,o.NODE_DIMENSIONS_INCLUDE_LABELS=f.NODE_DIMENSIONS_INCLUDE_LABELS=h.NODE_DIMENSIONS_INCLUDE_LABELS=y.nodeDimensionsIncludeLabels,o.DEFAULT_INCREMENTAL=f.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!y.randomize,o.ANIMATE=f.ANIMATE=h.ANIMATE=y.animate,o.TILE=y.tile,o.TILING_PADDING_VERTICAL=typeof y.tilingPaddingVertical=="function"?y.tilingPaddingVertical.call():y.tilingPaddingVertical,o.TILING_PADDING_HORIZONTAL=typeof y.tilingPaddingHorizontal=="function"?y.tilingPaddingHorizontal.call():y.tilingPaddingHorizontal,o.DEFAULT_INCREMENTAL=f.DEFAULT_INCREMENTAL=h.DEFAULT_INCREMENTAL=!0,o.PURE_INCREMENTAL=!y.randomize,h.DEFAULT_UNIFORM_LEAF_NODE_SIZES=y.uniformNodeDimensions,y.step=="transformed"&&(o.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,o.ENFORCE_CONSTRAINTS=!1,o.APPLY_LAYOUT=!1),y.step=="enforced"&&(o.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,o.ENFORCE_CONSTRAINTS=!0,o.APPLY_LAYOUT=!1),y.step=="cose"&&(o.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,o.ENFORCE_CONSTRAINTS=!1,o.APPLY_LAYOUT=!0),y.step=="all"&&(y.randomize?o.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:o.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,o.ENFORCE_CONSTRAINTS=!0,o.APPLY_LAYOUT=!0),y.fixedNodeConstraint||y.alignmentConstraint||y.relativePlacementConstraint?o.TREE_REDUCTION_ON_INCREMENTAL=!1:o.TREE_REDUCTION_ON_INCREMENTAL=!0;var x=new t,G=x.newGraphManager();return E(G.addRoot(),c.getTopMostNodes(P),x,y),d(x,G,$),O(x,y),x.runLayout(),J},"coseLayout");a.exports={coseLayout:A}}),212:((a,i,n)=>{var c=(function(){function y(N,S){for(var w=0;w0)if(d){var G=e.getTopMostNodes(w.eles.nodes());if(s=e.connectComponents(P,w.eles,G),s.forEach(function(ot){var rt=ot.boundingBox();m.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2})}),w.randomize&&s.forEach(function(ot){w.eles=ot,X.push(h(w))}),w.quality=="default"||w.quality=="proof"){var b=P.collection();if(w.tile){var I=new Map,Z=[],et=[],F=0,tt={nodeIndexes:I,xCoords:Z,yCoords:et},z=[];if(s.forEach(function(ot,rt){ot.edges().length==0&&(ot.nodes().forEach(function(vt,mt){b.merge(ot.nodes()[mt]),vt.isParent()||(tt.nodeIndexes.set(ot.nodes()[mt].id(),F++),tt.xCoords.push(ot.nodes()[0].position().x),tt.yCoords.push(ot.nodes()[0].position().y))}),z.push(rt))}),b.length>1){var M=b.boundingBox();m.push({x:M.x1+M.w/2,y:M.y1+M.h/2}),s.push(b),X.push(tt);for(var U=z.length-1;U>=0;U--)s.splice(z[U],1),X.splice(z[U],1),m.splice(z[U],1)}}s.forEach(function(ot,rt){w.eles=ot,J.push(o(w,X[rt])),e.relocateComponent(m[rt],J[rt],w)})}else s.forEach(function(ot,rt){e.relocateComponent(m[rt],X[rt],w)});var H=new Set;if(s.length>1){var K=[],ht=$.filter(function(ot){return ot.css("display")=="none"});s.forEach(function(ot,rt){var vt=void 0;if(w.quality=="draft"&&(vt=X[rt].nodeIndexes),ot.nodes().not(ht).length>0){var mt={};mt.edges=[],mt.nodes=[];var Lt=void 0;ot.nodes().not(ht).forEach(function(Et){if(w.quality=="draft")if(!Et.isParent())Lt=vt.get(Et.id()),mt.nodes.push({x:X[rt].xCoords[Lt]-Et.boundingbox().w/2,y:X[rt].yCoords[Lt]-Et.boundingbox().h/2,width:Et.boundingbox().w,height:Et.boundingbox().h});else{var Tt=e.calcBoundingBox(Et,X[rt].xCoords,X[rt].yCoords,vt);mt.nodes.push({x:Tt.topLeftX,y:Tt.topLeftY,width:Tt.width,height:Tt.height})}else J[rt][Et.id()]&&mt.nodes.push({x:J[rt][Et.id()].getLeft(),y:J[rt][Et.id()].getTop(),width:J[rt][Et.id()].getWidth(),height:J[rt][Et.id()].getHeight()})}),ot.edges().forEach(function(Et){var Tt=Et.source(),Mt=Et.target();if(Tt.css("display")!="none"&&Mt.css("display")!="none")if(w.quality=="draft"){var It=vt.get(Tt.id()),Wt=vt.get(Mt.id()),Pt=[],Ut=[];if(Tt.isParent()){var Ft=e.calcBoundingBox(Tt,X[rt].xCoords,X[rt].yCoords,vt);Pt.push(Ft.topLeftX+Ft.width/2),Pt.push(Ft.topLeftY+Ft.height/2)}else Pt.push(X[rt].xCoords[It]),Pt.push(X[rt].yCoords[It]);if(Mt.isParent()){var Y=e.calcBoundingBox(Mt,X[rt].xCoords,X[rt].yCoords,vt);Ut.push(Y.topLeftX+Y.width/2),Ut.push(Y.topLeftY+Y.height/2)}else Ut.push(X[rt].xCoords[Wt]),Ut.push(X[rt].yCoords[Wt]);mt.edges.push({startX:Pt[0],startY:Pt[1],endX:Ut[0],endY:Ut[1]})}else J[rt][Tt.id()]&&J[rt][Mt.id()]&&mt.edges.push({startX:J[rt][Tt.id()].getCenterX(),startY:J[rt][Tt.id()].getCenterY(),endX:J[rt][Mt.id()].getCenterX(),endY:J[rt][Mt.id()].getCenterY()})}),mt.nodes.length>0&&(K.push(mt),H.add(rt))}});var Nt=E.packComponents(K,w.randomize).shifts;if(w.quality=="draft")X.forEach(function(ot,rt){var vt=ot.xCoords.map(function(Lt){return Lt+Nt[rt].dx}),mt=ot.yCoords.map(function(Lt){return Lt+Nt[rt].dy});ot.xCoords=vt,ot.yCoords=mt});else{var St=0;H.forEach(function(ot){Object.keys(J[ot]).forEach(function(rt){var vt=J[ot][rt];vt.setCenter(vt.getCenterX()+Nt[St].dx,vt.getCenterY()+Nt[St].dy)}),St++})}}}else{var O=w.eles.boundingBox();if(m.push({x:O.x1+O.w/2,y:O.y1+O.h/2}),w.randomize){var x=h(w);X.push(x)}w.quality=="default"||w.quality=="proof"?(J.push(o(w,X[0])),e.relocateComponent(m[0],J[0],w)):e.relocateComponent(m[0],X[0],w)}var Q=L(function(rt,vt){if(w.quality=="default"||w.quality=="proof"){typeof rt=="number"&&(rt=vt);var mt=void 0,Lt=void 0,Et=rt.data("id");return J.forEach(function(Mt){Et in Mt&&(mt={x:Mt[Et].getRect().getCenterX(),y:Mt[Et].getRect().getCenterY()},Lt=Mt[Et])}),w.nodeDimensionsIncludeLabels&&(Lt.labelWidth&&(Lt.labelPosHorizontal=="left"?mt.x+=Lt.labelWidth/2:Lt.labelPosHorizontal=="right"&&(mt.x-=Lt.labelWidth/2)),Lt.labelHeight&&(Lt.labelPosVertical=="top"?mt.y+=Lt.labelHeight/2:Lt.labelPosVertical=="bottom"&&(mt.y-=Lt.labelHeight/2))),mt==null&&(mt={x:rt.position("x"),y:rt.position("y")}),{x:mt.x,y:mt.y}}else{var Tt=void 0;return X.forEach(function(Mt){var It=Mt.nodeIndexes.get(rt.id());It!=null&&(Tt={x:Mt.xCoords[It],y:Mt.yCoords[It]})}),Tt==null&&(Tt={x:rt.position("x"),y:rt.position("y")}),{x:Tt.x,y:Tt.y}}},"getPositions");if(w.quality=="default"||w.quality=="proof"||w.randomize){var Yt=e.calcParentsWithoutChildren(P,$),wt=$.filter(function(ot){return ot.css("display")=="none"});w.eles=$.not(wt),$.nodes().not(":parent").not(wt).layoutPositions(S,w,Q),Yt.length>0&&Yt.forEach(function(ot){ot.position(Q(ot))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")},"run")}]),y})();a.exports=v}),657:((a,i,n)=>{var c=n(548),t=n(140).layoutBase.Matrix,u=n(140).layoutBase.SVD,e=L(function(h){var f=h.cy,o=h.eles,A=o.nodes(),v=o.nodes(":parent"),y=new Map,N=new Map,S=new Map,w=[],P=[],$=[],X=[],_=[],R=[],J=[],s=[],m=void 0,p=void 0,E=1e8,d=1e-9,O=h.piTol,x=h.samplingType,G=h.nodeSeparation,b=void 0,I=L(function(){for(var V=0,B=0,k=!1;B=gt;){q=j[gt++];for(var st=w[q],nt=0;ntit&&(it=_[at],pt=at)}return pt},"BFS"),et=L(function(V){var B=void 0;if(V){B=Math.floor(Math.random()*p),m=B;for(var j=0;j=1)break;it=ut}for(var st=0;st=1)break;it=ut}for(var dt=0;dt0&&(B.isParent()?w[V].push(S.get(B.id())):w[V].push(B.id()))})});var Yt=L(function(V){var B=N.get(V),k=void 0;y.get(V).forEach(function(j){f.getElementById(j).isParent()?k=S.get(j):k=j,w[B].push(k),w[N.get(k)].push(V)})},"_loop"),wt=!0,ot=!1,rt=void 0;try{for(var vt=y.keys()[Symbol.iterator](),mt;!(wt=(mt=vt.next()).done);wt=!0){var Lt=mt.value;Yt(Lt)}}catch(W){ot=!0,rt=W}finally{try{!wt&&vt.return&&vt.return()}finally{if(ot)throw rt}}p=N.size;var Et=void 0;if(p>2){b=p{var c=n(212),t=L(function(e){e&&e("layout","fcose",c)},"register");typeof cytoscape<"u"&&t(cytoscape),a.exports=t}),140:(a=>{a.exports=D})},T={};function g(a){var i=T[a];if(i!==void 0)return i.exports;var n=T[a]={exports:{}};return C[a](n,n.exports,g),n.exports}L(g,"__webpack_require__");var l=g(579);return l})()})});var Le={L:"left",R:"right",T:"top",B:"bottom"},De={L:L(D=>`${D},${D/2} 0,${D} 0,0`,"L"),R:L(D=>`0,${D/2} ${D},0 ${D},${D}`,"R"),T:L(D=>`0,0 ${D},0 ${D/2},${D}`,"T"),B:L(D=>`${D/2},0 ${D},${D} 0,${D}`,"B")},ne={L:L((D,C)=>D-C+2,"L"),R:L((D,C)=>D-2,"R"),T:L((D,C)=>D-C+2,"T"),B:L((D,C)=>D-2,"B")},rr=L(function(D){return Ht(D)?D==="L"?"R":"L":D==="T"?"B":"T"},"getOppositeArchitectureDirection"),Ce=L(function(D){let C=D;return C==="L"||C==="R"||C==="T"||C==="B"},"isArchitectureDirection"),Ht=L(function(D){let C=D;return C==="L"||C==="R"},"isArchitectureDirectionX"),kt=L(function(D){let C=D;return C==="T"||C==="B"},"isArchitectureDirectionY"),ae=L(function(D,C){let T=Ht(D)&&kt(C),g=kt(D)&&Ht(C);return T||g},"isArchitectureDirectionXY"),ir=L(function(D){let C=D[0],T=D[1],g=Ht(C)&&kt(T),l=kt(C)&&Ht(T);return g||l},"isArchitecturePairXY"),Er=L(function(D){return D!=="LL"&&D!=="RR"&&D!=="TT"&&D!=="BB"},"isValidArchitectureDirectionPair"),oe=L(function(D,C){let T=`${D}${C}`;return Er(T)?T:void 0},"getArchitectureDirectionPair"),nr=L(function([D,C],T){let g=T[0],l=T[1];return Ht(g)?kt(l)?[D+(g==="L"?-1:1),C+(l==="T"?1:-1)]:[D+(g==="L"?-1:1),C]:Ht(l)?[D+(l==="L"?1:-1),C+(g==="T"?1:-1)]:[D,C+(g==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),ar=L(function(D){return D==="LT"||D==="TL"?[1,1]:D==="BL"||D==="LB"?[1,-1]:D==="BR"||D==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),or=L(function(D,C){return ae(D,C)?"bend":Ht(D)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),sr=L(function(D){return D.type==="service"},"isArchitectureService"),hr=L(function(D){return D.type==="junction"},"isArchitectureJunction"),pe=L(D=>D.data(),"edgeData"),Jt=L(D=>D.data(),"nodeData");var Tr=Ye.architecture,re=class{constructor(){this.nodes={};this.groups={};this.edges=[];this.registeredIds={};this.elements={};this.diagramId="";this.setAccTitle=Be;this.getAccTitle=$e;this.setDiagramTitle=Je;this.getDiagramTitle=qe;this.getAccDescription=Ze;this.setAccDescription=ke;this.clear()}static{L(this,"ArchitectureDB")}setDiagramId(C){this.diagramId=C}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",ze()}addService({id:C,icon:T,in:g,title:l,iconText:a}){if(this.registeredIds[C]!==void 0)throw new Error(`The service id [${C}] is already in use by another ${this.registeredIds[C]}`);if(g!==void 0){if(C===g)throw new Error(`The service [${C}] cannot be placed within itself`);if(this.registeredIds[g]===void 0)throw new Error(`The service [${C}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[g]==="node")throw new Error(`The service [${C}]'s parent is not a group`)}this.registeredIds[C]="node",this.nodes[C]={id:C,type:"service",icon:T,iconText:a,title:l,edges:[],in:g}}getServices(){return Object.values(this.nodes).filter(sr)}addJunction({id:C,in:T}){if(this.registeredIds[C]!==void 0)throw new Error(`The junction id [${C}] is already in use by another ${this.registeredIds[C]}`);if(T!==void 0){if(C===T)throw new Error(`The junction [${C}] cannot be placed within itself`);if(this.registeredIds[T]===void 0)throw new Error(`The junction [${C}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[T]==="node")throw new Error(`The junction [${C}]'s parent is not a group`)}this.registeredIds[C]="node",this.nodes[C]={id:C,type:"junction",edges:[],in:T}}getJunctions(){return Object.values(this.nodes).filter(hr)}getNodes(){return Object.values(this.nodes)}getNode(C){return this.nodes[C]??null}addGroup({id:C,icon:T,in:g,title:l}){if(this.registeredIds?.[C]!==void 0)throw new Error(`The group id [${C}] is already in use by another ${this.registeredIds[C]}`);if(g!==void 0){if(C===g)throw new Error(`The group [${C}] cannot be placed within itself`);if(this.registeredIds?.[g]===void 0)throw new Error(`The group [${C}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[g]==="node")throw new Error(`The group [${C}]'s parent is not a group`)}this.registeredIds[C]="group",this.groups[C]={id:C,icon:T,title:l,in:g}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:C,rhsId:T,lhsDir:g,rhsDir:l,lhsInto:a,rhsInto:i,lhsGroup:n,rhsGroup:c,title:t}){if(!Ce(g))throw new Error(`Invalid direction given for left hand side of edge ${C}--${T}. Expected (L,R,T,B) got ${String(g)}`);if(!Ce(l))throw new Error(`Invalid direction given for right hand side of edge ${C}--${T}. Expected (L,R,T,B) got ${String(l)}`);if(this.nodes[C]===void 0&&this.groups[C]===void 0)throw new Error(`The left-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[T]===void 0&&this.groups[T]===void 0)throw new Error(`The right-hand id [${T}] does not yet exist. Please create the service/group before declaring an edge to it.`);let u=this.nodes[C].in,e=this.nodes[T].in;if(n&&u&&e&&u==e)throw new Error(`The left-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(c&&u&&e&&u==e)throw new Error(`The right-hand id [${T}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);let r={lhsId:C,lhsDir:g,lhsInto:a,lhsGroup:n,rhsId:T,rhsDir:l,rhsInto:i,rhsGroup:c,title:t};this.edges.push(r),this.nodes[C]&&this.nodes[T]&&(this.nodes[C].edges.push(this.edges[this.edges.length-1]),this.nodes[T].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}getDataStructures(){if(this.dataStructures===void 0){let C={},T=Object.entries(this.nodes).reduce((c,[t,u])=>(c[t]=u.edges.reduce((e,r)=>{let h=this.getNode(r.lhsId)?.in,f=this.getNode(r.rhsId)?.in;if(h&&f&&h!==f){let o=or(r.lhsDir,r.rhsDir);o!=="bend"&&(C[h]??={},C[h][f]=o,C[f]??={},C[f][h]=o)}if(r.lhsId===t){let o=oe(r.lhsDir,r.rhsDir);o&&(e[o]=r.rhsId)}else{let o=oe(r.rhsDir,r.lhsDir);o&&(e[o]=r.lhsId)}return e},{}),c),{}),g=Object.keys(T)[0],l={[g]:1},a=Object.keys(T).reduce((c,t)=>t===g?c:{...c,[t]:1},{}),i=L(c=>{let t={[c]:[0,0]},u=[c];for(;u.length>0;){let e=u.shift();if(e){l[e]=1,delete a[e];let r=T[e],[h,f]=t[e];Object.entries(r).forEach(([o,A])=>{l[A]||(t[A]=nr([h,f],o),u.push(A))})}}return t},"BFS"),n=[i(g)];for(;Object.keys(a).length>0;)n.push(i(Object.keys(a)[0]));this.dataStructures={adjList:T,spatialMaps:n,groupAlignments:C}}return this.dataStructures}setElementForId(C,T){this.elements[C]=T}getElementById(C){return this.elements[C]}getConfig(){return Ke({...Tr,...Ue().architecture})}getConfigField(C){return this.getConfig()[C]}};var Ar=L((D,C)=>{tr(D,C),D.groups.map(T=>C.addGroup(T)),D.services.map(T=>C.addService({...T,type:"service"})),D.junctions.map(T=>C.addJunction({...T,type:"junction"})),D.edges.map(T=>C.addEdge(T))},"populateDb"),we={parser:{yy:void 0},parse:L(async D=>{let C=await _e("architecture",D);fe.debug(C);let T=we.parser?.yy;if(!(T instanceof re))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.");Ar(C,T)},"parse")};var Nr=L(D=>` .edge { stroke-width: ${D.archEdgeWidth}; stroke: ${D.archEdgeColor}; fill: none; } .arrow { fill: ${D.archEdgeArrowColor}; } .node-bkg { fill: none; stroke: ${D.archGroupBorderColor}; stroke-width: ${D.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"),lr=Nr;var pr=mr(cr(),1);var ie=L(D=>`${D}`,"wrapIcon"),Kt={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:ie('')},server:{body:ie('')},disk:{body:ie('')},internet:{body:ie('')},cloud:{body:ie('')},unknown:He,blank:{body:ie("")}}};var fr=L(async function(D,C,T,g){let l=T.getConfigField("padding"),a=T.getConfigField("iconSize"),i=a/2,n=a/6,c=n/2;await Promise.all(C.edges().map(async t=>{let{source:u,sourceDir:e,sourceArrow:r,sourceGroup:h,target:f,targetDir:o,targetArrow:A,targetGroup:v,label:y}=pe(t),{x:N,y:S}=t[0].sourceEndpoint(),{x:w,y:P}=t[0].midpoint(),{x:$,y:X}=t[0].targetEndpoint(),_=l+4;if(h&&(Ht(e)?N+=e==="L"?-_:_:S+=e==="T"?-_:_+18),v&&(Ht(o)?$+=o==="L"?-_:_:X+=o==="T"?-_:_+18),!h&&T.getNode(u)?.type==="junction"&&(Ht(e)?N+=e==="L"?i:-i:S+=e==="T"?i:-i),!v&&T.getNode(f)?.type==="junction"&&(Ht(o)?$+=o==="L"?i:-i:X+=o==="T"?i:-i),t[0]._private.rscratch){let R=D.insert("g");if(R.insert("path").attr("d",`M ${N},${S} L ${w},${P} L${$},${X} `).attr("class","edge").attr("id",`${g}-${je(u,f,{prefix:"L"})}`),r){let J=Ht(e)?ne[e](N,n):N-c,s=kt(e)?ne[e](S,n):S-c;R.insert("polygon").attr("points",De[e](n)).attr("transform",`translate(${J},${s})`).attr("class","arrow")}if(A){let J=Ht(o)?ne[o]($,n):$-c,s=kt(o)?ne[o](X,n):X-c;R.insert("polygon").attr("points",De[o](n)).attr("transform",`translate(${J},${s})`).attr("class","arrow")}if(y){let J=ae(e,o)?"XY":Ht(e)?"X":"Y",s=0;J==="X"?s=Math.abs(N-$):J==="Y"?s=Math.abs(S-X)/1.5:s=Math.abs(N-$)/2;let m=R.append("g");if(await de(m,y,{useHtmlLabels:!1,width:s,classes:"architecture-service-label"},ge()),m.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),J==="X")m.attr("transform","translate("+w+", "+P+")");else if(J==="Y")m.attr("transform","translate("+w+", "+P+") rotate(-90)");else if(J==="XY"){let p=oe(e,o);if(p&&ir(p)){let E=m.node().getBoundingClientRect(),[d,O]=ar(p);m.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*d*O*45})`);let x=m.node().getBoundingClientRect();m.attr("transform",` translate(${w}, ${P-E.height/2}) translate(${d*x.width/2}, ${O*x.height/2}) rotate(${-1*d*O*45}, 0, ${E.height/2}) `)}}}}}))},"drawEdges"),ur=L(async function(D,C,T,g){let a=T.getConfigField("padding")*.75,i=T.getConfigField("fontSize"),c=T.getConfigField("iconSize")/2;await Promise.all(C.nodes().map(async t=>{let u=Jt(t);if(u.type==="group"){let{h:e,w:r,x1:h,y1:f}=t.boundingBox(),o=D.append("rect");o.attr("id",`${g}-group-${u.id}`).attr("x",h+c).attr("y",f+c).attr("width",r).attr("height",e).attr("class","node-bkg");let A=D.append("g"),v=h,y=f;if(u.icon){let N=A.append("g");N.html(`${await ue(u.icon,{height:a,width:a,fallbackPrefix:Kt.prefix})}`),N.attr("transform","translate("+(v+c+1)+", "+(y+c+1)+")"),v+=a,y+=i/2-1-2}if(u.label){let N=A.append("g");await de(N,u.label,{useHtmlLabels:!1,width:r,classes:"architecture-service-label"},ge()),N.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),N.attr("transform","translate("+(v+c+4)+", "+(y+c+2)+")")}T.setElementForId(u.id,o)}}))},"drawGroups"),gr=L(async function(D,C,T,g){let l=ge();for(let a of T){let i=C.append("g"),n=D.getConfigField("iconSize");if(a.title){let e=i.append("g");await de(e,a.title,{useHtmlLabels:!1,width:n*1.5,classes:"architecture-service-label"},l),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),e.attr("transform","translate("+n/2+", "+n+")")}let c=i.append("g");if(a.icon)c.html(`${await ue(a.icon,{height:n,width:n,fallbackPrefix:Kt.prefix})}`);else if(a.iconText){c.html(`${await ue("blank",{height:n,width:n,fallbackPrefix:Kt.prefix})}`);let h=c.append("g").append("foreignObject").attr("width",n).attr("height",n).append("div").attr("class","node-icon-text").attr("style",`height: ${n}px;`).append("div").html(Xe(a.iconText,l)),f=parseInt(window.getComputedStyle(h.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;h.attr("style",`-webkit-line-clamp: ${Math.floor((n-2)/f)};`)}else c.append("path").attr("class","node-bkg").attr("id",`${g}-node-${a.id}`).attr("d",`M0,${n} V5 Q0,0 5,0 H${n-5} Q${n},0 ${n},5 V${n} Z`);i.attr("id",`${g}-service-${a.id}`).attr("class","architecture-service");let{width:t,height:u}=i.node().getBBox();a.width=t,a.height=u,D.setElementForId(a.id,i)}return 0},"drawServices"),dr=L(function(D,C,T,g){T.forEach(l=>{let a=C.append("g"),i=D.getConfigField("iconSize");a.append("g").append("rect").attr("id",`${g}-node-${l.id}`).attr("fill-opacity","0").attr("width",i).attr("height",i),a.attr("class","architecture-junction");let{width:c,height:t}=a._groups[0][0].getBBox();a.width=c,a.height=t,D.setElementForId(l.id,a)})},"drawJunctions");We([{name:Kt.prefix,icons:Kt}]);Ne.use(pr.default);function Lr(D,C,T){D.forEach(g=>{C.add({group:"nodes",data:{type:"service",id:g.id,icon:g.icon,label:g.title,parent:g.in,width:T.getConfigField("iconSize"),height:T.getConfigField("iconSize")},classes:"node-service"})})}L(Lr,"addServices");function Dr(D,C,T){D.forEach(g=>{C.add({group:"nodes",data:{type:"junction",id:g.id,parent:g.in,width:T.getConfigField("iconSize"),height:T.getConfigField("iconSize")},classes:"node-junction"})})}L(Dr,"addJunctions");function Cr(D,C){C.nodes().map(T=>{let g=Jt(T);if(g.type==="group")return;g.x=T.position().x,g.y=T.position().y,D.getElementById(g.id).attr("transform","translate("+(g.x||0)+","+(g.y||0)+")")})}L(Cr,"positionNodes");function wr(D,C){D.forEach(T=>{C.add({group:"nodes",data:{type:"group",id:T.id,icon:T.icon,label:T.title,parent:T.in},classes:"node-group"})})}L(wr,"addGroups");function Mr(D,C){D.forEach(T=>{let{lhsId:g,rhsId:l,lhsInto:a,lhsGroup:i,rhsInto:n,lhsDir:c,rhsDir:t,rhsGroup:u,title:e}=T,r=ae(T.lhsDir,T.rhsDir)?"segments":"straight",h={id:`${g}-${l}`,label:e,source:g,sourceDir:c,sourceArrow:a,sourceGroup:i,sourceEndpoint:c==="L"?"0 50%":c==="R"?"100% 50%":c==="T"?"50% 0":"50% 100%",target:l,targetDir:t,targetArrow:n,targetGroup:u,targetEndpoint:t==="L"?"0 50%":t==="R"?"100% 50%":t==="T"?"50% 0":"50% 100%"};C.add({group:"edges",data:h,classes:r})})}L(Mr,"addEdges");function xr(D,C,T){let g=L((n,c)=>Object.entries(n).reduce((t,[u,e])=>{let r=0,h=Object.entries(e);if(h.length===1)return t[u]=h[0][1],t;for(let f=0;f{let c={},t={};return Object.entries(n).forEach(([u,[e,r]])=>{let h=D.getNode(u)?.in??"default";c[r]??={},c[r][h]??=[],c[r][h].push(u),t[e]??={},t[e][h]??=[],t[e][h].push(u)}),{horiz:Object.values(g(c,"horizontal")).filter(u=>u.length>1),vert:Object.values(g(t,"vertical")).filter(u=>u.length>1)}}),[a,i]=l.reduce(([n,c],{horiz:t,vert:u})=>[[...n,...t],[...c,...u]],[[],[]]);return{horizontal:a,vertical:i}}L(xr,"getAlignments");function Or(D,C){let T=[],g=L(a=>`${a[0]},${a[1]}`,"posToStr"),l=L(a=>a.split(",").map(i=>parseInt(i)),"strToPos");return D.forEach(a=>{let i=Object.fromEntries(Object.entries(a).map(([u,e])=>[g(e),u])),n=[g([0,0])],c={},t={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;n.length>0;){let u=n.shift();if(u){c[u]=1;let e=i[u];if(e){let r=l(u);Object.entries(t).forEach(([h,f])=>{let o=g([r[0]+f[0],r[1]+f[1]]),A=i[o];A&&!c[o]&&(n.push(o),T.push({[Le[h]]:A,[Le[rr(h)]]:e,gap:1.5*C.getConfigField("iconSize")}))})}}}}),T}L(Or,"getRelativeConstraints");function Ir(D,C,T,g,l,{spatialMaps:a,groupAlignments:i}){return new Promise(n=>{let c=Qe("body").append("div").attr("id","cy").attr("style","display:none"),t=Ne({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}}});c.remove(),wr(T,t),Lr(D,t,l),Dr(C,t,l),Mr(g,t);let u=xr(l,a,i),e=Or(a,l),r=t.layout({name:"fcose",quality:"proof",randomize:l.getConfigField("randomize"),styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(h){let[f,o]=h.connectedNodes(),{parent:A}=Jt(f),{parent:v}=Jt(o);return A===v?1.5*l.getConfigField("iconSize"):.5*l.getConfigField("iconSize")},edgeElasticity(h){let[f,o]=h.connectedNodes(),{parent:A}=Jt(f),{parent:v}=Jt(o);return A===v?.45:.001},alignmentConstraint:u,relativePlacementConstraint:e});r.one("layoutstop",()=>{function h(f,o,A,v){let y,N,{x:S,y:w}=f,{x:P,y:$}=o;N=(v-w+(S-A)*(w-$)/(S-P))/Math.sqrt(1+Math.pow((w-$)/(S-P),2)),y=Math.sqrt(Math.pow(v-w,2)+Math.pow(A-S,2)-Math.pow(N,2));let X=Math.sqrt(Math.pow(P-S,2)+Math.pow($-w,2));y=y/X;let _=(P-S)*(v-w)-($-w)*(A-S);switch(!0){case _>=0:_=1;break;case _<0:_=-1;break}let R=(P-S)*(A-S)+($-w)*(v-w);switch(!0){case R>=0:R=1;break;case R<0:R=-1;break}return N=Math.abs(N)*_,y=y*R,{distances:N,weights:y}}L(h,"getSegmentWeights"),t.startBatch();for(let f of Object.values(t.edges()))if(f.data?.()){let{x:o,y:A}=f.source().position(),{x:v,y}=f.target().position();if(o!==v&&A!==y){let N=f.sourceEndpoint(),S=f.targetEndpoint(),{sourceDir:w}=pe(f),[P,$]=kt(w)?[N.x,S.y]:[S.x,N.y],{weights:X,distances:_}=h(N,S,P,$);f.style("segment-distances",_),f.style("segment-weights",X)}}t.endBatch(),r.run()}),r.run(),t.ready(h=>{fe.info("Ready",h),n(t)})})}L(Ir,"layoutArchitecture");var Rr=L(async(D,C,T,g)=>{let l=g.db;l.setDiagramId(C);let a=l.getServices(),i=l.getJunctions(),n=l.getGroups(),c=l.getEdges(),t=l.getDataStructures(),u=er(C),e=u.append("g");e.attr("class","architecture-edges");let r=u.append("g");r.attr("class","architecture-services");let h=u.append("g");h.attr("class","architecture-groups"),await gr(l,r,a,C),dr(l,r,i,C);let f=await Ir(a,i,n,c,l,t);await fr(e,f,l,C),await ur(h,f,l,C),Cr(l,f),Ve(void 0,u,l.getConfigField("padding"),l.getConfigField("useMaxWidth"))},"draw"),vr={draw:Rr};var Ci={parser:we,get db(){return new re},renderer:vr,styles:lr};export{Ci as diagram};