import{ar as fu,as as gs,at as hu,B as qa,au as vu,av as cu,aw as du,ax as gu,ay as ps,az as pu,aA as yu,aB as mu,aC as bu,aD as Eu,aE as wu,C as xu,aF as Tu,a7 as _r,a5 as or,a6 as Xr,a9 as Du,am as Cu,an as Lu}from"./doc-19de6184.js";import{i as Su}from"./is_dark-f23e070c.js";var Au=fu,Nu=function(){return Au.Date.now()},Mu=Nu,Ou=gs,fn=Mu,li=hu,Iu="Expected a function",Ru=Math.max,ku=Math.min;function Pu(r,e,t){var a,n,i,s,o,u,l=0,f=!1,h=!1,c=!0;if(typeof r!="function")throw new TypeError(Iu);e=li(e)||0,Ou(t)&&(f=!!t.leading,h="maxWait"in t,i=h?Ru(li(t.maxWait)||0,e):i,c="trailing"in t?!!t.trailing:c);function v(L){var b=a,x=n;return a=n=void 0,l=L,s=r.apply(x,b),s}function d(L){return l=L,o=setTimeout(p,e),f?v(L):s}function g(L){var b=L-u,x=L-l,w=e-b;return h?ku(w,i-x):w}function y(L){var b=L-u,x=L-l;return u===void 0||b>=e||b<0||h&&x>=i}function p(){var L=fn();if(y(L))return E(L);o=setTimeout(p,g(L))}function E(L){return o=void 0,c&&a?v(L):(a=n=void 0,s)}function m(){o!==void 0&&clearTimeout(o),l=0,a=u=n=o=void 0}function T(){return o===void 0?s:E(fn())}function D(){var L=fn(),b=y(L);if(a=arguments,n=this,u=L,b){if(o===void 0)return d(u);if(h)return clearTimeout(o),o=setTimeout(p,e),v(u)}return o===void 0&&(o=setTimeout(p,e)),s}return D.cancel=m,D.flush=T,D}var Bu=Pu,ys={exports:{}},ms={exports:{}};(function(r,e){(function(){var t,a,n,i,s,o,u,l,f,h,c,v,d,g,y;n=Math.floor,h=Math.min,a=function(p,E){return pE?1:0},f=function(p,E,m,T,D){var L;if(m==null&&(m=0),D==null&&(D=a),m<0)throw new Error("lo must be non-negative");for(T==null&&(T=p.length);mC;0<=C?w++:w--)x.push(w);return x}.apply(this).reverse(),b=[],T=0,D=L.length;TA;0<=A?++x:--x)S.push(s(p,m));return S},g=function(p,E,m,T){var D,L,b;for(T==null&&(T=a),D=p[m];m>E;){if(b=m-1>>1,L=p[b],T(D,L)<0){p[m]=L,m=b;continue}break}return p[m]=D},y=function(p,E,m){var T,D,L,b,x;for(m==null&&(m=a),D=p.length,x=E,L=p[E],T=2*E+1;Tr.length)&&(e=r.length);for(var t=0,a=new Array(e);t"u"?null:window,ci=Be?Be.navigator:null;Be&&Be.document;var pl=Ye(""),Es=Ye({}),yl=Ye(function(){}),ml=typeof HTMLElement>"u"?"undefined":Ye(HTMLElement),ua=function(e){return e&&e.instanceString&&Fe(e.instanceString)?e.instanceString():null},le=function(e){return e!=null&&Ye(e)==pl},Fe=function(e){return e!=null&&Ye(e)===yl},Ie=function(e){return!ft(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Te=function(e){return e!=null&&Ye(e)===Es&&!Ie(e)&&e.constructor===Object},bl=function(e){return e!=null&&Ye(e)===Es},ae=function(e){return e!=null&&Ye(e)===Ye(1)&&!isNaN(e)},El=function(e){return ae(e)&&Math.floor(e)===e},Fa=function(e){if(ml!=="undefined")return e!=null&&e instanceof HTMLElement},ft=function(e){return la(e)||ws(e)},la=function(e){return ua(e)==="collection"&&e._private.single},ws=function(e){return ua(e)==="collection"&&!e._private.single},zn=function(e){return ua(e)==="core"},xs=function(e){return ua(e)==="stylesheet"},wl=function(e){return ua(e)==="event"},Ut=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},xl=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Tl=function(e){return Te(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},Dl=function(e){return bl(e)&&Fe(e.then)},Cl=function(){return ci&&ci.userAgent.match(/msie|trident|edge/i)},Kr=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;st?1:0},Il=function(e,t){return-1*Ds(e,t)},ce=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(y-=1),y<1/6?d+(g-d)*6*y:y<1/2?g:y<2/3?d+(g-d)*(2/3-y)*6:d}var h=new RegExp("^"+Al+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,v=2*i-c;o=Math.round(255*f(v,c,a+1/3)),u=Math.round(255*f(v,c,a)),l=Math.round(255*f(v,c,a-1/3))}t=[o,u,l,s]}return t},Pl=function(e){var t,a=new RegExp("^"+Ll+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;t.push(Math.floor(s))}var o=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(o&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},Bl=function(e){return Gl[e.toLowerCase()]},Fl=function(e){return(Ie(e)?e:null)||Bl(e)||Rl(e)||Pl(e)||kl(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]},Cs=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i1&&arguments[1]!==void 0?arguments[1]:mr,a=t,n;n=e.next(),!n.done;)a=a*As+n.value|0;return a},Zr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:mr;return t*As+e|0},Qr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$r;return(t<<5)+t+e|0},Vl=function(e,t){return e*2097152+t},Ft=function(e){return e[0]*2097152+e[1]},ba=function(e,t){return[Zr(e[0],t[0]),Qr(e[1],t[1])]},$l=function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n=0&&!(e[n]===t&&(e.splice(n,1),a));n--);},Un=function(e){e.splice(0,e.length)},_l=function(e,t){for(var a=0;a"u"?"undefined":Ye(Set))!==Zl?Set:Ql,Ka=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!zn(e)){ze("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"){ze("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 Ar,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 s=t.renderedPosition,o=e.pan(),u=e.zoom();i.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];Ie(t.classes)?l=t.classes:le(t.classes)&&(l=t.classes.split(/\s+/));for(var f=0,h=l.length;f0;){var L=E.pop(),b=y(L),x=L.id();if(c[x]=b,b!==1/0)for(var w=L.neighborhood().intersect(d),C=0;C0)for(R.unshift(k);h[z];){var F=h[z];R.unshift(F.edge),R.unshift(F.node),B=F.node,z=B.id()}return o.spawn(R)}}}},ef={kruskal:function(e){e=e||function(m){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,u=function(T){for(var D=0;D0;){if(D(),b++,T===f){for(var x=[],w=i,C=f,A=p[C];x.unshift(w),A!=null&&x.unshift(A),w=y[C],w!=null;)C=w.id(),A=p[C];return{found:!0,distance:h[T],path:this.spawn(x),steps:b}}v[T]=!0;for(var S=m._private.edges,O=0;OA&&(d[C]=A,E[C]=w,m[C]=D),!i){var S=w*f+x;!i&&d[S]>A&&(d[S]=A,E[S]=x,m[S]=D)}}}for(var O=0;O1&&arguments[1]!==void 0?arguments[1]:s,Ee=m(ne),ge=[],ve=Ee;;){if(ve==null)return t.spawn();var J=E(ve),M=J.edge,Y=J.pred;if(ge.unshift(ve[0]),ve.same(ue)&&ge.length>0)break;M!=null&&ge.unshift(M),ve=Y}return u.spawn(ge)},L=0;L=0;f--){var h=l[f],c=h[1],v=h[2];(t[c]===o&&t[v]===u||t[c]===u&&t[v]===o)&&l.splice(f,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*t.length);t=lf(i,e,t),a--}return t},ff={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(R){return R.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/uf);if(i<2){ze("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=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,s=t;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a0&&e.splice(0,t));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];s?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}i&&e.sort(function(c,v){return c-v});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},pf=function(e){return Math.PI*e/180},Ea=function(e,t){return Math.atan2(t,e)-Math.PI/2},Hn=Math.log2||function(r){return Math.log(r)/Math.log(2)},Bs=function(e){return e>0?1:e<0?-1:0},rr=function(e,t){return Math.sqrt(Jt(e,t))},Jt=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},yf=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}}},bf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Ef=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},wf=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},xf=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},Ma=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},cn=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(t.length===1)a=n=i=s=t[0];else if(t.length===2)a=i=t[0],s=n=t[1];else if(t.length===4){var o=Mt(t,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},mi=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},Xn=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},Cr=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Tf=function(e,t){return Cr(e,t.x,t.y)},Fs=function(e,t){return Cr(e,t.x1,t.y1)&&Cr(e,t.x2,t.y2)},Gs=function(e,t,a,n,i,s,o){var u=fa(i,s),l=i/2,f=s/2,h;{var c=a-l+u-o,v=n-f-o,d=a+l-u+o,g=v;if(h=Vt(e,t,a,n,c,v,d,g,!1),h.length>0)return h}{var y=a+l+o,p=n-f+u-o,E=y,m=n+f-u+o;if(h=Vt(e,t,a,n,y,p,E,m,!1),h.length>0)return h}{var T=a-l+u-o,D=n+f+o,L=a+l-u+o,b=D;if(h=Vt(e,t,a,n,T,D,L,b,!1),h.length>0)return h}{var x=a-l-o,w=n-f+u-o,C=x,A=n+f-u+o;if(h=Vt(e,t,a,n,x,w,C,A,!1),h.length>0)return h}var S;{var O=a-l+u,N=n-f+u;if(S=Yr(e,t,a,n,O,N,u+o),S.length>0&&S[0]<=O&&S[1]<=N)return[S[0],S[1]]}{var P=a+l-u,I=n-f+u;if(S=Yr(e,t,a,n,P,I,u+o),S.length>0&&S[0]>=P&&S[1]<=I)return[S[0],S[1]]}{var k=a+l-u,R=n+f-u;if(S=Yr(e,t,a,n,k,R,u+o),S.length>0&&S[0]>=k&&S[1]>=R)return[S[0],S[1]]}{var B=a-l+u,z=n+f-u;if(S=Yr(e,t,a,n,B,z,u+o),S.length>0&&S[0]<=B&&S[1]>=z)return[S[0],S[1]]}return[]},Df=function(e,t,a,n,i,s,o){var u=o,l=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return l-u<=e&&e<=f+u&&h-u<=t&&t<=c+u},Cf=function(e,t,a,n,i,s,o,u,l){var f={x1:Math.min(a,o,i)-l,x2:Math.max(a,o,i)+l,y1:Math.min(n,u,s)-l,y2:Math.max(n,u,s)+l};return!(ef.x2||tf.y2)},Lf=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,u=(-t+s)/o,l=(-t-s)/o;return[u,l]},Sf=function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,u,l,f,h,c,v,d;if(u=(3*a-t*t)/9,l=-(27*n)+t*(9*a-2*(t*t)),l/=54,o=u*u*u+l*l,i[1]=0,v=t/3,o>0){h=l+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=l-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-v+h+c,v+=(h+c)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-c+h)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),d=2*Math.sqrt(u),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},Af=function(e,t,a,n,i,s,o,u){var l=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*u-n*t+2*s*s+2*s*t-u*t,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,v=[];Sf(l,f,h,c,v);for(var d=1e-7,g=[],y=0;y<6;y+=2)Math.abs(v[y+1])=0&&v[y]<=1&&g.push(v[y]);g.push(1),g.push(0);for(var p=-1,E,m,T,D=0;D=0?Tl?(e-i)*(e-i)+(t-s)*(t-s):f-c},ut=function(e,t,a){for(var n,i,s,o,u,l=0,f=0;f=e&&e>=s||n<=e&&e<=s)u=(e-n)/(s-n)*(o-i)+i,u>t&&l++;else continue;return l%2!==0},It=function(e,t,a,n,i,s,o,u,l){var f=new Array(a.length),h;u[0]!=null?(h=Math.atan(u[1]/u[0]),u[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=u;for(var c=Math.cos(-h),v=Math.sin(-h),d=0;d0){var y=Vs(f,-l);g=zs(y)}else g=f;return ut(e,t,g)},Mf=function(e,t,a,n,i,s,o){for(var u=new Array(a.length),l=s/2,f=o/2,h=qn(s,o),c=h*h,v=0;v=0&&y<=1&&E.push(y),p>=0&&p<=1&&E.push(p),E.length===0)return[];var m=E[0]*u[0]+e,T=E[0]*u[1]+t;if(E.length>1){if(E[0]==E[1])return[m,T];var D=E[1]*u[0]+e,L=E[1]*u[1]+t;return[m,T,D,L]}else return[m,T]},dn=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},Vt=function(e,t,a,n,i,s,o,u,l){var f=e-i,h=a-e,c=o-i,v=t-s,d=n-t,g=u-s,y=c*v-g*f,p=h*v-d*f,E=g*h-c*d;if(E!==0){var m=y/E,T=p/E,D=.001,L=0-D,b=1+D;return L<=m&&m<=b&&L<=T&&T<=b?[e+m*h,t+m*d]:l?[e+m*h,t+m*d]:[]}else return y===0||p===0?dn(e,a,o)===o?[o,u]:dn(e,a,i)===i?[i,s]:dn(i,o,a)===a?[a,n]:[]:[]},ea=function(e,t,a,n,i,s,o,u){var l=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var v;if(c){for(var d=0;d0){var g=Vs(h,-u);v=zs(g)}else v=h}else v=a;for(var y,p,E,m,T=0;T2){for(var I=[l[0],l[1]],k=Math.pow(I[0]-e,2)+Math.pow(I[1]-t,2),R=1;Rf&&(f=T)},get:function(m){return l[m]}},c=0;c0?I=P.edgesTo(N)[0]:I=N.edgesTo(P)[0];var k=n(I);N=N.id(),x[N]>x[S]+k&&(x[N]=x[S]+k,w.nodes.indexOf(N)<0?w.push(N):w.updateItem(N),b[N]=0,L[N]=[]),x[N]==x[S]+k&&(b[N]=b[N]+b[S],L[N].push(S))}else for(var R=0;R0;){for(var V=D.pop(),U=0;U0&&o.push(a[u]);o.length!==0&&i.push(n.collection(o))}return i},qf=function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:Kf,o=n,u,l,f=0;f=2?Fr(e,t,a,0,Ti,Zf):Fr(e,t,a,0,xi)},squaredEuclidean:function(e,t,a){return Fr(e,t,a,0,Ti)},manhattan:function(e,t,a){return Fr(e,t,a,0,xi)},max:function(e,t,a){return Fr(e,t,a,-1/0,Qf)}};Lr["squared-euclidean"]=Lr.squaredEuclidean;Lr.squaredeuclidean=Lr.squaredEuclidean;function Qa(r,e,t,a,n,i){var s;return Fe(r)?s=r:s=Lr[r]||Lr.euclidean,e===0&&Fe(r)?s(n,i):s(e,t,a,n,i)}var Jf=Ze({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Wn=function(e){return Jf(e)},Va=function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},u=function(c){return n[c](t)},l=a,f=t;return Qa(e,n.length,o,u,l,f)},gn=function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),u=null,l=0;la)return!1}return!0},th=function(e,t,a){for(var n=0;no&&(o=t[l][f],u=f);i[u].push(e[l])}for(var h=0;h=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[s],g=t[n[s]],y;i.mode==="dendrogram"?y={left:d,right:g,key:d.key}:y={value:d.value.concat(g.value),key:d.key},e[d.index]=y,e.splice(g.index,1),t[d.key]=y;for(var p=0;pa[g.key][E.key]&&(u=a[g.key][E.key])):i.linkage==="max"?(u=a[d.key][E.key],a[d.key][E.key]0&&n.push(i);return n},Ni=function(e,t,a){for(var n=[],i=0;io&&(s=l,o=t[i*e+l])}s>0&&n.push(s)}for(var f=0;fl&&(u=f,l=h)}a[i]=s[u]}return n=Ni(e,t,a),n},Mi=function(e){for(var t=this.cy(),a=this.nodes(),n=gh(e),i={},s=0;s=A?(S=A,A=N,O=P):N>S&&(S=N);for(var I=0;I0?1:0;b[w%n.minIterations*o+V]=U,F+=U}if(F>0&&(w>=n.minIterations-1||w==n.maxIterations-1)){for(var $=0,X=0;X1||L>1)&&(o=!0),h[m]=[],E.outgoers().forEach(function(x){x.isEdge()&&h[m].push(x.id())})}else c[m]=[void 0,E.target().id()]}):s.forEach(function(E){var m=E.id();if(E.isNode()){var T=E.degree(!0);T%2&&(u?l?o=!0:l=m:u=m),h[m]=[],E.connectedEdges().forEach(function(D){return h[m].push(D.id())})}else c[m]=[E.source().id(),E.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(l&&u)if(i){if(f&&l!=f)return v;f=l}else{if(f&&l!=f&&u!=f)return v;f||(f=l)}else f||(f=s[0].id());var d=function(m){for(var T=m,D=[m],L,b,x;h[T].length;)L=h[T].shift(),b=c[L][0],x=c[L][1],T!=x?(h[x]=h[x].filter(function(w){return w!=L}),T=x):!i&&T!=b&&(h[b]=h[b].filter(function(w){return w!=L}),T=b),D.unshift(L),D.unshift(T);return D},g=[],y=[];for(y=d(f);y.length!=1;)h[y[0]].length==0?(g.unshift(s.getElementById(y.shift())),g.unshift(s.getElementById(y.shift()))):y=d(y.shift()).concat(y);g.unshift(s.getElementById(y.shift()));for(var p in h)if(h[p].length)return v;return v.found=!0,v.trail=this.spawn(g,!0),v}},Ta=function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},u=function(c,v){for(var d=s.length-1,g=[],y=e.spawn();s[d].x!=c||s[d].y!=v;)g.push(s.pop().edge),d--;g.push(s.pop().edge),g.forEach(function(p){var E=p.connectedNodes().intersection(e);y.merge(p),E.forEach(function(m){var T=m.id(),D=m.connectedEdges().intersection(e);y.merge(m),t[T].cutVertex?y.merge(D.filter(function(L){return L.isLoop()})):y.merge(D)})}),i.push(y)},l=function h(c,v,d){c===d&&(n+=1),t[v]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(v).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(v)));else{var y,p,E,m;g.forEach(function(T){y=T.source().id(),p=T.target().id(),E=y===v?p:y,E!==d&&(m=T.id(),o[m]||(o[m]=!0,s.push({x:v,y:E,edge:T})),E in t?t[v].low=Math.min(t[v].low,t[E].id):(h(c,E,v),t[v].low=Math.min(t[v].low,t[E].low),t[v].id<=t[E].low&&(t[v].cutVertex=!0,u(v,E))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in t||(n=0,l(c,c),t[c].cutVertex=n>1)}});var f=Object.keys(t).filter(function(h){return t[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Th={hopcroftTarjanBiconnected:Ta,htbc:Ta,htb:Ta,hopcroftTarjanBiconnectedComponents:Ta},Da=function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=function u(l){i.push(l),t[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(g){var y=g.target().id();y!==l&&(y in t||u(y),t[y].explored||(t[l].low=Math.min(t[l].low,t[y].low)))}),t[l].index===t[l].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),t[c].low=t[l].index,t[c].explored=!0,c===l)break}var v=h.edgesWith(h),d=h.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||o(l)}}),{cut:s,components:n}},Dh={tarjanStronglyConnected:Da,tsc:Da,tscc:Da,tarjanStronglyConnectedComponents:Da},Ws={};[Jr,jl,ef,rf,nf,of,ff,Pf,xr,Tr,Ln,_f,oh,ch,Eh,xh,Th,Dh].forEach(function(r){ce(Ws,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 _s=0,Ks=1,Zs=2,Rt=function r(e){if(!(this instanceof r))return new r(e);this.id="Thenable/1.0.7",this.state=_s,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))};Rt.prototype={fulfill:function(e){return Oi(this,Ks,"fulfillValue",e)},reject:function(e){return Oi(this,Zs,"rejectReason",e)},then:function(e,t){var a=this,n=new Rt;return a.onFulfilled.push(Ri(e,n,"fulfill")),a.onRejected.push(Ri(t,n,"reject")),Qs(a),n.proxy}};var Oi=function(e,t,a,n){return e.state===_s&&(e.state=t,e[a]=n,Qs(e)),e},Qs=function(e){e.state===Ks?Ii(e,"onFulfilled",e.fulfillValue):e.state===Zs&&Ii(e,"onRejected",e.rejectReason)},Ii=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var o=0;o0}},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 s=0;s0&&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){Ie(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],s=0,o=a.length;s0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,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}};Oa.className=Oa.classNames=Oa.classes;var xe={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:$e,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};xe.variable="(?:[\\w-.]|(?:\\\\"+xe.metaChar+"))+";xe.className="(?:[\\w-]|(?:\\\\"+xe.metaChar+"))+";xe.value=xe.string+"|"+xe.number;xe.id=xe.variable;(function(){var r,e,t;for(r=xe.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(xe.comparatorOp+="|\\!"+e)})();var Me=function(){return{checks:[]}},ie={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},An=[{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 Il(r.selector,e.selector)}),Mh=function(){for(var r={},e,t=0;t0&&f.edgeCount>0)return Ae("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Ae("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Ae("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},Bh=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f==null?"":f},t=function(f){return le(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,v=f.value;switch(c){case ie.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case ie.DATA_COMPARE:{var g=f.field,y=f.operator;return"["+g+a(e(y))+t(v)+"]"}case ie.DATA_BOOL:{var p=f.operator,E=f.field;return"["+e(p)+E+"]"}case ie.DATA_EXIST:{var m=f.field;return"["+m+"]"}case ie.META_COMPARE:{var T=f.operator,D=f.field;return"[["+D+a(e(T))+t(v)+"]]"}case ie.STATE:return v;case ie.ID:return"#"+v;case ie.CLASS:return"."+v;case ie.PARENT:case ie.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case ie.ANCESTOR:case ie.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case ie.COMPOUND_SPLIT:{var L=i(f.left,h),b=i(f.subject,h),x=i(f.right,h);return L+(L.length>0?" ":"")+b+x}case ie.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,v,d){return c+(h===f&&d===0?"$":"")+n(v,h)},"")},s="",o=0;o1&&o=0&&(t=t.replace("!",""),h=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),f=!0),(i||o||f)&&(u=!i&&!s?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),t){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return r}function js(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return Kn(this,r,e,js)};function eo(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}Sr.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Kn(this,r,e,eo)};function Hh(r,e,t){eo(r,e,t),js(r,e,t)}Sr.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Kn(this,r,e,Hh)};Sr.ancestors=Sr.parents;var ta,to;ta=to={data:Se.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:Se.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Se.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Se.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Se.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Se.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ta.attr=ta.data;ta.removeAttr=ta.removeData;var Xh=to,Ja={};function pn(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,s=0;se}),minIndegree:dr("indegree",function(r,e){return re}),minOutdegree:dr("outdegree",function(r,e){return re})});ce(Ja,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n0,c=h;h&&(f=f[0]);var v=c?f.position():{x:0,y:0};t!==void 0?l.position(e,t+v[e]):i!==void 0&&l.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),g=o?a.parent():null,y=g&&g.length>0,p=y;y&&(g=g[0]);var E=p?g.position():{x:0,y:0};return i={x:d.x-E.x,y:d.y-E.y},e===void 0?i:i[e]}else if(!s)return;return this}};xt.modelPosition=xt.point=xt.position;xt.modelPositions=xt.points=xt.positions;xt.renderedPoint=xt.renderedPosition;xt.relativePoint=xt.relativePosition;var qh=ro,Dr,_t;Dr=_t={};_t.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:u,w:s-i,h:u-o}};_t.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)};_t.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(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function v(w,C,A){var S=0,O=0,N=C+A;return w>0&&N>0&&(S=C/N*w,O=A/N*w),{biasDiff:S,biasComplementDiff:O}}function d(w,C,A,S){if(A.units==="%")switch(S){case"width":return w>0?A.pfValue*w:0;case"height":return C>0?A.pfValue*C:0;case"average":return w>0&&C>0?A.pfValue*(w+C)/2:0;case"min":return w>0&&C>0?w>C?A.pfValue*C:A.pfValue*w:0;case"max":return w>0&&C>0?w>C?A.pfValue*w:A.pfValue*C:0;default:return 0}else return A.units==="px"?A.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var y=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var p=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(p=p*100/f.height.val);var E=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(E=E*100/f.height.val);var m=v(f.width.val-h.w,g,y),T=m.biasDiff,D=m.biasComplementDiff,L=v(f.height.val-h.h,p,E),b=L.biasDiff,x=L.biasComplementDiff;o.autoPadding=d(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-T+h.x1+h.x2+D)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-b+h.y1+h.y2+x)/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)},jt=function(e,t){return t==null?e:Et(e,t.x1,t.y1,t.x2,t.y2)},Gr=function(e,t,a){return wt(e,t,a)},Ca=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,s=i.arrowWidth/2,o=t.pstyle(a+"-arrow-shape").value,u,l;if(o!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=u-s,h.y1=l-s,h.x2=u+s,h.y2=l+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,Ma(h,1),Et(e,h.x1,h.y1,h.x2,h.y2)}}},yn=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,s=i.rstyle,o=t.pstyle(n+"label").strValue;if(o){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),f=Gr(s,"labelWidth",a),h=Gr(s,"labelHeight",a),c=Gr(s,"labelX",a),v=Gr(s,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,g=t.pstyle(n+"text-margin-y").pfValue,y=t.isEdge(),p=t.pstyle(n+"text-rotation"),E=t.pstyle("text-outline-width").pfValue,m=t.pstyle("text-border-width").pfValue,T=m/2,D=t.pstyle("text-background-padding").pfValue,L=2,b=h,x=f,w=x/2,C=b/2,A,S,O,N;if(y)A=c-w,S=c+w,O=v-C,N=v+C;else{switch(u.value){case"left":A=c-x,S=c;break;case"center":A=c-w,S=c+w;break;case"right":A=c,S=c+x;break}switch(l.value){case"top":O=v-b,N=v;break;case"center":O=v-C,N=v+C;break;case"bottom":O=v,N=v+b;break}}A+=d-Math.max(E,T)-D-L,S+=d+Math.max(E,T)+D+L,O+=g-Math.max(E,T)-D-L,N+=g+Math.max(E,T)+D+L;var P=a||"main",I=i.labelBounds,k=I[P]=I[P]||{};k.x1=A,k.y1=O,k.x2=S,k.y2=N,k.w=S-A,k.h=N-O;var R=y&&p.strValue==="autorotate",B=p.pfValue!=null&&p.pfValue!==0;if(R||B){var z=R?Gr(i.rstyle,"labelAngle",a):p.pfValue,F=Math.cos(z),V=Math.sin(z),U=(A+S)/2,$=(O+N)/2;if(!y){switch(u.value){case"left":U=S;break;case"right":U=A;break}switch(l.value){case"top":$=N;break;case"bottom":$=O;break}}var X=function(de,ee){return de=de-U,ee=ee-$,{x:de*F-ee*V+U,y:de*V+ee*F+$}},H=X(A,O),G=X(A,N),q=X(S,O),K=X(S,N);A=Math.min(H.x,G.x,q.x,K.x),S=Math.max(H.x,G.x,q.x,K.x),O=Math.min(H.y,G.y,q.y,K.y),N=Math.max(H.y,G.y,q.y,K.y)}var Z=P+"Rot",te=I[Z]=I[Z]||{};te.x1=A,te.y1=O,te.x2=S,te.y2=N,te.w=S-A,te.h=N-O,Et(e,A,O,S,N),Et(i.labelBounds.all,A,O,S,N)}return e}},Wh=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=lt(),o=e._private,u=e.isNode(),l=e.isEdge(),f,h,c,v,d,g,y=o.rstyle,p=u&&n?e.pstyle("bounds-expansion").pfValue:[0],E=function(fe){return fe.pstyle("display").value!=="none"},m=!n||E(e)&&(!l||E(e.source())&&E(e.target()));if(m){var T=0,D=0;n&&t.includeOverlays&&(T=e.pstyle("overlay-opacity").value,T!==0&&(D=e.pstyle("overlay-padding").value));var L=0,b=0;n&&t.includeUnderlays&&(L=e.pstyle("underlay-opacity").value,L!==0&&(b=e.pstyle("underlay-padding").value));var x=Math.max(D,b),w=0,C=0;if(n&&(w=e.pstyle("width").pfValue,C=w/2),u&&t.includeNodes){var A=e.position();d=A.x,g=A.y;var S=e.outerWidth(),O=S/2,N=e.outerHeight(),P=N/2;f=d-O,h=d+O,c=g-P,v=g+P,Et(s,f,c,h,v)}else if(l&&t.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),h=Math.max(y.srcX,y.midX,y.tgtX),c=Math.min(y.srcY,y.midY,y.tgtY),v=Math.max(y.srcY,y.midY,y.tgtY),f-=C,h+=C,c-=C,v+=C,Et(s,f,c,h,v),I==="haystack"){var k=y.haystackPts;if(k&&k.length===2){if(f=k[0].x,c=k[0].y,h=k[1].x,v=k[1].y,f>h){var R=f;f=h,h=R}if(c>v){var B=c;c=v,v=B}Et(s,f-C,c-C,h+C,v+C)}}else if(I==="bezier"||I==="unbundled-bezier"||I==="segments"||I==="taxi"){var z;switch(I){case"bezier":case"unbundled-bezier":z=y.bezierPts;break;case"segments":case"taxi":z=y.linePts;break}if(z!=null)for(var F=0;Fh){var G=f;f=h,h=G}if(c>v){var q=c;c=v,v=q}f-=C,h+=C,c-=C,v+=C,Et(s,f,c,h,v)}if(n&&t.includeEdges&&l&&(Ca(s,e,"mid-source"),Ca(s,e,"mid-target"),Ca(s,e,"source"),Ca(s,e,"target")),n){var K=e.pstyle("ghost").value==="yes";if(K){var Z=e.pstyle("ghost-offset-x").pfValue,te=e.pstyle("ghost-offset-y").pfValue;Et(s,s.x1+Z,s.y1+te,s.x2+Z,s.y2+te)}}var he=o.bodyBounds=o.bodyBounds||{};mi(he,s),cn(he,p),Ma(he,1),n&&(f=s.x1,h=s.x2,c=s.y1,v=s.y2,Et(s,f-x,c-x,h+x,v+x));var de=o.overlayBounds=o.overlayBounds||{};mi(de,s),cn(de,p),Ma(de,1);var ee=o.labelBounds=o.labelBounds||{};ee.all!=null?Ef(ee.all):ee.all=lt(),n&&t.includeLabels&&(t.includeMainLabels&&yn(s,e,null),l&&(t.includeSourceLabels&&yn(s,e,"source"),t.includeTargetLabels&&yn(s,e,"target")))}return s.x1=ct(s.x1),s.y1=ct(s.y1),s.x2=ct(s.x2),s.y2=ct(s.y2),s.w=ct(s.x2-s.x1),s.h=ct(s.y2-s.y1),s.w>0&&s.h>0&&m&&(cn(s,p),Ma(s,1)),s},no=function(e){var t=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:uv,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;o--)s(o);return this};Wt.removeAllListeners=function(){return this.removeListener("*")};Wt.emit=Wt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Ie(e)||(e=[e]),lv(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===ov)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&_l(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==h}));var v=i.callbackContext(i.context,h,s),d=h.callback.apply(v,c);i.afterEmit(i.context,h,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,i.set(l,{ele:u,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 s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&le(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=u,n=o)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,s=0;s=0&&i"u"?"undefined":Ye(Symbol))!=e&&Ye(Symbol.iterator)!=e;t&&($a[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return bs({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!=null?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 s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(le(e))if(t===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var s=0;s0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});et.neighbourhood=et.neighborhood;et.closedNeighbourhood=et.closedNeighborhood;et.openNeighbourhood=et.openNeighborhood;ce(et,{source:dt(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:dt(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Xi({attr:"source"}),targets:Xi({attr:"target"})});function Xi(r){return function(t){for(var a=[],n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});et.componentsOf=et.components;var Ke=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){ze("A collection must have a reference to the core");return}var i=new Ct,s=!1;if(!t)t=[];else if(t.length>0&&Te(t[0])&&!la(t[0])){s=!0;for(var o=[],u=new Ar,l=0,f=t.length;l0&&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=[],s=[],o,u=0,l=t.length;u0){for(var B=o.length===t.length?t:new Ke(a,o),z=0;z0&&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 s(N){for(var P=N._private.edges,I=0;I0&&(r?A.emitAndNotify("remove"):e&&A.emit("remove"));for(var S=0;S0?S=N:A=N;while(Math.abs(O)>s&&++P=i?E(C,P):I===0?P:T(C,A,A+l)}var L=!1;function b(){L=!0,(r!==e||t!==a)&&m()}var x=function(A){return L||b(),r===e&&t===a?A:A===0?0:A===1?1:y(D(A),e,a)};x.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var w="generateBezier("+[r,e,t,a]+")";return x.toString=function(){return w},x}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Ev=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:r(s)}}function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),u=e(a,n,o),l=1/6*(i.dx+2*(s.dx+o.dx)+u.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,h=16/1e3,c,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(l=a(n,i),v=l/s*h):v=h;d=t(d||o,v),u.push(1+d.x),l+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(g){return u[g*(u.length-1)|0]}:l}}(),Re=function(e,t,a,n){var i=bv(e,t,a,n);return function(s,o,u){return s+(o-s)*i(u)}},Ra={linear:function(e,t,a){return e+(t-e)*a},ease:Re(.25,.1,.25,1),"ease-in":Re(.42,0,1,1),"ease-out":Re(0,0,.58,1),"ease-in-out":Re(.42,0,.58,1),"ease-in-sine":Re(.47,0,.745,.715),"ease-out-sine":Re(.39,.575,.565,1),"ease-in-out-sine":Re(.445,.05,.55,.95),"ease-in-quad":Re(.55,.085,.68,.53),"ease-out-quad":Re(.25,.46,.45,.94),"ease-in-out-quad":Re(.455,.03,.515,.955),"ease-in-cubic":Re(.55,.055,.675,.19),"ease-out-cubic":Re(.215,.61,.355,1),"ease-in-out-cubic":Re(.645,.045,.355,1),"ease-in-quart":Re(.895,.03,.685,.22),"ease-out-quart":Re(.165,.84,.44,1),"ease-in-out-quart":Re(.77,0,.175,1),"ease-in-quint":Re(.755,.05,.855,.06),"ease-out-quint":Re(.23,1,.32,1),"ease-in-out-quint":Re(.86,0,.07,1),"ease-in-expo":Re(.95,.05,.795,.035),"ease-out-expo":Re(.19,1,.22,1),"ease-in-out-expo":Re(1,0,0,1),"ease-in-circ":Re(.6,.04,.98,.335),"ease-out-circ":Re(.075,.82,.165,1),"ease-in-out-circ":Re(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return Ra.linear;var n=Ev(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":Re};function _i(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 Ki(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function gr(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=Ki(r,n),o=Ki(e,n);if(ae(s)&&ae(o))return _i(i,s,o,t,a);if(Ie(s)&&Ie(o)){for(var u=[],l=0;l0?(v==="spring"&&d.push(s.duration),s.easingImpl=Ra[v].apply(null,d)):s.easingImpl=Ra[v]}var g=s.easingImpl,y;if(s.duration===0?y=1:y=(t-u)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var p=s.startPosition,E=s.position;if(E&&n&&!r.locked()){var m={};Vr(p.x,E.x)&&(m.x=gr(p.x,E.x,y,g)),Vr(p.y,E.y)&&(m.y=gr(p.y,E.y,y,g)),r.position(m)}var T=s.startPan,D=s.pan,L=i.pan,b=D!=null&&a;b&&(Vr(T.x,D.x)&&(L.x=gr(T.x,D.x,y,g)),Vr(T.y,D.y)&&(L.y=gr(T.y,D.y,y,g)),r.emit("pan"));var x=s.startZoom,w=s.zoom,C=w!=null&&a;C&&(Vr(x,w)&&(i.zoom=jr(i.minZoom,gr(x,w,y,g),i.maxZoom)),r.emit("zoom")),(b||C)&&r.emit("viewport");var A=s.style;if(A&&A.length>0&&n){for(var S=0;S=0;b--){var x=L[b];x()}L.splice(0,L.length)},E=v.length-1;E>=0;E--){var m=v[E],T=m._private;if(T.stopped){v.splice(E,1),T.hooked=!1,T.playing=!1,T.started=!1,p(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||xv(f,m,r),wv(f,m,r,h),T.applying&&(T.applying=!1),p(T.frames),T.step!=null&&T.step(r),m.completed()&&(v.splice(E,1),T.hooked=!1,T.playing=!1,T.started=!1,p(T.completes)),g=!0)}return!h&&v.length===0&&d.length===0&&a.push(f),g}for(var i=!1,s=0;s0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var Tv={animate:Se.animate(),animation:Se.animation(),animated:Se.animated(),clearQueue:Se.clearQueue(),delay:Se.delay(),delayAnimation:Se.delayAnimation(),stop:Se.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||Ga(function(i){Zi(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Zi(s,e)},a.beforeRenderPriorities.animations):t()}},Dv={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&&la(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}},Aa=function(e){return le(e)?new Xt(e):e},po={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ja(Dv,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,Aa(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,Aa(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,Aa(t),a),this},once:function(e,t,a){return this.emitter().one(e,Aa(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}};Se.eventAliasesOn(po);var Mn={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)}};Mn.jpeg=Mn.jpg;var ka={layout:function(e){var t=this;if(e==null){ze("Layout options must be specified to make a layout");return}if(e.name==null){ze("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){ze("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;le(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(ce({},e,{cy:t,eles:i}));return s}};ka.createLayout=ka.makeLayout=ka.layout;var Cv={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)}};On.invalidateDimensions=On.resize;var Pa={collection:function(e,t){return le(e)?this.$(e):ft(e)?e.collection():Ie(e)?(t||(t={}),new Ke(this,e,t.unique,t.removed)):new Ke(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}};Pa.elements=Pa.filter=Pa.$;var rt={},qr="t",Sv="f";rt.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(c||h&&v){var d=void 0;c&&v||c?d=l.properties:v&&(d=l.mappedProperties);for(var g=0;g1&&(T=1),o.color){var L=a.valueMin[0],b=a.valueMax[0],x=a.valueMin[1],w=a.valueMax[1],C=a.valueMin[2],A=a.valueMax[2],S=a.valueMin[3]==null?1:a.valueMin[3],O=a.valueMax[3]==null?1:a.valueMax[3],N=[Math.round(L+(b-L)*T),Math.round(x+(w-x)*T),Math.round(C+(A-C)*T),Math.round(S+(O-S)*T)];i={bypass:a.bypass,name:a.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(o.number){var P=a.valueMin+(a.valueMax-a.valueMin)*T;i=this.parse(a.name,P,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case s.data:{for(var I=a.field.split("."),k=h.data,R=0;R0&&i>0){for(var o={},u=!1,l=0;l0?r.delayAnimation(s).play().promise().then(m):m()}).then(function(){return r.animation({style:o,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)};rt.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(t,a)&&i(s)};rt.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)})};rt.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")||e==="display"&&(t==="none"||a==="none"))&&r.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()})})};rt.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a)};var va={};va.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}function u(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Ae("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new Xt(h);if(c.invalid){Ae("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var v=f[2],d=!1;i=v;for(var g=[];;){var y=i.match(/^\s*$/);if(y)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Ae("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=p[0];var E=p[1],m=p[2],T=e.properties[E];if(!T){Ae("Skipping property: Invalid property name in: "+s),u();continue}var D=t.parse(E,m);if(!D){Ae("Skipping property: Invalid property definition in: "+s),u();continue}g.push({name:E,val:m}),u()}if(d){o();break}t.selector(h);for(var L=0;L=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(t)return!1;var c=o.data;return{name:r,value:f,strValue:""+e,mapped:c,field:f[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(t||l.multiple)return!1;var v=o.mapData;if(!(l.color||l.number))return!1;var d=this.parse(r,h[4]);if(!d||d.mapped)return!1;var g=this.parse(r,h[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return Ae("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(l.color){var y=d.value,p=g.value,E=y[0]===p[0]&&y[1]===p[1]&&y[2]===p[2]&&(y[3]===p[3]||(y[3]==null||y[3]===1)&&(p[3]==null||p[3]===1));if(E)return!1}return{name:r,value:h,strValue:""+e,mapped:v,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:d.value,valueMax:g.value,bypass:t}}}if(l.multiple&&a!=="multiple"){var m;if(u?m=e.split(/\s+/):Ie(e)?m=e:m=[e],l.evenMultiple&&m.length%2!==0)return null;for(var T=[],D=[],L=[],b="",x=!1,w=0;w0?" ":"")+C.strValue}return l.validate&&!l.validate(T,D)?null:l.singleEnum&&x?T.length===1&&le(T[0])?{name:r,value:T[0],strValue:T[0],bypass:t}:null:{name:r,value:T,pfValue:L,strValue:b,bypass:t,units:D}}var A=function(){for(var K=0;Kl.max||l.strictMax&&e===l.max))return null;var I={name:r,value:e,strValue:""+e+(S||""),units:S,bypass:t};return l.unitless||S!=="px"&&S!=="em"?I.pfValue=e:I.pfValue=S==="px"||!S?e:this.getEmSizeInPixels()*e,(S==="ms"||S==="s")&&(I.pfValue=S==="ms"?e:1e3*e),(S==="deg"||S==="rad")&&(I.pfValue=S==="rad"?e:pf(e)),S==="%"&&(I.pfValue=e/100),I}else if(l.propList){var k=[],R=""+e;if(R!=="none"){for(var B=R.split(/\s*,\s*|\s+/),z=0;z0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((s-2*t)/a.w,(o-2*t)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=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,s,o=!1;if(t.zoomingEnabled||(o=!0),ae(e)?s=e:Te(e)&&(s=e.level,e.position!=null?i=Za(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(o=!0)),s=s>t.maxZoom?t.maxZoom:s,s=st.maxZoom||!t.zoomingEnabled?s=!0:(t.zoom=u,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ae(l.x)&&(t.pan.x=l.x,o=!1),ae(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(!!this._private.panningEnabled){if(le(e)){var a=e;e=this.mutableElements().filter(a)}else ft(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();t=t===void 0?this._private.zoom:t;var o={x:(i-t*(n.x1+n.x2))/2,y:(s-t*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container;return e.sizeCache=e.sizeCache||(t?function(){var a=Be.getComputedStyle(t),n=function(s){return parseFloat(a.getPropertyValue(s))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,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}};nr.centre=nr.center;nr.autolockNodes=nr.autolock;nr.autoungrabifyNodes=nr.autoungrabify;var aa={data:Se.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Se.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Se.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Se.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};aa.attr=aa.data;aa.removeAttr=aa.removeData;var na=function(e){var t=this;e=ce({},e);var a=e.container;a&&!Fa(a)&&Fa(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 s=Be!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=ce({name:s?"grid":"null"},o.layout),o.renderer=ce({name:s?"canvas":"null"},o.renderer);var u=function(d,g,y){return g!==void 0?g:y!==void 0?y:d},l=this._private={container:a,ready:!1,options:o,elements:new Ke(this),listeners:[],aniEles:new Ke(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:Te(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:Te(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,g){var y=d.some(Dl);if(y)return Nr.all(d).then(g);g(d)};l.styleEnabled&&t.setStyle([]);var h=ce({},o,o.renderer);t.initRenderer(h);var c=function(d,g,y){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),d!=null&&(Te(d)||Ie(d))&&t.add(d),t.one("layoutready",function(m){t.notifications(!0),t.emit(m),t.one("load",g),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",y),t.emit("done")});var E=ce({},t._private.options.layout);E.eles=t.elements(),t.layout(E).run()};f([o.style,o.elements],function(v){var d=v[0],g=v[1];l.styleEnabled&&t.style().append(d),c(g,function(){t.startAnimationLoop(),l.ready=!0,Fe(o.ready)&&t.on("ready",o.ready);for(var y=0;y0,u=lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),l;if(ft(e.roots))l=e.roots;else if(Ie(e.roots)){for(var f=[],h=0;h0;){var P=N(),I=C(P,S);if(I)P.outgoers().filter(function(ee){return ee.isNode()&&a.has(ee)}).forEach(O);else if(I===null){Ae("Detected double maximal shift for node `"+P.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}w();var k=0;if(e.avoidOverlap)for(var R=0;R0&&p[0].length<=3?ve/2:0),Y=2*Math.PI/p[se].length*ne;return se===0&&p[0].length===1&&(M=1),{x:te.x+M*Math.cos(Y),y:te.y+M*Math.sin(Y)}}else{var J={x:te.x+(ne+1-(ue+1)/2)*Ee,y:(se+1)*ge};return J}};return a.nodes().layoutPositions(this,e,de),this};var Ov={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 mo(r){this.options=ce({},Ov,r)}mo.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 s=lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,h=0,c=0;c1&&e.avoidOverlap){h*=1.75;var p=Math.cos(l)-Math.cos(0),E=Math.sin(l)-Math.sin(0),m=Math.sqrt(h*h/(p*p+E*E));f=Math.max(m,f)}var T=function(L,b){var x=e.startAngle+b*l*(n?1:-1),w=f*Math.cos(x),C=f*Math.sin(x),A={x:o.x+w,y:o.y+C};return A};return a.nodes().layoutPositions(this,e,T),this};var Iv={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 bo(r){this.options=ce({},Iv,r)}bo.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"),s=lt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,f=0;f0){var D=Math.abs(E[0].value-T.value);D>=y&&(E=[],p.push(E))}E.push(T)}var L=l+e.minNodeSpacing;if(!e.avoidOverlap){var b=p.length>0&&p[0].length>1,x=Math.min(s.w,s.h)/2-L,w=x/(p.length+b?1:0);L=Math.min(L,w)}for(var C=0,A=0;A1&&e.avoidOverlap){var P=Math.cos(N)-Math.cos(0),I=Math.sin(N)-Math.sin(0),k=Math.sqrt(L*L/(P*P+I*I));C=Math.max(k,C)}S.r=C,C+=L}if(e.equidistant){for(var R=0,B=0,z=0;z=r.numIter||(Vv(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),Ga(h)}};f()}else{for(;l;)l=s(u),u++;ji(a,r),o()}return this};nn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};nn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var kv=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:lt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=a.eles.components(),u={},l=0;l0){s.graphSet.push(b);for(var l=0;ln.count?0:n.graph},Bv=function r(e,t,a,n){var i=n.graphSet[a];if(-10)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+u*u),v=h*o/c,d=h*u/c;else var g=Ua(e,o,u),y=Ua(t,-1*o,-1*u),p=y.x-g.x,E=y.y-g.y,m=p*p+E*E,c=Math.sqrt(m),h=(e.nodeRepulsion+t.nodeRepulsion)/m,v=h*p/c,d=h*E/c;e.isLocked||(e.offsetX-=v,e.offsetY-=d),t.isLocked||(t.offsetX+=v,t.offsetY+=d)}},Uv=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 s=e.maxY-t.minY;else var s=t.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Ua=function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,u=a/t,l=s/o,f={};return t===0&&0a?(f.x=n,f.y=i+s/2,f):0t&&-1*l<=u&&u<=l?(f.x=n-o/2,f.y=i-o*a/2/t,f):0=l)?(f.x=n+s*t/2/a,f.y=i+s/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-s*t/2/a,f.y=i-s/2),f)},Hv=function(e,t){for(var a=0;aa){var y=t.gravity*v/g,p=t.gravity*d/g;c.offsetX+=y,c.offsetY+=p}}}}},qv=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 s=a[n++],o=e.idToIndex[s],u=e.layoutNodes[o],l=u.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},Kv=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.padTopp&&(d+=y+t.componentSpacing,v=0,g=0,y=0)}}},Zv={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 wo(r){this.options=ce({},Zv,r)}wo.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=lt(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(U){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),u=Math.round(o),l=Math.round(i.w/i.h*o),f=function($){if($==null)return Math.min(u,l);var X=Math.min(u,l);X==u?u=$:l=$},h=function($){if($==null)return Math.max(u,l);var X=Math.max(u,l);X==u?u=$:l=$},c=e.rows,v=e.cols!=null?e.cols:e.columns;if(c!=null&&v!=null)u=c,l=v;else if(c!=null&&v==null)u=c,l=Math.ceil(s/u);else if(c==null&&v!=null)l=v,u=Math.ceil(s/l);else if(l*u>s){var d=f(),g=h();(d-1)*g>=s?f(d-1):(g-1)*d>=s&&h(g-1)}else for(;l*u=s?h(p+1):f(y+1)}var E=i.w/l,m=i.h/u;if(e.condense&&(E=0,m=0),e.avoidOverlap)for(var T=0;T=l&&(P=0,N++)},k={},R=0;R(P=Nf(r,e,I[k],I[k+1],I[k+2],I[k+3])))return y(b,P),!0}else if(w.edgeType==="bezier"||w.edgeType==="multibezier"||w.edgeType==="self"||w.edgeType==="compound"){for(var I=w.allpts,k=0;k+5(P=Af(r,e,I[k],I[k+1],I[k+2],I[k+3],I[k+4],I[k+5])))return y(b,P),!0}for(var R=R||x.source,B=B||x.target,z=n.getArrowWidth(C,A),F=[{name:"source",x:w.arrowStartX,y:w.arrowStartY,angle:w.srcArrowAngle},{name:"target",x:w.arrowEndX,y:w.arrowEndY,angle:w.tgtArrowAngle},{name:"mid-source",x:w.midX,y:w.midY,angle:w.midsrcArrowAngle},{name:"mid-target",x:w.midX,y:w.midY,angle:w.midtgtArrowAngle}],k=0;k0&&(p(R),p(B))}function m(b,x,w){return wt(b,x,w)}function T(b,x){var w=b._private,C=c,A;x?A=x+"-":A="",b.boundingBox();var S=w.labelBounds[x||"main"],O=b.pstyle(A+"label").value,N=b.pstyle("text-events").strValue==="yes";if(!(!N||!O)){var P=m(w.rscratch,"labelX",x),I=m(w.rscratch,"labelY",x),k=m(w.rscratch,"labelAngle",x),R=b.pstyle(A+"text-margin-x").pfValue,B=b.pstyle(A+"text-margin-y").pfValue,z=S.x1-C-R,F=S.x2+C-R,V=S.y1-C-B,U=S.y2+C-B;if(k){var $=Math.cos(k),X=Math.sin(k),H=function(de,ee){return de=de-P,ee=ee-I,{x:de*$-ee*X+P,y:de*X+ee*$+I}},G=H(z,V),q=H(z,U),K=H(F,V),Z=H(F,U),te=[G.x+R,G.y+B,K.x+R,K.y+B,Z.x+R,Z.y+B,q.x+R,q.y+B];if(ut(r,e,te))return y(b),!0}else if(Cr(S,r,e))return y(b),!0}}for(var D=s.length-1;D>=0;D--){var L=s[D];L.isNode()?p(L)||T(L):E(L)||T(L)||T(L,"source")||T(L,"target")}return o};ur.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(r,t),o=Math.max(r,t),u=Math.min(e,a),l=Math.max(e,a);r=s,t=o,e=u,a=l;for(var f=lt({x1:r,y1:e,x2:t,y2:a}),h=0;h0?Math.max(oe-we,0):Math.min(oe+we,0)},O=S(C,x),N=S(A,w),P=!1;E===l?p=Math.abs(O)>Math.abs(N)?n:a:E===u||E===o?(p=a,P=!0):(E===i||E===s)&&(p=n,P=!0);var I=p===a,k=I?N:O,R=I?A:C,B=Bs(R),z=!1;!(P&&(T||L))&&(E===o&&R<0||E===u&&R>0||E===i&&R>0||E===s&&R<0)&&(B*=-1,k=B*Math.abs(k),z=!0);var F;if(T){var V=D<0?1+D:D;F=V*k}else{var U=D<0?k:0;F=U+D*B}var $=function(oe){return Math.abs(oe)=Math.abs(k)},X=$(F),H=$(Math.abs(k)-Math.abs(F)),G=X||H;if(G&&!z)if(I){var q=Math.abs(R)<=c/2,K=Math.abs(C)<=v/2;if(q){var Z=(f.x1+f.x2)/2,te=f.y1,he=f.y2;t.segpts=[Z,te,Z,he]}else if(K){var de=(f.y1+f.y2)/2,ee=f.x1,re=f.x2;t.segpts=[ee,de,re,de]}else t.segpts=[f.x1,f.y2]}else{var fe=Math.abs(R)<=h/2,se=Math.abs(A)<=d/2;if(fe){var ne=(f.y1+f.y2)/2,ue=f.x1,Ee=f.x2;t.segpts=[ue,ne,Ee,ne]}else if(se){var ge=(f.x1+f.x2)/2,ve=f.y1,J=f.y2;t.segpts=[ge,ve,ge,J]}else t.segpts=[f.x2,f.y1]}else if(I){var M=f.y1+F+(y?c/2*B:0),Y=f.x1,Q=f.x2;t.segpts=[Y,M,Q,M]}else{var W=f.x1+F+(y?h/2*B:0),_=f.y1,pe=f.y2;t.segpts=[W,_,W,pe]}};it.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,h=!ae(t.startX)||!ae(t.startY),c=!ae(t.arrowStartX)||!ae(t.arrowStartY),v=!ae(t.endX)||!ae(t.endY),d=!ae(t.arrowEndX)||!ae(t.arrowEndY),g=3,y=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,p=g*y,E=rr({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),m=EN.poolIndex()){var P=O;O=N,N=P}var I=w.srcPos=O.position(),k=w.tgtPos=N.position(),R=w.srcW=O.outerWidth(),B=w.srcH=O.outerHeight(),z=w.tgtW=N.outerWidth(),F=w.tgtH=N.outerHeight(),V=w.srcShape=t.nodeShapes[e.getNodeShape(O)],U=w.tgtShape=t.nodeShapes[e.getNodeShape(N)];w.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var $=0;$0){var q=i,K=Jt(q,br(t)),Z=Jt(q,br(G)),te=K;if(Z2){var he=Jt(q,{x:G[2],y:G[3]});he0){var Y=s,Q=Jt(Y,br(t)),W=Jt(Y,br(M)),_=Q;if(W2){var pe=Jt(Y,{x:M[2],y:M[3]});pe<_&&(t=[M[2],M[3]])}}}var j=wa(t,A,e.arrowShapes[u].spacing(r)+f),oe=wa(t,A,e.arrowShapes[u].gap(r)+f);c.startX=oe[0],c.startY=oe[1],c.arrowStartX=j[0],c.arrowStartY=j[1],T&&(!ae(c.startX)||!ae(c.startY)||!ae(c.endX)||!ae(c.endY)?c.badLine=!0:c.badLine=!1)};ca.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};ca.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var ti={};function tc(r,e,t){for(var a=function(l,f,h,c){return He(l,f,h,c)},n=e._private,i=n.rstyle.bezierPts,s=0;s=d||b){y={cp:T,segment:L};break}}if(y)break}var x=y.cp,w=y.segment,C=(d-p)/w.length,A=w.t1-w.t0,S=v?w.t0+A*C:w.t1-A*C;S=jr(0,S,1),e=wr(x.p0,x.p1,x.p2,S),c=rc(x.p0,x.p1,x.p2,S);break}case"straight":case"segments":case"haystack":{for(var O=0,N,P,I,k,R=a.allpts.length,B=0;B+3=d));B+=2);var z=d-P,F=z/N;F=jr(0,F,1),e=mf(I,k,F),c=So(I,k);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};l("source"),l("target"),this.applyLabelDimensions(r)}};St.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};St.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=this.calculateLabelDimensions(r,a),i=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,o=wt(t.rscratch,"labelWrapCachedLines",e)||[],u=s!=="wrap"?1:Math.max(o.length,1),l=n.height/u,f=l*i,h=n.width,c=n.height+(u-1)*(i-1)*l;zt(t.rstyle,"labelWidth",e,h),zt(t.rscratch,"labelWidth",e,h),zt(t.rstyle,"labelHeight",e,c),zt(t.rscratch,"labelHeight",e,c),zt(t.rscratch,"labelLineHeight",e,f)};St.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=function(z,F){return F?(zt(t.rscratch,z,e,F),F):wt(t.rscratch,z,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=r.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="\u200B",f=n.split(` `),h=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,v=c==="anywhere",d=[],g=/[\s\u200b]+/,y=v?"":" ",p=0;ph){for(var L=E.split(g),b="",x=0;xO)break;N+=n[k],k===n.length-1&&(I=!0)}return I||(N+=P),N}return n};St.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};St.calculateLabelDimensions=function(r,e){var t=this,a=tr(e,r._private.labelDimsKey),n=t.labelDimCache||(t.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=r.pstyle("font-style").strValue,u=r.pstyle("font-size").pfValue,l=r.pstyle("font-family").strValue,f=r.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var v=h.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(u,"px ").concat(l);for(var d=0,g=0,y=e.split(` `),p=0;p1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var u=0;u=r.desktopTapThreshold2}var Nt=a(M);Xe&&(r.hoverData.tapholdCancelled=!0);var Bt=function(){var Tt=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Tt.length===0?(Tt.push(be[0]),Tt.push(be[1])):(Tt[0]+=be[0],Tt[1]+=be[1])};Q=!0,t(me,["mousemove","vmousemove","tapdrag"],M,{x:j[0],y:j[1]});var hr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||W.emit({originalEvent:M,type:"boxstart",position:{x:j[0],y:j[1]}}),Ne[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Xe){var Zt={originalEvent:M,type:"cxtdrag",position:{x:j[0],y:j[1]}};ye?ye.emit(Zt):W.emit(Zt),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||me!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:j[0],y:j[1]}}),r.hoverData.cxtOver=me,me&&me.emit({originalEvent:M,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}}else if(r.hoverData.dragging){if(Q=!0,W.panningEnabled()&&W.userPanningEnabled()){var vr;if(r.hoverData.justStartedPan){var pa=r.hoverData.mdownPos;vr={x:(j[0]-pa[0])*_,y:(j[1]-pa[1])*_},r.hoverData.justStartedPan=!1}else vr={x:be[0]*_,y:be[1]*_};W.panBy(vr),W.emit("dragpan"),r.hoverData.dragged=!0}j=r.projectIntoViewport(M.clientX,M.clientY)}else if(Ne[4]==1&&(ye==null||ye.pannable())){if(Xe){if(!r.hoverData.dragging&&W.boxSelectionEnabled()&&(Nt||!W.panningEnabled()||!W.userPanningEnabled()))hr();else if(!r.hoverData.selecting&&W.panningEnabled()&&W.userPanningEnabled()){var Qt=n(ye,r.hoverData.downs);Qt&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,Ne[4]=0,r.data.bgActivePosistion=br(oe),r.redrawHint("select",!0),r.redraw())}ye&&ye.pannable()&&ye.active()&&ye.unactivate()}}else{if(ye&&ye.pannable()&&ye.active()&&ye.unactivate(),(!ye||!ye.grabbed())&&me!=Le&&(Le&&t(Le,["mouseout","tapdragout"],M,{x:j[0],y:j[1]}),me&&t(me,["mouseover","tapdragover"],M,{x:j[0],y:j[1]}),r.hoverData.last=me),ye)if(Xe){if(W.boxSelectionEnabled()&&Nt)ye&&ye.grabbed()&&(g(Ge),ye.emit("freeon"),Ge.emit("free"),r.dragData.didDrag&&(ye.emit("dragfreeon"),Ge.emit("dragfree"))),hr();else if(ye&&ye.grabbed()&&r.nodeIsDraggable(ye)){var st=!r.dragData.didDrag;st&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||v(Ge,{inDragLayer:!0});var Je={x:0,y:0};if(ae(be[0])&&ae(be[1])&&(Je.x+=be[0],Je.y+=be[1],st)){var ot=r.hoverData.dragDelta;ot&&ae(ot[0])&&ae(ot[1])&&(Je.x+=ot[0],Je.y+=ot[1])}r.hoverData.draggingEles=!0,Ge.silentShift(Je).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else Bt();Q=!0}if(Ne[2]=j[0],Ne[3]=j[1],Q)return M.stopPropagation&&M.stopPropagation(),M.preventDefault&&M.preventDefault(),!1}},!1);var w,C,A;r.registerBinding(window,"mouseup",function(M){var Y=r.hoverData.capture;if(!!Y){r.hoverData.capture=!1;var Q=r.cy,W=r.projectIntoViewport(M.clientX,M.clientY),_=r.selection,pe=r.findNearestElement(W[0],W[1],!0,!1),j=r.dragData.possibleDragElements,oe=r.hoverData.down,we=a(M);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 Ne={originalEvent:M,type:"cxttapend",position:{x:W[0],y:W[1]}};if(oe?oe.emit(Ne):Q.emit(Ne),!r.hoverData.cxtDragged){var me={originalEvent:M,type:"cxttap",position:{x:W[0],y:W[1]}};oe?oe.emit(me):Q.emit(me)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(t(pe,["mouseup","tapend","vmouseup"],M,{x:W[0],y:W[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(t(oe,["click","tap","vclick"],M,{x:W[0],y:W[1]}),C=!1,M.timeStamp-A<=Q.multiClickDebounceTime()?(w&&clearTimeout(w),C=!0,A=null,t(oe,["dblclick","dbltap","vdblclick"],M,{x:W[0],y:W[1]})):(w=setTimeout(function(){C||t(oe,["oneclick","onetap","voneclick"],M,{x:W[0],y:W[1]})},Q.multiClickDebounceTime()),A=M.timeStamp)),oe==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!a(M)&&(Q.$(e).unselect(["tapunselect"]),j.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=j=Q.collection()),pe==oe&&!r.dragData.didDrag&&!r.hoverData.selecting&&pe!=null&&pe._private.selectable&&(r.hoverData.dragging||(Q.selectionType()==="additive"||we?pe.selected()?pe.unselect(["tapunselect"]):pe.select(["tapselect"]):we||(Q.$(e).unmerge(pe).unselect(["tapunselect"]),pe.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var Le=Q.collection(r.getAllInBox(_[0],_[1],_[2],_[3]));r.redrawHint("select",!0),Le.length>0&&r.redrawHint("eles",!0),Q.emit({type:"boxend",originalEvent:M,position:{x:W[0],y:W[1]}});var ye=function(Xe){return Xe.selectable()&&!Xe.selected()};Q.selectionType()==="additive"||we||Q.$(e).unmerge(Le).unselect(),Le.emit("box").stdFilter(ye).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!_[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var be=oe&&oe.grabbed();g(j),be&&(oe.emit("freeon"),j.emit("free"),r.dragData.didDrag&&(oe.emit("dragfreeon"),j.emit("dragfree")))}}_[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}},!1);var S=function(M){if(!r.scrollingPage){var Y=r.cy,Q=Y.zoom(),W=Y.pan(),_=r.projectIntoViewport(M.clientX,M.clientY),pe=[_[0]*Q+W.x,_[1]*Q+W.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||b()){M.preventDefault();return}if(Y.panningEnabled()&&Y.userPanningEnabled()&&Y.zoomingEnabled()&&Y.userZoomingEnabled()){M.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 j;M.deltaY!=null?j=M.deltaY/-250:M.wheelDeltaY!=null?j=M.wheelDeltaY/1e3:j=M.wheelDelta/1e3,j=j*r.wheelSensitivity;var oe=M.deltaMode===1;oe&&(j*=33);var we=Y.zoom()*Math.pow(10,j);M.type==="gesturechange"&&(we=r.gestureStartZoom*M.scale),Y.zoom({level:we,renderedPosition:{x:pe[0],y:pe[1]}}),Y.emit(M.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",S,!0),r.registerBinding(window,"scroll",function(M){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(M){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||M.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(J){r.hasTouchStarted||S(J)},!0),r.registerBinding(r.container,"mouseout",function(M){var Y=r.projectIntoViewport(M.clientX,M.clientY);r.cy.emit({originalEvent:M,type:"mouseout",position:{x:Y[0],y:Y[1]}})},!1),r.registerBinding(r.container,"mouseover",function(M){var Y=r.projectIntoViewport(M.clientX,M.clientY);r.cy.emit({originalEvent:M,type:"mouseover",position:{x:Y[0],y:Y[1]}})},!1);var O,N,P,I,k,R,B,z,F,V,U,$,X,H=function(M,Y,Q,W){return Math.sqrt((Q-M)*(Q-M)+(W-Y)*(W-Y))},G=function(M,Y,Q,W){return(Q-M)*(Q-M)+(W-Y)*(W-Y)},q;r.registerBinding(r.container,"touchstart",q=function(M){if(r.hasTouchStarted=!0,!!x(M)){p(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var Y=r.cy,Q=r.touchData.now,W=r.touchData.earlier;if(M.touches[0]){var _=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Q[0]=_[0],Q[1]=_[1]}if(M.touches[1]){var _=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Q[2]=_[0],Q[3]=_[1]}if(M.touches[2]){var _=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Q[4]=_[0],Q[5]=_[1]}if(M.touches[1]){r.touchData.singleTouchMoved=!0,g(r.dragData.touchDragEles);var pe=r.findContainerClientCoords();F=pe[0],V=pe[1],U=pe[2],$=pe[3],O=M.touches[0].clientX-F,N=M.touches[0].clientY-V,P=M.touches[1].clientX-F,I=M.touches[1].clientY-V,X=0<=O&&O<=U&&0<=P&&P<=U&&0<=N&&N<=$&&0<=I&&I<=$;var j=Y.pan(),oe=Y.zoom();k=H(O,N,P,I),R=G(O,N,P,I),B=[(O+P)/2,(N+I)/2],z=[(B[0]-j.x)/oe,(B[1]-j.y)/oe];var we=200,Ne=we*we;if(R=1){for(var yt=r.touchData.startPosition=[],qe=0;qe=r.touchTapThreshold2}if(Y&&r.touchData.cxt){M.preventDefault();var yt=M.touches[0].clientX-F,qe=M.touches[0].clientY-V,vt=M.touches[1].clientX-F,at=M.touches[1].clientY-V,Nt=G(yt,qe,vt,at),Bt=Nt/R,hr=150,Zt=hr*hr,vr=1.5,pa=vr*vr;if(Bt>=pa||Nt>=Zt){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Qt={originalEvent:M,type:"cxttapend",position:{x:_[0],y:_[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(Qt),r.touchData.start=null):W.emit(Qt)}}if(Y&&r.touchData.cxt){var Qt={originalEvent:M,type:"cxtdrag",position:{x:_[0],y:_[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Qt):W.emit(Qt),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var st=r.findNearestElement(_[0],_[1],!0,!0);(!r.touchData.cxtOver||st!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:_[0],y:_[1]}}),r.touchData.cxtOver=st,st&&st.emit({originalEvent:M,type:"cxtdragover",position:{x:_[0],y:_[1]}}))}else if(Y&&M.touches[2]&&W.boxSelectionEnabled())M.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||W.emit({originalEvent:M,type:"boxstart",position:{x:_[0],y:_[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,Q[4]=1,!Q||Q.length===0||Q[0]===void 0?(Q[0]=(_[0]+_[2]+_[4])/3,Q[1]=(_[1]+_[3]+_[5])/3,Q[2]=(_[0]+_[2]+_[4])/3+1,Q[3]=(_[1]+_[3]+_[5])/3+1):(Q[2]=(_[0]+_[2]+_[4])/3,Q[3]=(_[1]+_[3]+_[5])/3),r.redrawHint("select",!0),r.redraw();else if(Y&&M.touches[1]&&!r.touchData.didSelect&&W.zoomingEnabled()&&W.panningEnabled()&&W.userZoomingEnabled()&&W.userPanningEnabled()){M.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Je=r.dragData.touchDragEles;if(Je){r.redrawHint("drag",!0);for(var ot=0;ot0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var Z;r.registerBinding(window,"touchcancel",Z=function(M){var Y=r.touchData.start;r.touchData.capture=!1,Y&&Y.unactivate()});var te,he,de,ee;if(r.registerBinding(window,"touchend",te=function(M){var Y=r.touchData.start,Q=r.touchData.capture;if(Q)M.touches.length===0&&(r.touchData.capture=!1),M.preventDefault();else return;var W=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var _=r.cy,pe=_.zoom(),j=r.touchData.now,oe=r.touchData.earlier;if(M.touches[0]){var we=r.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);j[0]=we[0],j[1]=we[1]}if(M.touches[1]){var we=r.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);j[2]=we[0],j[3]=we[1]}if(M.touches[2]){var we=r.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);j[4]=we[0],j[5]=we[1]}Y&&Y.unactivate();var Ne;if(r.touchData.cxt){if(Ne={originalEvent:M,type:"cxttapend",position:{x:j[0],y:j[1]}},Y?Y.emit(Ne):_.emit(Ne),!r.touchData.cxtDragged){var me={originalEvent:M,type:"cxttap",position:{x:j[0],y:j[1]}};Y?Y.emit(me):_.emit(me)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!M.touches[2]&&_.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var Le=_.collection(r.getAllInBox(W[0],W[1],W[2],W[3]));W[0]=void 0,W[1]=void 0,W[2]=void 0,W[3]=void 0,W[4]=0,r.redrawHint("select",!0),_.emit({type:"boxend",originalEvent:M,position:{x:j[0],y:j[1]}});var ye=function(Zt){return Zt.selectable()&&!Zt.selected()};Le.emit("box").stdFilter(ye).select().emit("boxselect"),Le.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(Y!=null&&Y.unactivate(),M.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!M.touches[1]){if(!M.touches[0]){if(!M.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var be=r.dragData.touchDragEles;if(Y!=null){var Ge=Y._private.grabbed;g(be),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ge&&(Y.emit("freeon"),be.emit("free"),r.dragData.didDrag&&(Y.emit("dragfreeon"),be.emit("dragfree"))),t(Y,["touchend","tapend","vmouseup","tapdragout"],M,{x:j[0],y:j[1]}),Y.unactivate(),r.touchData.start=null}else{var Xe=r.findNearestElement(j[0],j[1],!0,!0);t(Xe,["touchend","tapend","vmouseup","tapdragout"],M,{x:j[0],y:j[1]})}var pt=r.touchData.startPosition[0]-j[0],yt=pt*pt,qe=r.touchData.startPosition[1]-j[1],vt=qe*qe,at=yt+vt,Nt=at*pe*pe;r.touchData.singleTouchMoved||(Y||_.$(":selected").unselect(["tapunselect"]),t(Y,["tap","vclick"],M,{x:j[0],y:j[1]}),he=!1,M.timeStamp-ee<=_.multiClickDebounceTime()?(de&&clearTimeout(de),he=!0,ee=null,t(Y,["dbltap","vdblclick"],M,{x:j[0],y:j[1]})):(de=setTimeout(function(){he||t(Y,["onetap","voneclick"],M,{x:j[0],y:j[1]})},_.multiClickDebounceTime()),ee=M.timeStamp)),Y!=null&&!r.dragData.didDrag&&Y._private.selectable&&Nt"u"){var re=[],fe=function(M){return{clientX:M.clientX,clientY:M.clientY,force:1,identifier:M.pointerId,pageX:M.pageX,pageY:M.pageY,radiusX:M.width/2,radiusY:M.height/2,screenX:M.screenX,screenY:M.screenY,target:M.target}},se=function(M){return{event:M,touch:fe(M)}},ne=function(M){re.push(se(M))},ue=function(M){for(var Y=0;Y0)return F[0]}return null},v=Object.keys(h),d=0;d0?c:Gs(i,s,e,t,a,n,o)},checkPoint:function(e,t,a,n,i,s,o){var u=fa(n,i),l=2*u;if(It(e,t,this.points,s,o,n,i-l,[0,-1],a)||It(e,t,this.points,s,o,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(ut(e,t,c)||er(e,t,l,l,s+n/2-u,o+i/2-u,a)||er(e,t,l,l,s-n/2+u,o+i/2-u,a))}}};kt.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",nt(3,0)),this.generateRoundPolygon("round-triangle",nt(3,0)),this.generatePolygon("rectangle",nt(4,0)),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",nt(5,0)),this.generateRoundPolygon("round-pentagon",nt(5,0)),this.generatePolygon("hexagon",nt(6,0)),this.generateRoundPolygon("round-hexagon",nt(6,0)),this.generatePolygon("heptagon",nt(7,0)),this.generateRoundPolygon("round-heptagon",nt(7,0)),this.generatePolygon("octagon",nt(8,0)),this.generateRoundPolygon("round-octagon",nt(8,0));var a=new Array(20);{var n=Dn(5,0),i=Dn(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*T)break}else if(l){if(E>=e.deqCost*v||E>=e.deqAvgCost*c)break}else if(m>=e.deqNoDrawCost*En)break;var D=e.deq(a,y,g);if(D.length>0)for(var L=0;L0&&(e.onDeqd(a,d),!l&&e.shouldRedraw(a,d,y,g)&&i())},o=e.priority||Yn;n.beforeRender(s,o(a))}}}},nc=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:za;Fn(this,r),this.idsByKey=new Ct,this.keyForId=new Ct,this.cachesByLvl=new Ct,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return Gn(r,[{key:"getIdsFor",value:function(t){t==null&&ze("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new Ar,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 Ct,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}(),is=25,Na=50,Ba=-4,In=3,ic=7.99,sc=8,oc=1024,uc=1024,lc=1024,fc=.2,hc=.8,vc=10,cc=.15,dc=.1,gc=.9,pc=.9,yc=100,mc=1,Er={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},bc=Ze({getKey:null,doesEleInvalidateKey:za,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Os,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Hr=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=bc(t);ce(a,n),a.lookup=new nc(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ue=Hr.prototype;Ue.reasons=Er;Ue.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ue.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ue.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new oa.default(function(t,a){return a.reqs-t.reqs});return e};Ue.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ue.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),u=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(Hn(o*t))),a=ic||a>In)return null;var l=Math.pow(2,a),f=e.h*l,h=e.w*l,c=s.eleTextBiggerThanMin(r,l);if(!this.isVisible(r,c))return null;var v=u.get(r,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=is?d=is:f<=Na?d=Na:d=Math.ceil(f/Na)*Na,f>lc||h>uc)return null;var g=i.getTextureQueue(d),y=g[g.length-2],p=function(){return i.recycleTexture(d,h)||i.addTexture(d,h)};y||(y=g[g.length-1]),y||(y=p()),y.width-y.usedWidtha;A--)w=i.getElement(r,e,t,A,Er.downscale);C()}else return i.queueElement(r,L.level-1),L;else{var S;if(!m&&!T&&!D)for(var O=a-1;O>=Ba;O--){var N=u.get(r,O);if(N){S=N;break}}if(E(S))return i.queueElement(r,a),S;y.context.translate(y.usedWidth,0),y.context.scale(l,l),this.drawElement(y.context,r,e,c,!1),y.context.scale(1/l,1/l),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:a,scale:l,width:h,height:f,scaledLabelShown:c},y.usedWidth+=Math.ceil(h+sc),y.eleCaches.push(v),u.set(r,a,v),i.checkTextureFullness(y),v};Ue.invalidateElements=function(r){for(var e=0;e=fc*r.width&&this.retireTexture(r)};Ue.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>hc&&r.fullnessChecks>=vc?Ht(t,r):r.fullnessChecks++};Ue.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;Ht(a,r),r.retired=!0;for(var i=r.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,Un(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),Ht(n,s),a.push(s),s}};Ue.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(r),s.reqs++,a.updateItem(s);else{var o={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(o),n[i]=o}};Ue.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s0;s++){var o=t.pop(),u=o.key,l=o.eles[0],f=i.hasCache(l,o.level);if(a[u]=null,f)continue;n.push(o);var h=e.getBoundingBox(l);e.getElement(l,h,r,o.level,Er.dequeue)}return n};Ue.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=$n,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ue.onDequeue=function(r){this.onDequeues.push(r)};Ue.offDequeue=function(r){Ht(this.onDequeues,r)};Ue.setupDequeueing=Io.setupDequeueing({deqRedrawThreshold:yc,deqCost:cc,deqAvgCost:dc,deqNoDrawCost:gc,deqFastCost:pc,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a=wc||t>Xa)return null}a.validateLayersElesOrdering(t,r);var u=a.layersByLevel,l=Math.pow(2,t),f=u[t]=u[t]||[],h,c=a.levelIsComplete(t,r),v,d=function(){var C=function(P){if(a.validateLayersElesOrdering(P,r),a.levelIsComplete(P,r))return v=u[P],!0},A=function(P){if(!v)for(var I=t+P;Wr<=I&&I<=Xa&&!C(I);I+=P);};A(1),A(-1);for(var S=f.length-1;S>=0;S--){var O=f[S];O.invalid&&Ht(f,O)}};if(!c)d();else return f;var g=function(){if(!h){h=lt();for(var C=0;CNc)return null;var O=a.makeLayer(h,t);if(A!=null){var N=f.indexOf(A)+1;f.splice(N,0,O)}else(C.insert===void 0||C.insert)&&f.unshift(O);return O};if(a.skipping&&!o)return null;for(var p=null,E=r.length/Ec,m=!o,T=0;T=E||!Fs(p.bb,D.boundingBox()))&&(p=y({insert:!0,after:p}),!p))return null;v||m?a.queueLayer(p,D):a.drawEleInLayer(p,D,t,e),p.eles.push(D),b[t]=p}return v||(m?null:f)};Qe.getEleLevelForLayerLevel=function(r,e){return r};Qe.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,s=r.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,t,Mc),i.setImgSmoothing(s,!0))};Qe.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||s.invalid)return!1;n+=s.eles.length}return n===e.length};Qe.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(!!t)for(var a=0;a0){e=!0;break}}return e};Qe.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=Ot(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};Qe.invalidateLayer=function(r){if(this.lastInvalidationTime=Ot(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];Ht(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,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;t&&(u=t,r.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=l*f,y=l*f,p=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;h==="straight-triangle"?(s.eleStrokeStyle(r,e,S),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=v,r.lineCap=d,s.eleStrokeStyle(r,e,S),s.drawEdgePath(e,r,o.allpts,c),r.lineCap="butt")},E=function(){!n||s.drawEdgeOverlay(r,e)},m=function(){!n||s.drawEdgeUnderlay(r,e)},T=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;s.drawArrowheads(r,e,S)},D=function(){s.drawElementText(r,e,null,a)};r.lineJoin="round";var L=e.pstyle("ghost").value==="yes";if(L){var b=e.pstyle("ghost-offset-x").pfValue,x=e.pstyle("ghost-offset-y").pfValue,w=e.pstyle("ghost-opacity").value,C=g*w;r.translate(b,x),p(C),T(C),r.translate(-b,-x)}m(),p(),T(),E(),D(),t&&r.translate(u.x1,u.y1)}};var Po=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,s=i.usePaths(),o=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;t.lineWidth=l,o.edgeType==="self"&&!s?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,f[0],f[1],f[2],n),i.drawEdgePath(a,t,o.allpts,"solid")}}}};Pt.drawEdgeOverlay=Po("overlay");Pt.drawEdgeUnderlay=Po("underlay");Pt.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,u=this.usePaths(),l=r.pstyle("line-dash-pattern").pfValue,f=r.pstyle("line-dash-offset").pfValue;if(u){var h=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!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 v=2;v+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(e);r.textAlign=u,r.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(l||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var v=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(s.drawText(r,e,null,v,i),e.isEdge()&&(s.drawText(r,e,"source",v,i),s.drawText(r,e,"target",v,i))):s.drawText(r,e,n,v,i),t&&r.translate(d.x1,d.y1)};lr.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,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*o,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,l[0],l[1],l[2],o),this.colorStrokeStyle(r,f[0],f[1],f[2],u)};function $c(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5;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(),r.fill()}lr.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation"),o=wt(n,"labelAngle",e);return s.strValue==="autorotate"?t=r.isEdge()?o:0:s.strValue==="none"?t=0:t=s.pfValue,t};lr.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,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var u=wt(s,"labelX",t),l=wt(s,"labelY",t),f,h,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(r,e,n);var v=t?t+"-":"",d=wt(s,"labelWidth",t),g=wt(s,"labelHeight",t),y=e.pstyle(v+"text-margin-x").pfValue,p=e.pstyle(v+"text-margin-y").pfValue,E=e.isEdge(),m=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;E&&(m="center",T="center"),u+=y,l+=p;var D;switch(a?D=this.getTextAngle(e,t):D=0,D!==0&&(f=u,h=l,r.translate(f,h),r.rotate(D),u=0,l=0),T){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g;break}var L=e.pstyle("text-background-opacity").value,b=e.pstyle("text-border-opacity").value,x=e.pstyle("text-border-width").pfValue,w=e.pstyle("text-background-padding").pfValue;if(L>0||x>0&&b>0){var C=u-w;switch(m){case"left":C-=d;break;case"center":C-=d/2;break}var A=l-g-w,S=d+2*w,O=g+2*w;if(L>0){var N=r.fillStyle,P=e.pstyle("text-background-color").value;r.fillStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+L*o+")";var I=e.pstyle("text-background-shape").strValue;I.indexOf("round")===0?$c(r,C,A,S,O,2):r.fillRect(C,A,S,O),r.fillStyle=N}if(x>0&&b>0){var k=r.strokeStyle,R=r.lineWidth,B=e.pstyle("text-border-color").value,z=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+b*o+")",r.lineWidth=x,r.setLineDash)switch(z){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=x/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(r.strokeRect(C,A,S,O),z==="double"){var F=x/2;r.strokeRect(C+F,A+F,S-F*2,O-F*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=R,r.strokeStyle=k}}var V=2*e.pstyle("text-outline-width").pfValue;if(V>0&&(r.lineWidth=V),e.pstyle("text-wrap").value==="wrap"){var U=wt(s,"labelWrapCachedLines",t),$=wt(s,"labelLineHeight",t),X=d/2,H=this.getLabelJustification(e);switch(H==="auto"||(m==="left"?H==="left"?u+=-d:H==="center"&&(u+=-X):m==="center"?H==="left"?u+=-X:H==="right"&&(u+=X):m==="right"&&(H==="center"?u+=X:H==="right"&&(u+=d))),T){case"top":l-=(U.length-1)*$;break;case"center":case"bottom":l-=(U.length-1)*$;break}for(var G=0;G0&&r.strokeText(U[G],u,l),r.fillText(U[G],u,l),l+=$}else V>0&&r.strokeText(c,u,l),r.fillText(c,u,l);D!==0&&(r.rotate(-D),r.translate(-f,-h))}}};var kr={};kr.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,s=this,o,u,l=e._private,f=l.rscratch,h=e.position();if(!(!ae(h.x)||!ae(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,v=s.usePaths(),d,g=!1,y=e.padding();o=e.width()+2*y,u=e.height()+2*y;var p;t&&(p=t,r.translate(-p.x1,-p.y1));for(var E=e.pstyle("background-image"),m=E.value,T=new Array(m.length),D=new Array(m.length),L=0,b=0;b0&&arguments[0]!==void 0?arguments[0]:O;s.eleFillStyle(r,e,ne)},R=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:I;s.colorStrokeStyle(r,N[0],N[1],N[2],ne)},B=e.pstyle("shape").strValue,z=e.pstyle("shape-polygon-points").pfValue;if(v){r.translate(h.x,h.y);var F=s.nodePathCache=s.nodePathCache||[],V=Ms(B==="polygon"?B+","+z.join(","):B,""+u,""+o),U=F[V];U!=null?(d=U,g=!0,f.pathCache=d):(d=new Path2D,F[V]=f.pathCache=d)}var $=function(){if(!g){var ne=h;v&&(ne={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||r,ne.x,ne.y,o,u)}v?r.fill(d):r.fill()},X=function(){for(var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,Ee=l.backgrounding,ge=0,ve=0;ve0&&arguments[0]!==void 0?arguments[0]:!1,ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(r,e,ue),ne&&(v||s.nodeShapes[s.getNodeShape(e)].draw(r,h.x,h.y,o,u)))},G=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,ue=(A>0?A:-A)*ne,Ee=A>0?0:255;A!==0&&(s.colorFillStyle(r,Ee,Ee,Ee,ue),v?r.fill(d):r.fill())},q=function(){if(S>0){if(r.lineWidth=S,r.lineCap="butt",r.setLineDash)switch(P){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}if(v?r.stroke(d):r.stroke(),P==="double"){r.lineWidth=S/3;var ne=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",v?r.stroke(d):r.stroke(),r.globalCompositeOperation=ne}r.setLineDash&&r.setLineDash([])}},K=function(){n&&s.drawNodeOverlay(r,e,h,o,u)},Z=function(){n&&s.drawNodeUnderlay(r,e,h,o,u)},te=function(){s.drawElementText(r,e,null,a)},he=e.pstyle("ghost").value==="yes";if(he){var de=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue,re=e.pstyle("ghost-opacity").value,fe=re*c;r.translate(de,ee),k(re*O),$(),X(fe,!0),R(re*I),q(),H(A!==0||S!==0),X(fe,!1),G(fe),r.translate(-de,-ee)}v&&r.translate(-h.x,-h.y),Z(),v&&r.translate(h.x,h.y),k(),$(),X(c,!0),R(),q(),H(A!==0||S!==0),X(c,!1),G(),v&&r.translate(-h.x,-h.y),te(),K(),t&&r.translate(p.x1,p.y1)}};var Bo=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,s){var o=this;if(!!a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value;if(l>0){if(n=n||a.position(),i==null||s==null){var c=a.padding();i=a.width()+2*c,s=a.height()+2*c}o.colorFillStyle(t,f[0],f[1],f[2],l),o.nodeShapes[h].draw(t,n.x,n.y,i+u*2,s+u*2),t.fill()}}}};kr.drawNodeOverlay=Bo("overlay");kr.drawNodeUnderlay=Bo("underlay");kr.hasPie=function(r){return r=r[0],r._private.hasPie};kr.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,u=e.width(),l=e.height(),f=Math.min(u,l)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*t,p=d/100;p+h>1&&(p=1-h);var E=1.5*Math.PI+2*Math.PI*h,m=2*Math.PI*p,T=E+m;d===0||h>=1||h+p>1||(r.beginPath(),r.moveTo(s,o),r.arc(s,o,f,E,T),r.closePath(),this.colorFillStyle(r,g[0],g[1],g[2],y),r.fill(),h+=p)}};var ht={},Yc=100;ht.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e};ht.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;ns.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var E=u.style(),m=u.zoom(),T=n!==void 0?n:m,D=u.pan(),L={x:D.x,y:D.y},b={zoom:m,pan:{x:D.x,y:D.y}},x=s.prevViewport,w=x===void 0||b.zoom!==x.zoom||b.pan.x!==x.pan.x||b.pan.y!==x.pan.y;!w&&!(g&&!d)&&(s.motionBlurPxRatio=1),i&&(L=i),T*=o,L.x*=o,L.y*=o;var C=s.getCachedZSortedEles();function A(ee,re,fe,se,ne){var ue=ee.globalCompositeOperation;ee.globalCompositeOperation="destination-out",s.colorFillStyle(ee,255,255,255,s.motionBlurTransparency),ee.fillRect(re,fe,se,ne),ee.globalCompositeOperation=ue}function S(ee,re){var fe,se,ne,ue;!s.clearingMotionBlur&&(ee===l.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||ee===l.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(fe={x:D.x*v,y:D.y*v},se=m*v,ne=s.canvasWidth*v,ue=s.canvasHeight*v):(fe=L,se=T,ne=s.canvasWidth,ue=s.canvasHeight),ee.setTransform(1,0,0,1,0,0),re==="motionBlur"?A(ee,0,0,ne,ue):!e&&(re===void 0||re)&&ee.clearRect(0,0,ne,ue),t||(ee.translate(fe.x,fe.y),ee.scale(se,se)),i&&ee.translate(i.x,i.y),n&&ee.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var O=s.data.bufferContexts[s.TEXTURE_BUFFER];O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:O,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var b=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};b.mpan={x:(0-b.pan.x)/b.zoom,y:(0-b.pan.y)/b.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var N=l.contexts[s.NODE],P=s.textureCache.texture,b=s.textureCache.viewport;N.setTransform(1,0,0,1,0,0),c?A(N,0,0,b.width,b.height):N.clearRect(0,0,b.width,b.height);var I=E.core("outside-texture-bg-color").value,k=E.core("outside-texture-bg-opacity").value;s.colorFillStyle(N,I[0],I[1],I[2],k),N.fillRect(0,0,b.width,b.height);var m=u.zoom();S(N,!1),N.clearRect(b.mpan.x,b.mpan.y,b.width/b.zoom/o,b.height/b.zoom/o),N.drawImage(P,b.mpan.x,b.mpan.y,b.width/b.zoom/o,b.height/b.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var R=u.extent(),B=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),z=s.hideEdgesOnViewport&&B,F=[];if(F[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,F[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),F[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,F[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||t||a||F[s.NODE]){var V=c&&!F[s.NODE]&&v!==1,N=e||(V?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:l.contexts[s.NODE]),U=c&&!V?"motionBlur":void 0;S(N,U),z?s.drawCachedNodes(N,C.nondrag,o,R):s.drawLayeredElements(N,C.nondrag,o,R),s.debug&&s.drawDebugPoints(N,C.nondrag),!t&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||t||F[s.DRAG])){var V=c&&!F[s.DRAG]&&v!==1,N=e||(V?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:l.contexts[s.DRAG]);S(N,c&&!V?"motionBlur":void 0),z?s.drawCachedNodes(N,C.drag,o,R):s.drawCachedElements(N,C.drag,o,R),s.debug&&s.drawDebugPoints(N,C.drag),!t&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!t){var N=e||l.contexts[s.SELECT_BOX];if(S(N),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var m=s.cy.zoom(),$=E.core("selection-box-border-width").value/m;N.lineWidth=$,N.fillStyle="rgba("+E.core("selection-box-color").value[0]+","+E.core("selection-box-color").value[1]+","+E.core("selection-box-color").value[2]+","+E.core("selection-box-opacity").value+")",N.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),$>0&&(N.strokeStyle="rgba("+E.core("selection-box-border-color").value[0]+","+E.core("selection-box-border-color").value[1]+","+E.core("selection-box-border-color").value[2]+","+E.core("selection-box-opacity").value+")",N.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(l.bgActivePosistion&&!s.hoverData.selecting){var m=s.cy.zoom(),X=l.bgActivePosistion;N.fillStyle="rgba("+E.core("active-bg-color").value[0]+","+E.core("active-bg-color").value[1]+","+E.core("active-bg-color").value[2]+","+E.core("active-bg-opacity").value+")",N.beginPath(),N.arc(X.x,X.y,E.core("active-bg-size").pfValue/m,0,2*Math.PI),N.fill()}var H=s.lastRedrawTime;if(s.showFps&&H){H=Math.round(H);var G=Math.round(1e3/H);N.setTransform(1,0,0,1,0,0),N.fillStyle="rgba(255, 0, 0, 0.75)",N.strokeStyle="rgba(255, 0, 0, 0.75)",N.lineWidth=1,N.fillText("1 frame = "+H+" ms = "+G+" fps",0,20);var q=60;N.strokeRect(0,30,250,20),N.fillRect(0,30,250*Math.min(G/q,1),20)}t||(f[s.SELECT_BOX]=!1)}if(c&&v!==1){var K=l.contexts[s.NODE],Z=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],te=l.contexts[s.DRAG],he=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],de=function(re,fe,se){re.setTransform(1,0,0,1,0,0),se||!p?re.clearRect(0,0,s.canvasWidth,s.canvasHeight):A(re,0,0,s.canvasWidth,s.canvasHeight);var ne=v;re.drawImage(fe,0,0,s.canvasWidth*ne,s.canvasHeight*ne,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||F[s.NODE])&&(de(K,Z,F[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||F[s.DRAG])&&(de(te,he,F[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=b,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},Yc)),e||u.emit("render")};var Kt={};Kt.drawPolygonPath=function(r,e,t,a,n,i){var s=a/2,o=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+s*i[0],t+o*i[1]);for(var u=1;u0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)v.translate(-a.x1*l,-a.y1*l),v.scale(l,l),this.drawElements(v,d),v.scale(1/l,1/l),v.translate(a.x1*l,a.y1*l);else{var g=e.pan(),y={x:g.x*l,y:g.y*l};l*=e.zoom(),v.translate(y.x,y.y),v.scale(l,l),this.drawElements(v,d),v.scale(1/l,1/l),v.translate(-y.x,-y.y)}r.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=r.bg,v.rect(0,0,i,s),v.fill())}return c};function Uc(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":Ye(OffscreenCanvas))!=="undefined"?t=new OffscreenCanvas(r,e):(t=document.createElement("canvas"),t.width=r,t.height=e),t};[ko,At,Pt,ri,lr,kr,ht,Kt,ga,zo].forEach(function(r){ce(De,r)});var qc=[{name:"null",impl:Do},{name:"base",impl:Oo},{name:"canvas",impl:Hc}],Wc=[{type:"layout",extensions:ec},{type:"renderer",extensions:qc}],$o={},Yo={};function Uo(r,e,t){var a=t,n=function(x){Ae("Can not register `"+e+"` for `"+r+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(na.prototype[e])return n(e);na.prototype[e]=t}else if(r==="collection"){if(Ke.prototype[e])return n(e);Ke.prototype[e]=t}else if(r==="layout"){for(var i=function(x){this.options=x,t.call(this,x),Te(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(t.prototype),o=[],u=0;ud&&(this.rect.x-=(this.labelWidth-d)/2,this.setWidth(this.labelWidth)),this.labelHeight>g&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-g)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-g),this.setHeight(this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==s.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(v){var d=this.rect.x;d>u.WORLD_BOUNDARY?d=u.WORLD_BOUNDARY:d<-u.WORLD_BOUNDARY&&(d=-u.WORLD_BOUNDARY);var g=this.rect.y;g>u.WORLD_BOUNDARY?g=u.WORLD_BOUNDARY:g<-u.WORLD_BOUNDARY&&(g=-u.WORLD_BOUNDARY);var y=new f(d,g),p=v.inverseTransformPoint(y);this.setLocation(p.x,p.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=h},function(t,a,n){function i(s,o){s==null&&o==null?(this.x=0,this.y=0):(this.x=s,this.y=o)}i.prototype.getX=function(){return this.x},i.prototype.getY=function(){return this.y},i.prototype.setX=function(s){this.x=s},i.prototype.setY=function(s){this.y=s},i.prototype.getDifference=function(s){return new DimensionD(this.x-s.x,this.y-s.y)},i.prototype.getCopy=function(){return new i(this.x,this.y)},i.prototype.translate=function(s){return this.x+=s.width,this.y+=s.height,this},t.exports=i},function(t,a,n){var i=n(2),s=n(10),o=n(0),u=n(6),l=n(3),f=n(1),h=n(13),c=n(12),v=n(11);function d(y,p,E){i.call(this,E),this.estimatedSize=s.MIN_VALUE,this.margin=o.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=y,p!=null&&p instanceof u?this.graphManager=p:p!=null&&p instanceof Layout&&(this.graphManager=p.graphManager)}d.prototype=Object.create(i.prototype);for(var g in i)d[g]=i[g];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(y,p,E){if(p==null&&E==null){var m=y;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var T=y;if(!(this.getNodes().indexOf(p)>-1&&this.getNodes().indexOf(E)>-1))throw"Source or target not in graph!";if(!(p.owner==E.owner&&p.owner==this))throw"Both owners must be this graph!";return p.owner!=E.owner?null:(T.source=p,T.target=E,T.isInterGraph=!1,this.getEdges().push(T),p.edges.push(T),E!=p&&E.edges.push(T),T)}},d.prototype.remove=function(y){var p=y;if(y instanceof l){if(p==null)throw"Node is null!";if(!(p.owner!=null&&p.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var E=p.edges.slice(),m,T=E.length,D=0;D-1&&x>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(b,1),m.target!=m.source&&m.target.edges.splice(x,1);var L=m.source.owner.getEdges().indexOf(m);if(L==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(L,1)}},d.prototype.updateLeftTop=function(){for(var y=s.MAX_VALUE,p=s.MAX_VALUE,E,m,T,D=this.getNodes(),L=D.length,b=0;bE&&(y=E),p>m&&(p=m)}return y==s.MAX_VALUE?null:(D[0].getParent().paddingLeft!=null?T=D[0].getParent().paddingLeft:T=this.margin,this.left=p-T,this.top=y-T,new c(this.left,this.top))},d.prototype.updateBounds=function(y){for(var p=s.MAX_VALUE,E=-s.MAX_VALUE,m=s.MAX_VALUE,T=-s.MAX_VALUE,D,L,b,x,w,C=this.nodes,A=C.length,S=0;SD&&(p=D),Eb&&(m=b),TD&&(p=D),Eb&&(m=b),T=this.nodes.length){var A=0;E.forEach(function(S){S.owner==y&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},t.exports=d},function(t,a,n){var i,s=n(1);function o(u){i=n(5),this.layout=u,this.graphs=[],this.edges=[]}o.prototype.addRoot=function(){var u=this.layout.newGraph(),l=this.layout.newNode(null),f=this.add(u,l);return this.setRootGraph(f),this.rootGraph},o.prototype.add=function(u,l,f,h,c){if(f==null&&h==null&&c==null){if(u==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(u)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(u),u.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return u.parent=l,l.child=u,u}else{c=f,h=l,f=u;var v=h.getOwner(),d=c.getOwner();if(!(v!=null&&v.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(d!=null&&d.getGraphManager()==this))throw"Target not in this graph mgr!";if(v==d)return f.isInterGraph=!1,v.add(f,h,c);if(f.isInterGraph=!0,f.source=h,f.target=c,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},o.prototype.remove=function(u){if(u instanceof i){var l=u;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(l.getEdges());for(var h,c=f.length,v=0;v=u.getRight()?l[0]+=Math.min(u.getX()-o.getX(),o.getRight()-u.getRight()):u.getX()<=o.getX()&&u.getRight()>=o.getRight()&&(l[0]+=Math.min(o.getX()-u.getX(),u.getRight()-o.getRight())),o.getY()<=u.getY()&&o.getBottom()>=u.getBottom()?l[1]+=Math.min(u.getY()-o.getY(),o.getBottom()-u.getBottom()):u.getY()<=o.getY()&&u.getBottom()>=o.getBottom()&&(l[1]+=Math.min(o.getY()-u.getY(),u.getBottom()-o.getBottom()));var c=Math.abs((u.getCenterY()-o.getCenterY())/(u.getCenterX()-o.getCenterX()));u.getCenterY()===o.getCenterY()&&u.getCenterX()===o.getCenterX()&&(c=1);var v=c*l[0],d=l[1]/c;l[0]v)return l[0]=f,l[1]=g,l[2]=c,l[3]=C,!1;if(hc)return l[0]=d,l[1]=h,l[2]=x,l[3]=v,!1;if(fc?(l[0]=p,l[1]=E,N=!0):(l[0]=y,l[1]=g,N=!0):I===R&&(f>c?(l[0]=d,l[1]=g,N=!0):(l[0]=m,l[1]=E,N=!0)),-k===R?c>f?(l[2]=w,l[3]=C,P=!0):(l[2]=x,l[3]=b,P=!0):k===R&&(c>f?(l[2]=L,l[3]=b,P=!0):(l[2]=A,l[3]=C,P=!0)),N&&P)return!1;if(f>c?h>v?(B=this.getCardinalDirection(I,R,4),z=this.getCardinalDirection(k,R,2)):(B=this.getCardinalDirection(-I,R,3),z=this.getCardinalDirection(-k,R,1)):h>v?(B=this.getCardinalDirection(-I,R,1),z=this.getCardinalDirection(-k,R,3)):(B=this.getCardinalDirection(I,R,2),z=this.getCardinalDirection(k,R,4)),!N)switch(B){case 1:V=g,F=f+-D/R,l[0]=F,l[1]=V;break;case 2:F=m,V=h+T*R,l[0]=F,l[1]=V;break;case 3:V=E,F=f+D/R,l[0]=F,l[1]=V;break;case 4:F=p,V=h+-T*R,l[0]=F,l[1]=V;break}if(!P)switch(z){case 1:$=b,U=c+-O/R,l[2]=U,l[3]=$;break;case 2:U=A,$=v+S*R,l[2]=U,l[3]=$;break;case 3:$=C,U=c+O/R,l[2]=U,l[3]=$;break;case 4:U=w,$=v+-S*R,l[2]=U,l[3]=$;break}}return!1},s.getCardinalDirection=function(o,u,l){return o>u?l:1+l%4},s.getIntersection=function(o,u,l,f){if(f==null)return this.getIntersection2(o,u,l);var h=o.x,c=o.y,v=u.x,d=u.y,g=l.x,y=l.y,p=f.x,E=f.y,m=void 0,T=void 0,D=void 0,L=void 0,b=void 0,x=void 0,w=void 0,C=void 0,A=void 0;return D=d-c,b=h-v,w=v*c-h*d,L=E-y,x=g-p,C=p*y-g*E,A=D*x-L*b,A===0?null:(m=(b*C-x*w)/A,T=(L*w-D*C)/A,new i(m,T))},s.angleOfVector=function(o,u,l,f){var h=void 0;return o!==l?(h=Math.atan((f-u)/(l-o)),l0?1:s<0?-1:0},i.floor=function(s){return s<0?Math.ceil(s):Math.floor(s)},i.ceil=function(s){return s<0?Math.floor(s):Math.ceil(s)},t.exports=i},function(t,a,n){function i(){}i.MAX_VALUE=2147483647,i.MIN_VALUE=-2147483648,t.exports=i},function(t,a,n){var i=function(){function h(c,v){for(var d=0;d"u"?"undefined":i(o);return o==null||u!="object"&&u!="function"},t.exports=s},function(t,a,n){function i(g){if(Array.isArray(g)){for(var y=0,p=Array(g.length);y0&&y;){for(D.push(b[0]);D.length>0&&y;){var x=D[0];D.splice(0,1),T.add(x);for(var w=x.getEdges(),m=0;m-1&&b.splice(O,1)}T=new Set,L=new Map}}return g},d.prototype.createDummyNodesForBendpoints=function(g){for(var y=[],p=g.source,E=this.graphManager.calcLowestCommonAncestor(g.source,g.target),m=0;m0){for(var E=this.edgeToDummyNodes.get(p),m=0;m=0&&y.splice(C,1);var A=L.getNeighborsList();A.forEach(function(N){if(p.indexOf(N)<0){var P=E.get(N),I=P-1;I==1&&x.push(N),E.set(N,I)}})}p=p.concat(x),(y.length==1||y.length==2)&&(m=!0,T=y[0])}return T},d.prototype.setGraphManager=function(g){this.graphManager=g},t.exports=d},function(t,a,n){function i(){}i.seed=1,i.x=0,i.nextDouble=function(){return i.x=Math.sin(i.seed++)*1e4,i.x-Math.floor(i.x)},t.exports=i},function(t,a,n){var i=n(4);function s(o,u){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}s.prototype.getWorldOrgX=function(){return this.lworldOrgX},s.prototype.setWorldOrgX=function(o){this.lworldOrgX=o},s.prototype.getWorldOrgY=function(){return this.lworldOrgY},s.prototype.setWorldOrgY=function(o){this.lworldOrgY=o},s.prototype.getWorldExtX=function(){return this.lworldExtX},s.prototype.setWorldExtX=function(o){this.lworldExtX=o},s.prototype.getWorldExtY=function(){return this.lworldExtY},s.prototype.setWorldExtY=function(o){this.lworldExtY=o},s.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},s.prototype.setDeviceOrgX=function(o){this.ldeviceOrgX=o},s.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},s.prototype.setDeviceOrgY=function(o){this.ldeviceOrgY=o},s.prototype.getDeviceExtX=function(){return this.ldeviceExtX},s.prototype.setDeviceExtX=function(o){this.ldeviceExtX=o},s.prototype.getDeviceExtY=function(){return this.ldeviceExtY},s.prototype.setDeviceExtY=function(o){this.ldeviceExtY=o},s.prototype.transformX=function(o){var u=0,l=this.lworldExtX;return l!=0&&(u=this.ldeviceOrgX+(o-this.lworldOrgX)*this.ldeviceExtX/l),u},s.prototype.transformY=function(o){var u=0,l=this.lworldExtY;return l!=0&&(u=this.ldeviceOrgY+(o-this.lworldOrgY)*this.ldeviceExtY/l),u},s.prototype.inverseTransformX=function(o){var u=0,l=this.ldeviceExtX;return l!=0&&(u=this.lworldOrgX+(o-this.ldeviceOrgX)*this.lworldExtX/l),u},s.prototype.inverseTransformY=function(o){var u=0,l=this.ldeviceExtY;return l!=0&&(u=this.lworldOrgY+(o-this.ldeviceOrgY)*this.lworldExtY/l),u},s.prototype.inverseTransformPoint=function(o){var u=new i(this.inverseTransformX(o.x),this.inverseTransformY(o.y));return u},t.exports=s},function(t,a,n){function i(v){if(Array.isArray(v)){for(var d=0,g=Array(v.length);do.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*o.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(v-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-o.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT_INCREMENTAL):(v>o.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(o.COOLING_ADAPTATION_FACTOR,1-(v-o.ADAPTATION_LOWER_NODE_LIMIT)/(o.ADAPTATION_UPPER_NODE_LIMIT-o.ADAPTATION_LOWER_NODE_LIMIT)*(1-o.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=o.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var v=this.getAllEdges(),d,g=0;g0&&arguments[0]!==void 0?arguments[0]:!0,d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,g,y,p,E,m=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%o.GRID_CALCULATION_CHECK_PERIOD==1&&v&&this.updateGrid(),T=new Set,g=0;gD||T>D)&&(v.gravitationForceX=-this.gravityConstant*p,v.gravitationForceY=-this.gravityConstant*E)):(D=d.getEstimatedSize()*this.compoundGravityRangeFactor,(m>D||T>D)&&(v.gravitationForceX=-this.gravityConstant*p*this.compoundGravityConstant,v.gravitationForceY=-this.gravityConstant*E*this.compoundGravityConstant))},h.prototype.isConverged=function(){var v,d=!1;return this.totalIterations>this.maxIterations/3&&(d=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),v=this.totalDisplacement=m.length||D>=m[0].length)){for(var L=0;Lh}}]),l}();t.exports=u},function(t,a,n){var i=function(){function u(l,f){for(var h=0;h2&&arguments[2]!==void 0?arguments[2]:1,c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,v=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;s(this,u),this.sequence1=l,this.sequence2=f,this.match_score=h,this.mismatch_penalty=c,this.gap_penalty=v,this.iMax=l.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var d=0;d=0;l--){var f=this.listeners[l];f.event===o&&f.callback===u&&this.listeners.splice(l,1)}},s.emit=function(o,u){for(var l=0;lf.coolingFactor*f.maxNodeDisplacement&&(this.displacementX=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementX)),Math.abs(this.displacementY)>f.coolingFactor*f.maxNodeDisplacement&&(this.displacementY=f.coolingFactor*f.maxNodeDisplacement*o.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),f.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},u.prototype.propogateDisplacementToChildren=function(f,h){for(var c=this.getChild().getNodes(),v,d=0;d0)this.positionNodesRadially(b);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),w=this.nodesWithGravity.filter(function(C){return x.has(C)});this.graphManager.setAllNodesToApplyGravitation(w),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},D.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%c.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var b=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(A){return b.has(A)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var w=!this.isTreeGrowing&&!this.isGrowthFinished,C=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(w,C),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},D.prototype.getPositionsData=function(){for(var b=this.graphManager.getAllNodes(),x={},w=0;w1){var N;for(N=0;NC&&(C=Math.floor(O.y)),S=Math.floor(O.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new g(v.WORLD_CENTER_X-O.x/2,v.WORLD_CENTER_Y-O.y/2))},D.radialLayout=function(b,x,w){var C=Math.max(this.maxDiagonalInTree(b),h.DEFAULT_RADIAL_SEPARATION);D.branchRadialLayout(x,null,0,359,0,C);var A=m.calculateBounds(b),S=new T;S.setDeviceOrgX(A.getMinX()),S.setDeviceOrgY(A.getMinY()),S.setWorldOrgX(w.x),S.setWorldOrgY(w.y);for(var O=0;O1;){var $=U[0];U.splice(0,1);var X=R.indexOf($);X>=0&&R.splice(X,1),F--,B--}x!=null?V=(R.indexOf(U[0])+1)%F:V=0;for(var H=Math.abs(C-w)/B,G=V;z!=B;G=++G%F){var q=R[G].getOtherEnd(b);if(q!=x){var K=(w+z*H)%360,Z=(K+H)%360;D.branchRadialLayout(q,b,K,Z,A+S,S),z++}}},D.maxDiagonalInTree=function(b){for(var x=p.MIN_VALUE,w=0;wx&&(x=A)}return x},D.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},D.prototype.groupZeroDegreeMembers=function(){var b=this,x={};this.memberGroups={},this.idToDummyNode={};for(var w=[],C=this.graphManager.getAllNodes(),A=0;A"u"&&(x[N]=[]),x[N]=x[N].concat(S)}Object.keys(x).forEach(function(P){if(x[P].length>1){var I="DummyCompound_"+P;b.memberGroups[I]=x[P];var k=x[P][0].getParent(),R=new l(b.graphManager);R.id=I,R.paddingLeft=k.paddingLeft||0,R.paddingRight=k.paddingRight||0,R.paddingBottom=k.paddingBottom||0,R.paddingTop=k.paddingTop||0,b.idToDummyNode[I]=R;var B=b.getGraphManager().add(b.newGraph(),R),z=k.getChild();z.add(R);for(var F=0;F=0;b--){var x=this.compoundOrder[b],w=x.id,C=x.paddingLeft,A=x.paddingTop;this.adjustLocations(this.tiledMemberPack[w],x.rect.x,x.rect.y,C,A)}},D.prototype.repopulateZeroDegreeMembers=function(){var b=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(w){var C=b.idToDummyNode[w],A=C.paddingLeft,S=C.paddingTop;b.adjustLocations(x[w],C.rect.x,C.rect.y,A,S)})},D.prototype.getToBeTiled=function(b){var x=b.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var w=b.getChild();if(w==null)return this.toBeTiled[x]=!1,!1;for(var C=w.getNodes(),A=0;A0)return this.toBeTiled[x]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},D.prototype.getNodeDegree=function(b){b.id;for(var x=b.getEdges(),w=0,C=0;CP&&(P=k.rect.height)}w+=P+b.verticalPadding}},D.prototype.tileCompoundMembers=function(b,x){var w=this;this.tiledMemberPack=[],Object.keys(b).forEach(function(C){var A=x[C];w.tiledMemberPack[C]=w.tileNodes(b[C],A.paddingLeft+A.paddingRight),A.rect.width=w.tiledMemberPack[C].width,A.rect.height=w.tiledMemberPack[C].height})},D.prototype.tileNodes=function(b,x){var w=h.TILING_PADDING_VERTICAL,C=h.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:w,horizontalPadding:C};b.sort(function(N,P){return N.rect.width*N.rect.height>P.rect.width*P.rect.height?-1:N.rect.width*N.rect.height0&&(O+=b.horizontalPadding),b.rowWidth[w]=O,b.width0&&(N+=b.verticalPadding);var P=0;N>b.rowHeight[w]&&(P=b.rowHeight[w],b.rowHeight[w]=N,P=b.rowHeight[w]-P),b.height+=P,b.rows[w].push(x)},D.prototype.getShortestRowIndex=function(b){for(var x=-1,w=Number.MAX_VALUE,C=0;Cw&&(x=C,w=b.rowWidth[C]);return x},D.prototype.canAddHorizontal=function(b,x,w){var C=this.getShortestRowIndex(b);if(C<0)return!0;var A=b.rowWidth[C];if(A+b.horizontalPadding+x<=b.width)return!0;var S=0;b.rowHeight[C]0&&(S=w+b.verticalPadding-b.rowHeight[C]);var O;b.width-A>=x+b.horizontalPadding?O=(b.height+S)/(A+x+b.horizontalPadding):O=(b.height+S)/b.width,S=w+b.verticalPadding;var N;return b.widthS&&x!=w){C.splice(-1,1),b.rows[w].push(A),b.rowWidth[x]=b.rowWidth[x]-S,b.rowWidth[w]=b.rowWidth[w]+S,b.width=b.rowWidth[instance.getLongestRowIndex(b)];for(var O=Number.MIN_VALUE,N=0;NO&&(O=C[N].height);x>0&&(O+=b.verticalPadding);var P=b.rowHeight[x]+b.rowHeight[w];b.rowHeight[x]=O,b.rowHeight[w]0)for(var z=A;z<=S;z++)B[0]+=this.grid[z][O-1].length+this.grid[z][O].length-1;if(S0)for(var z=O;z<=N;z++)B[3]+=this.grid[A-1][z].length+this.grid[A][z].length-1;for(var F=p.MAX_VALUE,V,U,$=0;$0){var N;N=T.getGraphManager().add(T.newGraph(),w),this.processChildrenList(N,x,T)}}},g.prototype.stop=function(){return this.stopped=!0,this};var p=function(m){m("layout","cose-bilkent",g)};typeof cytoscape<"u"&&p(cytoscape),a.exports=p}])})})(Wo);const jc=xu(Wo.exports);var Bn=function(){var r=function(T,D,L,b){for(L=L||{},b=T.length;b--;L[T[b]]=D);return L},e=[1,4],t=[1,13],a=[1,12],n=[1,15],i=[1,16],s=[1,20],o=[1,19],u=[6,7,8],l=[1,26],f=[1,24],h=[1,25],c=[6,7,11],v=[1,6,13,15,16,19,22],d=[1,33],g=[1,34],y=[1,6,7,11,13,15,16,19,22],p={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(D,L,b,x,w,C,A){var S=C.length-1;switch(w){case 6:case 7:return x;case 8:x.getLogger().trace("Stop NL ");break;case 9:x.getLogger().trace("Stop EOF ");break;case 11:x.getLogger().trace("Stop NL2 ");break;case 12:x.getLogger().trace("Stop EOF2 ");break;case 15:x.getLogger().info("Node: ",C[S].id),x.addNode(C[S-1].length,C[S].id,C[S].descr,C[S].type);break;case 16:x.getLogger().trace("Icon: ",C[S]),x.decorateNode({icon:C[S]});break;case 17:case 21:x.decorateNode({class:C[S]});break;case 18:x.getLogger().trace("SPACELIST");break;case 19:x.getLogger().trace("Node: ",C[S].id),x.addNode(0,C[S].id,C[S].descr,C[S].type);break;case 20:x.decorateNode({icon:C[S]});break;case 25:x.getLogger().trace("node found ..",C[S-2]),this.$={id:C[S-1],descr:C[S-1],type:x.getType(C[S-2],C[S])};break;case 26:this.$={id:C[S],descr:C[S],type:x.nodeType.DEFAULT};break;case 27:x.getLogger().trace("node found ..",C[S-3]),this.$={id:C[S-3],descr:C[S-1],type:x.getType(C[S-2],C[S])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:t,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},r(u,[2,3]),{1:[2,2]},r(u,[2,4]),r(u,[2,5]),{1:[2,6],6:t,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:t,9:22,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:l,7:f,10:23,11:h},r(c,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),r(c,[2,18]),r(c,[2,19]),r(c,[2,20]),r(c,[2,21]),r(c,[2,23]),r(c,[2,24]),r(c,[2,26],{19:[1,30]}),{20:[1,31]},{6:l,7:f,10:32,11:h},{1:[2,7],6:t,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},r(v,[2,14],{7:d,11:g}),r(y,[2,8]),r(y,[2,9]),r(y,[2,10]),r(c,[2,15]),r(c,[2,16]),r(c,[2,17]),{20:[1,35]},{21:[1,36]},r(v,[2,13],{7:d,11:g}),r(y,[2,11]),r(y,[2,12]),{21:[1,37]},r(c,[2,25]),r(c,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(D,L){if(L.recoverable)this.trace(D);else{var b=new Error(D);throw b.hash=L,b}},parse:function(D){var L=this,b=[0],x=[],w=[null],C=[],A=this.table,S="",O=0,N=0,P=2,I=1,k=C.slice.call(arguments,1),R=Object.create(this.lexer),B={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(B.yy[z]=this.yy[z]);R.setInput(D,B.yy),B.yy.lexer=R,B.yy.parser=this,typeof R.yylloc>"u"&&(R.yylloc={});var F=R.yylloc;C.push(F);var V=R.options&&R.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(){var ee;return ee=x.pop()||R.lex()||I,typeof ee!="number"&&(ee instanceof Array&&(x=ee,ee=x.pop()),ee=L.symbols_[ee]||ee),ee}for(var $,X,H,G,q={},K,Z,te,he;;){if(X=b[b.length-1],this.defaultActions[X]?H=this.defaultActions[X]:(($===null||typeof $>"u")&&($=U()),H=A[X]&&A[X][$]),typeof H>"u"||!H.length||!H[0]){var de="";he=[];for(K in A[X])this.terminals_[K]&&K>P&&he.push("'"+this.terminals_[K]+"'");R.showPosition?de="Parse error on line "+(O+1)+`: `+R.showPosition()+` Expecting `+he.join(", ")+", got '"+(this.terminals_[$]||$)+"'":de="Parse error on line "+(O+1)+": Unexpected "+($==I?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(de,{text:R.match,token:this.terminals_[$]||$,line:R.yylineno,loc:F,expected:he})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+X+", token: "+$);switch(H[0]){case 1:b.push($),w.push(R.yytext),C.push(R.yylloc),b.push(H[1]),$=null,N=R.yyleng,S=R.yytext,O=R.yylineno,F=R.yylloc;break;case 2:if(Z=this.productions_[H[1]][1],q.$=w[w.length-Z],q._$={first_line:C[C.length-(Z||1)].first_line,last_line:C[C.length-1].last_line,first_column:C[C.length-(Z||1)].first_column,last_column:C[C.length-1].last_column},V&&(q._$.range=[C[C.length-(Z||1)].range[0],C[C.length-1].range[1]]),G=this.performAction.apply(q,[S,N,O,B.yy,H[1],w,C].concat(k)),typeof G<"u")return G;Z&&(b=b.slice(0,-1*Z*2),w=w.slice(0,-1*Z),C=C.slice(0,-1*Z)),b.push(this.productions_[H[1]][0]),w.push(q.$),C.push(q._$),te=A[b[b.length-2]][b[b.length-1]],b.push(te);break;case 3:return!0}}return!0}},E=function(){var T={EOF:1,parseError:function(L,b){if(this.yy.parser)this.yy.parser.parseError(L,b);else throw new Error(L)},setInput:function(D,L){return this.yy=L||this.yy||{},this._input=D,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var D=this._input[0];this.yytext+=D,this.yyleng++,this.offset++,this.match+=D,this.matched+=D;var L=D.match(/(?:\r\n?|\n).*/g);return L?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),D},unput:function(D){var L=D.length,b=D.split(/(?:\r\n?|\n)/g);this._input=D+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-L),this.offset-=L;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===x.length?this.yylloc.first_column:0)+x[x.length-b.length].length-b[0].length:this.yylloc.first_column-L},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-L]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(D){this.unput(this.match.slice(D))},pastInput:function(){var D=this.matched.substr(0,this.matched.length-this.match.length);return(D.length>20?"...":"")+D.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var D=this.match;return D.length<20&&(D+=this._input.substr(0,20-D.length)),(D.substr(0,20)+(D.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var D=this.pastInput(),L=new Array(D.length+1).join("-");return D+this.upcomingInput()+` `+L+"^"},test_match:function(D,L){var b,x,w;if(this.options.backtrack_lexer&&(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(w.yylloc.range=this.yylloc.range.slice(0))),x=D[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+D[0].length},this.yytext+=D[0],this.match+=D[0],this.matches=D,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(D[0].length),this.matched+=D[0],b=this.performAction.call(this,this.yy,this,L,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),b)return b;if(this._backtrack){for(var C in w)this[C]=w[C];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var D,L,b,x;this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),C=0;CL[0].length)){if(L=b,x=C,this.options.backtrack_lexer){if(D=this.test_match(b,w[C]),D!==!1)return D;if(this._backtrack){L=!1;continue}else return!1}else if(!this.options.flex)break}return L?(D=this.test_match(L,w[x]),D!==!1?D:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var L=this.next();return L||this.lex()},begin:function(L){this.conditionStack.push(L)},popState:function(){var L=this.conditionStack.length-1;return L>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(L){return L=this.conditionStack.length-1-Math.abs(L||0),L>=0?this.conditionStack[L]:"INITIAL"},pushState:function(L){this.begin(L)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(L,b,x,w){switch(x){case 0:L.getLogger().trace("Found comment",b.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:L.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return L.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:L.getLogger().trace("end icon"),this.popState();break;case 10:return L.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return L.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return L.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return L.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:L.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return L.getLogger().trace("description:",b.yytext),"NODE_DESCR";case 23:this.popState();break;case 24:return this.popState(),L.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),L.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),L.getLogger().trace("node end ...",b.yytext),"NODE_DEND";case 27:return this.popState(),L.getLogger().trace("node end (("),"NODE_DEND";case 28:return this.popState(),L.getLogger().trace("node end (-"),"NODE_DEND";case 29:return this.popState(),L.getLogger().trace("node end (-"),"NODE_DEND";case 30:return this.popState(),L.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),L.getLogger().trace("node end (("),"NODE_DEND";case 32:return L.getLogger().trace("Long description:",b.yytext),20;case 33:return L.getLogger().trace("Long description:",b.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)\{\}]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();p.lexer=E;function m(){this.yy={}}return m.prototype=p,p.Parser=m,new m}();Bn.parser=Bn;const ed=Bn,ia=r=>Tu(r,_r());let gt=[],_o=0,ai={};const td=()=>{gt=[],_o=0,ai={}},rd=function(r){for(let e=gt.length-1;e>=0;e--)if(gt[e].levelgt.length>0?gt[0]:null,nd=(r,e,t,a)=>{or.info("addNode",r,e,t,a);const n=_r(),i={id:_o++,nodeId:ia(e),level:r,descr:ia(t),type:a,children:[],width:_r().mindmap.maxNodeWidth};switch(i.type){case Oe.ROUNDED_RECT:i.padding=2*n.mindmap.padding;break;case Oe.RECT:i.padding=2*n.mindmap.padding;break;case Oe.HEXAGON:i.padding=2*n.mindmap.padding;break;default:i.padding=n.mindmap.padding}const s=rd(r);if(s)s.children.push(i),gt.push(i);else if(gt.length===0)gt.push(i);else{let o=new Error('There can be only one root. No parent could be found for ("'+i.descr+'")');throw o.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},o}},Oe={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},id=(r,e)=>{switch(or.debug("In get type",r,e),r){case"[":return Oe.RECT;case"(":return e===")"?Oe.ROUNDED_RECT:Oe.CLOUD;case"((":return Oe.CIRCLE;case")":return Oe.CLOUD;case"))":return Oe.BANG;case"{{":return Oe.HEXAGON;default:return Oe.DEFAULT}},Ko=(r,e)=>{ai[r]=e},sd=r=>{const e=gt[gt.length-1];r&&r.icon&&(e.icon=ia(r.icon)),r&&r.class&&(e.class=ia(r.class))},fr=r=>{switch(r){case Oe.DEFAULT:return"no-border";case Oe.RECT:return"rect";case Oe.ROUNDED_RECT:return"rounded-rect";case Oe.CIRCLE:return"circle";case Oe.CLOUD:return"cloud";case Oe.BANG:return"bang";case Oe.HEXAGON:return"hexgon";default:return"no-border"}};let Zo;const od=r=>{Zo=r},ud=()=>or,ld=r=>gt[r],ni=r=>ai[r],fd=Object.freeze(Object.defineProperty({__proto__:null,sanitizeText:ia,clear:td,getMindmap:ad,addNode:nd,nodeType:Oe,getType:id,setElementForId:Ko,decorateNode:sd,type2Str:fr,get parseError(){return Zo},setErrorHandler:od,getLogger:ud,getNodeById:ld,getElementById:ni},Symbol.toStringTag,{value:"Module"})),Qo=12;function hd(r,e){r.each(function(){var t=Xr(this),a=t.text().split(/(\s+|
)/).reverse(),n,i=[],s=1.1,o=t.attr("y"),u=parseFloat(t.attr("dy")),l=t.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",u+"em");for(let f=0;fe||n==="
")&&(i.pop(),l.text(i.join(" ").trim()),n==="
"?i=[""]:i=[n],l=t.append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em").text(n))})}const vd=function(r,e,t){r.append("path").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("d",`M0 ${e.height-5} v${-e.height+2*5} q0,-5 5,-5 h${e.width-2*5} q5,0 5,5 v${e.height-5} H0 Z`),r.append("line").attr("class","node-line-"+t).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},cd=function(r,e){r.append("rect").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("height",e.height).attr("width",e.width)},dd=function(r,e){const t=e.width,a=e.height,n=.15*t,i=.25*t,s=.35*t,o=.2*t;r.append("path").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("d",`M0 0 a${n},${n} 0 0,1 ${t*.25},${-1*t*.1} a${s},${s} 1 0,1 ${t*.4},${-1*t*.1} a${i},${i} 1 0,1 ${t*.35},${1*t*.2} a${n},${n} 1 0,1 ${t*.15},${1*a*.35} a${o},${o} 1 0,1 ${-1*t*.15},${1*a*.65} a${i},${n} 1 0,1 ${-1*t*.25},${t*.15} a${s},${s} 1 0,1 ${-1*t*.5},${0} a${n},${n} 1 0,1 ${-1*t*.25},${-1*t*.15} a${n},${n} 1 0,1 ${-1*t*.1},${-1*a*.35} a${o},${o} 1 0,1 ${t*.1},${-1*a*.65} H0 V0 Z`)},gd=function(r,e){const t=e.width,a=e.height,n=.15*t;r.append("path").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("d",`M0 0 a${n},${n} 1 0,0 ${t*.25},${-1*a*.1} a${n},${n} 1 0,0 ${t*.25},${0} a${n},${n} 1 0,0 ${t*.25},${0} a${n},${n} 1 0,0 ${t*.25},${1*a*.1} a${n},${n} 1 0,0 ${t*.15},${1*a*.33} a${n*.8},${n*.8} 1 0,0 ${0},${1*a*.34} a${n},${n} 1 0,0 ${-1*t*.15},${1*a*.33} a${n},${n} 1 0,0 ${-1*t*.25},${a*.15} a${n},${n} 1 0,0 ${-1*t*.25},${0} a${n},${n} 1 0,0 ${-1*t*.25},${0} a${n},${n} 1 0,0 ${-1*t*.25},${-1*a*.15} a${n},${n} 1 0,0 ${-1*t*.1},${-1*a*.33} a${n*.8},${n*.8} 1 0,0 ${0},${-1*a*.34} a${n},${n} 1 0,0 ${t*.1},${-1*a*.33} H0 V0 Z`)},pd=function(r,e){r.append("circle").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("r",e.width/2)};function yd(r,e,t,a,n){return r.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+t+")")}const md=function(r,e){const t=e.height,n=t/4,i=e.width-e.padding+2*n,s=[{x:n,y:0},{x:i-n,y:0},{x:i,y:-t/2},{x:i-n,y:-t},{x:n,y:-t},{x:0,y:-t/2}];yd(r,i,t,s,e)},bd=function(r,e){r.append("rect").attr("id","node-"+e.id).attr("class","node-bkg node-"+fr(e.type)).attr("height",e.height).attr("rx",e.padding).attr("ry",e.padding).attr("width",e.width)},Ed=function(r,e,t,a){const n=t%(Qo-1),i=r.append("g");e.section=n;let s="section-"+n;n<0&&(s+=" section-root"),i.attr("class",(e.class?e.class+" ":"")+"mindmap-node "+s);const o=i.append("g"),u=i.append("g"),f=u.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(hd,e.width).node().getBBox(),h=a.fontSize.replace?a.fontSize.replace("px",""):a.fontSize;if(e.height=f.height+h*1.1*.5+e.padding,e.width=f.width+2*e.padding,e.icon)if(e.type===Oe.CIRCLE)e.height+=50,e.width+=50,i.append("foreignObject").attr("height","50px").attr("width",e.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+n+" "+e.icon),u.attr("transform","translate("+e.width/2+", "+(e.height/2-1.5*e.padding)+")");else{e.width+=50;const c=e.height;e.height=Math.max(c,60);const v=Math.abs(e.height-c);i.append("foreignObject").attr("width","60px").attr("height",e.height).attr("style","text-align: center;margin-top:"+v/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+n+" "+e.icon),u.attr("transform","translate("+(25+e.width/2)+", "+(v/2+e.padding/2)+")")}else u.attr("transform","translate("+e.width/2+", "+e.padding/2+")");switch(e.type){case Oe.DEFAULT:vd(o,e,n);break;case Oe.ROUNDED_RECT:bd(o,e);break;case Oe.RECT:cd(o,e);break;case Oe.CIRCLE:o.attr("transform","translate("+e.width/2+", "+ +e.height/2+")"),pd(o,e);break;case Oe.CLOUD:dd(o,e);break;case Oe.BANG:gd(o,e);break;case Oe.HEXAGON:md(o,e);break}return Ko(e.id,i),e.height},wd=function(e,t,a,n,i){const s=i%(Qo-1),o=a.x+a.width/2,u=a.y+a.height/2,l=t.x+t.width/2,f=t.y+t.height/2,h=l>o?o+Math.abs(o-l)/2:o-Math.abs(o-l)/2,c=f>u?u+Math.abs(u-f)/2:u-Math.abs(u-f)/2,v=l>o?Math.abs(o-h)/2+o:-Math.abs(o-h)/2+o,d=f>u?Math.abs(u-c)/2+u:-Math.abs(u-c)/2+u;e.append("path").attr("d",a.direction==="TB"||a.direction==="BT"?`M${o},${u} Q${o},${d} ${h},${c} T${l},${f}`:`M${o},${u} Q${v},${u} ${h},${c} T${l},${f}`).attr("class","edge section-edge-"+s+" edge-depth-"+n)},xd=function(r){const e=ni(r.id),t=r.x||0,a=r.y||0;e.attr("transform","translate("+t+","+a+")")},Jo={drawNode:Ed,positionNode:xd,drawEdge:wd};qo.use(jc);function jo(r,e,t,a){Jo.drawNode(r,e,t,a),e.children&&e.children.forEach((n,i)=>{jo(r,n,t<0?i:t,a)})}function Td(r,e){e.edges().map((t,a)=>{const n=t.data();if(t[0]._private.bodyBounds){const i=t[0]._private.rscratch;or.trace("Edge: ",a,n),r.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}function eu(r,e,t,a){e.add({group:"nodes",data:{id:r.id,labelText:r.descr,height:r.height,width:r.width,level:a,nodeId:r.id,padding:r.padding,type:r.type},position:{x:r.x,y:r.y}}),r.children&&r.children.forEach(n=>{eu(n,e,t,a+1),e.add({group:"edges",data:{id:`${r.id}_${n.id}`,source:r.id,target:n.id,depth:a,section:n.section}})})}function Dd(r,e){return new Promise(t=>{const a=Xr("body").append("div").attr("id","cy").attr("style","display:none"),n=qo({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),eu(r,n,e,0),n.nodes().forEach(function(i){i.layoutDimensions=()=>{const s=i.data();return{w:s.width,h:s.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(i=>{or.info("Ready",i),t(n)})})}function Cd(r){r.nodes().map((e,t)=>{const a=e.data();a.x=e.position().x,a.y=e.position().y,Jo.positionNode(a);const n=ni(a.nodeId);or.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",a),n.attr("transform",`translate(${e.position().x-a.width/2}, ${e.position().y-a.height/2})`),n.attr("attr",`apa-${t})`)})}const Ld=async(r,e,t,a)=>{const n=_r();a.db.clear(),a.parser.parse(r),or.debug(`Renering info diagram `+r);const i=_r().securityLevel;let s;i==="sandbox"&&(s=Xr("#i"+e));const u=(i==="sandbox"?Xr(s.nodes()[0].contentDocument.body):Xr("body")).select("#"+e);u.append("g");const l=a.db.getMindmap(),f=u.append("g");f.attr("class","mindmap-edges");const h=u.append("g");h.attr("class","mindmap-nodes"),jo(h,l,-1,n);const c=await Dd(l,n);Td(f,c),Cd(c),Du(void 0,u,n.mindmap.padding,n.mindmap.useMaxWidth)},Sd={draw:Ld},Ad=r=>{let e="";for(let t=0;t` .edge { stroke-width: 3; } ${Ad(r)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${r.git0}; } .section-root text { fill: ${r.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } `,Md=Nd,Rd={db:fd,renderer:Sd,parser:ed,styles:Md};export{Rd as diagram};