import{_ as t,l as e,c as n,H as i,R as r,F as o,h as s,S as a,T as h,V as l,a3 as c,N as g}from"./mermaid-D0MGOvVE.js";import{c as u}from"./cytoscape.esm-bH-fs5wT.js";import{q as d}from"./index-BiV-b1K2.js";import{s as p}from"./transform-CdY8z5kT.js";import"./step-xJWGRC3d.js";var f,y={exports:{}},E={exports:{}},_={exports:{}};function m(){return f?_.exports:(f=1,t=function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=26)}([function(t,e,n){function i(){}i.QUALITY=1,i.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,i.DEFAULT_INCREMENTAL=!1,i.DEFAULT_ANIMATION_ON_LAYOUT=!0,i.DEFAULT_ANIMATION_DURING_LAYOUT=!1,i.DEFAULT_ANIMATION_PERIOD=50,i.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,i.DEFAULT_GRAPH_MARGIN=15,i.NODE_DIMENSIONS_INCLUDE_LABELS=!1,i.SIMPLE_NODE_SIZE=40,i.SIMPLE_NODE_HALF_SIZE=i.SIMPLE_NODE_SIZE/2,i.EMPTY_COMPOUND_NODE_SIZE=40,i.MIN_EDGE_LENGTH=1,i.WORLD_BOUNDARY=1e6,i.INITIAL_WORLD_BOUNDARY=i.WORLD_BOUNDARY/1e3,i.WORLD_CENTER_X=1200,i.WORLD_CENTER_Y=900,t.exports=i},function(t,e,n){var i=n(2),r=n(8),o=n(9);function s(t,e,n){i.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=t,this.target=e}for(var a in s.prototype=Object.create(i.prototype),i)s[a]=i[a];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(t){if(this.source===t)return this.target;if(this.target===t)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(t,e){for(var n=this.getOtherEnd(t),i=e.getGraphManager().getRoot();;){if(n.getOwner()==e)return n;if(n.getOwner()==i)break;n=n.getOwner().getParent()}return null},s.prototype.updateLength=function(){var t=new Array(4);this.isOverlapingSourceAndTarget=r.getIntersection(this.target.getRect(),this.source.getRect(),t),this.isOverlapingSourceAndTarget||(this.lengthX=t[0]-t[2],this.lengthY=t[1]-t[3],Math.abs(this.lengthX)<1&&(this.lengthX=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.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=o.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=o.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,n){t.exports=function(t){this.vGraphObject=t}},function(t,e,n){var i=n(2),r=n(10),o=n(13),s=n(0),a=n(16),h=n(4);function l(t,e,n,s){null==n&&null==s&&(s=e),i.call(this,s),null!=t.graphManager&&(t=t.graphManager),this.estimatedSize=r.MIN_VALUE,this.inclusionTreeDepth=r.MAX_VALUE,this.vGraphObject=s,this.edges=[],this.graphManager=t,this.rect=null!=n&&null!=e?new o(e.x,e.y,n.width,n.height):new o}for(var c in l.prototype=Object.create(i.prototype),i)l[c]=i[c];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(t){this.rect.width=t},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(t){this.rect.height=t},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new h(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new h(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(t,e){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=e.width,this.rect.height=e.height},l.prototype.setCenter=function(t,e){this.rect.x=t-this.rect.width/2,this.rect.y=e-this.rect.height/2},l.prototype.setLocation=function(t,e){this.rect.x=t,this.rect.y=e},l.prototype.moveBy=function(t,e){this.rect.x+=t,this.rect.y+=e},l.prototype.getEdgeListToNode=function(t){var e=[],n=this;return n.edges.forEach((function(i){if(i.target==t){if(i.source!=n)throw"Incorrect edge source!";e.push(i)}})),e},l.prototype.getEdgesBetween=function(t){var e=[],n=this;return n.edges.forEach((function(i){if(i.source!=n&&i.target!=n)throw"Incorrect edge source and/or target";i.target!=t&&i.source!=t||e.push(i)})),e},l.prototype.getNeighborsList=function(){var t=new Set,e=this;return e.edges.forEach((function(n){if(n.source==e)t.add(n.target);else{if(n.target!=e)throw"Incorrect incidency!";t.add(n.source)}})),t},l.prototype.withChildren=function(){var t=new Set;if(t.add(this),null!=this.child)for(var e=this.child.getNodes(),n=0;ne&&(this.rect.x-=(this.labelWidth-e)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==r.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},l.prototype.transform=function(t){var e=this.rect.x;e>s.WORLD_BOUNDARY?e=s.WORLD_BOUNDARY:e<-s.WORLD_BOUNDARY&&(e=-s.WORLD_BOUNDARY);var n=this.rect.y;n>s.WORLD_BOUNDARY?n=s.WORLD_BOUNDARY:n<-s.WORLD_BOUNDARY&&(n=-s.WORLD_BOUNDARY);var i=new h(e,n),r=t.inverseTransformPoint(i);this.setLocation(r.x,r.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},t.exports=l},function(t,e,n){function i(t,e){null==t&&null==e?(this.x=0,this.y=0):(this.x=t,this.y=e)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(t){this.x=t},i.prototype.setY=function(t){this.y=t},i.prototype.getDifference=function(t){return new DimensionD(this.x-t.x,this.y-t.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(t){return this.x+=t.width,this.y+=t.height,this},t.exports=i},function(t,e,n){var i=n(2),r=n(10),o=n(0),s=n(6),a=n(3),h=n(1),l=n(13),c=n(12),g=n(11);function u(t,e,n){i.call(this,n),this.estimatedSize=r.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=t,null!=e&&e instanceof s?this.graphManager=e:null!=e&&e instanceof Layout&&(this.graphManager=e.graphManager)}for(var d in u.prototype=Object.create(i.prototype),i)u[d]=i[d];u.prototype.getNodes=function(){return this.nodes},u.prototype.getEdges=function(){return this.edges},u.prototype.getGraphManager=function(){return this.graphManager},u.prototype.getParent=function(){return this.parent},u.prototype.getLeft=function(){return this.left},u.prototype.getRight=function(){return this.right},u.prototype.getTop=function(){return this.top},u.prototype.getBottom=function(){return this.bottom},u.prototype.isConnected=function(){return this.isConnected},u.prototype.add=function(t,e,n){if(null==e&&null==n){var i=t;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(i)>-1)throw"Node already in graph!";return i.owner=this,this.getNodes().push(i),i}var r=t;if(!(this.getNodes().indexOf(e)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(e.owner!=n.owner||e.owner!=this)throw"Both owners must be this graph!";return e.owner!=n.owner?null:(r.source=e,r.target=n,r.isInterGraph=!1,this.getEdges().push(r),e.edges.push(r),n!=e&&n.edges.push(r),r)},u.prototype.remove=function(t){var e=t;if(t instanceof a){if(null==e)throw"Node is null!";if(null==e.owner||e.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=e.edges.slice(),i=n.length,r=0;r-1&&c>-1))throw"Source and/or target doesn't know this edge!";if(o.source.edges.splice(l,1),o.target!=o.source&&o.target.edges.splice(c,1),-1==(s=o.source.owner.getEdges().indexOf(o)))throw"Not in owner's edge list!";o.source.owner.getEdges().splice(s,1)}},u.prototype.updateLeftTop=function(){for(var t,e,n,i=r.MAX_VALUE,o=r.MAX_VALUE,s=this.getNodes(),a=s.length,h=0;h(t=l.getTop())&&(i=t),o>(e=l.getLeft())&&(o=e)}return i==r.MAX_VALUE?null:(n=null!=s[0].getParent().paddingLeft?s[0].getParent().paddingLeft:this.margin,this.left=o-n,this.top=i-n,new c(this.left,this.top))},u.prototype.updateBounds=function(t){for(var e,n,i,o,s,a=r.MAX_VALUE,h=-r.MAX_VALUE,c=r.MAX_VALUE,g=-r.MAX_VALUE,u=this.nodes,d=u.length,p=0;p(e=f.getLeft())&&(a=e),h<(n=f.getRight())&&(h=n),c>(i=f.getTop())&&(c=i),g<(o=f.getBottom())&&(g=o)}var y=new l(a,c,h-a,g-c);a==r.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),s=null!=u[0].getParent().paddingLeft?u[0].getParent().paddingLeft:this.margin,this.left=y.x-s,this.right=y.x+y.width+s,this.top=y.y-s,this.bottom=y.y+y.height+s},u.calculateBounds=function(t){for(var e,n,i,o,s=r.MAX_VALUE,a=-r.MAX_VALUE,h=r.MAX_VALUE,c=-r.MAX_VALUE,g=t.length,u=0;u(e=d.getLeft())&&(s=e),a<(n=d.getRight())&&(a=n),h>(i=d.getTop())&&(h=i),c<(o=d.getBottom())&&(c=o)}return new l(s,h,a-s,c-h)},u.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==r.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){for(var t=0,e=this.nodes,n=e.length,i=0;i=this.nodes.length){var h=0;r.forEach((function(e){e.owner==t&&h++})),h==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},t.exports=u},function(t,e,n){var i,r=n(1);function o(t){i=n(5),this.layout=t,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var t=this.layout.newGraph(),e=this.layout.newNode(null),n=this.add(t,e);return this.setRootGraph(n),this.rootGraph},o.prototype.add=function(t,e,n,i,r){if(null==n&&null==i&&null==r){if(null==t)throw"Graph is null!";if(null==e)throw"Parent node is null!";if(this.graphs.indexOf(t)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(t),null!=t.parent)throw"Already has a parent!";if(null!=e.child)throw"Already has a child!";return t.parent=e,e.child=t,t}r=n,n=t;var o=(i=e).getOwner(),s=r.getOwner();if(null==o||o.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==s||s.getGraphManager()!=this)throw"Target not in this graph mgr!";if(o==s)return n.isInterGraph=!1,o.add(n,i,r);if(n.isInterGraph=!0,n.source=i,n.target=r,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},o.prototype.remove=function(t){if(t instanceof i){var e=t;if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(e!=this.rootGraph&&(null==e.parent||e.parent.graphManager!=this))throw"Invalid parent node!";for(var n,o=[],s=(o=o.concat(e.getEdges())).length,a=0;a=e.getRight()?n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight()):e.getX()<=t.getX()&&e.getRight()>=t.getRight()&&(n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())),t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()?n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()):e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()&&(n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()));var o=Math.abs((e.getCenterY()-t.getCenterY())/(e.getCenterX()-t.getCenterX()));e.getCenterY()===t.getCenterY()&&e.getCenterX()===t.getCenterX()&&(o=1);var s=o*n[0],a=n[1]/o;n[0]s)return n[0]=i,n[1]=h,n[2]=o,n[3]=m,!1;if(ro)return n[0]=a,n[1]=r,n[2]=E,n[3]=s,!1;if(io?(n[0]=c,n[1]=g,L=!0):(n[0]=l,n[1]=h,L=!0):O===I&&(i>o?(n[0]=a,n[1]=h,L=!0):(n[0]=u,n[1]=g,L=!0)),-D===I?o>i?(n[2]=_,n[3]=m,T=!0):(n[2]=E,n[3]=y,T=!0):D===I&&(o>i?(n[2]=f,n[3]=y,T=!0):(n[2]=v,n[3]=m,T=!0)),L&&T)return!1;if(i>o?r>s?(w=this.getCardinalDirection(O,I,4),R=this.getCardinalDirection(D,I,2)):(w=this.getCardinalDirection(-O,I,3),R=this.getCardinalDirection(-D,I,1)):r>s?(w=this.getCardinalDirection(-O,I,1),R=this.getCardinalDirection(-D,I,3)):(w=this.getCardinalDirection(O,I,2),R=this.getCardinalDirection(D,I,4)),!L)switch(w){case 1:M=h,C=i+-p/I,n[0]=C,n[1]=M;break;case 2:C=u,M=r+d*I,n[0]=C,n[1]=M;break;case 3:M=g,C=i+p/I,n[0]=C,n[1]=M;break;case 4:C=c,M=r+-d*I,n[0]=C,n[1]=M}if(!T)switch(R){case 1:G=y,x=o+-A/I,n[2]=x,n[3]=G;break;case 2:x=v,G=s+N*I,n[2]=x,n[3]=G;break;case 3:G=m,x=o+A/I,n[2]=x,n[3]=G;break;case 4:x=_,G=s+-N*I,n[2]=x,n[3]=G}}return!1},r.getCardinalDirection=function(t,e,n){return t>e?n:1+n%4},r.getIntersection=function(t,e,n,r){if(null==r)return this.getIntersection2(t,e,n);var o,s,a,h,l,c,g,u=t.x,d=t.y,p=e.x,f=e.y,y=n.x,E=n.y,_=r.x,m=r.y;return 0==(g=(o=f-d)*(h=y-_)-(s=m-E)*(a=u-p))?null:new i((a*(c=_*E-y*m)-h*(l=p*d-u*f))/g,(s*l-o*c)/g)},r.angleOfVector=function(t,e,n,i){var r=void 0;return t!==n?(r=Math.atan((i-e)/(n-t)),n0?1:t<0?-1:0},i.floor=function(t){return t<0?Math.ceil(t):Math.floor(t)},i.ceil=function(t){return t<0?Math.floor(t):Math.ceil(t)},t.exports=i},function(t,e,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,t.exports=i},function(t,e,n){var i=function(){function t(t,e){for(var n=0;n0&&e;){for(a.push(l[0]);a.length>0&&e;){var c=a[0];a.splice(0,1),s.add(c);var g=c.getEdges();for(o=0;o-1&&l.splice(f,1)}s=new Set,h=new Map}else t=[]}return t},u.prototype.createDummyNodesForBendpoints=function(t){for(var e=[],n=t.source,i=this.graphManager.calcLowestCommonAncestor(t.source,t.target),r=0;r0){for(var r=this.edgeToDummyNodes.get(n),o=0;o=0&&e.splice(g,1),c.getNeighborsList().forEach((function(t){if(n.indexOf(t)<0){var e=i.get(t)-1;1==e&&h.push(t),i.set(t,e)}}))}n=n.concat(h),1!=e.length&&2!=e.length||(r=!0,o=e[0])}return o},u.prototype.setGraphManager=function(t){this.graphManager=t},t.exports=u},function(t,e,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=1e4*Math.sin(i.seed++),i.x-Math.floor(i.x)},t.exports=i},function(t,e,n){var i=n(4);function r(t,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}r.prototype.getWorldOrgX=function(){return this.lworldOrgX},r.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},r.prototype.getWorldOrgY=function(){return this.lworldOrgY},r.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},r.prototype.getWorldExtX=function(){return this.lworldExtX},r.prototype.setWorldExtX=function(t){this.lworldExtX=t},r.prototype.getWorldExtY=function(){return this.lworldExtY},r.prototype.setWorldExtY=function(t){this.lworldExtY=t},r.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},r.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},r.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},r.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},r.prototype.getDeviceExtX=function(){return this.ldeviceExtX},r.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},r.prototype.getDeviceExtY=function(){return this.ldeviceExtY},r.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},r.prototype.transformX=function(t){var e=0,n=this.lworldExtX;return 0!=n&&(e=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/n),e},r.prototype.transformY=function(t){var e=0,n=this.lworldExtY;return 0!=n&&(e=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/n),e},r.prototype.inverseTransformX=function(t){var e=0,n=this.ldeviceExtX;return 0!=n&&(e=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/n),e},r.prototype.inverseTransformY=function(t){var e=0,n=this.ldeviceExtY;return 0!=n&&(e=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/n),e},r.prototype.inverseTransformPoint=function(t){return new i(this.inverseTransformX(t.x),this.inverseTransformY(t.y))},t.exports=r},function(t,e,n){var i=n(15),r=n(7),o=n(0),s=n(8),a=n(9);function h(){i.call(this),this.useSmartIdealEdgeLengthCalculation=r.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=r.DEFAULT_EDGE_LENGTH,this.springConstant=r.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=r.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=r.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=r.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=r.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=r.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*r.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=r.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=r.MAX_ITERATIONS}for(var l in h.prototype=Object.create(i.prototype),i)h[l]=i[l];h.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=r.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var t,e,n,i,s,a,h=this.getGraphManager().getAllEdges(),l=0;lr.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*r.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-r.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>r.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(r.COOLING_ADAPTATION_FACTOR,1-(t-r.ADAPTATION_LOWER_NODE_LIMIT)/(r.ADAPTATION_UPPER_NODE_LIMIT-r.ADAPTATION_LOWER_NODE_LIMIT)*(1-r.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=r.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var t,e=this.getAllEdges(),n=0;n0&&void 0!==arguments[0])||arguments[0],a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],h=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%r.GRID_CALCULATION_CHECK_PERIOD==1&&s&&this.updateGrid(),o=new Set,t=0;t(h=e.getEstimatedSize()*this.gravityRangeFactor)||a>h)&&(t.gravitationForceX=-this.gravityConstant*r,t.gravitationForceY=-this.gravityConstant*o):(s>(h=e.getEstimatedSize()*this.compoundGravityRangeFactor)||a>h)&&(t.gravitationForceX=-this.gravityConstant*r*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*o*this.compoundGravityConstant)},h.prototype.isConverged=function(){var t,e=!1;return this.totalIterations>this.maxIterations/3&&(e=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=a.length||l>=a[0].length))for(var c=0;ct}}]),t}();t.exports=o},function(t,e,n){var i=function(){function t(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.sequence1=e,this.sequence2=n,this.match_score=i,this.mismatch_penalty=r,this.gap_penalty=o,this.iMax=e.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;n--){var i=this.listeners[n];i.event===t&&i.callback===e&&this.listeners.splice(n,1)}},r.emit=function(t,e){for(var n=0;nt.coolingFactor*t.maxNodeDisplacement&&(this.displacementX=t.coolingFactor*t.maxNodeDisplacement*r.sign(this.displacementX)),Math.abs(this.displacementY)>t.coolingFactor*t.maxNodeDisplacement&&(this.displacementY=t.coolingFactor*t.maxNodeDisplacement*r.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),t.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},o.prototype.propogateDisplacementToChildren=function(t,e){for(var n,i=this.getChild().getNodes(),r=0;r0)this.positionNodesRadially(t);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},_.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(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 t=new Set(this.getAllNodes()),e=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(e),this.graphManager.updateBounds(),this.updateGrid(),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()),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,i=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,i),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},_.prototype.getPositionsData=function(){for(var t=this.graphManager.getAllNodes(),e={},n=0;n1)for(a=0;ai&&(i=Math.floor(s.y)),o=Math.floor(s.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new u(c.WORLD_CENTER_X-s.x/2,c.WORLD_CENTER_Y-s.y/2))},_.radialLayout=function(t,e,n){var i=Math.max(this.maxDiagonalInTree(t),h.DEFAULT_RADIAL_SEPARATION);_.branchRadialLayout(e,null,0,359,0,i);var r=y.calculateBounds(t),o=new E;o.setDeviceOrgX(r.getMinX()),o.setDeviceOrgY(r.getMinY()),o.setWorldOrgX(n.x),o.setWorldOrgY(n.y);for(var s=0;s1;){var E=y[0];y.splice(0,1);var m=c.indexOf(E);m>=0&&c.splice(m,1),p--,g--}u=null!=e?(c.indexOf(y[0])+1)%p:0;for(var v=Math.abs(i-n)/g,N=u;d!=g;N=++N%p){var A=c[N].getOtherEnd(t);if(A!=e){var L=(n+d*v)%360,T=(L+v)%360;_.branchRadialLayout(A,t,L,T,r+o,o),d++}}},_.maxDiagonalInTree=function(t){for(var e=p.MIN_VALUE,n=0;ne&&(e=i)}return e},_.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},_.prototype.groupZeroDegreeMembers=function(){var t=this,e={};this.memberGroups={},this.idToDummyNode={};for(var n=[],i=this.graphManager.getAllNodes(),r=0;r1){var i="DummyCompound_"+n;t.memberGroups[i]=e[n];var r=e[n][0].getParent(),o=new s(t.graphManager);o.id=i,o.paddingLeft=r.paddingLeft||0,o.paddingRight=r.paddingRight||0,o.paddingBottom=r.paddingBottom||0,o.paddingTop=r.paddingTop||0,t.idToDummyNode[i]=o;var a=t.getGraphManager().add(t.newGraph(),o),h=r.getChild();h.add(o);for(var l=0;l=0;t--){var e=this.compoundOrder[t],n=e.id,i=e.paddingLeft,r=e.paddingTop;this.adjustLocations(this.tiledMemberPack[n],e.rect.x,e.rect.y,i,r)}},_.prototype.repopulateZeroDegreeMembers=function(){var t=this,e=this.tiledZeroDegreePack;Object.keys(e).forEach((function(n){var i=t.idToDummyNode[n],r=i.paddingLeft,o=i.paddingTop;t.adjustLocations(e[n],i.rect.x,i.rect.y,r,o)}))},_.prototype.getToBeTiled=function(t){var e=t.id;if(null!=this.toBeTiled[e])return this.toBeTiled[e];var n=t.getChild();if(null==n)return this.toBeTiled[e]=!1,!1;for(var i=n.getNodes(),r=0;r0)return this.toBeTiled[e]=!1,!1;if(null!=o.getChild()){if(!this.getToBeTiled(o))return this.toBeTiled[e]=!1,!1}else this.toBeTiled[o.id]=!1}return this.toBeTiled[e]=!0,!0},_.prototype.getNodeDegree=function(t){t.id;for(var e=t.getEdges(),n=0,i=0;ih&&(h=c.rect.height)}n+=h+t.verticalPadding}},_.prototype.tileCompoundMembers=function(t,e){var n=this;this.tiledMemberPack=[],Object.keys(t).forEach((function(i){var r=e[i];n.tiledMemberPack[i]=n.tileNodes(t[i],r.paddingLeft+r.paddingRight),r.rect.width=n.tiledMemberPack[i].width,r.rect.height=n.tiledMemberPack[i].height}))},_.prototype.tileNodes=function(t,e){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:e,verticalPadding:h.TILING_PADDING_VERTICAL,horizontalPadding:h.TILING_PADDING_HORIZONTAL};t.sort((function(t,e){return t.rect.width*t.rect.height>e.rect.width*e.rect.height?-1:t.rect.width*t.rect.height0&&(o+=t.horizontalPadding),t.rowWidth[n]=o,t.width0&&(s+=t.verticalPadding);var a=0;s>t.rowHeight[n]&&(a=t.rowHeight[n],t.rowHeight[n]=s,a=t.rowHeight[n]-a),t.height+=a,t.rows[n].push(e)},_.prototype.getShortestRowIndex=function(t){for(var e=-1,n=Number.MAX_VALUE,i=0;in&&(e=i,n=t.rowWidth[i]);return e},_.prototype.canAddHorizontal=function(t,e,n){var i=this.getShortestRowIndex(t);if(i<0)return!0;var r=t.rowWidth[i];if(r+t.horizontalPadding+e<=t.width)return!0;var o,s,a=0;return t.rowHeight[i]0&&(a=n+t.verticalPadding-t.rowHeight[i]),o=t.width-r>=e+t.horizontalPadding?(t.height+a)/(r+e+t.horizontalPadding):(t.height+a)/t.width,a=n+t.verticalPadding,(s=t.widtho&&e!=n){i.splice(-1,1),t.rows[n].push(r),t.rowWidth[e]=t.rowWidth[e]-o,t.rowWidth[n]=t.rowWidth[n]+o,t.width=t.rowWidth[instance.getLongestRowIndex(t)];for(var s=Number.MIN_VALUE,a=0;as&&(s=i[a].height);e>0&&(s+=t.verticalPadding);var h=t.rowHeight[e]+t.rowHeight[n];t.rowHeight[e]=s,t.rowHeight[n]0)for(var c=r;c<=o;c++)h[0]+=this.grid[c][s-1].length+this.grid[c][s].length-1;if(o0)for(c=s;c<=a;c++)h[3]+=this.grid[r-1][c].length+this.grid[r][c].length-1;for(var g,u,d=p.MAX_VALUE,f=0;f0&&(s=n.getGraphManager().add(n.newGraph(),o),this.processChildrenList(s,g,n))}},g.prototype.stop=function(){return this.stopped=!0,this};var d=function(t){t("layout","cose-bilkent",g)};"undefined"!=typeof cytoscape&&d(cytoscape),t.exports=d}]))),y.exports));var T=function(){var e=t((function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n}),"o"),n=[1,4],i=[1,13],r=[1,12],o=[1,15],s=[1,16],a=[1,20],h=[1,19],l=[6,7,8],c=[1,26],g=[1,24],u=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],f=[1,33],y=[1,34],E=[1,6,7,11,13,15,16,19,22],_={trace:t((function(){}),"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:t((function(t,e,n,i,r,o,s){var a=o.length-1;switch(r){case 6:case 7:return i;case 8:i.getLogger().trace("Stop NL ");break;case 9:i.getLogger().trace("Stop EOF ");break;case 11:i.getLogger().trace("Stop NL2 ");break;case 12:i.getLogger().trace("Stop EOF2 ");break;case 15:i.getLogger().info("Node: ",o[a].id),i.addNode(o[a-1].length,o[a].id,o[a].descr,o[a].type);break;case 16:i.getLogger().trace("Icon: ",o[a]),i.decorateNode({icon:o[a]});break;case 17:case 21:i.decorateNode({class:o[a]});break;case 18:i.getLogger().trace("SPACELIST");break;case 19:i.getLogger().trace("Node: ",o[a].id),i.addNode(0,o[a].id,o[a].descr,o[a].type);break;case 20:i.decorateNode({icon:o[a]});break;case 25:i.getLogger().trace("node found ..",o[a-2]),this.$={id:o[a-1],descr:o[a-1],type:i.getType(o[a-2],o[a])};break;case 26:this.$={id:o[a],descr:o[a],type:i.nodeType.DEFAULT};break;case 27:i.getLogger().trace("node found ..",o[a-3]),this.$={id:o[a-3],descr:o[a-1],type:i.getType(o[a-2],o[a])}}}),"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:i,7:[1,10],9:9,12:11,13:r,14:14,15:o,16:s,17:17,18:18,19:a,22:h},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:i,12:21,13:r,14:14,15:o,16:s,17:17,18:18,19:a,22:h},{6:i,9:22,12:11,13:r,14:14,15:o,16:s,17:17,18:18,19:a,22:h},{6:c,7:g,10:23,11:u},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:a,22:h}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:c,7:g,10:32,11:u},{1:[2,7],6:i,12:21,13:r,14:14,15:o,16:s,17:17,18:18,19:a,22:h},e(p,[2,14],{7:f,11:y}),e(E,[2,8]),e(E,[2,9]),e(E,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:f,11:y}),e(E,[2,11]),e(E,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:t((function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)}),"parseError"),parse:t((function(e){var n=this,i=[0],r=[],o=[null],s=[],a=this.table,h="",l=0,c=0,g=s.slice.call(arguments,1),u=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);u.setInput(e,d.yy),d.yy.lexer=u,d.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var f=u.yylloc;s.push(f);var y=u.options&&u.options.ranges;function E(){var t;return"number"!=typeof(t=r.pop()||u.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t((function(t){i.length=i.length-2*t,o.length=o.length-t,s.length=s.length-t}),"popStack"),t(E,"lex");for(var _,m,v,N,A,L,T,O,D={};;){if(m=i[i.length-1],this.defaultActions[m]?v=this.defaultActions[m]:(null==_&&(_=E()),v=a[m]&&a[m][_]),void 0===v||!v.length||!v[0]){var I="";for(A in O=[],a[m])this.terminals_[A]&&A>2&&O.push("'"+this.terminals_[A]+"'");I=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+O.join(", ")+", got '"+(this.terminals_[_]||_)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==_?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(I,{text:u.match,token:this.terminals_[_]||_,line:u.yylineno,loc:f,expected:O})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+_);switch(v[0]){case 1:i.push(_),o.push(u.yytext),s.push(u.yylloc),i.push(v[1]),_=null,c=u.yyleng,h=u.yytext,l=u.yylineno,f=u.yylloc;break;case 2:if(L=this.productions_[v[1]][1],D.$=o[o.length-L],D._$={first_line:s[s.length-(L||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(L||1)].first_column,last_column:s[s.length-1].last_column},y&&(D._$.range=[s[s.length-(L||1)].range[0],s[s.length-1].range[1]]),void 0!==(N=this.performAction.apply(D,[h,c,l,d.yy,v[1],o,s].concat(g))))return N;L&&(i=i.slice(0,-1*L*2),o=o.slice(0,-1*L),s=s.slice(0,-1*L)),i.push(this.productions_[v[1]][0]),o.push(D.$),s.push(D._$),T=a[i[i.length-2]][i[i.length-1]],i.push(T);break;case 3:return!0}}return!0}),"parse")},m=function(){return{EOF:1,parseError:t((function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)}),"parseError"),setInput:t((function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}),"setInput"),input:t((function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t}),"input"),unput:t((function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this}),"unput"),more:t((function(){return this._more=!0,this}),"more"),reject:t((function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"reject"),less:t((function(t){this.unput(this.match.slice(t))}),"less"),pastInput:t((function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")}),"pastInput"),upcomingInput:t((function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")}),"upcomingInput"),showPosition:t((function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"}),"showPosition"),test_match:t((function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var o in r)this[o]=r[o];return!1}return!1}),"test_match"),next:t((function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),o=0;oe[0].length)){if(e=n,i=o,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[o])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}),"next"),lex:t((function(){var t=this.next();return t||this.lex()}),"lex"),begin:t((function(t){this.conditionStack.push(t)}),"begin"),popState:t((function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}),"popState"),_currentRules:t((function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}),"_currentRules"),topState:t((function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"}),"topState"),pushState:t((function(t){this.begin(t)}),"pushState"),stateStackSize:t((function(){return this.conditionStack.length}),"stateStackSize"),options:{"case-insensitive":!0},performAction:t((function(t,e,n,i){switch(n){case 0:return t.getLogger().trace("Found comment",e.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:case 26:this.popState();break;case 5:t.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return t.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:t.getLogger().trace("end icon"),this.popState();break;case 10:return t.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return t.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return t.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return t.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 24:t.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return t.getLogger().trace("description:",e.yytext),"NODE_DESCR";case 27:return this.popState(),t.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),t.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),t.getLogger().trace("node end ...",e.yytext),"NODE_DEND";case 30:case 33:case 34:return this.popState(),t.getLogger().trace("node end (("),"NODE_DEND";case 31:case 32:return this.popState(),t.getLogger().trace("node end (-"),"NODE_DEND";case 35:case 36:return t.getLogger().trace("Long description:",e.yytext),20}}),"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}}();function v(){this.yy={}}return _.lexer=m,t(v,"Parser"),v.prototype=_,_.Parser=v,new v}();T.parser=T;var O=T,D=[],I=0,w={},R=t((()=>{D=[],I=0,w={}}),"clear"),C=t((function(t){for(let e=D.length-1;e>=0;e--)if(D[e].levelD.length>0?D[0]:null),"getMindmap"),x=t(((t,i,r,a)=>{var h,l;e.info("addNode",t,i,r,a);const c=n();let g=(null==(h=c.mindmap)?void 0:h.padding)??o.mindmap.padding;switch(a){case G.ROUNDED_RECT:case G.RECT:case G.HEXAGON:g*=2}const u={id:I++,nodeId:s(i,c),level:t,descr:s(r,c),type:a,children:[],width:(null==(l=c.mindmap)?void 0:l.maxNodeWidth)??o.mindmap.maxNodeWidth,padding:g},d=C(t);if(d)d.children.push(u),D.push(u);else{if(0!==D.length)throw new Error('There can be only one root. No parent could be found for ("'+u.descr+'")');D.push(u)}}),"addNode"),G={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},S={clear:R,addNode:x,getMindmap:M,nodeType:G,getType:t(((t,n)=>{switch(e.debug("In get type",t,n),t){case"[":return G.RECT;case"(":return")"===n?G.ROUNDED_RECT:G.CLOUD;case"((":return G.CIRCLE;case")":return G.CLOUD;case"))":return G.BANG;case"{{":return G.HEXAGON;default:return G.DEFAULT}}),"getType"),setElementForId:t(((t,e)=>{w[t]=e}),"setElementForId"),decorateNode:t((t=>{if(!t)return;const e=n(),i=D[D.length-1];t.icon&&(i.icon=s(t.icon,e)),t.class&&(i.class=s(t.class,e))}),"decorateNode"),type2Str:t((t=>{switch(t){case G.DEFAULT:return"no-border";case G.RECT:return"rect";case G.ROUNDED_RECT:return"rounded-rect";case G.CIRCLE:return"circle";case G.CLOUD:return"cloud";case G.BANG:return"bang";case G.HEXAGON:return"hexgon";default:return"no-border"}}),"type2Str"),getLogger:t((()=>e),"getLogger"),getElementById:t((t=>w[t]),"getElementById")},b=t((function(t,e,n,i){e.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("d",`M0 ${n.height-5} v${10-n.height} q0,-5 5,-5 h${n.width-10} q5,0 5,5 v${n.height-5} H0 Z`),e.append("line").attr("class","node-line-"+i).attr("x1",0).attr("y1",n.height).attr("x2",n.width).attr("y2",n.height)}),"defaultBkg"),F=t((function(t,e,n){e.append("rect").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("height",n.height).attr("width",n.width)}),"rectBkg"),P=t((function(t,e,n){const i=n.width,r=n.height,o=.15*i,s=.25*i,a=.35*i,h=.2*i;e.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("d",`M0 0 a${o},${o} 0 0,1 ${.25*i},${-1*i*.1}\n a${a},${a} 1 0,1 ${.4*i},${-1*i*.1}\n a${s},${s} 1 0,1 ${.35*i},${1*i*.2}\n\n a${o},${o} 1 0,1 ${.15*i},${1*r*.35}\n a${h},${h} 1 0,1 ${-1*i*.15},${1*r*.65}\n\n a${s},${o} 1 0,1 ${-1*i*.25},${.15*i}\n a${a},${a} 1 0,1 ${-1*i*.5},0\n a${o},${o} 1 0,1 ${-1*i*.25},${-1*i*.15}\n\n a${o},${o} 1 0,1 ${-1*i*.1},${-1*r*.35}\n a${h},${h} 1 0,1 ${.1*i},${-1*r*.65}\n\n H0 V0 Z`)}),"cloudBkg"),U=t((function(t,e,n){const i=n.width,r=n.height,o=.15*i;e.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("d",`M0 0 a${o},${o} 1 0,0 ${.25*i},${-1*r*.1}\n a${o},${o} 1 0,0 ${.25*i},0\n a${o},${o} 1 0,0 ${.25*i},0\n a${o},${o} 1 0,0 ${.25*i},${1*r*.1}\n\n a${o},${o} 1 0,0 ${.15*i},${1*r*.33}\n a${.8*o},${.8*o} 1 0,0 0,${1*r*.34}\n a${o},${o} 1 0,0 ${-1*i*.15},${1*r*.33}\n\n a${o},${o} 1 0,0 ${-1*i*.25},${.15*r}\n a${o},${o} 1 0,0 ${-1*i*.25},0\n a${o},${o} 1 0,0 ${-1*i*.25},0\n a${o},${o} 1 0,0 ${-1*i*.25},${-1*r*.15}\n\n a${o},${o} 1 0,0 ${-1*i*.1},${-1*r*.33}\n a${.8*o},${.8*o} 1 0,0 0,${-1*r*.34}\n a${o},${o} 1 0,0 ${.1*i},${-1*r*.33}\n\n H0 V0 Z`)}),"bangBkg"),Y=t((function(t,e,n){e.append("circle").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("r",n.width/2)}),"circleBkg");function k(t,e,n,i,r){return t.insert("polygon",":first-child").attr("points",i.map((function(t){return t.x+","+t.y})).join(" ")).attr("transform","translate("+(r.width-e)/2+", "+n+")")}t(k,"insertPolygonShape");var X=t((function(t,e,n){const i=n.height,r=i/4,o=n.width-n.padding+2*r;k(e,o,i,[{x:r,y:0},{x:o-r,y:0},{x:o,y:-i/2},{x:o-r,y:-i},{x:r,y:-i},{x:0,y:-i/2}],n)}),"hexagonBkg"),B=t((function(t,e,n){e.append("rect").attr("id","node-"+n.id).attr("class","node-bkg node-"+t.type2Str(n.type)).attr("height",n.height).attr("rx",n.padding).attr("ry",n.padding).attr("width",n.width)}),"roundedRectBkg"),$=t((async function(t,e,n,i,r){const o=r.htmlLabels,s=i%11,a=e.append("g");n.section=s;let h="section-"+s;s<0&&(h+=" section-root"),a.attr("class",(n.class?n.class+" ":"")+"mindmap-node "+h);const l=a.append("g"),u=a.append("g"),d=n.descr.replace(/()/g,"\n");await c(u,d,{useHtmlLabels:o,width:n.width,classes:"mindmap-node-label"},r),o||u.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const p=u.node().getBBox(),[f]=g(r.fontSize);if(n.height=p.height+1.1*f*.5+n.padding,n.width=p.width+2*n.padding,n.icon)if(n.type===t.nodeType.CIRCLE){n.height+=50,n.width+=50;a.append("foreignObject").attr("height","50px").attr("width",n.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+n.icon),u.attr("transform","translate("+n.width/2+", "+(n.height/2-1.5*n.padding)+")")}else{n.width+=50;const t=n.height;n.height=Math.max(t,60);const e=Math.abs(n.height-t);a.append("foreignObject").attr("width","60px").attr("height",n.height).attr("style","text-align: center;margin-top:"+e/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+n.icon),u.attr("transform","translate("+(25+n.width/2)+", "+(e/2+n.padding/2)+")")}else if(o){const t=(n.width-p.width)/2,e=(n.height-p.height)/2;u.attr("transform","translate("+t+", "+e+")")}else{const t=n.width/2,e=n.padding/2;u.attr("transform","translate("+t+", "+e+")")}switch(n.type){case t.nodeType.DEFAULT:b(t,l,n,s);break;case t.nodeType.ROUNDED_RECT:B(t,l,n,s);break;case t.nodeType.RECT:F(t,l,n,s);break;case t.nodeType.CIRCLE:l.attr("transform","translate("+n.width/2+", "+ +n.height/2+")"),Y(t,l,n,s);break;case t.nodeType.CLOUD:P(t,l,n,s);break;case t.nodeType.BANG:U(t,l,n,s);break;case t.nodeType.HEXAGON:X(t,l,n,s)}return t.setElementForId(n.id,a),n.height}),"drawNode"),H=t((function(t,e){const n=t.getElementById(e.id),i=e.x||0,r=e.y||0;n.attr("transform","translate("+i+","+r+")")}),"positionNode");async function W(t,e,n,i,r){await $(t,e,n,i,r),n.children&&await Promise.all(n.children.map(((n,o)=>W(t,e,n,i<0?o:i,r))))}function j(t,n){n.edges().map(((n,i)=>{const r=n.data();if(n[0]._private.bodyBounds){const o=n[0]._private.rscratch;e.trace("Edge: ",i,r),t.insert("path").attr("d",`M ${o.startX},${o.startY} L ${o.midX},${o.midY} L${o.endX},${o.endY} `).attr("class","edge section-edge-"+r.section+" edge-depth-"+r.depth)}}))}function V(t,e,n,i){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:i,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach((r=>{V(r,e,n,i+1),e.add({group:"edges",data:{id:`${t.id}_${r.id}`,source:t.id,target:r.id,depth:i,section:r.section}})}))}function z(t,n){return new Promise((i=>{const r=p("body").append("div").attr("id","cy").attr("style","display:none"),o=u({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),V(t,o,n,0),o.nodes().forEach((function(t){t.layoutDimensions=()=>{const e=t.data();return{w:e.width,h:e.height}}})),o.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),o.ready((t=>{e.info("Ready",t),i(o)}))}))}function q(t,n){n.nodes().map(((n,i)=>{const r=n.data();r.x=n.position().x,r.y=n.position().y,H(t,r);const o=t.getElementById(r.nodeId);e.info("Id:",i,"Position: (",n.position().x,", ",n.position().y,")",r),o.attr("transform",`translate(${n.position().x-r.width/2}, ${n.position().y-r.height/2})`),o.attr("attr",`apa-${i})`)}))}u.use(L),t(W,"drawNodes"),t(j,"drawEdges"),t(V,"addNodes"),t(z,"layoutMindmap"),t(q,"positionNodes");var Z={draw:t((async(t,s,a,h)=>{var l,c;e.debug("Rendering mindmap diagram\n"+t);const g=h.db,u=g.getMindmap();if(!u)return;const d=n();d.htmlLabels=!1;const p=i(s),f=p.append("g");f.attr("class","mindmap-edges");const y=p.append("g");y.attr("class","mindmap-nodes"),await W(g,y,u,-1,d);const E=await z(u,d);j(f,E),q(g,E),r(void 0,p,(null==(l=d.mindmap)?void 0:l.padding)??o.mindmap.padding,(null==(c=d.mindmap)?void 0:c.useMaxWidth)??o.mindmap.useMaxWidth)}),"draw")},Q=t((t=>{let e="";for(let n=0;n`\n .edge {\n stroke-width: 3;\n }\n ${Q(t)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .mindmap-node-label {\n dy: 1em;\n alignment-baseline: middle;\n text-anchor: middle;\n dominant-baseline: middle;\n text-align: center;\n }\n`),"getStyles")};export{K as diagram};