(function(){"use strict";function hi(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=Array(e);r=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(u){throw u},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){s=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(s)throw i}}}}function Is(t,e,r){return(e=Bs(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lh(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fh(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a,n,i,o,s=[],u=!0,l=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(a=i.call(r)).done)&&(s.push(a.value),s.length!==e);u=!0);}catch(f){l=!0,n=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}function vh(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hh(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vt(t,e){return oh(t)||fh(t,e)||ci(t,e)||vh()}function an(t){return sh(t)||lh(t)||ci(t)||hh()}function ch(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}function Bs(t){var e=ch(t,"string");return typeof e=="symbol"?e:e+""}function ct(t){"@babel/helpers - typeof";return ct=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},ct(t)}function ci(t,e){if(t){if(typeof t=="string")return hi(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?hi(t,e):void 0}}var dt=typeof window>"u"?null:window,Fs=dt?dt.navigator:null;dt&&dt.document;var dh=ct(""),ks=ct({}),gh=ct(function(){}),ph=typeof HTMLElement>"u"?"undefined":ct(HTMLElement),ba=function(e){return e&&e.instanceString&&it(e.instanceString)?e.instanceString():null},Ne=function(e){return e!=null&&ct(e)==dh},it=function(e){return e!=null&&ct(e)===gh},Je=function(e){return!Ft(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ue=function(e){return e!=null&&ct(e)===ks&&!Je(e)&&e.constructor===Object},yh=function(e){return e!=null&&ct(e)===ks},be=function(e){return e!=null&&ct(e)===ct(1)&&!isNaN(e)},zs=function(e){return be(e)&&Math.floor(e)===e},nn=function(e){if(ph!=="undefined")return e!=null&&e instanceof HTMLElement},Ft=function(e){return wa(e)||Vs(e)},wa=function(e){return ba(e)==="collection"&&e._private.single},Vs=function(e){return ba(e)==="collection"&&!e._private.single},di=function(e){return ba(e)==="core"},Gs=function(e){return ba(e)==="stylesheet"},mh=function(e){return ba(e)==="event"},sr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},bh=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},wh=function(e){return Ue(e)&&be(e.x1)&&be(e.x2)&&be(e.y1)&&be(e.y2)},Eh=function(e){return yh(e)&&it(e.then)},xh=function(){return Fs&&Fs.userAgent.match(/msie|trident|edge/i)},Yr=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;or?1:0},Mh=function(e,r){return-1*qs(e,r)},Oe=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(y-=1),y<1/6?d+(p-d)*6*y:y<1/2?p:y<2/3?d+(p-d)*(2/3-y)*6:d}var v=new RegExp("^"+Sh+"$").exec(e);if(v){if(a=parseInt(v[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(v[2]),n<0||n>100||(n=n/100,i=parseFloat(v[3]),i<0||i>100)||(i=i/100,o=v[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*f(h,c,a+1/3)),u=Math.round(255*f(h,c,a)),l=Math.round(255*f(h,c,a-1/3))}r=[s,u,l,o]}return r},Ph=function(e){var r,a=new RegExp("^"+Th+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;r.push(Math.floor(o))}var s=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(s&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},Oh=function(e){return Ih[e.toLowerCase()]},Ys=function(e){return(Je(e)?e:null)||Oh(e)||Rh(e)||Ph(e)||Nh(e)},Ih={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]},Ws=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i=u||E<0||b&&A>=c}function M(){var I=e();if(x(I))return P(I);d=setTimeout(M,D(I))}function P(I){return d=void 0,m&&f?w(I):(f=v=void 0,h)}function N(){d!==void 0&&clearTimeout(d),y=0,f=p=v=d=void 0}function O(){return d===void 0?h:P(e())}function R(){var I=e(),E=x(I);if(f=arguments,v=this,p=I,E){if(d===void 0)return T(p);if(b)return clearTimeout(d),d=setTimeout(M,u),w(p)}return d===void 0&&(d=setTimeout(M,u)),h}return R.cancel=N,R.flush=O,R}return Ri=o,Ri}var Yh=qh(),Ca=Ea(Yh),Ni=dt?dt.performance:null,uu=Ni&&Ni.now?function(){return Ni.now()}:function(){return Date.now()},Wh=function(){if(dt){if(dt.requestAnimationFrame)return function(t){dt.requestAnimationFrame(t)};if(dt.mozRequestAnimationFrame)return function(t){dt.mozRequestAnimationFrame(t)};if(dt.webkitRequestAnimationFrame)return function(t){dt.webkitRequestAnimationFrame(t)};if(dt.msRequestAnimationFrame)return function(t){dt.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(uu())},1e3/60)}}(),ln=function(e){return Wh(e)},jt=uu,Dr=9261,lu=65599,Wr=5381,fu=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr,a=r,n;n=e.next(),!n.done;)a=a*lu+n.value|0;return a},Sa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dr;return r*lu+e|0},Aa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Wr;return(r<<5)+r+e|0},Xh=function(e,r){return e*2097152+r},lr=function(e){return e[0]*2097152+e[1]},fn=function(e,r){return[Sa(e[0],r[0]),Aa(e[1],r[1])]},vu=function(e,r){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n=0;n--)e[n]===r&&e.splice(n,1)},Ii=function(e){e.splice(0,e.length)},rc=function(e,r){for(var a=0;a"u"?"undefined":ct(Set))!==nc?Set:ic,hn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!di(e)){at("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"){at("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 Xr,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 o=r.renderedPosition,s=e.pan(),u=e.zoom();i.position={x:(o.x-s.x)/u,y:(o.y-s.y)/u}}var l=[];Je(r.classes)?l=r.classes:Ne(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,v=l.length;fb?1:0},f=function(g,b,m,w,T){var D;if(m==null&&(m=0),T==null&&(T=a),m<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);mN;0<=N?P++:P--)M.push(P);return M}).apply(this).reverse(),x=[],w=0,T=D.length;wO;0<=O?++M:--M)R.push(o(g,m));return R},p=function(g,b,m,w){var T,D,x;for(w==null&&(w=a),T=g[m];m>b;){if(x=m-1>>1,D=g[x],w(T,D)<0){g[m]=D,m=x;continue}break}return g[m]=T},y=function(g,b,m){var w,T,D,x,M;for(m==null&&(m=a),T=g.length,M=b,D=g[b],w=2*b+1;w0;){var D=b.pop(),x=y(D),M=D.id();if(c[M]=x,x!==1/0)for(var P=D.neighborhood().intersect(d),N=0;N0)for(L.unshift(C);v[k];){var F=v[k];L.unshift(F.edge),L.unshift(F.node),z=F.node,k=z.id()}return s.spawn(L)}}}},hc={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,o=new Array(i),s=a,u=function(w){for(var T=0;T0;){if(T(),x++,w===f){for(var M=[],P=i,N=f,O=g[N];M.unshift(P),O!=null&&M.unshift(O),P=y[N],P!=null;)N=P.id(),O=g[N];return{found:!0,distance:v[w],path:this.spawn(M),steps:x}}h[w]=!0;for(var R=m._private.edges,I=0;IO&&(d[N]=O,b[N]=P,m[N]=T),!i){var R=P*f+M;!i&&d[R]>O&&(d[R]=O,b[R]=M,m[R]=T)}}}for(var I=0;I1&&arguments[1]!==void 0?arguments[1]:o,ve=m(le),de=[],me=ve;;){if(me==null)return r.spawn();var ye=b(me),we=ye.edge,Me=ye.pred;if(de.unshift(me[0]),me.same(ce)&&de.length>0)break;we!=null&&de.unshift(we),me=Me}return u.spawn(de)},D=0;D=0;f--){var v=l[f],c=v[1],h=v[2];(r[c]===s&&r[h]===u||r[c]===u&&r[h]===s)&&l.splice(f,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*r.length);r=wc(i,e,r),a--}return r},Ec={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(L){return L.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/bc);if(i<2){at("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],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,o=r;o1&&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,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a0&&e.splice(0,r));for(var s=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,s++):e.splice(u,1)}i&&e.sort(function(c,h){return c-h});var f=e.length,v=Math.floor(f/2);return f%2!==0?e[v+1+s]:(e[v-1+s]+e[v+s])/2},Tu=function(e,r){return r===0?e:Tu(r,e%r)},Dc=function(e){for(var r=e[0],a=0;a0&&(r=Tu(r,e[a]));else return 0;return r},Lc=function(e){return Math.PI*e/180},gn=function(e,r){return Math.atan2(r,e)-Math.PI/2},zi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Vi=function(e){return e>0?1:e<0?-1:0},Mr=function(e,r){return Math.sqrt(Rr(e,r))},Rr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Mc=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}}},Nc=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Pc=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Oc=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},Cu=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},pn=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},yn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(r.length===1)a=n=i=o=r[0];else if(r.length===2)a=i=r[0],o=n=r[1];else if(r.length===4){var s=vt(r,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Su=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},Gi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},vr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Au=function(e,r){return vr(e,r.x,r.y)},Du=function(e,r){return vr(e,r.x1,r.y1)&&vr(e,r.x2,r.y2)},Ic=(ki=Math.hypot)!==null&&ki!==void 0?ki:function(t,e){return Math.sqrt(t*t+e*e)};function Bc(t,e){if(t.length<3)throw new Error("Need at least 3 vertices");var r=function(M,P){return{x:M.x+P.x,y:M.y+P.y}},a=function(M,P){return{x:M.x-P.x,y:M.y-P.y}},n=function(M,P){return{x:M.x*P,y:M.y*P}},i=function(M,P){return M.x*P.y-M.y*P.x},o=function(M){var P=Ic(M.x,M.y);return P===0?{x:0,y:0}:{x:M.x/P,y:M.y/P}},s=function(M){for(var P=0,N=0;N7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?cr(i,o):u,f=i/2,v=o/2;l=Math.min(l,f,v);var c=l!==f,h=l!==v,d;if(c){var p=a-f+l-s,y=n-v-s,g=a+f-l+s,b=y;if(d=hr(e,r,a,n,p,y,g,b,!1),d.length>0)return d}if(h){var m=a+f+s,w=n-v+l-s,T=m,D=n+v-l+s;if(d=hr(e,r,a,n,m,w,T,D,!1),d.length>0)return d}if(c){var x=a-f+l-s,M=n+v+s,P=a+f-l+s,N=M;if(d=hr(e,r,a,n,x,M,P,N,!1),d.length>0)return d}if(h){var O=a-f-s,R=n-v+l-s,I=O,E=n+v-l+s;if(d=hr(e,r,a,n,O,R,I,E,!1),d.length>0)return d}var A;{var S=a-f+l,C=n-v+l;if(A=Ra(e,r,a,n,S,C,l+s),A.length>0&&A[0]<=S&&A[1]<=C)return[A[0],A[1]]}{var L=a+f-l,z=n-v+l;if(A=Ra(e,r,a,n,L,z,l+s),A.length>0&&A[0]>=L&&A[1]<=z)return[A[0],A[1]]}{var k=a+f-l,F=n+v-l;if(A=Ra(e,r,a,n,k,F,l+s),A.length>0&&A[0]>=k&&A[1]>=F)return[A[0],A[1]]}{var H=a-f+l,W=n+v-l;if(A=Ra(e,r,a,n,H,W,l+s),A.length>0&&A[0]<=H&&A[1]>=W)return[A[0],A[1]]}return[]},kc=function(e,r,a,n,i,o,s){var u=s,l=Math.min(a,i),f=Math.max(a,i),v=Math.min(n,o),c=Math.max(n,o);return l-u<=e&&e<=f+u&&v-u<=r&&r<=c+u},zc=function(e,r,a,n,i,o,s,u,l){var f={x1:Math.min(a,s,i)-l,x2:Math.max(a,s,i)+l,y1:Math.min(n,u,o)-l,y2:Math.max(n,u,o)+l};return!(ef.x2||rf.y2)},Vc=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,u=(-r+o)/s,l=(-r-o)/s;return[u,l]},Gc=function(e,r,a,n,i){var o=1e-5;e===0&&(e=o),r/=e,a/=e,n/=e;var s,u,l,f,v,c,h,d;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,s=u*u*u+l*l,i[1]=0,h=r/3,s>0){v=l+Math.sqrt(s),v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3),c=l-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+v+c,h+=(v+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+v)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-h+d*Math.cos(f/3),i[2]=-h+d*Math.cos((f+2*Math.PI)/3),i[4]=-h+d*Math.cos((f+4*Math.PI)/3)},Uc=function(e,r,a,n,i,o,s,u){var l=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*u+4*o*o-4*o*u+u*u,f=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*u-6*o*o+3*o*u,v=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*u-n*r+2*o*o+2*o*r-u*r,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*r-o*r,h=[];Gc(l,f,v,c,h);for(var d=1e-7,p=[],y=0;y<6;y+=2)Math.abs(h[y+1])=0&&h[y]<=1&&p.push(h[y]);p.push(1),p.push(0);for(var g=-1,b,m,w,T=0;T=0?wl?(e-i)*(e-i)+(r-o)*(r-o):f-c},It=function(e,r,a){for(var n,i,o,s,u,l=0,f=0;f=e&&e>=o||n<=e&&e<=o)u=(e-n)/(o-n)*(s-i)+i,u>r&&l++;else continue;return l%2!==0},tr=function(e,r,a,n,i,o,s,u,l){var f=new Array(a.length),v;u[0]!=null?(v=Math.atan(u[1]/u[0]),u[0]<0?v=v+Math.PI/2:v=-v-Math.PI/2):v=u;for(var c=Math.cos(-v),h=Math.sin(-v),d=0;d0){var y=bn(f,-l);p=mn(y)}else p=f;return It(e,r,p)},qc=function(e,r,a,n,i,o,s,u){for(var l=new Array(a.length*2),f=0;f=0&&y<=1&&b.push(y),g>=0&&g<=1&&b.push(g),b.length===0)return[];var m=b[0]*u[0]+e,w=b[0]*u[1]+r;if(b.length>1){if(b[0]==b[1])return[m,w];var T=b[1]*u[0]+e,D=b[1]*u[1]+r;return[m,w,T,D]}else return[m,w]},Ui=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},hr=function(e,r,a,n,i,o,s,u,l){var f=e-i,v=a-e,c=s-i,h=r-o,d=n-r,p=u-o,y=c*h-p*f,g=v*h-d*f,b=p*v-c*d;if(b!==0){var m=y/b,w=g/b,T=.001,D=0-T,x=1+T;return D<=m&&m<=x&&D<=w&&w<=x?[e+m*v,r+m*d]:l?[e+m*v,r+m*d]:[]}else return y===0||g===0?Ui(e,a,s)===s?[s,u]:Ui(e,a,i)===i?[i,o]:Ui(i,s,a)===a?[a,n]:[]:[]},Wc=function(e,r,a,n,i){var o=[],s=n/2,u=i/2,l=r,f=a;o.push({x:l+s*e[0],y:f+u*e[1]});for(var v=1;v0){var p=bn(v,-u);h=mn(p)}else h=v}else h=a;for(var y,g,b,m,w=0;w2){for(var d=[f[0],f[1]],p=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),y=1;yf&&(f=w)},get:function(m){return l[m]}},c=0;c0?A=E.edgesTo(I)[0]:A=I.edgesTo(E)[0];var S=n(A);I=I.id(),x[I]>x[O]+S&&(x[I]=x[O]+S,M.nodes.indexOf(I)<0?M.push(I):M.updateItem(I),D[I]=0,T[I]=[]),x[I]==x[O]+S&&(D[I]=D[I]+D[O],T[I].push(O))}else for(var C=0;C0;){for(var F=w.pop(),H=0;H0&&s.push(a[u]);s.length!==0&&i.push(n.collection(s))}return i},od=function(e,r){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:ld,s=n,u,l,f=0;f=2?Pa(e,r,a,0,ku,fd):Pa(e,r,a,0,Fu)},squaredEuclidean:function(e,r,a){return Pa(e,r,a,0,ku)},manhattan:function(e,r,a){return Pa(e,r,a,0,Fu)},max:function(e,r,a){return Pa(e,r,a,-1/0,vd)}};Qr["squared-euclidean"]=Qr.squaredEuclidean,Qr.squaredeuclidean=Qr.squaredEuclidean;function En(t,e,r,a,n,i){var o;return it(t)?o=t:o=Qr[t]||Qr.euclidean,e===0&&it(t)?o(n,i):o(e,r,a,n,i)}var hd=xt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),$i=function(e){return hd(e)},xn=function(e,r,a,n,i){var o=i!=="kMedoids",s=o?function(v){return a[v]}:function(v){return n[v](a)},u=function(c){return n[c](r)},l=a,f=r;return En(e,n.length,s,u,l,f)},Ki=function(e,r,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(r),u=null,l=0;la)return!1}return!0},gd=function(e,r,a){for(var n=0;ns&&(s=r[l][f],u=f);i[u].push(e[l])}for(var v=0;v=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[o],p=r[n[o]],y;i.mode==="dendrogram"?y={left:d,right:p,key:d.key}:y={value:d.value.concat(p.value),key:d.key},e[d.index]=y,e.splice(p.index,1),r[d.key]=y;for(var g=0;ga[p.key][b.key]&&(u=a[p.key][b.key])):i.linkage==="max"?(u=a[d.key][b.key],a[d.key][b.key]0&&n.push(i);return n},Wu=function(e,r,a){for(var n=[],i=0;is&&(o=l,s=r[i*e+l])}o>0&&n.push(o)}for(var f=0;fl&&(u=f,l=v)}a[i]=o[u]}return n=Wu(e,r,a),n},Xu=function(e){for(var r=this.cy(),a=this.nodes(),n=Dd(e),i={},o=0;o=O?(R=O,O=E,I=A):E>R&&(R=E);for(var S=0;S0?1:0;x[P%n.minIterations*s+H]=W,F+=W}if(F>0&&(P>=n.minIterations-1||P==n.maxIterations-1)){for(var Q=0,K=0;K1||D>1)&&(s=!0),v[m]=[],b.outgoers().forEach(function(M){M.isEdge()&&v[m].push(M.id())})}else c[m]=[void 0,b.target().id()]}):o.forEach(function(b){var m=b.id();if(b.isNode()){var w=b.degree(!0);w%2&&(u?l?s=!0:l=m:u=m),v[m]=[],b.connectedEdges().forEach(function(T){return v[m].push(T.id())})}else c[m]=[b.source().id(),b.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(l&&u)if(i){if(f&&l!=f)return h;f=l}else{if(f&&l!=f&&u!=f)return h;f||(f=l)}else f||(f=o[0].id());var d=function(m){for(var w=m,T=[m],D,x,M;v[w].length;)D=v[w].shift(),x=c[D][0],M=c[D][1],w!=M?(v[M]=v[M].filter(function(P){return P!=D}),w=M):!i&&w!=x&&(v[x]=v[x].filter(function(P){return P!=D}),w=x),T.unshift(D),T.unshift(w);return T},p=[],y=[];for(y=d(f);y.length!=1;)v[y[0]].length==0?(p.unshift(o.getElementById(y.shift())),p.unshift(o.getElementById(y.shift()))):y=d(y.shift()).concat(y);p.unshift(o.getElementById(y.shift()));for(var g in v)if(v[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Tn=function(){var e=this,r={},a=0,n=0,i=[],o=[],s={},u=function(c,h){for(var d=o.length-1,p=[],y=e.spawn();o[d].x!=c||o[d].y!=h;)p.push(o.pop().edge),d--;p.push(o.pop().edge),p.forEach(function(g){var b=g.connectedNodes().intersection(e);y.merge(g),b.forEach(function(m){var w=m.id(),T=m.connectedEdges().intersection(e);y.merge(m),r[w].cutVertex?y.merge(T.filter(function(D){return D.isLoop()})):y.merge(T)})}),i.push(y)},l=function(c,h,d){c===d&&(n+=1),r[h]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(h).connectedEdges().intersection(e);if(p.size()===0)i.push(e.spawn(e.getElementById(h)));else{var y,g,b,m;p.forEach(function(w){y=w.source().id(),g=w.target().id(),b=y===h?g:y,b!==d&&(m=w.id(),s[m]||(s[m]=!0,o.push({x:h,y:b,edge:w})),b in r?r[h].low=Math.min(r[h].low,r[b].id):(l(c,b,h),r[h].low=Math.min(r[h].low,r[b].low),r[h].id<=r[b].low&&(r[h].cutVertex=!0,u(h,b))))})}};e.forEach(function(v){if(v.isNode()){var c=v.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(v){return r[v].cutVertex}).map(function(v){return e.getElementById(v)});return{cut:e.spawn(f),components:i}},Bd={hopcroftTarjanBiconnected:Tn,htbc:Tn,htb:Tn,hopcroftTarjanBiconnectedComponents:Tn},Cn=function(){var e=this,r={},a=0,n=[],i=[],o=e.spawn(e),s=function(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(p){var y=p.target().id();y!==l&&(y in r||s(y),r[y].explored||(r[l].low=Math.min(r[l].low,r[y].low)))}),r[l].index===r[l].low){for(var v=e.spawn();;){var c=i.pop();if(v.merge(e.getElementById(c)),r[c].low=r[l].index,r[c].explored=!0,c===l)break}var h=v.edgesWith(v),d=v.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||s(l)}}),{cut:o,components:n}},Fd={tarjanStronglyConnected:Cn,tsc:Cn,tscc:Cn,tarjanStronglyConnectedComponents:Cn},$u={};[Da,vc,hc,dc,pc,mc,Ec,_c,_r,Zr,Xi,ud,Ed,Sd,Pd,Id,Bd,Fd].forEach(function(t){Oe($u,t)});/*! Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) Licensed under The MIT License (http://opensource.org/licenses/MIT) */var Ku=0,_u=1,Zu=2,Ut=function(e){if(!(this instanceof Ut))return new Ut(e);this.id="Thenable/1.0.7",this.state=Ku,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))};Ut.prototype={fulfill:function(e){return Qu(this,_u,"fulfillValue",e)},reject:function(e){return Qu(this,Zu,"rejectReason",e)},then:function(e,r){var a=this,n=new Ut;return a.onFulfilled.push(el(e,n,"fulfill")),a.onRejected.push(el(r,n,"reject")),Ju(a),n.proxy}};var Qu=function(e,r,a,n){return e.state===Ku&&(e.state=r,e[a]=n,Ju(e)),e},Ju=function(e){e.state===_u?ju(e,"onFulfilled",e.fulfillValue):e.state===Zu&&ju(e,"onRejected",e.rejectReason)},ju=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var s=0;s0}},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 o=0;o-1}return Eo=e,Eo}var xo,Sl;function tg(){if(Sl)return xo;Sl=1;var t=Dn();function e(r,a){var n=this.__data__,i=t(n,r);return i<0?(++this.size,n.push([r,a])):n[i][1]=a,this}return xo=e,xo}var To,Al;function rg(){if(Al)return To;Al=1;var t=Qd(),e=Jd(),r=jd(),a=eg(),n=tg();function i(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s-1&&a%1==0&&a0&&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){Je(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],o=0,s=a.length;o0&&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}};Mn.className=Mn.classNames=Mn.classes;var He={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:gt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};He.variable="(?:[\\w-.]|(?:\\\\"+He.metaChar+"))+",He.className="(?:[\\w-]|(?:\\\\"+He.metaChar+"))+",He.value=He.string+"|"+He.number,He.id=He.variable,function(){var t,e,r;for(t=He.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(He.comparatorOp+="|\\!"+e)}();var Ze=function(){return{checks:[]}},Le={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},Jo=[{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 Mh(t.selector,e.selector)}),Og=function(){for(var t={},e,r=0;r0&&f.edgeCount>0)return Xe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Xe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Xe("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},Vg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return Ne(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,v){var c=f.type,h=f.value;switch(c){case Le.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case Le.DATA_COMPARE:{var p=f.field,y=f.operator;return"["+p+a(e(y))+r(h)+"]"}case Le.DATA_BOOL:{var g=f.operator,b=f.field;return"["+e(g)+b+"]"}case Le.DATA_EXIST:{var m=f.field;return"["+m+"]"}case Le.META_COMPARE:{var w=f.operator,T=f.field;return"[["+T+a(e(w))+r(h)+"]]"}case Le.STATE:return h;case Le.ID:return"#"+h;case Le.CLASS:return"."+h;case Le.PARENT:case Le.CHILD:return i(f.parent,v)+a(">")+i(f.child,v);case Le.ANCESTOR:case Le.DESCENDANT:return i(f.ancestor,v)+" "+i(f.descendant,v);case Le.COMPOUND_SPLIT:{var D=i(f.left,v),x=i(f.subject,v),M=i(f.right,v);return D+(D.length>0?" ":"")+x+M}case Le.TRUE:return""}},i=function(f,v){return f.checks.reduce(function(c,h,d){return c+(v===f&&d===0?"$":"")+n(h,v)},"")},o="",s=0;s1&&s=0&&(r=r.replace("!",""),v=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||s||f)&&(u=!i&&!o?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===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()),s&&a(n,i,f)}return t}function of(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,of)};function sf(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ta.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,sf)};function $g(t,e,r){sf(t,e,r),of(t,e,r)}ta.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ts(this,t,e,$g)},ta.ancestors=ta.parents;var Oa,uf;Oa=uf={data:$e.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:$e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:$e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:$e.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:$e.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Oa.attr=Oa.data,Oa.removeAttr=Oa.removeData;var Kg=uf,Rn={};function rs(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,o=0;oe}),minIndegree:ra("indegree",function(t,e){return te}),minOutdegree:ra("outdegree",function(t,e){return te})}),Oe(Rn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n0,c=v;v&&(f=f[0]);var h=c?f.position():{x:0,y:0};r!==void 0?l.position(e,r+h[e]):i!==void 0&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),p=s?a.parent():null,y=p&&p.length>0,g=y;y&&(p=p[0]);var b=g?p.position():{x:0,y:0};return i={x:d.x-b.x,y:d.y-b.y},e===void 0?i:i[e]}else if(!o)return;return this}},Ht.modelPosition=Ht.point=Ht.position,Ht.modelPositions=Ht.points=Ht.positions,Ht.renderedPoint=Ht.renderedPosition,Ht.relativePoint=Ht.relativePosition;var _g=lf,aa=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},na=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},Zg=function(e){switch(e){case"left":return"right";case"right":return"left";case"left-inside":return"left";case"right-inside":return"right";default:return"center"}},ia,mr;ia=mr={},mr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:u,w:o-i,h:u-s}},mr.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)},mr.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(o){if(!o.isParent())return;var s=o._private,u=o.children(),l=o.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},v=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=s.position;(v.w===0||v.h===0)&&(v={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},v.x1=c.x-v.w/2,v.x2=c.x+v.w/2,v.y1=c.y-v.h/2,v.y2=c.y+v.h/2);function h(P,N,O){var R=0,I=0,E=N+O;return P>0&&E>0&&(R=N/E*P,I=O/E*P),{biasDiff:R,biasComplementDiff:I}}function d(P,N,O,R){if(O.units==="%")switch(R){case"width":return P>0?O.pfValue*P:0;case"height":return N>0?O.pfValue*N:0;case"average":return P>0&&N>0?O.pfValue*(P+N)/2:0;case"min":return P>0&&N>0?P>N?O.pfValue*N:O.pfValue*P:0;case"max":return P>0&&N>0?P>N?O.pfValue*P:O.pfValue*N:0;default:return 0}else return O.units==="px"?O.pfValue:0}var p=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(p=p*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 g=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(g=g*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var m=h(f.width.val-v.w,p,y),w=m.biasDiff,T=m.biasComplementDiff,D=h(f.height.val-v.h,g,b),x=D.biasDiff,M=D.biasComplementDiff;s.autoPadding=d(v.w,v.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(v.w,f.width.val),c.x=(-w+v.x1+v.x2+T)/2,s.autoHeight=Math.max(v.h,f.height.val),c.y=(-x+v.y1+v.y2+M)/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)},br=function(e,r){return r==null?e:qt(e,r.x1,r.y1,r.x2,r.y2)},Ia=function(e,r,a){return Mt(e,r,a)},Nn=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,o=i.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,u,l;if(s!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},v=f[a]=f[a]||{};v.x1=u-o,v.y1=l-o,v.x2=u+o,v.y2=l+o,v.w=v.x2-v.x1,v.h=v.y2-v.y1,pn(v,1),qt(e,v.x1,v.y1,v.x2,v.y2)}}},as=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,o=i.rstyle,s=r.pstyle(n+"label").strValue;if(s){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=Ia(o,"labelWidth",a),v=Ia(o,"labelHeight",a),c=Ia(o,"labelX",a),h=Ia(o,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,p=r.pstyle(n+"text-margin-y").pfValue,y=r.isEdge(),g=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,m=r.pstyle("text-border-width").pfValue,w=m/2,T=r.pstyle("text-background-padding").pfValue,D=2,x=v,M=f,P=M/2,N=x/2,O,R,I,E;if(y)O=c-P,R=c+P,I=h-N,E=h+N;else{switch(aa(u.value)){case"left":O=c-M,R=c;break;case"center":O=c-P,R=c+P;break;case"right":O=c,R=c+M;break}switch(na(l.value)){case"top":I=h-x,E=h;break;case"center":I=h-N,E=h+N;break;case"bottom":I=h,E=h+x;break}}var A=d-Math.max(b,w)-T-D,S=d+Math.max(b,w)+T+D,C=p-Math.max(b,w)-T-D,L=p+Math.max(b,w)+T+D;O+=A,R+=S,I+=C,E+=L;var z=a||"main",k=i.labelBounds,F=k[z]=k[z]||{};F.x1=O,F.y1=I,F.x2=R,F.y2=E,F.w=R-O,F.h=E-I,F.leftPad=A,F.rightPad=S,F.topPad=C,F.botPad=L;var H=y&&g.strValue==="autorotate",W=g.pfValue!=null&&g.pfValue!==0;if(H||W){var Q=H?Ia(i.rstyle,"labelAngle",a):g.pfValue,K=Math.cos(Q),Z=Math.sin(Q),j=(O+R)/2,re=(I+E)/2;if(!y){switch(aa(u.value)){case"left":j=R;break;case"right":j=O;break}switch(na(l.value)){case"top":re=E;break;case"bottom":re=I;break}}var q=function(pe,le){return pe=pe-j,le=le-re,{x:pe*K-le*Z+j,y:pe*Z+le*K+re}},U=q(O,I),Y=q(O,E),X=q(R,I),ee=q(R,E);O=Math.min(U.x,Y.x,X.x,ee.x),R=Math.max(U.x,Y.x,X.x,ee.x),I=Math.min(U.y,Y.y,X.y,ee.y),E=Math.max(U.y,Y.y,X.y,ee.y)}var te=z+"Rot",ge=k[te]=k[te]||{};ge.x1=O,ge.y1=I,ge.x2=R,ge.y2=E,ge.w=R-O,ge.h=E-I,qt(e,O,I,R,E),qt(i.labelBounds.all,O,I,R,E)}return e}},hf=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value,i=r.pstyle("outline-offset").value,o=n+i;cf(e,r,a,o,"outside",o/2)}},cf=function(e,r,a,n,i,o){if(!(a===0||n<=0||i==="inside")){var s=r.cy(),u=s.renderer(),l=u.nodeShapes[u.getNodeShape(r)];if(l){var f=r.position(),v=f.x,c=f.y,h=r.width(),d=r.height();if(l.hasMiterBounds){i==="center"&&(n/=2);var p=l.miterBounds(v,c,h,d,n);br(e,p)}else o!=null&&o>0&&yn(e,[o,o,o,o])}}},Qg=function(e,r){if(!r.cy().headless()){var a=r.pstyle("border-opacity").value,n=r.pstyle("border-width").pfValue,i=r.pstyle("border-position").value;cf(e,r,a,n,i)}},Jg=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=Rt(),s=e._private,u=e.isNode(),l=e.isEdge(),f,v,c,h,d,p,y=s.rstyle,g=u&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(Te){return Te.pstyle("display").value!=="none"},m=!n||b(e)&&(!l||b(e.source())&&b(e.target()));if(m){var w=0,T=0;n&&r.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(T=e.pstyle("overlay-padding").value));var D=0,x=0;n&&r.includeUnderlays&&(D=e.pstyle("underlay-opacity").value,D!==0&&(x=e.pstyle("underlay-padding").value));var M=Math.max(T,x),P=0,N=0;if(n&&(P=e.pstyle("width").pfValue,N=P/2),u&&r.includeNodes){var O=e.position();d=O.x,p=O.y;var R=e.outerWidth(),I=R/2,E=e.outerHeight(),A=E/2;f=d-I,v=d+I,c=p-A,h=p+A,qt(o,f,c,v,h),n&&hf(o,e),n&&r.includeOutlines&&!i&&hf(o,e),n&&Qg(o,e)}else if(l&&r.includeEdges)if(n&&!i){var S=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),v=Math.max(y.srcX,y.midX,y.tgtX),c=Math.min(y.srcY,y.midY,y.tgtY),h=Math.max(y.srcY,y.midY,y.tgtY),f-=N,v+=N,c-=N,h+=N,qt(o,f,c,v,h),S==="haystack"){var C=y.haystackPts;if(C&&C.length===2){if(f=C[0].x,c=C[0].y,v=C[1].x,h=C[1].y,f>v){var L=f;f=v,v=L}if(c>h){var z=c;c=h,h=z}qt(o,f-N,c-N,v+N,h+N)}}else if(S==="bezier"||S==="unbundled-bezier"||ur(S,"segments")||ur(S,"taxi")){var k;switch(S){case"bezier":case"unbundled-bezier":k=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":k=y.linePts;break}if(k!=null)for(var F=0;Fv){var j=f;f=v,v=j}if(c>h){var re=c;c=h,h=re}f-=N,v+=N,c-=N,h+=N,qt(o,f,c,v,h)}if(n&&r.includeEdges&&l&&(Nn(o,e,"mid-source"),Nn(o,e,"mid-target"),Nn(o,e,"source"),Nn(o,e,"target")),n){var q=e.pstyle("ghost").value==="yes";if(q){var U=e.pstyle("ghost-offset-x").pfValue,Y=e.pstyle("ghost-offset-y").pfValue;qt(o,o.x1+U,o.y1+Y,o.x2+U,o.y2+Y)}}var X=s.bodyBounds=s.bodyBounds||{};Su(X,o),yn(X,g),pn(X,1),n&&(f=o.x1,v=o.x2,c=o.y1,h=o.y2,qt(o,f-M,c-M,v+M,h+M));var ee=s.overlayBounds=s.overlayBounds||{};Su(ee,o),yn(ee,g),pn(ee,1);var te=s.labelBounds=s.labelBounds||{};te.all!=null?Pc(te.all):te.all=Rt(),n&&r.includeLabels&&(r.includeMainLabels&&as(o,e,null),l&&(r.includeSourceLabels&&as(o,e,"source"),r.includeTargetLabels&&as(o,e,"target")))}return o.x1=zt(o.x1),o.y1=zt(o.y1),o.x2=zt(o.x2),o.y2=zt(o.y2),o.w=zt(o.x2-o.x1),o.h=zt(o.y2-o.y1),o.w>0&&o.h>0&&m&&(yn(o,g),pn(o,1)),o},df=function(e){var r=0,a=function(o){return(o?1:0)<0&&arguments[0]!==void 0?arguments[0]:cp,e=arguments.length>1?arguments[1]:void 0,r=0;r=0;s--)o(s);return this},wr.removeAllListeners=function(){return this.removeListener("*")},wr.emit=wr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Je(e)||(e=[e]),dp(this,function(i,o){r!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:r}],n=a.length);for(var s=function(){var f=a[u];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===hp)&&i.eventMatches(i.context,f,o)){var v=[o];e!=null&&rc(v,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(d){return d!==f}));var c=i.callbackContext(i.context,f,o),h=f.callback.apply(c,v);i.afterEmit(i.context,f,o),h===!1&&(o.stopPropagation(),o.preventDefault())}},u=0;u1&&!o){var s=this.length-1,u=this[s],l=u._private.data.id;this[s]=void 0,this[e]=u,i.set(l,{ele:u,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 o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&Ne(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=u,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,o=0;o=0&&i"u"?"undefined":ct(Symbol))!=e&&ct(Symbol.iterator)!=e;r&&(Bn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Is({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return 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(Ue(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(Ne(e))if(r===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):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 o=0;o0&&e.push(f[0]),e.push(s[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)}}),At.neighbourhood=At.neighborhood,At.closedNeighbourhood=At.closedNeighborhood,At.openNeighbourhood=At.openNeighborhood,Oe(At,{source:kt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:kt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Bf({attr:"source"}),targets:Bf({attr:"target"})});function Bf(t){return function(r){for(var a=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),At.componentsOf=At.components;var Ct=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){at("A collection must have a reference to the core");return}var i=new er,o=!1;if(!r)r=[];else if(r.length>0&&Ue(r[0])&&!wa(r[0])){o=!0;for(var s=[],u=new Xr,l=0,f=r.length;l0&&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=[],o=[],s,u=0,l=r.length;u0){for(var z=s.length===r.length?r:new Ct(a,s),k=0;k0&&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 o(E){for(var A=E._private.edges,S=0;S0&&(t?O.emitAndNotify("remove"):e&&O.emit("remove"));for(var R=0;R0?R=E:O=E;while(Math.abs(I)>o&&++A=i?b(N,A):S===0?A:w(N,O,O+l)}var D=!1;function x(){D=!0,(t!==e||r!==a)&&m()}var M=function(O){return D||x(),t===e&&r===a?O:O===0?0:O===1?1:y(T(O),e,a)};M.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var P="generateBezier("+[t,e,r,a]+")";return M.toString=function(){return P},M}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Sp=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:t(o)}}function r(a,n){var i={dx:a.v,dv:t(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),u=e(a,n,s),l=1/6*(i.dx+2*(o.dx+s.dx)+u.dx),f=1/6*(i.dv+2*(o.dv+s.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,v=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(l=a(n,i),h=l/o*v):h=v;d=r(d||s,h),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(p){return u[p*(u.length-1)|0]}:l}}(),et=function(e,r,a,n){var i=Cp(e,r,a,n);return function(o,s,u){return o+(s-o)*i(u)}},Vn={linear:function(e,r,a){return e+(r-e)*a},ease:et(.25,.1,.25,1),"ease-in":et(.42,0,1,1),"ease-out":et(0,0,.58,1),"ease-in-out":et(.42,0,.58,1),"ease-in-sine":et(.47,0,.745,.715),"ease-out-sine":et(.39,.575,.565,1),"ease-in-out-sine":et(.445,.05,.55,.95),"ease-in-quad":et(.55,.085,.68,.53),"ease-out-quad":et(.25,.46,.45,.94),"ease-in-out-quad":et(.455,.03,.515,.955),"ease-in-cubic":et(.55,.055,.675,.19),"ease-out-cubic":et(.215,.61,.355,1),"ease-in-out-cubic":et(.645,.045,.355,1),"ease-in-quart":et(.895,.03,.685,.22),"ease-out-quart":et(.165,.84,.44,1),"ease-in-out-quart":et(.77,0,.175,1),"ease-in-quint":et(.755,.05,.855,.06),"ease-out-quint":et(.23,1,.32,1),"ease-in-out-quint":et(.86,0,.07,1),"ease-in-expo":et(.95,.05,.795,.035),"ease-out-expo":et(.19,1,.22,1),"ease-in-out-expo":et(1,0,0,1),"ease-in-circ":et(.6,.04,.98,.335),"ease-out-circ":et(.075,.82,.165,1),"ease-in-out-circ":et(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Vn.linear;var n=Sp(e,r,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":et};function zf(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 Vf(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function ua(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var o=Vf(t,n),s=Vf(e,n);if(be(o)&&be(s))return zf(i,o,s,r,a);if(Je(o)&&Je(s)){for(var u=[],l=0;l0?(h==="spring"&&d.push(o.duration),o.easingImpl=Vn[h].apply(null,d)):o.easingImpl=Vn[h]}var p=o.easingImpl,y;if(o.duration===0?y=1:y=(r-u)/o.duration,o.applying&&(y=o.progress),y<0?y=0:y>1&&(y=1),o.delay==null){var g=o.startPosition,b=o.position;if(b&&n&&!t.locked()){var m={};Va(g.x,b.x)&&(m.x=ua(g.x,b.x,y,p)),Va(g.y,b.y)&&(m.y=ua(g.y,b.y,y,p)),t.position(m)}var w=o.startPan,T=o.pan,D=i.pan,x=T!=null&&a;x&&(Va(w.x,T.x)&&(D.x=ua(w.x,T.x,y,p)),Va(w.y,T.y)&&(D.y=ua(w.y,T.y,y,p)),t.emit("pan"));var M=o.startZoom,P=o.zoom,N=P!=null&&a;N&&(Va(M,P)&&(i.zoom=Ma(i.minZoom,ua(M,P,y,p),i.maxZoom)),t.emit("zoom")),(x||N)&&t.emit("viewport");var O=o.style;if(O&&O.length>0&&n){for(var R=0;R=0;x--){var M=D[x];M()}D.splice(0,D.length)},b=h.length-1;b>=0;b--){var m=h[b],w=m._private;if(w.stopped){h.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Dp(f,m,t),Ap(f,m,t,v),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(t),m.completed()&&(h.splice(b,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),p=!0)}return!v&&h.length===0&&d.length===0&&a.push(f),p}for(var i=!1,o=0;o0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Lp={animate:$e.animate(),animation:$e.animation(),animated:$e.animated(),clearQueue:$e.clearQueue(),delay:$e.delay(),delayAnimation:$e.delayAnimation(),stop:$e.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&&ln(function(i){Gf(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){Gf(o,e)},a.beforeRenderPriorities.animations):r()}},Mp={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&&wa(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}},Gn=function(e){return Ne(e)?new gr(e):e},Uf={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new On(Mp,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,Gn(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,Gn(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,Gn(r),a),this},once:function(e,r,a){return this.emitter().one(e,Gn(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}};$e.eventAliasesOn(Uf);var os={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)}};os.jpeg=os.jpg;var Un={layout:function(e){var r=this;if(e==null){at("Layout options must be specified to make a layout");return}if(e.name==null){at("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){at("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;Ne(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var o=new n(Oe({},e,{cy:r,eles:i}));return o}};Un.createLayout=Un.makeLayout=Un.layout;var Rp={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)}};ss.invalidateDimensions=ss.resize;var Hn={collection:function(e,r){return Ne(e)?this.$(e):Ft(e)?e.collection():Je(e)?(r||(r={}),new Ct(this,e,r.unique,r.removed)):new Ct(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}};Hn.elements=Hn.filter=Hn.$;var bt={},Ga="t",Pp="f";bt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i0;if(c||v&&h){var d=void 0;c&&h||c?d=l.properties:h&&(d=l.mappedProperties);for(var p=0;p1&&(w=1),s.color){var D=a.valueMin[0],x=a.valueMax[0],M=a.valueMin[1],P=a.valueMax[1],N=a.valueMin[2],O=a.valueMax[2],R=a.valueMin[3]==null?1:a.valueMin[3],I=a.valueMax[3]==null?1:a.valueMax[3],E=[Math.round(D+(x-D)*w),Math.round(M+(P-M)*w),Math.round(N+(O-N)*w),Math.round(R+(I-R)*w)];i={bypass:a.bypass,name:a.name,value:E,strValue:"rgb("+E[0]+", "+E[1]+", "+E[2]+")"}}else if(s.number){var A=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,A,a.bypass,c)}else return!1;if(!i)return p(),!1;i.mapping=a,a=i;break}case o.data:{for(var S=a.field.split("."),C=v.data,L=0;L0&&i>0){for(var s={},u=!1,l=0;l0?t.delayAnimation(o).play().promise().then(m):m()}).then(function(){return t.animation({style:s,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)},bt.checkTrigger=function(t,e,r,a,n,i){var o=this.properties[e],s=n(o);t.removed()||s!=null&&s(r,a,t)&&i(o)},bt.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)})},bt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache()})},bt.checkConnectedEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},bt.checkParallelEdgesBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){t.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},bt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a),this.checkConnectedEdgesBoundsTrigger(t,e,r,a),this.checkParallelEdgesBoundsTrigger(t,e,r,a)};var Ua={};Ua.applyBypass=function(t,e,r,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;sn.length?a=a.substr(n.length):a=""}function u(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Xe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var v=f[1];if(v!=="core"){var c=new gr(v);if(c.invalid){Xe("Skipping parsing of block: Invalid selector found in string stylesheet: "+v),s();continue}}var h=f[2],d=!1;i=h;for(var p=[];;){var y=i.match(/^\s*$/);if(y)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Xe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=g[0];var b=g[1],m=g[2],w=e.properties[b];if(!w){Xe("Skipping property: Invalid property name in: "+o),u();continue}var T=r.parse(b,m);if(!T){Xe("Skipping property: Invalid property definition in: "+o),u();continue}p.push({name:b,val:m}),u()}if(d){s();break}r.selector(v);for(var D=0;D=7&&e[0]==="d"&&(f=new RegExp(s.data.regex).exec(e))){if(r)return!1;var c=s.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(e))){if(r||l.multiple)return!1;var h=s.mapData;if(!(l.color||l.number))return!1;var d=this.parse(t,v[4]);if(!d||d.mapped)return!1;var p=this.parse(t,v[5]);if(!p||p.mapped)return!1;if(d.pfValue===p.pfValue||d.strValue===p.strValue)return Xe("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(l.color){var y=d.value,g=p.value,b=y[0]===g[0]&&y[1]===g[1]&&y[2]===g[2]&&(y[3]===g[3]||(y[3]==null||y[3]===1)&&(g[3]==null||g[3]===1));if(b)return!1}return{name:t,value:v,strValue:""+e,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:p.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var m;if(u?m=e.split(/\s+/):Je(e)?m=e:m=[e],l.evenMultiple&&m.length%2!==0)return null;for(var w=[],T=[],D=[],x="",M=!1,P=0;P0?" ":"")+N.strValue}return l.validate&&!l.validate(w,T)?null:l.singleEnum&&M?w.length===1&&Ne(w[0])?{name:t,value:w[0],strValue:w[0],bypass:r}:null:{name:t,value:w,pfValue:D,strValue:x,bypass:r,units:T}}var O=function(){for(var q=0;ql.max||l.strictMax&&e===l.max))return null;var S={name:t,value:e,strValue:""+e+(R||""),units:R,bypass:r};return l.unitless||R!=="px"&&R!=="em"?S.pfValue=e:S.pfValue=R==="px"||!R?e:this.getEmSizeInPixels()*e,(R==="ms"||R==="s")&&(S.pfValue=R==="ms"?e:1e3*e),(R==="deg"||R==="rad")&&(S.pfValue=R==="rad"?e:Lc(e)),R==="%"&&(S.pfValue=e/100),S}else if(l.propList){var C=[],L=""+e;if(L!=="none"){for(var z=L.split(/\s*,\s*|\s+/),k=0;k0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((o-2*r)/a.w,(s-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=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,o,s=!1;if(r.zoomingEnabled||(s=!0),be(e)?o=e:Ue(e)&&(o=e.level,e.position!=null?i=dn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(s=!0)),o=o>r.maxZoom?r.maxZoom:o,o=or.maxZoom||!r.zoomingEnabled?o=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;be(l.x)&&(r.pan.x=l.x,s=!1),be(l.y)&&(r.pan.y=l.y,s=!1),s||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(Ne(e)){var a=e;e=this.mutableElements().filter(a)}else Ft(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();r=r===void 0?this._private.zoom:r;var s={x:(i-r*(n.x1+n.x2))/2,y:(o-r*(n.y1+n.y2))/2};return s}}},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,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("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}};Or.centre=Or.center,Or.autolockNodes=Or.autolock,Or.autoungrabifyNodes=Or.autoungrabify;var Ha={data:$e.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:$e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:$e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:$e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ha.attr=Ha.data,Ha.removeAttr=Ha.removeData;var qa=function(e){var r=this;e=Oe({},e);var a=e.container;a&&!nn(a)&&nn(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 o=dt!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=Oe({name:o?"grid":"null"},s.layout),s.renderer=Oe({name:o?"canvas":"null"},s.renderer);var u=function(d,p,y){return p!==void 0?p:y!==void 0?y:d},l=this._private={container:a,ready:!1,options:s,elements:new Ct(this),listeners:[],aniEles:new Ct(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,s.zoomingEnabled),userZoomingEnabled:u(!0,s.userZoomingEnabled),panningEnabled:u(!0,s.panningEnabled),userPanningEnabled:u(!0,s.userPanningEnabled),boxSelectionEnabled:u(!0,s.boxSelectionEnabled),autolock:u(!1,s.autolock,s.autolockNodes),autoungrabify:u(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:u(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:be(s.zoom)?s.zoom:1,pan:{x:Ue(s.pan)&&be(s.pan.x)?s.pan.x:0,y:Ue(s.pan)&&be(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var f=function(d,p){var y=d.some(Eh);if(y)return jr.all(d).then(p);p(d)};l.styleEnabled&&r.setStyle([]);var v=Oe({},s,s.renderer);r.initRenderer(v);var c=function(d,p,y){r.notifications(!1);var g=r.mutableElements();g.length>0&&g.remove(),d!=null&&(Ue(d)||Je(d))&&r.add(d),r.one("layoutready",function(m){r.notifications(!0),r.emit(m),r.one("load",p),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var b=Oe({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};f([s.style,s.elements],function(h){var d=h[0],p=h[1];l.styleEnabled&&r.style().append(d),c(p,function(){r.startAnimationLoop(),l.ready=!0,it(s.ready)&&r.on("ready",s.ready);for(var y=0;y0,s=!!t.boundingBox,u=Rt(s?t.boundingBox:structuredClone(e.extent())),l;if(Ft(t.roots))l=t.roots;else if(Je(t.roots)){for(var f=[],v=0;v0;){var E=I(),A=P(E,O);if(A)E.outgoers().filter(function(ce){return ce.isNode()&&r.has(ce)}).forEach(R);else if(A===null){Xe("Detected double maximal shift for node `"+E.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var S=0;if(t.avoidOverlap)for(var C=0;C0&&g[0].length<=3?we/2:0),Ie=2*Math.PI/g[me].length*ye;return me===0&&g[0].length===1&&(Me=1),{x:X.x+Me*Math.cos(Ie),y:X.y+Me*Math.sin(Ie)}}else{var Be=g[me].length,Fe=Math.max(Be===1?0:s?(u.w-t.padding*2-ee.w)/((t.grid?ge:Be)-1):(u.w-t.padding*2-ee.w)/((t.grid?ge:Be)+1),S),oe={x:X.x+(ye+1-(Be+1)/2)*Fe,y:X.y+(me+1-(K+1)/2)*te};return oe}},pe={downward:0,leftward:90,upward:180,rightward:-90};Object.keys(pe).indexOf(t.direction)===-1&&at("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(pe).join(", ")));var le=function(ve){return Zh(Te(ve),u,pe[t.direction])};return r.nodes().layoutPositions(this,t,le),this};var kp={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 Yf(t){this.options=Oe({},kp,t)}Yf.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 o=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,v=0,c=0;c1&&e.avoidOverlap){v*=1.75;var g=Math.cos(l)-Math.cos(0),b=Math.sin(l)-Math.sin(0),m=Math.sqrt(v*v/(g*g+b*b));f=Math.max(m,f)}var w=function(D,x){var M=e.startAngle+x*l*(n?1:-1),P=f*Math.cos(M),N=f*Math.sin(M),O={x:s.x+P,y:s.y+N};return O};return a.nodes().layoutPositions(this,e,w),this};var zp={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 Wf(t){this.options=Oe({},zp,t)}Wf.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"),o=Rt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},u=[],l=0,f=0;f0){var T=Math.abs(b[0].value-w.value);T>=y&&(b=[],g.push(b))}b.push(w)}var D=l+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,M=Math.min(o.w,o.h)/2-D,P=M/(g.length+x?1:0);D=Math.min(D,P)}for(var N=0,O=0;O1&&e.avoidOverlap){var A=Math.cos(E)-Math.cos(0),S=Math.sin(E)-Math.sin(0),C=Math.sqrt(D*D/(A*A+S*S));N=Math.max(C,N)}R.r=N,N+=D}if(e.equidistant){for(var L=0,z=0,k=0;k=t.numIter||(Wp(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature=t.animationThreshold&&i(),ln(f)}};f()}else{for(;l;)l=o(u),u++;Zf(a,t),s()}return this},Xn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Xn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Gp=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=Rt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=a.eles.components(),l={},f=0;f0){s.graphSet.push(M);for(var f=0;fn.count?0:n.graph},Xf=function(e,r,a,n){var i=n.graphSet[a];if(-10)var v=n.nodeOverlap*f,c=Math.sqrt(s*s+u*u),h=v*s/c,d=v*u/c;else var p=$n(e,s,u),y=$n(r,-1*s,-1*u),g=y.x-p.x,b=y.y-p.y,m=g*g+b*b,c=Math.sqrt(m),v=(e.nodeRepulsion+r.nodeRepulsion)/m,h=v*g/c,d=v*b/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),r.isLocked||(r.offsetX+=h,r.offsetY+=d)}},Kp=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 o=e.maxY-r.minY;else var o=r.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},$n=function(e,r,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,u=a/r,l=o/s,f={};return r===0&&0a?(f.x=n,f.y=i+o/2,f):0r&&-1*l<=u&&u<=l?(f.x=n-s/2,f.y=i-s*a/2/r,f):0=l)?(f.x=n+o*r/2/a,f.y=i+o/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-o*r/2/a,f.y=i-o/2),f)},_p=function(e,r){for(var a=0;aa){var y=r.gravity*h/p,g=r.gravity*d/p;c.offsetX+=y,c.offsetY+=g}}}}},Qp=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 o=a[n++],s=e.idToIndex[o],u=e.layoutNodes[s],l=u.children;if(0a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},_f=function(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.padTopg&&(d+=y+r.componentSpacing,h=0,p=0,y=0)}}},ey={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 Qf(t){this.options=Oe({},ey,t)}Qf.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=Rt(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(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),u=Math.round(s),l=Math.round(i.w/i.h*s),f=function(Q){if(Q==null)return Math.min(u,l);var K=Math.min(u,l);K==u?u=Q:l=Q},v=function(Q){if(Q==null)return Math.max(u,l);var K=Math.max(u,l);K==u?u=Q:l=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)u=c,l=h;else if(c!=null&&h==null)u=c,l=Math.ceil(o/u);else if(c==null&&h!=null)l=h,u=Math.ceil(o/l);else if(l*u>o){var d=f(),p=v();(d-1)*p>=o?f(d-1):(p-1)*d>=o&&v(p-1)}else for(;l*u=o?v(g+1):f(y+1)}var b=i.w/l,m=i.h/u;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var w=0;w=l&&(A=0,E++)},C={},L=0;L(A=Hc(t,e,S[C],S[C+1],S[C+2],S[C+3])))return y(x,A),!0}else if(P.edgeType==="bezier"||P.edgeType==="multibezier"||P.edgeType==="self"||P.edgeType==="compound"){for(var S=P.allpts,C=0;C+5(A=Uc(t,e,S[C],S[C+1],S[C+2],S[C+3],S[C+4],S[C+5])))return y(x,A),!0}for(var L=L||M.source,z=z||M.target,k=n.getArrowWidth(N,O),F=[{name:"source",x:P.arrowStartX,y:P.arrowStartY,angle:P.srcArrowAngle},{name:"target",x:P.arrowEndX,y:P.arrowEndY,angle:P.tgtArrowAngle},{name:"mid-source",x:P.midX,y:P.midY,angle:P.midsrcArrowAngle},{name:"mid-target",x:P.midX,y:P.midY,angle:P.midtgtArrowAngle}],C=0;C0&&(g(L),g(z))}function m(x,M,P){return Mt(x,M,P)}function w(x,M){var P=x._private,N=c,O;M?O=M+"-":O="",x.boundingBox();var R=P.labelBounds[M||"main"],I=x.pstyle(O+"label").value,E=x.pstyle("text-events").strValue==="yes";if(!(!E||!I)){var A=m(P.rscratch,"labelX",M),S=m(P.rscratch,"labelY",M),C=m(P.rscratch,"labelAngle",M),L=x.pstyle(O+"text-margin-x").pfValue,z=x.pstyle(O+"text-margin-y").pfValue,k=R.x1-N-L,F=R.x2+N-L,H=R.y1-N-z,W=R.y2+N-z;if(C){var Q=Math.cos(C),K=Math.sin(C),Z=function(ee,te){return ee=ee-A,te=te-S,{x:ee*Q-te*K+A,y:ee*K+te*Q+S}},j=Z(k,H),re=Z(k,W),q=Z(F,H),U=Z(F,W),Y=[j.x+L,j.y+z,q.x+L,q.y+z,U.x+L,U.y+z,re.x+L,re.y+z];if(It(t,e,Y))return y(x),!0}else if(vr(R,t,e))return y(x),!0}}for(var T=o.length-1;T>=0;T--){var D=o[T];D.isNode()?g(D)||w(D):b(D)||w(D)||w(D,"source")||w(D,"target")}return s},Ir.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=this.cy.zoom(),o=2/i,s=[],u=Math.min(t,r),l=Math.max(t,r),f=Math.min(e,a),v=Math.max(e,a);t=u,r=l,e=f,a=v;var c=Rt({x1:t,y1:e,x2:r,y2:a}),h=[{x:c.x1,y:c.y1},{x:c.x2,y:c.y1},{x:c.x2,y:c.y2},{x:c.x1,y:c.y2}],d=[[h[0],h[1]],[h[1],h[2]],[h[2],h[3]],[h[3],h[0]]];function p(ee,te,ge){return Mt(ee,te,ge)}function y(ee,te){var ge=ee._private,Te=o,pe="";ee.boundingBox();var le=ge.labelBounds.main;if(!le)return null;var ce=p(ge.rscratch,"labelX",te),ve=p(ge.rscratch,"labelY",te),de=p(ge.rscratch,"labelAngle",te),me=ee.pstyle(pe+"text-margin-x").pfValue,ye=ee.pstyle(pe+"text-margin-y").pfValue,we=le.x1-Te-me,Me=le.x2+Te-me,Ie=le.y1-Te-ye,Be=le.y2+Te-ye;if(de){var Fe=Math.cos(de),oe=Math.sin(de),B=function(V,G){return V=V-ce,G=G-ve,{x:V*Fe-G*oe+ce,y:V*oe+G*Fe+ve}};return[B(we,Ie),B(Me,Ie),B(Me,Be),B(we,Be)]}else return[{x:we,y:Ie},{x:Me,y:Ie},{x:Me,y:Be},{x:we,y:Be}]}function g(ee,te,ge,Te){function pe(le,ce,ve){return(ve.y-le.y)*(ce.x-le.x)>(ce.y-le.y)*(ve.x-le.x)}return pe(ee,ge,Te)!==pe(te,ge,Te)&&pe(ee,te,ge)!==pe(ee,te,Te)}for(var b=0;b0?-(Math.PI-e.ang):Math.PI+e.ang},oy=function(e,r,a,n,i){if(e!==sv?uv(r,e,$t):iy(Vt,$t),uv(r,a,Vt),av=$t.nx*Vt.ny-$t.ny*Vt.nx,nv=$t.nx*Vt.nx-$t.ny*-Vt.ny,rr=Math.asin(Math.max(-1,Math.min(1,av))),Math.abs(rr)<1e-6){cs=r.x,ds=r.y,kr=fa=0;return}Br=1,_n=!1,nv<0?rr<0?rr=Math.PI+rr:(rr=Math.PI-rr,Br=-1,_n=!0):rr>0&&(Br=-1,_n=!0),r.radius!==void 0?fa=r.radius:fa=n,Fr=rr/2,Zn=Math.min($t.len/2,Vt.len/2),i?(Kt=Math.abs(Math.cos(Fr)*fa/Math.sin(Fr)),Kt>Zn?(Kt=Zn,kr=Math.abs(Kt*Math.sin(Fr)/Math.cos(Fr))):kr=fa):(Kt=Math.min(Zn,fa),kr=Math.abs(Kt*Math.sin(Fr)/Math.cos(Fr))),gs=r.x+Vt.nx*Kt,ps=r.y+Vt.ny*Kt,cs=gs-Vt.ny*kr*Br,ds=ps+Vt.nx*kr*Br,iv=r.x+$t.nx*Kt,ov=r.y+$t.ny*Kt,sv=r};function lv(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function ys(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(oy(t,e,r,a,n),{cx:cs,cy:ds,radius:kr,startX:iv,startY:ov,stopX:gs,stopY:ps,startAngle:$t.ang+Math.PI/2*Br,endAngle:Vt.ang-Math.PI/2*Br,counterClockwise:_n})}var Ya=.01,sy=Math.sqrt(2*Ya),Lt={};Lt.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),u=o.units!=null&&s.units!=null,l=function(T,D,x,M){var P=M-D,N=x-T,O=Math.sqrt(N*N+P*P);return{x:-P/O,y:N/O}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(u){var v=this.manualEndptToPx(t.source()[0],o),c=vt(v,2),h=c[0],d=c[1],p=this.manualEndptToPx(t.target()[0],s),y=vt(p,2),g=y[0],b=y[1],m={x1:h,y1:d,x2:g,y2:b};n=l(h,d,g,b),i=m}else Xe("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}},Lt.findHaystackPoints=function(t){for(var e=0;e0?Math.max(G-$,0):Math.min(G+$,0)},I=R(N,M),E=R(O,P),A=!1;b===l?g=Math.abs(I)>Math.abs(E)?n:a:b===u||b===s?(g=a,A=!0):(b===i||b===o)&&(g=n,A=!0);var S=g===a,C=S?E:I,L=S?O:N,z=Vi(L),k=!1;!(A&&(w||D))&&(b===s&&L<0||b===u&&L>0||b===i&&L>0||b===o&&L<0)&&(z*=-1,C=z*Math.abs(C),k=!0);var F;if(w){var H=T<0?1+T:T;F=H*C}else{var W=T<0?C:0;F=W+T*z}var Q=function(G){return Math.abs(G)=Math.abs(C)},K=Q(F),Z=Q(Math.abs(C)-Math.abs(F)),j=K||Z;if(j&&!k)if(S){var re=Math.abs(L)<=c/2,q=Math.abs(N)<=h/2;if(re){var U=(f.x1+f.x2)/2,Y=f.y1,X=f.y2;r.segpts=[U,Y,U,X]}else if(q){var ee=(f.y1+f.y2)/2,te=f.x1,ge=f.x2;r.segpts=[te,ee,ge,ee]}else r.segpts=[f.x1,f.y2]}else{var Te=Math.abs(L)<=v/2,pe=Math.abs(O)<=d/2;if(Te){var le=(f.y1+f.y2)/2,ce=f.x1,ve=f.x2;r.segpts=[ce,le,ve,le]}else if(pe){var de=(f.x1+f.x2)/2,me=f.y1,ye=f.y2;r.segpts=[de,me,de,ye]}else r.segpts=[f.x2,f.y1]}else if(S){var we=f.y1+F+(y?c/2*z:0),Me=f.x1,Ie=f.x2;r.segpts=[Me,we,Ie,we]}else{var Be=f.x1+F+(y?v/2*z:0),Fe=f.y1,oe=f.y2;r.segpts=[Be,Fe,Be,oe]}if(r.isRound){var B=t.pstyle("taxi-radius").value,_=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(B),r.isArcRadius=new Array(r.segpts.length/2).fill(_)}},Lt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,v=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,p=!be(r.startX)||!be(r.startY),y=!be(r.arrowStartX)||!be(r.arrowStartY),g=!be(r.endX)||!be(r.endY),b=!be(r.arrowEndX)||!be(r.arrowEndY),m=3,w=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=m*w,D=Mr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),x=DL.poolIndex()){var z=C;C=L,L=z}var k=I.srcPos=C.position(),F=I.tgtPos=L.position(),H=I.srcW=C.outerWidth(),W=I.srcH=C.outerHeight(),Q=I.tgtW=L.outerWidth(),K=I.tgtH=L.outerHeight(),Z=I.srcShape=r.nodeShapes[e.getNodeShape(C)],j=I.tgtShape=r.nodeShapes[e.getNodeShape(L)],re=I.srcCornerRadius=C.pstyle("corner-radius").value==="auto"?"auto":C.pstyle("corner-radius").pfValue,q=I.tgtCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,U=I.tgtRs=L._private.rscratch,Y=I.srcRs=C._private.rscratch;I.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var X=0;X=sy||(Ie=Math.sqrt(Math.max(Me*Me,Ya)+Math.max(we*we,Ya)));var Be=I.vector={x:Me,y:we},Fe=I.vectorNorm={x:Be.x/Ie,y:Be.y/Ie},oe={x:-Fe.y,y:Fe.x};I.nodesOverlap=!be(Ie)||j.checkPoint(le[0],le[1],0,Q,K,F.x,F.y,q,U)||Z.checkPoint(ve[0],ve[1],0,H,W,k.x,k.y,re,Y),I.vectorNormInverse=oe,E={nodesOverlap:I.nodesOverlap,dirCounts:I.dirCounts,calculatedIntersection:!0,hasBezier:I.hasBezier,hasUnbundled:I.hasUnbundled,eles:I.eles,srcPos:F,srcRs:U,tgtPos:k,tgtRs:Y,srcW:Q,srcH:K,tgtW:H,tgtH:W,srcIntn:de,tgtIntn:ce,srcShape:j,tgtShape:Z,posPts:{x1:ye.x2,y1:ye.y2,x2:ye.x1,y2:ye.y1},intersectionPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},vector:{x:-Be.x,y:-Be.y},vectorNorm:{x:-Fe.x,y:-Fe.y},vectorNormInverse:{x:-oe.x,y:-oe.y}}}var B=pe?E:I;te.nodesOverlap=B.nodesOverlap,te.srcIntn=B.srcIntn,te.tgtIntn=B.tgtIntn,te.isRound=ge.startsWith("round"),n&&(C.isParent()||C.isChild()||L.isParent()||L.isChild())&&(C.parents().anySame(L)||L.parents().anySame(C)||C.same(L)&&C.isParent())?e.findCompoundLoopPoints(ee,B,X,Te):C===L?e.findLoopPoints(ee,B,X,Te):ge.endsWith("segments")?e.findSegmentsPoints(ee,B):ge.endsWith("taxi")?e.findTaxiPoints(ee,B):ge==="straight"||!Te&&I.eles.length%2===1&&X===Math.floor(I.eles.length/2)?e.findStraightEdgePoints(ee):e.findBezierPoints(ee,B,X,Te,pe),e.findEndpoints(ee),e.tryToCorrectInvalidPoints(ee,B),e.checkForInvalidEdgeWarning(ee),e.storeAllpts(ee),e.storeEdgeProjections(ee),e.calculateArrowAngles(ee),e.recalculateEdgeLabelProjections(ee),e.calculateLabelAngles(ee)}},x=0;x0){var le=l,ce=Rr(le,$r(o)),ve=Rr(le,$r(pe)),de=ce;if(ve2){var me=Rr(le,{x:pe[2],y:pe[3]});me0){var ae=f,J=Rr(ae,$r(o)),ne=Rr(ae,$r($)),ie=J;if(ne2){var ue=Rr(ae,{x:$[2],y:$[3]});ue=d||x){y={cp:w,segment:D};break}}if(y)break}var M=y.cp,P=y.segment,N=(d-g)/P.length,O=P.t1-P.t0,R=h?P.t0+O*N:P.t1-O*N;R=Ma(0,R,1),e=Kr(M.p0,M.p1,M.p2,R),c=ly(M.p0,M.p1,M.p2,R);break}case"straight":case"segments":case"haystack":{for(var I=0,E,A,S,C,L=a.allpts.length,z=0;z+3=d));z+=2);var k=d-A,F=k/E;F=Ma(0,F,1),e=Rc(S,C,F),c=hv(S,C);break}}o("labelX",v,e.x),o("labelY",v,e.y),o("labelAutoAngle",v,c)}};l("source"),l("target"),this.applyLabelDimensions(t)}},_t.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},_t.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=Lr(a,t._private.labelDimsKey);if(Mt(r.rscratch,"prefixedLabelDimsKey",e)!==n){Wt(r.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("text-wrap").strValue,l=Mt(r.rscratch,"labelWrapCachedLines",e)||[],f=u!=="wrap"?1:Math.max(l.length,1),v=s*o,c=i.width,h=i.height+(f-1)*(o-1)*s;Wt(r.rstyle,"labelWidth",e,c),Wt(r.rscratch,"labelWidth",e,c),Wt(r.rstyle,"labelHeight",e,h),Wt(r.rscratch,"labelHeight",e,h),Wt(r.rscratch,"labelLineHeight",e,v),Wt(r.rscratch,"labelActualDescent",e,i.labelActualDescent)}},_t.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,o=function(W,Q){return Q?(Wt(r.rscratch,W,e,Q),Q):Mt(r.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var u=o("labelKey");if(u!=null&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l="​",f=n.split(` `),v=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],p=/[\s\u200b]+|$/g,y=0;yv){var T=g.matchAll(p),D="",x=0,M=Ot(T),P;try{for(M.s();!(P=M.n()).done;){var N=P.value,O=N[0],R=g.substring(x,N.index);x=N.index+O.length;var I=D.length===0?R:D+R+O,E=this.calculateLabelDimensions(t,I),A=E.width;A<=v?D+=R+O:(D&&d.push(D),D=R+O)}}catch(H){M.e(H)}finally{M.f()}D.match(/^[\s\u200b]+$/)||d.push(D)}else d.push(g)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(` `)),o("labelWrapKey",u)}else if(s==="ellipsis"){var S=t.pstyle("text-max-width").pfValue,C="",L="…",z=!1;if(this.calculateLabelDimensions(t,n).widthS)break;C+=n[k],k===n.length-1&&(z=!0)}return z||(C+=L),C}return n},_t.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;return e==="auto"?t.isNode()?Zg(r):"center":e},_t.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,i=0,o=t.pstyle("font-style").strValue,s=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,l=t.pstyle("font-weight").strValue,f=t.pstyle("text-metrics").strValue||"font",v=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=v.getContext("2d");var h=v.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}c.font="".concat(o," ").concat(l," ").concat(s,"px ").concat(u);for(var d=0,p=0,y=e.split(` `),g=y.length,b=0,m=0,w=0;w1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var u=0;u=t.desktopTapThreshold2}var qe=i(B);Ve&&(t.hoverData.tapholdCancelled=!0);var ke=function(){var yt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];yt.length===0?(yt.push(Ce[0]),yt.push(Ce[1])):(yt[0]+=Ce[0],yt[1]+=Ce[1])};V=!0,n(fe,["mousemove","vmousemove","tapdrag"],B,{x:J[0],y:J[1]});var Re=function(yt){return{originalEvent:B,type:yt,position:{x:J[0],y:J[1]}}},rt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||G.emit(Re("boxstart")),ue[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Ve){var Ke=Re("cxtdrag");he?he.emit(Ke):G.emit(Ke),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||fe!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit(Re("cxtdragout")),t.hoverData.cxtOver=fe,fe&&fe.emit(Re("cxtdragover")))}}else if(t.hoverData.dragging){if(V=!0,G.panningEnabled()&&G.userPanningEnabled()){var st;if(t.hoverData.justStartedPan){var Qe=t.hoverData.mdownPos;st={x:(J[0]-Qe[0])*$,y:(J[1]-Qe[1])*$},t.hoverData.justStartedPan=!1}else st={x:Ce[0]*$,y:Ce[1]*$};G.panBy(st),G.emit(Re("dragpan")),t.hoverData.dragged=!0}J=t.projectIntoViewport(B.clientX,B.clientY)}else if(ue[4]==1&&(he==null||he.pannable())){if(Ve){if(!t.hoverData.dragging&&G.boxSelectionEnabled()&&(qe||!G.panningEnabled()||!G.userPanningEnabled()))rt();else if(!t.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Et=o(he,t.hoverData.downs);Et&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ue[4]=0,t.data.bgActivePosistion=$r(ne),t.redrawHint("select",!0),t.redraw())}he&&he.pannable()&&he.active()&&he.unactivate()}}else{if(he&&he.pannable()&&he.active()&&he.unactivate(),(!he||!he.grabbed())&&fe!=se&&(se&&n(se,["mouseout","tapdragout"],B,{x:J[0],y:J[1]}),fe&&n(fe,["mouseover","tapdragover"],B,{x:J[0],y:J[1]}),t.hoverData.last=fe),he)if(Ve){if(G.boxSelectionEnabled()&&qe)he&&he.grabbed()&&(p(Ee),he.emit(Re("freeon")),Ee.emit(Re("free")),t.dragData.didDrag&&(he.emit(Re("dragfreeon")),Ee.emit(Re("dragfree")))),rt();else if(he&&he.grabbed()&&t.nodeIsDraggable(he)){var ft=!t.dragData.didDrag;ft&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||h(Ee,{inDragLayer:!0});var ut={x:0,y:0};if(be(Ce[0])&&be(Ce[1])&&(ut.x+=Ce[0],ut.y+=Ce[1],ft)){var lt=t.hoverData.dragDelta;lt&&be(lt[0])&&be(lt[1])&&(ut.x+=lt[0],ut.y+=lt[1])}t.hoverData.draggingEles=!0,Ee.silentShift(ut).emit(Re("position")).emit(Re("drag")),t.redrawHint("drag",!0),t.redraw()}}else ke();V=!0}if(ue[2]=J[0],ue[3]=J[1],V)return B.stopPropagation&&B.stopPropagation(),B.preventDefault&&B.preventDefault(),!1}},!1);var N,O,R;t.registerBinding(e,"mouseup",function(B){if(!(t.hoverData.which===1&&B.which!==1&&t.hoverData.capture)){var _=t.hoverData.capture;if(_){t.hoverData.capture=!1;var V=t.cy,G=t.projectIntoViewport(B.clientX,B.clientY),$=t.selection,ae=t.findNearestElement(G[0],G[1],!0,!1),J=t.dragData.possibleDragElements,ne=t.hoverData.down,ie=i(B);t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ne&&ne.unactivate();var ue=function(Ae){return{originalEvent:B,type:Ae,position:{x:G[0],y:G[1]}}};if(t.hoverData.which===3){var fe=ue("cxttapend");if(ne?ne.emit(fe):V.emit(fe),!t.hoverData.cxtDragged){var se=ue("cxttap");ne?ne.emit(se):V.emit(se)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(n(ae,["mouseup","tapend","vmouseup"],B,{x:G[0],y:G[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(n(ne,["click","tap","vclick"],B,{x:G[0],y:G[1]}),O=!1,B.timeStamp-R<=V.multiClickDebounceTime()?(N&&clearTimeout(N),O=!0,R=null,n(ne,["dblclick","dbltap","vdblclick"],B,{x:G[0],y:G[1]})):(N=setTimeout(function(){O||n(ne,["oneclick","onetap","voneclick"],B,{x:G[0],y:G[1]})},V.multiClickDebounceTime()),R=B.timeStamp)),ne==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!i(B)&&(V.$(r).unselect(["tapunselect"]),J.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=J=V.collection()),ae==ne&&!t.dragData.didDrag&&!t.hoverData.selecting&&ae!=null&&ae._private.selectable&&(t.hoverData.dragging||(V.selectionType()==="additive"||ie?ae.selected()?ae.unselect(["tapunselect"]):ae.select(["tapselect"]):ie||(V.$(r).unmerge(ae).unselect(["tapunselect"]),ae.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var he=V.collection(t.getAllInBox($[0],$[1],$[2],$[3]));t.redrawHint("select",!0),he.length>0&&t.redrawHint("eles",!0),V.emit(ue("boxend"));var Ce=function(Ae){return Ae.selectable()&&!Ae.selected()};V.selectionType()==="additive"||ie||V.$(r).unmerge(he).unselect(),he.emit(ue("box")).stdFilter(Ce).select().emit(ue("boxselect")),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!$[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Ee=ne&&ne.grabbed();p(J),Ee&&(ne.emit(ue("freeon")),J.emit(ue("free")),t.dragData.didDrag&&(ne.emit(ue("dragfreeon")),J.emit(ue("dragfree"))))}}$[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,t.hoverData.which=null}}},!1);var I=[],E=4,A,S=1e5,C=function(B){for(var _=Math.abs(B[0]),V=1;V=E){A=!1;var G=I;if(G[0]>=5){var $;C(G)?$=G[0]:$=Dc(G),$>1&&(A=!0,S=$)}}else I.push(Math.abs(V)),_=!0;else A&&(S=Math.min(Math.abs(V),S));if(!t.scrollingPage){var ae=t.cy,J=ae.zoom(),ne=ae.pan(),ie=t.projectIntoViewport(B.clientX,B.clientY),ue=[ie[0]*J+ne.x,ie[1]*J+ne.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||x()){B.preventDefault();return}if(ae.panningEnabled()&&ae.userPanningEnabled()&&ae.zoomingEnabled()&&ae.userZoomingEnabled()){B.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 fe;_&&Math.abs(V)>5&&(V=Vi(V)*5),fe=V/-250,A&&(fe/=S,fe*=3),fe=fe*t.wheelSensitivity;var se=B.deltaMode===1;se&&(fe*=33);var he=ae.zoom()*Math.pow(10,fe);B.type==="gesturechange"&&(he=t.gestureStartZoom*B.scale),ae.zoom({level:he,renderedPosition:{x:ue[0],y:ue[1]}}),ae.emit({type:B.type==="gesturechange"?"pinchzoom":"scrollzoom",originalEvent:B,position:{x:ie[0],y:ie[1]}})}}}};t.registerBinding(t.container,"wheel",L,!0),t.registerBinding(e,"scroll",function(B){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(B){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||B.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(oe){t.hasTouchStarted||L(oe)},!0),t.registerBinding(t.container,"mouseout",function(B){var _=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseout",position:{x:_[0],y:_[1]}})},!1),t.registerBinding(t.container,"mouseover",function(B){var _=t.projectIntoViewport(B.clientX,B.clientY);t.cy.emit({originalEvent:B,type:"mouseover",position:{x:_[0],y:_[1]}})},!1);var z,k,F,H,W,Q,K,Z,j,re,q,U,Y,X=function(B,_,V,G){return Math.sqrt((V-B)*(V-B)+(G-_)*(G-_))},ee=function(B,_,V,G){return(V-B)*(V-B)+(G-_)*(G-_)},te;t.registerBinding(t.container,"touchstart",te=function(B){if(t.hasTouchStarted=!0,!!M(B)){g(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var _=t.cy,V=t.touchData.now,G=t.touchData.earlier;if(B.touches[0]){var $=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);V[0]=$[0],V[1]=$[1]}if(B.touches[1]){var $=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);V[2]=$[0],V[3]=$[1]}if(B.touches[2]){var $=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);V[4]=$[0],V[5]=$[1]}var ae=function(qe){return{originalEvent:B,type:qe,position:{x:V[0],y:V[1]}}};if(B.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var J=t.findContainerClientCoords();j=J[0],re=J[1],q=J[2],U=J[3],z=B.touches[0].clientX-j,k=B.touches[0].clientY-re,F=B.touches[1].clientX-j,H=B.touches[1].clientY-re,Y=0<=z&&z<=q&&0<=F&&F<=q&&0<=k&&k<=U&&0<=H&&H<=U;var ne=_.pan(),ie=_.zoom();W=X(z,k,F,H),Q=ee(z,k,F,H),K=[(z+F)/2,(k+H)/2],Z=[(K[0]-ne.x)/ie,(K[1]-ne.y)/ie];var ue=200,fe=ue*ue;if(Q=1){for(var Se=t.touchData.startPosition=[null,null,null,null,null,null],Pe=0;Pe=t.touchTapThreshold2}if(_&&t.touchData.cxt){B.preventDefault();var Pe=B.touches[0].clientX-j,De=B.touches[0].clientY-re,xe=B.touches[1].clientX-j,qe=B.touches[1].clientY-re,ke=ee(Pe,De,xe,qe),Re=ke/Q,rt=150,Ke=rt*rt,st=1.5,Qe=st*st;if(Re>=Qe||ke>=Ke){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Et=ie("cxttapend");t.touchData.start?(t.touchData.start.unactivate().emit(Et),t.touchData.start=null):G.emit(Et)}}if(_&&t.touchData.cxt){var Et=ie("cxtdrag");t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Et):G.emit(Et),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ft=t.findNearestElement($[0],$[1],!0,!0);(!t.touchData.cxtOver||ft!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit(ie("cxtdragout")),t.touchData.cxtOver=ft,ft&&ft.emit(ie("cxtdragover")))}else if(_&&B.touches[2]&&G.boxSelectionEnabled())B.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||G.emit(ie("boxstart")),t.touchData.selecting=!0,t.touchData.didSelect=!0,V[4]=1,!V||V.length===0||V[0]===void 0?(V[0]=($[0]+$[2]+$[4])/3,V[1]=($[1]+$[3]+$[5])/3,V[2]=($[0]+$[2]+$[4])/3+1,V[3]=($[1]+$[3]+$[5])/3+1):(V[2]=($[0]+$[2]+$[4])/3,V[3]=($[1]+$[3]+$[5])/3),t.redrawHint("select",!0),t.redraw();else if(_&&B.touches[1]&&!t.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){B.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var ut=t.dragData.touchDragEles;if(ut){t.redrawHint("drag",!0);for(var lt=0;lt0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Te;t.registerBinding(e,"touchcancel",Te=function(B){var _=t.touchData.start;t.touchData.capture=!1,_&&_.unactivate()});var pe,le,ce,ve;if(t.registerBinding(e,"touchend",pe=function(B){var _=t.touchData.start,V=t.touchData.capture;if(V)B.touches.length===0&&(t.touchData.capture=!1),B.preventDefault();else return;var G=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var $=t.cy,ae=$.zoom(),J=t.touchData.now,ne=t.touchData.earlier;if(B.touches[0]){var ie=t.projectIntoViewport(B.touches[0].clientX,B.touches[0].clientY);J[0]=ie[0],J[1]=ie[1]}if(B.touches[1]){var ie=t.projectIntoViewport(B.touches[1].clientX,B.touches[1].clientY);J[2]=ie[0],J[3]=ie[1]}if(B.touches[2]){var ie=t.projectIntoViewport(B.touches[2].clientX,B.touches[2].clientY);J[4]=ie[0],J[5]=ie[1]}var ue=function(Ke){return{originalEvent:B,type:Ke,position:{x:J[0],y:J[1]}}};_&&_.unactivate();var fe;if(t.touchData.cxt){if(fe=ue("cxttapend"),_?_.emit(fe):$.emit(fe),!t.touchData.cxtDragged){var se=ue("cxttap");_?_.emit(se):$.emit(se)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!B.touches[2]&&$.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var he=$.collection(t.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,t.redrawHint("select",!0),$.emit(ue("boxend"));var Ce=function(Ke){return Ke.selectable()&&!Ke.selected()};he.emit(ue("box")).stdFilter(Ce).select().emit(ue("boxselect")),he.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(_!=null&&_.unactivate(),B.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!B.touches[1]){if(!B.touches[0]){if(!B.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ee=t.dragData.touchDragEles;if(_!=null){var Ve=_._private.grabbed;p(Ee),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ve&&(_.emit(ue("freeon")),Ee.emit(ue("free")),t.dragData.didDrag&&(_.emit(ue("dragfreeon")),Ee.emit(ue("dragfree")))),n(_,["touchend","tapend","vmouseup","tapdragout"],B,{x:J[0],y:J[1]}),_.unactivate(),t.touchData.start=null}else{var Ae=t.findNearestElement(J[0],J[1],!0,!0);n(Ae,["touchend","tapend","vmouseup","tapdragout"],B,{x:J[0],y:J[1]})}var Se=t.touchData.startPosition[0]-J[0],Pe=Se*Se,De=t.touchData.startPosition[1]-J[1],xe=De*De,qe=Pe+xe,ke=qe*ae*ae;t.touchData.singleTouchMoved||(_||$.$(":selected").unselect(["tapunselect"]),n(_,["tap","vclick"],B,{x:J[0],y:J[1]}),le=!1,B.timeStamp-ve<=$.multiClickDebounceTime()?(ce&&clearTimeout(ce),le=!0,ve=null,n(_,["dbltap","vdblclick"],B,{x:J[0],y:J[1]})):(ce=setTimeout(function(){le||n(_,["onetap","voneclick"],B,{x:J[0],y:J[1]})},$.multiClickDebounceTime()),ve=B.timeStamp)),_!=null&&!t.dragData.didDrag&&_._private.selectable&&ke"u"){var de=[],me=function(B){return{clientX:B.clientX,clientY:B.clientY,force:1,identifier:B.pointerId,pageX:B.pageX,pageY:B.pageY,radiusX:B.width/2,radiusY:B.height/2,screenX:B.screenX,screenY:B.screenY,target:B.target}},ye=function(B){return{event:B,touch:me(B)}},we=function(B){de.push(ye(B))},Me=function(B){for(var _=0;_0)return H[0]}return null},d=Object.keys(c),p=0;p0?h:Lu(i,o,e,r,a,n,s,u)},checkPoint:function(e,r,a,n,i,o,s,u){u=u==="auto"?cr(n,i):u;var l=2*u;if(tr(e,r,this.points,o,s,n,i-l,[0,-1],a)||tr(e,r,this.points,o,s,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,v=i/2+2*a,c=[o-f,s-v,o-f,s,o+f,s,o+f,s-v];return!!(It(e,r,c)||Nr(e,r,l,l,o+n/2-u,s+i/2-u,a)||Nr(e,r,l,l,o-n/2+u,s+i/2-u,a))}}},ar.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",Nt(3,0)),this.generateRoundPolygon("round-triangle",Nt(3,0)),this.generatePolygon("rectangle",Nt(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",Nt(5,0)),this.generateRoundPolygon("round-pentagon",Nt(5,0)),this.generatePolygon("hexagon",Nt(6,0)),this.generateRoundPolygon("round-hexagon",Nt(6,0)),this.generatePolygon("heptagon",Nt(7,0)),this.generateRoundPolygon("round-heptagon",Nt(7,0)),this.generatePolygon("octagon",Nt(8,0)),this.generateRoundPolygon("round-octagon",Nt(8,0));var a=new Array(20);{var n=Hi(5,0),i=Hi(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*w)break}else if(l){if(b>=e.deqCost*h||b>=e.deqAvgCost*c)break}else if(m>=e.deqNoDrawCost*bs)break;var T=e.deq(a,y,p);if(T.length>0)for(var D=0;D0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,y,p)&&i())},s=e.priority||Oi;n.beforeRender(o,s(a))}}}},cy=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vn;ir(this,t),this.idsByKey=new er,this.keyForId=new er,this.cachesByLvl=new er,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return or(t,[{key:"getIdsFor",value:function(r){r==null&&at("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Xr,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 er,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}}])}(),xv=25,jn=50,ei=-4,ws=3,Tv=7.99,dy=8,gy=1024,py=1024,yy=1024,my=.2,by=.8,wy=10,Ey=.15,xy=.1,Ty=.9,Cy=.9,Sy=100,Ay=1,ca={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Dy=xt({getKey:null,doesEleInvalidateKey:vn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:du,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),$a=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Dy(r);Oe(a,n),a.lookup=new cy(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},pt=$a.prototype;pt.reasons=ca,pt.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},pt.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a},pt.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new La(function(r,a){return a.reqs-r.reqs});return e},pt.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},pt.getElement=function(t,e,r,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),u=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(zi(s*r))),a=Tv||a>ws)return null;var l=Math.pow(2,a),f=e.h*l,v=e.w*l,c=o.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var h=u.get(t,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(f<=xv?d=xv:f<=jn?d=jn:d=Math.ceil(f/jn)*jn,f>yy||v>py)return null;var p=i.getTextureQueue(d),y=p[p.length-2],g=function(){return i.recycleTexture(d,v)||i.addTexture(d,v)};y||(y=p[p.length-1]),y||(y=g()),y.width-y.usedWidtha;O--)P=i.getElement(t,e,r,O,ca.downscale);N()}else return i.queueElement(t,D.level-1),D;else{var R;if(!m&&!w&&!T)for(var I=a-1;I>=ei;I--){var E=u.get(t,I);if(E){R=E;break}}if(b(R))return i.queueElement(t,a),R;y.context.translate(y.usedWidth,0),y.context.scale(l,l),this.drawElement(y.context,t,e,c,!1),y.context.scale(1/l,1/l),y.context.translate(-y.usedWidth,0)}return h={x:y.usedWidth,texture:y,level:a,scale:l,width:v,height:f,scaledLabelShown:c},y.usedWidth+=Math.ceil(v+dy),y.eleCaches.push(h),u.set(t,a,h),i.checkTextureFullness(y),h},pt.invalidateElements=function(t){for(var e=0;e=my*t.width&&this.retireTexture(t)},pt.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>by&&t.fullnessChecks>=wy?fr(r,t):t.fullnessChecks++},pt.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;fr(a,t),t.retired=!0;for(var i=t.eleCaches,o=0;o=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Ii(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),fr(n,o),a.push(o),o}},pt.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(t),o.reqs++,a.updateItem(o);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(s),n[i]=s}},pt.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o0;o++){var s=r.pop(),u=s.key,l=s.eles[0],f=i.hasCache(l,s.level);if(a[u]=null,f)continue;n.push(s);var v=e.getBoundingBox(l);e.getElement(l,v,t,s.level,ca.dequeue)}return n},pt.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=Pi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))},pt.onDequeue=function(t){this.onDequeues.push(t)},pt.offDequeue=function(t){fr(this.onDequeues,t)},pt.setupDequeueing=Ev.setupDequeueing({deqRedrawThreshold:Sy,deqCost:Ey,deqAvgCost:xy,deqNoDrawCost:Ty,deqFastCost:Cy,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a=My||r>ti)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],v,c=a.levelIsComplete(r,t),h,d=function(){var N=function(A){if(a.validateLayersElesOrdering(A,t),a.levelIsComplete(A,t))return h=u[A],!0},O=function(A){if(!h)for(var S=r+A;Ka<=S&&S<=ti&&!N(S);S+=A);};O(1),O(-1);for(var R=f.length-1;R>=0;R--){var I=f[R];I.invalid&&fr(f,I)}};if(!c)d();else return f;var p=function(){if(!v){v=Rt();for(var N=0;NSv||I>Sv)return null;var E=R*I;if(E>ky)return null;var A=a.makeLayer(v,r);if(O!=null){var S=f.indexOf(O)+1;f.splice(S,0,A)}else(N.insert===void 0||N.insert)&&f.unshift(A);return A};if(a.skipping&&!s)return null;for(var g=null,b=t.length/Ly,m=!s,w=0;w=b||!Du(g.bb,T.boundingBox()))&&(g=y({insert:!0,after:g}),!g))return null;h||m?a.queueLayer(g,T):a.drawEleInLayer(g,T,r,e),g.eles.push(T),x[r]=g}return h||(m?null:f)},St.getEleLevelForLayerLevel=function(t,e){return t},St.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,o=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,r,zy),i.setImgSmoothing(o,!0))},St.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||o.invalid)return!1;n+=o.eles.length}return n===e.length},St.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a0){e=!0;break}}return e},St.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=jt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))},St.invalidateLayer=function(t){if(this.lastInvalidationTime=jt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];fr(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,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,v=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,p=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,g=l*f,b=l*f,m=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;v==="straight-triangle"?(o.eleStrokeStyle(t,e,A),o.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=h,t.lineCap=d,o.eleStrokeStyle(t,e,A),o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},w=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(t.lineWidth=h+p,t.lineCap=d,p>0)o.colorStrokeStyle(t,y[0],y[1],y[2],A);else{t.lineCap="butt";return}v==="straight-triangle"?o.drawEdgeTrianglePath(e,t,s.allpts):(o.drawEdgePath(e,t,s.allpts,c),t.lineCap="butt")},T=function(){n&&o.drawEdgeOverlay(t,e)},D=function(){n&&o.drawEdgeUnderlay(t,e)},x=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;o.drawArrowheads(t,e,A)},M=function(){o.drawElementText(t,e,null,a)};t.lineJoin="round";var P=e.pstyle("ghost").value==="yes";if(P){var N=e.pstyle("ghost-offset-x").pfValue,O=e.pstyle("ghost-offset-y").pfValue,R=e.pstyle("ghost-opacity").value,I=g*R;t.translate(N,O),m(I),x(I),t.translate(-N,-O)}else w();D(),m(),x(),T(),M(),r&&t.translate(u.x1,u.y1)}};var Nv=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,o=i.usePaths(),s=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,s.edgeType==="self"&&!o?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,s.allpts,"solid")}}}};nr.drawEdgeOverlay=Nv("overlay"),nr.drawEdgeUnderlay=Nv("underlay"),nr.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,o,s=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var v=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===v;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=v,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!s&&!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 h=2;h+35&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var u=o.getLabelJustification(e),l=e.pstyle("text-metrics").strValue==="glyph";t.textAlign=u,t.textBaseline=l?"alphabetic":"bottom"}else{var f=e.element()._private.rscratch.badLine,v=e.pstyle("label"),c=e.pstyle("source-label"),h=e.pstyle("target-label");if(f||(!v||!v.value)&&(!c||!c.value)&&(!h||!h.value))return;t.textAlign="center",t.textBaseline="bottom"}var d=!r,p;r&&(p=r,t.translate(-p.x1,-p.y1)),n==null?(o.drawText(t,e,null,d,i),e.isEdge()&&(o.drawText(t,e,"source",d,i),o.drawText(t,e,"target",d,i))):o.drawText(t,e,n,d,i),r&&t.translate(p.x1,p.y1)},zr.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,o=e.pstyle("font-weight").strValue,s=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*s,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+o+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],s),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function _y(t,e,r,a,n){var i=Math.min(a,n),o=i/2,s=e+a/2,u=r+n/2;t.beginPath(),t.arc(s,u,o,0,Math.PI*2),t.closePath()}function Pv(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=Math.min(i,a/2,n/2);t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath()}zr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",o=t.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=Mt(n,"labelAngle",e);r=t.isEdge()?s:0}else o.strValue==="none"?r=0:r=o.pfValue;return r},zr.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,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=Mt(o,"labelX",r),l=Mt(o,"labelY",r),f,v,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var h=r?r+"-":"",d=Mt(o,"labelWidth",r),p=Mt(o,"labelHeight",r),y=Mt(o,"labelActualDescent",r),g=e.pstyle(h+"text-margin-x").pfValue,b=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),w=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;m&&(w="center",T="center"),u+=g,l+=b;var D;a?D=this.getTextAngle(e,r):D=0,D!==0&&(f=u,v=l,t.translate(f,v),t.rotate(D),u=0,l=0);var x=aa(w),M=na(T);switch(M){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p;break}var P=e.pstyle("text-background-opacity").value,N=e.pstyle("text-border-opacity").value,O=e.pstyle("text-border-width").pfValue,R=e.pstyle("text-background-padding").pfValue,I=e.pstyle("text-background-shape").strValue,E=I==="round-rectangle"||I==="roundrectangle",A=I==="circle",S=2;if(P>0||O>0&&N>0){var C=t.fillStyle,L=t.strokeStyle,z=t.lineWidth,k=e.pstyle("text-background-color").value,F=e.pstyle("text-border-color").value,H=e.pstyle("text-border-style").value,W=P>0,Q=O>0&&N>0,K=u-R;switch(x){case"left":K-=d;break;case"center":K-=d/2;break}var Z=l-p-R,j=d+2*R,re=p+2*R;if(W&&(t.fillStyle="rgba(".concat(k[0],",").concat(k[1],",").concat(k[2],",").concat(P*s,")")),Q&&(t.strokeStyle="rgba(".concat(F[0],",").concat(F[1],",").concat(F[2],",").concat(N*s,")"),t.lineWidth=O,t.setLineDash))switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=O/4,t.setLineDash([]);break;case"solid":default:t.setLineDash([]);break}if(E?(t.beginPath(),Pv(t,K,Z,j,re,S)):A?(t.beginPath(),_y(t,K,Z,j,re)):(t.beginPath(),t.rect(K,Z,j,re)),W&&t.fill(),Q&&t.stroke(),Q&&H==="double"){var q=O/2;t.beginPath(),E?Pv(t,K+q,Z+q,j-2*q,re-2*q,S):t.rect(K+q,Z+q,j-2*q,re-2*q),t.stroke()}t.fillStyle=C,t.strokeStyle=L,t.lineWidth=z,t.setLineDash&&t.setLineDash([])}var U=2*e.pstyle("text-outline-width").pfValue;if(U>0&&(t.lineWidth=U),l-=y,e.pstyle("text-wrap").value==="wrap"){var Y=Mt(o,"labelWrapCachedLines",r),X=Mt(o,"labelLineHeight",r),ee=d/2,te=this.getLabelJustification(e);switch(te==="auto"||(x==="left"?te==="left"?u+=-d:te==="center"&&(u+=-ee):x==="center"?te==="left"?u+=-ee:te==="right"&&(u+=ee):x==="right"&&(te==="center"?u+=ee:te==="right"&&(u+=d))),M){case"top":l-=(Y.length-1)*X;break;case"center":case"bottom":l-=(Y.length-1)*X;break}for(var ge=0;ge0&&t.strokeText(Y[ge],u,l),t.fillText(Y[ge],u,l),l+=X}else U>0&&t.strokeText(c,u,l),t.fillText(c,u,l);D!==0&&(t.rotate(-D),t.translate(-f,-v))}}};var xr={};xr.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,o=this,s,u,l=e._private,f=l.rscratch,v=e.position();if(!(!be(v.x)||!be(v.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,p=!1,y=e.padding();s=e.width()+2*y,u=e.height()+2*y;var g;r&&(g=r,t.translate(-g.x1,-g.y1));for(var b=e.pstyle("background-image"),m=b.value,w=new Array(m.length),T=new Array(m.length),D=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:I;o.eleFillStyle(t,e,_)},q=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(t,E[0],E[1],E[2],_)},U=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;o.colorStrokeStyle(t,W[0],W[1],W[2],_)},Y=function(_,V,G,$){var ae=o.nodePathCache=o.nodePathCache||[],J=hu(G==="polygon"?G+","+$.join(","):G,""+V,""+_,""+j),ne=ae[J],ie,ue=!1;return ne!=null?(ie=ne,ue=!0,f.pathCache=ie):(ie=new Path2D,ae[J]=f.pathCache=ie),{path:ie,cacheHit:ue}},X=e.pstyle("shape").strValue,ee=e.pstyle("shape-polygon-points").pfValue;if(h){t.translate(v.x,v.y);var te=Y(s,u,X,ee);d=te.path,p=te.cacheHit}var ge=function(){if(!p){var _=v;h&&(_={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||t,_.x,_.y,s,u,j,f)}h?t.fill(d):t.fill()},Te=function(){for(var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,G=l.backgrounding,$=0,ae=0;ae0&&arguments[0]!==void 0?arguments[0]:!1,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(t,e,V),_&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},le=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasStripe(e)&&(t.save(),h?t.clip(f.pathCache):(o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f),t.clip()),o.drawStripe(t,e,V),t.restore(),_&&(h||o.nodeShapes[o.getNodeShape(e)].draw(t,v.x,v.y,s,u,j,f)))},ce=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=(O>0?O:-O)*_,G=O>0?0:255;O!==0&&(o.colorFillStyle(t,G,G,G,V),h?t.fill(d):t.fill())},ve=function(){if(R>0){if(t.lineWidth=R,t.lineCap=C,t.lineJoin=S,t.setLineDash)switch(A){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(z),t.lineDashOffset=k;break;case"solid":case"double":t.setLineDash([]);break}if(L!=="center"){if(t.save(),t.lineWidth*=2,L==="inside")h?t.clip(d):t.clip();else{var _=new Path2D;_.rect(-s/2-R,-u/2-R,s+2*R,u+2*R),_.addPath(d),t.clip(_,"evenodd")}h?t.stroke(d):t.stroke(),t.restore()}else h?t.stroke(d):t.stroke();if(A==="double"){t.lineWidth=R/3;var V=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(d):t.stroke(),t.globalCompositeOperation=V}t.setLineDash&&t.setLineDash([])}},de=function(){if(H>0){if(t.lineWidth=H,t.lineCap="butt",t.setLineDash)switch(Q){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var _=v;h&&(_={x:0,y:0});var V=o.getNodeShape(e),G=R;L==="inside"&&(G=0),L==="outside"&&(G*=2);var $=(s+G+(H+Z))/s,ae=(u+G+(H+Z))/u,J=s*$,ne=u*ae,ie=o.nodeShapes[V].points,ue;if(h){var fe=Y(J,ne,V,ie);ue=fe.path}if(V==="ellipse")o.drawEllipsePath(ue||t,_.x,_.y,J,ne);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(V)){var se=0,he=0,Ce=0;V==="round-diamond"?se=(G+Z+H)*1.4:V==="round-heptagon"?(se=(G+Z+H)*1.075,Ce=-(G/2+Z+H)/35):V==="round-hexagon"?se=(G+Z+H)*1.12:V==="round-pentagon"?(se=(G+Z+H)*1.13,Ce=-(G/2+Z+H)/15):V==="round-tag"?(se=(G+Z+H)*1.12,he=(G/2+H+Z)*.07):V==="round-triangle"&&(se=(G+Z+H)*(Math.PI/2),Ce=-(G+Z/2+H)/Math.PI),se!==0&&($=(s+se)/s,J=s*$,["round-hexagon","round-tag"].includes(V)||(ae=(u+se)/u,ne=u*ae)),j=j==="auto"?Ru(J,ne):j;for(var Ee=J/2,Ve=ne/2,Ae=j+(G+H+Z)/2,Se=new Array(ie.length/2),Pe=new Array(ie.length/2),De=0;De0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(r,f[0],f[1],f[2],l),s.nodeShapes[v].draw(r,n.x,n.y,i+u*2,o+u*2,c),r.fill()}}}};xr.drawNodeOverlay=Ov("overlay"),xr.drawNodeUnderlay=Ov("underlay"),xr.hasPie=function(t){return t=t[0],t._private.hasPie},xr.hasStripe=function(t){return t=t[0],t._private.hasStripe},xr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=e.pstyle("pie-hole"),s=e.pstyle("pie-start-angle").pfValue,u=a.x,l=a.y,f=e.width(),v=e.height(),c=Math.min(f,v)/2,h,d=0,p=this.usePaths();if(p&&(u=0,l=0),i.units==="%"?c=c*i.pfValue:i.pfValue!==void 0&&(c=i.pfValue/2),o.units==="%"?h=c*o.pfValue:o.pfValue!==void 0&&(h=o.pfValue/2),!(h>=c))for(var y=1;y<=n.pieBackgroundN;y++){var g=e.pstyle("pie-"+y+"-background-size").value,b=e.pstyle("pie-"+y+"-background-color").value,m=e.pstyle("pie-"+y+"-background-opacity").value*r,w=g/100;w+d>1&&(w=1-d);var T=1.5*Math.PI+2*Math.PI*d;T+=s;var D=2*Math.PI*w,x=T+D;g===0||d>=1||d+w>1||(h===0?(t.beginPath(),t.moveTo(u,l),t.arc(u,l,c,T,x),t.closePath()):(t.beginPath(),t.arc(u,l,c,T,x),t.arc(u,l,h,x,T,!0),t.closePath()),this.colorFillStyle(t,b[0],b[1],b[2],m),t.fill(),d+=w)}},xr.drawStripe=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=a.x,o=a.y,s=e.width(),u=e.height(),l=0,f=this.usePaths();t.save();var v=e.pstyle("stripe-direction").value,c=e.pstyle("stripe-size");switch(v){case"vertical":break;case"righward":t.rotate(-Math.PI/2);break}var h=s,d=u;c.units==="%"?(h=h*c.pfValue,d=d*c.pfValue):c.pfValue!==void 0&&(h=c.pfValue,d=c.pfValue),f&&(i=0,o=0),o-=h/2,i-=d/2;for(var p=1;p<=n.stripeBackgroundN;p++){var y=e.pstyle("stripe-"+p+"-background-size").value,g=e.pstyle("stripe-"+p+"-background-color").value,b=e.pstyle("stripe-"+p+"-background-opacity").value*r,m=y/100;m+l>1&&(m=1-l),!(y===0||l>=1||l+m>1)&&(t.beginPath(),t.rect(i,o+d*l,h,d*m),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],b),t.fill(),l+=m)}t.restore()};var Pt={},Zy=100;Pt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r},Pt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;ne.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!v&&(f[e.NODE]=!0,f[e.SELECT_BOX]=!0);var b=r.style(),m=r.zoom(),w=o!==void 0?o:m,T=r.pan(),D={x:T.x,y:T.y},x={zoom:m,pan:{x:T.x,y:T.y}},M=e.prevViewport,P=M===void 0||x.zoom!==M.zoom||x.pan.x!==M.pan.x||x.pan.y!==M.pan.y;!P&&!(p&&!d)&&(e.motionBlurPxRatio=1),s&&(D=s),w*=u,D.x*=u,D.y*=u;var N=e.getCachedZSortedEles();function O(q,U,Y,X,ee){var te=q.globalCompositeOperation;q.globalCompositeOperation="destination-out",e.colorFillStyle(q,255,255,255,e.motionBlurTransparency),q.fillRect(U,Y,X,ee),q.globalCompositeOperation=te}function R(q,U){var Y,X,ee,te;!e.clearingMotionBlur&&(q===l.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||q===l.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?(Y={x:T.x*h,y:T.y*h},X=m*h,ee=e.canvasWidth*h,te=e.canvasHeight*h):(Y=D,X=w,ee=e.canvasWidth,te=e.canvasHeight),q.setTransform(1,0,0,1,0,0),U==="motionBlur"?O(q,0,0,ee,te):!a&&(U===void 0||U)&&q.clearRect(0,0,ee,te),n||(q.translate(Y.x,Y.y),q.scale(X,X)),s&&q.translate(s.x,s.y),o&&q.scale(o,o)}if(v||(e.textureDrawLastFrame=!1),v){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=r.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var I=e.data.bufferContexts[e.TEXTURE_BUFFER];I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:I,drawOnlyNodeLayer:!0,forcedPxRatio:u*e.textureMult});var x=e.textureCache.viewport={zoom:r.zoom(),pan:r.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}f[e.DRAG]=!1,f[e.NODE]=!1;var E=l.contexts[e.NODE],A=e.textureCache.texture,x=e.textureCache.viewport;E.setTransform(1,0,0,1,0,0),c?O(E,0,0,x.width,x.height):E.clearRect(0,0,x.width,x.height);var S=b.core("outside-texture-bg-color").value,C=b.core("outside-texture-bg-opacity").value;e.colorFillStyle(E,S[0],S[1],S[2],C),E.fillRect(0,0,x.width,x.height);var m=r.zoom();R(E,!1),E.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),E.drawImage(A,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else e.textureOnViewport&&!a&&(e.textureCache=null);var L=r.extent(),z=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),k=e.hideEdgesOnViewport&&z,F=[];if(F[e.NODE]=!f[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,F[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),F[e.DRAG]=!f[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,F[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),f[e.NODE]||n||i||F[e.NODE]){var H=c&&!F[e.NODE]&&h!==1,E=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:l.contexts[e.NODE]),W=c&&!H?"motionBlur":void 0;R(E,W),k?e.drawCachedNodes(E,N.nondrag,u,L):e.drawLayeredElements(E,N.nondrag,u,L),e.debug&&e.drawDebugPoints(E,N.nondrag),!n&&!c&&(f[e.NODE]=!1)}if(!i&&(f[e.DRAG]||n||F[e.DRAG])){var H=c&&!F[e.DRAG]&&h!==1,E=a||(H?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:l.contexts[e.DRAG]);R(E,c&&!H?"motionBlur":void 0),k?e.drawCachedNodes(E,N.drag,u,L):e.drawCachedElements(E,N.drag,u,L),e.debug&&e.drawDebugPoints(E,N.drag),!n&&!c&&(f[e.DRAG]=!1)}if(this.drawSelectionRectangle(t,R),c&&h!==1){var Q=l.contexts[e.NODE],K=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Z=l.contexts[e.DRAG],j=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],re=function(U,Y,X){U.setTransform(1,0,0,1,0,0),X||!g?U.clearRect(0,0,e.canvasWidth,e.canvasHeight):O(U,0,0,e.canvasWidth,e.canvasHeight);var ee=h;U.drawImage(Y,0,0,e.canvasWidth*ee,e.canvasHeight*ee,0,0,e.canvasWidth,e.canvasHeight)};(f[e.NODE]||F[e.NODE])&&(re(Q,K,F[e.NODE]),f[e.NODE]=!1),(f[e.DRAG]||F[e.DRAG])&&(re(Z,j,F[e.DRAG]),f[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!v,e.mbFrames=0,f[e.NODE]=!0,f[e.DRAG]=!0,e.redraw()},Zy)),a||r.emit("render")};var _a;Pt.drawSelectionRectangle=function(t,e){var r=this,a=r.cy,n=r.data,i=a.style(),o=t.drawOnlyNodeLayer,s=t.drawAllLayers,u=n.canvasNeedsRedraw,l=t.forcedContext;if(r.showFps||!o&&u[r.SELECT_BOX]&&!s){var f=l||n.contexts[r.SELECT_BOX];if(e(f),r.selection[4]==1&&(r.hoverData.selecting||r.touchData.selecting)){var v=r.cy.zoom(),c=i.core("selection-box-border-width").value/v;f.lineWidth=c,f.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",f.fillRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]),c>0&&(f.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",f.strokeRect(r.selection[0],r.selection[1],r.selection[2]-r.selection[0],r.selection[3]-r.selection[1]))}if(n.bgActivePosistion&&!r.hoverData.selecting){var v=r.cy.zoom(),h=n.bgActivePosistion;f.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",f.beginPath(),f.arc(h.x,h.y,i.core("active-bg-size").pfValue/v,0,2*Math.PI),f.fill()}var d=r.lastRedrawTime;if(r.showFps&&d){d=Math.round(d);var p=Math.round(1e3/d),y="1 frame = "+d+" ms = "+p+" fps";if(f.setTransform(1,0,0,1,0,0),f.fillStyle="rgba(255, 0, 0, 0.75)",f.strokeStyle="rgba(255, 0, 0, 0.75)",f.font="30px Arial",!_a){var g=f.measureText(y);_a=g.actualBoundingBoxAscent}f.fillText(y,0,_a);var b=60;f.strokeRect(0,_a+10,250,20),f.fillRect(0,_a+10,250*Math.min(p/b,1),20)}s||(u[r.SELECT_BOX]=!1)}};function Iv(t,e,r){var a=t.createShader(e);if(t.shaderSource(a,r),t.compileShader(a),!t.getShaderParameter(a,t.COMPILE_STATUS))throw new Error(t.getShaderInfoLog(a));return a}function Qy(t,e,r){var a=Iv(t,t.VERTEX_SHADER,e),n=Iv(t,t.FRAGMENT_SHADER,r),i=t.createProgram();if(t.attachShader(i,a),t.attachShader(i,n),t.linkProgram(i),!t.getProgramParameter(i,t.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function Jy(t,e,r){r===void 0&&(r=e);var a=t.makeOffscreenCanvas(e,r),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function Ts(t){var e=t.pixelRatio,r=t.cy.zoom(),a=t.cy.pan();return{zoom:r*e,pan:{x:a.x*e,y:a.y*e}}}function jy(t){var e=t.pixelRatio,r=t.cy.zoom();return r*e}function em(t,e,r,a,n){var i=a*r+e.x,o=n*r+e.y;return o=Math.round(t.canvasHeight-o),[i,o]}function tm(t,e){return e.picking?!0:t.pstyle("background-fill").value!=="solid"||t.pstyle("background-image").strValue!=="none"?!1:t.pstyle("border-width").value===0||t.pstyle("border-opacity").value===0?!0:t.pstyle("border-style").value==="solid"}function rm(t,e){if(t.length!==e.length)return!1;for(var r=0;r>0&255)/255,r[1]=(t>>8&255)/255,r[2]=(t>>16&255)/255,r[3]=(t>>24&255)/255,r}function am(t){return t[0]+(t[1]<<8)+(t[2]<<16)+(t[3]<<24)}function nm(t,e){var r=t.createTexture();return r.buffer=function(a){t.bindTexture(t.TEXTURE_2D,r),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_NEAREST),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,a),t.generateMipmap(t.TEXTURE_2D),t.bindTexture(t.TEXTURE_2D,null)},r.deleteTexture=function(){t.deleteTexture(r)},r}function Bv(t,e){switch(e){case"float":return[1,t.FLOAT,4];case"vec2":return[2,t.FLOAT,4];case"vec3":return[3,t.FLOAT,4];case"vec4":return[4,t.FLOAT,4];case"int":return[1,t.INT,4];case"ivec2":return[2,t.INT,4]}}function Fv(t,e,r){switch(e){case t.FLOAT:return new Float32Array(r);case t.INT:return new Int32Array(r)}}function im(t,e,r,a,n,i){switch(e){case t.FLOAT:return new Float32Array(r.buffer,i*a,n);case t.INT:return new Int32Array(r.buffer,i*a,n)}}function om(t,e,r,a){var n=Bv(t,e),i=vt(n,2),o=i[0],s=i[1],u=Fv(t,s,a),l=t.createBuffer();return t.bindBuffer(t.ARRAY_BUFFER,l),t.bufferData(t.ARRAY_BUFFER,u,t.STATIC_DRAW),s===t.FLOAT?t.vertexAttribPointer(r,o,s,!1,0,0):s===t.INT&&t.vertexAttribIPointer(r,o,s,0,0),t.enableVertexAttribArray(r),t.bindBuffer(t.ARRAY_BUFFER,null),l}function Qt(t,e,r,a){var n=Bv(t,r),i=vt(n,3),o=i[0],s=i[1],u=i[2],l=Fv(t,s,e*o),f=o*u,v=t.createBuffer();t.bindBuffer(t.ARRAY_BUFFER,v),t.bufferData(t.ARRAY_BUFFER,e*f,t.DYNAMIC_DRAW),t.enableVertexAttribArray(a),s===t.FLOAT?t.vertexAttribPointer(a,o,s,!1,f,0):s===t.INT&&t.vertexAttribIPointer(a,o,s,f,0),t.vertexAttribDivisor(a,1),t.bindBuffer(t.ARRAY_BUFFER,null);for(var c=new Array(e),h=0;ho&&(s=o/a,u=a*s,l=n*s),{scale:s,texW:u,texH:l}}},{key:"draw",value:function(r,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,u=this.texHeight,l=this.getScale(a),f=l.scale,v=l.texW,c=l.texH,h=function(m,w){if(n&&w){var T=w.context,D=m.x,x=m.row,M=D,P=u*x;T.save(),T.translate(M,P),T.scale(f,f),n(T,a),T.restore()}},d=[null,null],p=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*u,w:v,h:c},d[1]={x:i.freePointer.x+v,y:i.freePointer.row*u,w:0,h:c},i.freePointer.x+=v,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},y=function(){var m=i.scratch,w=i.canvas;m.clear(),h({x:0,row:0},m);var T=o-i.freePointer.x,D=v-T,x=u;{var M=i.freePointer.x,P=i.freePointer.row*u,N=T;w.context.drawImage(m,0,0,N,x,M,P,N,x),d[0]={x:M,y:P,w:N,h:c}}{var O=T,R=(i.freePointer.row+1)*u,I=D;w&&w.context.drawImage(m,O,0,I,x,0,R,I,x),d[1]={x:0,y:R,w:I,h:c}}i.freePointer.x=D,i.freePointer.row++},g=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+v<=o)p();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(g(),p()):this.enableWrapping?y():(g(),p())}return this.keyToLocation.set(r,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(r){return this.keyToLocation.get(r)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(r){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(r),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row1&&arguments[1]!==void 0?arguments[1]:{},i=n.forceRedraw,o=i===void 0?!1:i,s=n.filterEle,u=s===void 0?function(){return!0}:s,l=n.filterType,f=l===void 0?function(){return!0}:l,v=!1,c=!1,h=Ot(r),d;try{for(h.s();!(d=h.n()).done;){var p=d.value;if(u(p)){var y=Ot(this.renderTypes.values()),g;try{var b=function(){var w=g.value,T=w.type;if(f(T)){var D=a.collections.get(w.collection),x=w.getKey(p),M=Array.isArray(x)?x:[x];if(o)M.forEach(function(R){return D.markKeyForGC(R)}),c=!0;else{var P=w.getID?w.getID(p):p.id(),N=a._key(T,P),O=a.typeAndIdToKey.get(N);O!==void 0&&!rm(M,O)&&(v=!0,a.typeAndIdToKey.delete(N),O.forEach(function(R){return D.markKeyForGC(R)}))}}};for(y.s();!(g=y.n()).done;)b()}catch(m){y.e(m)}finally{y.f()}}}}catch(m){h.e(m)}finally{h.f()}return c&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var r=Ot(this.collections.values()),a;try{for(r.s();!(a=r.n()).done;){var n=a.value;n.gc()}}catch(i){r.e(i)}finally{r.f()}}},{key:"getOrCreateAtlas",value:function(r,a,n,i){var o=this.renderTypes.get(a),s=this.collections.get(o.collection),u=!1,l=s.draw(i,n,function(c){o.drawClipped?(c.save(),c.beginPath(),c.rect(0,0,n.w,n.h),c.clip(),o.drawElement(c,r,n,!0,!0),c.restore()):o.drawElement(c,r,n,!0,!0),u=!0});if(u){var f=o.getID?o.getID(r):r.id(),v=this._key(a,f);this.typeAndIdToKey.has(v)?this.typeAndIdToKey.get(v).push(i):this.typeAndIdToKey.set(v,[i])}return l}},{key:"getAtlasInfo",value:function(r,a){var n=this,i=this.renderTypes.get(a),o=i.getKey(r),s=Array.isArray(o)?o:[o];return s.map(function(u){var l=i.getBoundingBox(r,u),f=n.getOrCreateAtlas(r,a,l,u),v=f.getOffsets(u),c=vt(v,2),h=c[0],d=c[1];return{atlas:f,tex:h,tex1:h,tex2:d,bb:l}})}},{key:"getDebugInfo",value:function(){var r=[],a=Ot(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=vt(n.value,2),o=i[0],s=i[1],u=s.getCounts(),l=u.keyCount,f=u.atlasCount;r.push({type:o,keyCount:l,atlasCount:f})}}catch(v){a.e(v)}finally{a.f()}return r}}])}(),gm=function(){function t(e){ir(this,t),this.globalOptions=e,this.atlasSize=e.webglTexSize,this.maxAtlasesPerBatch=e.webglTexPerBatch,this.batchAtlases=[]}return or(t,[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(r,a){return a})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(r){return this.batchAtlases.length===this.maxAtlasesPerBatch?this.batchAtlases.includes(r):!0}},{key:"getAtlasIndexForBatch",value:function(r){var a=this.batchAtlases.indexOf(r);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(r),a=this.batchAtlases.length-1}return a}}])}(),pm=` float circleSD(vec2 p, float r) { return distance(vec2(0), p) - r; // signed distance } `,ym=` float rectangleSD(vec2 p, vec2 b) { vec2 d = abs(p)-b; return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); } `,mm=` float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; cr.x = (p.y > 0.0) ? cr.x : cr.y; vec2 q = abs(p) - b + cr.x; return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; } `,bm=` float ellipseSD(vec2 p, vec2 ab) { p = abs( p ); // symmetry // find root with Newton solver vec2 q = ab*(p-ab); float w = (q.x1.0) ? d : -d; } `,Za={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},ai={IGNORE:1,USE_BB:2},As=0,Gv=1,Uv=2,Ds=3,ga=4,ni=5,Qa=6,Ja=7,wm=function(){function t(e,r,a){ir(this,t),this.r=e,this.gl=r,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=Jy,this.atlasManager=new dm(e,a),this.batchManager=new gm(a),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(Za.SCREEN),this.pickingProgram=this._createShaderProgram(Za.PICKING),this.vao=this._createVAO()}return or(t,[{key:"addAtlasCollection",value:function(r,a){this.atlasManager.addAtlasCollection(r,a)}},{key:"addTextureAtlasRenderType",value:function(r,a){this.atlasManager.addRenderType(r,a)}},{key:"addSimpleShapeRenderType",value:function(r,a){this.simpleShapeOptions.set(r,a)}},{key:"invalidate",value:function(r){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(r,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(r)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(r){var a=this.gl,n=`#version 300 es precision highp float; uniform mat3 uPanZoomMatrix; uniform int uAtlasSize; // instanced in vec2 aPosition; // a vertex from the unit square in mat3 aTransform; // used to transform verticies, eg into a bounding box in int aVertType; // the type of thing we are rendering // the z-index that is output when using picking mode in vec4 aIndex; // For textures in int aAtlasId; // which shader unit/atlas to use in vec4 aTex; // x/y/w/h of texture in atlas // for edges in vec4 aPointAPointB; in vec4 aPointCPointD; in vec2 aLineWidth; // also used for node border width // simple shapes in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left] in vec4 aColor; // also used for edges in vec4 aBorderColor; // aLineWidth is used for border width // output values passed to the fragment shader out vec2 vTexCoord; out vec4 vColor; out vec2 vPosition; // flat values are not interpolated flat out int vAtlasId; flat out int vVertType; flat out vec2 vTopRight; flat out vec2 vBotLeft; flat out vec4 vCornerRadius; flat out vec4 vBorderColor; flat out vec2 vBorderWidth; flat out vec4 vIndex; void main(void) { int vid = gl_VertexID; vec2 position = aPosition; // TODO make this a vec3, simplifies some code below if(aVertType == `.concat(As,`) { float texX = aTex.x; // texture coordinates float texY = aTex.y; float texW = aTex.z; float texH = aTex.w; if(vid == 1 || vid == 2 || vid == 4) { texX += texW; } if(vid == 2 || vid == 4 || vid == 5) { texY += texH; } float d = float(uAtlasSize); vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1 gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); } else if(aVertType == `).concat(ga," || aVertType == ").concat(Ja,` || aVertType == `).concat(ni," || aVertType == ").concat(Qa,`) { // simple shapes // the bounding box is needed by the fragment shader vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated // calculations are done in the fragment shader, just pass these along vColor = aColor; vCornerRadius = aCornerRadius; vBorderColor = aBorderColor; vBorderWidth = aLineWidth; gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); } else if(aVertType == `).concat(Gv,`) { vec2 source = aPointAPointB.xy; vec2 target = aPointAPointB.zw; // adjust the geometry so that the line is centered on the edge position.y = position.y - 0.5; // stretch the unit square into a long skinny rectangle vec2 xBasis = target - source; vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x)); vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y; gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); vColor = aColor; } else if(aVertType == `).concat(Uv,`) { vec2 pointA = aPointAPointB.xy; vec2 pointB = aPointAPointB.zw; vec2 pointC = aPointCPointD.xy; vec2 pointD = aPointCPointD.zw; // adjust the geometry so that the line is centered on the edge position.y = position.y - 0.5; vec2 p0, p1, p2, pos; if(position.x == 0.0) { // The left side of the unit square p0 = pointA; p1 = pointB; p2 = pointC; pos = position; } else { // The right side of the unit square, use same approach but flip the geometry upside down p0 = pointD; p1 = pointC; p2 = pointB; pos = vec2(0.0, -position.y); } vec2 p01 = p1 - p0; vec2 p12 = p2 - p1; vec2 p21 = p1 - p2; // Find the normal vector. vec2 tangent = normalize(normalize(p12) + normalize(p01)); vec2 normal = vec2(-tangent.y, tangent.x); // Find the vector perpendicular to p0 -> p1. vec2 p01Norm = normalize(vec2(-p01.y, p01.x)); // Determine the bend direction. float sigma = sign(dot(p01 + p21, normal)); float width = aLineWidth[0]; if(sign(pos.y) == -sigma) { // This is an intersecting vertex. Adjust the position so that there's no overlap. vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm); gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); } else { // This is a non-intersecting vertex. Treat it like a mitre join. vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm); gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); } vColor = aColor; } else if(aVertType == `).concat(Ds,` && vid < 3) { // massage the first triangle into an edge arrow if(vid == 0) position = vec2(-0.15, -0.3); if(vid == 1) position = vec2( 0.0, 0.0); if(vid == 2) position = vec2( 0.15, -0.3); gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); vColor = aColor; } else { gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space } vAtlasId = aAtlasId; vVertType = aVertType; vIndex = aIndex; } `),i=this.batchManager.getIndexArray(),o=`#version 300 es precision highp float; // declare texture unit for each texture atlas in the batch `.concat(i.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(` `),` uniform vec4 uBGColor; uniform float uZoom; in vec2 vTexCoord; in vec4 vColor; in vec2 vPosition; // model coordinates flat in int vAtlasId; flat in vec4 vIndex; flat in int vVertType; flat in vec2 vTopRight; flat in vec2 vBotLeft; flat in vec4 vCornerRadius; flat in vec4 vBorderColor; flat in vec2 vBorderWidth; out vec4 outColor; `).concat(pm,` `).concat(ym,` `).concat(mm,` `).concat(bm,` vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha return vec4( top.rgb + (bot.rgb * (1.0 - top.a)), top.a + (bot.a * (1.0 - top.a)) ); } vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance // scale to the zoom level so that borders don't look blurry when zoomed in // note 1.5 is an aribitrary value chosen because it looks good return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); } void main(void) { if(vVertType == `).concat(As,`) { // look up the texel from the texture unit `).concat(i.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(` else `),` } else if(vVertType == `).concat(Ds,`) { // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; outColor = blend(vColor, uBGColor); outColor.a = 1.0; // make opaque, masks out line under arrow } else if(vVertType == `).concat(ga,` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done } else if(vVertType == `).concat(ga," || vVertType == ").concat(Ja,` || vVertType == `).concat(ni," || vVertType == ").concat(Qa,`) { // use SDF float outerBorder = vBorderWidth[0]; float innerBorder = vBorderWidth[1]; float borderPadding = outerBorder * 2.0; float w = vTopRight.x - vBotLeft.x - borderPadding; float h = vTopRight.y - vBotLeft.y - borderPadding; vec2 b = vec2(w/2.0, h/2.0); // half width, half height vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center float d; // signed distance if(vVertType == `).concat(ga,`) { d = rectangleSD(p, b); } else if(vVertType == `).concat(Ja,` && w == h) { d = circleSD(p, b.x); // faster than ellipse } else if(vVertType == `).concat(Ja,`) { d = ellipseSD(p, b); } else { d = roundRectangleSD(p, b, vCornerRadius.wzyx); } // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box if(d > 0.0) { if(d > outerBorder) { discard; } else { outColor = distInterp(vBorderColor, vec4(0), d - outerBorder); } } else { if(d > innerBorder) { vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor; vec4 innerBorderColor = blend(vBorderColor, vColor); outColor = distInterp(innerBorderColor, outerColor, d); } else { vec4 outerColor; if(innerBorder == 0.0 && outerBorder == 0.0) { outerColor = vec4(0); } else if(innerBorder == 0.0) { outerColor = vBorderColor; } else { outerColor = blend(vBorderColor, vColor); } outColor = distInterp(vColor, outerColor, d - innerBorder); } } } else { outColor = vColor; } `).concat(r.picking?`if(outColor.a == 0.0) discard; else outColor = vIndex;`:"",` } `),s=Qy(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.aCornerRadius=a.getAttribLocation(s,"aCornerRadius"),s.aBorderColor=a.getAttribLocation(s,"aBorderColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uZoom=a.getUniformLocation(s,"uZoom"),s.uTextures=[];for(var u=0;u1&&arguments[1]!==void 0?arguments[1]:Za.SCREEN;this.panZoomMatrix=r,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(r,a){return r.visible()?a&&a.isVisible?a.isVisible(r):!0:!1}},{key:"drawTexture",value:function(r,a,n){var i=this.atlasManager,o=this.batchManager,s=i.getRenderTypeOpts(n);if(this._isVisible(r,s)&&!(r.isEdge()&&!this._isValidEdge(r))){if(this.renderTarget.picking&&s.getTexPickingMode){var u=s.getTexPickingMode(r);if(u===ai.IGNORE)return;if(u==ai.USE_BB){this.drawPickingRectangle(r,a,n);return}}var l=i.getAtlasInfo(r,n),f=Ot(l),v;try{for(f.s();!(v=f.n()).done;){var c=v.value,h=c.atlas,d=c.tex1,p=c.tex2;o.canAddToCurrentBatch(h)||this.endBatch();for(var y=o.getAtlasIndexForBatch(h),g=0,b=[[d,!0],[p,!1]];g=this.maxInstances&&this.endBatch()}}}}catch(O){f.e(O)}finally{f.f()}}}},{key:"setTransformMatrix",value:function(r,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=0;if(n.shapeProps&&n.shapeProps.padding&&(s=r.pstyle(n.shapeProps.padding).pfValue),i){var u=i.bb,l=i.tex1,f=i.tex2,v=l.w/(l.w+f.w);o||(v=1-v);var c=this._getAdjustedBB(u,s,o,v);this._applyTransformMatrix(a,c,n,r)}else{var h=n.getBoundingBox(r),d=this._getAdjustedBB(h,s,!0,1);this._applyTransformMatrix(a,d,n,r)}}},{key:"_applyTransformMatrix",value:function(r,a,n,i){var o,s;zv(r);var u=n.getRotation?n.getRotation(i):0;if(u!==0){var l=n.getRotationPoint(i),f=l.x,v=l.y;ri(r,r,[f,v]),Vv(r,r,u);var c=n.getRotationOffset(i);o=c.x+(a.xOffset||0),s=c.y+(a.yOffset||0)}else o=a.x1,s=a.y1;ri(r,r,[o,s]),Ss(r,r,[a.w,a.h])}},{key:"_getAdjustedBB",value:function(r,a,n,i){var o=r.x1,s=r.y1,u=r.w,l=r.h,f=r.yOffset;a&&(o-=a,s-=a,u+=2*a,l+=2*a);var v=0,c=u*i;return n&&i<1?u=c:!n&&i<1&&(v=u-c,o+=v,u=c),{x1:o,y1:s,w:u,h:l,xOffset:v,yOffset:f}}},{key:"drawPickingRectangle",value:function(r,a,n){var i=this.atlasManager.getRenderTypeOpts(n),o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=ga;var s=this.indexBuffer.getView(o);da(a,s);var u=this.colorBuffer.getView(o);Vr([0,0,0],1,u);var l=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(r,l,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(r,a,n){var i=this.simpleShapeOptions.get(n);if(this._isVisible(r,i)){var o=i.shapeProps,s=this._getVertTypeForShape(r,o.shape);if(s===void 0||i.isSimple&&!i.isSimple(r,this.renderTarget)){this.drawTexture(r,a,n);return}var u=this.instanceCount;if(this.vertTypeBuffer.getView(u)[0]=s,s===ni||s===Qa){var l=i.getBoundingBox(r),f=this._getCornerRadius(r,o.radius,l),v=this.cornerRadiusBuffer.getView(u);v[0]=f,v[1]=f,v[2]=f,v[3]=f,s===Qa&&(v[0]=0,v[2]=0)}var c=this.indexBuffer.getView(u);da(a,c);var h=this.renderTarget.picking?1:n==="node-body"?r.effectiveOpacity():1,d=this.renderTarget.picking?1:r.pstyle(o.opacity).value*h,p=r.pstyle(o.color).value,y=this.colorBuffer.getView(u);Vr(p,d,y);var g=this.lineWidthBuffer.getView(u);if(g[0]=0,g[1]=0,o.border){var b=r.pstyle("border-width").value;if(b>0){var m=r.pstyle("border-color").value,w=h*r.pstyle("border-opacity").value,T=this.borderColorBuffer.getView(u);Vr(m,w,T);var D=r.pstyle("border-position").value;if(D==="inside")g[0]=0,g[1]=-b;else if(D==="outside")g[0]=b,g[1]=0;else{var x=b/2;g[0]=x,g[1]=-x}}}var M=this.transformBuffer.getMatrixView(u);this.setTransformMatrix(r,M,i),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(r,a){var n=r.pstyle(a).value;switch(n){case"rectangle":return ga;case"ellipse":return Ja;case"roundrectangle":case"round-rectangle":return ni;case"bottom-round-rectangle":return Qa;default:return}}},{key:"_getCornerRadius",value:function(r,a,n){var i=n.w,o=n.h;if(r.pstyle(a).value==="auto")return cr(i,o);var s=r.pstyle(a).pfValue,u=i/2,l=o/2;return Math.min(s,l,u)}},{key:"drawEdgeArrow",value:function(r,a,n){if(r.visible()){var i=r._private.rscratch,o,s,u;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,u=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,u=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(u)||u==null)){var l=r.pstyle(n+"-arrow-shape").value;if(l!=="none"){var f=r.pstyle(n+"-arrow-color").value,v=r.pstyle("opacity").value,c=r.pstyle("line-opacity").value,h=v*c,d=r.pstyle("width").pfValue,p=r.pstyle("arrow-scale").value,y=this.r.getArrowWidth(d,p),g=this.instanceCount,b=this.transformBuffer.getMatrixView(g);zv(b),ri(b,b,[o,s]),Ss(b,b,[y,y]),Vv(b,b,u),this.vertTypeBuffer.getView(g)[0]=Ds;var m=this.indexBuffer.getView(g);da(a,m);var w=this.colorBuffer.getView(g);Vr(f,h,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(r,a){if(r.visible()){var n=this._getEdgePoints(r);if(n){var i=r.pstyle("opacity").value,o=r.pstyle("line-opacity").value,s=r.pstyle("width").pfValue,u=r.pstyle("line-color").value,l=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var f=this.instanceCount;this.vertTypeBuffer.getView(f)[0]=Gv;var v=this.indexBuffer.getView(f);da(a,v);var c=this.colorBuffer.getView(f);Vr(u,l,c);var h=this.lineWidthBuffer.getView(f);h[0]=s;var d=this.pointAPointBBuffer.getView(f);d[0]=n[0],d[1]=n[1],d[2]=n[2],d[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(r){var a=r._private.rscratch;return!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))}},{key:"_getEdgePoints",value:function(r){var a=r._private.rscratch;if(this._isValidEdge(r)){var n=a.allpts;if(n.length==4)return n;var i=this._getNumSegments(r);return this._getCurveSegmentPoints(n,i)}}},{key:"_getNumSegments",value:function(r){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(r,a){if(r.length==4)return r;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=r[0],n[1]=r[1];else if(i==a)n[i*2]=r[r.length-2],n[i*2+1]=r[r.length-1];else{var o=i/a;this._setCurvePoint(r,o,n,i*2)}return n}},{key:"_setCurvePoint",value:function(r,a,n,i){if(r.length<=2)n[i]=r[0],n[i+1]=r[1];else{for(var o=Array(r.length-2),s=0;s0}},s=function(v){var c=v.pstyle("text-events").strValue==="yes";return c?ai.USE_BB:ai.IGNORE},u=function(v){var c=v.position(),h=c.x,d=c.y,p=v.outerWidth(),y=v.outerHeight();return{w:p,h:y,x1:h-p/2,y1:d-y/2}};r.drawing.addAtlasCollection("node",{texRows:t.webglTexRowsNodes}),r.drawing.addAtlasCollection("label",{texRows:t.webglTexRows}),r.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement}),r.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:u,isSimple:tm,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),r.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:u,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),r.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:u,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),r.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getLabelKey,null),getBoundingBox:Ms(e.getLabelBox,null),drawClipped:!0,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")}),r.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getSourceLabelKey,"source"),getBoundingBox:Ms(e.getSourceLabelBox,"source"),drawClipped:!0,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")}),r.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:Ls(e.getTargetLabelKey,"target"),getBoundingBox:Ms(e.getTargetLabelBox,"target"),drawClipped:!0,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")});var l=Ca(function(){console.log("garbage collect flag set"),r.data.gc=!0},1e4);r.onUpdateEleCalcs(function(f,v){var c=!1;v&&v.length>0&&(c|=r.drawing.invalidate(v)),c&&l()}),xm(r)};function Em(t){var e=t.cy.container(),r=e&&e.style&&e.style.backgroundColor||"white";return Ys(r)}function qv(t,e){var r=t._private.rscratch;return Mt(r,"labelWrapCachedLines",e)||[]}var Ls=function(e,r){return function(a){var n=e(a),i=qv(a,r);return i.length>1?i.map(function(o,s){return"".concat(n,"_").concat(s)}):n}},Ms=function(e,r){return function(a,n){var i=e(a);if(typeof n=="string"){var o=n.indexOf("_");if(o>0){var s=Number(n.substring(o+1)),u=qv(a,r),l=i.h/u.length,f=l*s,v=i.y1+f;return{x1:i.x1,w:i.w,y1:v,h:l,yOffset:f}}}return i}};function xm(t){{var e=t.render;t.render=function(i){i=i||{};var o=t.cy;t.webgl&&(o.zoom()>Tv?(Tm(t),e.call(t,i)):(Cm(t),Wv(t,i,Za.SCREEN)))}}{var r=t.matchCanvasSize;t.matchCanvasSize=function(i){r.call(t,i),t.pickingFrameBuffer.setFramebufferAttachmentSizes(t.canvasWidth,t.canvasHeight),t.pickingFrameBuffer.needsDraw=!0}}t.findNearestElements=function(i,o,s,u){return Rm(t,i,o)};{var a=t.invalidateCachedZSortedEles;t.invalidateCachedZSortedEles=function(){a.call(t),t.pickingFrameBuffer.needsDraw=!0}}{var n=t.notify;t.notify=function(i,o){n.call(t,i,o),i==="viewport"||i==="bounds"?t.pickingFrameBuffer.needsDraw=!0:i==="background"&&t.drawing.invalidate(o,{type:"node-body"})}}}function Tm(t){var e=t.data.contexts[t.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function Cm(t){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,t.canvasWidth,t.canvasHeight),a.restore()};e(t.data.contexts[t.NODE]),e(t.data.contexts[t.DRAG])}function Sm(t){var e=t.canvasWidth,r=t.canvasHeight,a=Ts(t),n=a.pan,i=a.zoom,o=Cs();ri(o,o,[n.x,n.y]),Ss(o,o,[i,i]);var s=Cs();fm(s,e,r);var u=Cs();return lm(u,s,o),u}function Yv(t,e){var r=t.canvasWidth,a=t.canvasHeight,n=Ts(t),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,r,a),e.translate(i.x,i.y),e.scale(o,o)}function Am(t,e){t.drawSelectionRectangle(e,function(r){return Yv(t,r)})}function Dm(t){var e=t.data.contexts[t.NODE];e.save(),Yv(t,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function Lm(t){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),u=t.data.contexts[t.NODE],l=s.atlases,f=0;f=0&&w.add(x)}return w}function Rm(t,e,r){var a=Mm(t,e,r),n=t.getCachedZSortedEles(),i,o,s=Ot(a),u;try{for(s.s();!(u=s.n()).done;){var l=u.value,f=n[l];if(!i&&f.isNode()&&(i=f),!o&&f.isEdge()&&(o=f),i&&o)break}}catch(v){s.e(v)}finally{s.f()}return[i,o].filter(Boolean)}function Rs(t,e,r){var a=t.drawing;e+=1,r.isNode()?(a.drawNode(r,e,"node-underlay"),a.drawNode(r,e,"node-body"),a.drawTexture(r,e,"label"),a.drawNode(r,e,"node-overlay")):(a.drawEdgeLine(r,e),a.drawEdgeArrow(r,e,"source"),a.drawEdgeArrow(r,e,"target"),a.drawTexture(r,e,"label"),a.drawTexture(r,e,"edge-source-label"),a.drawTexture(r,e,"edge-target-label"))}function Wv(t,e,r){var a;t.webglDebug&&(a=performance.now());var n=t.drawing,i=0;if(r.screen&&t.data.canvasNeedsRedraw[t.SELECT_BOX]&&Am(t,e),t.data.canvasNeedsRedraw[t.NODE]||r.picking){var o=t.data.contexts[t.WEBGL];r.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=Sm(t),u=t.getCachedZSortedEles();if(i=u.length,n.startFrame(s,r),r.screen){for(var l=0;l0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)h.translate(-a.x1*l,-a.y1*l),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(a.x1*l,a.y1*l);else{var p=e.pan(),y={x:p.x*l,y:p.y*l};l*=e.zoom(),h.translate(y.x,y.y),h.scale(l,l),this.drawElements(h,d),h.scale(1/l,1/l),h.translate(-y.x,-y.y)}t.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=t.bg,h.rect(0,0,i,o),h.fill())}return c};function Nm(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i"u"?"undefined":ct(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r},[Lv,Zt,nr,xs,zr,xr,Pt,Hv,Tr,ja,Qv].forEach(function(t){Oe(Ge,t)});var Im=[{name:"null",impl:ev},{name:"base",impl:wv},{name:"canvas",impl:Pm}],Bm=[{type:"layout",extensions:ny},{type:"renderer",extensions:Im}],jv={},eh={};function th(t,e,r){var a=r,n=function(M){Xe("Can not register `"+e+"` for `"+t+"` since `"+M+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(qa.prototype[e])return n(e);qa.prototype[e]=r}else if(t==="collection"){if(Ct.prototype[e])return n(e);Ct.prototype[e]=r}else if(t==="layout"){for(var i=function(M){this.options=M,r.call(this,M),Ue(this._private)||(this._private={}),this._private.cy=M.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(r.prototype),s=[],u=0;ud?(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(d+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(p+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>p?(this.rect.y-=(this.labelHeight-p)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(p+this.labelHeight))}}},v.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==o.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},v.prototype.transform=function(h){var d=this.rect.x;d>u.WORLD_BOUNDARY?d=u.WORLD_BOUNDARY:d<-u.WORLD_BOUNDARY&&(d=-u.WORLD_BOUNDARY);var p=this.rect.y;p>u.WORLD_BOUNDARY?p=u.WORLD_BOUNDARY:p<-u.WORLD_BOUNDARY&&(p=-u.WORLD_BOUNDARY);var y=new f(d,p),g=h.inverseTransformPoint(y);this.setLocation(g.x,g.y)},v.prototype.getLeft=function(){return this.rect.x},v.prototype.getRight=function(){return this.rect.x+this.rect.width},v.prototype.getTop=function(){return this.rect.y},v.prototype.getBottom=function(){return this.rect.y+this.rect.height},v.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=v},function(r,a,n){var i=n(0);function o(){}for(var s in i)o[s]=i[s];o.MAX_ITERATIONS=2500,o.DEFAULT_EDGE_LENGTH=50,o.DEFAULT_SPRING_STRENGTH=.45,o.DEFAULT_REPULSION_STRENGTH=4500,o.DEFAULT_GRAVITY_STRENGTH=.4,o.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,o.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,o.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,o.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,o.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,o.COOLING_ADAPTATION_FACTOR=.33,o.ADAPTATION_LOWER_NODE_LIMIT=1e3,o.ADAPTATION_UPPER_NODE_LIMIT=5e3,o.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,o.MAX_NODE_DISPLACEMENT=o.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,o.MIN_REPULSION_DIST=o.DEFAULT_EDGE_LENGTH/10,o.CONVERGENCE_CHECK_PERIOD=100,o.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,o.MIN_EDGE_LENGTH=1,o.GRID_CALCULATION_CHECK_PERIOD=10,r.exports=o},function(r,a,n){function i(o,s){o==null&&s==null?(this.x=0,this.y=0):(this.x=o,this.y=s)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(o){this.x=o},i.prototype.setY=function(o){this.y=o},i.prototype.getDifference=function(o){return new DimensionD(this.x-o.x,this.y-o.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(o){return this.x+=o.width,this.y+=o.height,this},r.exports=i},function(r,a,n){var i=n(2),o=n(10),s=n(0),u=n(7),l=n(3),f=n(1),v=n(13),c=n(12),h=n(11);function d(y,g,b){i.call(this,b),this.estimatedSize=o.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=y,g!=null&&g instanceof u?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}d.prototype=Object.create(i.prototype);for(var p in i)d[p]=i[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(y,g,b){if(g==null&&b==null){var m=y;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var w=y;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(g.owner==b.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=b.owner?null:(w.source=g,w.target=b,w.isInterGraph=!1,this.getEdges().push(w),g.edges.push(w),b!=g&&b.edges.push(w),w)}},d.prototype.remove=function(y){var g=y;if(y instanceof l){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=g.edges.slice(),m,w=b.length,T=0;T-1&&M>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(x,1),m.target!=m.source&&m.target.edges.splice(M,1);var D=m.source.owner.getEdges().indexOf(m);if(D==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(D,1)}},d.prototype.updateLeftTop=function(){for(var y=o.MAX_VALUE,g=o.MAX_VALUE,b,m,w,T=this.getNodes(),D=T.length,x=0;xb&&(y=b),g>m&&(g=m)}return y==o.MAX_VALUE?null:(T[0].getParent().paddingLeft!=null?w=T[0].getParent().paddingLeft:w=this.margin,this.left=g-w,this.top=y-w,new c(this.left,this.top))},d.prototype.updateBounds=function(y){for(var g=o.MAX_VALUE,b=-o.MAX_VALUE,m=o.MAX_VALUE,w=-o.MAX_VALUE,T,D,x,M,P,N=this.nodes,O=N.length,R=0;RT&&(g=T),bx&&(m=x),wT&&(g=T),bx&&(m=x),w=this.nodes.length){var O=0;b.forEach(function(R){R.owner==y&&O++}),O==this.nodes.length&&(this.isConnected=!0)}},r.exports=d},function(r,a,n){var i,o=n(1);function s(u){i=n(6),this.layout=u,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),f=this.add(u,l);return this.setRootGraph(f),this.rootGraph},s.prototype.add=function(u,l,f,v,c){if(f==null&&v==null&&c==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{c=f,v=l,f=u;var h=v.getOwner(),d=c.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==d)return f.isInterGraph=!1,h.add(f,v,c);if(f.isInterGraph=!0,f.source=v,f.target=c,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},s.prototype.remove=function(u){if(u instanceof i){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(l.getEdges());for(var v,c=f.length,h=0;h=u.getRight()?l[0]+=Math.min(u.getX()-s.getX(),s.getRight()-u.getRight()):u.getX()<=s.getX()&&u.getRight()>=s.getRight()&&(l[0]+=Math.min(s.getX()-u.getX(),u.getRight()-s.getRight())),s.getY()<=u.getY()&&s.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-s.getY(),s.getBottom()-u.getBottom()):u.getY()<=s.getY()&&u.getBottom()>=s.getBottom()&&(l[1]+=Math.min(s.getY()-u.getY(),u.getBottom()-s.getBottom()));var c=Math.abs((u.getCenterY()-s.getCenterY())/(u.getCenterX()-s.getCenterX()));u.getCenterY()===s.getCenterY()&&u.getCenterX()===s.getCenterX()&&(c=1);var h=c*l[0],d=l[1]/c;l[0]h)return l[0]=f,l[1]=p,l[2]=c,l[3]=N,!1;if(vc)return l[0]=d,l[1]=v,l[2]=M,l[3]=h,!1;if(fc?(l[0]=g,l[1]=b,E=!0):(l[0]=y,l[1]=p,E=!0):S===L&&(f>c?(l[0]=d,l[1]=p,E=!0):(l[0]=m,l[1]=b,E=!0)),-C===L?c>f?(l[2]=P,l[3]=N,A=!0):(l[2]=M,l[3]=x,A=!0):C===L&&(c>f?(l[2]=D,l[3]=x,A=!0):(l[2]=O,l[3]=N,A=!0)),E&&A)return!1;if(f>c?v>h?(z=this.getCardinalDirection(S,L,4),k=this.getCardinalDirection(C,L,2)):(z=this.getCardinalDirection(-S,L,3),k=this.getCardinalDirection(-C,L,1)):v>h?(z=this.getCardinalDirection(-S,L,1),k=this.getCardinalDirection(-C,L,3)):(z=this.getCardinalDirection(S,L,2),k=this.getCardinalDirection(C,L,4)),!E)switch(z){case 1:H=p,F=f+-T/L,l[0]=F,l[1]=H;break;case 2:F=m,H=v+w*L,l[0]=F,l[1]=H;break;case 3:H=b,F=f+T/L,l[0]=F,l[1]=H;break;case 4:F=g,H=v+-w*L,l[0]=F,l[1]=H;break}if(!A)switch(k){case 1:Q=x,W=c+-I/L,l[2]=W,l[3]=Q;break;case 2:W=O,Q=h+R*L,l[2]=W,l[3]=Q;break;case 3:Q=N,W=c+I/L,l[2]=W,l[3]=Q;break;case 4:W=P,Q=h+-R*L,l[2]=W,l[3]=Q;break}}return!1},o.getCardinalDirection=function(s,u,l){return s>u?l:1+l%4},o.getIntersection=function(s,u,l,f){if(f==null)return this.getIntersection2(s,u,l);var v=s.x,c=s.y,h=u.x,d=u.y,p=l.x,y=l.y,g=f.x,b=f.y,m=void 0,w=void 0,T=void 0,D=void 0,x=void 0,M=void 0,P=void 0,N=void 0,O=void 0;return T=d-c,x=v-h,P=h*c-v*d,D=b-y,M=p-g,N=g*y-p*b,O=T*M-D*x,O===0?null:(m=(x*N-M*P)/O,w=(D*P-T*N)/O,new i(m,w))},o.angleOfVector=function(s,u,l,f){var v=void 0;return s!==l?(v=Math.atan((f-u)/(l-s)),l=0){var b=(-p+Math.sqrt(p*p-4*d*y))/(2*d),m=(-p-Math.sqrt(p*p-4*d*y))/(2*d),w=null;return b>=0&&b<=1?[b]:m>=0&&m<=1?[m]:w}else return null},o.HALF_PI=.5*Math.PI,o.ONE_AND_HALF_PI=1.5*Math.PI,o.TWO_PI=2*Math.PI,o.THREE_PI=3*Math.PI,r.exports=o},function(r,a,n){function i(){}i.sign=function(o){return o>0?1:o<0?-1:0},i.floor=function(o){return o<0?Math.ceil(o):Math.floor(o)},i.ceil=function(o){return o<0?Math.floor(o):Math.ceil(o)},r.exports=i},function(r,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,r.exports=i},function(r,a,n){var i=function(){function v(c,h){for(var d=0;d"u"?"undefined":i(s);return s==null||u!="object"&&u!="function"},r.exports=o},function(r,a,n){function i(p){if(Array.isArray(p)){for(var y=0,g=Array(p.length);y0&&y;){for(T.push(x[0]);T.length>0&&y;){var M=T[0];T.splice(0,1),w.add(M);for(var P=M.getEdges(),m=0;m-1&&x.splice(I,1)}w=new Set,D=new Map}}return p},d.prototype.createDummyNodesForBendpoints=function(p){for(var y=[],g=p.source,b=this.graphManager.calcLowestCommonAncestor(p.source,p.target),m=0;m0){for(var b=this.edgeToDummyNodes.get(g),m=0;m=0&&y.splice(N,1);var O=D.getNeighborsList();O.forEach(function(E){if(g.indexOf(E)<0){var A=b.get(E),S=A-1;S==1&&M.push(E),b.set(E,S)}})}g=g.concat(M),(y.length==1||y.length==2)&&(m=!0,w=y[0])}return w},d.prototype.setGraphManager=function(p){this.graphManager=p},r.exports=d},function(r,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},r.exports=i},function(r,a,n){var i=n(5);function o(s,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}o.prototype.getWorldOrgX=function(){return this.lworldOrgX},o.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},o.prototype.getWorldOrgY=function(){return this.lworldOrgY},o.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},o.prototype.getWorldExtX=function(){return this.lworldExtX},o.prototype.setWorldExtX=function(s){this.lworldExtX=s},o.prototype.getWorldExtY=function(){return this.lworldExtY},o.prototype.setWorldExtY=function(s){this.lworldExtY=s},o.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},o.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},o.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},o.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},o.prototype.getDeviceExtX=function(){return this.ldeviceExtX},o.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},o.prototype.getDeviceExtY=function(){return this.ldeviceExtY},o.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},o.prototype.transformX=function(s){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/l),u},o.prototype.transformY=function(s){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/l),u},o.prototype.inverseTransformX=function(s){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/l),u},o.prototype.inverseTransformY=function(s){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/l),u},o.prototype.inverseTransformPoint=function(s){var u=new i(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return u},r.exports=o},function(r,a,n){function i(h){if(Array.isArray(h)){for(var d=0,p=Array(h.length);ds.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},v.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),d,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,y,g,b,m=this.getAllNodes(),w;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),w=new Set,p=0;pT||w>T)&&(h.gravitationForceX=-this.gravityConstant*g,h.gravitationForceY=-this.gravityConstant*b)):(T=d.getEstimatedSize()*this.compoundGravityRangeFactor,(m>T||w>T)&&(h.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},v.prototype.isConverged=function(){var h,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement=m.length||T>=m[0].length)){for(var D=0;Dv}}]),l}();r.exports=u},function(r,a,n){function i(){}i.svd=function(o){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=o.length,this.n=o[0].length;var s=Math.min(this.m,this.n);this.s=function(ke){for(var Re=[];ke-- >0;)Re.push(0);return Re}(Math.min(this.m+1,this.n)),this.U=function(ke){var Re=function rt(Ke){if(Ke.length==0)return 0;for(var st=[],Qe=0;Qe0;)Re.push(0);return Re}(this.n),l=function(ke){for(var Re=[];ke-- >0;)Re.push(0);return Re}(this.m),f=!0,v=Math.min(this.m-1,this.n),c=Math.max(0,Math.min(this.n-2,this.m)),h=0;h=0;C--)if(this.s[C]!==0){for(var L=C+1;L=0;K--){if(function(ke,Re){return ke&&Re}(K0;){var te=void 0,ge=void 0;for(te=E-2;te>=-1&&te!==-1;te--)if(Math.abs(u[te])<=ee+X*(Math.abs(this.s[te])+Math.abs(this.s[te+1]))){u[te]=0;break}if(te===E-2)ge=4;else{var Te=void 0;for(Te=E-1;Te>=te&&Te!==te;Te--){var pe=(Te!==E?Math.abs(u[Te]):0)+(Te!==te+1?Math.abs(u[Te-1]):0);if(Math.abs(this.s[Te])<=ee+X*pe){this.s[Te]=0;break}}Te===te?ge=3:Te===E-1?ge=1:(ge=2,te=Te)}switch(te++,ge){case 1:{var le=u[E-2];u[E-2]=0;for(var ce=E-2;ce>=te;ce--){var ve=i.hypot(this.s[ce],le),de=this.s[ce]/ve,me=le/ve;this.s[ce]=ve,ce!==te&&(le=-me*u[ce-1],u[ce-1]=de*u[ce-1]);for(var ye=0;ye=this.s[te+1]);){var Pe=this.s[te];if(this.s[te]=this.s[te+1],this.s[te+1]=Pe,teMath.abs(s)?(u=s/o,u=Math.abs(o)*Math.sqrt(1+u*u)):s!=0?(u=o/s,u=Math.abs(s)*Math.sqrt(1+u*u)):u=0,u},r.exports=i},function(r,a,n){var i=function(){function u(l,f){for(var v=0;v2&&arguments[2]!==void 0?arguments[2]:1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;o(this,u),this.sequence1=l,this.sequence2=f,this.match_score=v,this.mismatch_penalty=c,this.gap_penalty=h,this.iMax=l.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;l--){var f=this.listeners[l];f.event===s&&f.callback===u&&this.listeners.splice(l,1)}},o.emit=function(s,u){for(var l=0;l{var a={45:(s,u,l)=>{var f={};f.layoutBase=l(551),f.CoSEConstants=l(806),f.CoSEEdge=l(767),f.CoSEGraph=l(880),f.CoSEGraphManager=l(578),f.CoSELayout=l(765),f.CoSENode=l(991),f.ConstraintHandler=l(902),s.exports=f},806:(s,u,l)=>{var f=l(551).FDLayoutConstants;function v(){}for(var c in f)v[c]=f[c];v.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,v.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,v.DEFAULT_COMPONENT_SEPERATION=60,v.TILE=!0,v.TILING_PADDING_VERTICAL=10,v.TILING_PADDING_HORIZONTAL=10,v.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,v.ENFORCE_CONSTRAINTS=!0,v.APPLY_LAYOUT=!0,v.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,v.TREE_REDUCTION_ON_INCREMENTAL=!0,v.PURE_INCREMENTAL=v.DEFAULT_INCREMENTAL,s.exports=v},767:(s,u,l)=>{var f=l(551).FDLayoutEdge;function v(h,d,p){f.call(this,h,d,p)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},880:(s,u,l)=>{var f=l(551).LGraph;function v(h,d,p){f.call(this,h,d,p)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},578:(s,u,l)=>{var f=l(551).LGraphManager;function v(h){f.call(this,h)}v.prototype=Object.create(f.prototype);for(var c in f)v[c]=f[c];s.exports=v},765:(s,u,l)=>{var f=l(551).FDLayout,v=l(578),c=l(880),h=l(991),d=l(767),p=l(806),y=l(902),g=l(551).FDLayoutConstants,b=l(551).LayoutConstants,m=l(551).Point,w=l(551).PointD,T=l(551).DimensionD,D=l(551).Layout,x=l(551).Integer,M=l(551).IGeometry,P=l(551).LGraph,N=l(551).Transform,O=l(551).LinkedList;function R(){f.call(this),this.toBeTiled={},this.constraints={}}R.prototype=Object.create(f.prototype);for(var I in f)R[I]=f[I];R.prototype.newGraphManager=function(){var E=new v(this);return this.graphManager=E,E},R.prototype.newGraph=function(E){return new c(null,this.graphManager,E)},R.prototype.newNode=function(E){return new h(this.graphManager,E)},R.prototype.newEdge=function(E){return new d(null,null,E)},R.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(p.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=p.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=p.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=g.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=g.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=g.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},R.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/g.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},R.prototype.layout=function(){var E=b.DEFAULT_CREATE_BENDS_AS_NEEDED;return E&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},R.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(p.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(z){return A.has(z)});this.graphManager.setAllNodesToApplyGravitation(S)}}else{var E=this.getFlatForest();if(E.length>0)this.positionNodesRadially(E);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var A=new Set(this.getAllNodes()),S=this.nodesWithGravity.filter(function(C){return A.has(C)});this.graphManager.setAllNodesToApplyGravitation(S),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(y.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),p.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},R.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%g.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 E=new Set(this.getAllNodes()),A=this.nodesWithGravity.filter(function(L){return E.has(L)});this.graphManager.setAllNodesToApplyGravitation(A),this.graphManager.updateBounds(),this.updateGrid(),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=g.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()),p.PURE_INCREMENTAL?this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=g.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var S=!this.isTreeGrowing&&!this.isGrowthFinished,C=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(S,C),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},R.prototype.getPositionsData=function(){for(var E=this.graphManager.getAllNodes(),A={},S=0;S0&&this.updateDisplacements();for(var S=0;S0&&(C.fixedNodeWeight=z)}}if(this.constraints.relativePlacementConstraint){var k=new Map,F=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(q){E.fixedNodesOnHorizontal.add(q),E.fixedNodesOnVertical.add(q)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var H=this.constraints.alignmentConstraint.vertical,S=0;S=2*q.length/3;X--)U=Math.floor(Math.random()*(X+1)),Y=q[X],q[X]=q[U],q[U]=Y;return q},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(q){if(q.left){var U=k.has(q.left)?k.get(q.left):q.left,Y=k.has(q.right)?k.get(q.right):q.right;E.nodesInRelativeHorizontal.includes(U)||(E.nodesInRelativeHorizontal.push(U),E.nodeToRelativeConstraintMapHorizontal.set(U,[]),E.dummyToNodeForVerticalAlignment.has(U)?E.nodeToTempPositionMapHorizontal.set(U,E.idToNodeMap.get(E.dummyToNodeForVerticalAlignment.get(U)[0]).getCenterX()):E.nodeToTempPositionMapHorizontal.set(U,E.idToNodeMap.get(U).getCenterX())),E.nodesInRelativeHorizontal.includes(Y)||(E.nodesInRelativeHorizontal.push(Y),E.nodeToRelativeConstraintMapHorizontal.set(Y,[]),E.dummyToNodeForVerticalAlignment.has(Y)?E.nodeToTempPositionMapHorizontal.set(Y,E.idToNodeMap.get(E.dummyToNodeForVerticalAlignment.get(Y)[0]).getCenterX()):E.nodeToTempPositionMapHorizontal.set(Y,E.idToNodeMap.get(Y).getCenterX())),E.nodeToRelativeConstraintMapHorizontal.get(U).push({right:Y,gap:q.gap}),E.nodeToRelativeConstraintMapHorizontal.get(Y).push({left:U,gap:q.gap})}else{var X=F.has(q.top)?F.get(q.top):q.top,ee=F.has(q.bottom)?F.get(q.bottom):q.bottom;E.nodesInRelativeVertical.includes(X)||(E.nodesInRelativeVertical.push(X),E.nodeToRelativeConstraintMapVertical.set(X,[]),E.dummyToNodeForHorizontalAlignment.has(X)?E.nodeToTempPositionMapVertical.set(X,E.idToNodeMap.get(E.dummyToNodeForHorizontalAlignment.get(X)[0]).getCenterY()):E.nodeToTempPositionMapVertical.set(X,E.idToNodeMap.get(X).getCenterY())),E.nodesInRelativeVertical.includes(ee)||(E.nodesInRelativeVertical.push(ee),E.nodeToRelativeConstraintMapVertical.set(ee,[]),E.dummyToNodeForHorizontalAlignment.has(ee)?E.nodeToTempPositionMapVertical.set(ee,E.idToNodeMap.get(E.dummyToNodeForHorizontalAlignment.get(ee)[0]).getCenterY()):E.nodeToTempPositionMapVertical.set(ee,E.idToNodeMap.get(ee).getCenterY())),E.nodeToRelativeConstraintMapVertical.get(X).push({bottom:ee,gap:q.gap}),E.nodeToRelativeConstraintMapVertical.get(ee).push({top:X,gap:q.gap})}});else{var Q=new Map,K=new Map;this.constraints.relativePlacementConstraint.forEach(function(q){if(q.left){var U=k.has(q.left)?k.get(q.left):q.left,Y=k.has(q.right)?k.get(q.right):q.right;Q.has(U)?Q.get(U).push(Y):Q.set(U,[Y]),Q.has(Y)?Q.get(Y).push(U):Q.set(Y,[U])}else{var X=F.has(q.top)?F.get(q.top):q.top,ee=F.has(q.bottom)?F.get(q.bottom):q.bottom;K.has(X)?K.get(X).push(ee):K.set(X,[ee]),K.has(ee)?K.get(ee).push(X):K.set(ee,[X])}});var Z=function(U,Y){var X=[],ee=[],te=new O,ge=new Set,Te=0;return U.forEach(function(pe,le){if(!ge.has(le)){X[Te]=[],ee[Te]=!1;var ce=le;for(te.push(ce),ge.add(ce),X[Te].push(ce);te.length!=0;){ce=te.shift(),Y.has(ce)&&(ee[Te]=!0);var ve=U.get(ce);ve.forEach(function(de){ge.has(de)||(te.push(de),ge.add(de),X[Te].push(de))})}Te++}}),{components:X,isFixed:ee}},j=Z(Q,E.fixedNodesOnHorizontal);this.componentsOnHorizontal=j.components,this.fixedComponentsOnHorizontal=j.isFixed;var re=Z(K,E.fixedNodesOnVertical);this.componentsOnVertical=re.components,this.fixedComponentsOnVertical=re.isFixed}}},R.prototype.updateDisplacements=function(){var E=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(re){var q=E.idToNodeMap.get(re.nodeId);q.displacementX=0,q.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var A=this.constraints.alignmentConstraint.vertical,S=0;S1){var F;for(F=0;FC&&(C=Math.floor(k.y)),z=Math.floor(k.x+p.DEFAULT_COMPONENT_SEPERATION)}this.transform(new w(b.WORLD_CENTER_X-k.x/2,b.WORLD_CENTER_Y-k.y/2))},R.radialLayout=function(E,A,S){var C=Math.max(this.maxDiagonalInTree(E),p.DEFAULT_RADIAL_SEPARATION);R.branchRadialLayout(A,null,0,359,0,C);var L=P.calculateBounds(E),z=new N;z.setDeviceOrgX(L.getMinX()),z.setDeviceOrgY(L.getMinY()),z.setWorldOrgX(S.x),z.setWorldOrgY(S.y);for(var k=0;k1;){var Y=U[0];U.splice(0,1);var X=K.indexOf(Y);X>=0&&K.splice(X,1),re--,Z--}A!=null?q=(K.indexOf(U[0])+1)%re:q=0;for(var ee=Math.abs(C-S)/Z,te=q;j!=Z;te=++te%re){var ge=K[te].getOtherEnd(E);if(ge!=A){var Te=(S+j*ee)%360,pe=(Te+ee)%360;R.branchRadialLayout(ge,E,Te,pe,L+z,z),j++}}},R.maxDiagonalInTree=function(E){for(var A=x.MIN_VALUE,S=0;SA&&(A=L)}return A},R.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},R.prototype.groupZeroDegreeMembers=function(){var E=this,A={};this.memberGroups={},this.idToDummyNode={};for(var S=[],C=this.graphManager.getAllNodes(),L=0;L"u"&&(A[F]=[]),A[F]=A[F].concat(z)}Object.keys(A).forEach(function(H){if(A[H].length>1){var W="DummyCompound_"+H;E.memberGroups[W]=A[H];var Q=A[H][0].getParent(),K=new h(E.graphManager);K.id=W,K.paddingLeft=Q.paddingLeft||0,K.paddingRight=Q.paddingRight||0,K.paddingBottom=Q.paddingBottom||0,K.paddingTop=Q.paddingTop||0,E.idToDummyNode[W]=K;var Z=E.getGraphManager().add(E.newGraph(),K),j=Q.getChild();j.add(K);for(var re=0;reL?(C.rect.x-=(C.labelWidth-L)/2,C.setWidth(C.labelWidth),C.labelMarginLeft=(C.labelWidth-L)/2):C.labelPosHorizontal=="right"&&C.setWidth(L+C.labelWidth)),C.labelHeight&&(C.labelPosVertical=="top"?(C.rect.y-=C.labelHeight,C.setHeight(z+C.labelHeight),C.labelMarginTop=C.labelHeight):C.labelPosVertical=="center"&&C.labelHeight>z?(C.rect.y-=(C.labelHeight-z)/2,C.setHeight(C.labelHeight),C.labelMarginTop=(C.labelHeight-z)/2):C.labelPosVertical=="bottom"&&C.setHeight(z+C.labelHeight))}})},R.prototype.repopulateCompounds=function(){for(var E=this.compoundOrder.length-1;E>=0;E--){var A=this.compoundOrder[E],S=A.id,C=A.paddingLeft,L=A.paddingTop,z=A.labelMarginLeft,k=A.labelMarginTop;this.adjustLocations(this.tiledMemberPack[S],A.rect.x,A.rect.y,C,L,z,k)}},R.prototype.repopulateZeroDegreeMembers=function(){var E=this,A=this.tiledZeroDegreePack;Object.keys(A).forEach(function(S){var C=E.idToDummyNode[S],L=C.paddingLeft,z=C.paddingTop,k=C.labelMarginLeft,F=C.labelMarginTop;E.adjustLocations(A[S],C.rect.x,C.rect.y,L,z,k,F)})},R.prototype.getToBeTiled=function(E){var A=E.id;if(this.toBeTiled[A]!=null)return this.toBeTiled[A];var S=E.getChild();if(S==null)return this.toBeTiled[A]=!1,!1;for(var C=S.getNodes(),L=0;L0)return this.toBeTiled[A]=!1,!1;if(z.getChild()==null){this.toBeTiled[z.id]=!1;continue}if(!this.getToBeTiled(z))return this.toBeTiled[A]=!1,!1}return this.toBeTiled[A]=!0,!0},R.prototype.getNodeDegree=function(E){E.id;for(var A=E.getEdges(),S=0,C=0;CQ&&(Q=Z.rect.height)}S+=Q+E.verticalPadding}},R.prototype.tileCompoundMembers=function(E,A){var S=this;this.tiledMemberPack=[],Object.keys(E).forEach(function(C){var L=A[C];if(S.tiledMemberPack[C]=S.tileNodes(E[C],L.paddingLeft+L.paddingRight),L.rect.width=S.tiledMemberPack[C].width,L.rect.height=S.tiledMemberPack[C].height,L.setCenter(S.tiledMemberPack[C].centerX,S.tiledMemberPack[C].centerY),L.labelMarginLeft=0,L.labelMarginTop=0,p.NODE_DIMENSIONS_INCLUDE_LABELS){var z=L.rect.width,k=L.rect.height;L.labelWidth&&(L.labelPosHorizontal=="left"?(L.rect.x-=L.labelWidth,L.setWidth(z+L.labelWidth),L.labelMarginLeft=L.labelWidth):L.labelPosHorizontal=="center"&&L.labelWidth>z?(L.rect.x-=(L.labelWidth-z)/2,L.setWidth(L.labelWidth),L.labelMarginLeft=(L.labelWidth-z)/2):L.labelPosHorizontal=="right"&&L.setWidth(z+L.labelWidth)),L.labelHeight&&(L.labelPosVertical=="top"?(L.rect.y-=L.labelHeight,L.setHeight(k+L.labelHeight),L.labelMarginTop=L.labelHeight):L.labelPosVertical=="center"&&L.labelHeight>k?(L.rect.y-=(L.labelHeight-k)/2,L.setHeight(L.labelHeight),L.labelMarginTop=(L.labelHeight-k)/2):L.labelPosVertical=="bottom"&&L.setHeight(k+L.labelHeight))}})},R.prototype.tileNodes=function(E,A){var S=this.tileNodesByFavoringDim(E,A,!0),C=this.tileNodesByFavoringDim(E,A,!1),L=this.getOrgRatio(S),z=this.getOrgRatio(C),k;return zF&&(F=re.getWidth())});var H=z/L,W=k/L,Q=Math.pow(S-C,2)+4*(H+C)*(W+S)*L,K=(C-S+Math.sqrt(Q))/(2*(H+C)),Z;A?(Z=Math.ceil(K),Z==K&&Z++):Z=Math.floor(K);var j=Z*(H+C)-C;return F>j&&(j=F),j+=C*2,j},R.prototype.tileNodesByFavoringDim=function(E,A,S){var C=p.TILING_PADDING_VERTICAL,L=p.TILING_PADDING_HORIZONTAL,z=p.TILING_COMPARE_BY,k={rows:[],rowWidth:[],rowHeight:[],width:0,height:A,verticalPadding:C,horizontalPadding:L,centerX:0,centerY:0};z&&(k.idealRowWidth=this.calcIdealRowWidth(E,S));var F=function(q){return q.rect.width*q.rect.height},H=function(q,U){return F(U)-F(q)};E.sort(function(re,q){var U=H;return k.idealRowWidth?(U=z,U(re.id,q.id)):U(re,q)});for(var W=0,Q=0,K=0;K0&&(k+=E.horizontalPadding),E.rowWidth[S]=k,E.width0&&(F+=E.verticalPadding);var H=0;F>E.rowHeight[S]&&(H=E.rowHeight[S],E.rowHeight[S]=F,H=E.rowHeight[S]-H),E.height+=H,E.rows[S].push(A)},R.prototype.getShortestRowIndex=function(E){for(var A=-1,S=Number.MAX_VALUE,C=0;CS&&(A=C,S=E.rowWidth[C]);return A},R.prototype.canAddHorizontal=function(E,A,S){if(E.idealRowWidth){var C=E.rows.length-1,L=E.rowWidth[C];return L+A+E.horizontalPadding<=E.idealRowWidth}var z=this.getShortestRowIndex(E);if(z<0)return!0;var k=E.rowWidth[z];if(k+E.horizontalPadding+A<=E.width)return!0;var F=0;E.rowHeight[z]0&&(F=S+E.verticalPadding-E.rowHeight[z]);var H;E.width-k>=A+E.horizontalPadding?H=(E.height+F)/(k+A+E.horizontalPadding):H=(E.height+F)/E.width,F=S+E.verticalPadding;var W;return E.widthz&&A!=S){C.splice(-1,1),E.rows[S].push(L),E.rowWidth[A]=E.rowWidth[A]-z,E.rowWidth[S]=E.rowWidth[S]+z,E.width=E.rowWidth[instance.getLongestRowIndex(E)];for(var k=Number.MIN_VALUE,F=0;Fk&&(k=C[F].height);A>0&&(k+=E.verticalPadding);var H=E.rowHeight[A]+E.rowHeight[S];E.rowHeight[A]=k,E.rowHeight[S]0)for(var j=L;j<=z;j++)Z[0]+=this.grid[j][k-1].length+this.grid[j][k].length-1;if(z0)for(var j=k;j<=F;j++)Z[3]+=this.grid[L-1][j].length+this.grid[L][j].length-1;for(var re=x.MAX_VALUE,q,U,Y=0;Y{var f=l(551).FDLayoutNode,v=l(551).IMath;function c(d,p,y,g){f.call(this,d,p,y,g)}c.prototype=Object.create(f.prototype);for(var h in f)c[h]=f[h];c.prototype.calculateDisplacement=function(){var d=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=d.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=d.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementX=d.coolingFactor*d.maxNodeDisplacement*v.sign(this.displacementX)),Math.abs(this.displacementY)>d.coolingFactor*d.maxNodeDisplacement&&(this.displacementY=d.coolingFactor*d.maxNodeDisplacement*v.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},c.prototype.propogateDisplacementToChildren=function(d,p){for(var y=this.getChild().getNodes(),g,b=0;b{function f(y){if(Array.isArray(y)){for(var g=0,b=Array(y.length);g0){var Pe=0;Se.forEach(function(xe){$=="horizontal"?(fe.set(xe,m.has(xe)?w[m.get(xe)]:J.get(xe)),Pe+=fe.get(xe)):(fe.set(xe,m.has(xe)?T[m.get(xe)]:J.get(xe)),Pe+=fe.get(xe))}),Pe=Pe/Se.length,Ae.forEach(function(xe){ae.has(xe)||fe.set(xe,Pe)})}else{var De=0;Ae.forEach(function(xe){$=="horizontal"?De+=m.has(xe)?w[m.get(xe)]:J.get(xe):De+=m.has(xe)?T[m.get(xe)]:J.get(xe)}),De=De/Ae.length,Ae.forEach(function(xe){fe.set(xe,De)})}});for(var Ce=function(){var Se=he.shift(),Pe=G.get(Se);Pe.forEach(function(De){if(fe.get(De.id)xe&&(xe=Et),ftqe&&(qe=ft)}}catch(Ar){Re=!0,rt=Ar}finally{try{!ke&&Ke.return&&Ke.return()}finally{if(Re)throw rt}}var ut=(Pe+xe)/2-(De+qe)/2,lt=!0,Gt=!1,yt=void 0;try{for(var Jt=Ae[Symbol.iterator](),ya;!(lt=(ya=Jt.next()).done);lt=!0){var Sr=ya.value;fe.set(Sr,fe.get(Sr)+ut)}}catch(Ar){Gt=!0,yt=Ar}finally{try{!lt&&Jt.return&&Jt.return()}finally{if(Gt)throw yt}}})}return fe},I=function(G){var $=0,ae=0,J=0,ne=0;if(G.forEach(function(se){se.left?w[m.get(se.left)]-w[m.get(se.right)]>=0?$++:ae++:T[m.get(se.top)]-T[m.get(se.bottom)]>=0?J++:ne++}),$>ae&&J>ne)for(var ie=0;ieae)for(var ue=0;uene)for(var fe=0;fe1)g.fixedNodeConstraint.forEach(function(V,G){C[G]=[V.position.x,V.position.y],L[G]=[w[m.get(V.nodeId)],T[m.get(V.nodeId)]]}),z=!0;else if(g.alignmentConstraint)(function(){var V=0;if(g.alignmentConstraint.vertical){for(var G=g.alignmentConstraint.vertical,$=function(fe){var se=new Set;G[fe].forEach(function(Ee){se.add(Ee)});var he=new Set([].concat(f(se)).filter(function(Ee){return F.has(Ee)})),Ce=void 0;he.size>0?Ce=w[m.get(he.values().next().value)]:Ce=O(se).x,G[fe].forEach(function(Ee){C[V]=[Ce,T[m.get(Ee)]],L[V]=[w[m.get(Ee)],T[m.get(Ee)]],V++})},ae=0;ae0?Ce=w[m.get(he.values().next().value)]:Ce=O(se).y,J[fe].forEach(function(Ee){C[V]=[w[m.get(Ee)],Ce],L[V]=[w[m.get(Ee)],T[m.get(Ee)]],V++})},ie=0;ieK&&(K=Q[j].length,Z=j);if(K0){var ye={x:0,y:0};g.fixedNodeConstraint.forEach(function(V,G){var $={x:w[m.get(V.nodeId)],y:T[m.get(V.nodeId)]},ae=V.position,J=N(ae,$);ye.x+=J.x,ye.y+=J.y}),ye.x/=g.fixedNodeConstraint.length,ye.y/=g.fixedNodeConstraint.length,w.forEach(function(V,G){w[G]+=ye.x}),T.forEach(function(V,G){T[G]+=ye.y}),g.fixedNodeConstraint.forEach(function(V){w[m.get(V.nodeId)]=V.position.x,T[m.get(V.nodeId)]=V.position.y})}if(g.alignmentConstraint){if(g.alignmentConstraint.vertical)for(var we=g.alignmentConstraint.vertical,Me=function(G){var $=new Set;we[G].forEach(function(ne){$.add(ne)});var ae=new Set([].concat(f($)).filter(function(ne){return F.has(ne)})),J=void 0;ae.size>0?J=w[m.get(ae.values().next().value)]:J=O($).x,$.forEach(function(ne){F.has(ne)||(w[m.get(ne)]=J)})},Ie=0;Ie0?J=T[m.get(ae.values().next().value)]:J=O($).y,$.forEach(function(ne){F.has(ne)||(T[m.get(ne)]=J)})},oe=0;oe{s.exports=r}},n={};function i(s){var u=n[s];if(u!==void 0)return u.exports;var l=n[s]={exports:{}};return a[s](l,l.exports,i),l.exports}var o=i(45);return o})()})}(si)),si.exports}var Ym=oi.exports,ih;function Wm(){return ih||(ih=1,function(t,e){(function(a,n){t.exports=n(qm())})(Ym,function(r){return(()=>{var a={658:s=>{s.exports=Object.assign!=null?Object.assign.bind(Object):function(u){for(var l=arguments.length,f=Array(l>1?l-1:0),v=1;v{var f=function(){function h(d,p){var y=[],g=!0,b=!1,m=void 0;try{for(var w=d[Symbol.iterator](),T;!(g=(T=w.next()).done)&&(y.push(T.value),!(p&&y.length===p));g=!0);}catch(D){b=!0,m=D}finally{try{!g&&w.return&&w.return()}finally{if(b)throw m}}return y}return function(d,p){if(Array.isArray(d))return d;if(Symbol.iterator in Object(d))return h(d,p);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),v=l(140).layoutBase.LinkedList,c={};c.getTopMostNodes=function(h){for(var d={},p=0;p0&&z.merge(W)});for(var k=0;k1){T=m[0],D=T.connectedEdges().length,m.forEach(function(L){L.connectedEdges().length0&&y.set("dummy"+(y.size+1),P),N},c.relocateComponent=function(h,d,p){if(!p.fixedNodeConstraint){var y=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,b=Number.POSITIVE_INFINITY,m=Number.NEGATIVE_INFINITY;if(p.quality=="draft"){var w=!0,T=!1,D=void 0;try{for(var x=d.nodeIndexes[Symbol.iterator](),M;!(w=(M=x.next()).done);w=!0){var P=M.value,N=f(P,2),O=N[0],R=N[1],I=p.cy.getElementById(O);if(I){var E=I.boundingBox(),A=d.xCoords[R]-E.w/2,S=d.xCoords[R]+E.w/2,C=d.yCoords[R]-E.h/2,L=d.yCoords[R]+E.h/2;Ag&&(g=S),Cm&&(m=L)}}}catch(W){T=!0,D=W}finally{try{!w&&x.return&&x.return()}finally{if(T)throw D}}var z=h.x-(g+y)/2,k=h.y-(m+b)/2;d.xCoords=d.xCoords.map(function(W){return W+z}),d.yCoords=d.yCoords.map(function(W){return W+k})}else{Object.keys(d).forEach(function(W){var Q=d[W],K=Q.getRect().x,Z=Q.getRect().x+Q.getRect().width,j=Q.getRect().y,re=Q.getRect().y+Q.getRect().height;Kg&&(g=Z),jm&&(m=re)});var F=h.x-(g+y)/2,H=h.y-(m+b)/2;Object.keys(d).forEach(function(W){var Q=d[W];Q.setCenter(Q.getCenterX()+F,Q.getCenterY()+H)})}}},c.calcBoundingBox=function(h,d,p,y){for(var g=Number.MAX_SAFE_INTEGER,b=Number.MIN_SAFE_INTEGER,m=Number.MAX_SAFE_INTEGER,w=Number.MIN_SAFE_INTEGER,T=void 0,D=void 0,x=void 0,M=void 0,P=h.descendants().not(":parent"),N=P.length,O=0;OT&&(g=T),bx&&(m=x),w{var f=l(548),v=l(140).CoSELayout,c=l(140).CoSENode,h=l(140).layoutBase.PointD,d=l(140).layoutBase.DimensionD,p=l(140).layoutBase.LayoutConstants,y=l(140).layoutBase.FDLayoutConstants,g=l(140).CoSEConstants,b=function(w,T){var D=w.cy,x=w.eles,M=x.nodes(),P=x.edges(),N=void 0,O=void 0,R=void 0,I={};w.randomize&&(N=T.nodeIndexes,O=T.xCoords,R=T.yCoords);var E=function(W){return typeof W=="function"},A=function(W,Q){return E(W)?W(Q):W},S=f.calcParentsWithoutChildren(D,x),C=function H(W,Q,K,Z){for(var j=Q.length,re=0;re0){var te=void 0;te=K.getGraphManager().add(K.newGraph(),Y),H(te,U,K,Z)}}},L=function(W,Q,K){for(var Z=0,j=0,re=0;re0?g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=Z/j:E(w.idealEdgeLength)?g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=50:g.DEFAULT_EDGE_LENGTH=y.DEFAULT_EDGE_LENGTH=w.idealEdgeLength,g.MIN_REPULSION_DIST=y.MIN_REPULSION_DIST=y.DEFAULT_EDGE_LENGTH/10,g.DEFAULT_RADIAL_SEPARATION=y.DEFAULT_EDGE_LENGTH)},z=function(W,Q){Q.fixedNodeConstraint&&(W.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(W.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(W.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};w.nestingFactor!=null&&(g.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=w.nestingFactor),w.gravity!=null&&(g.DEFAULT_GRAVITY_STRENGTH=y.DEFAULT_GRAVITY_STRENGTH=w.gravity),w.numIter!=null&&(g.MAX_ITERATIONS=y.MAX_ITERATIONS=w.numIter),w.gravityRange!=null&&(g.DEFAULT_GRAVITY_RANGE_FACTOR=y.DEFAULT_GRAVITY_RANGE_FACTOR=w.gravityRange),w.gravityCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.DEFAULT_COMPOUND_GRAVITY_STRENGTH=w.gravityCompound),w.gravityRangeCompound!=null&&(g.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=w.gravityRangeCompound),w.initialEnergyOnIncremental!=null&&(g.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.DEFAULT_COOLING_FACTOR_INCREMENTAL=w.initialEnergyOnIncremental),w.tilingCompareBy!=null&&(g.TILING_COMPARE_BY=w.tilingCompareBy),w.quality=="proof"?p.QUALITY=2:p.QUALITY=0,g.NODE_DIMENSIONS_INCLUDE_LABELS=y.NODE_DIMENSIONS_INCLUDE_LABELS=p.NODE_DIMENSIONS_INCLUDE_LABELS=w.nodeDimensionsIncludeLabels,g.DEFAULT_INCREMENTAL=y.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!w.randomize,g.ANIMATE=y.ANIMATE=p.ANIMATE=w.animate,g.TILE=w.tile,g.TILING_PADDING_VERTICAL=typeof w.tilingPaddingVertical=="function"?w.tilingPaddingVertical.call():w.tilingPaddingVertical,g.TILING_PADDING_HORIZONTAL=typeof w.tilingPaddingHorizontal=="function"?w.tilingPaddingHorizontal.call():w.tilingPaddingHorizontal,g.DEFAULT_INCREMENTAL=y.DEFAULT_INCREMENTAL=p.DEFAULT_INCREMENTAL=!0,g.PURE_INCREMENTAL=!w.randomize,p.DEFAULT_UNIFORM_LEAF_NODE_SIZES=w.uniformNodeDimensions,w.step=="transformed"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!1),w.step=="enforced"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!1),w.step=="cose"&&(g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!1,g.APPLY_LAYOUT=!0),w.step=="all"&&(w.randomize?g.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:g.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,g.ENFORCE_CONSTRAINTS=!0,g.APPLY_LAYOUT=!0),w.fixedNodeConstraint||w.alignmentConstraint||w.relativePlacementConstraint?g.TREE_REDUCTION_ON_INCREMENTAL=!1:g.TREE_REDUCTION_ON_INCREMENTAL=!0;var k=new v,F=k.newGraphManager();return C(F.addRoot(),f.getTopMostNodes(M),k,w),L(k,F,P),z(k,w),k.runLayout(),I};s.exports={coseLayout:b}},212:(s,u,l)=>{var f=function(){function w(T,D){for(var x=0;x0)if(S){var z=h.getTopMostNodes(x.eles.nodes());if(R=h.connectComponents(M,x.eles,z),R.forEach(function(pe){var le=pe.boundingBox();I.push({x:le.x1+le.w/2,y:le.y1+le.h/2})}),x.randomize&&R.forEach(function(pe){x.eles=pe,N.push(p(x))}),x.quality=="default"||x.quality=="proof"){var k=M.collection();if(x.tile){var F=new Map,H=[],W=[],Q=0,K={nodeIndexes:F,xCoords:H,yCoords:W},Z=[];if(R.forEach(function(pe,le){pe.edges().length==0&&(pe.nodes().forEach(function(ce,ve){k.merge(pe.nodes()[ve]),ce.isParent()||(K.nodeIndexes.set(pe.nodes()[ve].id(),Q++),K.xCoords.push(pe.nodes()[0].position().x),K.yCoords.push(pe.nodes()[0].position().y))}),Z.push(le))}),k.length>1){var j=k.boundingBox();I.push({x:j.x1+j.w/2,y:j.y1+j.h/2}),R.push(k),N.push(K);for(var re=Z.length-1;re>=0;re--)R.splice(Z[re],1),N.splice(Z[re],1),I.splice(Z[re],1)}}R.forEach(function(pe,le){x.eles=pe,O.push(g(x,N[le])),h.relocateComponent(I[le],O[le],x)})}else R.forEach(function(pe,le){h.relocateComponent(I[le],N[le],x)});var q=new Set;if(R.length>1){var U=[],Y=P.filter(function(pe){return pe.css("display")=="none"});R.forEach(function(pe,le){var ce=void 0;if(x.quality=="draft"&&(ce=N[le].nodeIndexes),pe.nodes().not(Y).length>0){var ve={};ve.edges=[],ve.nodes=[];var de=void 0;pe.nodes().not(Y).forEach(function(me){if(x.quality=="draft")if(!me.isParent())de=ce.get(me.id()),ve.nodes.push({x:N[le].xCoords[de]-me.boundingbox().w/2,y:N[le].yCoords[de]-me.boundingbox().h/2,width:me.boundingbox().w,height:me.boundingbox().h});else{var ye=h.calcBoundingBox(me,N[le].xCoords,N[le].yCoords,ce);ve.nodes.push({x:ye.topLeftX,y:ye.topLeftY,width:ye.width,height:ye.height})}else O[le][me.id()]&&ve.nodes.push({x:O[le][me.id()].getLeft(),y:O[le][me.id()].getTop(),width:O[le][me.id()].getWidth(),height:O[le][me.id()].getHeight()})}),pe.edges().forEach(function(me){var ye=me.source(),we=me.target();if(ye.css("display")!="none"&&we.css("display")!="none")if(x.quality=="draft"){var Me=ce.get(ye.id()),Ie=ce.get(we.id()),Be=[],Fe=[];if(ye.isParent()){var oe=h.calcBoundingBox(ye,N[le].xCoords,N[le].yCoords,ce);Be.push(oe.topLeftX+oe.width/2),Be.push(oe.topLeftY+oe.height/2)}else Be.push(N[le].xCoords[Me]),Be.push(N[le].yCoords[Me]);if(we.isParent()){var B=h.calcBoundingBox(we,N[le].xCoords,N[le].yCoords,ce);Fe.push(B.topLeftX+B.width/2),Fe.push(B.topLeftY+B.height/2)}else Fe.push(N[le].xCoords[Ie]),Fe.push(N[le].yCoords[Ie]);ve.edges.push({startX:Be[0],startY:Be[1],endX:Fe[0],endY:Fe[1]})}else O[le][ye.id()]&&O[le][we.id()]&&ve.edges.push({startX:O[le][ye.id()].getCenterX(),startY:O[le][ye.id()].getCenterY(),endX:O[le][we.id()].getCenterX(),endY:O[le][we.id()].getCenterY()})}),ve.nodes.length>0&&(U.push(ve),q.add(le))}});var X=A.packComponents(U,x.randomize).shifts;if(x.quality=="draft")N.forEach(function(pe,le){var ce=pe.xCoords.map(function(de){return de+X[le].dx}),ve=pe.yCoords.map(function(de){return de+X[le].dy});pe.xCoords=ce,pe.yCoords=ve});else{var ee=0;q.forEach(function(pe){Object.keys(O[pe]).forEach(function(le){var ce=O[pe][le];ce.setCenter(ce.getCenterX()+X[ee].dx,ce.getCenterY()+X[ee].dy)}),ee++})}}}else{var C=x.eles.boundingBox();if(I.push({x:C.x1+C.w/2,y:C.y1+C.h/2}),x.randomize){var L=p(x);N.push(L)}x.quality=="default"||x.quality=="proof"?(O.push(g(x,N[0])),h.relocateComponent(I[0],O[0],x)):h.relocateComponent(I[0],N[0],x)}var te=function(le,ce){if(x.quality=="default"||x.quality=="proof"){typeof le=="number"&&(le=ce);var ve=void 0,de=void 0,me=le.data("id");return O.forEach(function(we){me in we&&(ve={x:we[me].getRect().getCenterX(),y:we[me].getRect().getCenterY()},de=we[me])}),x.nodeDimensionsIncludeLabels&&(de.labelWidth&&(de.labelPosHorizontal=="left"?ve.x+=de.labelWidth/2:de.labelPosHorizontal=="right"&&(ve.x-=de.labelWidth/2)),de.labelHeight&&(de.labelPosVertical=="top"?ve.y+=de.labelHeight/2:de.labelPosVertical=="bottom"&&(ve.y-=de.labelHeight/2))),ve==null&&(ve={x:le.position("x"),y:le.position("y")}),{x:ve.x,y:ve.y}}else{var ye=void 0;return N.forEach(function(we){var Me=we.nodeIndexes.get(le.id());Me!=null&&(ye={x:we.xCoords[Me],y:we.yCoords[Me]})}),ye==null&&(ye={x:le.position("x"),y:le.position("y")}),{x:ye.x,y:ye.y}}};if(x.quality=="default"||x.quality=="proof"||x.randomize){var ge=h.calcParentsWithoutChildren(M,P),Te=P.filter(function(pe){return pe.css("display")=="none"});x.eles=P.not(Te),P.nodes().not(":parent").not(Te).layoutPositions(D,x,te),ge.length>0&&ge.forEach(function(pe){pe.position(te(pe))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),w}();s.exports=m},657:(s,u,l)=>{var f=l(548),v=l(140).layoutBase.Matrix,c=l(140).layoutBase.SVD,h=function(p){var y=p.cy,g=p.eles,b=g.nodes(),m=g.nodes(":parent"),w=new Map,T=new Map,D=new Map,x=[],M=[],P=[],N=[],O=[],R=[],I=[],E=[],A=void 0,S=1e8,C=1e-9,L=p.piTol,z=p.samplingType,k=p.nodeSeparation,F=void 0,H=function(){for(var G=0,$=0,ae=!1;$=ne;){ue=J[ne++];for(var Ve=x[ue],Ae=0;Aehe&&(he=O[Pe],Ce=Pe)}return Ce},Q=function(G){var $=void 0;if(G){$=Math.floor(Math.random()*A);for(var J=0;J=1)break;se=fe}for(var Ee=0;Ee=1)break;se=fe}for(var Ae=0;Ae0&&($.isParent()?x[G].push(D.get($.id())):x[G].push($.id()))})});var Te=function(G){var $=T.get(G),ae=void 0;w.get(G).forEach(function(J){y.getElementById(J).isParent()?ae=D.get(J):ae=J,x[$].push(ae),x[T.get(ae)].push(G)})},pe=!0,le=!1,ce=void 0;try{for(var ve=w.keys()[Symbol.iterator](),de;!(pe=(de=ve.next()).done);pe=!0){var me=de.value;Te(me)}}catch(V){le=!0,ce=V}finally{try{!pe&&ve.return&&ve.return()}finally{if(le)throw ce}}A=T.size;var ye=void 0;if(A>2){F=A{var f=l(212),v=function(h){h&&h("layout","fcose",f)};typeof cytoscape<"u"&&v(cytoscape),s.exports=v},140:s=>{s.exports=r}},n={};function i(s){var u=n[s];if(u!==void 0)return u.exports;var l=n[s]={exports:{}};return a[s](l,l.exports,i),l.exports}var o=i(579);return o})()})}(oi)),oi.exports}var Xm=Wm(),$m=Vm(Xm);function Km(t,{nodes:e,edges:r,options:a}){return new Promise((n,i)=>{let o=null;try{o=t({headless:!0,styleEnabled:!0,style:[{selector:"node",style:{width:"data(size)",height:"data(size)"}}],elements:[...e.map(u=>({data:{id:u.id,size:u.size||8}})),...r.map(u=>({data:{id:u.id,source:u.source,target:u.target}}))]});const s=o.layout({...a,animate:!1});s.one("layoutstop",()=>{const u={};o.nodes().forEach(l=>{const f=l.position();u[l.id()]={x:f.x,y:f.y}}),o.destroy(),n(u)}),s.run()}catch(s){o&&!o.destroyed()&&o.destroy(),i(s)}})}Cr.use($m),self.onmessage=t=>{const{id:e,nodes:r,edges:a,options:n}=t.data||{};Km(Cr,{nodes:r,edges:a,options:n}).then(i=>self.postMessage({id:e,positions:i})).catch(i=>self.postMessage({id:e,error:String(i&&i.message||i)}))}})();