import{a as Qu}from"./chunk-SF6FGZXC.js";import{$a as Da,Fa as Rr,Ha as Ju,I as Mp,L as Wu,M as Ku,N as Zu,b as Op,c as Np,cb as ju,h as sn}from"./chunk-AZTSVESG.js";import"./chunk-BZUL2CAN.js";import{f as ni,h as nn}from"./chunk-EP6THQJ3.js";var el=ni((Qi,Ji)=>{(function(q,W){typeof Qi=="object"&&typeof Ji!="undefined"?Ji.exports=W():typeof define=="function"&&define.amd?define(W):(q=typeof globalThis!="undefined"?globalThis:q||self,q.cytoscape=W())})(Qi,function(){"use strict";function q(t){"@babel/helpers - typeof";return q=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(t)}function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,a=new Array(e);rr?1:0},Jt=function(e,r){return-1*Zr(e,r)},$e=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(y-=1),y<1/6?d+(g-d)*6*y:y<1/2?g:y<2/3?d+(g-d)*(2/3-y)*6:d}var h=new RegExp("^"+br+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,v=2*i-c;o=Math.round(255*f(v,c,a+1/3)),l=Math.round(255*f(v,c,a)),u=Math.round(255*f(v,c,a-1/3))}r=[o,l,u,s]}return r},cl=function(e){var r,a=new RegExp("^"+mr+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},vl=function(e){return gl[e.toLowerCase()]},dl=function(e){return(me(e)?e:null)||vl(e)||fl(e)||cl(e)||hl(e)},gl={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]},us=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i=e||T<0||h&&k>=i}function p(){var O=ii();if(y(O))return m(O);o=setTimeout(p,g(O))}function m(O){return o=void 0,c&&a?v(O):(a=n=void 0,s)}function b(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function x(){return o===void 0?s:m(ii())}function I(){var O=ii(),T=y(O);if(a=arguments,n=this,l=O,T){if(o===void 0)return d(l);if(h)return clearTimeout(o),o=setTimeout(p,e),v(l)}return o===void 0&&(o=setTimeout(p,e)),s}return I.cancel=b,I.flush=x,I}var vn=jl,si=D?D.performance:null,gs=si&&si.now?function(){return si.now()}:function(){return Date.now()},ef=function(){if(D){if(D.requestAnimationFrame)return function(t){D.requestAnimationFrame(t)};if(D.mozRequestAnimationFrame)return function(t){D.mozRequestAnimationFrame(t)};if(D.webkitRequestAnimationFrame)return function(t){D.webkitRequestAnimationFrame(t)};if(D.msRequestAnimationFrame)return function(t){D.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(gs())},1e3/60)}}(),dn=function(e){return ef(e)},cr=gs,Jr=9261,ps=65599,Oa=5381,ys=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr,a=r,n;n=e.next(),!n.done;)a=a*ps+n.value|0;return a},Na=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr;return r*ps+e|0},Ma=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oa;return(r<<5)+r+e|0},tf=function(e,r){return e*2097152+r},Er=function(e){return e[0]*2097152+e[1]},gn=function(e,r){return[Na(e[0],r[0]),Ma(e[1],r[1])]},rf=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},li=function(e){e.splice(0,e.length)},ff=function(e,r){for(var a=0;a2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Ge(e)){bt("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){bt("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new jr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];me(r.classes)?u=r.classes:ee(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,h=u.length;fm?1:0},f=function(p,m,b,x,I){var O;if(b==null&&(b=0),I==null&&(I=a),b<0)throw new Error("lo must be non-negative");for(x==null&&(x=p.length);bF;0<=F?S++:S--)k.push(S);return k}.apply(this).reverse(),T=[],x=0,I=O.length;xz;0<=z?++k:--k)P.push(s(p,b));return P},g=function(p,m,b,x){var I,O,T;for(x==null&&(x=a),I=p[b];b>m;){if(T=b-1>>1,O=p[T],x(I,O)<0){p[b]=O,b=T;continue}break}return p[b]=I},y=function(p,m,b){var x,I,O,T,k;for(b==null&&(b=a),I=p.length,k=m,O=p[m],x=2*m+1;x0;){var O=m.pop(),T=y(O),k=O.id();if(c[k]=T,T!==1/0)for(var S=O.neighborhood().intersect(d),F=0;F0)for(ie.unshift(K);h[ve];){var oe=h[ve];ie.unshift(oe.edge),ie.unshift(oe.node),fe=oe.node,ve=fe.id()}return o.spawn(ie)}}}},yf={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(x){for(var I=0;I0;){if(I(),T++,x===f){for(var k=[],S=i,F=f,z=p[F];k.unshift(S),z!=null&&k.unshift(z),S=y[F],S!=null;)F=S.id(),z=p[F];return{found:!0,distance:h[x],path:this.spawn(k),steps:T}}v[x]=!0;for(var P=b._private.edges,H=0;Hz&&(d[F]=z,m[F]=S,b[F]=I),!i){var P=S*f+k;!i&&d[P]>z&&(d[P]=z,m[P]=k,b[P]=I)}}}for(var H=0;H1&&arguments[1]!==void 0?arguments[1]:s,je=b(Ie),Xe=[],_e=je;;){if(_e==null)return r.spawn();var De=m(_e),M=De.edge,he=De.pred;if(Xe.unshift(_e[0]),_e.same(Be)&&Xe.length>0)break;M!=null&&Xe.unshift(M),_e=he}return l.spawn(Xe)},O=0;O=0;f--){var h=u[f],c=h[1],v=h[2];(r[c]===o&&r[v]===l||r[c]===l&&r[v]===o)&&u.splice(f,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*r.length);r=Df(i,e,r),a--}return r},Sf={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(ie){return ie.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Cf);if(i<2){bt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,v){return c-v});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},If=function(e){return Math.PI*e/180},bn=function(e,r){return Math.atan2(r,e)-Math.PI/2},hi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Ls=function(e){return e>0?1:e<0?-1:0},Br=function(e,r){return Math.sqrt(Fr(e,r))},Fr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Rf=function(e){for(var r=e.length,a=0,n=0;n=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(e.w!=null&&e.h!=null&&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}}},Pf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Bf=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Ff=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},zf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},En=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ci=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=w(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},As=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},vi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},ra=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Gf=function(e,r){return ra(e,r.x,r.y)},Os=function(e,r){return ra(e,r.x1,r.y1)&&ra(e,r.x2,r.y2)},Ns=function(e,r,a,n,i,s,o){var l=Fa(i,s),u=i/2,f=s/2,h;{var c=a-u+l-o,v=n-f-o,d=a+u-l+o,g=v;if(h=Tr(e,r,a,n,c,v,d,g,!1),h.length>0)return h}{var y=a+u+o,p=n-f+l-o,m=y,b=n+f-l+o;if(h=Tr(e,r,a,n,y,p,m,b,!1),h.length>0)return h}{var x=a-u+l-o,I=n+f+o,O=a+u-l+o,T=I;if(h=Tr(e,r,a,n,x,I,O,T,!1),h.length>0)return h}{var k=a-u-o,S=n-f+l-o,F=k,z=n+f-l+o;if(h=Tr(e,r,a,n,k,S,F,z,!1),h.length>0)return h}var P;{var H=a-u+l,G=n-f+l;if(P=Pa(e,r,a,n,H,G,l+o),P.length>0&&P[0]<=H&&P[1]<=G)return[P[0],P[1]]}{var re=a+u-l,X=n-f+l;if(P=Pa(e,r,a,n,re,X,l+o),P.length>0&&P[0]>=re&&P[1]<=X)return[P[0],P[1]]}{var K=a+u-l,ie=n+f-l;if(P=Pa(e,r,a,n,K,ie,l+o),P.length>0&&P[0]>=K&&P[1]>=ie)return[P[0],P[1]]}{var fe=a-u+l,ve=n+f-l;if(P=Pa(e,r,a,n,fe,ve,l+o),P.length>0&&P[0]<=fe&&P[1]>=ve)return[P[0],P[1]]}return[]},Vf=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=f+l&&h-l<=r&&r<=c+l},$f=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(ef.x2||rf.y2)},_f=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},Uf=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,h,c,v,d;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,v=r/3,o>0){h=u+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-v+h+c,v+=(h+c)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-c+h)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),d=2*Math.sqrt(l),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},Yf=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,v=[];Uf(u,f,h,c,v);for(var d=1e-7,g=[],y=0;y<6;y+=2)Math.abs(v[y+1])=0&&v[y]<=1&&g.push(v[y]);g.push(1),g.push(0);for(var p=-1,m,b,x,I=0;I=0?xu?(e-i)*(e-i)+(r-s)*(r-s):f-c},_t=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},vr=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var c=Math.cos(-h),v=Math.sin(-h),d=0;d0){var y=Is(f,-u);g=Ms(y)}else g=f;return _t(e,r,g)},Xf=function(e,r,a,n,i,s,o){for(var l=new Array(a.length),u=s/2,f=o/2,h=pi(s,o),c=h*h,v=0;v=0&&y<=1&&m.push(y),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*l[0]+e,x=m[0]*l[1]+r;if(m.length>1){if(m[0]==m[1])return[b,x];var I=m[1]*l[0]+e,O=m[1]*l[1]+r;return[b,x,I,O]}else return[b,x]},di=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Tr=function(e,r,a,n,i,s,o,l,u){var f=e-i,h=a-e,c=o-i,v=r-s,d=n-r,g=l-s,y=c*v-g*f,p=h*v-d*f,m=g*h-c*d;if(m!==0){var b=y/m,x=p/m,I=.001,O=0-I,T=1+I;return O<=b&&b<=T&&O<=x&&x<=T?[e+b*h,r+b*d]:u?[e+b*h,r+b*d]:[]}else return y===0||p===0?di(e,a,o)===o?[o,l]:di(e,a,i)===i?[i,s]:di(i,o,a)===a?[a,n]:[]:[]},Ba=function(e,r,a,n,i,s,o,l){var u=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var v;if(c){for(var d=0;d0){var g=Is(h,-l);v=Ms(g)}else v=h}else v=a;for(var y,p,m,b,x=0;x2){for(var X=[u[0],u[1]],K=Math.pow(X[0]-e,2)+Math.pow(X[1]-r,2),ie=1;ief&&(f=x)},get:function(b){return u[b]}},c=0;c0?X=re.edgesTo(G)[0]:X=G.edgesTo(re)[0];var K=n(X);G=G.id(),k[G]>k[P]+K&&(k[G]=k[P]+K,S.nodes.indexOf(G)<0?S.push(G):S.updateItem(G),T[G]=0,O[G]=[]),k[G]==k[P]+K&&(T[G]=T[G]+T[P],O[G].push(P))}else for(var ie=0;ie0;){for(var ce=I.pop(),Ee=0;Ee0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},uh=function(e,r){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:hh,o=n,l,u,f=0;f=2?za(e,r,a,0,$s,ch):za(e,r,a,0,Vs)},squaredEuclidean:function(e,r,a){return za(e,r,a,0,$s)},manhattan:function(e,r,a){return za(e,r,a,0,Vs)},max:function(e,r,a){return za(e,r,a,-1/0,vh)}};ia["squared-euclidean"]=ia.squaredEuclidean,ia.squaredeuclidean=ia.squaredEuclidean;function xn(t,e,r,a,n,i){var s;return ne(t)?s=t:s=ia[t]||ia.euclidean,e===0&&ne(t)?s(n,i):s(e,r,a,n,i)}var dh=St({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),bi=function(e){return dh(e)},Tn=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},l=function(c){return n[c](r)},u=a,f=r;return xn(e,n.length,o,l,u,f)},Ei=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;ua)return!1}return!0},yh=function(e,r,a){for(var n=0;no&&(o=r[u][f],l=f);i[l].push(e[u])}for(var h=0;h=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[s],g=r[n[s]],y;i.mode==="dendrogram"?y={left:d,right:g,key:d.key}:y={value:d.value.concat(g.value),key:d.key},e[d.index]=y,e.splice(g.index,1),r[d.key]=y;for(var p=0;pa[g.key][m.key]&&(l=a[g.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]0&&n.push(i);return n},Ks=function(e,r,a){for(var n=[],i=0;io&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;fu&&(l=f,u=h)}a[i]=s[l]}return n=Ks(e,r,a),n},Zs=function(e){for(var r=this.cy(),a=this.nodes(),n=Mh(e),i={},s=0;s=z?(P=z,z=G,H=re):G>P&&(P=G);for(var X=0;X0?1:0;T[S%n.minIterations*o+ce]=Ee,oe+=Ee}if(oe>0&&(S>=n.minIterations-1||S==n.maxIterations-1)){for(var xe=0,ye=0;ye1||O>1)&&(o=!0),h[b]=[],m.outgoers().forEach(function(k){k.isEdge()&&h[b].push(k.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var x=m.degree(!0);x%2&&(l?u?o=!0:u=b:l=b),h[b]=[],m.connectedEdges().forEach(function(I){return h[b].push(I.id())})}else c[b]=[m.source().id(),m.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(f&&u!=f)return v;f=u}else{if(f&&u!=f&&l!=f)return v;f||(f=u)}else f||(f=s[0].id());var d=function(b){for(var x=b,I=[b],O,T,k;h[x].length;)O=h[x].shift(),T=c[O][0],k=c[O][1],x!=k?(h[k]=h[k].filter(function(S){return S!=O}),x=k):!i&&x!=T&&(h[T]=h[T].filter(function(S){return S!=O}),x=T),I.unshift(O),I.unshift(x);return I},g=[],y=[];for(y=d(f);y.length!=1;)h[y[0]].length==0?(g.unshift(s.getElementById(y.shift())),g.unshift(s.getElementById(y.shift()))):y=d(y.shift()).concat(y);g.unshift(s.getElementById(y.shift()));for(var p in h)if(h[p].length)return v;return v.found=!0,v.trail=this.spawn(g,!0),v}},Dn=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(c,v){for(var d=s.length-1,g=[],y=e.spawn();s[d].x!=c||s[d].y!=v;)g.push(s.pop().edge),d--;g.push(s.pop().edge),g.forEach(function(p){var m=p.connectedNodes().intersection(e);y.merge(p),m.forEach(function(b){var x=b.id(),I=b.connectedEdges().intersection(e);y.merge(b),r[x].cutVertex?y.merge(I.filter(function(O){return O.isLoop()})):y.merge(I)})}),i.push(y)},u=function h(c,v,d){c===d&&(n+=1),r[v]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(v).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(v)));else{var y,p,m,b;g.forEach(function(x){y=x.source().id(),p=x.target().id(),m=y===v?p:y,m!==d&&(b=x.id(),o[b]||(o[b]=!0,s.push({x:v,y:m,edge:x})),m in r?r[v].low=Math.min(r[v].low,r[m].id):(h(c,m,v),r[v].low=Math.min(r[v].low,r[m].low),r[v].id<=r[m].low&&(r[v].cutVertex=!0,l(v,m))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,u(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Gh={hopcroftTarjanBiconnected:Dn,htbc:Dn,htb:Dn,hopcroftTarjanBiconnectedComponents:Dn},Sn=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(g){var y=g.target().id();y!==u&&(y in r||l(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[u].index,r[c].explored=!0,c===u)break}var v=h.edgesWith(h),d=h.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},Vh={tarjanStronglyConnected:Sn,tsc:Sn,tscc:Sn,tarjanStronglyConnectedComponents:Sn},Qs={};[Ia,pf,yf,bf,wf,Tf,Sf,Qf,aa,na,mi,fh,Th,Oh,Bh,zh,Gh,Vh].forEach(function(t){$e(Qs,t)});var Js=0,js=1,eo=2,dr=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=Js,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};dr.prototype={fulfill:function(e){return to(this,js,"fulfillValue",e)},reject:function(e){return to(this,eo,"rejectReason",e)},then:function(e,r){var a=this,n=new dr;return a.onFulfilled.push(no(e,n,"fulfill")),a.onRejected.push(no(r,n,"reject")),ro(a),n.proxy}};var to=function(e,r,a,n){return e.state===Js&&(e.state=r,e[a]=n,ro(e)),e},ro=function(e){e.state===js?ao(e,"onFulfilled",e.fulfillValue):e.state===eo&&ao(e,"onRejected",e.rejectReason)},ao=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s-1}var qc=Xc;function Wc(t,e){var r=this.__data__,a=An(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Kc=Wc;function ua(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){me(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Nn.className=Nn.classNames=Nn.classes;var nt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ke,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};nt.variable="(?:[\\w-.]|(?:\\\\"+nt.metaChar+"))+",nt.className="(?:[\\w-]|(?:\\\\"+nt.metaChar+"))+",nt.value=nt.string+"|"+nt.number,nt.id=nt.variable,function(){var t,e,r;for(t=nt.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(nt.comparatorOp+="|\\!"+e)}();var vt=function(){return{checks:[]}},Re={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},Si=[{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(t,e){return Jt(t.selector,e.selector)}),jv=function(){for(var t={},e,r=0;r0&&f.edgeCount>0)return lt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return lt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&<("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},id=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f==null?"":f},r=function(f){return ee(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,v=f.value;switch(c){case Re.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case Re.DATA_COMPARE:{var g=f.field,y=f.operator;return"["+g+a(e(y))+r(v)+"]"}case Re.DATA_BOOL:{var p=f.operator,m=f.field;return"["+e(p)+m+"]"}case Re.DATA_EXIST:{var b=f.field;return"["+b+"]"}case Re.META_COMPARE:{var x=f.operator,I=f.field;return"[["+I+a(e(x))+r(v)+"]]"}case Re.STATE:return v;case Re.ID:return"#"+v;case Re.CLASS:return"."+v;case Re.PARENT:case Re.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case Re.ANCESTOR:case Re.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case Re.COMPOUND_SPLIT:{var O=i(f.left,h),T=i(f.subject,h),k=i(f.right,h);return O+(O.length>0?" ":"")+T+k}case Re.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,v,d){return c+(h===f&&d===0?"$":"")+n(v,h)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function bo(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,bo)};function Eo(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ha.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,Eo)};function vd(t,e,r){Eo(t,e,r),bo(t,e,r)}ha.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,vd)},ha.ancestors=ha.parents;var Va,wo;Va=wo={data:ft.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:ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ft.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ft.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Va.attr=Va.data,Va.removeAttr=Va.removeData;var dd=wo,Mn={};function Ni(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,s=0;se}),minIndegree:ca("indegree",function(t,e){return te}),minOutdegree:ca("outdegree",function(t,e){return te})}),$e(Mn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n0,c=h;h&&(f=f[0]);var v=c?f.position():{x:0,y:0};r!==void 0?u.position(e,r+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),g=o?a.parent():null,y=g&&g.length>0,p=y;y&&(g=g[0]);var m=p?g.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!s)return;return this}},er.modelPosition=er.point=er.position,er.modelPositions=er.points=er.positions,er.renderedPoint=er.renderedPosition,er.relativePoint=er.relativePosition;var gd=xo,va,Ar;va=Ar={},Ar.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}},Ar.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)},Ar.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function v(S,F,z){var P=0,H=0,G=F+z;return S>0&&G>0&&(P=F/G*S,H=z/G*S),{biasDiff:P,biasComplementDiff:H}}function d(S,F,z,P){if(z.units==="%")switch(P){case"width":return S>0?z.pfValue*S:0;case"height":return F>0?z.pfValue*F:0;case"average":return S>0&&F>0?z.pfValue*(S+F)/2:0;case"min":return S>0&&F>0?S>F?z.pfValue*F:z.pfValue*S:0;case"max":return S>0&&F>0?S>F?z.pfValue*S:z.pfValue*F:0;default:return 0}else return z.units==="px"?z.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var y=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var p=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(p=p*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var b=v(f.width.val-h.w,g,y),x=b.biasDiff,I=b.biasComplementDiff,O=v(f.height.val-h.h,p,m),T=O.biasDiff,k=O.biasComplementDiff;o.autoPadding=d(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-x+h.x1+h.x2+I)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-T+h.y1+h.y2+k)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Vr=function(e,r){return r==null?e:tr(e,r.x1,r.y1,r.x2,r.y2)},$a=function(e,r,a){return jt(e,r,a)},In=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=l-s,h.y1=u-s,h.x2=l+s,h.y2=u+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,En(h,1),tr(e,h.x1,h.y1,h.x2,h.y2)}}},Mi=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),f=$a(s,"labelWidth",a),h=$a(s,"labelHeight",a),c=$a(s,"labelX",a),v=$a(s,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,g=r.pstyle(n+"text-margin-y").pfValue,y=r.isEdge(),p=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,x=b/2,I=r.pstyle("text-background-padding").pfValue,O=2,T=h,k=f,S=k/2,F=T/2,z,P,H,G;if(y)z=c-S,P=c+S,H=v-F,G=v+F;else{switch(l.value){case"left":z=c-k,P=c;break;case"center":z=c-S,P=c+S;break;case"right":z=c,P=c+k;break}switch(u.value){case"top":H=v-T,G=v;break;case"center":H=v-F,G=v+F;break;case"bottom":H=v,G=v+T;break}}z+=d-Math.max(m,x)-I-O,P+=d+Math.max(m,x)+I+O,H+=g-Math.max(m,x)-I-O,G+=g+Math.max(m,x)+I+O;var re=a||"main",X=i.labelBounds,K=X[re]=X[re]||{};K.x1=z,K.y1=H,K.x2=P,K.y2=G,K.w=P-z,K.h=G-H;var ie=y&&p.strValue==="autorotate",fe=p.pfValue!=null&&p.pfValue!==0;if(ie||fe){var ve=ie?$a(i.rstyle,"labelAngle",a):p.pfValue,oe=Math.cos(ve),ce=Math.sin(ve),Ee=(z+P)/2,xe=(H+G)/2;if(!y){switch(l.value){case"left":Ee=P;break;case"right":Ee=z;break}switch(u.value){case"top":xe=G;break;case"bottom":xe=H;break}}var ye=function(He,Me){return He=He-Ee,Me=Me-xe,{x:He*oe-Me*ce+Ee,y:He*ce+Me*oe+xe}},de=ye(z,H),ae=ye(z,G),we=ye(P,H),Te=ye(P,G);z=Math.min(de.x,ae.x,we.x,Te.x),P=Math.max(de.x,ae.x,we.x,Te.x),H=Math.min(de.y,ae.y,we.y,Te.y),G=Math.max(de.y,ae.y,we.y,Te.y)}var Ae=re+"Rot",Ne=X[Ae]=X[Ae]||{};Ne.x1=z,Ne.y1=H,Ne.x2=P,Ne.y2=G,Ne.w=P-z,Ne.h=G-H,tr(e,z,H,P,G),tr(i.labelBounds.all,z,H,P,G)}return e}},pd=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=$t(),o=e._private,l=e.isNode(),u=e.isEdge(),f,h,c,v,d,g,y=o.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ve){return Ve.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var x=0,I=0;n&&r.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(I=e.pstyle("overlay-padding").value));var O=0,T=0;n&&r.includeUnderlays&&(O=e.pstyle("underlay-opacity").value,O!==0&&(T=e.pstyle("underlay-padding").value));var k=Math.max(I,T),S=0,F=0;if(n&&(S=e.pstyle("width").pfValue,F=S/2),l&&r.includeNodes){var z=e.position();d=z.x,g=z.y;var P=e.outerWidth(),H=P/2,G=e.outerHeight(),re=G/2;f=d-H,h=d+H,c=g-re,v=g+re,tr(s,f,c,h,v)}else if(u&&r.includeEdges)if(n&&!i){var X=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),h=Math.max(y.srcX,y.midX,y.tgtX),c=Math.min(y.srcY,y.midY,y.tgtY),v=Math.max(y.srcY,y.midY,y.tgtY),f-=F,h+=F,c-=F,v+=F,tr(s,f,c,h,v),X==="haystack"){var K=y.haystackPts;if(K&&K.length===2){if(f=K[0].x,c=K[0].y,h=K[1].x,v=K[1].y,f>h){var ie=f;f=h,h=ie}if(c>v){var fe=c;c=v,v=fe}tr(s,f-F,c-F,h+F,v+F)}}else if(X==="bezier"||X==="unbundled-bezier"||X==="segments"||X==="taxi"){var ve;switch(X){case"bezier":case"unbundled-bezier":ve=y.bezierPts;break;case"segments":case"taxi":ve=y.linePts;break}if(ve!=null)for(var oe=0;oeh){var ae=f;f=h,h=ae}if(c>v){var we=c;c=v,v=we}f-=F,h+=F,c-=F,v+=F,tr(s,f,c,h,v)}if(n&&r.includeEdges&&u&&(In(s,e,"mid-source"),In(s,e,"mid-target"),In(s,e,"source"),In(s,e,"target")),n){var Te=e.pstyle("ghost").value==="yes";if(Te){var Ae=e.pstyle("ghost-offset-x").pfValue,Ne=e.pstyle("ghost-offset-y").pfValue;tr(s,s.x1+Ae,s.y1+Ne,s.x2+Ae,s.y2+Ne)}}var Ue=o.bodyBounds=o.bodyBounds||{};As(Ue,s),ci(Ue,p),En(Ue,1),n&&(f=s.x1,h=s.x2,c=s.y1,v=s.y2,tr(s,f-k,c-k,h+k,v+k));var He=o.overlayBounds=o.overlayBounds||{};As(He,s),ci(He,p),En(He,1);var Me=o.labelBounds=o.labelBounds||{};Me.all!=null?Bf(Me.all):Me.all=$t(),n&&r.includeLabels&&(r.includeMainLabels&&Mi(s,e,null),u&&(r.includeSourceLabels&&Mi(s,e,"source"),r.includeTargetLabels&&Mi(s,e,"target")))}return s.x1=qt(s.x1),s.y1=qt(s.y1),s.x2=qt(s.x2),s.y2=qt(s.y2),s.w=qt(s.x2-s.x1),s.h=qt(s.y2-s.y1),s.w>0&&s.h>0&&b&&(ci(s,p),En(s,1)),s},Do=function(e){var r=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:Md,e=arguments.length>1?arguments[1]:void 0,r=0;r=0;o--)s(o);return this},Or.removeAllListeners=function(){return this.removeListener("*")},Or.emit=Or.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,me(e)||(e=[e]),Id(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===Nd)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&ff(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==h}));var v=i.callbackContext(i.context,h,s),d=h.callback.apply(v,c);i.afterEmit(i.context,h,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ee(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;ia&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s=0&&i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i!=null?i:r?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(C(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ee(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var s=0;s0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Rt.neighbourhood=Rt.neighborhood,Rt.closedNeighbourhood=Rt.closedNeighborhood,Rt.openNeighbourhood=Rt.openNeighborhood,$e(Rt,{source:Xt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Xt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Xo({attr:"source"}),targets:Xo({attr:"target"})});function Xo(t){return function(r){for(var a=[],n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Rt.componentsOf=Rt.components;var At=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){bt("A collection must have a reference to the core");return}var i=new or,s=!1;if(!r)r=[];else if(r.length>0&&C(r[0])&&!Le(r[0])){s=!0;for(var o=[],l=new jr,u=0,f=r.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],s=[],o,l=0,u=r.length;l0){for(var fe=o.length===r.length?r:new At(a,o),ve=0;ve0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function s(G){for(var re=G._private.edges,X=0;X0&&(t?z.emitAndNotify("remove"):e&&z.emit("remove"));for(var P=0;P0?P=G:z=G;while(Math.abs(H)>s&&++re=i?m(F,re):X===0?re:x(F,z,z+u)}var O=!1;function T(){O=!0,(t!==e||r!==a)&&b()}var k=function(z){return O||T(),t===e&&r===a?z:z===0?0:z===1?1:y(I(z),e,a)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var S="generateBezier("+[t,e,r,a]+")";return k.toString=function(){return S},k}var Ud=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,h=16/1e3,c,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(u=a(n,i),v=u/s*h):v=h;d=r(d||o,v),l.push(1+d.x),u+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(g){return l[g*(l.length-1)|0]}:u}}(),pt=function(e,r,a,n){var i=_d(e,r,a,n);return function(s,o,l){return s+(o-s)*i(l)}},Vn={linear:function(e,r,a){return e+(r-e)*a},ease:pt(.25,.1,.25,1),"ease-in":pt(.42,0,1,1),"ease-out":pt(0,0,.58,1),"ease-in-out":pt(.42,0,.58,1),"ease-in-sine":pt(.47,0,.745,.715),"ease-out-sine":pt(.39,.575,.565,1),"ease-in-out-sine":pt(.445,.05,.55,.95),"ease-in-quad":pt(.55,.085,.68,.53),"ease-out-quad":pt(.25,.46,.45,.94),"ease-in-out-quad":pt(.455,.03,.515,.955),"ease-in-cubic":pt(.55,.055,.675,.19),"ease-out-cubic":pt(.215,.61,.355,1),"ease-in-out-cubic":pt(.645,.045,.355,1),"ease-in-quart":pt(.895,.03,.685,.22),"ease-out-quart":pt(.165,.84,.44,1),"ease-in-out-quart":pt(.77,0,.175,1),"ease-in-quint":pt(.755,.05,.855,.06),"ease-out-quint":pt(.23,1,.32,1),"ease-in-out-quint":pt(.86,0,.07,1),"ease-in-expo":pt(.95,.05,.795,.035),"ease-out-expo":pt(.19,1,.22,1),"ease-in-out-expo":pt(1,0,0,1),"ease-in-circ":pt(.6,.04,.98,.335),"ease-out-circ":pt(.075,.82,.165,1),"ease-in-out-circ":pt(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Vn.linear;var n=Ud(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":pt};function Ko(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Zo(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function pa(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=Zo(t,n),o=Zo(e,n);if(N(s)&&N(o))return Ko(i,s,o,r,a);if(me(s)&&me(o)){for(var l=[],u=0;u0?(v==="spring"&&d.push(s.duration),s.easingImpl=Vn[v].apply(null,d)):s.easingImpl=Vn[v]}var g=s.easingImpl,y;if(s.duration===0?y=1:y=(r-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var p=s.startPosition,m=s.position;if(m&&n&&!t.locked()){var b={};Xa(p.x,m.x)&&(b.x=pa(p.x,m.x,y,g)),Xa(p.y,m.y)&&(b.y=pa(p.y,m.y,y,g)),t.position(b)}var x=s.startPan,I=s.pan,O=i.pan,T=I!=null&&a;T&&(Xa(x.x,I.x)&&(O.x=pa(x.x,I.x,y,g)),Xa(x.y,I.y)&&(O.y=pa(x.y,I.y,y,g)),t.emit("pan"));var k=s.startZoom,S=s.zoom,F=S!=null&&a;F&&(Xa(k,S)&&(i.zoom=ka(i.minZoom,pa(k,S,y,g),i.maxZoom)),t.emit("zoom")),(T||F)&&t.emit("viewport");var z=s.style;if(z&&z.length>0&&n){for(var P=0;P=0;T--){var k=O[T];k()}O.splice(0,O.length)},m=v.length-1;m>=0;m--){var b=v[m],x=b._private;if(x.stopped){v.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||Hd(f,b,t),Yd(f,b,t,h),x.applying&&(x.applying=!1),p(x.frames),x.step!=null&&x.step(t),b.completed()&&(v.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.completes)),g=!0)}return!h&&v.length===0&&d.length===0&&a.push(f),g}for(var i=!1,s=0;s0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Xd={animate:ft.animate(),animation:ft.animation(),animated:ft.animated(),clearQueue:ft.clearQueue(),delay:ft.delay(),delayAnimation:ft.delayAnimation(),stop:ft.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&dn(function(i){Qo(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Qo(s,e)},a.beforeRenderPriorities.animations):r()}},qd={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Le(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},$n=function(e){return ee(e)?new Dr(e):e},Jo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new kn(qd,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,$n(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,$n(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,$n(r),a),this},once:function(e,r,a){return this.emitter().one(e,$n(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};ft.eventAliasesOn(Jo);var ki={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};ki.jpeg=ki.jpg;var _n={layout:function(e){var r=this;if(e==null){bt("Layout options must be specified to make a layout");return}if(e.name==null){bt("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){bt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ee(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n($e({},e,{cy:r,eles:i}));return s}};_n.createLayout=_n.makeLayout=_n.layout;var Wd={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.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 e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Pi.invalidateDimensions=Pi.resize;var Un={collection:function(e,r){return ee(e)?this.$(e):se(e)?e.collection():me(e)?(r||(r={}),new At(this,e,r.unique,r.removed)):new At(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Un.elements=Un.filter=Un.$;var kt={},qa="t",Zd="f";kt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i0;if(c||h&&v){var d=void 0;c&&v||c?d=u.properties:v&&(d=u.mappedProperties);for(var g=0;g1&&(x=1),o.color){var O=a.valueMin[0],T=a.valueMax[0],k=a.valueMin[1],S=a.valueMax[1],F=a.valueMin[2],z=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],H=a.valueMax[3]==null?1:a.valueMax[3],G=[Math.round(O+(T-O)*x),Math.round(k+(S-k)*x),Math.round(F+(z-F)*x),Math.round(P+(H-P)*x)];i={bypass:a.bypass,name:a.name,value:G,strValue:"rgb("+G[0]+", "+G[1]+", "+G[2]+")"}}else if(o.number){var re=a.valueMin+(a.valueMax-a.valueMin)*x;i=this.parse(a.name,re,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case s.data:{for(var X=a.field.split("."),K=h.data,ie=0;ie0&&i>0){for(var o={},l=!1,u=0;u0?t.delayAnimation(s).play().promise().then(b):b()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)},kt.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)},kt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})},kt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&(e==="curve-style"&&(r==="bezier"||a==="bezier")||e==="display"&&(r==="none"||a==="none"))&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()})})},kt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Wa={};Wa.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){lt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new Dr(h);if(c.invalid){lt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var v=f[2],d=!1;i=v;for(var g=[];;){var y=i.match(/^\s*$/);if(y)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){lt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=p[0];var m=p[1],b=p[2],x=e.properties[m];if(!x){lt("Skipping property: Invalid property name in: "+s),l();continue}var I=r.parse(m,b);if(!I){lt("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:m,val:b}),l()}if(d){o();break}r.selector(h);for(var O=0;O=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var c=o.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(t,h[4]);if(!d||d.mapped)return!1;var g=this.parse(t,h[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return lt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(u.color){var y=d.value,p=g.value,m=y[0]===p[0]&&y[1]===p[1]&&y[2]===p[2]&&(y[3]===p[3]||(y[3]==null||y[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:t,value:h,strValue:""+e,mapped:v,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:d.value,valueMax:g.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):me(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var x=[],I=[],O=[],T="",k=!1,S=0;S0?" ":"")+F.strValue}return u.validate&&!u.validate(x,I)?null:u.singleEnum&&k?x.length===1&&ee(x[0])?{name:t,value:x[0],strValue:x[0],bypass:r}:null:{name:t,value:x,pfValue:O,strValue:T,bypass:r,units:I}}var z=function(){for(var Te=0;Teu.max||u.strictMax&&e===u.max))return null;var X={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return u.unitless||P!=="px"&&P!=="em"?X.pfValue=e:X.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(X.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(X.pfValue=P==="rad"?e:If(e)),P==="%"&&(X.pfValue=e/100),X}else if(u.propList){var K=[],ie=""+e;if(ie!=="none"){for(var fe=ie.split(/\s*,\s*|\s+/),ve=0;ve0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*r)/a.w,(o-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,s,o=!1;if(r.zoomingEnabled||(o=!0),N(e)?s=e:C(e)&&(s=e.level,e.position!=null?i=mn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;N(u.x)&&(r.pan.x=u.x,o=!1),N(u.y)&&(r.pan.y=u.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 r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ee(e)){var a=e;e=this.mutableElements().filter(a)}else se(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container;return e.sizeCache=e.sizeCache||(r?function(){var a=D.getComputedStyle(r),n=function(s){return parseFloat(a.getPropertyValue(s))};return{width:r.clientWidth-n("padding-left")-n("padding-right"),height:r.clientHeight-n("padding-top")-n("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,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};$r.centre=$r.center,$r.autolockNodes=$r.autolock,$r.autoungrabifyNodes=$r.autoungrabify;var Ka={data:ft.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ka.attr=Ka.data,Ka.removeAttr=Ka.removeData;var Za=function(e){var r=this;e=$e({},e);var a=e.container;a&&!ue(a)&&ue(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var s=D!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=$e({name:s?"grid":"null"},o.layout),o.renderer=$e({name:s?"canvas":"null"},o.renderer);var l=function(d,g,y){return g!==void 0?g:y!==void 0?y:d},u=this._private={container:a,ready:!1,options:o,elements:new At(this),listeners:[],aniEles:new At(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:N(o.zoom)?o.zoom:1,pan:{x:C(o.pan)&&N(o.pan.x)?o.pan.x:0,y:C(o.pan)&&N(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,g){var y=d.some(Je);if(y)return sa.all(d).then(g);g(d)};u.styleEnabled&&r.setStyle([]);var h=$e({},o,o.renderer);r.initRenderer(h);var c=function(d,g,y){r.notifications(!1);var p=r.mutableElements();p.length>0&&p.remove(),d!=null&&(C(d)||me(d))&&r.add(d),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var m=$e({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([o.style,o.elements],function(v){var d=v[0],g=v[1];u.styleEnabled&&r.style().append(d),c(g,function(){r.startAnimationLoop(),u.ready=!0,ne(o.ready)&&r.on("ready",o.ready);for(var y=0;y0,l=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(se(e.roots))u=e.roots;else if(me(e.roots)){for(var f=[],h=0;h0;){var re=G(),X=F(re,P);if(X)re.outgoers().filter(function(Me){return Me.isNode()&&a.has(Me)}).forEach(H);else if(X===null){lt("Detected double maximal shift for node `"+re.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}S();var K=0;if(e.avoidOverlap)for(var ie=0;ie0&&p[0].length<=3?_e/2:0),he=2*Math.PI/p[ke].length*Ie;return ke===0&&p[0].length===1&&(M=1),{x:Ne.x+M*Math.cos(he),y:Ne.y+M*Math.sin(he)}}else{var De={x:Ne.x+(Ie+1-(Be+1)/2)*je,y:(ke+1)*Xe};return De}};return a.nodes().layoutPositions(this,e,He),this};var eg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function tu(t){this.options=$e({},eg,t)}tu.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,h=0,c=0;c1&&e.avoidOverlap){h*=1.75;var p=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(h*h/(p*p+m*m));f=Math.max(b,f)}var x=function(O,T){var k=e.startAngle+T*u*(n?1:-1),S=f*Math.cos(k),F=f*Math.sin(k),z={x:o.x+S,y:o.y+F};return z};return a.nodes().layoutPositions(this,e,x),this};var tg={fit:!0,padding:30,startAngle:3/2*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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function ru(t){this.options=$e({},tg,t)}ru.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),s=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f0){var I=Math.abs(m[0].value-x.value);I>=y&&(m=[],p.push(m))}m.push(x)}var O=u+e.minNodeSpacing;if(!e.avoidOverlap){var T=p.length>0&&p[0].length>1,k=Math.min(s.w,s.h)/2-O,S=k/(p.length+T?1:0);O=Math.min(O,S)}for(var F=0,z=0;z1&&e.avoidOverlap){var re=Math.cos(G)-Math.cos(0),X=Math.sin(G)-Math.sin(0),K=Math.sqrt(O*O/(re*re+X*X));F=Math.max(K,F)}P.r=F,F+=O}if(e.equidistant){for(var ie=0,fe=0,ve=0;ve=t.numIter||(lg(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature=t.animationThreshold&&i(),dn(h)}};f()}else{for(;u;)u=s(l),l++;iu(a,t),o()}return this},qn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},qn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ag=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:$t(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=a.eles.components(),l={},u=0;u0){s.graphSet.push(T);for(var u=0;un.count?0:n.graph},ig=function t(e,r,a,n){var i=n.graphSet[a];if(-10)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+l*l),v=h*o/c,d=h*l/c;else var g=Wn(e,o,l),y=Wn(r,-1*o,-1*l),p=y.x-g.x,m=y.y-g.y,b=p*p+m*m,c=Math.sqrt(b),h=(e.nodeRepulsion+r.nodeRepulsion)/b,v=h*p/c,d=h*m/c;e.isLocked||(e.offsetX-=v,e.offsetY-=d),r.isLocked||(r.offsetX+=v,r.offsetY+=d)}},cg=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Wn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/r,u=s/o,f={};return r===0&&0a?(f.x=n,f.y=i+s/2,f):0r&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/r,f):0=u)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},vg=function(e,r){for(var a=0;aa){var y=r.gravity*v/g,p=r.gravity*d/g;c.offsetX+=y,c.offsetY+=p}}}}},gg=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},mg=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTopp&&(d+=y+r.componentSpacing,v=0,g=0,y=0)}}},bg={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function su(t){this.options=$e({},bg,t)}su.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(Ee){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),f=function(xe){if(xe==null)return Math.min(l,u);var ye=Math.min(l,u);ye==l?l=xe:u=xe},h=function(xe){if(xe==null)return Math.max(l,u);var ye=Math.max(l,u);ye==l?l=xe:u=xe},c=e.rows,v=e.cols!=null?e.cols:e.columns;if(c!=null&&v!=null)l=c,u=v;else if(c!=null&&v==null)l=c,u=Math.ceil(s/l);else if(c==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var d=f(),g=h();(d-1)*g>=s?f(d-1):(g-1)*d>=s&&h(g-1)}else for(;u*l=s?h(p+1):f(y+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var x=0;x=u&&(re=0,G++)},K={},ie=0;ie(re=Hf(t,e,X[K],X[K+1],X[K+2],X[K+3])))return y(T,re),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var X=S.allpts,K=0;K+5(re=Yf(t,e,X[K],X[K+1],X[K+2],X[K+3],X[K+4],X[K+5])))return y(T,re),!0}for(var ie=ie||k.source,fe=fe||k.target,ve=n.getArrowWidth(F,z),oe=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],K=0;K0&&(p(ie),p(fe))}function b(T,k,S){return jt(T,k,S)}function x(T,k){var S=T._private,F=c,z;k?z=k+"-":z="",T.boundingBox();var P=S.labelBounds[k||"main"],H=T.pstyle(z+"label").value,G=T.pstyle("text-events").strValue==="yes";if(!(!G||!H)){var re=b(S.rscratch,"labelX",k),X=b(S.rscratch,"labelY",k),K=b(S.rscratch,"labelAngle",k),ie=T.pstyle(z+"text-margin-x").pfValue,fe=T.pstyle(z+"text-margin-y").pfValue,ve=P.x1-F-ie,oe=P.x2+F-ie,ce=P.y1-F-fe,Ee=P.y2+F-fe;if(K){var xe=Math.cos(K),ye=Math.sin(K),de=function(He,Me){return He=He-re,Me=Me-X,{x:He*xe-Me*ye+re,y:He*ye+Me*xe+X}},ae=de(ve,ce),we=de(ve,Ee),Te=de(oe,ce),Ae=de(oe,Ee),Ne=[ae.x+ie,ae.y+fe,Te.x+ie,Te.y+fe,Ae.x+ie,Ae.y+fe,we.x+ie,we.y+fe];if(_t(t,e,Ne))return y(T),!0}else if(ra(P,t,e))return y(T),!0}}for(var I=s.length-1;I>=0;I--){var O=s[I];O.isNode()?p(O)||x(O):m(O)||x(O)||x(O,"source")||x(O,"target")}return o},_r.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=s,r=o,e=l,a=u;for(var f=$t({x1:t,y1:e,x2:r,y2:a}),h=0;h0?Math.max(Pe-rt,0):Math.min(Pe+rt,0)},H=P(F,k),G=P(z,S),re=!1;m===u?p=Math.abs(H)>Math.abs(G)?n:a:m===l||m===o?(p=a,re=!0):(m===i||m===s)&&(p=n,re=!0);var X=p===a,K=X?G:H,ie=X?z:F,fe=Ls(ie),ve=!1;!(re&&(x||O))&&(m===o&&ie<0||m===l&&ie>0||m===i&&ie>0||m===s&&ie<0)&&(fe*=-1,K=fe*Math.abs(K),ve=!0);var oe;if(x){var ce=I<0?1+I:I;oe=ce*K}else{var Ee=I<0?K:0;oe=Ee+I*fe}var xe=function(Pe){return Math.abs(Pe)=Math.abs(K)},ye=xe(oe),de=xe(Math.abs(K)-Math.abs(oe)),ae=ye||de;if(ae&&!ve)if(X){var we=Math.abs(ie)<=c/2,Te=Math.abs(F)<=v/2;if(we){var Ae=(f.x1+f.x2)/2,Ne=f.y1,Ue=f.y2;r.segpts=[Ae,Ne,Ae,Ue]}else if(Te){var He=(f.y1+f.y2)/2,Me=f.x1,Oe=f.x2;r.segpts=[Me,He,Oe,He]}else r.segpts=[f.x1,f.y2]}else{var Ve=Math.abs(ie)<=h/2,ke=Math.abs(z)<=d/2;if(Ve){var Ie=(f.y1+f.y2)/2,Be=f.x1,je=f.x2;r.segpts=[Be,Ie,je,Ie]}else if(ke){var Xe=(f.x1+f.x2)/2,_e=f.y1,De=f.y2;r.segpts=[Xe,_e,Xe,De]}else r.segpts=[f.x2,f.y1]}else if(X){var M=f.y1+oe+(y?c/2*fe:0),he=f.x1,Ce=f.x2;r.segpts=[he,M,Ce,M]}else{var ge=f.x1+oe+(y?h/2*fe:0),pe=f.y1,qe=f.y2;r.segpts=[ge,pe,ge,qe]}},Gt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,f=e.tgtShape,h=!N(r.startX)||!N(r.startY),c=!N(r.arrowStartX)||!N(r.arrowStartY),v=!N(r.endX)||!N(r.endY),d=!N(r.arrowEndX)||!N(r.arrowEndY),g=3,y=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,p=g*y,m=Br({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),b=mG.poolIndex()){var re=H;H=G,G=re}var X=S.srcPos=H.position(),K=S.tgtPos=G.position(),ie=S.srcW=H.outerWidth(),fe=S.srcH=H.outerHeight(),ve=S.tgtW=G.outerWidth(),oe=S.tgtH=G.outerHeight(),ce=S.srcShape=r.nodeShapes[e.getNodeShape(H)],Ee=S.tgtShape=r.nodeShapes[e.getNodeShape(G)];S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var xe=0;xe0){var we=i,Te=Fr(we,ea(r)),Ae=Fr(we,ea(ae)),Ne=Te;if(Ae2){var Ue=Fr(we,{x:ae[2],y:ae[3]});Ue0){var he=s,Ce=Fr(he,ea(r)),ge=Fr(he,ea(M)),pe=Ce;if(ge2){var qe=Fr(he,{x:M[2],y:M[3]});qe=d||T){y={cp:x,segment:O};break}}if(y)break}var k=y.cp,S=y.segment,F=(d-p)/S.length,z=S.t1-S.t0,P=v?S.t0+z*F:S.t1-z*F;P=ka(0,P,1),e=ta(k.p0,k.p1,k.p2,P),c=Dg(k.p0,k.p1,k.p2,P);break}case"straight":case"segments":case"haystack":{for(var H=0,G,re,X,K,ie=a.allpts.length,fe=0;fe+3=d));fe+=2);var ve=d-re,oe=ve/G;oe=ka(0,oe,1),e=kf(X,K,oe),c=du(X,K);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};u("source"),u("target"),this.applyLabelDimensions(t)}},lr.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},lr.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=jt(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,h=n.width,c=n.height+(l-1)*(i-1)*u;xr(r.rstyle,"labelWidth",e,h),xr(r.rscratch,"labelWidth",e,h),xr(r.rstyle,"labelHeight",e,c),xr(r.rscratch,"labelHeight",e,c),xr(r.rscratch,"labelLineHeight",e,f)},lr.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(ve,oe){return oe?(xr(r.rscratch,ve,e,oe),oe):jt(r.rscratch,ve,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",f=n.split(` `),h=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,v=c==="anywhere",d=[],g=/[\s\u200b]+/,y=v?"":" ",p=0;ph){for(var O=m.split(g),T="",k=0;kH)break;G+=n[K],K===n.length-1&&(X=!0)}return X||(G+=re),G}return n},lr.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e},lr.calculateLabelDimensions=function(t,e){var r=this,a=Pr(e,t._private.labelDimsKey),n=r.labelDimCache||(r.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=t.pstyle("font-style").strValue,l=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var v=h.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(l,"px ").concat(u);for(var d=0,g=0,y=e.split(` `),p=0;p1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l=t.desktopTapThreshold2}var yr=a(M);Mt&&(t.hoverData.tapholdCancelled=!0);var Ir=function(){var hr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];hr.length===0?(hr.push(Qe[0]),hr.push(Qe[1])):(hr[0]+=Qe[0],hr[1]+=Qe[1])};Ce=!0,r(Ze,["mousemove","vmousemove","tapdrag"],M,{x:Se[0],y:Se[1]});var Ta=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ge.emit({originalEvent:M,type:"boxstart",position:{x:Se[0],y:Se[1]}}),ht[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Mt){var Xr={originalEvent:M,type:"cxtdrag",position:{x:Se[0],y:Se[1]}};We?We.emit(Xr):ge.emit(Xr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ze!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:Se[0],y:Se[1]}}),t.hoverData.cxtOver=Ze,Ze&&Ze.emit({originalEvent:M,type:"cxtdragover",position:{x:Se[0],y:Se[1]}}))}}else if(t.hoverData.dragging){if(Ce=!0,ge.panningEnabled()&&ge.userPanningEnabled()){var Ca;if(t.hoverData.justStartedPan){var ti=t.hoverData.mdownPos;Ca={x:(Se[0]-ti[0])*pe,y:(Se[1]-ti[1])*pe},t.hoverData.justStartedPan=!1}else Ca={x:Qe[0]*pe,y:Qe[1]*pe};ge.panBy(Ca),ge.emit("dragpan"),t.hoverData.dragged=!0}Se=t.projectIntoViewport(M.clientX,M.clientY)}else if(ht[4]==1&&(We==null||We.pannable())){if(Mt){if(!t.hoverData.dragging&&ge.boxSelectionEnabled()&&(yr||!ge.panningEnabled()||!ge.userPanningEnabled()))Ta();else if(!t.hoverData.selecting&&ge.panningEnabled()&&ge.userPanningEnabled()){var qr=n(We,t.hoverData.downs);qr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ht[4]=0,t.data.bgActivePosistion=ea(Pe),t.redrawHint("select",!0),t.redraw())}We&&We.pannable()&&We.active()&&We.unactivate()}}else{if(We&&We.pannable()&&We.active()&&We.unactivate(),(!We||!We.grabbed())&&Ze!=ot&&(ot&&r(ot,["mouseout","tapdragout"],M,{x:Se[0],y:Se[1]}),Ze&&r(Ze,["mouseover","tapdragover"],M,{x:Se[0],y:Se[1]}),t.hoverData.last=Ze),We)if(Mt){if(ge.boxSelectionEnabled()&&yr)We&&We.grabbed()&&(g(wt),We.emit("freeon"),wt.emit("free"),t.dragData.didDrag&&(We.emit("dragfreeon"),wt.emit("dragfree"))),Ta();else if(We&&We.grabbed()&&t.nodeIsDraggable(We)){var Ut=!t.dragData.didDrag;Ut&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||v(wt,{inDragLayer:!0});var Ft={x:0,y:0};if(N(Qe[0])&&N(Qe[1])&&(Ft.x+=Qe[0],Ft.y+=Qe[1],Ut)){var Yt=t.hoverData.dragDelta;Yt&&N(Yt[0])&&N(Yt[1])&&(Ft.x+=Yt[0],Ft.y+=Yt[1])}t.hoverData.draggingEles=!0,wt.silentShift(Ft).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Ir();Ce=!0}if(ht[2]=Se[0],ht[3]=Se[1],Ce)return M.stopPropagation&&M.stopPropagation(),M.preventDefault&&M.preventDefault(),!1}},!1);var S,F,z;t.registerBinding(window,"mouseup",function(M){var he=t.hoverData.capture;if(he){t.hoverData.capture=!1;var Ce=t.cy,ge=t.projectIntoViewport(M.clientX,M.clientY),pe=t.selection,qe=t.findNearestElement(ge[0],ge[1],!0,!1),Se=t.dragData.possibleDragElements,Pe=t.hoverData.down,rt=a(M);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Pe&&Pe.unactivate(),t.hoverData.which===3){var ht={originalEvent:M,type:"cxttapend",position:{x:ge[0],y:ge[1]}};if(Pe?Pe.emit(ht):Ce.emit(ht),!t.hoverData.cxtDragged){var Ze={originalEvent:M,type:"cxttap",position:{x:ge[0],y:ge[1]}};Pe?Pe.emit(Ze):Ce.emit(Ze)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(r(qe,["mouseup","tapend","vmouseup"],M,{x:ge[0],y:ge[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(r(Pe,["click","tap","vclick"],M,{x:ge[0],y:ge[1]}),F=!1,M.timeStamp-z<=Ce.multiClickDebounceTime()?(S&&clearTimeout(S),F=!0,z=null,r(Pe,["dblclick","dbltap","vdblclick"],M,{x:ge[0],y:ge[1]})):(S=setTimeout(function(){F||r(Pe,["oneclick","onetap","voneclick"],M,{x:ge[0],y:ge[1]})},Ce.multiClickDebounceTime()),z=M.timeStamp)),Pe==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(M)&&(Ce.$(e).unselect(["tapunselect"]),Se.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Se=Ce.collection()),qe==Pe&&!t.dragData.didDrag&&!t.hoverData.selecting&&qe!=null&&qe._private.selectable&&(t.hoverData.dragging||(Ce.selectionType()==="additive"||rt?qe.selected()?qe.unselect(["tapunselect"]):qe.select(["tapselect"]):rt||(Ce.$(e).unmerge(qe).unselect(["tapunselect"]),qe.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ot=Ce.collection(t.getAllInBox(pe[0],pe[1],pe[2],pe[3]));t.redrawHint("select",!0),ot.length>0&&t.redrawHint("eles",!0),Ce.emit({type:"boxend",originalEvent:M,position:{x:ge[0],y:ge[1]}});var We=function(Mt){return Mt.selectable()&&!Mt.selected()};Ce.selectionType()==="additive"||rt||Ce.$(e).unmerge(ot).unselect(),ot.emit("box").stdFilter(We).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!pe[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Qe=Pe&&Pe.grabbed();g(Se),Qe&&(Pe.emit("freeon"),Se.emit("free"),t.dragData.didDrag&&(Pe.emit("dragfreeon"),Se.emit("dragfree")))}}pe[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var P=function(M){if(!t.scrollingPage){var he=t.cy,Ce=he.zoom(),ge=he.pan(),pe=t.projectIntoViewport(M.clientX,M.clientY),qe=[pe[0]*Ce+ge.x,pe[1]*Ce+ge.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){M.preventDefault();return}if(he.panningEnabled()&&he.userPanningEnabled()&&he.zoomingEnabled()&&he.userZoomingEnabled()){M.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var Se;M.deltaY!=null?Se=M.deltaY/-250:M.wheelDeltaY!=null?Se=M.wheelDeltaY/1e3:Se=M.wheelDelta/1e3,Se=Se*t.wheelSensitivity;var Pe=M.deltaMode===1;Pe&&(Se*=33);var rt=he.zoom()*Math.pow(10,Se);M.type==="gesturechange"&&(rt=t.gestureStartZoom*M.scale),he.zoom({level:rt,renderedPosition:{x:qe[0],y:qe[1]}}),he.emit(M.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",P,!0),t.registerBinding(window,"scroll",function(M){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(M){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||M.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(De){t.hasTouchStarted||P(De)},!0),t.registerBinding(t.container,"mouseout",function(M){var he=t.projectIntoViewport(M.clientX,M.clientY);t.cy.emit({originalEvent:M,type:"mouseout",position:{x:he[0],y:he[1]}})},!1),t.registerBinding(t.container,"mouseover",function(M){var he=t.projectIntoViewport(M.clientX,M.clientY);t.cy.emit({originalEvent:M,type:"mouseover",position:{x:he[0],y:he[1]}})},!1);var H,G,re,X,K,ie,fe,ve,oe,ce,Ee,xe,ye,de=function(M,he,Ce,ge){return Math.sqrt((Ce-M)*(Ce-M)+(ge-he)*(ge-he))},ae=function(M,he,Ce,ge){return(Ce-M)*(Ce-M)+(ge-he)*(ge-he)},we;t.registerBinding(t.container,"touchstart",we=function(M){if(t.hasTouchStarted=!0,!!k(M)){p(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var he=t.cy,Ce=t.touchData.now,ge=t.touchData.earlier;if(M.touches[0]){var pe=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Ce[0]=pe[0],Ce[1]=pe[1]}if(M.touches[1]){var pe=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Ce[2]=pe[0],Ce[3]=pe[1]}if(M.touches[2]){var pe=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Ce[4]=pe[0],Ce[5]=pe[1]}if(M.touches[1]){t.touchData.singleTouchMoved=!0,g(t.dragData.touchDragEles);var qe=t.findContainerClientCoords();oe=qe[0],ce=qe[1],Ee=qe[2],xe=qe[3],H=M.touches[0].clientX-oe,G=M.touches[0].clientY-ce,re=M.touches[1].clientX-oe,X=M.touches[1].clientY-ce,ye=0<=H&&H<=Ee&&0<=re&&re<=Ee&&0<=G&&G<=xe&&0<=X&&X<=xe;var Se=he.pan(),Pe=he.zoom();K=de(H,G,re,X),ie=ae(H,G,re,X),fe=[(H+re)/2,(G+X)/2],ve=[(fe[0]-Se.x)/Pe,(fe[1]-Se.y)/Pe];var rt=200,ht=rt*rt;if(ie=1){for(var ar=t.touchData.startPosition=[],It=0;It=t.touchTapThreshold2}if(he&&t.touchData.cxt){M.preventDefault();var ar=M.touches[0].clientX-oe,It=M.touches[0].clientY-ce,Wt=M.touches[1].clientX-oe,Vt=M.touches[1].clientY-ce,yr=ae(ar,It,Wt,Vt),Ir=yr/ie,Ta=150,Xr=Ta*Ta,Ca=1.5,ti=Ca*Ca;if(Ir>=ti||yr>=Xr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var qr={originalEvent:M,type:"cxttapend",position:{x:pe[0],y:pe[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(qr),t.touchData.start=null):ge.emit(qr)}}if(he&&t.touchData.cxt){var qr={originalEvent:M,type:"cxtdrag",position:{x:pe[0],y:pe[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(qr):ge.emit(qr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Ut=t.findNearestElement(pe[0],pe[1],!0,!0);(!t.touchData.cxtOver||Ut!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:pe[0],y:pe[1]}}),t.touchData.cxtOver=Ut,Ut&&Ut.emit({originalEvent:M,type:"cxtdragover",position:{x:pe[0],y:pe[1]}}))}else if(he&&M.touches[2]&&ge.boxSelectionEnabled())M.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ge.emit({originalEvent:M,type:"boxstart",position:{x:pe[0],y:pe[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Ce[4]=1,!Ce||Ce.length===0||Ce[0]===void 0?(Ce[0]=(pe[0]+pe[2]+pe[4])/3,Ce[1]=(pe[1]+pe[3]+pe[5])/3,Ce[2]=(pe[0]+pe[2]+pe[4])/3+1,Ce[3]=(pe[1]+pe[3]+pe[5])/3+1):(Ce[2]=(pe[0]+pe[2]+pe[4])/3,Ce[3]=(pe[1]+pe[3]+pe[5])/3),t.redrawHint("select",!0),t.redraw();else if(he&&M.touches[1]&&!t.touchData.didSelect&&ge.zoomingEnabled()&&ge.panningEnabled()&&ge.userZoomingEnabled()&&ge.userPanningEnabled()){M.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ft=t.dragData.touchDragEles;if(Ft){t.redrawHint("drag",!0);for(var Yt=0;Yt0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Ae;t.registerBinding(window,"touchcancel",Ae=function(M){var he=t.touchData.start;t.touchData.capture=!1,he&&he.unactivate()});var Ne,Ue,He,Me;if(t.registerBinding(window,"touchend",Ne=function(M){var he=t.touchData.start,Ce=t.touchData.capture;if(Ce)M.touches.length===0&&(t.touchData.capture=!1),M.preventDefault();else return;var ge=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var pe=t.cy,qe=pe.zoom(),Se=t.touchData.now,Pe=t.touchData.earlier;if(M.touches[0]){var rt=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Se[0]=rt[0],Se[1]=rt[1]}if(M.touches[1]){var rt=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Se[2]=rt[0],Se[3]=rt[1]}if(M.touches[2]){var rt=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Se[4]=rt[0],Se[5]=rt[1]}he&&he.unactivate();var ht;if(t.touchData.cxt){if(ht={originalEvent:M,type:"cxttapend",position:{x:Se[0],y:Se[1]}},he?he.emit(ht):pe.emit(ht),!t.touchData.cxtDragged){var Ze={originalEvent:M,type:"cxttap",position:{x:Se[0],y:Se[1]}};he?he.emit(Ze):pe.emit(Ze)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!M.touches[2]&&pe.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ot=pe.collection(t.getAllInBox(ge[0],ge[1],ge[2],ge[3]));ge[0]=void 0,ge[1]=void 0,ge[2]=void 0,ge[3]=void 0,ge[4]=0,t.redrawHint("select",!0),pe.emit({type:"boxend",originalEvent:M,position:{x:Se[0],y:Se[1]}});var We=function(Xr){return Xr.selectable()&&!Xr.selected()};ot.emit("box").stdFilter(We).select().emit("boxselect"),ot.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(he!=null&&he.unactivate(),M.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!M.touches[1]){if(!M.touches[0]){if(!M.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Qe=t.dragData.touchDragEles;if(he!=null){var wt=he._private.grabbed;g(Qe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),wt&&(he.emit("freeon"),Qe.emit("free"),t.dragData.didDrag&&(he.emit("dragfreeon"),Qe.emit("dragfree"))),r(he,["touchend","tapend","vmouseup","tapdragout"],M,{x:Se[0],y:Se[1]}),he.unactivate(),t.touchData.start=null}else{var Mt=t.findNearestElement(Se[0],Se[1],!0,!0);r(Mt,["touchend","tapend","vmouseup","tapdragout"],M,{x:Se[0],y:Se[1]})}var rr=t.touchData.startPosition[0]-Se[0],ar=rr*rr,It=t.touchData.startPosition[1]-Se[1],Wt=It*It,Vt=ar+Wt,yr=Vt*qe*qe;t.touchData.singleTouchMoved||(he||pe.$(":selected").unselect(["tapunselect"]),r(he,["tap","vclick"],M,{x:Se[0],y:Se[1]}),Ue=!1,M.timeStamp-Me<=pe.multiClickDebounceTime()?(He&&clearTimeout(He),Ue=!0,Me=null,r(he,["dbltap","vdblclick"],M,{x:Se[0],y:Se[1]})):(He=setTimeout(function(){Ue||r(he,["onetap","voneclick"],M,{x:Se[0],y:Se[1]})},pe.multiClickDebounceTime()),Me=M.timeStamp)),he!=null&&!t.dragData.didDrag&&he._private.selectable&&yr0)return oe[0]}return null},v=Object.keys(h),d=0;d0?c:Ns(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var l=Fa(n,i),u=2*l;if(vr(e,r,this.points,s,o,n,i-u,[0,-1],a)||vr(e,r,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(_t(e,r,c)||zr(e,r,u,u,s+n/2-l,o+i/2-l,a)||zr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}},gr.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",zt(3,0)),this.generateRoundPolygon("round-triangle",zt(3,0)),this.generatePolygon("rectangle",zt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",zt(5,0)),this.generateRoundPolygon("round-pentagon",zt(5,0)),this.generatePolygon("hexagon",zt(6,0)),this.generateRoundPolygon("round-hexagon",zt(6,0)),this.generatePolygon("heptagon",zt(7,0)),this.generateRoundPolygon("round-heptagon",zt(7,0)),this.generatePolygon("octagon",zt(8,0)),this.generateRoundPolygon("round-octagon",zt(8,0));var a=new Array(20);{var n=gi(5,0),i=gi(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*x)break}else if(u){if(m>=e.deqCost*v||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*_i)break;var I=e.deq(a,y,g);if(I.length>0)for(var O=0;O0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,y,g)&&i())},o=e.priority||ui;n.beforeRender(s,o(a))}}}},Lg=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pn;W(this,t),this.idsByKey=new or,this.keyForId=new or,this.cachesByLvl=new or,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return L(t,[{key:"getIdsFor",value:function(r){r==null&&bt("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new jr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new or,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),t}(),Tu=25,Jn=50,jn=-4,Ui=3,Ag=7.99,Og=8,Ng=1024,Mg=1024,Ig=1024,Rg=.2,kg=.8,Pg=10,Bg=.15,Fg=.1,zg=.9,Gg=.9,Vg=100,$g=1,Ea={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},_g=St({getKey:null,doesEleInvalidateKey:pn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Es,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ja=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=_g(r);$e(a,n),a.lookup=new Lg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ct=ja.prototype;Ct.reasons=Ea,Ct.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},Ct.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a},Ct.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ra(function(r,a){return a.reqs-r.reqs});return e},Ct.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},Ct.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(hi(o*r))),a=Ag||a>Ui)return null;var u=Math.pow(2,a),f=e.h*u,h=e.w*u,c=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,c))return null;var v=l.get(t,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=Tu?d=Tu:f<=Jn?d=Jn:d=Math.ceil(f/Jn)*Jn,f>Ig||h>Mg)return null;var g=i.getTextureQueue(d),y=g[g.length-2],p=function(){return i.recycleTexture(d,h)||i.addTexture(d,h)};y||(y=g[g.length-1]),y||(y=p()),y.width-y.usedWidtha;z--)S=i.getElement(t,e,r,z,Ea.downscale);F()}else return i.queueElement(t,O.level-1),O;else{var P;if(!b&&!x&&!I)for(var H=a-1;H>=jn;H--){var G=l.get(t,H);if(G){P=G;break}}if(m(P))return i.queueElement(t,a),P;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,t,e,c,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:a,scale:u,width:h,height:f,scaledLabelShown:c},y.usedWidth+=Math.ceil(h+Og),y.eleCaches.push(v),l.set(t,a,v),i.checkTextureFullness(y),v},Ct.invalidateElements=function(t){for(var e=0;e=Rg*t.width&&this.retireTexture(t)},Ct.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>kg&&t.fullnessChecks>=Pg?wr(r,t):t.fullnessChecks++},Ct.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;wr(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,li(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),wr(n,s),a.push(s),s}},Ct.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}},Ct.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<$g&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var h=e.getBoundingBox(u);e.getElement(u,h,t,o.level,Ea.dequeue)}return n},Ct.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=oi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))},Ct.onDequeue=function(t){this.onDequeues.push(t)},Ct.offDequeue=function(t){wr(this.onDequeues,t)},Ct.setupDequeueing=xu.setupDequeueing({deqRedrawThreshold:Vg,deqCost:Bg,deqAvgCost:Fg,deqNoDrawCost:zg,deqFastCost:Gg,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a=Yg||r>ei)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),f=l[r]=l[r]||[],h,c=a.levelIsComplete(r,t),v,d=function(){var F=function(re){if(a.validateLayersElesOrdering(re,t),a.levelIsComplete(re,t))return v=l[re],!0},z=function(re){if(!v)for(var X=r+re;en<=X&&X<=ei&&!F(X);X+=re);};z(1),z(-1);for(var P=f.length-1;P>=0;P--){var H=f[P];H.invalid&&wr(f,H)}};if(!c)d();else return f;var g=function(){if(!h){h=$t();for(var F=0;FJg)return null;var H=a.makeLayer(h,r);if(z!=null){var G=f.indexOf(z)+1;f.splice(G,0,H)}else(F.insert===void 0||F.insert)&&f.unshift(H);return H};if(a.skipping&&!o)return null;for(var p=null,m=t.length/Ug,b=!o,x=0;x=m||!Os(p.bb,I.boundingBox()))&&(p=y({insert:!0,after:p}),!p))return null;v||b?a.queueLayer(p,I):a.drawEleInLayer(p,I,r,e),p.eles.push(I),T[r]=p}return v||(b?null:f)},Nt.getEleLevelForLayerLevel=function(t,e){return t},Nt.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,jg),i.setImgSmoothing(s,!0))},Nt.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||s.invalid)return!1;n+=s.eles.length}return n===e.length},Nt.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a0){e=!0;break}}return e},Nt.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=cr(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))},Nt.invalidateLayer=function(t){if(this.lastInvalidationTime=cr(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];wr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=u*f,y=u*f,p=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;h==="straight-triangle"?(s.eleStrokeStyle(t,e,P),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=d,s.eleStrokeStyle(t,e,P),s.drawEdgePath(e,t,o.allpts,c),t.lineCap="butt")},m=function(){n&&s.drawEdgeOverlay(t,e)},b=function(){n&&s.drawEdgeUnderlay(t,e)},x=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;s.drawArrowheads(t,e,P)},I=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var O=e.pstyle("ghost").value==="yes";if(O){var T=e.pstyle("ghost-offset-x").pfValue,k=e.pstyle("ghost-offset-y").pfValue,S=e.pstyle("ghost-opacity").value,F=g*S;t.translate(T,k),p(F),x(F),t.translate(-T,-k)}b(),p(),x(),m(),I(),r&&t.translate(l.x1,l.y1)}};var Nu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};pr.drawEdgeOverlay=Nu("overlay"),pr.drawEdgeUnderlay=Nu("underlay"),pr.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(s.drawText(t,e,null,v,i),e.isEdge()&&(s.drawText(t,e,"source",v,i),s.drawText(t,e,"target",v,i))):s.drawText(t,e,n,v,i),r&&t.translate(d.x1,d.y1)},Ur.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],l)};function fp(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),t.fill()}Ur.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=jt(n,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r},Ur.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=jt(s,"labelX",r),u=jt(s,"labelY",r),f,h,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var v=r?r+"-":"",d=jt(s,"labelWidth",r),g=jt(s,"labelHeight",r),y=e.pstyle(v+"text-margin-x").pfValue,p=e.pstyle(v+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;m&&(b="center",x="center"),l+=y,u+=p;var I;switch(a?I=this.getTextAngle(e,r):I=0,I!==0&&(f=l,h=u,t.translate(f,h),t.rotate(I),l=0,u=0),x){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var O=e.pstyle("text-background-opacity").value,T=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue;if(O>0||k>0&&T>0){var F=l-S;switch(b){case"left":F-=d;break;case"center":F-=d/2;break}var z=u-g-S,P=d+2*S,H=g+2*S;if(O>0){var G=t.fillStyle,re=e.pstyle("text-background-color").value;t.fillStyle="rgba("+re[0]+","+re[1]+","+re[2]+","+O*o+")";var X=e.pstyle("text-background-shape").strValue;X.indexOf("round")===0?fp(t,F,z,P,H,2):t.fillRect(F,z,P,H),t.fillStyle=G}if(k>0&&T>0){var K=t.strokeStyle,ie=t.lineWidth,fe=e.pstyle("text-border-color").value,ve=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+fe[0]+","+fe[1]+","+fe[2]+","+T*o+")",t.lineWidth=k,t.setLineDash)switch(ve){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=k/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(t.strokeRect(F,z,P,H),ve==="double"){var oe=k/2;t.strokeRect(F+oe,z+oe,P-oe*2,H-oe*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=ie,t.strokeStyle=K}}var ce=2*e.pstyle("text-outline-width").pfValue;if(ce>0&&(t.lineWidth=ce),e.pstyle("text-wrap").value==="wrap"){var Ee=jt(s,"labelWrapCachedLines",r),xe=jt(s,"labelLineHeight",r),ye=d/2,de=this.getLabelJustification(e);switch(de==="auto"||(b==="left"?de==="left"?l+=-d:de==="center"&&(l+=-ye):b==="center"?de==="left"?l+=-ye:de==="right"&&(l+=ye):b==="right"&&(de==="center"?l+=ye:de==="right"&&(l+=d))),x){case"top":u-=(Ee.length-1)*xe;break;case"center":case"bottom":u-=(Ee.length-1)*xe;break}for(var ae=0;ae0&&t.strokeText(Ee[ae],l,u),t.fillText(Ee[ae],l,u),u+=xe}else ce>0&&t.strokeText(c,l,u),t.fillText(c,l,u);I!==0&&(t.rotate(-I),t.translate(-f,-h))}}};var wa={};wa.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,f=u.rscratch,h=e.position();if(!(!N(h.x)||!N(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,v=s.usePaths(),d,g=!1,y=e.padding();o=e.width()+2*y,l=e.height()+2*y;var p;r&&(p=r,t.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,x=new Array(b.length),I=new Array(b.length),O=0,T=0;T0&&arguments[0]!==void 0?arguments[0]:H;s.eleFillStyle(t,e,Ie)},ie=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;s.colorStrokeStyle(t,G[0],G[1],G[2],Ie)},fe=e.pstyle("shape").strValue,ve=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(h.x,h.y);var oe=s.nodePathCache=s.nodePathCache||[],ce=ms(fe==="polygon"?fe+","+ve.join(","):fe,""+l,""+o),Ee=oe[ce];Ee!=null?(d=Ee,g=!0,f.pathCache=d):(d=new Path2D,oe[ce]=f.pathCache=d)}var xe=function(){if(!g){var Ie=h;v&&(Ie={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||t,Ie.x,Ie.y,o,l)}v?t.fill(d):t.fill()},ye=function(){for(var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,je=u.backgrounding,Xe=0,_e=0;_e0&&arguments[0]!==void 0?arguments[0]:!1,Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(t,e,Be),Ie&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,h.x,h.y,o,l)))},ae=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,Be=(z>0?z:-z)*Ie,je=z>0?0:255;z!==0&&(s.colorFillStyle(t,je,je,je,Be),v?t.fill(d):t.fill())},we=function(){if(P>0){if(t.lineWidth=P,t.lineCap="butt",t.setLineDash)switch(re){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}if(v?t.stroke(d):t.stroke(),re==="double"){t.lineWidth=P/3;var Ie=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(d):t.stroke(),t.globalCompositeOperation=Ie}t.setLineDash&&t.setLineDash([])}},Te=function(){n&&s.drawNodeOverlay(t,e,h,o,l)},Ae=function(){n&&s.drawNodeUnderlay(t,e,h,o,l)},Ne=function(){s.drawElementText(t,e,null,a)},Ue=e.pstyle("ghost").value==="yes";if(Ue){var He=e.pstyle("ghost-offset-x").pfValue,Me=e.pstyle("ghost-offset-y").pfValue,Oe=e.pstyle("ghost-opacity").value,Ve=Oe*c;t.translate(He,Me),K(Oe*H),xe(),ye(Ve,!0),ie(Oe*X),we(),de(z!==0||P!==0),ye(Ve,!1),ae(Ve),t.translate(-He,-Me)}v&&t.translate(-h.x,-h.y),Ae(),v&&t.translate(h.x,h.y),K(),xe(),ye(c,!0),ie(),we(),de(z!==0||P!==0),ye(c,!1),ae(),v&&t.translate(-h.x,-h.y),Ne(),Te(),r&&t.translate(p.x1,p.y1)}};var Mu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value;if(u>0){if(n=n||a.position(),i==null||s==null){var c=a.padding();i=a.width()+2*c,s=a.height()+2*c}o.colorFillStyle(r,f[0],f[1],f[2],u),o.nodeShapes[h].draw(r,n.x,n.y,i+l*2,s+l*2),r.fill()}}}};wa.drawNodeOverlay=Mu("overlay"),wa.drawNodeUnderlay=Mu("underlay"),wa.hasPie=function(t){return t=t[0],t._private.hasPie},wa.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*r,p=d/100;p+h>1&&(p=1-h);var m=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*p,x=m+b;d===0||h>=1||h+p>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,m,x),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],y),t.fill(),h+=p)}};var Ht={},hp=100;Ht.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},Ht.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;ns.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=n!==void 0?n:b,I=l.pan(),O={x:I.x,y:I.y},T={zoom:b,pan:{x:I.x,y:I.y}},k=s.prevViewport,S=k===void 0||T.zoom!==k.zoom||T.pan.x!==k.pan.x||T.pan.y!==k.pan.y;!S&&!(g&&!d)&&(s.motionBlurPxRatio=1),i&&(O=i),x*=o,O.x*=o,O.y*=o;var F=s.getCachedZSortedEles();function z(Me,Oe,Ve,ke,Ie){var Be=Me.globalCompositeOperation;Me.globalCompositeOperation="destination-out",s.colorFillStyle(Me,255,255,255,s.motionBlurTransparency),Me.fillRect(Oe,Ve,ke,Ie),Me.globalCompositeOperation=Be}function P(Me,Oe){var Ve,ke,Ie,Be;!s.clearingMotionBlur&&(Me===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||Me===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(Ve={x:I.x*v,y:I.y*v},ke=b*v,Ie=s.canvasWidth*v,Be=s.canvasHeight*v):(Ve=O,ke=x,Ie=s.canvasWidth,Be=s.canvasHeight),Me.setTransform(1,0,0,1,0,0),Oe==="motionBlur"?z(Me,0,0,Ie,Be):!e&&(Oe===void 0||Oe)&&Me.clearRect(0,0,Ie,Be),r||(Me.translate(Ve.x,Ve.y),Me.scale(ke,ke)),i&&Me.translate(i.x,i.y),n&&Me.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var H=s.data.bufferContexts[s.TEXTURE_BUFFER];H.setTransform(1,0,0,1,0,0),H.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:H,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var T=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var G=u.contexts[s.NODE],re=s.textureCache.texture,T=s.textureCache.viewport;G.setTransform(1,0,0,1,0,0),c?z(G,0,0,T.width,T.height):G.clearRect(0,0,T.width,T.height);var X=m.core("outside-texture-bg-color").value,K=m.core("outside-texture-bg-opacity").value;s.colorFillStyle(G,X[0],X[1],X[2],K),G.fillRect(0,0,T.width,T.height);var b=l.zoom();P(G,!1),G.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/o,T.height/T.zoom/o),G.drawImage(re,T.mpan.x,T.mpan.y,T.width/T.zoom/o,T.height/T.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var ie=l.extent(),fe=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),ve=s.hideEdgesOnViewport&&fe,oe=[];if(oe[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,oe[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),oe[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,oe[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||a||oe[s.NODE]){var ce=c&&!oe[s.NODE]&&v!==1,G=e||(ce?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),Ee=c&&!ce?"motionBlur":void 0;P(G,Ee),ve?s.drawCachedNodes(G,F.nondrag,o,ie):s.drawLayeredElements(G,F.nondrag,o,ie),s.debug&&s.drawDebugPoints(G,F.nondrag),!r&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||r||oe[s.DRAG])){var ce=c&&!oe[s.DRAG]&&v!==1,G=e||(ce?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);P(G,c&&!ce?"motionBlur":void 0),ve?s.drawCachedNodes(G,F.drag,o,ie):s.drawCachedElements(G,F.drag,o,ie),s.debug&&s.drawDebugPoints(G,F.drag),!r&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!r){var G=e||u.contexts[s.SELECT_BOX];if(P(G),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var b=s.cy.zoom(),xe=m.core("selection-box-border-width").value/b;G.lineWidth=xe,G.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",G.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),xe>0&&(G.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",G.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var b=s.cy.zoom(),ye=u.bgActivePosistion;G.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",G.beginPath(),G.arc(ye.x,ye.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),G.fill()}var de=s.lastRedrawTime;if(s.showFps&&de){de=Math.round(de);var ae=Math.round(1e3/de);G.setTransform(1,0,0,1,0,0),G.fillStyle="rgba(255, 0, 0, 0.75)",G.strokeStyle="rgba(255, 0, 0, 0.75)",G.lineWidth=1,G.fillText("1 frame = "+de+" ms = "+ae+" fps",0,20);var we=60;G.strokeRect(0,30,250,20),G.fillRect(0,30,250*Math.min(ae/we,1),20)}r||(f[s.SELECT_BOX]=!1)}if(c&&v!==1){var Te=u.contexts[s.NODE],Ae=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Ne=u.contexts[s.DRAG],Ue=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],He=function(Oe,Ve,ke){Oe.setTransform(1,0,0,1,0,0),ke||!p?Oe.clearRect(0,0,s.canvasWidth,s.canvasHeight):z(Oe,0,0,s.canvasWidth,s.canvasHeight);var Ie=v;Oe.drawImage(Ve,0,0,s.canvasWidth*Ie,s.canvasHeight*Ie,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||oe[s.NODE])&&(He(Te,Ae,oe[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||oe[s.DRAG])&&(He(Ne,Ue,oe[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=T,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},hp)),e||l.emit("render")};var Mr={};Mr.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var l=1;l0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)v.translate(-a.x1*u,-a.y1*u),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(a.x1*u,a.y1*u);else{var g=e.pan(),y={x:g.x*u,y:g.y*u};u*=e.zoom(),v.translate(y.x,y.y),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(-y.x,-y.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return c};function cp(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i{(function(W,_){typeof on=="object"&&typeof ji=="object"?ji.exports=_():typeof define=="function"&&define.amd?define([],_):typeof on=="object"?on.layoutBase=_():W.layoutBase=_()})(on,function(){return function(q){var W={};function _(L){if(W[L])return W[L].exports;var E=W[L]={i:L,l:!1,exports:{}};return q[L].call(E.exports,E,E.exports,_),E.l=!0,E.exports}return _.m=q,_.c=W,_.i=function(L){return L},_.d=function(L,E,w){_.o(L,E)||Object.defineProperty(L,E,{configurable:!1,enumerable:!0,get:w})},_.n=function(L){var E=L&&L.__esModule?function(){return L.default}:function(){return L};return _.d(E,"a",E),E},_.o=function(L,E){return Object.prototype.hasOwnProperty.call(L,E)},_.p="",_(_.s=26)}([function(q,W,_){"use strict";function L(){}L.QUALITY=1,L.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,L.DEFAULT_INCREMENTAL=!1,L.DEFAULT_ANIMATION_ON_LAYOUT=!0,L.DEFAULT_ANIMATION_DURING_LAYOUT=!1,L.DEFAULT_ANIMATION_PERIOD=50,L.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,L.DEFAULT_GRAPH_MARGIN=15,L.NODE_DIMENSIONS_INCLUDE_LABELS=!1,L.SIMPLE_NODE_SIZE=40,L.SIMPLE_NODE_HALF_SIZE=L.SIMPLE_NODE_SIZE/2,L.EMPTY_COMPOUND_NODE_SIZE=40,L.MIN_EDGE_LENGTH=1,L.WORLD_BOUNDARY=1e6,L.INITIAL_WORLD_BOUNDARY=L.WORLD_BOUNDARY/1e3,L.WORLD_CENTER_X=1200,L.WORLD_CENTER_Y=900,q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(8),w=_(9);function A(U,R,J){L.call(this,J),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=J,this.bendpoints=[],this.source=U,this.target=R}A.prototype=Object.create(L.prototype);for(var V in L)A[V]=L[V];A.prototype.getSource=function(){return this.source},A.prototype.getTarget=function(){return this.target},A.prototype.isInterGraph=function(){return this.isInterGraph},A.prototype.getLength=function(){return this.length},A.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},A.prototype.getBendpoints=function(){return this.bendpoints},A.prototype.getLca=function(){return this.lca},A.prototype.getSourceInLca=function(){return this.sourceInLca},A.prototype.getTargetInLca=function(){return this.targetInLca},A.prototype.getOtherEnd=function(U){if(this.source===U)return this.target;if(this.target===U)return this.source;throw"Node is not incident with this edge"},A.prototype.getOtherEndInGraph=function(U,R){for(var J=this.getOtherEnd(U),D=R.getGraphManager().getRoot();;){if(J.getOwner()==R)return J;if(J.getOwner()==D)break;J=J.getOwner().getParent()}return null},A.prototype.updateLength=function(){var U=new Array(4);this.isOverlapingSourceAndTarget=E.getIntersection(this.target.getRect(),this.source.getRect(),U),this.isOverlapingSourceAndTarget||(this.lengthX=U[0]-U[2],this.lengthY=U[1]-U[3],Math.abs(this.lengthX)<1&&(this.lengthX=w.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=w.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},A.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=w.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=w.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},q.exports=A},function(q,W,_){"use strict";function L(E){this.vGraphObject=E}q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(10),w=_(13),A=_(0),V=_(16),U=_(4);function R(D,$,Y,j){Y==null&&j==null&&(j=$),L.call(this,j),D.graphManager!=null&&(D=D.graphManager),this.estimatedSize=E.MIN_VALUE,this.inclusionTreeDepth=E.MAX_VALUE,this.vGraphObject=j,this.edges=[],this.graphManager=D,Y!=null&&$!=null?this.rect=new w($.x,$.y,Y.width,Y.height):this.rect=new w}R.prototype=Object.create(L.prototype);for(var J in L)R[J]=L[J];R.prototype.getEdges=function(){return this.edges},R.prototype.getChild=function(){return this.child},R.prototype.getOwner=function(){return this.owner},R.prototype.getWidth=function(){return this.rect.width},R.prototype.setWidth=function(D){this.rect.width=D},R.prototype.getHeight=function(){return this.rect.height},R.prototype.setHeight=function(D){this.rect.height=D},R.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},R.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},R.prototype.getCenter=function(){return new U(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},R.prototype.getLocation=function(){return new U(this.rect.x,this.rect.y)},R.prototype.getRect=function(){return this.rect},R.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},R.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},R.prototype.setRect=function(D,$){this.rect.x=D.x,this.rect.y=D.y,this.rect.width=$.width,this.rect.height=$.height},R.prototype.setCenter=function(D,$){this.rect.x=D-this.rect.width/2,this.rect.y=$-this.rect.height/2},R.prototype.setLocation=function(D,$){this.rect.x=D,this.rect.y=$},R.prototype.moveBy=function(D,$){this.rect.x+=D,this.rect.y+=$},R.prototype.getEdgeListToNode=function(D){var $=[],Y,j=this;return j.edges.forEach(function(te){if(te.target==D){if(te.source!=j)throw"Incorrect edge source!";$.push(te)}}),$},R.prototype.getEdgesBetween=function(D){var $=[],Y,j=this;return j.edges.forEach(function(te){if(!(te.source==j||te.target==j))throw"Incorrect edge source and/or target";(te.target==D||te.source==D)&&$.push(te)}),$},R.prototype.getNeighborsList=function(){var D=new Set,$=this;return $.edges.forEach(function(Y){if(Y.source==$)D.add(Y.target);else{if(Y.target!=$)throw"Incorrect incidency!";D.add(Y.source)}}),D},R.prototype.withChildren=function(){var D=new Set,$,Y;if(D.add(this),this.child!=null)for(var j=this.child.getNodes(),te=0;te$&&(this.rect.x-=(this.labelWidth-$)/2,this.setWidth(this.labelWidth)),this.labelHeight>Y&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-Y)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-Y),this.setHeight(this.labelHeight))}}},R.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==E.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},R.prototype.transform=function(D){var $=this.rect.x;$>A.WORLD_BOUNDARY?$=A.WORLD_BOUNDARY:$<-A.WORLD_BOUNDARY&&($=-A.WORLD_BOUNDARY);var Y=this.rect.y;Y>A.WORLD_BOUNDARY?Y=A.WORLD_BOUNDARY:Y<-A.WORLD_BOUNDARY&&(Y=-A.WORLD_BOUNDARY);var j=new U($,Y),te=D.inverseTransformPoint(j);this.setLocation(te.x,te.y)},R.prototype.getLeft=function(){return this.rect.x},R.prototype.getRight=function(){return this.rect.x+this.rect.width},R.prototype.getTop=function(){return this.rect.y},R.prototype.getBottom=function(){return this.rect.y+this.rect.height},R.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},q.exports=R},function(q,W,_){"use strict";function L(E,w){E==null&&w==null?(this.x=0,this.y=0):(this.x=E,this.y=w)}L.prototype.getX=function(){return this.x},L.prototype.getY=function(){return this.y},L.prototype.setX=function(E){this.x=E},L.prototype.setY=function(E){this.y=E},L.prototype.getDifference=function(E){return new DimensionD(this.x-E.x,this.y-E.y)},L.prototype.getCopy=function(){return new L(this.x,this.y)},L.prototype.translate=function(E){return this.x+=E.width,this.y+=E.height,this},q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(10),w=_(0),A=_(6),V=_(3),U=_(1),R=_(13),J=_(12),D=_(11);function $(j,te,le){L.call(this,le),this.estimatedSize=E.MIN_VALUE,this.margin=w.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=j,te!=null&&te instanceof A?this.graphManager=te:te!=null&&te instanceof Layout&&(this.graphManager=te.graphManager)}$.prototype=Object.create(L.prototype);for(var Y in L)$[Y]=L[Y];$.prototype.getNodes=function(){return this.nodes},$.prototype.getEdges=function(){return this.edges},$.prototype.getGraphManager=function(){return this.graphManager},$.prototype.getParent=function(){return this.parent},$.prototype.getLeft=function(){return this.left},$.prototype.getRight=function(){return this.right},$.prototype.getTop=function(){return this.top},$.prototype.getBottom=function(){return this.bottom},$.prototype.isConnected=function(){return this.isConnected},$.prototype.add=function(j,te,le){if(te==null&&le==null){var Q=j;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(Q)>-1)throw"Node already in graph!";return Q.owner=this,this.getNodes().push(Q),Q}else{var ee=j;if(!(this.getNodes().indexOf(te)>-1&&this.getNodes().indexOf(le)>-1))throw"Source or target not in graph!";if(!(te.owner==le.owner&&te.owner==this))throw"Both owners must be this graph!";return te.owner!=le.owner?null:(ee.source=te,ee.target=le,ee.isInterGraph=!1,this.getEdges().push(ee),te.edges.push(ee),le!=te&&le.edges.push(ee),ee)}},$.prototype.remove=function(j){var te=j;if(j instanceof V){if(te==null)throw"Node is null!";if(!(te.owner!=null&&te.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var le=te.edges.slice(),Q,ee=le.length,ne=0;ne-1&&B>-1))throw"Source and/or target doesn't know this edge!";Q.source.edges.splice(C,1),Q.target!=Q.source&&Q.target.edges.splice(B,1);var me=Q.source.owner.getEdges().indexOf(Q);if(me==-1)throw"Not in owner's edge list!";Q.source.owner.getEdges().splice(me,1)}},$.prototype.updateLeftTop=function(){for(var j=E.MAX_VALUE,te=E.MAX_VALUE,le,Q,ee,ne=this.getNodes(),me=ne.length,C=0;Cle&&(j=le),te>Q&&(te=Q)}return j==E.MAX_VALUE?null:(ne[0].getParent().paddingLeft!=null?ee=ne[0].getParent().paddingLeft:ee=this.margin,this.left=te-ee,this.top=j-ee,new J(this.left,this.top))},$.prototype.updateBounds=function(j){for(var te=E.MAX_VALUE,le=-E.MAX_VALUE,Q=E.MAX_VALUE,ee=-E.MAX_VALUE,ne,me,C,B,N,Z=this.nodes,ue=Z.length,se=0;sene&&(te=ne),leC&&(Q=C),eene&&(te=ne),leC&&(Q=C),ee=this.nodes.length){var ue=0;le.forEach(function(se){se.owner==j&&ue++}),ue==this.nodes.length&&(this.isConnected=!0)}},q.exports=$},function(q,W,_){"use strict";var L,E=_(1);function w(A){L=_(5),this.layout=A,this.graphs=[],this.edges=[]}w.prototype.addRoot=function(){var A=this.layout.newGraph(),V=this.layout.newNode(null),U=this.add(A,V);return this.setRootGraph(U),this.rootGraph},w.prototype.add=function(A,V,U,R,J){if(U==null&&R==null&&J==null){if(A==null)throw"Graph is null!";if(V==null)throw"Parent node is null!";if(this.graphs.indexOf(A)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(A),A.parent!=null)throw"Already has a parent!";if(V.child!=null)throw"Already has a child!";return A.parent=V,V.child=A,A}else{J=U,R=V,U=A;var D=R.getOwner(),$=J.getOwner();if(!(D!=null&&D.getGraphManager()==this))throw"Source not in this graph mgr!";if(!($!=null&&$.getGraphManager()==this))throw"Target not in this graph mgr!";if(D==$)return U.isInterGraph=!1,D.add(U,R,J);if(U.isInterGraph=!0,U.source=R,U.target=J,this.edges.indexOf(U)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(U),!(U.source!=null&&U.target!=null))throw"Edge source and/or target is null!";if(!(U.source.edges.indexOf(U)==-1&&U.target.edges.indexOf(U)==-1))throw"Edge already in source and/or target incidency list!";return U.source.edges.push(U),U.target.edges.push(U),U}},w.prototype.remove=function(A){if(A instanceof L){var V=A;if(V.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(V==this.rootGraph||V.parent!=null&&V.parent.graphManager==this))throw"Invalid parent node!";var U=[];U=U.concat(V.getEdges());for(var R,J=U.length,D=0;D=A.getRight()?V[0]+=Math.min(A.getX()-w.getX(),w.getRight()-A.getRight()):A.getX()<=w.getX()&&A.getRight()>=w.getRight()&&(V[0]+=Math.min(w.getX()-A.getX(),A.getRight()-w.getRight())),w.getY()<=A.getY()&&w.getBottom()>=A.getBottom()?V[1]+=Math.min(A.getY()-w.getY(),w.getBottom()-A.getBottom()):A.getY()<=w.getY()&&A.getBottom()>=w.getBottom()&&(V[1]+=Math.min(w.getY()-A.getY(),A.getBottom()-w.getBottom()));var J=Math.abs((A.getCenterY()-w.getCenterY())/(A.getCenterX()-w.getCenterX()));A.getCenterY()===w.getCenterY()&&A.getCenterX()===w.getCenterX()&&(J=1);var D=J*V[0],$=V[1]/J;V[0]<$?$=V[0]:D=V[1],V[0]=-1*R[0]*($/2+U),V[1]=-1*R[1]*(D/2+U)},E.decideDirectionsForOverlappingNodes=function(w,A,V){w.getCenterX()D)return V[0]=U,V[1]=Y,V[2]=J,V[3]=Z,!1;if(RJ)return V[0]=$,V[1]=R,V[2]=B,V[3]=D,!1;if(UJ?(V[0]=te,V[1]=le,be=!0):(V[0]=j,V[1]=Y,be=!0):et===Ye&&(U>J?(V[0]=$,V[1]=Y,be=!0):(V[0]=Q,V[1]=le,be=!0)),-ct===Ye?J>U?(V[2]=N,V[3]=Z,Ge=!0):(V[2]=B,V[3]=C,Ge=!0):ct===Ye&&(J>U?(V[2]=me,V[3]=C,Ge=!0):(V[2]=ue,V[3]=Z,Ge=!0)),be&&Ge)return!1;if(U>J?R>D?(Fe=this.getCardinalDirection(et,Ye,4),ze=this.getCardinalDirection(ct,Ye,2)):(Fe=this.getCardinalDirection(-et,Ye,3),ze=this.getCardinalDirection(-ct,Ye,1)):R>D?(Fe=this.getCardinalDirection(-et,Ye,1),ze=this.getCardinalDirection(-ct,Ye,3)):(Fe=this.getCardinalDirection(et,Ye,2),ze=this.getCardinalDirection(ct,Ye,4)),!be)switch(Fe){case 1:at=Y,Je=U+-ne/Ye,V[0]=Je,V[1]=at;break;case 2:Je=Q,at=R+ee*Ye,V[0]=Je,V[1]=at;break;case 3:at=le,Je=U+ne/Ye,V[0]=Je,V[1]=at;break;case 4:Je=te,at=R+-ee*Ye,V[0]=Je,V[1]=at;break}if(!Ge)switch(ze){case 1:tt=C,ut=J+-Le/Ye,V[2]=ut,V[3]=tt;break;case 2:ut=ue,tt=D+se*Ye,V[2]=ut,V[3]=tt;break;case 3:tt=Z,ut=J+Le/Ye,V[2]=ut,V[3]=tt;break;case 4:ut=N,tt=D+-se*Ye,V[2]=ut,V[3]=tt;break}}return!1},E.getCardinalDirection=function(w,A,V){return w>A?V:1+V%4},E.getIntersection=function(w,A,V,U){if(U==null)return this.getIntersection2(w,A,V);var R=w.x,J=w.y,D=A.x,$=A.y,Y=V.x,j=V.y,te=U.x,le=U.y,Q=void 0,ee=void 0,ne=void 0,me=void 0,C=void 0,B=void 0,N=void 0,Z=void 0,ue=void 0;return ne=$-J,C=R-D,N=D*J-R*$,me=le-j,B=Y-te,Z=te*j-Y*le,ue=ne*B-me*C,ue===0?null:(Q=(C*Z-B*N)/ue,ee=(me*N-ne*Z)/ue,new L(Q,ee))},E.angleOfVector=function(w,A,V,U){var R=void 0;return w!==V?(R=Math.atan((U-A)/(V-w)),V0?1:E<0?-1:0},L.floor=function(E){return E<0?Math.ceil(E):Math.floor(E)},L.ceil=function(E){return E<0?Math.floor(E):Math.ceil(E)},q.exports=L},function(q,W,_){"use strict";function L(){}L.MAX_VALUE=2147483647,L.MIN_VALUE=-2147483648,q.exports=L},function(q,W,_){"use strict";var L=function(){function R(J,D){for(var $=0;$0&&j;){for(ne.push(C[0]);ne.length>0&&j;){var B=ne[0];ne.splice(0,1),ee.add(B);for(var N=B.getEdges(),Q=0;Q-1&&C.splice(Le,1)}ee=new Set,me=new Map}}return Y},$.prototype.createDummyNodesForBendpoints=function(Y){for(var j=[],te=Y.source,le=this.graphManager.calcLowestCommonAncestor(Y.source,Y.target),Q=0;Q0){for(var le=this.edgeToDummyNodes.get(te),Q=0;Q=0&&j.splice(Z,1);var ue=me.getNeighborsList();ue.forEach(function(be){if(te.indexOf(be)<0){var Ge=le.get(be),et=Ge-1;et==1&&B.push(be),le.set(be,et)}})}te=te.concat(B),(j.length==1||j.length==2)&&(Q=!0,ee=j[0])}return ee},$.prototype.setGraphManager=function(Y){this.graphManager=Y},q.exports=$},function(q,W,_){"use strict";function L(){}L.seed=1,L.x=0,L.nextDouble=function(){return L.x=Math.sin(L.seed++)*1e4,L.x-Math.floor(L.x)},q.exports=L},function(q,W,_){"use strict";var L=_(4);function E(w,A){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}E.prototype.getWorldOrgX=function(){return this.lworldOrgX},E.prototype.setWorldOrgX=function(w){this.lworldOrgX=w},E.prototype.getWorldOrgY=function(){return this.lworldOrgY},E.prototype.setWorldOrgY=function(w){this.lworldOrgY=w},E.prototype.getWorldExtX=function(){return this.lworldExtX},E.prototype.setWorldExtX=function(w){this.lworldExtX=w},E.prototype.getWorldExtY=function(){return this.lworldExtY},E.prototype.setWorldExtY=function(w){this.lworldExtY=w},E.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},E.prototype.setDeviceOrgX=function(w){this.ldeviceOrgX=w},E.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},E.prototype.setDeviceOrgY=function(w){this.ldeviceOrgY=w},E.prototype.getDeviceExtX=function(){return this.ldeviceExtX},E.prototype.setDeviceExtX=function(w){this.ldeviceExtX=w},E.prototype.getDeviceExtY=function(){return this.ldeviceExtY},E.prototype.setDeviceExtY=function(w){this.ldeviceExtY=w},E.prototype.transformX=function(w){var A=0,V=this.lworldExtX;return V!=0&&(A=this.ldeviceOrgX+(w-this.lworldOrgX)*this.ldeviceExtX/V),A},E.prototype.transformY=function(w){var A=0,V=this.lworldExtY;return V!=0&&(A=this.ldeviceOrgY+(w-this.lworldOrgY)*this.ldeviceExtY/V),A},E.prototype.inverseTransformX=function(w){var A=0,V=this.ldeviceExtX;return V!=0&&(A=this.lworldOrgX+(w-this.ldeviceOrgX)*this.lworldExtX/V),A},E.prototype.inverseTransformY=function(w){var A=0,V=this.ldeviceExtY;return V!=0&&(A=this.lworldOrgY+(w-this.ldeviceOrgY)*this.lworldExtY/V),A},E.prototype.inverseTransformPoint=function(w){var A=new L(this.inverseTransformX(w.x),this.inverseTransformY(w.y));return A},q.exports=E},function(q,W,_){"use strict";function L(D){if(Array.isArray(D)){for(var $=0,Y=Array(D.length);$w.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*w.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-w.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT_INCREMENTAL):(D>w.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(w.COOLING_ADAPTATION_FACTOR,1-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*(1-w.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},R.prototype.calcSpringForces=function(){for(var D=this.getAllEdges(),$,Y=0;Y0&&arguments[0]!==void 0?arguments[0]:!0,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Y,j,te,le,Q=this.getAllNodes(),ee;if(this.useFRGridVariant)for(this.totalIterations%w.GRID_CALCULATION_CHECK_PERIOD==1&&D&&this.updateGrid(),ee=new Set,Y=0;Yne||ee>ne)&&(D.gravitationForceX=-this.gravityConstant*te,D.gravitationForceY=-this.gravityConstant*le)):(ne=$.getEstimatedSize()*this.compoundGravityRangeFactor,(Q>ne||ee>ne)&&(D.gravitationForceX=-this.gravityConstant*te*this.compoundGravityConstant,D.gravitationForceY=-this.gravityConstant*le*this.compoundGravityConstant))},R.prototype.isConverged=function(){var D,$=!1;return this.totalIterations>this.maxIterations/3&&($=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),D=this.totalDisplacement=Q.length||ne>=Q[0].length)){for(var me=0;meR}}]),V}();q.exports=A},function(q,W,_){"use strict";var L=function(){function A(V,U){for(var R=0;R2&&arguments[2]!==void 0?arguments[2]:1,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,D=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;E(this,A),this.sequence1=V,this.sequence2=U,this.match_score=R,this.mismatch_penalty=J,this.gap_penalty=D,this.iMax=V.length+1,this.jMax=U.length+1,this.grid=new Array(this.iMax);for(var $=0;$=0;V--){var U=this.listeners[V];U.event===w&&U.callback===A&&this.listeners.splice(V,1)}},E.emit=function(w,A){for(var V=0;V{(function(W,_){typeof un=="object"&&typeof ts=="object"?ts.exports=_(es()):typeof define=="function"&&define.amd?define(["layout-base"],_):typeof un=="object"?un.coseBase=_(es()):W.coseBase=_(W.layoutBase)})(un,function(q){return function(W){var _={};function L(E){if(_[E])return _[E].exports;var w=_[E]={i:E,l:!1,exports:{}};return W[E].call(w.exports,w,w.exports,L),w.l=!0,w.exports}return L.m=W,L.c=_,L.i=function(E){return E},L.d=function(E,w,A){L.o(E,w)||Object.defineProperty(E,w,{configurable:!1,enumerable:!0,get:A})},L.n=function(E){var w=E&&E.__esModule?function(){return E.default}:function(){return E};return L.d(w,"a",w),w},L.o=function(E,w){return Object.prototype.hasOwnProperty.call(E,w)},L.p="",L(L.s=7)}([function(W,_){W.exports=q},function(W,_,L){"use strict";var E=L(0).FDLayoutConstants;function w(){}for(var A in E)w[A]=E[A];w.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,w.DEFAULT_RADIAL_SEPARATION=E.DEFAULT_EDGE_LENGTH,w.DEFAULT_COMPONENT_SEPERATION=60,w.TILE=!0,w.TILING_PADDING_VERTICAL=10,w.TILING_PADDING_HORIZONTAL=10,w.TREE_REDUCTION_ON_INCREMENTAL=!1,W.exports=w},function(W,_,L){"use strict";var E=L(0).FDLayoutEdge;function w(V,U,R){E.call(this,V,U,R)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).LGraph;function w(V,U,R){E.call(this,V,U,R)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).LGraphManager;function w(V){E.call(this,V)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).FDLayoutNode,w=L(0).IMath;function A(U,R,J,D){E.call(this,U,R,J,D)}A.prototype=Object.create(E.prototype);for(var V in E)A[V]=E[V];A.prototype.move=function(){var U=this.graphManager.getLayout();this.displacementX=U.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=U.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>U.coolingFactor*U.maxNodeDisplacement&&(this.displacementX=U.coolingFactor*U.maxNodeDisplacement*w.sign(this.displacementX)),Math.abs(this.displacementY)>U.coolingFactor*U.maxNodeDisplacement&&(this.displacementY=U.coolingFactor*U.maxNodeDisplacement*w.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),U.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(U,R){for(var J=this.getChild().getNodes(),D,$=0;$0)this.positionNodesRadially(C);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var B=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(Z){return B.has(Z)});this.graphManager.setAllNodesToApplyGravitation(N),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},ne.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%J.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var C=new Set(this.getAllNodes()),B=this.nodesWithGravity.filter(function(ue){return C.has(ue)});this.graphManager.setAllNodesToApplyGravitation(B),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=J.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=J.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var N=!this.isTreeGrowing&&!this.isGrowthFinished,Z=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(N,Z),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},ne.prototype.getPositionsData=function(){for(var C=this.graphManager.getAllNodes(),B={},N=0;N1){var be;for(be=0;beZ&&(Z=Math.floor(Le.y)),se=Math.floor(Le.x+R.DEFAULT_COMPONENT_SEPERATION)}this.transform(new Y(D.WORLD_CENTER_X-Le.x/2,D.WORLD_CENTER_Y-Le.y/2))},ne.radialLayout=function(C,B,N){var Z=Math.max(this.maxDiagonalInTree(C),R.DEFAULT_RADIAL_SEPARATION);ne.branchRadialLayout(B,null,0,359,0,Z);var ue=Q.calculateBounds(C),se=new ee;se.setDeviceOrgX(ue.getMinX()),se.setDeviceOrgY(ue.getMinY()),se.setWorldOrgX(N.x),se.setWorldOrgY(N.y);for(var Le=0;Le1;){var Tt=tt[0];tt.splice(0,1);var mt=Fe.indexOf(Tt);mt>=0&&Fe.splice(mt,1),at--,ze--}B!=null?ut=(Fe.indexOf(tt[0])+1)%at:ut=0;for(var xt=Math.abs(Z-N)/ze,Ke=ut;Je!=ze;Ke=++Ke%at){var mr=Fe[Ke].getOtherEnd(C);if(mr!=B){var Zt=(N+Je*xt)%360,br=(Zt+xt)%360;ne.branchRadialLayout(mr,C,Zt,br,ue+se,se),Je++}}},ne.maxDiagonalInTree=function(C){for(var B=te.MIN_VALUE,N=0;NB&&(B=ue)}return B},ne.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},ne.prototype.groupZeroDegreeMembers=function(){var C=this,B={};this.memberGroups={},this.idToDummyNode={};for(var N=[],Z=this.graphManager.getAllNodes(),ue=0;ue1){var et="DummyCompound_"+Ge;C.memberGroups[et]=B[Ge];var ct=B[Ge][0].getParent(),Ye=new V(C.graphManager);Ye.id=et,Ye.paddingLeft=ct.paddingLeft||0,Ye.paddingRight=ct.paddingRight||0,Ye.paddingBottom=ct.paddingBottom||0,Ye.paddingTop=ct.paddingTop||0,C.idToDummyNode[et]=Ye;var Fe=C.getGraphManager().add(C.newGraph(),Ye),ze=ct.getChild();ze.add(Ye);for(var Je=0;Je=0;C--){var B=this.compoundOrder[C],N=B.id,Z=B.paddingLeft,ue=B.paddingTop;this.adjustLocations(this.tiledMemberPack[N],B.rect.x,B.rect.y,Z,ue)}},ne.prototype.repopulateZeroDegreeMembers=function(){var C=this,B=this.tiledZeroDegreePack;Object.keys(B).forEach(function(N){var Z=C.idToDummyNode[N],ue=Z.paddingLeft,se=Z.paddingTop;C.adjustLocations(B[N],Z.rect.x,Z.rect.y,ue,se)})},ne.prototype.getToBeTiled=function(C){var B=C.id;if(this.toBeTiled[B]!=null)return this.toBeTiled[B];var N=C.getChild();if(N==null)return this.toBeTiled[B]=!1,!1;for(var Z=N.getNodes(),ue=0;ue0)return this.toBeTiled[B]=!1,!1;if(se.getChild()==null){this.toBeTiled[se.id]=!1;continue}if(!this.getToBeTiled(se))return this.toBeTiled[B]=!1,!1}return this.toBeTiled[B]=!0,!0},ne.prototype.getNodeDegree=function(C){for(var B=C.id,N=C.getEdges(),Z=0,ue=0;ueGe&&(Ge=ct.rect.height)}N+=Ge+C.verticalPadding}},ne.prototype.tileCompoundMembers=function(C,B){var N=this;this.tiledMemberPack=[],Object.keys(C).forEach(function(Z){var ue=B[Z];N.tiledMemberPack[Z]=N.tileNodes(C[Z],ue.paddingLeft+ue.paddingRight),ue.rect.width=N.tiledMemberPack[Z].width,ue.rect.height=N.tiledMemberPack[Z].height})},ne.prototype.tileNodes=function(C,B){var N=R.TILING_PADDING_VERTICAL,Z=R.TILING_PADDING_HORIZONTAL,ue={rows:[],rowWidth:[],rowHeight:[],width:0,height:B,verticalPadding:N,horizontalPadding:Z};C.sort(function(be,Ge){return be.rect.width*be.rect.height>Ge.rect.width*Ge.rect.height?-1:be.rect.width*be.rect.height0&&(Le+=C.horizontalPadding),C.rowWidth[N]=Le,C.width0&&(be+=C.verticalPadding);var Ge=0;be>C.rowHeight[N]&&(Ge=C.rowHeight[N],C.rowHeight[N]=be,Ge=C.rowHeight[N]-Ge),C.height+=Ge,C.rows[N].push(B)},ne.prototype.getShortestRowIndex=function(C){for(var B=-1,N=Number.MAX_VALUE,Z=0;ZN&&(B=Z,N=C.rowWidth[Z]);return B},ne.prototype.canAddHorizontal=function(C,B,N){var Z=this.getShortestRowIndex(C);if(Z<0)return!0;var ue=C.rowWidth[Z];if(ue+C.horizontalPadding+B<=C.width)return!0;var se=0;C.rowHeight[Z]0&&(se=N+C.verticalPadding-C.rowHeight[Z]);var Le;C.width-ue>=B+C.horizontalPadding?Le=(C.height+se)/(ue+B+C.horizontalPadding):Le=(C.height+se)/C.width,se=N+C.verticalPadding;var be;return C.widthse&&B!=N){Z.splice(-1,1),C.rows[N].push(ue),C.rowWidth[B]=C.rowWidth[B]-se,C.rowWidth[N]=C.rowWidth[N]+se,C.width=C.rowWidth[instance.getLongestRowIndex(C)];for(var Le=Number.MIN_VALUE,be=0;beLe&&(Le=Z[be].height);B>0&&(Le+=C.verticalPadding);var Ge=C.rowHeight[B]+C.rowHeight[N];C.rowHeight[B]=Le,C.rowHeight[N]0)for(var ze=ue;ze<=se;ze++)Fe[0]+=this.grid[ze][Le-1].length+this.grid[ze][Le].length-1;if(se0)for(var ze=Le;ze<=be;ze++)Fe[3]+=this.grid[ue-1][ze].length+this.grid[ue][ze].length-1;for(var Je=te.MAX_VALUE,at,ut,tt=0;tt{(function(W,_){typeof ln=="object"&&typeof as=="object"?as.exports=_(rs()):typeof define=="function"&&define.amd?define(["cose-base"],_):typeof ln=="object"?ln.cytoscapeCoseBilkent=_(rs()):W.cytoscapeCoseBilkent=_(W.coseBase)})(ln,function(q){return function(W){var _={};function L(E){if(_[E])return _[E].exports;var w=_[E]={i:E,l:!1,exports:{}};return W[E].call(w.exports,w,w.exports,L),w.l=!0,w.exports}return L.m=W,L.c=_,L.i=function(E){return E},L.d=function(E,w,A){L.o(E,w)||Object.defineProperty(E,w,{configurable:!1,enumerable:!0,get:A})},L.n=function(E){var w=E&&E.__esModule?function(){return E.default}:function(){return E};return L.d(w,"a",w),w},L.o=function(E,w){return Object.prototype.hasOwnProperty.call(E,w)},L.p="",L(L.s=1)}([function(W,_){W.exports=q},function(W,_,L){"use strict";var E=L(0).layoutBase.LayoutConstants,w=L(0).layoutBase.FDLayoutConstants,A=L(0).CoSEConstants,V=L(0).CoSELayout,U=L(0).CoSENode,R=L(0).layoutBase.PointD,J=L(0).layoutBase.DimensionD,D={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function $(le,Q){var ee={};for(var ne in le)ee[ne]=le[ne];for(var ne in Q)ee[ne]=Q[ne];return ee}function Y(le){this.options=$(D,le),j(this.options)}var j=function(Q){Q.nodeRepulsion!=null&&(A.DEFAULT_REPULSION_STRENGTH=w.DEFAULT_REPULSION_STRENGTH=Q.nodeRepulsion),Q.idealEdgeLength!=null&&(A.DEFAULT_EDGE_LENGTH=w.DEFAULT_EDGE_LENGTH=Q.idealEdgeLength),Q.edgeElasticity!=null&&(A.DEFAULT_SPRING_STRENGTH=w.DEFAULT_SPRING_STRENGTH=Q.edgeElasticity),Q.nestingFactor!=null&&(A.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=w.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=Q.nestingFactor),Q.gravity!=null&&(A.DEFAULT_GRAVITY_STRENGTH=w.DEFAULT_GRAVITY_STRENGTH=Q.gravity),Q.numIter!=null&&(A.MAX_ITERATIONS=w.MAX_ITERATIONS=Q.numIter),Q.gravityRange!=null&&(A.DEFAULT_GRAVITY_RANGE_FACTOR=w.DEFAULT_GRAVITY_RANGE_FACTOR=Q.gravityRange),Q.gravityCompound!=null&&(A.DEFAULT_COMPOUND_GRAVITY_STRENGTH=w.DEFAULT_COMPOUND_GRAVITY_STRENGTH=Q.gravityCompound),Q.gravityRangeCompound!=null&&(A.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=w.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=Q.gravityRangeCompound),Q.initialEnergyOnIncremental!=null&&(A.DEFAULT_COOLING_FACTOR_INCREMENTAL=w.DEFAULT_COOLING_FACTOR_INCREMENTAL=Q.initialEnergyOnIncremental),Q.quality=="draft"?E.QUALITY=0:Q.quality=="proof"?E.QUALITY=2:E.QUALITY=1,A.NODE_DIMENSIONS_INCLUDE_LABELS=w.NODE_DIMENSIONS_INCLUDE_LABELS=E.NODE_DIMENSIONS_INCLUDE_LABELS=Q.nodeDimensionsIncludeLabels,A.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=E.DEFAULT_INCREMENTAL=!Q.randomize,A.ANIMATE=w.ANIMATE=E.ANIMATE=Q.animate,A.TILE=Q.tile,A.TILING_PADDING_VERTICAL=typeof Q.tilingPaddingVertical=="function"?Q.tilingPaddingVertical.call():Q.tilingPaddingVertical,A.TILING_PADDING_HORIZONTAL=typeof Q.tilingPaddingHorizontal=="function"?Q.tilingPaddingHorizontal.call():Q.tilingPaddingHorizontal};Y.prototype.run=function(){var le,Q,ee=this.options,ne=this.idToLNode={},me=this.layout=new V,C=this;C.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var B=me.newGraphManager();this.gm=B;var N=this.options.eles.nodes(),Z=this.options.eles.edges();this.root=B.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(N),me);for(var ue=0;ue0){var be;be=ee.getGraphManager().add(ee.newGraph(),N),this.processChildrenList(be,B,ee)}}},Y.prototype.stop=function(){return this.stopped=!0,this};var te=function(Q){Q("layout","cose-bilkent",Y)};typeof cytoscape!="undefined"&&te(cytoscape),W.exports=te}])})});var is=nn(el(),1),rl=nn(tl(),1);var vy=nn(Op(),1),dy=nn(Np(),1),gy=nn(Mp(),1);var ns=function(){var q=function(me,C,B,N){for(B=B||{},N=me.length;N--;B[me[N]]=C);return B},W=[1,4],_=[1,13],L=[1,12],E=[1,15],w=[1,16],A=[1,20],V=[1,19],U=[6,7,8],R=[1,26],J=[1,24],D=[1,25],$=[6,7,11],Y=[1,6,13,15,16,19,22],j=[1,33],te=[1,34],le=[1,6,7,11,13,15,16,19,22],Q={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(C,B,N,Z,ue,se,Le){var be=se.length-1;switch(ue){case 6:case 7:return Z;case 8:Z.getLogger().trace("Stop NL ");break;case 9:Z.getLogger().trace("Stop EOF ");break;case 11:Z.getLogger().trace("Stop NL2 ");break;case 12:Z.getLogger().trace("Stop EOF2 ");break;case 15:Z.getLogger().info("Node: ",se[be].id),Z.addNode(se[be-1].length,se[be].id,se[be].descr,se[be].type);break;case 16:Z.getLogger().trace("Icon: ",se[be]),Z.decorateNode({icon:se[be]});break;case 17:case 21:Z.decorateNode({class:se[be]});break;case 18:Z.getLogger().trace("SPACELIST");break;case 19:Z.getLogger().trace("Node: ",se[be].id),Z.addNode(0,se[be].id,se[be].descr,se[be].type);break;case 20:Z.decorateNode({icon:se[be]});break;case 25:Z.getLogger().trace("node found ..",se[be-2]),this.$={id:se[be-1],descr:se[be-1],type:Z.getType(se[be-2],se[be])};break;case 26:this.$={id:se[be],descr:se[be],type:Z.nodeType.DEFAULT};break;case 27:Z.getLogger().trace("node found ..",se[be-3]),this.$={id:se[be-3],descr:se[be-1],type:Z.getType(se[be-2],se[be])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:W},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:W},{6:_,7:[1,10],9:9,12:11,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},q(U,[2,3]),{1:[2,2]},q(U,[2,4]),q(U,[2,5]),{1:[2,6],6:_,12:21,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},{6:_,9:22,12:11,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},{6:R,7:J,10:23,11:D},q($,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:A,22:V}),q($,[2,18]),q($,[2,19]),q($,[2,20]),q($,[2,21]),q($,[2,23]),q($,[2,24]),q($,[2,26],{19:[1,30]}),{20:[1,31]},{6:R,7:J,10:32,11:D},{1:[2,7],6:_,12:21,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},q(Y,[2,14],{7:j,11:te}),q(le,[2,8]),q(le,[2,9]),q(le,[2,10]),q($,[2,15]),q($,[2,16]),q($,[2,17]),{20:[1,35]},{21:[1,36]},q(Y,[2,13],{7:j,11:te}),q(le,[2,11]),q(le,[2,12]),{21:[1,37]},q($,[2,25]),q($,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(C,B){if(B.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=B,N}},parse:function(C){var B=this,N=[0],Z=[],ue=[null],se=[],Le=this.table,be="",Ge=0,et=0,ct=2,Ye=1,Fe=se.slice.call(arguments,1),ze=Object.create(this.lexer),Je={yy:{}};for(var at in this.yy)Object.prototype.hasOwnProperty.call(this.yy,at)&&(Je.yy[at]=this.yy[at]);ze.setInput(C,Je.yy),Je.yy.lexer=ze,Je.yy.parser=this,typeof ze.yylloc=="undefined"&&(ze.yylloc={});var ut=ze.yylloc;se.push(ut);var tt=ze.options&&ze.options.ranges;typeof Je.yy.parseError=="function"?this.parseError=Je.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Tt(){var Jt;return Jt=Z.pop()||ze.lex()||Ye,typeof Jt!="number"&&(Jt instanceof Array&&(Z=Jt,Jt=Z.pop()),Jt=B.symbols_[Jt]||Jt),Jt}for(var mt,xt,Ke,mr,Zt={},br,Qt,hn,Kr;;){if(xt=N[N.length-1],this.defaultActions[xt]?Ke=this.defaultActions[xt]:((mt===null||typeof mt=="undefined")&&(mt=Tt()),Ke=Le[xt]&&Le[xt][mt]),typeof Ke=="undefined"||!Ke.length||!Ke[0]){var Zr="";Kr=[];for(br in Le[xt])this.terminals_[br]&&br>ct&&Kr.push("'"+this.terminals_[br]+"'");ze.showPosition?Zr="Parse error on line "+(Ge+1)+`: `+ze.showPosition()+` Expecting `+Kr.join(", ")+", got '"+(this.terminals_[mt]||mt)+"'":Zr="Parse error on line "+(Ge+1)+": Unexpected "+(mt==Ye?"end of input":"'"+(this.terminals_[mt]||mt)+"'"),this.parseError(Zr,{text:ze.match,token:this.terminals_[mt]||mt,line:ze.yylineno,loc:ut,expected:Kr})}if(Ke[0]instanceof Array&&Ke.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+mt);switch(Ke[0]){case 1:N.push(mt),ue.push(ze.yytext),se.push(ze.yylloc),N.push(Ke[1]),mt=null,et=ze.yyleng,be=ze.yytext,Ge=ze.yylineno,ut=ze.yylloc;break;case 2:if(Qt=this.productions_[Ke[1]][1],Zt.$=ue[ue.length-Qt],Zt._$={first_line:se[se.length-(Qt||1)].first_line,last_line:se[se.length-1].last_line,first_column:se[se.length-(Qt||1)].first_column,last_column:se[se.length-1].last_column},tt&&(Zt._$.range=[se[se.length-(Qt||1)].range[0],se[se.length-1].range[1]]),mr=this.performAction.apply(Zt,[be,et,Ge,Je.yy,Ke[1],ue,se].concat(Fe)),typeof mr!="undefined")return mr;Qt&&(N=N.slice(0,-1*Qt*2),ue=ue.slice(0,-1*Qt),se=se.slice(0,-1*Qt)),N.push(this.productions_[Ke[1]][0]),ue.push(Zt.$),se.push(Zt._$),hn=Le[N[N.length-2]][N[N.length-1]],N.push(hn);break;case 3:return!0}}return!0}},ee=function(){var me={EOF:1,parseError:function(B,N){if(this.yy.parser)this.yy.parser.parseError(B,N);else throw new Error(B)},setInput:function(C,B){return this.yy=B||this.yy||{},this._input=C,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 C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var B=C.match(/(?:\r\n?|\n).*/g);return B?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},unput:function(C){var B=C.length,N=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-B),this.offset-=B;var Z=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 ue=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===Z.length?this.yylloc.first_column:0)+Z[Z.length-N.length].length-N[0].length:this.yylloc.first_column-B},this.options.ranges&&(this.yylloc.range=[ue[0],ue[0]+this.yyleng-B]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return 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). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(C){this.unput(this.match.slice(C))},pastInput:function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var C=this.pastInput(),B=new Array(C.length+1).join("-");return C+this.upcomingInput()+` `+B+"^"},test_match:function(C,B){var N,Z,ue;if(this.options.backtrack_lexer&&(ue={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&&(ue.yylloc.range=this.yylloc.range.slice(0))),Z=C[0].match(/(?:\r\n?|\n).*/g),Z&&(this.yylineno+=Z.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Z?Z[Z.length-1].length-Z[Z.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,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(C[0].length),this.matched+=C[0],N=this.performAction.call(this,this.yy,this,B,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),N)return N;if(this._backtrack){for(var se in ue)this[se]=ue[se];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,B,N,Z;this._more||(this.yytext="",this.match="");for(var ue=this._currentRules(),se=0;seB[0].length)){if(B=N,Z=se,this.options.backtrack_lexer){if(C=this.test_match(N,ue[se]),C!==!1)return C;if(this._backtrack){B=!1;continue}else return!1}else if(!this.options.flex)break}return B?(C=this.test_match(B,ue[Z]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var B=this.next();return B||this.lex()},begin:function(B){this.conditionStack.push(B)},popState:function(){var B=this.conditionStack.length-1;return B>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(B){return B=this.conditionStack.length-1-Math.abs(B||0),B>=0?this.conditionStack[B]:"INITIAL"},pushState:function(B){this.begin(B)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(B,N,Z,ue){switch(Z){case 0:return B.getLogger().trace("Found comment",N.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:B.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return B.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:B.getLogger().trace("end icon"),this.popState();break;case 10:return B.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return B.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return B.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return B.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:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:B.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return B.getLogger().trace("description:",N.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),B.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),B.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),B.getLogger().trace("node end ...",N.yytext),"NODE_DEND";case 30:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),B.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),B.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 35:return B.getLogger().trace("Long description:",N.yytext),20;case 36:return B.getLogger().trace("Long description:",N.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,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return me}();Q.lexer=ee;function ne(){this.yy={}}return ne.prototype=Q,Q.Parser=ne,new ne}();ns.parser=ns;var Ip=ns,fn=q=>Ju(q,Da()),Kt=[],al=0,ss={},Rp=()=>{Kt=[],al=0,ss={}},kp=function(q){for(let W=Kt.length-1;W>=0;W--)if(Kt[W].levelKt.length>0?Kt[0]:null,Bp=(q,W,_,L)=>{Rr.info("addNode",q,W,_,L);let E=Da(),w={id:al++,nodeId:fn(W),level:q,descr:fn(_),type:L,children:[],width:Da().mindmap.maxNodeWidth};switch(w.type){case dt.ROUNDED_RECT:w.padding=2*E.mindmap.padding;break;case dt.RECT:w.padding=2*E.mindmap.padding;break;case dt.HEXAGON:w.padding=2*E.mindmap.padding;break;default:w.padding=E.mindmap.padding}let A=kp(q);if(A)A.children.push(w),Kt.push(w);else if(Kt.length===0)Kt.push(w);else{let V=new Error('There can be only one root. No parent could be found for ("'+w.descr+'")');throw V.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+'"']},V}},dt={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Fp=(q,W)=>{switch(Rr.debug("In get type",q,W),q){case"[":return dt.RECT;case"(":return W===")"?dt.ROUNDED_RECT:dt.CLOUD;case"((":return dt.CIRCLE;case")":return dt.CLOUD;case"))":return dt.BANG;case"{{":return dt.HEXAGON;default:return dt.DEFAULT}},nl=(q,W)=>{ss[q]=W},zp=q=>{let W=Kt[Kt.length-1];q&&q.icon&&(W.icon=fn(q.icon)),q&&q.class&&(W.class=fn(q.class))},Wr=q=>{switch(q){case dt.DEFAULT:return"no-border";case dt.RECT:return"rect";case dt.ROUNDED_RECT:return"rounded-rect";case dt.CIRCLE:return"circle";case dt.CLOUD:return"cloud";case dt.BANG:return"bang";case dt.HEXAGON:return"hexgon";default:return"no-border"}},il,Gp=q=>{il=q},Vp=()=>Rr,$p=q=>Kt[q],os=q=>ss[q],_p=Object.freeze(Object.defineProperty({__proto__:null,addNode:Bp,clear:Rp,decorateNode:zp,getElementById:os,getLogger:Vp,getMindmap:Pp,getNodeById:$p,getType:Fp,nodeType:dt,get parseError(){return il},sanitizeText:fn,setElementForId:nl,setErrorHandler:Gp,type2Str:Wr},Symbol.toStringTag,{value:"Module"})),sl=12,Up=function(q,W,_){q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 ${W.height-5} v${-W.height+2*5} q0,-5 5,-5 h${W.width-2*5} q5,0 5,5 v${W.height-5} H0 Z`),q.append("line").attr("class","node-line-"+_).attr("x1",0).attr("y1",W.height).attr("x2",W.width).attr("y2",W.height)},Yp=function(q,W){q.append("rect").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("height",W.height).attr("width",W.width)},Hp=function(q,W){let _=W.width,L=W.height,E=.15*_,w=.25*_,A=.35*_,V=.2*_;q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 0 a${E},${E} 0 0,1 ${_*.25},${-1*_*.1} a${A},${A} 1 0,1 ${_*.4},${-1*_*.1} a${w},${w} 1 0,1 ${_*.35},${1*_*.2} a${E},${E} 1 0,1 ${_*.15},${1*L*.35} a${V},${V} 1 0,1 ${-1*_*.15},${1*L*.65} a${w},${E} 1 0,1 ${-1*_*.25},${_*.15} a${A},${A} 1 0,1 ${-1*_*.5},0 a${E},${E} 1 0,1 ${-1*_*.25},${-1*_*.15} a${E},${E} 1 0,1 ${-1*_*.1},${-1*L*.35} a${V},${V} 1 0,1 ${_*.1},${-1*L*.65} H0 V0 Z`)},Xp=function(q,W){let _=W.width,L=W.height,E=.15*_;q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 0 a${E},${E} 1 0,0 ${_*.25},${-1*L*.1} a${E},${E} 1 0,0 ${_*.25},0 a${E},${E} 1 0,0 ${_*.25},0 a${E},${E} 1 0,0 ${_*.25},${1*L*.1} a${E},${E} 1 0,0 ${_*.15},${1*L*.33} a${E*.8},${E*.8} 1 0,0 0,${1*L*.34} a${E},${E} 1 0,0 ${-1*_*.15},${1*L*.33} a${E},${E} 1 0,0 ${-1*_*.25},${L*.15} a${E},${E} 1 0,0 ${-1*_*.25},0 a${E},${E} 1 0,0 ${-1*_*.25},0 a${E},${E} 1 0,0 ${-1*_*.25},${-1*L*.15} a${E},${E} 1 0,0 ${-1*_*.1},${-1*L*.33} a${E*.8},${E*.8} 1 0,0 0,${-1*L*.34} a${E},${E} 1 0,0 ${_*.1},${-1*L*.33} H0 V0 Z`)},qp=function(q,W){q.append("circle").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("r",W.width/2)};function Wp(q,W,_,L,E){return q.insert("polygon",":first-child").attr("points",L.map(function(w){return w.x+","+w.y}).join(" ")).attr("transform","translate("+(E.width-W)/2+", "+_+")")}var Kp=function(q,W){let _=W.height,E=_/4,w=W.width-W.padding+2*E,A=[{x:E,y:0},{x:w-E,y:0},{x:w,y:-_/2},{x:w-E,y:-_},{x:E,y:-_},{x:0,y:-_/2}];Wp(q,w,_,A,W)},Zp=function(q,W){q.append("rect").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("height",W.height).attr("rx",W.padding).attr("ry",W.padding).attr("width",W.width)},Qp=function(q,W,_,L){let E=L.htmlLabels,w=_%(sl-1),A=q.append("g");W.section=w;let V="section-"+w;w<0&&(V+=" section-root"),A.attr("class",(W.class?W.class+" ":"")+"mindmap-node "+V);let U=A.append("g"),R=A.append("g"),J=W.descr.replace(/()/g,` `);Qu(R,J,{useHtmlLabels:E,width:W.width,classes:"mindmap-node-label"}),E||R.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let D=R.node().getBBox(),$=L.fontSize.replace?L.fontSize.replace("px",""):L.fontSize;if(W.height=D.height+$*1.1*.5+W.padding,W.width=D.width+2*W.padding,W.icon)if(W.type===dt.CIRCLE)W.height+=50,W.width+=50,A.append("foreignObject").attr("height","50px").attr("width",W.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+w+" "+W.icon),R.attr("transform","translate("+W.width/2+", "+(W.height/2-1.5*W.padding)+")");else{W.width+=50;let Y=W.height;W.height=Math.max(Y,60);let j=Math.abs(W.height-Y);A.append("foreignObject").attr("width","60px").attr("height",W.height).attr("style","text-align: center;margin-top:"+j/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+w+" "+W.icon),R.attr("transform","translate("+(25+W.width/2)+", "+(j/2+W.padding/2)+")")}else if(E){let Y=(W.width-D.width)/2,j=(W.height-D.height)/2;R.attr("transform","translate("+Y+", "+j+")")}else{let Y=W.width/2,j=W.padding/2;R.attr("transform","translate("+Y+", "+j+")")}switch(W.type){case dt.DEFAULT:Up(U,W,w);break;case dt.ROUNDED_RECT:Zp(U,W);break;case dt.RECT:Yp(U,W);break;case dt.CIRCLE:U.attr("transform","translate("+W.width/2+", "+ +W.height/2+")"),qp(U,W);break;case dt.CLOUD:Hp(U,W);break;case dt.BANG:Xp(U,W);break;case dt.HEXAGON:Kp(U,W);break}return nl(W.id,A),W.height},Jp=function(W,_,L,E,w){let A=w%(sl-1),V=L.x+L.width/2,U=L.y+L.height/2,R=_.x+_.width/2,J=_.y+_.height/2,D=R>V?V+Math.abs(V-R)/2:V-Math.abs(V-R)/2,$=J>U?U+Math.abs(U-J)/2:U-Math.abs(U-J)/2,Y=R>V?Math.abs(V-D)/2+V:-Math.abs(V-D)/2+V,j=J>U?Math.abs(U-$)/2+U:-Math.abs(U-$)/2+U;W.append("path").attr("d",L.direction==="TB"||L.direction==="BT"?`M${V},${U} Q${V},${j} ${D},${$} T${R},${J}`:`M${V},${U} Q${Y},${U} ${D},${$} T${R},${J}`).attr("class","edge section-edge-"+A+" edge-depth-"+E)},jp=function(q){let W=os(q.id),_=q.x||0,L=q.y||0;W.attr("transform","translate("+_+","+L+")")},ol={drawNode:Qp,positionNode:jp,drawEdge:Jp};is.default.use(rl.default);function ul(q,W,_,L){ol.drawNode(q,W,_,L),W.children&&W.children.forEach((E,w)=>{ul(q,E,_<0?w:_,L)})}function ey(q,W){W.edges().map((_,L)=>{let E=_.data();if(_[0]._private.bodyBounds){let w=_[0]._private.rscratch;Rr.trace("Edge: ",L,E),q.insert("path").attr("d",`M ${w.startX},${w.startY} L ${w.midX},${w.midY} L${w.endX},${w.endY} `).attr("class","edge section-edge-"+E.section+" edge-depth-"+E.depth)}})}function ll(q,W,_,L){W.add({group:"nodes",data:{id:q.id,labelText:q.descr,height:q.height,width:q.width,level:L,nodeId:q.id,padding:q.padding,type:q.type},position:{x:q.x,y:q.y}}),q.children&&q.children.forEach(E=>{ll(E,W,_,L+1),W.add({group:"edges",data:{id:`${q.id}_${E.id}`,source:q.id,target:E.id,depth:L,section:E.section}})})}function ty(q,W){return new Promise(_=>{let L=sn("body").append("div").attr("id","cy").attr("style","display:none"),E=(0,is.default)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});L.remove(),ll(q,E,W,0),E.nodes().forEach(function(w){w.layoutDimensions=()=>{let A=w.data();return{w:A.width,h:A.height}}}),E.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),E.ready(w=>{Rr.info("Ready",w),_(E)})})}function ry(q){q.nodes().map((W,_)=>{let L=W.data();L.x=W.position().x,L.y=W.position().y,ol.positionNode(L);let E=os(L.nodeId);Rr.info("Id:",_,"Position: (",W.position().x,", ",W.position().y,")",L),E.attr("transform",`translate(${W.position().x-L.width/2}, ${W.position().y-L.height/2})`),E.attr("attr",`apa-${_})`)})}var ay=async(q,W,_,L)=>{let E=Da();E.htmlLabels=!1,Rr.debug(`Rendering mindmap diagram `+q,L.parser);let w=Da().securityLevel,A;w==="sandbox"&&(A=sn("#i"+W));let U=(w==="sandbox"?sn(A.nodes()[0].contentDocument.body):sn("body")).select("#"+W);U.append("g");let R=L.db.getMindmap(),J=U.append("g");J.attr("class","mindmap-edges");let D=U.append("g");D.attr("class","mindmap-nodes"),ul(D,R,-1,E);let $=await ty(R,E);ey(J,$),ry($),ju(void 0,U,E.mindmap.padding,E.mindmap.useMaxWidth)},ny={draw:ay},iy=q=>{let W="";for(let _=0;_` .edge { stroke-width: 3; } ${iy(q)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${q.git0}; } .section-root text { fill: ${q.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .mindmap-node-label { dy: 1em; alignment-baseline: middle; text-anchor: middle; dominant-baseline: middle; text-align: center; } `,oy=sy,py={db:_p,renderer:ny,parser:Ip,styles:oy};export{py as diagram}; /*! Bundled license information: cytoscape/dist/cytoscape.umd.js: (*! 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) *) (*! Event object based on jQuery events, MIT license https://jquery.org/license/ https://tldrlegal.com/license/mit-license https://github.com/jquery/jquery/blob/master/src/event.js *) (*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *) (*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *) */