(self["webpackChunkdigital_codedoc_render"]=self["webpackChunkdigital_codedoc_render"]||[]).push([[664],{1006:function(e,t,n){n(4114),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(8992),n(4520),n(3949),function(t,r){e.exports=r(n(7710))}(0,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){"use strict";var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){"use strict";var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.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},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},m.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%u.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 e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=u.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=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},m.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n1)for(s=0;sr&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))},m.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o1){var b=y[0];y.splice(0,1);var x=h.indexOf(b);x>=0&&h.splice(x,1),v--,d--}p=null!=t?(h.indexOf(y[0])+1)%v:0;for(var w=Math.abs(r-n)/d,E=p;g!=d;E=++E%v){var T=h[E].getOtherEnd(e);if(T!=t){var _=(n+g*w)%360,A=(_+w)%360;m.branchRadialLayout(T,e,_,A,i+a,a),g++}}},m.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;nt&&(t=i)}return t},m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},m.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},m.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)}))},m.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},m.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;rl&&(l=c.rect.height)}n+=l+e.verticalPadding}},m.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach((function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height}))},m.prototype.tileNodes=function(e,t){var n=l.TILING_PADDING_VERTICAL,r=l.TILING_PADDING_HORIZONTAL,i={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:n,horizontalPadding:r};e.sort((function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height0&&(o+=e.horizontalPadding),e.rowWidth[n]=o,e.width0&&(s+=e.verticalPadding);var l=0;s>e.rowHeight[n]&&(l=e.rowHeight[n],e.rowHeight[n]=s,l=e.rowHeight[n]-l),e.height+=l,e.rows[n].push(t)},m.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;rn&&(t=r,n=e.rowWidth[r]);return t},m.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a,o,s=0;return e.rowHeight[r]0&&(s=n+e.verticalPadding-e.rowHeight[r]),a=e.width-i>=t+e.horizontalPadding?(e.height+s)/(i+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,o=e.widtha&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;so&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]0)for(var f=i;f<=a;f++)p[0]+=this.grid[f][o-1].length+this.grid[f][o].length-1;if(a0)for(f=o;f<=s;f++)p[3]+=this.grid[i-1][f].length+this.grid[i][f].length-1;for(var v,y,m=g.MAX_VALUE,b=0;b0)o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,h,n)}},d.prototype.stop=function(){return this.stopped=!0,this};var g=function(e){e("layout","cose-bilkent",d)};"undefined"!==typeof cytoscape&&g(cytoscape),e.exports=g}])}))},2469:function(e,t,n){n(4114),n(6573),n(8100),n(7936),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(7467),n(4732),n(9577),n(8992),n(3215),n(4520),n(3949),n(1454),n(8872),n(7550),n(1795),n(4979),n(9848),function(t,n){e.exports=n()}(0,(function(){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}var y="undefined"===typeof window?null:window,m=y?y.navigator:null;y&&y.document;var b=e(""),x=e({}),w=e((function(){})),E="undefined"===typeof HTMLElement?"undefined":e(HTMLElement),T=function(e){return e&&e.instanceString&&A(e.instanceString)?e.instanceString():null},_=function(t){return null!=t&&e(t)==b},A=function(t){return null!=t&&e(t)===w},C=function(e){return!P(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},D=function(t){return null!=t&&e(t)===x&&!C(t)&&t.constructor===Object},N=function(t){return null!=t&&e(t)===x},S=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},k=function(e){return S(e)&&Math.floor(e)===e},L=function(e){return"undefined"===E?void 0:null!=e&&e instanceof HTMLElement},P=function(e){return I(e)||M(e)},I=function(e){return"collection"===T(e)&&e._private.single},M=function(e){return"collection"===T(e)&&!e._private.single},O=function(e){return"core"===T(e)},R=function(e){return"stylesheet"===T(e)},B=function(e){return"event"===T(e)},F=function(e){return void 0===e||null===e||!(""!==e&&!e.match(/^\s+$/))},z=function(e){return"undefined"!==typeof HTMLElement&&e instanceof HTMLElement},G=function(e){return D(e)&&S(e.x1)&&S(e.x2)&&S(e.y1)&&S(e.y2)},V=function(e){return N(e)&&A(e.then)},X=function(){return m&&m.userAgent.match(/msie|trident|edge/i)},Y=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},ne=function(e,t){return-1*te(e,t)},re=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+Z+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,r=parseFloat(c[2]),r<0||r>100)return;if(r/=100,i=parseFloat(c[3]),i<0||i>100)return;if(i/=100,a=c[4],void 0!==a&&(a=parseFloat(a),a<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t},oe=function(e){var t,n=new RegExp("^"+$+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},se=function(e){return ue[e.toLowerCase()]},le=function(e){return(C(e)?e:null)||se(e)||ie(e)||oe(e)||ae(e)},ue={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ce=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||h&&r>=a}function y(){var e=Ee();if(v(e))return m(e);s=setTimeout(y,f(e))}function m(e){return s=void 0,d&&r?p(e):(r=i=void 0,o)}function b(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0}function x(){return void 0===s?o:m(Ee())}function w(){var e=Ee(),n=v(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return g(l);if(h)return clearTimeout(s),s=setTimeout(y,t),p(l)}return void 0===s&&(s=setTimeout(y,t)),o}return t=rt(t)||0,pe(n)&&(c=!!n.leading,h="maxWait"in n,a=h?at(rt(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),w.cancel=b,w.flush=x,w}var lt=st,ut=y?y.performance:null,ct=ut&&ut.now?function(){return ut.now()}:function(){return Date.now()},ht=function(){if(y){if(y.requestAnimationFrame)return function(e){y.requestAnimationFrame(e)};if(y.mozRequestAnimationFrame)return function(e){y.mozRequestAnimationFrame(e)};if(y.webkitRequestAnimationFrame)return function(e){y.webkitRequestAnimationFrame(e)};if(y.msRequestAnimationFrame)return function(e){y.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(ct())}),1e3/60)}}(),dt=function(e){return ht(e)},pt=ct,gt=9261,ft=65599,vt=5381,yt=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt,r=n;;){if(t=e.next(),t.done)break;r=r*ft+t.value|0}return r},mt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:gt;return t*ft+e|0},bt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt;return(t<<5)+t+e|0},xt=function(e,t){return 2097152*e+t},wt=function(e){return 2097152*e[0]+e[1]},Et=function(e,t){return[mt(e[0],t[0]),bt(e[1],t[1])]},Tt=function(e,t){var n={value:0,done:!1},r=0,i=e.length,a={next:function(){return r=0;r--)if(e[r]===t&&(e.splice(r,1),n))break},jt=function(e){e.splice(0,e.length)},Ht=function(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&O(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new en,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];C(t.classes)?l=t.classes:_(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");null==a&&(a=e.length);while(in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse(),l=[],a=0,o=s.length;af;0<=f?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;null==i&&(i=n),a=e[r];while(r>t){if(s=r-1>>1,o=e[s],!(i(a,o)<0))break;e[r]=o,r=s}return e[r]=a},f=function(e,t,r){var i,a,o,s,l;null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;while(i0){var w=y.pop(),E=f(w),T=w.id();if(h[T]=E,E!==1/0)for(var A=w.neighborhood().intersect(p),C=0;C0){n.unshift(t);while(c[i]){var a=c[i];n.unshift(a.edge),n.unshift(a.node),r=a.node,i=r.id()}}return o.spawn(n)}}}},un={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0){if(x(),E++,u===h){for(var T=[],_=i,A=h,C=m[A];;){if(T.unshift(_),null!=C&&T.unshift(C),_=y[A],null==_)break;A=_.id(),C=m[A]}return{found:!0,distance:d[u],path:this.spawn(T),steps:E}}g[u]=!0;for(var D=l._private.edges,N=0;ND&&(p[C]=D,y[C]=A,m[C]=x),!i){var N=A*u+T;!i&&p[N]>D&&(p[N]=D,y[N]=T,m[N]=x)}}}for(var S=0;S1&&void 0!==arguments[1]?arguments[1]:a,r=m(e),i=[],o=r;;){if(null==o)return t.spawn();var l=y(o),u=l.edge,c=l.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=u&&i.unshift(u),o=c}return s.spawn(i)},w=0;w=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;pr){var i=Math.floor(Math.random()*t.length);t=yn(i,e,t),n--}return t},bn={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/vn);if(!(i<2)){for(var l=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?isFinite(l)||(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort((function(e,t){return e-t}));var u=e.length,c=Math.floor(u/2);return u%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},Nn=function(e){return Math.PI*e/180},Sn=function(e,t){return Math.atan2(t,e)-Math.PI/2},kn=Math.log2||function(e){return Math.log(e)/Math.log(2)},Ln=function(e){return e>0?1:e<0?-1:0},Pn=function(e,t){return Math.sqrt(In(e,t))},In=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Mn=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Gn=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Vn=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Xn=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},Yn=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Un=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Wn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},jn=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var s=o(a,4);t=s[0],n=s[1],r=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Hn=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},qn=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},$n=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Kn=function(e,t){return $n(e,t.x,t.y)},Zn=function(e,t){return $n(e,t.x1,t.y1)&&$n(e,t.x2,t.y2)},Qn=function(e,t,n,r,i,a,o){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",l="auto"===s?wr(i,a):s,u=i/2,c=a/2;l=Math.min(l,u,c);var h,d,p=l!==u,g=l!==c;if(p){var f=n-u+l-o,v=r-c-o,y=n+u-l+o,m=v;if(h=gr(e,t,n,r,f,v,y,m,!1),h.length>0)return h}if(g){var b=n+u+o,x=r-c+l-o,w=b,E=r+c-l+o;if(h=gr(e,t,n,r,b,x,w,E,!1),h.length>0)return h}if(p){var T=n-u+l-o,_=r+c+o,A=n+u-l+o,C=_;if(h=gr(e,t,n,r,T,_,A,C,!1),h.length>0)return h}if(g){var D=n-u-o,N=r-c+l-o,S=D,k=r+c-l+o;if(h=gr(e,t,n,r,D,N,S,k,!1),h.length>0)return h}var L=n-u+l,P=r-c+l;if(d=dr(e,t,n,r,L,P,l+o),d.length>0&&d[0]<=L&&d[1]<=P)return[d[0],d[1]];var I=n+u-l,M=r-c+l;if(d=dr(e,t,n,r,I,M,l+o),d.length>0&&d[0]>=I&&d[1]<=M)return[d[0],d[1]];var O=n+u-l,R=r+c-l;if(d=dr(e,t,n,r,O,R,l+o),d.length>0&&d[0]>=O&&d[1]>=R)return[d[0],d[1]];var B=n-u+l,F=r+c-l;return d=dr(e,t,n,r,B,F,l+o),d.length>0&&d[0]<=B&&d[1]>=F?[d[0],d[1]]:[]},Jn=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},er=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(eu.x2||tu.y2)},tr=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var a=Math.sqrt(i),o=2*e,s=(-t+a)/o,l=(-t-a)/o;return[s,l]},nr=function(e,t,n,r,i){var a,o,s,l,u,c,h,d,p=1e-5;return 0===e&&(e=p),t/=e,n/=e,r/=e,o=(3*n-t*t)/9,s=-27*r+t*(9*n-t*t*2),s/=54,a=o*o*o+s*s,i[1]=0,h=t/3,a>0?(u=s+Math.sqrt(a),u=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=s-Math.sqrt(a),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,void(i[5]=-h)):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,void(i[4]=i[2]=-(d+h))):(o=-o,l=o*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),void(i[4]=-h+d*Math.cos((l+4*Math.PI)/3))))},rr=function(e,t,n,r,i,a,o,s){var l=1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,u=9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,c=3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,h=1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,d=[];nr(l,u,c,h,d);for(var p=1e-7,g=[],f=0;f<6;f+=2)Math.abs(d[f+1])=0&&d[f]<=1&&g.push(d[f]);g.push(1),g.push(0);for(var v,y,m,b=-1,x=0;x=0?ml?(e-i)*(e-i)+(t-a)*(t-a):u-h},ar=function(e,t,n){for(var r,i,a,o,s,l=0,u=0;u=e&&e>=a||r<=e&&e<=a))continue;s=(e-r)/(a-r)*(o-i)+i,s>t&&l++}return l%2!==0},or=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),g=0;g0){var f=ur(c,-l);h=lr(f)}else h=c;return ar(e,t,h)},sr=function(e,t,n,r,i,a,o,s){for(var l=new Array(2*n.length),u=0;u=0&&f<=1&&y.push(f),v>=0&&v<=1&&y.push(v),0===y.length)return[];var m=y[0]*s[0]+e,b=y[0]*s[1]+t;if(y.length>1){if(y[0]==y[1])return[m,b];var x=y[1]*s[0]+e,w=y[1]*s[1]+t;return[m,b,x,w]}return[m,b]},pr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},gr=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,g=s-a,f=h*d-g*u,v=c*d-p*u,y=g*c-h*p;if(0!==y){var m=f/y,b=v/y,x=.001,w=0-x,E=1+x;return w<=m&&m<=E&&w<=b&&b<=E||l?[e+m*c,t+m*p]:[]}return 0===f||0===v?pr(e,n,o)===o?[o,s]:pr(e,n,i)===i?[i,a]:pr(i,o,n)===n?[n,r]:[]:[]},fr=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,g=[],f=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=ur(f,-s);u=lr(m)}else u=f}else u=n;for(var b=0;b2){for(var p=[c[0],c[1]],g=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),f=1;fu&&(u=t)},get:function(e){return l[e]}},h=0;h0?m.edgesTo(y)[0]:y.edgesTo(m)[0];var x=r(b);y=y.id(),h[y]>h[f]+x&&(h[y]=h[f]+x,d.nodes.indexOf(y)<0?d.push(y):d.updateItem(y),u[y]=0,l[y]=[]),h[y]==h[f]+x&&(u[y]=u[y]+u[f],l[y].push(f))}else for(var w=0;w0){for(var A=n.pop(),C=0;C0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},Ur=function(e,t){for(var n=0;n5&&void 0!==arguments[5]?arguments[5]:qr,l=r,u=0;u=2?ei(e,t,n,0,Zr,Qr):ei(e,t,n,0,Kr)},squaredEuclidean:function(e,t,n){return ei(e,t,n,0,Zr)},manhattan:function(e,t,n){return ei(e,t,n,0,Kr)},max:function(e,t,n){return ei(e,t,n,-1/0,Jr)}};function ni(e,t,n,r,i,a){var o;return o=A(e)?e:ti[e]||ti.euclidean,0===t&&A(e)?o(i,a):o(t,n,r,i,a)}ti["squared-euclidean"]=ti["squaredEuclidean"],ti["squaredeuclidean"]=ti["squaredEuclidean"];var ri=Ut({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ii=function(e){return ri(e)},ai=function(e,t,n,r,i){var a="kMedoids"!==i,o=a?function(e){return n[e]}:function(e){return r[e](n)},s=function(e){return r[e](t)},l=n,u=t;return ni(e,r.length,o,s,l,u)},oi=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1}return!0},hi=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,g=t[o],f=t[r[o]];p="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=p,e.splice(f.index,1),t[g.key]=p;for(var v=0;vn[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]0&&r.push(i);return r},Oi=function(e,t,n){for(var r=[],i=0;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;ul&&(s=u,l=c)}n[i]=a[s]}return r=Oi(e,t,n),r},Bi=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=Li(e),c={},h=0;h=C?(D=C,C=S,N=k):S>D&&(D=S);for(var L=0;L0?1:0;T[E%u.minIterations*t+B]=F,R+=F}if(R>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var z=0,G=0;G1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.degree(!0);i%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))}else h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var p=function(e){var t,n,r,i=e,a=[e];while(c[i].length)t=c[i].shift(),n=h[t][0],r=h[t][1],i!=r?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],f=[];f=p(i);while(1!=f.length)0==c[f[0]].length?(g.unshift(l.getElementById(f.shift())),g.unshift(l.getElementById(f.shift()))):f=p(f.shift()).concat(f);for(var v in g.unshift(l.getElementById(f.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},Vi=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){var o=a.length-1,s=[],l=e.spawn();while(a[o].x!=n||a[o].y!=r)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)},l=function l(u,c,h){u===h&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var d,p,g,f,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach((function(e){d=e.source().id(),p=e.target().id(),g=d===c?p:d,g!==h&&(f=e.id(),o[f]||(o[f]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},Xi={hopcroftTarjanBiconnected:Vi,htbc:Vi,htb:Vi,hopcroftTarjanBiconnectedComponents:Vi},Yi=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){i.push(s),t[s]={index:n,low:n++,explored:!1};var l=e.getElementById(s).connectedEdges().intersection(e);if(l.forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var u=e.spawn();;){var c=i.pop();if(u.merge(e.getElementById(c)),t[c].low=t[s].index,t[c].explored=!0,c===s)break}var h=u.edgesWith(u),d=u.merge(h);r.push(d),a=a.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},Ui={tarjanStronglyConnected:Yi,tsc:Yi,tscc:Yi,tarjanStronglyConnectedComponents:Yi},Wi={};[rn,ln,un,hn,pn,fn,bn,Dr,Sr,Lr,Ir,Hr,xi,Si,Fi,Gi,Xi,Ui].forEach((function(e){re(Wi,e)})); /*! Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) Licensed under The MIT License (http://opensource.org/licenses/MIT) */var ji=0,Hi=1,qi=2,$i=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=ji,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};$i.prototype={fulfill:function(e){return Ki(this,Hi,"fulfillValue",e)},reject:function(e){return Ki(this,qi,"rejectReason",e)},then:function(e,t){var n=this,r=new $i;return n.onFulfilled.push(Ji(e,r,"fulfill")),n.onRejected.push(Ji(t,r,"reject")),Zi(n),r.proxy}};var Ki=function(e,t,n,r){return e.state===ji&&(e.state=t,e[n]=r,Zi(e)),e},Zi=function(e){e.state===Hi?Qi(e,"onFulfilled",e.fulfillValue):e.state===qi&&Qi(e,"onRejected",e.rejectReason)},Qi=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i-1}var bo=mo;function xo(e,t){var n=this.__data__,r=co(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var wo=xo;function Eo(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t-1&&e%1==0&&e0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){C(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Gs.className=Gs.classNames=Gs.classes;var Vs={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:q,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Vs.variable="(?:[\\w-.]|(?:\\\\"+Vs.metaChar+"))+",Vs.className="(?:[\\w-]|(?:\\\\"+Vs.metaChar+"))+",Vs.value=Vs.string+"|"+Vs.number,Vs.id=Vs.variable,function(){var e,t,n;for(e=Vs.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Vs.comparatorOp+="|\\!"+t)}();var Xs=function(){return{checks:[]}},Ys={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Us=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return ne(e.selector,t.selector)})),Ws=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return Bt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Bt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Bt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},el=function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return _(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case Ys.GROUP:var l=e(s);return l.substring(0,l.length-1);case Ys.DATA_COMPARE:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case Ys.DATA_BOOL:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case Ys.DATA_EXIST:var p=r.field;return"["+p+"]";case Ys.META_COMPARE:var g=r.operator,f=r.field;return"[["+f+n(e(g))+t(s)+"]]";case Ys.STATE:return s;case Ys.ID:return"#"+s;case Ys.CLASS:return"."+s;case Ys.PARENT:case Ys.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case Ys.ANCESTOR:case Ys.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case Ys.COMPOUND_SPLIT:var v=i(r.left,a),y=i(r.subject,a),m=i(r.right,a);return v+(v.length>0?" ":"")+y+m;case Ys.TRUE:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e0){var c=i.shift();t(c),a.add(c.id()),s&&r(i,a,c)}return e}function xl(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,xl)},ml.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,wl)},ml.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return bl(this,e,t,El)},ml.ancestors=ml.parents,fl=vl={data:Fs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Fs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Fs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Fs.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Fs.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},fl.attr=fl.data,fl.removeAttr=fl.removeData;var Tl,_l,Al=vl,Cl={};function Dl(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;ot})),minIndegree:Nl("indegree",(function(e,t){return et})),minOutdegree:Nl("outdegree",(function(e,t){return et}))}),re(Cl,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d0,v=f;f&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==i&&p.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}},Tl.modelPosition=Tl.point=Tl.position,Tl.modelPositions=Tl.points=Tl.positions,Tl.renderedPoint=Tl.renderedPosition,Tl.relativePoint=Tl.relativePosition;var Ll,Pl,Il=_l;Ll=Pl={},Pl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Pl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Pl.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||(a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue},a.x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=m(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function m(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Rl=function(e,t){return null==t?e:Ol(e,t.x1,t.y1,t.x2,t.y2)},Bl=function(e,t,n){return qt(e,t,n)},Fl=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var u=a.arrowBounds=a.arrowBounds||{},c=u[n]=u[n]||{};c.x1=r-s,c.y1=i-s,c.x2=r+s,c.y2=i+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Wn(c,1),Ol(e,c.x1,c.y1,c.x2,c.y2)}}},zl=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle,o=t.pstyle(r+"label").strValue;if(o){var s,l,u,c,h=t.pstyle("text-halign"),d=t.pstyle("text-valign"),p=Bl(a,"labelWidth",n),g=Bl(a,"labelHeight",n),f=Bl(a,"labelX",n),v=Bl(a,"labelY",n),y=t.pstyle(r+"text-margin-x").pfValue,m=t.pstyle(r+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle(r+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue,T=E/2,_=t.pstyle("text-background-padding").pfValue,A=2,C=g,D=p,N=D/2,S=C/2;if(b)s=f-N,l=f+N,u=v-S,c=v+S;else{switch(h.value){case"left":s=f-D,l=f;break;case"center":s=f-N,l=f+N;break;case"right":s=f,l=f+D;break}switch(d.value){case"top":u=v-C,c=v;break;case"center":u=v-S,c=v+S;break;case"bottom":u=v,c=v+C;break}}var k=y-Math.max(w,T)-_-A,L=y+Math.max(w,T)+_+A,P=m-Math.max(w,T)-_-A,I=m+Math.max(w,T)+_+A;s+=k,l+=L,u+=P,c+=I;var M=n||"main",O=i.labelBounds,R=O[M]=O[M]||{};R.x1=s,R.y1=u,R.x2=l,R.y2=c,R.w=l-s,R.h=c-u,R.leftPad=k,R.rightPad=L,R.topPad=P,R.botPad=I;var B=b&&"autorotate"===x.strValue,F=null!=x.pfValue&&0!==x.pfValue;if(B||F){var z=B?Bl(i.rstyle,"labelAngle",n):x.pfValue,G=Math.cos(z),V=Math.sin(z),X=(s+l)/2,Y=(u+c)/2;if(!b){switch(h.value){case"left":X=l;break;case"right":X=s;break}switch(d.value){case"top":Y=c;break;case"bottom":Y=u;break}}var U=function(e,t){return e-=X,t-=Y,{x:e*G-t*V+X,y:e*V+t*G+Y}},W=U(s,u),j=U(s,c),H=U(l,u),q=U(l,c);s=Math.min(W.x,j.x,H.x,q.x),l=Math.max(W.x,j.x,H.x,q.x),u=Math.min(W.y,j.y,H.y,q.y),c=Math.max(W.y,j.y,H.y,q.y)}var $=M+"Rot",K=O[$]=O[$]||{};K.x1=s,K.y1=u,K.x2=l,K.y2=c,K.w=l-s,K.h=c-u,Ol(e,s,u,l,c),Ol(i.labelBounds.all,s,u,l,c)}return e}},Gl=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0,c=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,c=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,c=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,c=.5*-o);var h=e.h*l-e.h,d=e.w*s-e.w;if(jn(e,[Math.ceil(h/2),Math.ceil(d/2)]),0!=u||0!==c){var p=Xn(e,u,c);Yn(e,p)}}}},Vl=function(e,t){var n,r,i,a,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),h=zn(),d=e._private,p=e.isNode(),g=e.isEdge(),f=d.rstyle,v=p&&u?e.pstyle("bounds-expansion").pfValue:[0],y=function(e){return"none"!==e.pstyle("display").value},m=!u||y(e)&&(!g||y(e.source())&&y(e.target()));if(m){var b=0,x=0;u&&t.includeOverlays&&(b=e.pstyle("overlay-opacity").value,0!==b&&(x=e.pstyle("overlay-padding").value));var w=0,E=0;u&&t.includeUnderlays&&(w=e.pstyle("underlay-opacity").value,0!==w&&(E=e.pstyle("underlay-padding").value));var T=Math.max(x,E),_=0,A=0;if(u&&(_=e.pstyle("width").pfValue,A=_/2),p&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var D=e.outerWidth(),N=D/2,S=e.outerHeight(),k=S/2;n=o-N,r=o+N,i=s-k,a=s+k,Ol(h,n,i,r,a),u&&t.includeOutlines&&Gl(h,e)}else if(g&&t.includeEdges)if(u&&!c){var L=e.pstyle("curve-style").strValue;if(n=Math.min(f.srcX,f.midX,f.tgtX),r=Math.max(f.srcX,f.midX,f.tgtX),i=Math.min(f.srcY,f.midY,f.tgtY),a=Math.max(f.srcY,f.midY,f.tgtY),n-=A,r+=A,i-=A,a+=A,Ol(h,n,i,r,a),"haystack"===L){var P=f.haystackPts;if(P&&2===P.length){if(n=P[0].x,i=P[0].y,r=P[1].x,a=P[1].y,n>r){var I=n;n=r,r=I}if(i>a){var M=i;i=a,a=M}Ol(h,n-A,i-A,r+A,a+A)}}else if("bezier"===L||"unbundled-bezier"===L||L.endsWith("segments")||L.endsWith("taxi")){var O;switch(L){case"bezier":case"unbundled-bezier":O=f.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":O=f.linePts;break}if(null!=O)for(var R=0;Rr){var X=n;n=r,r=X}if(i>a){var Y=i;i=a,a=Y}n-=A,r+=A,i-=A,a+=A,Ol(h,n,i,r,a)}if(u&&t.includeEdges&&g&&(Fl(h,e,"mid-source"),Fl(h,e,"mid-target"),Fl(h,e,"source"),Fl(h,e,"target")),u){var U="yes"===e.pstyle("ghost").value;if(U){var W=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue;Ol(h,h.x1+W,h.y1+j,h.x2+W,h.y2+j)}}var H=d.bodyBounds=d.bodyBounds||{};Hn(H,h),jn(H,v),Wn(H,1),u&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ol(h,n-T,i-T,r+T,a+T));var q=d.overlayBounds=d.overlayBounds||{};Hn(q,h),jn(q,v),Wn(q,1);var $=d.labelBounds=d.labelBounds||{};null!=$.all?Vn($.all):$.all=zn(),u&&t.includeLabels&&(t.includeMainLabels&&zl(h,e,null),g&&(t.includeSourceLabels&&zl(h,e,"source"),t.includeTargetLabels&&zl(h,e,"target")))}return h.x1=Ml(h.x1),h.y1=Ml(h.y1),h.x2=Ml(h.x2),h.y2=Ml(h.y2),h.w=Ml(h.x2-h.x1),h.h=Ml(h.y2-h.y1),h.w>0&&h.h>0&&m&&(jn(h,v),Wn(h,1)),h},Xl=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:mu,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},xu.removeAllListeners=function(){return this.removeListener("*")},xu.emit=xu.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,C(t)||(t=[t]),Tu(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||i.namespace===fu)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&Ht(o,t),e.beforeEmit(e.context,i,a),i.conf&&i.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==i})));var s=e.callbackContext(e.context,i,a),l=i.callback.apply(s,o);e.afterEmit(e.context,i,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s1&&!a){var o=this.length-1,s=this[o],l=s._private.data.id;this[o]=void 0,this[e]=s,i.set(l,{ele:s,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,i=r.get(n);if(!i)return this;var a=i.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&_(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(D(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify("style")}else if(_(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(void 0===e)for(var a=0;a0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),$u.neighbourhood=$u.neighborhood,$u.closedNeighbourhood=$u.closedNeighborhood,$u.openNeighbourhood=$u.openNeighborhood,re($u,{source:yl((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:yl((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:Ju({attr:"source"}),targets:Ju({attr:"target"})}),re($u,{edgesWith:yl(ec(),"edgesWith"),edgesTo:yl(ec({thisIsSrc:!0}),"edgesTo")}),re($u,{connectedEdges:yl((function(e){for(var t=[],n=this,r=0;r0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),$u.componentsOf=$u.components;var nc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new Zt,a=!1;if(t){if(t.length>0&&D(t[0])&&!I(t[0])){a=!0;for(var o=[],s=new en,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var B,z=e.length===i.length?i:new nc(a,e),G=0;G0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?D.emitAndNotify("remove"):t&&D.emit("remove"));for(var N=0;N0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,c):0===h?c:x(t,r,r+u)}var E=!1;function T(){E=!0,e===t&&n===r||b()}var _=function(i){return E||T(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var A="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return A},_}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var oc=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4,d=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,a=null!==i,a?(c=e(t,r),o=c/i*d):o=d;;)if(s=n(s||l,o),u.push(1+s.x),c+=16,!(Math.abs(s.x)>h&&Math.abs(s.v)>h))break;return a?function(e){return u[e*(u.length-1)|0]}:c}}(),sc=function(e,t,n,r){var i=ac(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},lc={linear:function(e,t,n){return e+(t-e)*n},ease:sc(.25,.1,.25,1),"ease-in":sc(.42,0,1,1),"ease-out":sc(0,0,.58,1),"ease-in-out":sc(.42,0,.58,1),"ease-in-sine":sc(.47,0,.745,.715),"ease-out-sine":sc(.39,.575,.565,1),"ease-in-out-sine":sc(.445,.05,.55,.95),"ease-in-quad":sc(.55,.085,.68,.53),"ease-out-quad":sc(.25,.46,.45,.94),"ease-in-out-quad":sc(.455,.03,.515,.955),"ease-in-cubic":sc(.55,.055,.675,.19),"ease-out-cubic":sc(.215,.61,.355,1),"ease-in-out-cubic":sc(.645,.045,.355,1),"ease-in-quart":sc(.895,.03,.685,.22),"ease-out-quart":sc(.165,.84,.44,1),"ease-in-out-quart":sc(.77,0,.175,1),"ease-in-quint":sc(.755,.05,.855,.06),"ease-out-quint":sc(.23,1,.32,1),"ease-in-out-quint":sc(.86,0,.07,1),"ease-in-expo":sc(.95,.05,.795,.035),"ease-out-expo":sc(.19,1,.22,1),"ease-in-out-expo":sc(1,0,0,1),"ease-in-circ":sc(.6,.04,.98,.335),"ease-out-circ":sc(.075,.82,.165,1),"ease-in-out-circ":sc(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return lc.linear;var r=oc(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":sc};function uc(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function cc(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function hc(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=cc(e,i),s=cc(t,i);if(S(o)&&S(s))return uc(a,o,s,n,r);if(C(o)&&C(s)){for(var l=[],u=0;u0?("spring"===d&&p.push(o.duration),o.easingImpl=lc[d].apply(null,p)):o.easingImpl=lc[d]}var f,v=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var y=o.startPosition,m=o.position;if(m&&i&&!e.locked()){var b={};pc(y.x,m.x)&&(b.x=hc(y.x,m.x,f,v)),pc(y.y,m.y)&&(b.y=hc(y.y,m.y,f,v)),e.position(b)}var x=o.startPan,w=o.pan,E=a.pan,T=null!=w&&r;T&&(pc(x.x,w.x)&&(E.x=hc(x.x,w.x,f,v)),pc(x.y,w.y)&&(E.y=hc(x.y,w.y,f,v)),e.emit("pan"));var A=o.startZoom,C=o.zoom,D=null!=C&&r;D&&(pc(A,C)&&(a.zoom=Fn(a.minZoom,hc(A,C,f,v),a.maxZoom)),e.emit("zoom")),(T||D)&&e.emit("viewport");var N=o.style;if(N&&N.length>0&&i){for(var S=0;S=0;t--){var n=e[t];n()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||gc(t,h,e),dc(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var vc={animate:Fs.animate(),animation:Fs.animation(),animated:Fs.animated(),clearQueue:Fs.clearQueue(),delay:Fs.delay(),delayAnimation:Fs.delayAnimation(),stop:Fs.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){fc(n,e)}),t.beforeRenderPriorities.animations):n()}function n(){e._private.animationsRunning&&dt((function(t){fc(t,e),n()}))}}},yc={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&I(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},mc=function(e){return _(e)?new dl(e):e},bc={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new bu(yc,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,mc(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,mc(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,mc(t),n),this},once:function(e,t,n){return this.emitter().one(e,mc(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Fs.eventAliasesOn(bc);var xc={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};xc.jpeg=xc.jpg;var wc={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=_(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(re({},e,{cy:t,eles:i}));return a}Ot("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Ot("A `name` must be specified to make a layout");else Ot("Layout options must be specified to make a layout")}};wc.createLayout=wc.makeLayout=wc.layout;var Ec={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0)t.removeChild(t.childNodes[0])}e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};_c.invalidateDimensions=_c.resize;var Ac={collection:function(e,t){return _(e)?this.$(e):P(e)?e.collection():C(e)?(t||(t={}),new nc(this,e,t.unique,t.removed)):new nc(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ac.elements=Ac.filter=Ac.$;var Cc={},Dc="t",Nc="f";Cc.apply=function(e){for(var t=this,n=t._private,r=n.cy,i=r.collection(),a=0;a0;if(d||h&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var f=0;f1&&(v=1),s.color){var E=i.valueMin[0],T=i.valueMax[0],_=i.valueMin[1],A=i.valueMax[1],C=i.valueMin[2],D=i.valueMax[2],N=null==i.valueMin[3]?1:i.valueMin[3],k=null==i.valueMax[3]?1:i.valueMax[3],L=[Math.round(E+(T-E)*v),Math.round(_+(A-_)*v),Math.round(C+(D-C)*v),Math.round(N+(k-N)*v)];n={bypass:i.bypass,name:i.name,value:L,strValue:"rgb("+L[0]+", "+L[1]+", "+L[2]+")"}}else{if(!s.number)return!1;var P=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,P,i.bypass,d)}if(!n)return f(),!1;n.mapping=i,i=n;break;case o.data:for(var I=i.field.split("."),M=h.data,O=0;O0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Cc.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Cc.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Cc.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!i.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.dirtyBoundingBoxCache()})),!i.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Cc.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Sc={applyBypass:function(e,t,n,r){var i=this,a=[],o=!0;if("*"===t||"**"===t){if(void 0!==n)for(var s=0;st.length?o.substr(t.length):""}function l(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");;){var u=o.match(/^\s*$/);if(u)break;var c=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Bt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=c[0];var h=c[1];if("core"!==h){var d=new dl(h);if(d.invalid){Bt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),s();continue}}var p=c[2],g=!1;n=p;for(var f=[];;){var v=n.match(/^\s*$/);if(v)break;var y=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Bt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),g=!0;break}r=y[0];var m=y[1],b=y[2],x=i.properties[m];if(x){var w=a.parse(m,b);w?(f.push({name:m,val:b}),l()):(Bt("Skipping property: Invalid property definition in: "+r),l())}else Bt("Skipping property: Invalid property name in: "+r),l()}if(g){s();break}a.selector(h);for(var E=0;E=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(h.multiple)return!1;var p=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var f=this.parse(e,c[5]);if(!f||f.mapped)return!1;if(g.pfValue===f.pfValue||g.strValue===f.strValue)return Bt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=f.value,m=v[0]===y[0]&&v[1]===y[1]&&v[2]===y[2]&&(v[3]===y[3]||(null==v[3]||1===v[3])&&(null==y[3]||1===y[3]));if(m)return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:f.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var b;if(b=l?t.split(/\s+/):C(t)?t:[t],h.evenMultiple&&b.length%2!==0)return null;for(var x=[],w=[],E=[],T="",D=!1,N=0;N0?" ":"")+S.strValue}return h.validate&&!h.validate(x,w)?null:h.singleEnum&&D?1===x.length&&_(x[0])?{name:e,value:x[0],strValue:x[0],bypass:n}:null:{name:e,value:x,pfValue:E,strValue:T,bypass:n,units:w}}var L=function(){for(var r=0;rh.max||h.strictMax&&t===h.max))return null;var R={name:e,value:t,strValue:""+t+(P||""),units:P,bypass:n};return h.unitless||"px"!==P&&"em"!==P?R.pfValue=t:R.pfValue="px"!==P&&P?this.getEmSizeInPixels()*t:t,"ms"!==P&&"s"!==P||(R.pfValue="ms"===P?t:1e3*t),"deg"!==P&&"rad"!==P||(R.pfValue="rad"===P?t:Nn(t)),"%"===P&&(R.pfValue=t/100),R}if(h.propList){var B=[],F=""+t;if("none"===F);else{for(var z=F.split(/\s*,\s*|\s+/),G=0;G0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){a=Math.min((o-2*t)/n.w,(s-2*t)/n.h),a=a>this._private.maxZoom?this._private.maxZoom:a,a=a=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),S(e)?n=e:D(e)&&(n=e.level,null!=e.position?t=wn(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=n>r.maxZoom?r.maxZoom:n,n=nt.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;S(l.x)&&(t.pan.x=l.x,o=!1),S(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(_(e)){var n=e;e=this.mutableElements().filter(n)}else P(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();t=void 0===t?this._private.zoom:t;var o={x:(i-t*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2};return o}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var e=n.window().getComputedStyle(t),r=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-r("padding-left")-r("padding-right"),height:t.clientHeight-r("padding-top")-r("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Gc.centre=Gc.center,Gc.autolockNodes=Gc.autolock,Gc.autoungrabifyNodes=Gc.autoungrabify;var Vc={data:Fs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Fs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Fs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Fs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Vc.attr=Vc.data,Vc.removeAttr=Vc.removeData;var Xc=function(e){var t=this;e=re({},e);var n=e.container;n&&!L(n)&&L(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==y&&void 0!==n&&!e.headless,o=e;o.layout=re({name:a?"grid":"null"},o.layout),o.renderer=re({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new nc(this),listeners:[],aniEles:new nc(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:S(o.zoom)?o.zoom:1,pan:{x:D(o.pan)&&S(o.pan.x)?o.pan.x:0,y:D(o.pan)&&S(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var u=function(e,t){var n=e.some(V);if(n)return ta.all(e).then(t);t(e)};l.styleEnabled&&t.setStyle([]);var c=re({},o,o.renderer);t.initRenderer(c);var h=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(D(e)||C(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=re({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};u([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),h(a,(function(){t.startAnimationLoop(),l.ready=!0,A(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,l=!!t.boundingBox,u=n.extent(),c=zn(l?t.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h});if(P(t.roots))e=t.roots;else if(C(t.roots)){for(var h=[],d=0;d0){var M=I(),O=N(M,k);if(O)M.outgoers().filter((function(e){return e.isNode()&&r.has(e)})).forEach(L);else if(null===O){Bt("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var R=0;if(t.avoidOverlap)for(var B=0;B0&&m[0].length<=3?a/2:0),s=2*Math.PI/m[r].length*i;return 0===r&&1===m[0].length&&(o=1),{x:Q.x+o*Math.cos(s),y:Q.y+o*Math.sin(s)}}var u=m[r].length,h=Math.max(1===u?0:l?(c.w-2*t.padding-J.w)/((t.grid?ne:u)-1):(c.w-2*t.padding-J.w)/((t.grid?ne:u)+1),R),d={x:Q.x+(i+1-(u+1)/2)*h,y:Q.y+(r+1-(W+1)/2)*ee};return d};return r.nodes().layoutPositions(this,t,re),this};var $c={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Kc(e){this.options=re({},$c,e)}Kc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep,c=u/Math.max(1,a.length-1),h=0,d=0;d1&&t.avoidOverlap){h*=1.75;var y=Math.cos(c)-Math.cos(0),m=Math.sin(c)-Math.sin(0),b=Math.sqrt(h*h/(y*y+m*m));o=Math.max(b,o)}var x=function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r),u={x:l.x+a,y:l.y+s};return u};return r.nodes().layoutPositions(this,t,x),this};var Zc,Qc={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Jc(e){this.options=re({},Qc,e)}Jc.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c0){var w=Math.abs(m[0].value-x.value);w>=v&&(m=[],y.push(m))}m.push(x)}var E=u+t.minNodeSpacing;if(!t.avoidOverlap){var T=y.length>0&&y[0].length>1,_=Math.min(o.w,o.h)/2-E,A=_/(y.length+T?1:0);E=Math.min(E,A)}for(var C=0,D=0;D1&&t.avoidOverlap){var L=Math.cos(k)-Math.cos(0),P=Math.sin(k)-Math.sin(0),I=Math.sqrt(E*E/(L*L+P*P));C=Math.max(I,C)}N.r=C,C+=E}if(t.equidistant){for(var M=0,O=0,R=0;R=e.numIter)&&(uh(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),dt(t)}else wh(r,e),s()};c()}else{while(u)u=o(l),l++;wh(r,e),s()}return this},th.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},th.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var nh,rh=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=zn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(T);for(u=0;ur.count?0:r.graph},ah=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var c=r.nodeOverlap*u,h=Math.sqrt(o*o+s*s),d=c*o/h,p=c*s/h;else{var g=gh(e,o,s),f=gh(t,-1*o,-1*s),v=f.x-g.x,y=f.y-g.y,m=v*v+y*y;h=Math.sqrt(m),c=(e.nodeRepulsion+t.nodeRepulsion)/m,d=c*v/h,p=c*y/h}e.isLocked||(e.offsetX-=d,e.offsetY-=p),t.isLocked||(t.offsetX+=d,t.offsetY+=p)}},ph=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},gh=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},fh=function(e,t){for(var n=0;nn){var f=t.gravity*d/g,v=t.gravity*p/g;h.offsetX+=f,h.offsetY+=v}}}}},yh=function(e,t){var n=[],r=0,i=-1;n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;while(r<=i){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},xh=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopv&&(p+=f+t.componentSpacing,d=0,g=0,f=0)}}},Eh={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Th(e){this.options=re({},Eh,e)}Th.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);var t=Math.min(l,u);t==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);var t=Math.max(l,u);t==l?l=e:u=e},d=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=p)l=d,u=p;else if(null!=d&&null==p)l=d,u=Math.ceil(o/l);else if(null==d&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var g=c(),f=h();(g-1)*f>=o?c(g-1):(f-1)*g>=o&&h(f-1)}else while(u*l=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(L=0,k++)},I={},M=0;M(r=ir(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=rr(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),T=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return qt(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value,u="yes"===n.pstyle("text-events").strValue;if(u&&l){var c=b(a.rscratch,"labelX",r),h=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),p=n.pstyle(i+"text-margin-x").pfValue,f=n.pstyle(i+"text-margin-y").pfValue,y=s.x1-o-p,m=s.x2+o-p,x=s.y1-o-f,w=s.y2+o-f;if(d){var E=Math.cos(d),T=Math.sin(d),_=function(e,t){return e-=c,t-=h,{x:e*E-t*T+c,y:e*T+t*E+h}},A=_(y,x),C=_(y,w),D=_(m,x),N=_(m,w),S=[A.x+p,A.y+f,D.x+p,D.y+f,N.x+p,N.y+f,C.x+p,C.y+f];if(ar(e,t,S))return v(n),!0}else if($n(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=o,n=s,t=l,r=u;for(var c=zn({x1:e,y1:t,x2:n,y2:r}),h=0;h0?-(Math.PI-e.ang):Math.PI+e.ang},id=function(e,t,n,r,i){if(e!==Jh?nd(t,e,ed):rd(td,ed),nd(t,n,td),zh=ed.nx*td.ny-ed.ny*td.nx,Gh=ed.nx*td.nx-ed.ny*-td.ny,Yh=Math.asin(Math.max(-1,Math.min(1,zh))),Math.abs(Yh)<1e-6)return Bh=t.x,Fh=t.y,void(Wh=Hh=0);Vh=1,Xh=!1,Gh<0?Yh<0?Yh=Math.PI+Yh:(Yh=Math.PI-Yh,Vh=-1,Xh=!0):Yh>0&&(Vh=-1,Xh=!0),Hh=void 0!==t.radius?t.radius:r,Uh=Yh/2,qh=Math.min(ed.len/2,td.len/2),i?(jh=Math.abs(Math.cos(Uh)*Hh/Math.sin(Uh)),jh>qh?(jh=qh,Wh=Math.abs(jh*Math.sin(Uh)/Math.cos(Uh))):Wh=Hh):(jh=Math.min(qh,Hh),Wh=Math.abs(jh*Math.sin(Uh)/Math.cos(Uh))),Zh=t.x+td.nx*jh,Qh=t.y+td.ny*jh,Bh=Zh-td.ny*Wh*Vh,Fh=Qh+td.nx*Wh*Vh,$h=t.x+ed.nx*jh,Kh=t.y+ed.ny*jh,Jh=t};function ad(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function od(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(id(e,t,n,r,i),{cx:Bh,cy:Fh,radius:Wh,startX:$h,startY:Kh,stopX:Zh,stopY:Qh,startAngle:ed.ang+Math.PI/2*Vh,endAngle:td.ang-Math.PI/2*Vh,counterClockwise:Xh})}var sd={};function ld(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},S=N(C,_),k=N(D,A),L=!1;m===u?y=Math.abs(S)>Math.abs(k)?i:r:m===l||m===s?(y=r,L=!0):m!==a&&m!==o||(y=i,L=!0);var P,I=y===r,M=I?k:S,O=I?D:C,R=Ln(O),B=!1;if(L&&(x||E)||!(m===s&&O<0||m===l&&O>0||m===a&&O>0||m===o&&O<0)||(R*=-1,M=R*Math.abs(M),B=!0),x){var F=w<0?1+w:w;P=F*M}else{var z=w<0?M:0;P=z+w*R}var G=function(e){return Math.abs(e)=Math.abs(M)},V=G(P),X=G(Math.abs(M)-Math.abs(P)),Y=V||X;if(Y&&!B)if(I){var U=Math.abs(O)<=d/2,W=Math.abs(C)<=p/2;if(U){var j=(c.x1+c.x2)/2,H=c.y1,q=c.y2;n.segpts=[j,H,j,q]}else if(W){var $=(c.y1+c.y2)/2,K=c.x1,Z=c.x2;n.segpts=[K,$,Z,$]}else n.segpts=[c.x1,c.y2]}else{var Q=Math.abs(O)<=h/2,J=Math.abs(D)<=g/2;if(Q){var ee=(c.y1+c.y2)/2,te=c.x1,ne=c.x2;n.segpts=[te,ee,ne,ee]}else if(J){var re=(c.x1+c.x2)/2,ie=c.y1,ae=c.y2;n.segpts=[re,ie,re,ae]}else n.segpts=[c.x2,c.y1]}else if(I){var oe=c.y1+P+(v?d/2*R:0),se=c.x1,le=c.x2;n.segpts=[se,oe,le,oe]}else{var ue=c.x1+P+(v?h/2*R:0),ce=c.y1,he=c.y2;n.segpts=[ue,ce,ue,he]}if(n.isRound){var de=e.pstyle("taxi-radius").value,pe="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(de),n.isArcRadius=new Array(n.segpts.length/2).fill(pe)}},sd.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,g=t.tgtRs,f=!S(n.startX)||!S(n.startY),v=!S(n.arrowStartX)||!S(n.arrowStartY),y=!S(n.endX)||!S(n.endY),m=!S(n.arrowEndX)||!S(n.arrowEndY),b=3,x=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,w=b*x,E=Pn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),T=Ed.poolIndex()){var p=h;h=d,d=p}var g=s.srcPos=h.position(),f=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),m=s.tgtW=d.outerWidth(),b=s.tgtH=d.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(h)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(d)],E=s.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,T=s.tgtCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,_=s.tgtRs=d._private.rscratch,A=s.srcRs=h._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var C=0;C0){var $=u,K=In($,Tn(t)),Z=In($,Tn(q)),Q=K;if(Z2){var J=In($,{x:q[2],y:q[3]});J0){var de=c,pe=In(de,Tn(t)),ge=In(de,Tn(he)),fe=pe;if(ge2){var ve=In(de,{x:he[2],y:he[3]});ve=u||m){c={cp:f,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,T=s?x.t0+E*w:x.t1-E*w;T=Fn(0,T,1),t=Rn(b.p0,b.p1,b.p2,T),i=fd(b.p0,b.p1,b.p2,T);break;case"straight":case"segments":case"haystack":for(var _,A,C,D,N=0,S=r.allpts.length,k=0;k+3=u)break;var L=u-A,P=L/_;P=Fn(0,P,1),t=Bn(C,D,P),i=gd(C,D);break}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},dd.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},dd.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=qt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;$t(n.rstyle,"labelWidth",t,h),$t(n.rscratch,"labelWidth",t,h),$t(n.rstyle,"labelHeight",t,d),$t(n.rscratch,"labelHeight",t,d),$t(n.rscratch,"labelLineHeight",t,c)},dd.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?($t(n.rscratch,e,t,r),r):qt(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,p="anywhere"===d,g=[],f=/[\s\u200b]+|$/g,y=0;yh){var E,T=m.matchAll(f),_="",A=0,C=v(T);try{for(C.s();!(E=C.n()).done;){var D=E.value,N=D[0],S=m.substring(A,D.index);A=D.index+N.length;var k=0===_.length?S:_+S+N,L=this.calculateLabelDimensions(e,k),P=L.width;P<=h?_+=S+N:(_&&g.push(_),_=S+N)}}catch(z){C.e(z)}finally{C.f()}_.match(/^[\s\u200b]+$/)||g.push(_)}else g.push(m)}o("labelWrapCachedLines",g),i=o("labelWrapCachedText",g.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var I=e.pstyle("text-max-width").pfValue,M="",O="…",R=!1;if(this.calculateLabelDimensions(e,i).widthI)break;M+=i[B],B===i.length-1&&(R=!0)}return R||(M+=O),M}return i},dd.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},dd.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),i=r.document,a=_t(t,e._private.labelDimsKey),o=n.labelDimCache||(n.labelDimCache=[]),s=o[a];if(null!=s)return s;var l=0,u=e.pstyle("font-style").strValue,c=e.pstyle("font-size").pfValue,h=e.pstyle("font-family").strValue,d=e.pstyle("font-weight").strValue,p=this.labelCalcCanvas,g=this.labelCalcCanvasContext;if(!p){p=this.labelCalcCanvas=i.createElement("canvas"),g=this.labelCalcCanvasContext=p.getContext("2d");var f=p.style;f.position="absolute",f.left="-9999px",f.top="-9999px",f.zIndex="-1",f.visibility="hidden",f.pointerEvents="none"}g.font="".concat(u," ").concat(d," ").concat(c,"px ").concat(h);for(var v=0,y=0,m=t.split("\n"),b=0;b1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var N=a(t);v&&(e.hoverData.tapholdCancelled=!0);var k=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])};r=!0,i(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var L=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||s.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),p[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var P={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};b?b.emit(P):s.emit(P),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(r=!0,s.panningEnabled()&&s.userPanningEnabled()){var I;if(e.hoverData.justStartedPan){var M=e.hoverData.mdownPos;I={x:(c[0]-M[0])*l,y:(c[1]-M[1])*l},e.hoverData.justStartedPan=!1}else I={x:x[0]*l,y:x[1]*l};s.panBy(I),s.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=p[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||g==m||(m&&i(m,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&i(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),b)if(v){if(s.boxSelectionEnabled()&&N)b&&b.grabbed()&&(y(w),b.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),w.emit("dragfree"))),L();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var O=!e.dragData.didDrag;O&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(w,{inDragLayer:!0});var R={x:0,y:0};if(S(x[0])&&S(x[1])&&(R.x+=x[0],R.y+=x[1],O)){var B=e.hoverData.dragDelta;B&&S(B[0])&&S(B[1])&&(R.x+=B[0],R.y+=B[1])}e.hoverData.draggingEles=!0,w.silentShift(R).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else k();r=!0}else if(v){if(e.hoverData.dragging||!s.boxSelectionEnabled()||!N&&s.panningEnabled()&&s.userPanningEnabled()){if(!e.hoverData.selecting&&s.panningEnabled()&&s.userPanningEnabled()){var F=o(b,e.hoverData.downs);F&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,p[4]=0,e.data.bgActivePosistion=Tn(h),e.redrawHint("select",!0),e.redraw())}}else L();b&&b.pannable()&&b.active()&&b.unactivate()}return p[2]=c[0],p[3]=c[1],r?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if(1!==e.hoverData.which||1===t.which||!e.hoverData.capture){var r=e.hoverData.capture;if(r){e.hoverData.capture=!1;var o=e.cy,s=e.projectIntoViewport(t.clientX,t.clientY),l=e.selection,u=e.findNearestElement(s[0],s[1],!0,!1),c=e.dragData.possibleDragElements,h=e.hoverData.down,d=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,h&&h.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};if(h?h.emit(p):o.emit(p),!e.hoverData.cxtDragged){var g={originalEvent:t,type:"cxttap",position:{x:s[0],y:s[1]}};h?h.emit(g):o.emit(g)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(i(u,["mouseup","tapend","vmouseup"],t,{x:s[0],y:s[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(i(h,["click","tap","vclick"],t,{x:s[0],y:s[1]}),N=!1,t.timeStamp-k<=o.multiClickDebounceTime()?(D&&clearTimeout(D),N=!0,k=null,i(h,["dblclick","dbltap","vdblclick"],t,{x:s[0],y:s[1]})):(D=setTimeout((function(){N||i(h,["oneclick","onetap","voneclick"],t,{x:s[0],y:s[1]})}),o.multiClickDebounceTime()),k=t.timeStamp)),null!=h||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(o.$(n).unselect(["tapunselect"]),c.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=c=o.collection()),u!=h||e.dragData.didDrag||e.hoverData.selecting||null!=u&&u._private.selectable&&(e.hoverData.dragging||("additive"===o.selectionType()||d?u.selected()?u.unselect(["tapunselect"]):u.select(["tapselect"]):d||(o.$(n).unmerge(u).unselect(["tapunselect"]),u.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var f=o.collection(e.getAllInBox(l[0],l[1],l[2],l[3]));e.redrawHint("select",!0),f.length>0&&e.redrawHint("eles",!0),o.emit({type:"boxend",originalEvent:t,position:{x:s[0],y:s[1]}});var v=function(e){return e.selectable()&&!e.selected()};"additive"===o.selectionType()||d||o.$(n).unmerge(f).unselect(),f.emit("box").stdFilter(v).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!l[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var m=h&&h.grabbed();y(c),m&&(h.emit("freeon"),c.emit("free"),e.dragData.didDrag&&(h.emit("dragfreeon"),c.emit("dragfree")))}}l[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}}),!1);var P,I,M,O,R,B,F,z,G,V,X,Y,U,W=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||A())t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity;var l=1===t.deltaMode;l&&(s*=33);var u=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(u=e.gestureStartZoom*t.scale),n.zoom({level:u,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",W,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||W(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var j,H,q,$,K,Z,Q,J=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},ee=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",j=function(t){if(e.hasTouchStarted=!0,C(t)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);r[2]=o[0],r[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);r[4]=o[0],r[5]=o[1]}if(t.touches[1]){e.touchData.singleTouchMoved=!0,y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();G=s[0],V=s[1],X=s[2],Y=s[3],P=t.touches[0].clientX-G,I=t.touches[0].clientY-V,M=t.touches[1].clientX-G,O=t.touches[1].clientY-V,U=0<=P&&P<=X&&0<=M&&M<=X&&0<=I&&I<=Y&&0<=O&&O<=Y;var l=n.pan(),u=n.zoom();R=J(P,I,M,O),B=ee(P,I,M,O),F=[(P+M)/2,(I+O)/2],z=[(F[0]-l.x)/u,(F[1]-l.y)/u];var c=200,d=c*c;if(B=1){for(var _=e.touchData.startPosition=[null,null,null,null,null,null],A=0;A=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-G,T=t.touches[0].clientY-V,_=t.touches[1].clientX-G,A=t.touches[1].clientY-V,D=ee(E,T,_,A),N=D/B,k=150,L=k*k,F=1.5,X=F*F;if(N>=X||D>=L){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Y={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(Y),e.touchData.start=null):a.emit(Y)}}if(n&&e.touchData.cxt){Y={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(Y):a.emit(Y),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var W=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&W===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=W,W&&W.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3):(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var j=e.dragData.touchDragEles;if(j){e.redrawHint("drag",!0);for(var H=0;H0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",q=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",$=function(t){var r=e.touchData.start,a=e.touchData.capture;if(a){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var o=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var s,l=e.cy,u=l.zoom(),c=e.touchData.now,h=e.touchData.earlier;if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);c[0]=d[0],c[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);c[2]=d[0],c[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);c[4]=d[0],c[5]=d[1]}if(r&&r.unactivate(),e.touchData.cxt){if(s={originalEvent:t,type:"cxttapend",position:{x:c[0],y:c[1]}},r?r.emit(s):l.emit(s),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:c[0],y:c[1]}};r?r.emit(p):l.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&l.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var g=l.collection(e.getAllInBox(o[0],o[1],o[2],o[3]));o[0]=void 0,o[1]=void 0,o[2]=void 0,o[3]=void 0,o[4]=0,e.redrawHint("select",!0),l.emit({type:"boxend",originalEvent:t,position:{x:c[0],y:c[1]}});var f=function(e){return e.selectable()&&!e.selected()};g.emit("box").stdFilter(f).select().emit("boxselect"),g.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=r&&r.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var v=e.dragData.touchDragEles;if(null!=r){var m=r._private.grabbed;y(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),m&&(r.emit("freeon"),v.emit("free"),e.dragData.didDrag&&(r.emit("dragfreeon"),v.emit("dragfree"))),i(r,["touchend","tapend","vmouseup","tapdragout"],t,{x:c[0],y:c[1]}),r.unactivate(),e.touchData.start=null}else{var b=e.findNearestElement(c[0],c[1],!0,!0);i(b,["touchend","tapend","vmouseup","tapdragout"],t,{x:c[0],y:c[1]})}var x=e.touchData.startPosition[0]-c[0],w=x*x,E=e.touchData.startPosition[1]-c[1],T=E*E,_=w+T,A=_*u*u;e.touchData.singleTouchMoved||(r||l.$(":selected").unselect(["tapunselect"]),i(r,["tap","vclick"],t,{x:c[0],y:c[1]}),K=!1,t.timeStamp-Q<=l.multiClickDebounceTime()?(Z&&clearTimeout(Z),K=!0,Q=null,i(r,["dbltap","vdblclick"],t,{x:c[0],y:c[1]})):(Z=setTimeout((function(){K||i(r,["onetap","voneclick"],t,{x:c[0],y:c[1]})}),l.multiClickDebounceTime()),Q=t.timeStamp)),null!=r&&!e.dragData.didDrag&&r._private.selectable&&A0)return g[0]}return null},p=Object.keys(h),g=0;g0?d:Qn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){s="auto"===s?wr(r,i):s;var l=2*s;if(or(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(or(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n,h=[a-u,o-c,a-u,o,a+u,o,a+u,o-c];return!!ar(e,t,h)||(!!hr(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!hr(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",mr(3,0)),this.generateRoundPolygon("round-triangle",mr(3,0)),this.generatePolygon("rectangle",mr(4,0)),e["square"]=e["rectangle"],this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",mr(5,0)),this.generateRoundPolygon("round-pentagon",mr(5,0)),this.generatePolygon("hexagon",mr(6,0)),this.generateRoundPolygon("round-hexagon",mr(6,0)),this.generatePolygon("heptagon",mr(7,0)),this.generateRoundPolygon("round-heptagon",mr(7,0)),this.generatePolygon("octagon",mr(8,0)),this.generateRoundPolygon("round-octagon",mr(8,0));var r=new Array(20),i=xr(5,0),a=xr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*kd)break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},a=e.priority||Mt;n.beforeRender(i,a(t))}}}},Pd=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Pt;t(this,e),this.idsByKey=new Zt,this.keyForId=new Zt,this.cachesByLvl=new Zt,this.lvls=[],this.getKey=n,this.doesEleInvalidateKey=r}return i(e,[{key:"getIdsFor",value:function(e){null==e&&Ot("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new en,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e)["delete"](t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId["delete"](t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);return n!==r}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new Zt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id()),r=this.getCache(n,t);return r}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t)["delete"](e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),Id=25,Md=50,Od=-4,Rd=3,Bd=7.99,Fd=8,zd=1024,Gd=1024,Vd=1024,Xd=.2,Yd=.8,Ud=10,Wd=.15,jd=.1,Hd=.9,qd=.9,$d=100,Kd=1,Zd={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Qd=Ut({getKey:null,doesEleInvalidateKey:Pt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Lt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Jd=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Qd(t);re(n,r),n.lookup=new Pd(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},ep=Jd.prototype;ep.reasons=Zd,ep.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},ep.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},ep.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new on((function(e,t){return t.reqs-e.reqs}));return t},ep.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},ep.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(kn(s*n))),r=Bd||r>Rd)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(p=c<=Id?Id:c<=Md?Md:Math.ceil(c/Md)*Md,c>Vd||h>Gd)return null;var f=a.getTextureQueue(p),v=f[f.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=f[f.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)A=a.getElement(e,t,n,D,Zd.downscale);C()}else{var N;if(!x&&!w&&!E)for(var S=r-1;S>=Od;S--){var k=l.get(e,S);if(k){N=k;break}}if(b(N))return a.queueElement(e,r),N;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+Fd),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},ep.invalidateElements=function(e){for(var t=0;t=Xd*e.width&&this.retireTexture(e)},ep.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Yd&&e.fullnessChecks>=Ud?Wt(n,e):e.fullnessChecks++},ep.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;Wt(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,jt(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),Wt(i,o),r.push(o),o}},ep.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},ep.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o0))break;var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,Zd.dequeue)}}return i},ep.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];null!=a&&(1===a.eles.length?(a.reqs=kt,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},ep.onDequeue=function(e){this.onDequeues.push(e)},ep.offDequeue=function(e){Wt(this.onDequeues,e)},ep.setupDequeueing=Ld.setupDequeueing({deqRedrawThreshold:$d,deqCost:Wd,deqAvgCost:jd,deqNoDrawCost:Hd,deqFastCost:qd,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=ip||n>rp)return null;r.validateLayersElesOrdering(n,e);var l,u,c=r.layersByLevel,h=Math.pow(2,n),d=c[n]=c[n]||[],p=r.levelIsComplete(n,e),g=function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return u=c[t],!0},i=function(e){if(!u)for(var r=n+e;np<=r&&r<=rp;r+=e)if(t(r))break};i(1),i(-1);for(var a=d.length-1;a>=0;a--){var o=d[a];o.invalid&&Wt(d,o)}};if(p)return d;g();var f=function(){if(!l){l=zn();for(var t=0;tgp||a>gp)return null;var o=i*a;if(o>pp)return null;var s=r.makeLayer(l,n);if(null!=t){var u=d.indexOf(t)+1;d.splice(u,0,s)}else(void 0===e.insert||e.insert)&&d.unshift(s);return s};if(r.skipping&&!s)return null;for(var y=null,m=e.length/tp,b=!s,x=0;x=m||!Zn(y.bb,w.boundingBox()))&&(y=v({insert:!0,after:y}),!y))return null;u||b?r.queueLayer(y,w):r.drawEleInLayer(y,w,n,t),y.eles.push(w),T[n]=y}}return u||(b?null:d)},yp.getEleLevelForLayerLevel=function(e,t){return e},yp.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,fp),a.setImgSmoothing(o,!0))},yp.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||0===r.length)return!1;for(var i=0,a=0;a0)return!1;if(o.invalid)return!1;i+=o.eles.length}return i===t.length},yp.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},yp.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=pt(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},yp.invalidateLayer=function(e){if(this.lastInvalidationTime=pt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Wt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+f,e.lineCap=g,f>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===h?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},T=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},_=function(){o.drawElementText(e,t,null,r)};e.lineJoin="round";var A="yes"===t.pstyle("ghost").value;if(A){var C=t.pstyle("ghost-offset-x").pfValue,D=t.pstyle("ghost-offset-y").pfValue,N=t.pstyle("ghost-opacity").value,S=y*N;e.translate(C,D),b(S),T(S),e.translate(-C,-D)}else x();E(),b(),T(),w(),_(),n&&e.translate(l.x1,l.y1)}}},Op=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=n.pstyle("".concat(e,"-padding")).pfValue,l=2*s,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,u[0],u[1],u[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Mp.drawEdgeOverlay=Op("overlay"),Mp.drawEdgeUnderlay=Op("underlay"),Mp.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$"),d=a.pathCacheKey&&a.pathCacheKey===h;d?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([]);break}if(!s&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Bp.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(kn(n*r));t=Math.pow(2,i)}var a=e.pstyle("font-size").pfValue*t,o=e.pstyle("min-zoomed-font-size").pfValue;return!(a5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,g=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,g,a),t.isEdge()&&(o.drawText(e,t,"source",g,a),o.drawText(e,t,"target",g,a))):o.drawText(e,t,i,g,a),n&&e.translate(p.x1,p.y1)},Bp.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Bp.getTextAngle=function(e,t){var n,r=e._private,i=r.rscratch,a=t?t+"-":"",o=e.pstyle(a+"text-rotation");if("autorotate"===o.strValue){var s=qt(i,"labelAngle",t);n=e.isEdge()?s:0}else n="none"===o.strValue?0:o.pfValue;return n},Bp.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private,o=a.rscratch,s=i?t.effectiveOpacity():1;if(!i||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l,u,c=qt(o,"labelX",n),h=qt(o,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(c)&&!isNaN(h)){this.setupTextStyle(e,t,i);var p,g=n?n+"-":"",f=qt(o,"labelWidth",n),v=qt(o,"labelHeight",n),y=t.pstyle(g+"text-margin-x").pfValue,m=t.pstyle(g+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),c+=y,h+=m,p=r?this.getTextAngle(t,n):0,0!==p&&(l=c,u=h,e.translate(l,u),e.rotate(p),c=0,h=0),w){case"top":break;case"center":h+=v/2;break;case"bottom":h+=v;break}var E=t.pstyle("text-background-opacity").value,T=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,A=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,D=0===C.indexOf("round"),N=2;if(E>0||_>0&&T>0){var S=c-A;switch(x){case"left":S-=f;break;case"center":S-=f/2;break}var k=h-v-A,L=f+2*A,P=v+2*A;if(E>0){var I=e.fillStyle,M=t.pstyle("text-background-color").value;e.fillStyle="rgba("+M[0]+","+M[1]+","+M[2]+","+E*s+")",D?Fp(e,S,k,L,P,N):e.fillRect(S,k,L,P),e.fillStyle=I}if(_>0&&T>0){var O=e.strokeStyle,R=e.lineWidth,B=t.pstyle("text-border-color").value,F=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+T*s+")",e.lineWidth=_,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(D?Fp(e,S,k,L,P,N,"stroke"):e.strokeRect(S,k,L,P),"double"===F){var z=_/2;D?Fp(e,S+z,k+z,L-2*z,P-2*z,N,"stroke"):e.strokeRect(S+z,k+z,L-2*z,P-2*z)}e.setLineDash&&e.setLineDash([]),e.lineWidth=R,e.strokeStyle=O}}var G=2*t.pstyle("text-outline-width").pfValue;if(G>0&&(e.lineWidth=G),"wrap"===t.pstyle("text-wrap").value){var V=qt(o,"labelWrapCachedLines",n),X=qt(o,"labelLineHeight",n),Y=f/2,U=this.getLabelJustification(t);switch("auto"===U||("left"===x?"left"===U?c+=-f:"center"===U&&(c+=-Y):"center"===x?"left"===U?c+=-Y:"right"===U&&(c+=Y):"right"===x&&("center"===U?c+=Y:"right"===U&&(c+=f))),w){case"top":h-=(V.length-1)*X;break;case"center":case"bottom":h-=(V.length-1)*X;break}for(var W=0;W0&&e.strokeText(V[W],c,h),e.fillText(V[W],c,h),h+=X}else G>0&&e.strokeText(d,c,h),e.fillText(d,c,h);0!==p&&(e.rotate(-p),e.translate(-l,-u))}}};var zp={drawNode:function(e,t,n){var r,i,a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,h=t.position();if(S(h.x)&&S(h.y)&&(!s||t.visible())){var d,p,g=s?t.effectiveOpacity():1,f=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image"),b=m.value,x=new Array(b.length),w=new Array(b.length),E=0,T=0;T0&&void 0!==arguments[0]?arguments[0]:k;l.eleFillStyle(e,t,n)},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F;l.colorStrokeStyle(e,L[0],L[1],L[2],t)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;l.colorStrokeStyle(e,G[0],G[1],G[2],t)},q=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=At("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+U),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},$=t.pstyle("shape").strValue,K=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(h.x,h.y);var Z=q(r,i,$,K);d=Z.path,v=Z.cacheHit}var Q=function(){if(!v){var n=h;f&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i,U,c)}f?e.fill(d):e.fill()},J=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(f||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,U,c)))},te=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=(D>0?D:-D)*t,r=D>0?0:255;0!==D&&(l.colorFillStyle(e,r,r,r,n),f?e.fill(d):e.fill())},ne=function(){if(N>0){if(e.lineWidth=N,e.lineCap=M,e.lineJoin=I,e.setLineDash)switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(R),e.lineDashOffset=B;break;case"solid":case"double":e.setLineDash([]);break}if("center"!==O){if(e.save(),e.lineWidth*=2,"inside"===O)f?e.clip(d):e.clip();else{var t=new Path2D;t.rect(-r/2-N,-i/2-N,r+2*N,i+2*N),t.addPath(d),e.clip(t,"evenodd")}f?e.stroke(d):e.stroke(),e.restore()}else f?e.stroke(d):e.stroke();if("double"===P){e.lineWidth=N/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(d):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},re=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var n=h;f&&(n={x:0,y:0});var a=l.getNodeShape(t),o=N;"inside"===O&&(o=0),"outside"===O&&(o*=2);var s,u=(r+o+(z+Y))/r,c=(i+o+(z+Y))/i,d=r*u,p=i*c,g=l.nodeShapes[a].points;if(f){var v=q(d,p,a,g);s=v.path}if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,d,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var y=0,m=0,b=0;"round-diamond"===a?y=1.4*(o+Y+z):"round-heptagon"===a?(y=1.075*(o+Y+z),b=-(o/2+Y+z)/35):"round-hexagon"===a?y=1.12*(o+Y+z):"round-pentagon"===a?(y=1.13*(o+Y+z),b=-(o/2+Y+z)/15):"round-tag"===a?(y=1.12*(o+Y+z),m=.07*(o/2+z+Y)):"round-triangle"===a&&(y=(o+Y+z)*(Math.PI/2),b=-(o+Y/2+z)/Math.PI),0!==y&&(u=(r+y)/r,d=r*u,["round-hexagon","round-tag"].includes(a)||(c=(i+y)/i,p=i*c)),U="auto"===U?Er(d,p):U;for(var x=d/2,w=p/2,E=U+(o+z+Y)/2,T=new Array(g.length/2),_=new Array(g.length/2),A=0;A0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}o.colorFillStyle(t,u[0],u[1],u[2],l),o.nodeShapes[c].draw(t,r.x,r.y,i+2*s,a+2*s,h),t.fill()}}}};zp.drawNodeOverlay=Gp("overlay"),zp.drawNodeUnderlay=Gp("underlay"),zp.hasPie=function(e){return e=e[0],e._private.hasPie},zp.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0,d=this.usePaths();d&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var p=1;p<=i.pieBackgroundN;p++){var g=t.pstyle("pie-"+p+"-background-size").value,f=t.pstyle("pie-"+p+"-background-color").value,v=t.pstyle("pie-"+p+"-background-opacity").value*n,y=g/100;y+h>1&&(y=1-h);var m=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*y,x=m+b;0===g||h>=1||h+y>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,m,x),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],v),e.fill(),h+=y)}};var Vp,Xp={},Yp=100;function Up(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Wp(e,t,n){var r=Up(e,e.VERTEX_SHADER,t),i=Up(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function jp(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Hp(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function qp(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return o=Math.round(e.canvasHeight-o),[a,o]}function $p(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||new Array(4);return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Kp(e,t){var n=t||new Array(4);return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Zp(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Qp(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function Jp(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function eg(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function tg(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function ng(e,t,n,r){var i=Jp(e,t),a=o(i,2),s=a[0],l=a[1],u=eg(e,l,r),c=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),l===e.FLOAT?e.vertexAttribPointer(n,s,l,!1,0,0):l===e.INT&&e.vertexAttribIPointer(n,s,l,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),c}function rg(e,t,n,r){var i=Jp(e,n),a=o(i,3),s=a[0],l=a[1],u=a[2],c=eg(e,l,t*s),h=s*u,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*h,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),l===e.FLOAT?e.vertexAttribPointer(r,s,l,!1,h,0):l===e.INT&&e.vertexAttribIPointer(r,s,l,h,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var p=new Array(t),g=0;gt.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},T={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport,A=void 0===_||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y;A||f&&!g||(t.motionBlurPxRatio=1),s&&(E=s),x*=l,E.x*=l,E.y*=l;var C=t.getCachedZSortedEles();function D(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function N(e,n){var a,l,c,h;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=E,l=x,c=t.canvasWidth,h=t.canvasHeight):(a={x:w.x*p,y:w.y*p},l=b*p,c=t.canvasWidth*p,h=t.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?D(e,0,0,c,h):r||void 0!==n&&!n||e.clearRect(0,0,c,h),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var S=t.data.bufferContexts[t.TEXTURE_BUFFER];S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:S,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});T=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var k=u.contexts[t.NODE],L=t.textureCache.texture;T=t.textureCache.viewport;k.setTransform(1,0,0,1,0,0),d?D(k,0,0,T.width,T.height):k.clearRect(0,0,T.width,T.height);var P=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(k,P[0],P[1],P[2],I),k.fillRect(0,0,T.width,T.height);b=n.zoom();N(k,!1),k.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),k.drawImage(L,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var M=n.extent(),O=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),R=t.hideEdgesOnViewport&&O,B=[];if(B[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,B[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),B[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,B[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||B[t.NODE]){var F=d&&!B[t.NODE]&&1!==p,z=(k=r||(F?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),d&&!F?"motionBlur":void 0);N(k,z),R?t.drawCachedNodes(k,C.nondrag,l,M):t.drawLayeredElements(k,C.nondrag,l,M),t.debug&&t.drawDebugPoints(k,C.nondrag),i||d||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||B[t.DRAG])){F=d&&!B[t.DRAG]&&1!==p,k=r||(F?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);N(k,d&&!F?"motionBlur":void 0),R?t.drawCachedNodes(k,C.drag,l,M):t.drawCachedElements(k,C.drag,l,M),t.debug&&t.drawDebugPoints(k,C.drag),i||d||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,N),d&&1!==p){var G=u.contexts[t.NODE],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],X=u.contexts[t.DRAG],Y=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],U=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):D(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||B[t.NODE])&&(U(G,V,B[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||B[t.DRAG])&&(U(X,Y,B[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=T,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout((function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()}),Yp)),r||n.emit("render")},Xp.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||i.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var h=n.cy.zoom(),d=a.core("selection-box-border-width").value/h;c.lineWidth=d,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),d>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){h=n.cy.zoom();var p=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(p.x,p.y,a.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var g=n.lastRedrawTime;if(n.showFps&&g){g=Math.round(g);var f=Math.round(1e3/g),v="1 frame = "+g+" ms = "+f+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Vp){var y=c.measureText(v);Vp=y.actualBoundingBoxAscent}c.fillText(v,0,Vp);var m=60;c.strokeRect(0,Vp+10,250,20),c.fillRect(0,Vp+10,250*Math.min(f/m,1),20)}s||(l[n.SELECT_BOX]=!1)}};var ag="undefined"!==typeof Float32Array?Float32Array:Array;function og(){var e=new ag(9);return ag!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function sg(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function lg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1],g=n[2],f=n[3],v=n[4],y=n[5],m=n[6],b=n[7],x=n[8];return e[0]=d*r+p*o+g*u,e[1]=d*i+p*s+g*c,e[2]=d*a+p*l+g*h,e[3]=f*r+v*o+y*u,e[4]=f*i+v*s+y*c,e[5]=f*a+v*l+y*h,e[6]=m*r+b*o+x*u,e[7]=m*i+b*s+x*c,e[8]=m*a+b*l+x*h,e}function ug(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+p*o+u,e[7]=d*i+p*s+c,e[8]=d*a+p*l+h,e}function cg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(n),p=Math.cos(n);return e[0]=p*r+d*o,e[1]=p*i+d*s,e[2]=p*a+d*l,e[3]=p*o-d*r,e[4]=p*s-d*i,e[5]=p*l-d*a,e[6]=u,e[7]=c,e[8]=h,e}function hg(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function dg(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}Math.hypot||(Math.hypot=function(){var e=0,t=arguments.length;while(t--)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var pg={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},gg=Ut({getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:null,getPadding:null}),fg=function(){function e(n,r){t(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=n,this.atlasSize=r.webglTexSize,this.rows=r.webglTexRows,this.enableWrapping=r.enableWrapping,this.texHeight=Math.floor(this.atlasSize/this.rows),this.maxTexWidth=this.atlasSize,this.texture=null,this.canvas=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=r.createTextureCanvas(n,this.atlasSize,this.atlasSize),this.scratch=r.createTextureCanvas(n,this.atlasSize,this.texHeight,"scratch")}return i(e,[{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.maxTexWidth,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this,i=this.atlasSize,a=this.rows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,h=[null,null],d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,u=a,c=o*s;i.save(),i.translate(u,c),i.scale(l,l),n(i,t),i.restore()}},p=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},h[1]={x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},g=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=u-n,s=o,l=r.freePointer.x,p=r.freePointer.row*o,g=n;t.context.drawImage(e,0,0,g,s,l,p,g,s),h[0]={x:l,y:p,w:g,h:c};var f=n,v=(r.freePointer.row+1)*o,y=a;t&&t.context.drawImage(e,f,0,y,s,0,v,y,s),h[1]={x:0,y:v,w:y,h:c},r.freePointer.x=a,r.freePointer.row++},f=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=i)p();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===i?(f(),p()):this.enableWrapping?g():(f(),p())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){var t=this.atlasSize,n=this.rows,r=this.getScale(e),i=r.texW;return!(this.freePointer.x+i>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},r=n.forceRedraw,i=void 0!==r&&r,a=n.filterEle,o=void 0===a?function(){return!0}:a,s=n.filterType,l=void 0===s?function(){return!0}:s,u=!1,c=v(e);try{for(c.s();!(t=c.n()).done;){var h=t.value;if(o(h)){var d,p=h.id(),g=v(this.getRenderTypes());try{for(g.s();!(d=g.n()).done;){var f=d.value;if(l(f.type)){var y=f.getKey(h);i?(f.atlasCollection.deleteKey(p,y),f.atlasCollection.styleKeyNeedsRedraw.add(y),u=!0):u|=f.atlasCollection.checkKeyIsInvalid(p,y)}}}catch(m){g.e(m)}finally{g.f()}}}}catch(m){c.e(m)}finally{c.f()}return u}},{key:"gc",value:function(){var e,t=v(this.getRenderTypes());try{for(t.s();!(e=t.n()).done;){var n=e.value;n.atlasCollection.gc()}}catch(r){t.e(r)}finally{t.f()}}},{key:"isRenderable",value:function(e,t){var n=this.getRenderTypeOpts(t);return n&&n.isVisible(e)}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"getOrCreateAtlas",value:function(e,t,n){var r=this.renderTypes.get(n),i=r.getKey(e),a=e.id();return r.atlasCollection.draw(a,i,t,(function(n){r.drawElement(n,e,t,!0,!0)}))}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlases},(function(e,t){return t}))}},{key:"getAtlasInfo",value:function(e,t){var n=this.renderTypes.get(t),r=n.getBoundingBox(e),i=this.getOrCreateAtlas(e,r,t),a=this.getAtlasIndexForBatch(i);if(void 0!==a){var s=n.getKey(e),l=i.getOffsets(s),u=o(l,2),c=u[0],h=u[1];return{atlasID:a,tex:c,tex1:c,tex2:h,bb:r,type:t,styleKey:s}}}},{key:"canAddToCurrentBatch",value:function(e,t){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(t),r=n.getKey(e),i=n.atlasCollection.getAtlas(r);return i&&this.batchAtlases.includes(i)}return!0}},{key:"setTransformMatrix",value:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=t.bb,a=t.type,o=t.tex1,s=t.tex2,l=this.getRenderTypeOpts(a),u=l.getPadding?l.getPadding(n):0,c=o.w/(o.w+s.w);r||(c=1-c);var h,d,p=this.getAdjustedBB(i,u,r,c);sg(e);var g=l.getRotation?l.getRotation(n):0;if(0!==g){var f=l.getRotationPoint(n),v=f.x,y=f.y;ug(e,e,[v,y]),cg(e,e,g);var m=l.getRotationOffset(n);h=m.x+p.xOffset,d=m.y}else h=p.x1,d=p.y1;ug(e,e,[h,d]),hg(e,e,[p.w,p.h])}},{key:"getTransformMatrix",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=og();return this.setTransformMatrix(r,e,t,n),r}},{key:"getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(l=o-u,i+=l,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l}}},{key:"getDebugInfo",value:function(){var e,t=[],n=v(this.renderTypes);try{for(n.s();!(e=n.n()).done;){var r=o(e.value,2),i=r[0],a=r[1],s=a.atlasCollection.getCounts(),l=s.keyCount,u=s.atlasCount;t.push({type:i,keyCount:l,atlasCount:u})}}catch(c){n.e(c)}finally{n.f()}return t}}]),e}(),bg=0,xg=1,wg=2,Eg=3,Tg=function(){function e(n,r,i){t(this,e),this.r=n,this.gl=r,this.maxInstances=i.webglBatchSize,this.maxAtlases=i.webglTexPerBatch,this.atlasSize=i.webglTexSize,this.bgColor=i.bgColor,i.enableWrapping=!0,i.createTextureCanvas=jp,this.atlasManager=new mg(n,i),this.program=this.createShaderProgram(pg.SCREEN),this.pickingProgram=this.createShaderProgram(pg.PICKING),this.vao=this.createVAO(),this.debugInfo=[]}return i(e,[{key:"addTextureRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"invalidate",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; \n\n // what are we rendering?\n in int aVertType;\n\n // for picking\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex1; // x/y/w/h of texture in atlas\n in vec4 aTex2; \n\n // for any transforms that are needed\n in vec4 aScaleRotate1; // vectors use fewer attributes than matrices\n in vec2 aTranslate1;\n in vec4 aScaleRotate2;\n in vec2 aTranslate2;\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in float aLineWidth;\n in vec4 aEdgeColor;\n\n out vec2 vTexCoord;\n out vec4 vEdgeColor;\n flat out int vAtlasId;\n flat out vec4 vIndex;\n flat out int vVertType;\n\n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition;\n\n if(aVertType == ".concat(bg,") {\n float texX;\n float texY;\n float texW;\n float texH;\n mat3 texMatrix;\n\n int vid = gl_VertexID;\n if(vid <= 5) {\n texX = aTex1.x;\n texY = aTex1.y;\n texW = aTex1.z;\n texH = aTex1.w;\n texMatrix = mat3(\n vec3(aScaleRotate1.xy, 0.0),\n vec3(aScaleRotate2.zw, 0.0),\n vec3(aTranslate1, 1.0)\n );\n } else {\n texX = aTex2.x;\n texY = aTex2.y;\n texW = aTex2.z;\n texH = aTex2.w;\n texMatrix = mat3(\n vec3(aScaleRotate2.xy, 0.0),\n vec3(aScaleRotate2.zw, 0.0),\n vec3(aTranslate2, 1.0)\n );\n }\n\n if(vid == 1 || vid == 2 || vid == 4 || vid == 7 || vid == 8 || vid == 10) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5 || vid == 8 || vid == 10 || vid == 11) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * texMatrix * vec3(position, 1.0), 1.0);\n } \n else if(aVertType == ").concat(xg," && vid < 6) {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vEdgeColor = aEdgeColor;\n } \n else if(aVertType == ").concat(wg," && vid < 6) {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0 = pointA;\n vec2 p1 = pointB;\n vec2 p2 = pointC;\n vec2 pos = position;\n if(position.x == 1.0) {\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth;\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vEdgeColor = aEdgeColor;\n } \n else if(aVertType == ").concat(Eg," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n mat3 transform = mat3(\n vec3(aScaleRotate1.xy, 0.0),\n vec3(aScaleRotate1.zw, 0.0),\n vec3(aTranslate1, 1.0)\n );\n gl_Position = vec4(uPanZoomMatrix * transform * vec3(position, 1.0), 1.0);\n vEdgeColor = aEdgeColor;\n } else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vIndex = aIndex;\n vVertType = aVertType;\n }\n "),r=this.atlasManager.getIndexArray(),i="#version 300 es\n precision highp float;\n\n // define texture unit for each node in the batch\n ".concat(r.map((function(e){return"uniform sampler2D uTexture".concat(e,";")})).join("\n\t"),"\n\n uniform vec4 uBGColor;\n\n in vec2 vTexCoord;\n in vec4 vEdgeColor;\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n\n out vec4 outColor;\n\n void main(void) {\n if(vVertType == ").concat(bg,") {\n ").concat(r.map((function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")})).join("\n\telse "),"\n } else if(vVertType == ").concat(Eg,") {\n // blend arrow color with background (using premultiplied alpha)\n outColor.rgb = vEdgeColor.rgb + (uBGColor.rgb * (1.0 - vEdgeColor.a)); \n outColor.a = 1.0; // make opaque, masks out line under arrow\n } else {\n outColor = vEdgeColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),a=Wp(t,n,i);a.aPosition=t.getAttribLocation(a,"aPosition"),a.aIndex=t.getAttribLocation(a,"aIndex"),a.aVertType=t.getAttribLocation(a,"aVertType"),a.aAtlasId=t.getAttribLocation(a,"aAtlasId"),a.aTex1=t.getAttribLocation(a,"aTex1"),a.aTex2=t.getAttribLocation(a,"aTex2"),a.aScaleRotate1=t.getAttribLocation(a,"aScaleRotate1"),a.aTranslate1=t.getAttribLocation(a,"aTranslate1"),a.aScaleRotate2=t.getAttribLocation(a,"aScaleRotate2"),a.aTranslate2=t.getAttribLocation(a,"aTranslate2"),a.aPointAPointB=t.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=t.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=t.getAttribLocation(a,"aLineWidth"),a.aEdgeColor=t.getAttribLocation(a,"aEdgeColor"),a.uPanZoomMatrix=t.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=t.getUniformLocation(a,"uAtlasSize"),a.uBGColor=t.getUniformLocation(a,"uBGColor"),a.uTextures=[];for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:pg.SCREEN;this.panZoomMatrix=e,this.debugInfo=t,this.renderTarget=n,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||og()}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager;if(r.isRenderable(e,n)){r.canAddToCurrentBatch(e,n)||this.endBatch();var i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=bg;var a=this.indexBuffer.getView(i);Kp(t,a);var o=r.getAtlasInfo(e,n,o),s=o.atlasID,l=o.tex1,u=o.tex2,c=this.atlasIdBuffer.getView(i);c[0]=s;var h=this.tex1Buffer.getView(i);h[0]=l.x,h[1]=l.y,h[2]=l.w,h[3]=l.h;var d=this.tex2Buffer.getView(i);d[0]=u.x,d[1]=u.y,d[2]=u.w,d[3]=u.h;for(var p=this.getTempMatrix(),g=0,f=[1,2];g=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(e,t,n){var r,i,a,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){var s=e.pstyle(n+"-arrow-shape").value;if("none"!==s){var l=e.pstyle(n+"-arrow-color").value,u=e.pstyle("opacity").value,c=e.pstyle("line-opacity").value,h=u*c,d=e.pstyle("width").pfValue,p=e.pstyle("arrow-scale").value,g=this.r.getArrowWidth(d,p),f=this.getTempMatrix();sg(f),ug(f,f,[r,i]),hg(f,f,[g,g]),cg(f,f,a);var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Eg;var y=this.indexBuffer.getView(v);Kp(t,y);var m=this.edgeColorBuffer.getView(v);$p(l,h,m);var b=this.scaleRotate1Buffer.getView(v);b[0]=f[0],b[1]=f[1],b[2]=f[3],b[3]=f[4];var x=this.translate1Buffer.getView(v);x[0]=f[6],x[1]=f[7],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){var n=e.pstyle("opacity").value,r=e.pstyle("line-opacity").value,i=e.pstyle("width").pfValue,a=e.pstyle("line-color").value,o=n*r,s=this.getEdgePoints(e);if(s.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==s.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=xg;var u=this.indexBuffer.getView(l);Kp(t,u);var c=this.edgeColorBuffer.getView(l);$p(a,o,c);var h=this.lineWidthBuffer.getView(l);h[0]=i;var d=this.pointAPointBBuffer.getView(l);d[0]=s[0],d[1]=s[1],d[2]=s[2],d[3]=s[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p=this.maxInstances&&this.endBatch()}}},{key:"getEdgePoints",value:function(e){var t=e._private.rscratch,n=t.allpts;if(4==n.length)return n;var r=this.getNumSegments(e);return this.getCurveSegmentPoints(n,r)}},{key:"getNumSegments",value:function(e){var t=15;return Math.min(Math.max(t,5),this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this.setCurvePoint(e,i,n,2*r)}return n}},{key:"setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var i=Array(e.length-2),a=0;a0}},{key:"getStyle",value:function(e,t){var n=t.pstyle("".concat(e,"-opacity")).value,r=t.pstyle("".concat(e,"-color")).value,i=t.pstyle("".concat(e,"-shape")).value;return{opacity:n,color:r,shape:i}}},{key:"getPadding",value:function(e,t){return t.pstyle("".concat(e,"-padding")).pfValue}},{key:"draw",value:function(e,t,n,r){if(this.isVisible(e,n)){var i=this.r,a=r.w,o=r.h,s=a/2,l=o/2,u=this.getStyle(e,n),c=u.shape,h=u.color,d=u.opacity;t.save(),t.fillStyle=_g(h,d),"round-rectangle"===c||"roundrectangle"===c?i.drawRoundRectanglePath(t,s,l,a,o,"auto"):"ellipse"===c&&i.drawEllipsePath(t,s,l,a,o),t.fill(),t.restore()}}}]),e}();function Cg(e){var t=e&&e.style&&e.style.backgroundColor||"white";return le(t)}var Dg={};function Ng(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>Bd?(Sg(e),t.call(e,n)):(kg(e),Fg(e,n,pg.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return Bg(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.eleDrawing.invalidate(n,{type:"node-body"})}}function Sg(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function kg(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Lg(e){var t=e.canvasWidth,n=e.canvasHeight,r=Hp(e),i=r.pan,a=r.zoom,o=og();ug(o,o,[i.x,i.y]),hg(o,o,[a,a]);var s=og();dg(s,t,n);var l=og();return lg(l,s,o),l}function Pg(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Hp(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function Ig(e,t){e.drawSelectionRectangle(t,(function(t){return Pg(e,t)}))}function Mg(e){var t=e.data.contexts[e.NODE];t.save(),Pg(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function Og(e){var t=function(t,n,r){for(var i=t.atlasManager.getRenderTypeOpts(n),a=e.data.contexts[e.NODE],o=.125,s=i.atlasCollection.atlases,l=0;l=0&&S.add(P)}return S}function Bg(e,t,n){var r,i,a,o=Rg(e,t,n),s=e.getCachedZSortedEles(),l=v(o);try{for(l.s();!(a=l.n()).done;){var u=a.value,c=s[u];if(!r&&c.isNode()&&(r=c),!i&&c.isEdge()&&(i=c),r&&i)break}}catch(h){l.e(h)}finally{l.f()}return[r,i].filter(Boolean)}function Fg(e,t,n){var r,i;e.webglDebug&&(i=[],r=performance.now());var a=e.eleDrawing,o=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&Ig(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=function(e,t){t+=1,e.isNode()?(a.drawTexture(e,t,"node-underlay"),a.drawTexture(e,t,"node-body"),a.drawTexture(e,t,"node-label"),a.drawTexture(e,t,"node-overlay")):(a.drawEdgeLine(e,t),a.drawEdgeArrow(e,t,"source"),a.drawEdgeArrow(e,t,"target"),a.drawTexture(e,t,"edge-label"))},l=e.data.contexts[e.WEBGL];n.screen?(l.clearColor(0,0,0,0),l.enable(l.BLEND),l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA)):l.disable(l.BLEND),l.clear(l.COLOR_BUFFER_BIT|l.DEPTH_BUFFER_BIT),l.viewport(0,0,l.canvas.width,l.canvas.height);var u=Lg(e),c=e.getCachedZSortedEles();if(o=c.length,a.startFrame(u,i,n),n.screen){for(var h=0;h0&&(r|=n.eleDrawing.invalidate(t)),r&&l()})),Ng(n)};for(var zg={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&o>0){p.clearRect(0,0,a,o),p.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)p.translate(-r.x1*u,-r.y1*u),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(r.x1*u,r.y1*u);else{var f=t.pan(),v={x:f.x*u,y:f.y*u};u*=t.zoom(),p.translate(v.x,v.y),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(-v.x,-v.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,a,o),p.fill())}return d},jg.png=function(e){return $g(e,this.bufferCanvasImage(e),"image/png")},jg.jpg=function(e){return $g(e,this.bufferCanvasImage(e),"image/jpeg")};var Kg={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},Zg=Jg,Qg=Jg.prototype;function Jg(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(Qg.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Qg.CANVAS_LAYERS),contexts:new Array(Qg.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Qg.CANVAS_LAYERS),bufferCanvases:new Array(Qg.BUFFER_COUNT),bufferContexts:new Array(Qg.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var o=t.data.canvasContainer.style;t.data.canvasContainer.style[i]=a,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=e.cy.container();s.appendChild(t.data.canvasContainer),s.style[i]=a;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};X()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;ut&&(this.rect.x-=(this.labelWidth-t)/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))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){"use strict";function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){"use strict";var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i-1&&c>-1))throw"Source and/or target doesn't know this edge!";o.source.edges.splice(u,1),o.target!=o.source&&o.target.edges.splice(c,1);a=o.source.owner.getEdges().indexOf(o);if(-1==a)throw"Not in owner's edge list!";o.source.owner.getEdges().splice(a,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;le&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;gt&&(s=t),lr&&(c=r),ht&&(o=t),sr&&(l=r),c=this.nodes.length){var d=0;i.forEach((function(t){t.owner==e&&d++})),d==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d},function(e,t,n){"use strict";var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,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},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";var n,a=[];a=a.concat(t.getEdges());for(var o=a.length,s=0;s=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(ia)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(ra?(n[0]=c,n[1]=h,T=!0):(n[0]=u,n[1]=l,T=!0):A===D&&(r>a?(n[0]=s,n[1]=l,T=!0):(n[0]=d,n[1]=h,T=!0)),-C===D?a>r?(n[2]=m,n[3]=b,_=!0):(n[2]=y,n[3]=v,_=!0):C===D&&(a>r?(n[2]=f,n[3]=v,_=!0):(n[2]=x,n[3]=b,_=!0)),T&&_)return!1;if(r>a?i>o?(N=this.getCardinalDirection(A,D,4),S=this.getCardinalDirection(C,D,2)):(N=this.getCardinalDirection(-A,D,3),S=this.getCardinalDirection(-C,D,1)):i>o?(N=this.getCardinalDirection(-A,D,1),S=this.getCardinalDirection(-C,D,3)):(N=this.getCardinalDirection(A,D,2),S=this.getCardinalDirection(C,D,4)),!T)switch(N){case 1:L=l,k=r+-g/D,n[0]=k,n[1]=L;break;case 2:k=d,L=i+p*D,n[0]=k,n[1]=L;break;case 3:L=h,k=r+g/D,n[0]=k,n[1]=L;break;case 4:k=c,L=i+-p*D,n[0]=k,n[1]=L;break}if(!_)switch(S){case 1:I=v,P=a+-E/D,n[2]=P,n[3]=I;break;case 2:P=x,I=o+w*D,n[2]=P,n[3]=I;break;case 3:I=b,P=a+E/D,n[2]=P,n[3]=I;break;case 4:P=m,I=o+-w*D,n[2]=P,n[3]=I;break}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,l=t.y,u=n.x,c=n.y,h=i.x,d=i.y,p=void 0,g=void 0,f=void 0,v=void 0,y=void 0,m=void 0,b=void 0,x=void 0,w=void 0;return f=l-o,y=a-s,b=s*o-a*l,v=d-c,m=u-h,x=h*c-u*d,w=f*m-v*y,0===w?null:(p=(y*x-m*b)/w,g=(v*b-f*x)/w,new r(p,g))},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){"use strict";function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n0&&t){s.push(u[0]);while(s.length>0&&t){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i0){for(var i=this.edgeToDummyNodes.get(n),a=0;a=0&&t.splice(h,1);var d=s.getNeighborsList();d.forEach((function(e){if(n.indexOf(e)<0){var t=r.get(e),i=t-1;1==i&&u.push(e),r.set(e,i)}}))}n=n.concat(u),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){"use strict";function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){"use strict";var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){var t=new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y));return t},e.exports=i},function(e,t,n){"use strict";function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);ta.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(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),i=new Set,e=0;el||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a)):(l=t.getEstimatedSize()*this.compoundGravityRangeFactor,(o>l||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant))},u.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement=l.length||c>=l[0].length))for(var h=0;he}}]),e}();e.exports=o},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;nc&&C.push("'"+this.terminals_[T]+"'");N=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+C.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(b==h?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(N,{text:p.match,token:this.terminals_[b]||b,line:p.yylineno,loc:v,expected:C})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+b);switch(w[0]){case 1:n.push(b),i.push(p.yytext),a.push(p.yylloc),n.push(w[1]),b=null,u=p.yyleng,s=p.yytext,l=p.yylineno,v=p.yylloc;break;case 2:if(_=this.productions_[w[1]][1],D.$=i[i.length-_],D._$={first_line:a[a.length-(_||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(_||1)].first_column,last_column:a[a.length-1].last_column},y&&(D._$.range=[a[a.length-(_||1)].range[0],a[a.length-1].range[1]]),E=this.performAction.apply(D,[s,u,l,g.yy,w[1],i,a].concat(d)),"undefined"!==typeof E)return E;_&&(n=n.slice(0,-1*_*2),i=i.slice(0,-1*_),a=a.slice(0,-1*_)),n.push(this.productions_[w[1]][0]),i.push(D.$),a.push(D._$),A=o[n[n.length-2]][n[n.length-1]],n.push(A);break;case 3:return!0}}return!0}},m=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,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},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=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 i=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===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject: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})},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={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&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,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(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},next:function(){if(this.done)return this.EOF;var e,t,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;at[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),!1!==e)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),!1!==e&&e):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){var e=this.conditionStack.length-1;return e>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions["INITIAL"].rules},topState:function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:e.getLogger().trace("Found comment",t.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 23:this.popState();break;case 24:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 27:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 28:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 29:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 30:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 32:return e.getLogger().trace("Long description:",t.yytext),20;case 33:return e.getLogger().trace("Long description:",t.yytext),20}},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],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return e}();function b(){this.yy={}}return y.lexer=m,b.prototype=y,y.Parser=b,new b}());d.parser=d;const p=d,g=e=>(0,r.n)(e,(0,r.g)());let f=[],v=0,y={};const m=()=>{f=[],v=0,y={}},b=function(e){for(let t=f.length-1;t>=0;t--)if(f[t].levelf.length>0?f[0]:null,w=(e,t,n,i)=>{r.l.info("addNode",e,t,n,i);const a=(0,r.g)(),o={id:v++,nodeId:g(t),level:e,descr:g(n),type:i,children:[],width:(0,r.g)().mindmap.maxNodeWidth};switch(o.type){case E.ROUNDED_RECT:o.padding=2*a.mindmap.padding;break;case E.RECT:o.padding=2*a.mindmap.padding;break;case E.HEXAGON:o.padding=2*a.mindmap.padding;break;default:o.padding=a.mindmap.padding}const s=b(e);if(s)s.children.push(o),f.push(o);else{if(0!==f.length){let e=new Error('There can be only one root. No parent could be found for ("'+o.descr+'")');throw e.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},e}f.push(o)}},E={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},T=(e,t)=>{switch(r.l.debug("In get type",e,t),e){case"[":return E.RECT;case"(":return")"===t?E.ROUNDED_RECT:E.CLOUD;case"((":return E.CIRCLE;case")":return E.CLOUD;case"))":return E.BANG;case"{{":return E.HEXAGON;default:return E.DEFAULT}},_=(e,t)=>{y[e]=t},A=e=>{const t=f[f.length-1];e&&e.icon&&(t.icon=g(e.icon)),e&&e.class&&(t.class=g(e.class))},C=e=>{switch(e){case E.DEFAULT:return"no-border";case E.RECT:return"rect";case E.ROUNDED_RECT:return"rounded-rect";case E.CIRCLE:return"circle";case E.CLOUD:return"cloud";case E.BANG:return"bang";case E.HEXAGON:return"hexgon";default:return"no-border"}};let D;const N=e=>{D=e},S=()=>r.l,k=e=>f[e],L=e=>y[e],P=Object.freeze(Object.defineProperty({__proto__:null,addNode:w,clear:m,decorateNode:A,getElementById:L,getLogger:S,getMindmap:x,getNodeById:k,getType:T,nodeType:E,get parseError(){return D},sanitizeText:g,setElementForId:_,setErrorHandler:N,type2Str:C},Symbol.toStringTag,{value:"Module"})),I=12;function M(e,t){e.each((function(){var e,n=(0,i.Ltv)(this),r=n.text().split(/(\s+|
)/).reverse(),a=[],o=1.1,s=n.attr("y"),l=parseFloat(n.attr("dy")),u=n.text(null).append("tspan").attr("x",0).attr("y",s).attr("dy",l+"em");for(let i=0;it||"
"===e)&&(a.pop(),u.text(a.join(" ").trim()),a="
"===e?[""]:[e],u=n.append("tspan").attr("x",0).attr("y",s).attr("dy",o+"em").text(e))}))}const O=function(e,t,n){const r=5;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 ${t.height-r} v${-t.height+2*r} q0,-5 5,-5 h${t.width-2*r} q5,0 5,5 v${t.height-r} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},R=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("width",t.width)},B=function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)},F=function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)},z=function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("r",t.width/2)};function G(e,t,n,r,i){return e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}const V=function(e,t){const n=t.height,r=4,i=n/r,a=t.width-t.padding+2*i,o=[{x:i,y:0},{x:a-i,y:0},{x:a,y:-n/2},{x:a-i,y:-n},{x:i,y:-n},{x:0,y:-n/2}];G(e,a,n,o,t)},X=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+C(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)},Y=function(e,t,n,r){const i=n%(I-1),a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(M,t.width),c=u.node().getBBox(),h=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=c.height+1.1*h*.5+t.padding,t.width=c.width+2*t.padding,t.icon)if(t.type===E.CIRCLE){t.height+=50,t.width+=50;const e=a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;");e.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e),r=a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;");r.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case E.DEFAULT:O(s,t,i);break;case E.ROUNDED_RECT:X(s,t);break;case E.RECT:R(s,t);break;case E.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),z(s,t);break;case E.CLOUD:B(s,t);break;case E.BANG:F(s,t);break;case E.HEXAGON:V(s,t);break}return _(t.id,a),t.height},U=function(e,t,n,r,i){const a=i%(I-1),o=n.x+n.width/2,s=n.y+n.height/2,l=t.x+t.width/2,u=t.y+t.height/2,c=l>o?o+Math.abs(o-l)/2:o-Math.abs(o-l)/2,h=u>s?s+Math.abs(s-u)/2:s-Math.abs(s-u)/2,d=l>o?Math.abs(o-c)/2+o:-Math.abs(o-c)/2+o,p=u>s?Math.abs(s-h)/2+s:-Math.abs(s-h)/2+s;e.append("path").attr("d","TB"===n.direction||"BT"===n.direction?`M${o},${s} Q${o},${p} ${c},${h} T${l},${u}`:`M${o},${s} Q${d},${s} ${c},${h} T${l},${u}`).attr("class","edge section-edge-"+a+" edge-depth-"+r)},W=function(e){const t=L(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")},j={drawNode:Y,positionNode:W,drawEdge:U};function H(e,t,n,r){j.drawNode(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{H(e,t,n<0?i:n,r)}))}function q(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.l.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}function $(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{$(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function K(e,t){return new Promise((n=>{const a=(0,i.Ltv)("body").append("div").attr("id","cy").attr("style","display:none"),s=o()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),$(e,s,t,0),s.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),s.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),s.ready((e=>{r.l.info("Ready",e),n(s)}))}))}function Z(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,j.positionNode(n);const i=L(n.nodeId);r.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}o().use(l());const Q=async(e,t,n,a)=>{const o=(0,r.g)();a.db.clear(),a.parser.parse(e),r.l.debug("Renering info diagram\n"+e);const s=(0,r.g)().securityLevel;let l;"sandbox"===s&&(l=(0,i.Ltv)("#i"+t));const u="sandbox"===s?(0,i.Ltv)(l.nodes()[0].contentDocument.body):(0,i.Ltv)("body"),c=u.select("#"+t);c.append("g");const h=a.db.getMindmap(),d=c.append("g");d.attr("class","mindmap-edges");const p=c.append("g");p.attr("class","mindmap-nodes"),H(p,h,-1,o);const g=await K(h,o);q(d,g),Z(g),(0,r.s)(void 0,c,o.mindmap.padding,o.mindmap.useMaxWidth)},J={draw:Q},ee=e=>{let t="";for(let n=0;n`\n .edge {\n stroke-width: 3;\n }\n ${ee(e)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${e.git0};\n }\n .section-root text {\n fill: ${e.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`,ne=te,re={db:P,renderer:J,parser:p,styles:ne}},4872:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=n(1258),i=n(5888);const a=e=>{const{r:t,g:n,b:a}=i.A.parse(e),o=.2126*r.A.channel.toLinear(t)+.7152*r.A.channel.toLinear(n)+.0722*r.A.channel.toLinear(a);return r.A.lang.round(o)};var o=a;const s=e=>o(e)>=.5;var l=s;const u=e=>!l(e);var c=u}}]);