import{aq as Ri}from"./md-index-CaQzOFPE.js";function Ue(r){"@babel/helpers - typeof";return Ue=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},Ue(r)}function ii(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Gu(r,e){for(var t=0;tr.length)&&(e=r.length);for(var t=0,a=new Array(e);t=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},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=!0,o=!1,s;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}}}var Ke=typeof window>"u"?null:window,Ii=Ke?Ke.navigator:null;Ke&&Ke.document;var Yu=Ue(""),_o=Ue({}),Xu=Ue(function(){}),Zu=typeof HTMLElement>"u"?"undefined":Ue(HTMLElement),wa=function(e){return e&&e.instanceString&&qe(e.instanceString)?e.instanceString():null},ce=function(e){return e!=null&&Ue(e)==Yu},qe=function(e){return e!=null&&Ue(e)===Xu},Oe=function(e){return!yr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Te=function(e){return e!=null&&Ue(e)===_o&&!Oe(e)&&e.constructor===Object},Qu=function(e){return e!=null&&Ue(e)===_o},ne=function(e){return e!=null&&Ue(e)===Ue(1)&&!isNaN(e)},Ju=function(e){return ne(e)&&Math.floor(e)===e},_a=function(e){if(Zu!=="undefined")return e!=null&&e instanceof HTMLElement},yr=function(e){return xa(e)||jo(e)},xa=function(e){return wa(e)==="collection"&&e._private.single},jo=function(e){return wa(e)==="collection"&&!e._private.single},si=function(e){return wa(e)==="core"},es=function(e){return wa(e)==="stylesheet"},_u=function(e){return wa(e)==="event"},jr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},ju=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},el=function(e){return Te(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},rl=function(e){return Qu(e)&&qe(e.then)},tl=function(){return Ii&&Ii.userAgent.match(/msie|trident|edge/i)},la=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;ot?1:0},ll=function(e,t){return-1*ts(e,t)},pe=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(p-=1),p<1/6?d+(y-d)*6*p:p<1/2?y:p<2/3?d+(y-d)*(2/3-p)*6:d}var f=new RegExp("^"+il+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,o=f[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*v(h,c,a+1/3)),l=Math.round(255*v(h,c,a)),u=Math.round(255*v(h,c,a-1/3))}t=[s,l,u,o]}return t},cl=function(e){var t,a=new RegExp("^"+al+"$").exec(e);if(a){t=[];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;t.push(Math.floor(o))}var s=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(s&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},dl=function(e){return gl[e.toLowerCase()]},hl=function(e){return(Oe(e)?e:null)||dl(e)||vl(e)||cl(e)||fl(e)},gl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},as=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i=e||x<0||f&&D>=i}function g(){var E=Mn();if(p(E))return m(E);s=setTimeout(g,y(E))}function m(E){return s=void 0,c&&a?h(E):(a=n=void 0,o)}function b(){s!==void 0&&clearTimeout(s),u=0,a=l=n=s=void 0}function w(){return s===void 0?o:m(Mn())}function S(){var E=Mn(),x=p(E);if(a=arguments,n=this,l=E,x){if(s===void 0)return d(l);if(f)return clearTimeout(s),s=setTimeout(g,e),h(l)}return s===void 0&&(s=setTimeout(g,e)),o}return S.cancel=b,S.flush=w,S}var cn=jl,Ln=Ke?Ke.performance:null,ss=Ln&&Ln.now?function(){return Ln.now()}:function(){return Date.now()},ev=function(){if(Ke){if(Ke.requestAnimationFrame)return function(r){Ke.requestAnimationFrame(r)};if(Ke.mozRequestAnimationFrame)return function(r){Ke.mozRequestAnimationFrame(r)};if(Ke.webkitRequestAnimationFrame)return function(r){Ke.webkitRequestAnimationFrame(r)};if(Ke.msRequestAnimationFrame)return function(r){Ke.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(ss())},1e3/60)}}(),ja=function(e){return ev(e)},Hr=ss,kt=9261,us=65599,aa=5381,ls=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt,a=t,n;n=e.next(),!n.done;)a=a*us+n.value|0;return a},va=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt;return t*us+e|0},fa=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;return(t<<5)+t+e|0},rv=function(e,t){return e*2097152+t},Yr=function(e){return e[0]*2097152+e[1]},La=function(e,t){return[va(e[0],t[0]),fa(e[1],t[1])]},tv=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n=0;n--)e[n]===t&&e.splice(n,1)},fi=function(e){e.splice(0,e.length)},lv=function(e,t){for(var a=0;a"u"?"undefined":Ue(Set))!==fv?Set:cv,dn=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!si(e)){$e("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){$e("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:t.data||{},position:t.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:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new Vt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),l=e.zoom();i.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];Oe(t.classes)?u=t.classes:ce(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;vm?1:0},v=function(g,m,b,w,S){var E;if(b==null&&(b=0),S==null&&(S=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);bM;0<=M?C++:C--)D.push(C);return D}).apply(this).reverse(),x=[],w=0,S=E.length;wP;0<=P?++D:--D)B.push(o(g,b));return B},y=function(g,m,b,w){var S,E,x;for(w==null&&(w=a),S=g[b];b>m;){if(x=b-1>>1,E=g[x],w(S,E)<0){g[b]=E,b=x;continue}break}return g[b]=S},p=function(g,m,b){var w,S,E,x,D;for(b==null&&(b=a),S=g.length,D=m,E=g[m],w=2*m+1;w0;){var E=m.pop(),x=p(E),D=E.id();if(c[D]=x,x!==1/0)for(var C=E.neighborhood().intersect(d),M=0;M0)for(I.unshift(R);f[G];){var F=f[G];I.unshift(F.edge),I.unshift(F.node),V=F.node,G=V.id()}return s.spawn(I)}}}},pv={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,o=new Array(i),s=a,l=function(w){for(var S=0;S0;){if(S(),x++,w===v){for(var D=[],C=i,M=v,P=g[M];D.unshift(C),P!=null&&D.unshift(P),C=p[M],C!=null;)M=C.id(),P=g[M];return{found:!0,distance:f[w],path:this.spawn(D),steps:x}}h[w]=!0;for(var B=b._private.edges,L=0;LP&&(d[M]=P,m[M]=C,b[M]=S),!i){var B=C*v+D;!i&&d[B]>P&&(d[B]=P,m[B]=D,b[B]=S)}}}for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:o,Le=b(se),Ce=[],xe=Le;;){if(xe==null)return t.spawn();var Ae=m(xe),Ee=Ae.edge,Pe=Ae.pred;if(Ce.unshift(xe[0]),xe.same(de)&&Ce.length>0)break;Ee!=null&&Ce.unshift(Ee),xe=Pe}return l.spawn(Ce)},E=0;E=0;v--){var f=u[v],c=f[1],h=f[2];(t[c]===s&&t[h]===l||t[c]===l&&t[h]===s)&&u.splice(v,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*t.length);t=Sv(i,e,t),a--}return t},Tv={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(I){return I.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Cv);if(i<2){$e("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],v=0;v1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;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=t;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(t,a):(a0&&e.splice(0,t));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,s++):e.splice(l,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},Lv=function(e){return Math.PI*e/180},Aa=function(e,t){return Math.atan2(t,e)-Math.PI/2},ci=Math.log2||function(r){return Math.log(r)/Math.log(2)},ps=function(e){return e>0?1:e<0?-1:0},ht=function(e,t){return Math.sqrt(st(e,t))},st=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Av=function(e){for(var t=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}}},Ov=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Iv=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},zv=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},ys=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Nv=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Ga=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ka=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(t.length===1)a=n=i=o=t[0];else if(t.length===2)a=i=t[0],o=n=t[1];else if(t.length===4){var s=Tr(t,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},Gi=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},di=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},It=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Fv=function(e,t){return It(e,t.x,t.y)},ms=function(e,t){return It(e,t.x1,t.y1)&&It(e,t.x2,t.y2)},bs=function(e,t,a,n,i,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?gt(i,o):l,v=i/2,f=o/2;u=Math.min(u,v,f);var c=u!==v,h=u!==f,d;if(c){var y=a-v+u-s,p=n-f-s,g=a+v-u+s,m=p;if(d=Qr(e,t,a,n,y,p,g,m,!1),d.length>0)return d}if(h){var b=a+v+s,w=n-f+u-s,S=b,E=n+f-u+s;if(d=Qr(e,t,a,n,b,w,S,E,!1),d.length>0)return d}if(c){var x=a-v+u-s,D=n+f+s,C=a+v-u+s,M=D;if(d=Qr(e,t,a,n,x,D,C,M,!1),d.length>0)return d}if(h){var P=a-v-s,B=n-f+u-s,L=P,k=n+f-u+s;if(d=Qr(e,t,a,n,P,B,L,k,!1),d.length>0)return d}var O;{var A=a-v+u,R=n-f+u;if(O=na(e,t,a,n,A,R,u+s),O.length>0&&O[0]<=A&&O[1]<=R)return[O[0],O[1]]}{var I=a+v-u,V=n-f+u;if(O=na(e,t,a,n,I,V,u+s),O.length>0&&O[0]>=I&&O[1]<=V)return[O[0],O[1]]}{var G=a+v-u,F=n+f-u;if(O=na(e,t,a,n,G,F,u+s),O.length>0&&O[0]>=G&&O[1]>=F)return[O[0],O[1]]}{var q=a-v+u,Y=n+f-u;if(O=na(e,t,a,n,q,Y,u+s),O.length>0&&O[0]<=q&&O[1]>=Y)return[O[0],O[1]]}return[]},Vv=function(e,t,a,n,i,o,s){var l=s,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,o),c=Math.max(n,o);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},qv=function(e,t,a,n,i,o,s,l,u){var v={x1:Math.min(a,s,i)-u,x2:Math.max(a,s,i)+u,y1:Math.min(n,l,o)-u,y2:Math.max(n,l,o)+u};return!(ev.x2||tv.y2)},$v=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,l=(-t+o)/s,u=(-t-o)/s;return[l,u]},Hv=function(e,t,a,n,i){var o=1e-5;e===0&&(e=o),t/=e,a/=e,n/=e;var s,l,u,v,f,c,h,d;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,s=l*l*l+u*u,i[1]=0,h=t/3,s>0){f=u+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=u-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),d=2*Math.sqrt(l),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)},Gv=function(e,t,a,n,i,o,s,l){var u=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*l+4*o*o-4*o*l+l*l,v=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*l-6*o*o+3*o*l,f=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*l-n*t+2*o*o+2*o*t-l*t,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*t-o*t,h=[];Hv(u,v,f,c,h);for(var d=1e-7,y=[],p=0;p<6;p+=2)Math.abs(h[p+1])=0&&h[p]<=1&&y.push(h[p]);y.push(1),y.push(0);for(var g=-1,m,b,w,S=0;S=0?wu?(e-i)*(e-i)+(t-o)*(t-o):v-c},dr=function(e,t,a){for(var n,i,o,s,l,u=0,v=0;v=e&&e>=o||n<=e&&e<=o)l=(e-n)/(o-n)*(s-i)+i,l>t&&u++;else continue;return u%2!==0},Gr=function(e,t,a,n,i,o,s,l,u){var v=new Array(a.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d0){var p=tn(v,-u);y=rn(p)}else y=v;return dr(e,t,y)},Wv=function(e,t,a,n,i,o,s,l){for(var u=new Array(a.length*2),v=0;v=0&&p<=1&&m.push(p),g>=0&&g<=1&&m.push(g),m.length===0)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var S=m[1]*l[0]+e,E=m[1]*l[1]+t;return[b,w,S,E]}else return[b,w]},Rn=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},Qr=function(e,t,a,n,i,o,s,l,u){var v=e-i,f=a-e,c=s-i,h=t-o,d=n-t,y=l-o,p=c*h-y*v,g=f*h-d*v,m=y*f-c*d;if(m!==0){var b=p/m,w=g/m,S=.001,E=0-S,x=1+S;return E<=b&&b<=x&&E<=w&&w<=x?[e+b*f,t+b*d]:u?[e+b*f,t+b*d]:[]}else return p===0||g===0?Rn(e,a,s)===s?[s,l]:Rn(e,a,i)===i?[i,o]:Rn(i,s,a)===a?[a,n]:[]:[]},ha=function(e,t,a,n,i,o,s,l){var u=[],v,f=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d0){var y=tn(f,-l);h=rn(y)}else h=f}else h=a;for(var p,g,m,b,w=0;w2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),p=1;pv&&(v=w)},get:function(b){return u[b]}},c=0;c0?A=O.edgesTo(k)[0]:A=k.edgesTo(O)[0];var R=n(A);k=k.id(),D[k]>D[B]+R&&(D[k]=D[B]+R,C.nodes.indexOf(k)<0?C.push(k):C.updateItem(k),x[k]=0,E[k]=[]),D[k]==D[B]+R&&(x[k]=x[k]+x[B],E[k].push(B))}else for(var I=0;I0;){for(var q=S.pop(),Y=0;Y0&&s.push(a[l]);s.length!==0&&i.push(n.collection(s))}return i},uf=function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:ff,s=n,l,u,v=0;v=2?_t(e,t,a,0,Xi,cf):_t(e,t,a,0,Yi)},squaredEuclidean:function(e,t,a){return _t(e,t,a,0,Xi)},manhattan:function(e,t,a){return _t(e,t,a,0,Yi)},max:function(e,t,a){return _t(e,t,a,-1/0,df)}};zt["squared-euclidean"]=zt.squaredEuclidean;zt.squaredeuclidean=zt.squaredEuclidean;function gn(r,e,t,a,n,i){var o;return qe(r)?o=r:o=zt[r]||zt.euclidean,e===0&&qe(r)?o(n,i):o(e,t,a,n,i)}var hf=rr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),gi=function(e){return hf(e)},an=function(e,t,a,n,i){var o=i!=="kMedoids",s=o?function(f){return a[f]}:function(f){return n[f](a)},l=function(c){return n[c](t)},u=a,v=t;return gn(e,n.length,s,l,u,v)},On=function(e,t,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(t),l=null,u=0;ua)return!1}return!0},yf=function(e,t,a){for(var n=0;ns&&(s=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[o],y=t[n[o]],p;i.mode==="dendrogram"?p={left:d,right:y,key:d.key}:p={value:d.value.concat(y.value),key:d.key},e[d.index]=p,e.splice(y.index,1),t[d.key]=p;for(var g=0;ga[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]0&&n.push(i);return n},eo=function(e,t,a){for(var n=[],i=0;is&&(o=u,s=t[i*e+u])}o>0&&n.push(o)}for(var v=0;vu&&(l=v,u=f)}a[i]=o[l]}return n=eo(e,t,a),n},ro=function(e){for(var t=this.cy(),a=this.nodes(),n=Lf(e),i={},o=0;o=P?(B=P,P=k,L=O):k>B&&(B=k);for(var A=0;A0?1:0;x[C%n.minIterations*s+q]=Y,F+=Y}if(F>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var Q=0,J=0;J1||E>1)&&(s=!0),f[b]=[],m.outgoers().forEach(function(D){D.isEdge()&&f[b].push(D.id())})}else c[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(l?u?s=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(S){return f[b].push(S.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(u&&l)if(i){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=o[0].id());var d=function(b){for(var w=b,S=[b],E,x,D;f[w].length;)E=f[w].shift(),x=c[E][0],D=c[E][1],w!=D?(f[D]=f[D].filter(function(C){return C!=E}),w=D):!i&&w!=x&&(f[x]=f[x].filter(function(C){return C!=E}),w=x),S.unshift(E),S.unshift(w);return S},y=[],p=[];for(p=d(v);p.length!=1;)f[p[0]].length==0?(y.unshift(o.getElementById(p.shift())),y.unshift(o.getElementById(p.shift()))):p=d(p.shift()).concat(p);y.unshift(o.getElementById(p.shift()));for(var g in f)if(f[g].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},Ia=function(){var e=this,t={},a=0,n=0,i=[],o=[],s={},l=function(c,h){for(var d=o.length-1,y=[],p=e.spawn();o[d].x!=c||o[d].y!=h;)y.push(o.pop().edge),d--;y.push(o.pop().edge),y.forEach(function(g){var m=g.connectedNodes().intersection(e);p.merge(g),m.forEach(function(b){var w=b.id(),S=b.connectedEdges().intersection(e);p.merge(b),t[w].cutVertex?p.merge(S.filter(function(E){return E.isLoop()})):p.merge(S)})}),i.push(p)},u=function f(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var p,g,m,b;y.forEach(function(w){p=w.source().id(),g=w.target().id(),m=p===h?g:p,m!==d&&(b=w.id(),s[b]||(s[b]=!0,o.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(f(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,l(h,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},Vf={hopcroftTarjanBiconnected:Ia,htbc:Ia,htb:Ia,hopcroftTarjanBiconnectedComponents:Ia},za=function(){var e=this,t={},a=0,n=[],i=[],o=e.spawn(e),s=function l(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(y){var p=y.target().id();p!==u&&(p in t||l(p),t[p].explored||(t[u].low=Math.min(t[u].low,t[p].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||s(u)}}),{cut:o,components:n}},qf={tarjanStronglyConnected:za,tsc:za,tscc:za,tarjanStronglyConnectedComponents:za},Ds={};[ca,gv,pv,mv,wv,Ev,Tv,Qv,Lt,At,Wn,vf,Cf,Bf,zf,Ff,Vf,qf].forEach(function(r){pe(Ds,r)});/*! 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 ks=0,Ps=1,Bs=2,Kr=function r(e){if(!(this instanceof r))return new r(e);this.id="Thenable/1.0.7",this.state=ks,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))};Kr.prototype={fulfill:function(e){return to(this,Ps,"fulfillValue",e)},reject:function(e){return to(this,Bs,"rejectReason",e)},then:function(e,t){var a=this,n=new Kr;return a.onFulfilled.push(no(e,n,"fulfill")),a.onRejected.push(no(t,n,"reject")),Ms(a),n.proxy}};var to=function(e,t,a,n){return e.state===ks&&(e.state=t,e[a]=n,Ms(e)),e},Ms=function(e){e.state===Ps?ao(e,"onFulfilled",e.fulfillValue):e.state===Bs&&ao(e,"onRejected",e.rejectReason)},ao=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var s=0;s0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o-1}var Yc=Uc;function Xc(r,e){var t=this.__data__,a=yn(t,r);return a<0?(++this.size,t.push([r,e])):t[a][1]=e,this}var Zc=Xc;function Ht(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e-1&&r%1==0&&r0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Oe(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===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,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};Wa.className=Wa.classNames=Wa.classes;var Se={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:We,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Se.variable="(?:[\\w-.]|(?:\\\\"+Se.metaChar+"))+";Se.className="(?:[\\w-]|(?:\\\\"+Se.metaChar+"))+";Se.value=Se.string+"|"+Se.number;Se.id=Se.variable;(function(){var r,e,t;for(r=Se.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(Se.comparatorOp+="|\\!"+e)})();var Re=function(){return{checks:[]}},ue={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},Yn=[{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(r,e){return ll(r.selector,e.selector)}),jd=function(){for(var r={},e,t=0;t0&&v.edgeCount>0)return Me("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Me("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Me("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},ih=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return ce(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,h=v.value;switch(c){case ue.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case ue.DATA_COMPARE:{var y=v.field,p=v.operator;return"["+y+a(e(p))+t(h)+"]"}case ue.DATA_BOOL:{var g=v.operator,m=v.field;return"["+e(g)+m+"]"}case ue.DATA_EXIST:{var b=v.field;return"["+b+"]"}case ue.META_COMPARE:{var w=v.operator,S=v.field;return"[["+S+a(e(w))+t(h)+"]]"}case ue.STATE:return h;case ue.ID:return"#"+h;case ue.CLASS:return"."+h;case ue.PARENT:case ue.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case ue.ANCESTOR:case ue.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case ue.COMPOUND_SPLIT:{var E=i(v.left,f),x=i(v.subject,f),D=i(v.right,f);return E+(E.length>0?" ":"")+x+D}case ue.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&d===0?"$":"")+n(h,f)},"")},o="",s=0;s1&&s=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||s||v)&&(l=!i&&!o?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var v=n.shift();e(v),i.add(v.id()),s&&a(n,i,v)}return r}function Vs(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return wi(this,r,e,Vs)};function qs(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}Nt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return wi(this,r,e,qs)};function dh(r,e,t){qs(r,e,t),Vs(r,e,t)}Nt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return wi(this,r,e,dh)};Nt.ancestors=Nt.parents;var pa,$s;pa=$s={data:Be.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:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Be.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Be.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};pa.attr=pa.data;pa.removeAttr=pa.removeData;var hh=$s,bn={};function zn(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,o=0;oe}),minIndegree:Et("indegree",function(r,e){return re}),minOutdegree:Et("outdegree",function(r,e){return re})});pe(bn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};t!==void 0?u.position(e,t+h[e]):i!==void 0&&u.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),y=s?a.parent():null,p=y&&y.length>0,g=p;p&&(y=y[0]);var m=g?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Pr.modelPosition=Pr.point=Pr.position;Pr.modelPositions=Pr.points=Pr.positions;Pr.renderedPoint=Pr.renderedPosition;Pr.relativePoint=Pr.relativePosition;var gh=Hs,Rt,nt;Rt=nt={};nt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}};nt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};nt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",v={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")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function h(C,M,P){var B=0,L=0,k=M+P;return C>0&&k>0&&(B=M/k*C,L=P/k*C),{biasDiff:B,biasComplementDiff:L}}function d(C,M,P,B){if(P.units==="%")switch(B){case"width":return C>0?P.pfValue*C:0;case"height":return M>0?P.pfValue*M:0;case"average":return C>0&&M>0?P.pfValue*(C+M)/2:0;case"min":return C>0&&M>0?C>M?P.pfValue*M:P.pfValue*C:0;case"max":return C>0&&M>0?C>M?P.pfValue*C:P.pfValue*M:0;default:return 0}else return P.units==="px"?P.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var p=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(p=p*100/v.width.val);var g=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(g=g*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=h(v.width.val-f.w,y,p),w=b.biasDiff,S=b.biasComplementDiff,E=h(v.height.val-f.h,g,m),x=E.biasDiff,D=E.biasComplementDiff;s.autoPadding=d(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+S)/2,s.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+D)/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)},ut=function(e,t){return t==null?e:Dr(e,t.x1,t.y1,t.x2,t.y2)},jt=function(e,t,a){return kr(e,t,a)},Na=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,o=i.arrowWidth/2,s=t.pstyle(a+"-arrow-shape").value,l,u;if(s!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-o,f.y1=u-o,f.x2=l+o,f.y2=u+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,Ga(f,1),Dr(e,f.x1,f.y1,f.x2,f.y2)}}},Nn=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,o=i.rstyle,s=t.pstyle(n+"label").strValue;if(s){var l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=jt(o,"labelWidth",a),f=jt(o,"labelHeight",a),c=jt(o,"labelX",a),h=jt(o,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,p=t.isEdge(),g=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,S=t.pstyle("text-background-padding").pfValue,E=2,x=f,D=v,C=D/2,M=x/2,P,B,L,k;if(p)P=c-C,B=c+C,L=h-M,k=h+M;else{switch(l.value){case"left":P=c-D,B=c;break;case"center":P=c-C,B=c+C;break;case"right":P=c,B=c+D;break}switch(u.value){case"top":L=h-x,k=h;break;case"center":L=h-M,k=h+M;break;case"bottom":L=h,k=h+x;break}}var O=d-Math.max(m,w)-S-E,A=d+Math.max(m,w)+S+E,R=y-Math.max(m,w)-S-E,I=y+Math.max(m,w)+S+E;P+=O,B+=A,L+=R,k+=I;var V=a||"main",G=i.labelBounds,F=G[V]=G[V]||{};F.x1=P,F.y1=L,F.x2=B,F.y2=k,F.w=B-P,F.h=k-L,F.leftPad=O,F.rightPad=A,F.topPad=R,F.botPad=I;var q=p&&g.strValue==="autorotate",Y=g.pfValue!=null&&g.pfValue!==0;if(q||Y){var Q=q?jt(i.rstyle,"labelAngle",a):g.pfValue,J=Math.cos(Q),_=Math.sin(Q),j=(P+B)/2,W=(L+k)/2;if(!p){switch(l.value){case"left":j=B;break;case"right":j=P;break}switch(u.value){case"top":W=k;break;case"bottom":W=L;break}}var z=function(le,se){return le=le-j,se=se-W,{x:le*J-se*_+j,y:le*_+se*J+W}},K=z(P,L),X=z(P,k),ae=z(B,L),he=z(B,k);P=Math.min(K.x,X.x,ae.x,he.x),B=Math.max(K.x,X.x,ae.x,he.x),L=Math.min(K.y,X.y,ae.y,he.y),k=Math.max(K.y,X.y,ae.y,he.y)}var te=V+"Rot",re=G[te]=G[te]||{};re.x1=P,re.y1=L,re.x2=B,re.y2=k,re.w=B-P,re.h=k-L,Dr(e,P,L,B,k),Dr(i.labelBounds.all,P,L,B,k)}return e}},ph=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,s=n+i,l=(e.w+s*2)/e.w,u=(e.h+s*2)/e.h,v=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(l=(e.w+s*2.4)/e.w,f=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?l=(e.w+s*2.4)/e.w:o==="star"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.6)/e.h,f=-s/3.8):o==="triangle"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.4)/e.h,f=-s/1.4):o==="vee"&&(l=(e.w+s*4.4)/e.w,u=(e.h+s*3.8)/e.h,f=-s*.5);var c=e.h*u-e.h,h=e.w*l-e.w;if(Ka(e,[Math.ceil(c/2),Math.ceil(h/2)]),v!=0||f!==0){var d=zv(e,v,f);ys(e,d)}}}},yh=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=hr(),s=e._private,l=e.isNode(),u=e.isEdge(),v,f,c,h,d,y,p=s.rstyle,g=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(ve){return ve.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var w=0,S=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(S=e.pstyle("overlay-padding").value));var E=0,x=0;n&&t.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(x=e.pstyle("underlay-padding").value));var D=Math.max(S,x),C=0,M=0;if(n&&(C=e.pstyle("width").pfValue,M=C/2),l&&t.includeNodes){var P=e.position();d=P.x,y=P.y;var B=e.outerWidth(),L=B/2,k=e.outerHeight(),O=k/2;v=d-L,f=d+L,c=y-O,h=y+O,Dr(o,v,c,f,h),n&&t.includeOutlines&&ph(o,e)}else if(u&&t.includeEdges)if(n&&!i){var A=e.pstyle("curve-style").strValue;if(v=Math.min(p.srcX,p.midX,p.tgtX),f=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),h=Math.max(p.srcY,p.midY,p.tgtY),v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h),A==="haystack"){var R=p.haystackPts;if(R&&R.length===2){if(v=R[0].x,c=R[0].y,f=R[1].x,h=R[1].y,v>f){var I=v;v=f,f=I}if(c>h){var V=c;c=h,h=V}Dr(o,v-M,c-M,f+M,h+M)}}else if(A==="bezier"||A==="unbundled-bezier"||A.endsWith("segments")||A.endsWith("taxi")){var G;switch(A){case"bezier":case"unbundled-bezier":G=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":G=p.linePts;break}if(G!=null)for(var F=0;Ff){var j=v;v=f,f=j}if(c>h){var W=c;c=h,h=W}v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h)}if(n&&t.includeEdges&&u&&(Na(o,e,"mid-source"),Na(o,e,"mid-target"),Na(o,e,"source"),Na(o,e,"target")),n){var z=e.pstyle("ghost").value==="yes";if(z){var K=e.pstyle("ghost-offset-x").pfValue,X=e.pstyle("ghost-offset-y").pfValue;Dr(o,o.x1+K,o.y1+X,o.x2+K,o.y2+X)}}var ae=s.bodyBounds=s.bodyBounds||{};Gi(ae,o),Ka(ae,g),Ga(ae,1),n&&(v=o.x1,f=o.x2,c=o.y1,h=o.y2,Dr(o,v-D,c-D,f+D,h+D));var he=s.overlayBounds=s.overlayBounds||{};Gi(he,o),Ka(he,g),Ga(he,1);var te=s.labelBounds=s.labelBounds||{};te.all!=null?Iv(te.all):te.all=hr(),n&&t.includeLabels&&(t.includeMainLabels&&Nn(o,e,null),u&&(t.includeSourceLabels&&Nn(o,e,"source"),t.includeTargetLabels&&Nn(o,e,"target")))}return o.x1=xr(o.x1),o.y1=xr(o.y1),o.x2=xr(o.x2),o.y2=xr(o.y2),o.w=xr(o.x2-o.x1),o.h=xr(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Ka(o,g),Ga(o,1)),o},Ks=function(e){var t=0,a=function(o){return(o?1:0)<0&&arguments[0]!==void 0?arguments[0]:Ah,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;s--)o(s);return this};at.removeAllListeners=function(){return this.removeListener("*")};at.emit=at.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Oe(e)||(e=[e]),Rh(this,function(i,o){t!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],n=a.length);for(var s=function(v){var f=a[v];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===Lh)&&i.eventMatches(i.context,f,o)){var c=[o];e!=null&&lv(c,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(y){return y!==f}));var h=i.callbackContext(i.context,f,o),d=f.callback.apply(h,c);i.afterEmit(i.context,f,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ce(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;ia&&(a=l,n=s)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,o=0;o=0&&i"u"?"undefined":Ue(Symbol))!=e&&Ue(Symbol.iterator)!=e;t&&(nn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Zo({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Te(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(ce(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var o=0;o0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});ir.neighbourhood=ir.neighborhood;ir.closedNeighbourhood=ir.closedNeighborhood;ir.openNeighbourhood=ir.openNeighborhood;pe(ir,{source:Er(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:Er(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Eo({attr:"source"}),targets:Eo({attr:"target"})});function Eo(r){return function(t){for(var a=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ir.componentsOf=ir.components;var er=function(e,t){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){$e("A collection must have a reference to the core");return}var i=new Ir,o=!1;if(!t)t=[];else if(t.length>0&&Te(t[0])&&!xa(t[0])){o=!0;for(var s=[],l=new Vt,u=0,v=t.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],o=[],s,l=0,u=t.length;l0){for(var V=s.length===t.length?t:new er(a,s),G=0;G0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function o(k){for(var O=k._private.edges,A=0;A0&&(r?P.emitAndNotify("remove"):e&&P.emit("remove"));for(var B=0;B0?B=k:P=k;while(Math.abs(L)>o&&++O=i?m(M,O):A===0?O:w(M,P,P+u)}var E=!1;function x(){E=!0,(r!==e||t!==a)&&b()}var D=function(P){return E||x(),r===e&&t===a?P:P===0?0:P===1?1:p(S(P),e,a)};D.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var C="generateBezier("+[r,e,t,a]+")";return D.toString=function(){return C},D}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Kh=function(){function r(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:r(o)}}function t(a,n){var i={dx:a.v,dv:r(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),l=e(a,n,s),u=1/6*(i.dx+2*(o.dx+s.dx)+l.dx),v=1/6*(i.dv+2*(o.dv+s.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=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?(u=a(n,i),h=u/o*f):h=f;d=t(d||s,h),l.push(1+d.x),u+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),ze=function(e,t,a,n){var i=Gh(e,t,a,n);return function(o,s,l){return o+(s-o)*i(l)}},Ya={linear:function(e,t,a){return e+(t-e)*a},ease:ze(.25,.1,.25,1),"ease-in":ze(.42,0,1,1),"ease-out":ze(0,0,.58,1),"ease-in-out":ze(.42,0,.58,1),"ease-in-sine":ze(.47,0,.745,.715),"ease-out-sine":ze(.39,.575,.565,1),"ease-in-out-sine":ze(.445,.05,.55,.95),"ease-in-quad":ze(.55,.085,.68,.53),"ease-out-quad":ze(.25,.46,.45,.94),"ease-in-out-quad":ze(.455,.03,.515,.955),"ease-in-cubic":ze(.55,.055,.675,.19),"ease-out-cubic":ze(.215,.61,.355,1),"ease-in-out-cubic":ze(.645,.045,.355,1),"ease-in-quart":ze(.895,.03,.685,.22),"ease-out-quart":ze(.165,.84,.44,1),"ease-in-out-quart":ze(.77,0,.175,1),"ease-in-quint":ze(.755,.05,.855,.06),"ease-out-quint":ze(.23,1,.32,1),"ease-in-out-quint":ze(.86,0,.07,1),"ease-in-expo":ze(.95,.05,.795,.035),"ease-out-expo":ze(.19,1,.22,1),"ease-in-out-expo":ze(1,0,0,1),"ease-in-circ":ze(.6,.04,.98,.335),"ease-out-circ":ze(.075,.82,.165,1),"ease-in-out-circ":ze(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return Ya.linear;var n=Kh(e,t,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":ze};function To(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function Do(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Ct(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var o=Do(r,n),s=Do(e,n);if(ne(o)&&ne(s))return To(i,o,s,t,a);if(Oe(o)&&Oe(s)){for(var l=[],u=0;u0?(h==="spring"&&d.push(o.duration),o.easingImpl=Ya[h].apply(null,d)):o.easingImpl=Ya[h]}var y=o.easingImpl,p;if(o.duration===0?p=1:p=(t-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),o.delay==null){var g=o.startPosition,m=o.position;if(m&&n&&!r.locked()){var b={};ra(g.x,m.x)&&(b.x=Ct(g.x,m.x,p,y)),ra(g.y,m.y)&&(b.y=Ct(g.y,m.y,p,y)),r.position(b)}var w=o.startPan,S=o.pan,E=i.pan,x=S!=null&&a;x&&(ra(w.x,S.x)&&(E.x=Ct(w.x,S.x,p,y)),ra(w.y,S.y)&&(E.y=Ct(w.y,S.y,p,y)),r.emit("pan"));var D=o.startZoom,C=o.zoom,M=C!=null&&a;M&&(ra(D,C)&&(i.zoom=da(i.minZoom,Ct(D,C,p,y),i.maxZoom)),r.emit("zoom")),(x||M)&&r.emit("viewport");var P=o.style;if(P&&P.length>0&&n){for(var B=0;B=0;x--){var D=E[x];D()}E.splice(0,E.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;if(w.stopped){h.splice(m,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||Uh(v,b,r),Wh(v,b,r,f),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),y=!0)}return!f&&h.length===0&&d.length===0&&a.push(v),y}for(var i=!1,o=0;o0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var Yh={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&ja(function(i){ko(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){ko(o,e)},a.beforeRenderPriorities.animations):t()}},Xh={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&xa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},qa=function(e){return ce(e)?new rt(e):e},ru={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new wn(Xh,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,qa(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,qa(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,qa(t),a),this},once:function(e,t,a){return this.emitter().one(e,qa(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Be.eventAliasesOn(ru);var Zn={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Zn.jpeg=Zn.jpg;var Xa={layout:function(e){var t=this;if(e==null){$e("Layout options must be specified to make a layout");return}if(e.name==null){$e("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){$e("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ce(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new n(pe({},e,{cy:t,eles:i}));return o}};Xa.createLayout=Xa.makeLayout=Xa.layout;var Zh={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return 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 t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)t.removeChild(t.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)}};Qn.invalidateDimensions=Qn.resize;var Za={collection:function(e,t){return ce(e)?this.$(e):yr(e)?e.collection():Oe(e)?(t||(t={}),new er(this,e,t.unique,t.removed)):new er(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Za.elements=Za.filter=Za.$;var sr={},sa="t",Jh="f";sr.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(c||f&&h){var d=void 0;c&&h||c?d=u.properties:h&&(d=u.mappedProperties);for(var y=0;y1&&(w=1),s.color){var E=a.valueMin[0],x=a.valueMax[0],D=a.valueMin[1],C=a.valueMax[1],M=a.valueMin[2],P=a.valueMax[2],B=a.valueMin[3]==null?1:a.valueMin[3],L=a.valueMax[3]==null?1:a.valueMax[3],k=[Math.round(E+(x-E)*w),Math.round(D+(C-D)*w),Math.round(M+(P-M)*w),Math.round(B+(L-B)*w)];i={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else if(s.number){var O=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,O,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case o.data:{for(var A=a.field.split("."),R=f.data,I=0;I0&&i>0){for(var s={},l=!1,u=0;u0?r.delayAnimation(o).play().promise().then(b):b()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};sr.checkTrigger=function(r,e,t,a,n,i){var o=this.properties[e],s=n(o);s!=null&&s(t,a)&&i(o)};sr.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};sr.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(t==="bezier"||a==="bezier")&&r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(t==="none"||a==="none")&&r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};sr.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a)};var Ta={};Ta.applyBypass=function(r,e,t,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;sn.length?a=a.substr(n.length):a=""}function l(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Me("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new rt(f);if(c.invalid){Me("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var h=v[2],d=!1;i=h;for(var y=[];;){var p=i.match(/^\s*$/);if(p)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Me("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=g[0];var m=g[1],b=g[2],w=e.properties[m];if(!w){Me("Skipping property: Invalid property name in: "+o),l();continue}var S=t.parse(m,b);if(!S){Me("Skipping property: Invalid property definition in: "+o),l();continue}y.push({name:m,val:b}),l()}if(d){s();break}t.selector(f);for(var E=0;E=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(t)return!1;var c=s.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=s.mapData;if(!(u.color||u.number))return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Me("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(u.color){var p=d.value,g=y.value,m=p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(p[3]==null||p[3]===1)&&(g[3]==null||g[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):Oe(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var w=[],S=[],E=[],x="",D=!1,C=0;C0?" ":"")+M.strValue}return u.validate&&!u.validate(w,S)?null:u.singleEnum&&D?w.length===1&&ce(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:E,strValue:x,bypass:t,units:S}}var P=function(){for(var z=0;zu.max||u.strictMax&&e===u.max))return null;var A={name:r,value:e,strValue:""+e+(B||""),units:B,bypass:t};return u.unitless||B!=="px"&&B!=="em"?A.pfValue=e:A.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(A.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(A.pfValue=B==="rad"?e:Lv(e)),B==="%"&&(A.pfValue=e/100),A}else if(u.propList){var R=[],I=""+e;if(I!=="none"){for(var V=I.split(/\s*,\s*|\s+/),G=0;G0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((o-2*t)/a.w,(s-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.maxZoom=t),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 t=this._private,a=t.pan,n=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),ne(e)?o=e:Te(e)&&(o=e.level,e.position!=null?i=hn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=ot.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ne(u.x)&&(t.pan.x=u.x,s=!1),ne(u.y)&&(t.pan.y=u.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 t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ce(e)){var a=e;e=this.mutableElements().filter(a)}else yr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(n.x1+n.x2))/2,y:(o-t*(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,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.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,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};yt.centre=yt.center;yt.autolockNodes=yt.autolock;yt.autoungrabifyNodes=yt.autoungrabify;var ma={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ma.attr=ma.data;ma.removeAttr=ma.removeData;var ba=function(e){var t=this;e=pe({},e);var a=e.container;a&&!_a(a)&&_a(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=t;var o=Ke!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=pe({name:o?"grid":"null"},s.layout),s.renderer=pe({name:o?"canvas":"null"},s.renderer);var l=function(d,y,p){return y!==void 0?y:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:s,elements:new er(this),listeners:[],aniEles:new er(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ne(s.zoom)?s.zoom:1,pan:{x:Te(s.pan)&&ne(s.pan.x)?s.pan.x:0,y:Te(s.pan)&&ne(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var v=function(d,y){var p=d.some(rl);if(p)return qt.all(d).then(y);y(d)};u.styleEnabled&&t.setStyle([]);var f=pe({},s,s.renderer);t.initRenderer(f);var c=function(d,y,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),d!=null&&(Te(d)||Oe(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var m=pe({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([s.style,s.elements],function(h){var d=h[0],y=h[1];u.styleEnabled&&t.style().append(d),c(y,function(){t.startAnimationLoop(),u.ready=!0,qe(s.ready)&&t.on("ready",s.ready);for(var p=0;p0,l=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),u;if(yr(e.roots))u=e.roots;else if(Oe(e.roots)){for(var v=[],f=0;f0;){var O=k(),A=M(O,B);if(A)O.outgoers().filter(function(te){return te.isNode()&&a.has(te)}).forEach(L);else if(A===null){Me("Detected double maximal shift for node `"+O.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var R=0;if(e.avoidOverlap)for(var I=0;I0&&g[0].length<=3?xe/2:0),Pe=2*Math.PI/g[le].length*se;return le===0&&g[0].length===1&&(Ee=1),{x:X.x+Ee*Math.cos(Pe),y:X.y+Ee*Math.sin(Pe)}}else{var Ae={x:X.x+(se+1-(de+1)/2)*Le,y:(le+1)*Ce};return Ae}};return a.nodes().layoutPositions(this,e,he),this};var tg={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function au(r){this.options=pe({},tg,r)}au.prototype.run=function(){var r=this.options,e=r,t=r.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=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),v,f=0,c=0;c1&&e.avoidOverlap){f*=1.75;var g=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(g*g+m*m));v=Math.max(b,v)}var w=function(E,x){var D=e.startAngle+x*u*(n?1:-1),C=v*Math.cos(D),M=v*Math.sin(D),P={x:s.x+C,y:s.y+M};return P};return a.nodes().layoutPositions(this,e,w),this};var ag={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function nu(r){this.options=pe({},ag,r)}nu.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),o=hr(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},l=[],u=0,v=0;v0){var S=Math.abs(m[0].value-w.value);S>=p&&(m=[],g.push(m))}m.push(w)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,D=Math.min(o.w,o.h)/2-E,C=D/(g.length+x?1:0);E=Math.min(E,C)}for(var M=0,P=0;P1&&e.avoidOverlap){var O=Math.cos(k)-Math.cos(0),A=Math.sin(k)-Math.sin(0),R=Math.sqrt(E*E/(O*O+A*A));M=Math.max(R,M)}B.r=M,M+=E}if(e.equidistant){for(var I=0,V=0,G=0;G=r.numIter||(fg(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),ja(f)}};v()}else{for(;u;)u=o(l),l++;Mo(a,r),s()}return this};Tn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Tn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ig=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=hr(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},l=a.eles.components(),u={},v=0;v0){s.graphSet.push(D);for(var v=0;vn.count?0:n.graph},sg=function r(e,t,a,n){var i=n.graphSet[a];if(-10)var f=n.nodeOverlap*v,c=Math.sqrt(s*s+l*l),h=f*s/c,d=f*l/c;else var y=sn(e,s,l),p=sn(t,-1*s,-1*l),g=p.x-y.x,m=p.y-y.y,b=g*g+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*g/c,d=f*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},hg=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},sn=function(e,t,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,l=a/t,u=o/s,v={};return t===0&&0a?(v.x=n,v.y=i+o/2,v):0t&&-1*u<=l&&l<=u?(v.x=n-s/2,v.y=i-s*a/2/t,v):0=u)?(v.x=n+o*t/2/a,v.y=i+o/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-o*t/2/a,v.y=i-o/2),v)},gg=function(e,t){for(var a=0;aa){var p=t.gravity*h/y,g=t.gravity*d/y;c.offsetX+=p,c.offsetY+=g}}}}},yg=function(e,t){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],l=e.layoutNodes[s],u=l.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},wg=function r(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.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+=p+t.componentSpacing,h=0,y=0,p=0)}}},xg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ou(r){this.options=pe({},xg,r)}ou.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(Y){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),v=function(Q){if(Q==null)return Math.min(l,u);var J=Math.min(l,u);J==l?l=Q:u=Q},f=function(Q){if(Q==null)return Math.max(l,u);var J=Math.max(l,u);J==l?l=Q:u=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)l=c,u=h;else if(c!=null&&h==null)l=c,u=Math.ceil(o/l);else if(c==null&&h!=null)u=h,l=Math.ceil(o/u);else if(u*l>o){var d=v(),y=f();(d-1)*y>=o?v(d-1):(y-1)*d>=o&&f(y-1)}else for(;u*l=o?f(g+1):v(p+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w=u&&(O=0,k++)},R={},I=0;I(O=Kv(r,e,A[R],A[R+1],A[R+2],A[R+3])))return p(x,O),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var A=C.allpts,R=0;R+5(O=Gv(r,e,A[R],A[R+1],A[R+2],A[R+3],A[R+4],A[R+5])))return p(x,O),!0}for(var I=I||D.source,V=V||D.target,G=n.getArrowWidth(M,P),F=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],R=0;R0&&(g(I),g(V))}function b(x,D,C){return kr(x,D,C)}function w(x,D){var C=x._private,M=c,P;D?P=D+"-":P="",x.boundingBox();var B=C.labelBounds[D||"main"],L=x.pstyle(P+"label").value,k=x.pstyle("text-events").strValue==="yes";if(!(!k||!L)){var O=b(C.rscratch,"labelX",D),A=b(C.rscratch,"labelY",D),R=b(C.rscratch,"labelAngle",D),I=x.pstyle(P+"text-margin-x").pfValue,V=x.pstyle(P+"text-margin-y").pfValue,G=B.x1-M-I,F=B.x2+M-I,q=B.y1-M-V,Y=B.y2+M-V;if(R){var Q=Math.cos(R),J=Math.sin(R),_=function(he,te){return he=he-O,te=te-A,{x:he*Q-te*J+O,y:he*J+te*Q+A}},j=_(G,q),W=_(G,Y),z=_(F,q),K=_(F,Y),X=[j.x+I,j.y+V,z.x+I,z.y+V,K.x+I,K.y+V,W.x+I,W.y+V];if(dr(r,e,X))return p(x),!0}else if(It(B,r,e))return p(x),!0}}for(var S=o.length-1;S>=0;S--){var E=o[S];E.isNode()?g(E)||w(E):m(E)||w(E)||w(E,"source")||w(E,"target")}return s};bt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],o=Math.min(r,t),s=Math.max(r,t),l=Math.min(e,a),u=Math.max(e,a);r=o,t=s,e=l,a=u;for(var v=hr({x1:r,y1:e,x2:t,y2:a}),f=0;f0?-(Math.PI-e.ang):Math.PI+e.ang},kg=function(e,t,a,n,i){if(e!==Io?zo(t,e,Rr):Dg(wr,Rr),zo(t,a,wr),Ro=Rr.nx*wr.ny-Rr.ny*wr.nx,Oo=Rr.nx*wr.nx-Rr.ny*-wr.ny,$r=Math.asin(Math.max(-1,Math.min(1,Ro))),Math.abs($r)<1e-6){Jn=t.x,_n=t.y,lt=Tt=0;return}vt=1,Qa=!1,Oo<0?$r<0?$r=Math.PI+$r:($r=Math.PI-$r,vt=-1,Qa=!0):$r>0&&(vt=-1,Qa=!0),t.radius!==void 0?Tt=t.radius:Tt=n,ot=$r/2,$a=Math.min(Rr.len/2,wr.len/2),i?(Ar=Math.abs(Math.cos(ot)*Tt/Math.sin(ot)),Ar>$a?(Ar=$a,lt=Math.abs(Ar*Math.sin(ot)/Math.cos(ot))):lt=Tt):(Ar=Math.min($a,Tt),lt=Math.abs(Ar*Math.sin(ot)/Math.cos(ot))),jn=t.x+wr.nx*Ar,ei=t.y+wr.ny*Ar,Jn=jn-wr.ny*lt*vt,_n=ei+wr.nx*lt*vt,vu=t.x+Rr.nx*Ar,fu=t.y+Rr.ny*Ar,Io=t};function cu(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Di(r,e,t,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}:(kg(r,e,t,a,n),{cx:Jn,cy:_n,radius:lt,startX:vu,startY:fu,stopX:jn,stopY:ei,startAngle:Rr.ang+Math.PI/2*vt,endAngle:wr.ang-Math.PI/2*vt,counterClockwise:Qa})}var ur={};ur.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),l=o.units!=null&&s.units!=null,u=function(S,E,x,D){var C=D-E,M=x-S,P=Math.sqrt(M*M+C*C);return{x:-C/P,y:M/P}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(r.source()[0],o),c=Tr(f,2),h=c[0],d=c[1],y=this.manualEndptToPx(r.target()[0],s),p=Tr(y,2),g=p[0],m=p[1],b={x1:h,y1:d,x2:g,y2:m};n=u(h,d,g,m),i=b}else Me("Edge ".concat(r.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}};ur.findHaystackPoints=function(r){for(var e=0;e0?Math.max(Z-oe,0):Math.min(Z+oe,0)},L=B(M,D),k=B(P,C),O=!1;m===u?g=Math.abs(L)>Math.abs(k)?n:a:m===l||m===s?(g=a,O=!0):(m===i||m===o)&&(g=n,O=!0);var A=g===a,R=A?k:L,I=A?P:M,V=ps(I),G=!1;!(O&&(w||E))&&(m===s&&I<0||m===l&&I>0||m===i&&I>0||m===o&&I<0)&&(V*=-1,R=V*Math.abs(R),G=!0);var F;if(w){var q=S<0?1+S:S;F=q*R}else{var Y=S<0?R:0;F=Y+S*V}var Q=function(Z){return Math.abs(Z)=Math.abs(R)},J=Q(F),_=Q(Math.abs(R)-Math.abs(F)),j=J||_;if(j&&!G)if(A){var W=Math.abs(I)<=c/2,z=Math.abs(M)<=h/2;if(W){var K=(v.x1+v.x2)/2,X=v.y1,ae=v.y2;t.segpts=[K,X,K,ae]}else if(z){var he=(v.y1+v.y2)/2,te=v.x1,re=v.x2;t.segpts=[te,he,re,he]}else t.segpts=[v.x1,v.y2]}else{var ve=Math.abs(I)<=f/2,le=Math.abs(P)<=d/2;if(ve){var se=(v.y1+v.y2)/2,de=v.x1,Le=v.x2;t.segpts=[de,se,Le,se]}else if(le){var Ce=(v.x1+v.x2)/2,xe=v.y1,Ae=v.y2;t.segpts=[Ce,xe,Ce,Ae]}else t.segpts=[v.x2,v.y1]}else if(A){var Ee=v.y1+F+(p?c/2*V:0),Pe=v.x1,ee=v.x2;t.segpts=[Pe,Ee,ee,Ee]}else{var T=v.x1+F+(p?f/2*V:0),$=v.y1,U=v.y2;t.segpts=[T,$,T,U]}if(t.isRound){var N=r.pstyle("taxi-radius").value,H=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(N),t.isArcRadius=new Array(t.segpts.length/2).fill(H)}};ur.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!ne(t.startX)||!ne(t.startY),p=!ne(t.arrowStartX)||!ne(t.arrowStartY),g=!ne(t.endX)||!ne(t.endY),m=!ne(t.arrowEndX)||!ne(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=b*w,E=ht({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=Ek.poolIndex()){var O=L;L=k,k=O}var A=C.srcPos=L.position(),R=C.tgtPos=k.position(),I=C.srcW=L.outerWidth(),V=C.srcH=L.outerHeight(),G=C.tgtW=k.outerWidth(),F=C.tgtH=k.outerHeight(),q=C.srcShape=t.nodeShapes[e.getNodeShape(L)],Y=C.tgtShape=t.nodeShapes[e.getNodeShape(k)],Q=C.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,J=C.tgtCornerRadius=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,_=C.tgtRs=k._private.rscratch,j=C.srcRs=L._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var W=0;W0){var ae=i,he=st(ae,Pt(t)),te=st(ae,Pt(X)),re=he;if(te2){var ve=st(ae,{x:X[2],y:X[3]});ve0){var U=o,N=st(U,Pt(t)),H=st(U,Pt($)),ie=N;if(H2){var Z=st(U,{x:$[2],y:$[3]});Z=d||x){p={cp:w,segment:E};break}}if(p)break}var D=p.cp,C=p.segment,M=(d-g)/C.length,P=C.t1-C.t0,B=h?C.t0+P*M:C.t1-P*M;B=da(0,B,1),e=Mt(D.p0,D.p1,D.p2,B),c=Bg(D.p0,D.p1,D.p2,B);break}case"straight":case"segments":case"haystack":{for(var L=0,k,O,A,R,I=a.allpts.length,V=0;V+3=d));V+=2);var G=d-O,F=G/k;F=da(0,F,1),e=Rv(A,R,F),c=gu(A,R);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}};Nr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Nr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=this.calculateLabelDimensions(r,a),i=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,s=kr(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(s.length,1),u=n.height/l,v=u*i,f=n.width,c=n.height+(l-1)*(i-1)*u;Zr(t.rstyle,"labelWidth",e,f),Zr(t.rscratch,"labelWidth",e,f),Zr(t.rstyle,"labelHeight",e,c),Zr(t.rscratch,"labelHeight",e,c),Zr(t.rscratch,"labelLineHeight",e,v)};Nr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,o=function(Y,Q){return Q?(Zr(t.rscratch,Y,e,Q),Q):kr(t.rscratch,Y,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",v=n.split(` `),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],y=/[\s\u200b]+|$/g,p=0;pf){var S=g.matchAll(y),E="",x=0,D=Jo(S),C;try{for(D.s();!(C=D.n()).done;){var M=C.value,P=M[0],B=g.substring(x,M.index);x=M.index+P.length;var L=E.length===0?B:E+B+P,k=this.calculateLabelDimensions(r,L),O=k.width;O<=f?E+=B+P:(E&&d.push(E),E=B+P)}}catch(q){D.e(q)}finally{D.f()}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(g)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(` `)),o("labelWrapKey",l)}else if(s==="ellipsis"){var A=r.pstyle("text-max-width").pfValue,R="",I="…",V=!1;if(this.calculateLabelDimensions(r,n).widthA)break;R+=n[G],G===n.length-1&&(V=!0)}return V||(R+=I),R}return n};Nr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Nr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=dt(e,r._private.labelDimsKey),o=t.labelDimCache||(t.labelDimCache=[]),s=o[i];if(s!=null)return s;var l=0,u=r.pstyle("font-style").strValue,v=r.pstyle("font-size").pfValue,f=r.pstyle("font-family").strValue,c=r.pstyle("font-weight").strValue,h=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=n.createElement("canvas"),d=this.labelCalcCanvasContext=h.getContext("2d");var y=h.style;y.position="absolute",y.left="-9999px",y.top="-9999px",y.zIndex="-1",y.visibility="hidden",y.pointerEvents="none"}d.font="".concat(u," ").concat(c," ").concat(v,"px ").concat(f);for(var p=0,g=0,m=e.split(` `),b=0;b1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var l=0;l=r.desktopTapThreshold2}var lr=i(T);Ve&&(r.hoverData.tapholdCancelled=!0);var vr=function(){var Lr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Lr.length===0?(Lr.push(ye[0]),Lr.push(ye[1])):(Lr[0]+=ye[0],Lr[1]+=ye[1])};U=!0,n(fe,["mousemove","vmousemove","tapdrag"],T,{x:Z[0],y:Z[1]});var Br=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||N.emit({originalEvent:T,type:"boxstart",position:{x:Z[0],y:Z[1]}}),we[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Ve){var br={originalEvent:T,type:"cxtdrag",position:{x:Z[0],y:Z[1]}};be?be.emit(br):N.emit(br),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||fe!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:Z[0],y:Z[1]}}),r.hoverData.cxtOver=fe,fe&&fe.emit({originalEvent:T,type:"cxtdragover",position:{x:Z[0],y:Z[1]}}))}}else if(r.hoverData.dragging){if(U=!0,N.panningEnabled()&&N.userPanningEnabled()){var Mr;if(r.hoverData.justStartedPan){var Vr=r.hoverData.mdownPos;Mr={x:(Z[0]-Vr[0])*H,y:(Z[1]-Vr[1])*H},r.hoverData.justStartedPan=!1}else Mr={x:ye[0]*H,y:ye[1]*H};N.panBy(Mr),N.emit("dragpan"),r.hoverData.dragged=!0}Z=r.projectIntoViewport(T.clientX,T.clientY)}else if(we[4]==1&&(be==null||be.pannable())){if(Ve){if(!r.hoverData.dragging&&N.boxSelectionEnabled()&&(lr||!N.panningEnabled()||!N.userPanningEnabled()))Br();else if(!r.hoverData.selecting&&N.panningEnabled()&&N.userPanningEnabled()){var qr=o(be,r.hoverData.downs);qr&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,we[4]=0,r.data.bgActivePosistion=Pt(oe),r.redrawHint("select",!0),r.redraw())}be&&be.pannable()&&be.active()&&be.unactivate()}}else{if(be&&be.pannable()&&be.active()&&be.unactivate(),(!be||!be.grabbed())&&fe!=me&&(me&&n(me,["mouseout","tapdragout"],T,{x:Z[0],y:Z[1]}),fe&&n(fe,["mouseover","tapdragover"],T,{x:Z[0],y:Z[1]}),r.hoverData.last=fe),be)if(Ve){if(N.boxSelectionEnabled()&&lr)be&&be.grabbed()&&(g(Ie),be.emit("freeon"),Ie.emit("free"),r.dragData.didDrag&&(be.emit("dragfreeon"),Ie.emit("dragfree"))),Br();else if(be&&be.grabbed()&&r.nodeIsDraggable(be)){var ar=!r.dragData.didDrag;ar&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||y(Ie,{inDragLayer:!0});var Qe={x:0,y:0};if(ne(ye[0])&&ne(ye[1])&&(Qe.x+=ye[0],Qe.y+=ye[1],ar)){var cr=r.hoverData.dragDelta;cr&&ne(cr[0])&&ne(cr[1])&&(Qe.x+=cr[0],Qe.y+=cr[1])}r.hoverData.draggingEles=!0,Ie.silentShift(Qe).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else vr();U=!0}if(we[2]=Z[0],we[3]=Z[1],U)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var B,L,k;r.registerBinding(e,"mouseup",function(T){if(!(r.hoverData.which===1&&T.which!==1&&r.hoverData.capture)){var $=r.hoverData.capture;if($){r.hoverData.capture=!1;var U=r.cy,N=r.projectIntoViewport(T.clientX,T.clientY),H=r.selection,ie=r.findNearestElement(N[0],N[1],!0,!1),Z=r.dragData.possibleDragElements,oe=r.hoverData.down,ge=i(T);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,oe&&oe.unactivate(),r.hoverData.which===3){var we={originalEvent:T,type:"cxttapend",position:{x:N[0],y:N[1]}};if(oe?oe.emit(we):U.emit(we),!r.hoverData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:N[0],y:N[1]}};oe?oe.emit(fe):U.emit(fe)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(ie,["mouseup","tapend","vmouseup"],T,{x:N[0],y:N[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(oe,["click","tap","vclick"],T,{x:N[0],y:N[1]}),L=!1,T.timeStamp-k<=U.multiClickDebounceTime()?(B&&clearTimeout(B),L=!0,k=null,n(oe,["dblclick","dbltap","vdblclick"],T,{x:N[0],y:N[1]})):(B=setTimeout(function(){L||n(oe,["oneclick","onetap","voneclick"],T,{x:N[0],y:N[1]})},U.multiClickDebounceTime()),k=T.timeStamp)),oe==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(T)&&(U.$(t).unselect(["tapunselect"]),Z.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=Z=U.collection()),ie==oe&&!r.dragData.didDrag&&!r.hoverData.selecting&&ie!=null&&ie._private.selectable&&(r.hoverData.dragging||(U.selectionType()==="additive"||ge?ie.selected()?ie.unselect(["tapunselect"]):ie.select(["tapselect"]):ge||(U.$(t).unmerge(ie).unselect(["tapunselect"]),ie.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var me=U.collection(r.getAllInBox(H[0],H[1],H[2],H[3]));r.redrawHint("select",!0),me.length>0&&r.redrawHint("eles",!0),U.emit({type:"boxend",originalEvent:T,position:{x:N[0],y:N[1]}});var be=function(Ve){return Ve.selectable()&&!Ve.selected()};U.selectionType()==="additive"||ge||U.$(t).unmerge(me).unselect(),me.emit("box").stdFilter(be).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!H[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var ye=oe&&oe.grabbed();g(Z),ye&&(oe.emit("freeon"),Z.emit("free"),r.dragData.didDrag&&(oe.emit("dragfreeon"),Z.emit("dragfree")))}}H[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var O=function(T){if(!r.scrollingPage){var $=r.cy,U=$.zoom(),N=$.pan(),H=r.projectIntoViewport(T.clientX,T.clientY),ie=[H[0]*U+N.x,H[1]*U+N.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||C()){T.preventDefault();return}if($.panningEnabled()&&$.userPanningEnabled()&&$.zoomingEnabled()&&$.userZoomingEnabled()){T.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Z;T.deltaY!=null?Z=T.deltaY/-250:T.wheelDeltaY!=null?Z=T.wheelDeltaY/1e3:Z=T.wheelDelta/1e3,Z=Z*r.wheelSensitivity;var oe=T.deltaMode===1;oe&&(Z*=33);var ge=$.zoom()*Math.pow(10,Z);T.type==="gesturechange"&&(ge=r.gestureStartZoom*T.scale),$.zoom({level:ge,renderedPosition:{x:ie[0],y:ie[1]}}),$.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",O,!0),r.registerBinding(e,"scroll",function(T){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(T){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||T.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(ee){r.hasTouchStarted||O(ee)},!0),r.registerBinding(r.container,"mouseout",function(T){var $=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseout",position:{x:$[0],y:$[1]}})},!1),r.registerBinding(r.container,"mouseover",function(T){var $=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseover",position:{x:$[0],y:$[1]}})},!1);var A,R,I,V,G,F,q,Y,Q,J,_,j,W,z=function(T,$,U,N){return Math.sqrt((U-T)*(U-T)+(N-$)*(N-$))},K=function(T,$,U,N){return(U-T)*(U-T)+(N-$)*(N-$)},X;r.registerBinding(r.container,"touchstart",X=function(T){if(r.hasTouchStarted=!0,!!M(T)){b(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var $=r.cy,U=r.touchData.now,N=r.touchData.earlier;if(T.touches[0]){var H=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=H[0],U[1]=H[1]}if(T.touches[1]){var H=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=H[0],U[3]=H[1]}if(T.touches[2]){var H=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=H[0],U[5]=H[1]}if(T.touches[1]){r.touchData.singleTouchMoved=!0,g(r.dragData.touchDragEles);var ie=r.findContainerClientCoords();Q=ie[0],J=ie[1],_=ie[2],j=ie[3],A=T.touches[0].clientX-Q,R=T.touches[0].clientY-J,I=T.touches[1].clientX-Q,V=T.touches[1].clientY-J,W=0<=A&&A<=_&&0<=I&&I<=_&&0<=R&&R<=j&&0<=V&&V<=j;var Z=$.pan(),oe=$.zoom();G=z(A,R,I,V),F=K(A,R,I,V),q=[(A+I)/2,(R+V)/2],Y=[(q[0]-Z.x)/oe,(q[1]-Z.y)/oe];var ge=200,we=ge*ge;if(F=1){for(var pr=r.touchData.startPosition=[null,null,null,null,null,null],Ge=0;Ge=r.touchTapThreshold2}if($&&r.touchData.cxt){T.preventDefault();var pr=T.touches[0].clientX-Q,Ge=T.touches[0].clientY-J,Xe=T.touches[1].clientX-Q,Ze=T.touches[1].clientY-J,lr=K(pr,Ge,Xe,Ze),vr=lr/F,Br=150,br=Br*Br,Mr=1.5,Vr=Mr*Mr;if(vr>=Vr||lr>=br){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var qr={originalEvent:T,type:"cxttapend",position:{x:H[0],y:H[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(qr),r.touchData.start=null):N.emit(qr)}}if($&&r.touchData.cxt){var qr={originalEvent:T,type:"cxtdrag",position:{x:H[0],y:H[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(qr):N.emit(qr),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var ar=r.findNearestElement(H[0],H[1],!0,!0);(!r.touchData.cxtOver||ar!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:H[0],y:H[1]}}),r.touchData.cxtOver=ar,ar&&ar.emit({originalEvent:T,type:"cxtdragover",position:{x:H[0],y:H[1]}}))}else if($&&T.touches[2]&&N.boxSelectionEnabled())T.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||N.emit({originalEvent:T,type:"boxstart",position:{x:H[0],y:H[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,U[4]=1,!U||U.length===0||U[0]===void 0?(U[0]=(H[0]+H[2]+H[4])/3,U[1]=(H[1]+H[3]+H[5])/3,U[2]=(H[0]+H[2]+H[4])/3+1,U[3]=(H[1]+H[3]+H[5])/3+1):(U[2]=(H[0]+H[2]+H[4])/3,U[3]=(H[1]+H[3]+H[5])/3),r.redrawHint("select",!0),r.redraw();else if($&&T.touches[1]&&!r.touchData.didSelect&&N.zoomingEnabled()&&N.panningEnabled()&&N.userZoomingEnabled()&&N.userPanningEnabled()){T.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Qe=r.dragData.touchDragEles;if(Qe){r.redrawHint("drag",!0);for(var cr=0;cr0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var he;r.registerBinding(e,"touchcancel",he=function(T){var $=r.touchData.start;r.touchData.capture=!1,$&&$.unactivate()});var te,re,ve,le;if(r.registerBinding(e,"touchend",te=function(T){var $=r.touchData.start,U=r.touchData.capture;if(U)T.touches.length===0&&(r.touchData.capture=!1),T.preventDefault();else return;var N=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var H=r.cy,ie=H.zoom(),Z=r.touchData.now,oe=r.touchData.earlier;if(T.touches[0]){var ge=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Z[0]=ge[0],Z[1]=ge[1]}if(T.touches[1]){var ge=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Z[2]=ge[0],Z[3]=ge[1]}if(T.touches[2]){var ge=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Z[4]=ge[0],Z[5]=ge[1]}$&&$.unactivate();var we;if(r.touchData.cxt){if(we={originalEvent:T,type:"cxttapend",position:{x:Z[0],y:Z[1]}},$?$.emit(we):H.emit(we),!r.touchData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:Z[0],y:Z[1]}};$?$.emit(fe):H.emit(fe)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!T.touches[2]&&H.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var me=H.collection(r.getAllInBox(N[0],N[1],N[2],N[3]));N[0]=void 0,N[1]=void 0,N[2]=void 0,N[3]=void 0,N[4]=0,r.redrawHint("select",!0),H.emit({type:"boxend",originalEvent:T,position:{x:Z[0],y:Z[1]}});var be=function(br){return br.selectable()&&!br.selected()};me.emit("box").stdFilter(be).select().emit("boxselect"),me.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if($!=null&&$.unactivate(),T.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ye=r.dragData.touchDragEles;if($!=null){var Ie=$._private.grabbed;g(ye),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ie&&($.emit("freeon"),ye.emit("free"),r.dragData.didDrag&&($.emit("dragfreeon"),ye.emit("dragfree"))),n($,["touchend","tapend","vmouseup","tapdragout"],T,{x:Z[0],y:Z[1]}),$.unactivate(),r.touchData.start=null}else{var Ve=r.findNearestElement(Z[0],Z[1],!0,!0);n(Ve,["touchend","tapend","vmouseup","tapdragout"],T,{x:Z[0],y:Z[1]})}var gr=r.touchData.startPosition[0]-Z[0],pr=gr*gr,Ge=r.touchData.startPosition[1]-Z[1],Xe=Ge*Ge,Ze=pr+Xe,lr=Ze*ie*ie;r.touchData.singleTouchMoved||($||H.$(":selected").unselect(["tapunselect"]),n($,["tap","vclick"],T,{x:Z[0],y:Z[1]}),re=!1,T.timeStamp-le<=H.multiClickDebounceTime()?(ve&&clearTimeout(ve),re=!0,le=null,n($,["dbltap","vdblclick"],T,{x:Z[0],y:Z[1]})):(ve=setTimeout(function(){re||n($,["onetap","voneclick"],T,{x:Z[0],y:Z[1]})},H.multiClickDebounceTime()),le=T.timeStamp)),$!=null&&!r.dragData.didDrag&&$._private.selectable&&lr"u"){var se=[],de=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},Le=function(T){return{event:T,touch:de(T)}},Ce=function(T){se.push(Le(T))},xe=function(T){for(var $=0;$0)return q[0]}return null},d=Object.keys(c),y=0;y0?h:bs(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){l=l==="auto"?gt(n,i):l;var u=2*l;if(Gr(e,t,this.points,o,s,n,i-u,[0,-1],a)||Gr(e,t,this.points,o,s,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[o-v,s-f,o-v,s,o+v,s,o+v,s-f];return!!(dr(e,t,c)||ft(e,t,u,u,o+n/2-l,s+i/2-l,a)||ft(e,t,u,u,o-n/2+l,s+i/2-l,a))}}};Wr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",fr(3,0)),this.generateRoundPolygon("round-triangle",fr(3,0)),this.generatePolygon("rectangle",fr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",fr(5,0)),this.generateRoundPolygon("round-pentagon",fr(5,0)),this.generatePolygon("hexagon",fr(6,0)),this.generateRoundPolygon("round-hexagon",fr(6,0)),this.generatePolygon("heptagon",fr(7,0)),this.generateRoundPolygon("round-heptagon",fr(7,0)),this.generatePolygon("octagon",fr(8,0)),this.generateRoundPolygon("round-octagon",fr(8,0));var a=new Array(20);{var n=Gn(5,0),i=Gn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*qn)break;var S=e.deq(a,p,y);if(S.length>0)for(var E=0;E0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,y)&&i())},s=e.priority||vi;n.beforeRender(o,s(a))}}}},Lg=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:en;ii(this,r),this.idsByKey=new Ir,this.keyForId=new Ir,this.cachesByLvl=new Ir,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return oi(r,[{key:"getIdsFor",value:function(t){t==null&&$e("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new Vt,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Ir,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),r}(),qo=25,Ha=50,Ja=-4,ri=3,Ag=7.99,Rg=8,Og=1024,Ig=1024,zg=1024,Ng=.2,Fg=.8,Vg=10,qg=.15,$g=.1,Hg=.9,Gg=.9,Kg=100,Wg=1,Bt={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Ug=rr({getKey:null,doesEleInvalidateKey:en,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:fs,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),oa=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=Ug(t);pe(a,n),a.lookup=new Lg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ye=oa.prototype;Ye.reasons=Bt;Ye.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ye.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ye.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ca(function(t,a){return a.reqs-t.reqs});return e};Ye.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ye.getElement=function(r,e,t,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(ci(s*t))),a=Ag||a>ri)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=o.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var h=l.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(v<=qo?d=qo:v<=Ha?d=Ha:d=Math.ceil(v/Ha)*Ha,v>zg||f>Ig)return null;var y=i.getTextureQueue(d),p=y[y.length-2],g=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};p||(p=y[y.length-1]),p||(p=g()),p.width-p.usedWidtha;P--)C=i.getElement(r,e,t,P,Bt.downscale);M()}else return i.queueElement(r,E.level-1),E;else{var B;if(!b&&!w&&!S)for(var L=a-1;L>=Ja;L--){var k=l.get(r,L);if(k){B=k;break}}if(m(B))return i.queueElement(r,a),B;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,r,e,c,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return h={x:p.usedWidth,texture:p,level:a,scale:u,width:f,height:v,scaledLabelShown:c},p.usedWidth+=Math.ceil(f+Rg),p.eleCaches.push(h),l.set(r,a,h),i.checkTextureFullness(p),h};Ye.invalidateElements=function(r){for(var e=0;e=Ng*r.width&&this.retireTexture(r)};Ye.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Fg&&r.fullnessChecks>=Vg?et(t,r):r.fullnessChecks++};Ye.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;et(a,r),r.retired=!0;for(var i=r.eleCaches,o=0;o=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,fi(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),et(n,o),a.push(o),o}};Ye.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,a.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(s),n[i]=s}};Ye.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o0;o++){var s=t.pop(),l=s.key,u=s.eles[0],v=i.hasCache(u,s.level);if(a[l]=null,v)continue;n.push(s);var f=e.getBoundingBox(u);e.getElement(u,f,r,s.level,Bt.dequeue)}return n};Ye.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=li,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ye.onDequeue=function(r){this.onDequeues.push(r)};Ye.offDequeue=function(r){et(this.onDequeues,r)};Ye.setupDequeueing=wu.setupDequeueing({deqRedrawThreshold:Kg,deqCost:qg,deqAvgCost:$g,deqNoDrawCost:Hg,deqFastCost:Gg,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a=Xg||t>ln)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[],f,c=a.levelIsComplete(t,r),h,d=function(){var M=function(O){if(a.validateLayersElesOrdering(O,r),a.levelIsComplete(O,r))return h=l[O],!0},P=function(O){if(!h)for(var A=t+O;ua<=A&&A<=ln&&!M(A);A+=O);};P(1),P(-1);for(var B=v.length-1;B>=0;B--){var L=v[B];L.invalid&&et(v,L)}};if(!c)d();else return v;var y=function(){if(!f){f=hr();for(var M=0;MHo||L>Ho)return null;var k=B*L;if(k>tp)return null;var O=a.makeLayer(f,t);if(P!=null){var A=v.indexOf(P)+1;v.splice(A,0,O)}else(M.insert===void 0||M.insert)&&v.unshift(O);return O};if(a.skipping&&!s)return null;for(var g=null,m=r.length/Yg,b=!s,w=0;w=m||!ms(g.bb,S.boundingBox()))&&(g=p({insert:!0,after:g}),!g))return null;h||b?a.queueLayer(g,S):a.drawEleInLayer(g,S,t,e),g.eles.push(S),x[t]=g}return h||(b?null:v)};tr.getEleLevelForLayerLevel=function(r,e){return r};tr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,ap),i.setImgSmoothing(o,!0))};tr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];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};tr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a0){e=!0;break}}return e};tr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Hr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};tr.invalidateLayer=function(r){if(this.lastInvalidationTime=Hr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];et(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.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 l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,g=u*v,m=u*v,b=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;f==="straight-triangle"?(o.eleStrokeStyle(r,e,O),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=h,r.lineCap=d,o.eleStrokeStyle(r,e,O),o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},w=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(r.lineWidth=h+y,r.lineCap=d,y>0)o.colorStrokeStyle(r,p[0],p[1],p[2],O);else{r.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},S=function(){n&&o.drawEdgeOverlay(r,e)},E=function(){n&&o.drawEdgeUnderlay(r,e)},x=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(r,e,O)},D=function(){o.drawElementText(r,e,null,a)};r.lineJoin="round";var C=e.pstyle("ghost").value==="yes";if(C){var M=e.pstyle("ghost-offset-x").pfValue,P=e.pstyle("ghost-offset-y").pfValue,B=e.pstyle("ghost-opacity").value,L=g*B;r.translate(M,P),b(L),x(L),r.translate(-M,-P)}else w();E(),b(),x(),S(),D(),t&&r.translate(l.x1,l.y1)}};var Cu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,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,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,s.allpts,"solid")}}}};Ur.drawEdgeOverlay=Cu("overlay");Ur.drawEdgeUnderlay=Cu("underlay");Ur.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,o,s=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=f,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[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 l=o.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(o.drawText(r,e,null,h,i),e.isEdge()&&(o.drawText(r,e,"source",h,i),o.drawText(r,e,"target",h,i))):o.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};wt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t2&&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=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*s,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+o+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],s),this.colorStrokeStyle(r,v[0],v[1],v[2],l)};function Hn(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),o?r.stroke():r.fill()}wt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=kr(n,"labelAngle",e);return o.strValue==="autorotate"?t=r.isEdge()?s:0:o.strValue==="none"?t=0:t=o.pfValue,t};wt.drawText=function(r,e,t){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))){t==="main"&&(t=null);var l=kr(o,"labelX",t),u=kr(o,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=kr(o,"labelWidth",t),y=kr(o,"labelHeight",t),p=e.pstyle(h+"text-margin-x").pfValue,g=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),l+=p,u+=g;var S;switch(a?S=this.getTextAngle(e,t):S=0,S!==0&&(v=l,f=u,r.translate(v,f),r.rotate(S),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var E=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,D=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,M=e.pstyle("text-background-shape").strValue,P=M.indexOf("round")===0,B=2;if(E>0||D>0&&x>0){var L=l-C;switch(b){case"left":L-=d;break;case"center":L-=d/2;break}var k=u-y-C,O=d+2*C,A=y+2*C;if(E>0){var R=r.fillStyle,I=e.pstyle("text-background-color").value;r.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",P?Hn(r,L,k,O,A,B):r.fillRect(L,k,O,A),r.fillStyle=R}if(D>0&&x>0){var V=r.strokeStyle,G=r.lineWidth,F=e.pstyle("text-border-color").value,q=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+x*s+")",r.lineWidth=D,r.setLineDash)switch(q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=D/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(P?Hn(r,L,k,O,A,B,"stroke"):r.strokeRect(L,k,O,A),q==="double"){var Y=D/2;P?Hn(r,L+Y,k+Y,O-Y*2,A-Y*2,B,"stroke"):r.strokeRect(L+Y,k+Y,O-Y*2,A-Y*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=G,r.strokeStyle=V}}var Q=2*e.pstyle("text-outline-width").pfValue;if(Q>0&&(r.lineWidth=Q),e.pstyle("text-wrap").value==="wrap"){var J=kr(o,"labelWrapCachedLines",t),_=kr(o,"labelLineHeight",t),j=d/2,W=this.getLabelJustification(e);switch(W==="auto"||(b==="left"?W==="left"?l+=-d:W==="center"&&(l+=-j):b==="center"?W==="left"?l+=-j:W==="right"&&(l+=j):b==="right"&&(W==="center"?l+=j:W==="right"&&(l+=d))),w){case"top":u-=(J.length-1)*_;break;case"center":case"bottom":u-=(J.length-1)*_;break}for(var z=0;z0&&r.strokeText(J[z],l,u),r.fillText(J[z],l,u),u+=_}else Q>0&&r.strokeText(c,l,u),r.fillText(c,l,u);S!==0&&(r.rotate(-S),r.translate(-v,-f))}}};var Xt={};Xt.drawNode=function(r,e,t){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,l,u=e._private,v=u.rscratch,f=e.position();if(!(!ne(f.x)||!ne(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,y=!1,p=e.padding();s=e.width()+2*p,l=e.height()+2*p;var g;t&&(g=t,r.translate(-g.x1,-g.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),S=new Array(b.length),E=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(r,e,N)},z=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(r,k[0],k[1],k[2],N)},K=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:J;o.colorStrokeStyle(r,Y[0],Y[1],Y[2],N)},X=function(N,H,ie,Z){var oe=o.nodePathCache=o.nodePathCache||[],ge=vs(ie==="polygon"?ie+","+Z.join(","):ie,""+H,""+N,""+j),we=oe[ge],fe,me=!1;return we!=null?(fe=we,me=!0,v.pathCache=fe):(fe=new Path2D,oe[ge]=v.pathCache=fe),{path:fe,cacheHit:me}},ae=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var te=X(s,l,ae,he);d=te.path,y=te.cacheHit}var re=function(){if(!y){var N=f;h&&(N={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||r,N.x,N.y,s,l,j,v)}h?r.fill(d):r.fill()},ve=function(){for(var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ie=u.backgrounding,Z=0,oe=0;oe0&&arguments[0]!==void 0?arguments[0]:!1,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(r,e,H),N&&(h||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,l,j,v)))},se=function(){var N=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,H=(P>0?P:-P)*N,ie=P>0?0:255;P!==0&&(o.colorFillStyle(r,ie,ie,ie,H),h?r.fill(d):r.fill())},de=function(){if(B>0){if(r.lineWidth=B,r.lineCap=R,r.lineJoin=A,r.setLineDash)switch(O){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(V),r.lineDashOffset=G;break;case"solid":case"double":r.setLineDash([]);break}if(I!=="center"){if(r.save(),r.lineWidth*=2,I==="inside")h?r.clip(d):r.clip();else{var N=new Path2D;N.rect(-s/2-B,-l/2-B,s+2*B,l+2*B),N.addPath(d),r.clip(N,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(O==="double"){r.lineWidth=B/3;var H=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=H}r.setLineDash&&r.setLineDash([])}},Le=function(){if(q>0){if(r.lineWidth=q,r.lineCap="butt",r.setLineDash)switch(Q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var N=f;h&&(N={x:0,y:0});var H=o.getNodeShape(e),ie=B;I==="inside"&&(ie=0),I==="outside"&&(ie*=2);var Z=(s+ie+(q+_))/s,oe=(l+ie+(q+_))/l,ge=s*Z,we=l*oe,fe=o.nodeShapes[H].points,me;if(h){var be=X(ge,we,H,fe);me=be.path}if(H==="ellipse")o.drawEllipsePath(me||r,N.x,N.y,ge,we);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(H)){var ye=0,Ie=0,Ve=0;H==="round-diamond"?ye=(ie+_+q)*1.4:H==="round-heptagon"?(ye=(ie+_+q)*1.075,Ve=-(ie/2+_+q)/35):H==="round-hexagon"?ye=(ie+_+q)*1.12:H==="round-pentagon"?(ye=(ie+_+q)*1.13,Ve=-(ie/2+_+q)/15):H==="round-tag"?(ye=(ie+_+q)*1.12,Ie=(ie/2+q+_)*.07):H==="round-triangle"&&(ye=(ie+_+q)*(Math.PI/2),Ve=-(ie+_/2+q)/Math.PI),ye!==0&&(Z=(s+ye)/s,ge=s*Z,["round-hexagon","round-tag"].includes(H)||(oe=(l+ye)/l,we=l*oe)),j=j==="auto"?xs(ge,we):j;for(var gr=ge/2,pr=we/2,Ge=j+(ie+q+_)/2,Xe=new Array(fe.length/2),Ze=new Array(fe.length/2),lr=0;lr0){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(t,v[0],v[1],v[2],u),s.nodeShapes[f].draw(t,n.x,n.y,i+l*2,o+l*2,c),t.fill()}}}};Xt.drawNodeOverlay=Su("overlay");Xt.drawNodeUnderlay=Su("underlay");Xt.hasPie=function(r){return r=r[0],r._private.hasPie};Xt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=a.x,s=a.y,l=e.width(),u=e.height(),v=Math.min(l,u)/2,f=0,c=this.usePaths();c&&(o=0,s=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2);for(var h=1;h<=n.pieBackgroundN;h++){var d=e.pstyle("pie-"+h+"-background-size").value,y=e.pstyle("pie-"+h+"-background-color").value,p=e.pstyle("pie-"+h+"-background-opacity").value*t,g=d/100;g+f>1&&(g=1-f);var m=1.5*Math.PI+2*Math.PI*f,b=2*Math.PI*g,w=m+b;d===0||f>=1||f+g>1||(r.beginPath(),r.moveTo(o,s),r.arc(o,s,v,m,w),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],p),r.fill(),f+=g)}};var mr={},hp=100;mr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};mr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;no.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(v[o.NODE]=!0,v[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),w=n!==void 0?n:b,S=l.pan(),E={x:S.x,y:S.y},x={zoom:b,pan:{x:S.x,y:S.y}},D=o.prevViewport,C=D===void 0||x.zoom!==D.zoom||x.pan.x!==D.pan.x||x.pan.y!==D.pan.y;!C&&!(y&&!d)&&(o.motionBlurPxRatio=1),i&&(E=i),w*=s,E.x*=s,E.y*=s;var M=o.getCachedZSortedEles();function P(te,re,ve,le,se){var de=te.globalCompositeOperation;te.globalCompositeOperation="destination-out",o.colorFillStyle(te,255,255,255,o.motionBlurTransparency),te.fillRect(re,ve,le,se),te.globalCompositeOperation=de}function B(te,re){var ve,le,se,de;!o.clearingMotionBlur&&(te===u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||te===u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ve={x:S.x*h,y:S.y*h},le=b*h,se=o.canvasWidth*h,de=o.canvasHeight*h):(ve=E,le=w,se=o.canvasWidth,de=o.canvasHeight),te.setTransform(1,0,0,1,0,0),re==="motionBlur"?P(te,0,0,se,de):!e&&(re===void 0||re)&&te.clearRect(0,0,se,de),t||(te.translate(ve.x,ve.y),te.scale(le,le)),i&&te.translate(i.x,i.y),n&&te.scale(n,n)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var x=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[o.DRAG]=!1,v[o.NODE]=!1;var k=u.contexts[o.NODE],O=o.textureCache.texture,x=o.textureCache.viewport;k.setTransform(1,0,0,1,0,0),c?P(k,0,0,x.width,x.height):k.clearRect(0,0,x.width,x.height);var A=m.core("outside-texture-bg-color").value,R=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(k,A[0],A[1],A[2],R),k.fillRect(0,0,x.width,x.height);var b=l.zoom();B(k,!1),k.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s),k.drawImage(O,x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s)}else o.textureOnViewport&&!e&&(o.textureCache=null);var I=l.extent(),V=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),G=o.hideEdgesOnViewport&&V,F=[];if(F[o.NODE]=!v[o.NODE]&&c&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,F[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),F[o.DRAG]=!v[o.DRAG]&&c&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,F[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),v[o.NODE]||t||a||F[o.NODE]){var q=c&&!F[o.NODE]&&h!==1,k=e||(q?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),Y=c&&!q?"motionBlur":void 0;B(k,Y),G?o.drawCachedNodes(k,M.nondrag,s,I):o.drawLayeredElements(k,M.nondrag,s,I),o.debug&&o.drawDebugPoints(k,M.nondrag),!t&&!c&&(v[o.NODE]=!1)}if(!a&&(v[o.DRAG]||t||F[o.DRAG])){var q=c&&!F[o.DRAG]&&h!==1,k=e||(q?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);B(k,c&&!q?"motionBlur":void 0),G?o.drawCachedNodes(k,M.drag,s,I):o.drawCachedElements(k,M.drag,s,I),o.debug&&o.drawDebugPoints(k,M.drag),!t&&!c&&(v[o.DRAG]=!1)}if(o.showFps||!a&&v[o.SELECT_BOX]&&!t){var k=e||u.contexts[o.SELECT_BOX];if(B(k),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var b=o.cy.zoom(),Q=m.core("selection-box-border-width").value/b;k.lineWidth=Q,k.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",k.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),Q>0&&(k.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",k.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var b=o.cy.zoom(),J=u.bgActivePosistion;k.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",k.beginPath(),k.arc(J.x,J.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),k.fill()}var _=o.lastRedrawTime;if(o.showFps&&_){_=Math.round(_);var j=Math.round(1e3/_);k.setTransform(1,0,0,1,0,0),k.fillStyle="rgba(255, 0, 0, 0.75)",k.strokeStyle="rgba(255, 0, 0, 0.75)",k.lineWidth=1,k.fillText("1 frame = "+_+" ms = "+j+" fps",0,20);var W=60;k.strokeRect(0,30,250,20),k.fillRect(0,30,250*Math.min(j/W,1),20)}t||(v[o.SELECT_BOX]=!1)}if(c&&h!==1){var z=u.contexts[o.NODE],K=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],ae=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],he=function(re,ve,le){re.setTransform(1,0,0,1,0,0),le||!g?re.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(re,0,0,o.canvasWidth,o.canvasHeight);var se=h;re.drawImage(ve,0,0,o.canvasWidth*se,o.canvasHeight*se,0,0,o.canvasWidth,o.canvasHeight)};(v[o.NODE]||F[o.NODE])&&(he(z,K,F[o.NODE]),v[o.NODE]=!1),(v[o.DRAG]||F[o.DRAG])&&(he(X,ae,F[o.DRAG]),v[o.DRAG]=!1)}o.prevViewport=x,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),c&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,v[o.NODE]=!0,v[o.DRAG]=!0,o.redraw()},hp)),e||l.emit("render")};var it={};it.drawPolygonPath=function(r,e,t,a,n,i){var o=a/2,s=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var l=1;l0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var y=e.pan(),p={x:y.x*u,y:y.y*u};u*=e.zoom(),h.translate(p.x,p.y),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(-p.x,-p.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,o),h.fill())}return c};function gp(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":Ue(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[Eu,Fr,Ur,Pi,wt,Xt,mr,it,Pa,ku].forEach(function(r){pe(De,r)});var mp=[{name:"null",impl:lu},{name:"base",impl:bu},{name:"canvas",impl:pp}],bp=[{type:"layout",extensions:Tg},{type:"renderer",extensions:mp}],Bu={},Mu={};function Lu(r,e,t){var a=t,n=function(D){Me("Can not register `"+e+"` for `"+r+"` since `"+D+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(ba.prototype[e])return n(e);ba.prototype[e]=t}else if(r==="collection"){if(er.prototype[e])return n(e);er.prototype[e]=t}else if(r==="layout"){for(var i=function(D){this.options=D,t.call(this,D),Te(this._private)||(this._private={}),this._private.cy=D.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],l=0;l