All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.chunks.mermaid.esm.min.chunk-VSJQYA62.mjs Maven / Gradle / Ivy

Go to download

Markdown-ish syntax for generating flowcharts, mindmaps, sequence diagrams, class diagrams, gantt charts, git graphs and more.

There is a newer version: 11.4.0
Show newest version
import{a as v}from"./chunk-GTKDMUJJ.mjs";function Ue(r){"@babel/helpers - typeof";return Ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(r)}v(Ue,"_typeof");function ni(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}v(ni,"_classCallCheck");function Ai(r,e){for(var t=0;tr.length)&&(e=r.length);for(var t=0,a=new Array(e);t=r.length?{done:!0}:{done:!1,value:r[a++]}},"n"),e:v(function(l){throw l},"e"),f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,o;return{s:v(function(){t=t.call(r)},"s"),n:v(function(){var l=t.next();return i=l.done,l},"n"),e:v(function(l){s=!0,o=l},"e"),f:v(function(){try{!i&&t.return!=null&&t.return()}finally{if(s)throw o}},"f")}}v(Xs,"_createForOfIteratorHelper");var Ke=typeof window>"u"?null:window,Oi=Ke?Ke.navigator:null;Ke&&Ke.document;var Ku=Ue(""),Zs=Ue({}),Wu=Ue(function(){}),Uu=typeof HTMLElement>"u"?"undefined":Ue(HTMLElement),wa=v(function(e){return e&&e.instanceString&&Ve(e.instanceString)?e.instanceString():null},"instanceStr"),he=v(function(e){return e!=null&&Ue(e)==Ku},"string"),Ve=v(function(e){return e!=null&&Ue(e)===Wu},"fn"),Oe=v(function(e){return!pr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},"array"),Te=v(function(e){return e!=null&&Ue(e)===Zs&&!Oe(e)&&e.constructor===Object},"plainObject"),Yu=v(function(e){return e!=null&&Ue(e)===Zs},"object"),ie=v(function(e){return e!=null&&Ue(e)===Ue(1)&&!isNaN(e)},"number"),Xu=v(function(e){return ie(e)&&Math.floor(e)===e},"integer"),Ja=v(function(e){if(Uu!=="undefined")return e!=null&&e instanceof HTMLElement},"htmlElement"),pr=v(function(e){return xa(e)||Qs(e)},"elementOrCollection"),xa=v(function(e){return wa(e)==="collection"&&e._private.single},"element"),Qs=v(function(e){return wa(e)==="collection"&&!e._private.single},"collection"),si=v(function(e){return wa(e)==="core"},"core"),Js=v(function(e){return wa(e)==="stylesheet"},"stylesheet"),Zu=v(function(e){return wa(e)==="event"},"event"),_r=v(function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},"emptyString"),Qu=v(function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},"domElement"),Ju=v(function(e){return Te(e)&&ie(e.x1)&&ie(e.x2)&&ie(e.y1)&&ie(e.y2)},"boundingBox"),_u=v(function(e){return Yu(e)&&Ve(e.then)},"promise"),ju=v(function(){return Oi&&Oi.userAgent.match(/msie|trident|edge/i)},"ms"),la=v(function(e,t){t||(t=v(function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;st?1:0},"ascending"),sl=v(function(e,t){return-1*js(e,t)},"descending"),we=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(y-=1),y<1/6?h+(m-h)*6*y:y<1/2?m:y<2/3?h+(m-h)*(2/3-y)*6:h}v(f,"hue2rgb");var c=new RegExp("^"+tl+"$").exec(e);if(c){if(a=parseInt(c[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(c[2]),n<0||n>100||(n=n/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,s=c[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var d=i<.5?i*(1+n):i+n-i*n,g=2*i-d;o=Math.round(255*f(g,d,a+1/3)),l=Math.round(255*f(g,d,a)),u=Math.round(255*f(g,d,a-1/3))}t=[o,l,u,s]}return t},"hsl2tuple"),ll=v(function(e){var t,a=new RegExp("^"+el+"$").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],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},"rgb2tuple"),vl=v(function(e){return cl[e.toLowerCase()]},"colorname2tuple"),fl=v(function(e){return(Oe(e)?e:null)||vl(e)||ol(e)||ll(e)||ul(e)},"color2tuple"),cl={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]},eo=v(function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i=e||E<0||c&&k>=i}v(y,"shouldInvoke");function p(){var C=Bn();if(y(C))return b(C);o=setTimeout(p,m(C))}v(p,"timerExpired");function b(C){return o=void 0,d&&a?g(C):(a=n=void 0,s)}v(b,"trailingEdge");function w(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}v(w,"cancel");function x(){return o===void 0?s:b(Bn())}v(x,"flush");function T(){var C=Bn(),E=y(C);if(a=arguments,n=this,l=C,E){if(o===void 0)return h(l);if(c)return clearTimeout(o),o=setTimeout(p,e),g(l)}return o===void 0&&(o=setTimeout(p,e)),s}return v(T,"debounced"),T.cancel=w,T.flush=x,T}v(Ql,"debounce");var fn=Ql,Mn=Ke?Ke.performance:null,no=Mn&&Mn.now?function(){return Mn.now()}:function(){return Date.now()},Jl=function(){if(Ke){if(Ke.requestAnimationFrame)return function(r){Ke.requestAnimationFrame(r)};if(Ke.mozRequestAnimationFrame)return function(r){Ke.mozRequestAnimationFrame(r)};if(Ke.webkitRequestAnimationFrame)return function(r){Ke.webkitRequestAnimationFrame(r)};if(Ke.msRequestAnimationFrame)return function(r){Ke.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(no())},1e3/60)}}(),_a=v(function(e){return Jl(e)},"requestAnimationFrame"),$r=no,kt=9261,io=65599,aa=5381,so=v(function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt,a=t,n;n=e.next(),!n.done;)a=a*io+n.value|0;return a},"hashIterableInts"),va=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kt;return t*io+e|0},"hashInt"),fa=v(function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:aa;return(t<<5)+t+e|0},"hashIntAlt"),_l=v(function(e,t){return e*2097152+t},"combineHashes"),Ur=v(function(e){return e[0]*2097152+e[1]},"combineHashesArray"),Ma=v(function(e,t){return[va(e[0],t[0]),fa(e[1],t[1])]},"hashArrays"),jl=v(function(e,t){var a={value:0,done:!1},n=0,i=e.length,s={next:v(function(){return n=0&&!(e[n]===t&&(e.splice(n,1),a));n--);},"removeFromArray"),vi=v(function(e){e.splice(0,e.length)},"clearArray"),sv=v(function(e,t){for(var a=0;a"u"?"undefined":Ue(Set))!==uv?Set:lv,cn=v(function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!si(e)){qe("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"){qe("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new Vt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var s=t.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Oe(t.classes)?u=t.classes:he(t.classes)&&(u=t.classes.split(/\s+/));for(var f=0,c=u.length;fb?1:0},"defaultCmp"),f=v(function(p,b,w,x,T){var C;if(w==null&&(w=0),T==null&&(T=a),w<0)throw new Error("lo must be non-negative");for(x==null&&(x=p.length);wL;0<=L?S++:S--)k.push(S);return k}.apply(this).reverse(),E=[],x=0,T=C.length;xB;0<=B?++k:--k)M.push(s(p,w));return M},"nsmallest"),m=v(function(p,b,w,x){var T,C,E;for(x==null&&(x=a),T=p[w];w>b;){if(E=w-1>>1,C=p[E],x(T,C)<0){p[w]=C,w=E;continue}break}return p[w]=T},"_siftdown"),y=v(function(p,b,w){var x,T,C,E,k;for(w==null&&(w=a),T=p.length,k=b,C=p[b],x=2*b+1;x0;){var C=b.pop(),E=y(C),k=C.id();if(d[k]=E,E!==1/0)for(var S=C.neighborhood().intersect(h),L=0;L0)for(z.unshift(O);c[H];){var V=c[H];z.unshift(V.edge),z.unshift(V.node),$=V.node,H=$.id()}return o.spawn(z)},"pathTo")}},"dijkstra")},dv={kruskal:v(function(e){e=e||function(w){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,s=new Array(i),o=a,l=v(function(x){for(var T=0;T0;){if(T(),E++,x===f){for(var k=[],S=i,L=f,B=p[L];k.unshift(S),B!=null&&k.unshift(B),S=y[L],S!=null;)L=S.id(),B=p[L];return{found:!0,distance:c[x],path:this.spawn(k),steps:E}}g[x]=!0;for(var M=w._private.edges,A=0;AB&&(h[L]=B,b[L]=S,w[L]=T),!i){var M=S*f+k;!i&&h[M]>B&&(h[M]=B,b[M]=k,w[M]=T)}}}for(var A=0;A1&&arguments[1]!==void 0?arguments[1]:s,Be=w(fe),Ce=[],Ee=Be;;){if(Ee==null)return t.spawn();var De=b(Ee),_=De.edge,D=De.pred;if(Ce.unshift(Ee[0]),Ee.same(ye)&&Ce.length>0)break;_!=null&&Ce.unshift(_),Ee=D}return l.spawn(Ce)},"pathTo"),C=0;C=0;f--){var c=u[f],d=c[1],g=c[2];(t[d]===o&&t[g]===l||t[d]===l&&t[g]===o)&&u.splice(f,1)}for(var h=0;hn;){var i=Math.floor(Math.random()*t.length);t=xv(i,e,t),a--}return t},"contractUntil"),Ev={kargerStein:v(function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(z){return z.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/wv);if(i<2){qe("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=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,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(d,g){return d-g});var f=e.length,c=Math.floor(f/2);return f%2!==0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},"median"),Pv=v(function(e){return Math.PI*e/180},"deg2rad"),La=v(function(e,t){return Math.atan2(t,e)-Math.PI/2},"getAngleFromDisp"),fi=Math.log2||function(r){return Math.log(r)/Math.log(2)},ho=v(function(e){return e>0?1:e<0?-1:0},"signum"),ht=v(function(e,t){return Math.sqrt(ot(e,t))},"dist"),ot=v(function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},"sqdist"),Bv=v(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}}},"makeBoundingBox"),Lv=v(function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},"copyBoundingBox"),Av=v(function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},"clearBoundingBox"),Rv=v(function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},"shiftBoundingBox"),go=v(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},"updateBoundingBox"),Ov=v(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},"expandBoundingBoxByPoint"),Ha=v(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},"expandBoundingBox"),Ga=v(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=Dr(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},"expandBoundingBoxSides"),Hi=v(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},"assignBoundingBox"),ci=v(function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},"boundingBoxesIntersect"),It=v(function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},"inBoundingBox"),Iv=v(function(e,t){return It(e,t.x,t.y)},"pointInBoundingBox"),po=v(function(e,t){return It(e,t.x1,t.y1)&&It(e,t.x2,t.y2)},"boundingBoxInBoundingBox"),yo=v(function(e,t,a,n,i,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?gt(i,s):l,f=i/2,c=s/2;u=Math.min(u,f,c);var d=u!==f,g=u!==c,h;if(d){var m=a-f+u-o,y=n-c-o,p=a+f-u+o,b=y;if(h=Zr(e,t,a,n,m,y,p,b,!1),h.length>0)return h}if(g){var w=a+f+o,x=n-c+u-o,T=w,C=n+c-u+o;if(h=Zr(e,t,a,n,w,x,T,C,!1),h.length>0)return h}if(d){var E=a-f+u-o,k=n+c+o,S=a+f-u+o,L=k;if(h=Zr(e,t,a,n,E,k,S,L,!1),h.length>0)return h}if(g){var B=a-f-o,M=n-c+u-o,A=B,P=n+c-u+o;if(h=Zr(e,t,a,n,B,M,A,P,!1),h.length>0)return h}var I;{var R=a-f+u,O=n-c+u;if(I=na(e,t,a,n,R,O,u+o),I.length>0&&I[0]<=R&&I[1]<=O)return[I[0],I[1]]}{var z=a+f-u,$=n-c+u;if(I=na(e,t,a,n,z,$,u+o),I.length>0&&I[0]>=z&&I[1]<=$)return[I[0],I[1]]}{var H=a+f-u,V=n+c-u;if(I=na(e,t,a,n,H,V,u+o),I.length>0&&I[0]>=H&&I[1]>=V)return[I[0],I[1]]}{var F=a-f+u,U=n+c-u;if(I=na(e,t,a,n,F,U,u+o),I.length>0&&I[0]<=F&&I[1]>=U)return[I[0],I[1]]}return[]},"roundRectangleIntersectLine"),zv=v(function(e,t,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),c=Math.min(n,s),d=Math.max(n,s);return u-l<=e&&e<=f+l&&c-l<=t&&t<=d+l},"inLineVicinity"),Nv=v(function(e,t,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(ef.x2||tf.y2)},"inBezierVicinity"),Fv=v(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,l=(-t+s)/o,u=(-t-s)/o;return[l,u]},"solveQuadratic"),Vv=v(function(e,t,a,n,i){var s=1e-5;e===0&&(e=s),t/=e,a/=e,n/=e;var o,l,u,f,c,d,g,h;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,o=l*l*l+u*u,i[1]=0,g=t/3,o>0){c=u+Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=u-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),i[0]=-g+c+d,g+=(c+d)/2,i[4]=i[2]=-g,g=Math.sqrt(3)*(-d+c)/2,i[3]=g,i[5]=-g;return}if(i[5]=i[3]=0,o===0){h=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-g+2*h,i[4]=i[2]=-(h+g);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),h=2*Math.sqrt(l),i[0]=-g+h*Math.cos(f/3),i[2]=-g+h*Math.cos((f+2*Math.PI)/3),i[4]=-g+h*Math.cos((f+4*Math.PI)/3)},"solveCubic"),qv=v(function(e,t,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,c=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*t+2*s*s+2*s*t-l*t,d=1*a*i-a*a+a*e-i*e+n*s-n*n+n*t-s*t,g=[];Vv(u,f,c,d,g);for(var h=1e-7,m=[],y=0;y<6;y+=2)Math.abs(g[y+1])=0&&g[y]<=1&&m.push(g[y]);m.push(1),m.push(0);for(var p=-1,b,w,x,T=0;T=0?xu?(e-i)*(e-i)+(t-s)*(t-s):f-d},"sqdistToFiniteLine"),hr=v(function(e,t,a){for(var n,i,s,o,l,u=0,f=0;f=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>t&&u++;else continue;return u%2!==0},"pointInsidePolygonPoints"),Hr=v(function(e,t,a,n,i,s,o,l,u){var f=new Array(a.length),c;l[0]!=null?(c=Math.atan(l[1]/l[0]),l[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=l;for(var d=Math.cos(-c),g=Math.sin(-c),h=0;h0){var y=rn(f,-u);m=en(y)}else m=f;return hr(e,t,m)},"pointInsidePolygon"),Hv=v(function(e,t,a,n,i,s,o,l){for(var u=new Array(a.length*2),f=0;f=0&&y<=1&&b.push(y),p>=0&&p<=1&&b.push(p),b.length===0)return[];var w=b[0]*l[0]+e,x=b[0]*l[1]+t;if(b.length>1){if(b[0]==b[1])return[w,x];var T=b[1]*l[0]+e,C=b[1]*l[1]+t;return[w,x,T,C]}else return[w,x]},"intersectLineCircle"),An=v(function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},"midOfThree"),Zr=v(function(e,t,a,n,i,s,o,l,u){var f=e-i,c=a-e,d=o-i,g=t-s,h=n-t,m=l-s,y=d*g-m*f,p=c*g-h*f,b=m*c-d*h;if(b!==0){var w=y/b,x=p/b,T=.001,C=0-T,E=1+T;return C<=w&&w<=E&&C<=x&&x<=E?[e+w*c,t+w*h]:u?[e+w*c,t+w*h]:[]}else return y===0||p===0?An(e,a,o)===o?[o,l]:An(e,a,i)===i?[i,s]:An(i,o,a)===a?[a,n]:[]:[]},"finiteLinesIntersect"),ha=v(function(e,t,a,n,i,s,o,l){var u=[],f,c=new Array(a.length),d=!0;s==null&&(d=!1);var g;if(d){for(var h=0;h0){var m=rn(c,-l);g=en(m)}else g=c}else g=a;for(var y,p,b,w,x=0;x2){for(var h=[f[0],f[1]],m=Math.pow(h[0]-e,2)+Math.pow(h[1]-t,2),y=1;yf&&(f=x)},"set"),get:v(function(w){return u[w]},"get")},d=0;d0?R=I.edgesTo(P)[0]:R=P.edgesTo(I)[0];var O=n(R);P=P.id(),k[P]>k[M]+O&&(k[P]=k[M]+O,S.nodes.indexOf(P)<0?S.push(P):S.updateItem(P),E[P]=0,C[P]=[]),k[P]==k[M]+O&&(E[P]=E[P]+E[M],C[P].push(M))}else for(var z=0;z0;){for(var F=T.pop(),U=0;U0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},"assign"),nf=v(function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:uf,o=n,l,u,f=0;f=2?_t(e,t,a,0,Yi,lf):_t(e,t,a,0,Ui)},"euclidean"),squaredEuclidean:v(function(e,t,a){return _t(e,t,a,0,Yi)},"squaredEuclidean"),manhattan:v(function(e,t,a){return _t(e,t,a,0,Ui)},"manhattan"),max:v(function(e,t,a){return _t(e,t,a,-1/0,vf)},"max")};zt["squared-euclidean"]=zt.squaredEuclidean;zt.squaredeuclidean=zt.squaredEuclidean;function hn(r,e,t,a,n,i){var s;return Ve(r)?s=r:s=zt[r]||zt.euclidean,e===0&&Ve(r)?s(n,i):s(e,t,a,n,i)}v(hn,"clusteringDistance");var ff=rr({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),hi=v(function(e){return ff(e)},"setOptions"),tn=v(function(e,t,a,n,i){var s=i!=="kMedoids",o=s?function(c){return a[c]}:function(c){return n[c](a)},l=v(function(d){return n[d](t)},"getQ"),u=a,f=t;return hn(e,n.length,o,l,u,f)},"getDist"),Rn=v(function(e,t,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(t),l=null,u=0;ua)return!1}return!0},"haveMatricesConverged"),hf=v(function(e,t,a){for(var n=0;no&&(o=t[u][f],l=f);i[l].push(e[u])}for(var c=0;c=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var h=t[s],m=t[n[s]],y;i.mode==="dendrogram"?y={left:h,right:m,key:h.key}:y={value:h.value.concat(m.value),key:h.key},e[h.index]=y,e.splice(m.index,1),t[h.key]=y;for(var p=0;pa[m.key][b.key]&&(l=a[m.key][b.key])):i.linkage==="max"?(l=a[h.key][b.key],a[h.key][b.key]0&&n.push(i);return n},"findExemplars"),ji=v(function(e,t,a){for(var n=[],i=0;io&&(s=u,o=t[i*e+u])}s>0&&n.push(s)}for(var f=0;fu&&(l=f,u=c)}a[i]=s[l]}return n=ji(e,t,a),n},"assign"),es=v(function(e){for(var t=this.cy(),a=this.nodes(),n=Pf(e),i={},s=0;s=B?(M=B,B=P,A=I):P>M&&(M=P);for(var R=0;R0?1:0;E[S%n.minIterations*o+F]=U,V+=U}if(V>0&&(S>=n.minIterations-1||S==n.maxIterations-1)){for(var J=0,j=0;j1||C>1)&&(o=!0),c[w]=[],b.outgoers().forEach(function(k){k.isEdge()&&c[w].push(k.id())})}else d[w]=[void 0,b.target().id()]}):s.forEach(function(b){var w=b.id();if(b.isNode()){var x=b.degree(!0);x%2&&(l?u?o=!0:u=w:l=w),c[w]=[],b.connectedEdges().forEach(function(T){return c[w].push(T.id())})}else d[w]=[b.source().id(),b.target().id()]});var g={found:!1,trail:void 0};if(o)return g;if(u&&l)if(i){if(f&&u!=f)return g;f=u}else{if(f&&u!=f&&l!=f)return g;f||(f=u)}else f||(f=s[0].id());var h=v(function(w){for(var x=w,T=[w],C,E,k;c[x].length;)C=c[x].shift(),E=d[C][0],k=d[C][1],x!=k?(c[k]=c[k].filter(function(S){return S!=C}),x=k):!i&&x!=E&&(c[E]=c[E].filter(function(S){return S!=C}),x=E),T.unshift(C),T.unshift(x);return T},"walk"),m=[],y=[];for(y=h(f);y.length!=1;)c[y[0]].length==0?(m.unshift(s.getElementById(y.shift())),m.unshift(s.getElementById(y.shift()))):y=h(y.shift()).concat(y);m.unshift(s.getElementById(y.shift()));for(var p in c)if(c[p].length)return g;return g.found=!0,g.trail=this.spawn(m,!0),g},"hierholzer")},Oa=v(function(){var e=this,t={},a=0,n=0,i=[],s=[],o={},l=v(function(d,g){for(var h=s.length-1,m=[],y=e.spawn();s[h].x!=d||s[h].y!=g;)m.push(s.pop().edge),h--;m.push(s.pop().edge),m.forEach(function(p){var b=p.connectedNodes().intersection(e);y.merge(p),b.forEach(function(w){var x=w.id(),T=w.connectedEdges().intersection(e);y.merge(w),t[x].cutVertex?y.merge(T.filter(function(C){return C.isLoop()})):y.merge(T)})}),i.push(y)},"buildComponent"),u=v(function c(d,g,h){d===h&&(n+=1),t[g]={id:a,low:a++,cutVertex:!1};var m=e.getElementById(g).connectedEdges().intersection(e);if(m.size()===0)i.push(e.spawn(e.getElementById(g)));else{var y,p,b,w;m.forEach(function(x){y=x.source().id(),p=x.target().id(),b=y===g?p:y,b!==h&&(w=x.id(),o[w]||(o[w]=!0,s.push({x:g,y:b,edge:x})),b in t?t[g].low=Math.min(t[g].low,t[b].id):(c(d,b,g),t[g].low=Math.min(t[g].low,t[b].low),t[g].id<=t[b].low&&(t[g].cutVertex=!0,l(g,b))))})}},"biconnectedSearch");e.forEach(function(c){if(c.isNode()){var d=c.id();d in t||(n=0,u(d,d),t[d].cutVertex=n>1)}});var f=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(f),components:i}},"hopcroftTarjanBiconnected"),zf={hopcroftTarjanBiconnected:Oa,htbc:Oa,htb:Oa,hopcroftTarjanBiconnectedComponents:Oa},Ia=v(function(){var e=this,t={},a=0,n=[],i=[],s=e.spawn(e),o=v(function l(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(m){var y=m.target().id();y!==u&&(y in t||l(y),t[y].explored||(t[u].low=Math.min(t[u].low,t[y].low)))}),t[u].index===t[u].low){for(var c=e.spawn();;){var d=i.pop();if(c.merge(e.getElementById(d)),t[d].low=t[u].index,t[d].explored=!0,d===u)break}var g=c.edgesWith(c),h=c.merge(g);n.push(h),s=s.difference(h)}},"stronglyConnectedSearch");return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||o(u)}}),{cut:s,components:n}},"tarjanStronglyConnected"),Nf={tarjanStronglyConnected:Ia,tsc:Ia,tscc:Ia,tarjanStronglyConnectedComponents:Ia},So={};[ca,cv,dv,gv,yv,bv,Ev,Yv,Lt,At,Kn,of,wf,Df,Rf,If,zf,Nf].forEach(function(r){we(So,r)});var To=0,Do=1,ko=2,Gr=v(function r(e){if(!(this instanceof r))return new r(e);this.id="Thenable/1.0.7",this.state=To,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))},"api");Gr.prototype={fulfill:v(function(e){return rs(this,Do,"fulfillValue",e)},"fulfill"),reject:v(function(e){return rs(this,ko,"rejectReason",e)},"reject"),then:v(function(e,t){var a=this,n=new Gr;return a.onFulfilled.push(as(e,n,"fulfill")),a.onRejected.push(as(t,n,"reject")),Po(a),n.proxy},"then")};var rs=v(function(e,t,a,n){return e.state===To&&(e.state=t,e[a]=n,Po(e)),e},"deliver"),Po=v(function(e){e.state===Do?ts(e,"onFulfilled",e.fulfillValue):e.state===ko&&ts(e,"onRejected",e.rejectReason)},"execute"),ts=v(function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=v(function(){for(var o=0;o0},"animatedImpl")},"animated"),clearQueue:v(function(){return v(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;s-1}v(Gc,"listCacheHas");var Kc=Gc;function Wc(r,e){var t=this.__data__,a=pn(t,r);return a<0?(++this.size,t.push([r,e])):t[a][1]=e,this}v(Wc,"listCacheSet");var Uc=Wc;function Ht(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e-1&&r%1==0&&r0&&this.spawn(n).updateStyle().emit("class"),t},"classes"),addClass:v(function(e){return this.toggleClass(e,!0)},"addClass"),hasClass:v(function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},"hasClass"),toggleClass:v(function(e,t){Oe(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},"toggleClass"),removeClass:v(function(e){return this.toggleClass(e,!1)},"removeClass"),flashClass:v(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},"flashClass")};Ka.className=Ka.classNames=Ka.classes;var Se={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:We,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Se.variable="(?:[\\w-.]|(?:\\\\"+Se.metaChar+"))+";Se.className="(?:[\\w-]|(?:\\\\"+Se.metaChar+"))+";Se.value=Se.string+"|"+Se.number;Se.id=Se.variable;(function(){var r,e,t;for(r=Se.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(Se.comparatorOp+="|\\!"+e)})();var Ae=v(function(){return{checks:[]}},"newQuery"),ue={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Un=[{selector:":selected",matches:v(function(e){return e.selected()},"matches")},{selector:":unselected",matches:v(function(e){return!e.selected()},"matches")},{selector:":selectable",matches:v(function(e){return e.selectable()},"matches")},{selector:":unselectable",matches:v(function(e){return!e.selectable()},"matches")},{selector:":locked",matches:v(function(e){return e.locked()},"matches")},{selector:":unlocked",matches:v(function(e){return!e.locked()},"matches")},{selector:":visible",matches:v(function(e){return e.visible()},"matches")},{selector:":hidden",matches:v(function(e){return!e.visible()},"matches")},{selector:":transparent",matches:v(function(e){return e.transparent()},"matches")},{selector:":grabbed",matches:v(function(e){return e.grabbed()},"matches")},{selector:":free",matches:v(function(e){return!e.grabbed()},"matches")},{selector:":removed",matches:v(function(e){return e.removed()},"matches")},{selector:":inside",matches:v(function(e){return!e.removed()},"matches")},{selector:":grabbable",matches:v(function(e){return e.grabbable()},"matches")},{selector:":ungrabbable",matches:v(function(e){return!e.grabbable()},"matches")},{selector:":animated",matches:v(function(e){return e.animated()},"matches")},{selector:":unanimated",matches:v(function(e){return!e.animated()},"matches")},{selector:":parent",matches:v(function(e){return e.isParent()},"matches")},{selector:":childless",matches:v(function(e){return e.isChildless()},"matches")},{selector:":child",matches:v(function(e){return e.isChild()},"matches")},{selector:":orphan",matches:v(function(e){return e.isOrphan()},"matches")},{selector:":nonorphan",matches:v(function(e){return e.isChild()},"matches")},{selector:":compound",matches:v(function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()},"matches")},{selector:":loop",matches:v(function(e){return e.isLoop()},"matches")},{selector:":simple",matches:v(function(e){return e.isSimple()},"matches")},{selector:":active",matches:v(function(e){return e.active()},"matches")},{selector:":inactive",matches:v(function(e){return!e.active()},"matches")},{selector:":backgrounding",matches:v(function(e){return e.backgrounding()},"matches")},{selector:":nonbackgrounding",matches:v(function(e){return!e.backgrounding()},"matches")}].sort(function(r,e){return sl(r.selector,e.selector)}),Qd=function(){for(var r={},e,t=0;t0&&f.edgeCount>0)return Le("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Le("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Le("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},"parse"),th=v(function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=v(function(f){return f??""},"clean"),t=v(function(f){return he(f)?'"'+f+'"':e(f)},"cleanVal"),a=v(function(f){return" "+f+" "},"space"),n=v(function(f,c){var d=f.type,g=f.value;switch(d){case ue.GROUP:{var h=e(g);return h.substring(0,h.length-1)}case ue.DATA_COMPARE:{var m=f.field,y=f.operator;return"["+m+a(e(y))+t(g)+"]"}case ue.DATA_BOOL:{var p=f.operator,b=f.field;return"["+e(p)+b+"]"}case ue.DATA_EXIST:{var w=f.field;return"["+w+"]"}case ue.META_COMPARE:{var x=f.operator,T=f.field;return"[["+T+a(e(x))+t(g)+"]]"}case ue.STATE:return g;case ue.ID:return"#"+g;case ue.CLASS:return"."+g;case ue.PARENT:case ue.CHILD:return i(f.parent,c)+a(">")+i(f.child,c);case ue.ANCESTOR:case ue.DESCENDANT:return i(f.ancestor,c)+" "+i(f.descendant,c);case ue.COMPOUND_SPLIT:{var C=i(f.left,c),E=i(f.subject,c),k=i(f.right,c);return C+(C.length>0?" ":"")+E+k}case ue.TRUE:return""}},"checkToString"),i=v(function(f,c){return f.checks.reduce(function(d,g,h){return d+(c===f&&h===0?"$":"")+n(g,c)},"")},"queryToString"),s="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":d=!0,n=e>a;break;case">=":d=!0,n=e>=a;break;case"<":d=!0,n=e0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return r}v(bi,"forEachCompound");function No(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return bi(this,r,e,No)};function Fo(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}v(Fo,"addParent");Nt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return bi(this,r,e,Fo)};function vh(r,e,t){Fo(r,e,t),No(r,e,t)}v(vh,"addParentAndChildren");Nt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return bi(this,r,e,vh)};Nt.ancestors=Nt.parents;var pa,Vo;pa=Vo={data:Me.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:Me.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Me.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Me.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Me.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Me.removeData({field:"rscratch",triggerEvent:!1}),id:v(function(){var e=this[0];if(e)return e._private.data.id},"id")};pa.attr=pa.data;pa.removeAttr=pa.removeData;var fh=Vo,mn={};function In(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:Ct("indegree",function(r,e){return re}),minOutdegree:Ct("outdegree",function(r,e){return re})});we(mn,{totalDegree:v(function(e){for(var t=0,a=this.nodes(),n=0;n0,d=c;c&&(f=f[0]);var g=d?f.position():{x:0,y:0};t!==void 0?u.position(e,t+g[e]):i!==void 0&&u.position({x:i.x+g.x,y:i.y+g.y})}else{var h=a.position(),m=o?a.parent():null,y=m&&m.length>0,p=y;y&&(m=m[0]);var b=p?m.position():{x:0,y:0};return i={x:h.x-b.x,y:h.y-b.y},e===void 0?i:i[e]}else if(!s)return;return this},"relativePosition")};Br.modelPosition=Br.point=Br.position;Br.modelPositions=Br.points=Br.positions;Br.renderedPoint=Br.renderedPosition;Br.relativePoint=Br.relativePosition;var ch=qo,Rt,at;Rt=at={};at.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,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};at.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)};at.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,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},c=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),d=o.position;(c.w===0||c.h===0)&&(c={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},c.x1=d.x-c.w/2,c.x2=d.x+c.w/2,c.y1=d.y-c.h/2,c.y2=d.y+c.h/2);function g(S,L,B){var M=0,A=0,P=L+B;return S>0&&P>0&&(M=L/P*S,A=B/P*S),{biasDiff:M,biasComplementDiff:A}}v(g,"computeBiasValues");function h(S,L,B,M){if(B.units==="%")switch(M){case"width":return S>0?B.pfValue*S:0;case"height":return L>0?B.pfValue*L:0;case"average":return S>0&&L>0?B.pfValue*(S+L)/2:0;case"min":return S>0&&L>0?S>L?B.pfValue*L:B.pfValue*S:0;case"max":return S>0&&L>0?S>L?B.pfValue*S:B.pfValue*L:0;default:return 0}else return B.units==="px"?B.pfValue:0}v(h,"computePaddingValues");var m=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(m=m*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 b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var w=g(f.width.val-c.w,m,y),x=w.biasDiff,T=w.biasComplementDiff,C=g(f.height.val-c.h,p,b),E=C.biasDiff,k=C.biasComplementDiff;o.autoPadding=h(c.w,c.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(c.w,f.width.val),d.x=(-x+c.x1+c.x2+T)/2,o.autoHeight=Math.max(c.h,f.height.val),d.y=(-E+c.y1+c.y2+k)/2}v(t,"update");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)},"updateBounds"),ut=v(function(e,t){return t==null?e:kr(e,t.x1,t.y1,t.x2,t.y2)},"updateBoundsFromBox"),jt=v(function(e,t,a){return Pr(e,t,a)},"prefixedProperty"),za=v(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,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},c=f[a]=f[a]||{};c.x1=l-s,c.y1=u-s,c.x2=l+s,c.y2=u+s,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Ha(c,1),kr(e,c.x1,c.y1,c.x2,c.y2)}}},"updateBoundsFromArrow"),zn=v(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 l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),f=jt(s,"labelWidth",a),c=jt(s,"labelHeight",a),d=jt(s,"labelX",a),g=jt(s,"labelY",a),h=t.pstyle(n+"text-margin-x").pfValue,m=t.pstyle(n+"text-margin-y").pfValue,y=t.isEdge(),p=t.pstyle(n+"text-rotation"),b=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue,x=w/2,T=t.pstyle("text-background-padding").pfValue,C=2,E=c,k=f,S=k/2,L=E/2,B,M,A,P;if(y)B=d-S,M=d+S,A=g-L,P=g+L;else{switch(l.value){case"left":B=d-k,M=d;break;case"center":B=d-S,M=d+S;break;case"right":B=d,M=d+k;break}switch(u.value){case"top":A=g-E,P=g;break;case"center":A=g-L,P=g+L;break;case"bottom":A=g,P=g+E;break}}B+=h-Math.max(b,x)-T-C,M+=h+Math.max(b,x)+T+C,A+=m-Math.max(b,x)-T-C,P+=m+Math.max(b,x)+T+C;var I=a||"main",R=i.labelBounds,O=R[I]=R[I]||{};O.x1=B,O.y1=A,O.x2=M,O.y2=P,O.w=M-B,O.h=P-A;var z=y&&p.strValue==="autorotate",$=p.pfValue!=null&&p.pfValue!==0;if(z||$){var H=z?jt(i.rstyle,"labelAngle",a):p.pfValue,V=Math.cos(H),F=Math.sin(H),U=(B+M)/2,J=(A+P)/2;if(!y){switch(l.value){case"left":U=M;break;case"right":U=B;break}switch(u.value){case"top":J=P;break;case"bottom":J=A;break}}var j=v(function(ge,ne){return ge=ge-U,ne=ne-J,{x:ge*V-ne*F+U,y:ge*F+ne*V+J}},"rotate"),ee=j(B,A),re=j(B,P),Y=j(M,A),N=j(M,P);B=Math.min(ee.x,re.x,Y.x,N.x),M=Math.max(ee.x,re.x,Y.x,N.x),A=Math.min(ee.y,re.y,Y.y,N.y),P=Math.max(ee.y,re.y,Y.y,N.y)}var X=I+"Rot",Z=R[X]=R[X]||{};Z.x1=B,Z.y1=A,Z.x2=M,Z.y2=P,Z.w=M-B,Z.h=P-A,kr(e,B,A,M,P),kr(i.labelBounds.all,B,A,M,P)}return e}},"updateBoundsFromLabel"),dh=v(function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,s=t.pstyle("shape").value,o=n+i,l=(e.w+o*2)/e.w,u=(e.h+o*2)/e.h,f=0,c=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+o*2.4)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+o*2.4)/e.w:s==="star"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.6)/e.h,c=-o/3.8):s==="triangle"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.4)/e.h,c=-o/1.4):s==="vee"&&(l=(e.w+o*4.4)/e.w,u=(e.h+o*3.8)/e.h,c=-o*.5);var d=e.h*u-e.h,g=e.w*l-e.w;if(Ga(e,[Math.ceil(d/2),Math.ceil(g/2)]),f!=0||c!==0){var h=Rv(e,f,c);go(e,h)}}}},"updateBoundsFromOutline"),hh=v(function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=gr(),o=e._private,l=e.isNode(),u=e.isEdge(),f,c,d,g,h,m,y=o.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],b=v(function(le){return le.pstyle("display").value!=="none"},"isDisplayed"),w=!n||b(e)&&(!u||b(e.source())&&b(e.target()));if(w){var x=0,T=0;n&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(T=e.pstyle("overlay-padding").value));var C=0,E=0;n&&t.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(E=e.pstyle("underlay-padding").value));var k=Math.max(T,E),S=0,L=0;if(n&&(S=e.pstyle("width").pfValue,L=S/2),l&&t.includeNodes){var B=e.position();h=B.x,m=B.y;var M=e.outerWidth(),A=M/2,P=e.outerHeight(),I=P/2;f=h-A,c=h+A,d=m-I,g=m+I,kr(s,f,d,c,g),n&&t.includeOutlines&&dh(s,e)}else if(u&&t.includeEdges)if(n&&!i){var R=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),c=Math.max(y.srcX,y.midX,y.tgtX),d=Math.min(y.srcY,y.midY,y.tgtY),g=Math.max(y.srcY,y.midY,y.tgtY),f-=L,c+=L,d-=L,g+=L,kr(s,f,d,c,g),R==="haystack"){var O=y.haystackPts;if(O&&O.length===2){if(f=O[0].x,d=O[0].y,c=O[1].x,g=O[1].y,f>c){var z=f;f=c,c=z}if(d>g){var $=d;d=g,g=$}kr(s,f-L,d-L,c+L,g+L)}}else if(R==="bezier"||R==="unbundled-bezier"||R.endsWith("segments")||R.endsWith("taxi")){var H;switch(R){case"bezier":case"unbundled-bezier":H=y.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":H=y.linePts;break}if(H!=null)for(var V=0;Vc){var re=f;f=c,c=re}if(d>g){var Y=d;d=g,g=Y}f-=L,c+=L,d-=L,g+=L,kr(s,f,d,c,g)}if(n&&t.includeEdges&&u&&(za(s,e,"mid-source"),za(s,e,"mid-target"),za(s,e,"source"),za(s,e,"target")),n){var N=e.pstyle("ghost").value==="yes";if(N){var X=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue;kr(s,s.x1+X,s.y1+Z,s.x2+X,s.y2+Z)}}var oe=o.bodyBounds=o.bodyBounds||{};Hi(oe,s),Ga(oe,p),Ha(oe,1),n&&(f=s.x1,c=s.x2,d=s.y1,g=s.y2,kr(s,f-k,d-k,c+k,g+k));var ge=o.overlayBounds=o.overlayBounds||{};Hi(ge,s),Ga(ge,p),Ha(ge,1);var ne=o.labelBounds=o.labelBounds||{};ne.all!=null?Av(ne.all):ne.all=gr(),n&&t.includeLabels&&(t.includeMainLabels&&zn(s,e,null),u&&(t.includeSourceLabels&&zn(s,e,"source"),t.includeTargetLabels&&zn(s,e,"target")))}return s.x1=wr(s.x1),s.y1=wr(s.y1),s.x2=wr(s.x2),s.y2=wr(s.y2),s.w=wr(s.x2-s.x1),s.h=wr(s.y2-s.y1),s.w>0&&s.h>0&&w&&(Ga(s,p),Ha(s,1)),s},"boundingBoxImpl"),Ho=v(function(e){var t=0,a=v(function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:Bh,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;o--)s(o);return this};tt.removeAllListeners=function(){return this.removeListener("*")};tt.emit=tt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Oe(e)||(e=[e]),Mh(this,function(i,s){t!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:t}],n=a.length);for(var o=v(function(f){var c=a[f];if(c.type===s.type&&(!c.namespace||c.namespace===s.namespace||c.namespace===Ph)&&i.eventMatches(i.context,c,s)){var d=[s];e!=null&&sv(d,e),i.beforeEmit(i.context,c,s),c.conf&&c.conf.one&&(i.listeners=i.listeners.filter(function(m){return m!==c}));var g=i.callbackContext(i.context,c,s),h=c.callback.apply(g,d);i.afterEmit(i.context,c,s),h===!1&&(s.stopPropagation(),s.preventDefault())}},"_loop2"),l=0;l1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},"unmergeAt"),unmergeOne:v(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},"unmergeOne"),unmerge:v(function(e){var t=this._private.cy;if(!e)return this;if(e&&he(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},"unmergeBy"),map:v(function(e,t){for(var a=[],n=this,i=0;ia&&(a=l,n=o)}return{value:a,ele:n}},"max"),min:v(function(e,t){for(var a=1/0,n,i=this,s=0;s=0&&i"u"?"undefined":Ue(Symbol))!=e&&Ue(Symbol.iterator)!=e;t&&(an[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Us({next:v(function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},"parsedStyle"),numericStyle:v(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}},"numericStyle"),numericStyleUnits:v(function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},"numericStyleUnits"),renderedStyle:v(function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},"renderedStyle"),style:v(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(he(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 l=this[0];return l?i.getRawStyle(l):void 0}return this},"style"),removeStyle:v(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:v(function(e){return this.neighborhood().add(this).filter(e)},"closedNeighborhood"),openNeighborhood:v(function(e){return this.neighborhood(e)},"openNeighborhood")});ir.neighbourhood=ir.neighborhood;ir.closedNeighbourhood=ir.closedNeighborhood;ir.openNeighbourhood=ir.openNeighborhood;we(ir,{source:xr(v(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"sourceImpl"),"source"),target:xr(v(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"targetImpl"),"target"),sources:ws({attr:"source"}),targets:ws({attr:"target"})});function ws(r){return v(function(t){for(var a=[],n=0;n0);return s},"components"),component:v(function(){var e=this[0];return e.cy().mutableElements().components(e)[0]},"component")});ir.componentsOf=ir.components;var er=v(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){qe("A collection must have a reference to the core");return}var i=new Ir,s=!1;if(!t)t=[];else if(t.length>0&&Te(t[0])&&!xa(t[0])){s=!0;for(var o=[],l=new Vt,u=0,f=t.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],s=[],o,l=0,u=t.length;l0){for(var $=o.length===t.length?t:new er(a,o),H=0;H<$.length;H++){var V=$[H];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}var F;n.hasCompoundNodes?F=a.collection().merge($).merge($.connectedNodes()).merge($.parent()):F=$,F.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?$.emitAndNotify("add"):e&&$.emit("add")}return t};ze.removed=function(){var r=this[0];return r&&r._private.removed};ze.inside=function(){var r=this[0];return r&&!r._private.removed};ze.remove=function(){var r=arguments.length>0&&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(P){for(var I=P._private.edges,R=0;R0&&(r?B.emitAndNotify("remove"):e&&B.emit("remove"));for(var M=0;M0?M=P:B=P;while(Math.abs(A)>s&&++I=i?b(L,I):R===0?I:x(L,B,B+u)}v(T,"getTForX");var C=!1;function E(){C=!0,(r!==e||t!==a)&&w()}v(E,"precompute");var k=v(function(B){return C||E(),r===e&&t===a?B:B===0?0:B===1?1:y(T(B),e,a)},"f");k.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var S="generateBezier("+[r,e,t,a]+")";return k.toString=function(){return S},k}v(qh,"generateCubicBezier");var $h=function(){function r(a){return-a.tension*a.x-a.friction*a.v}v(r,"springAccelerationForState");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)}}v(e,"springEvaluateStateWithDerivative");function t(a,n){var i={dx:a.v,dv:r(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return v(t,"springIntegrateState"),v(function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,c=16/1e3,d,g,h;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,d=s!==null,d?(u=a(n,i),g=u/s*c):g=c;h=t(h||o,g),l.push(1+h.x),u+=16,Math.abs(h.x)>f&&Math.abs(h.v)>f;);return d?function(m){return l[m*(l.length-1)|0]}:u},"springRK4Factory")}(),Ie=v(function(e,t,a,n){var i=qh(e,t,a,n);return function(s,o,l){return s+(o-s)*i(l)}},"cubicBezier"),Ua={linear:v(function(e,t,a){return e+(t-e)*a},"linear"),ease:Ie(.25,.1,.25,1),"ease-in":Ie(.42,0,1,1),"ease-out":Ie(0,0,.58,1),"ease-in-out":Ie(.42,0,.58,1),"ease-in-sine":Ie(.47,0,.745,.715),"ease-out-sine":Ie(.39,.575,.565,1),"ease-in-out-sine":Ie(.445,.05,.55,.95),"ease-in-quad":Ie(.55,.085,.68,.53),"ease-out-quad":Ie(.25,.46,.45,.94),"ease-in-out-quad":Ie(.455,.03,.515,.955),"ease-in-cubic":Ie(.55,.055,.675,.19),"ease-out-cubic":Ie(.215,.61,.355,1),"ease-in-out-cubic":Ie(.645,.045,.355,1),"ease-in-quart":Ie(.895,.03,.685,.22),"ease-out-quart":Ie(.165,.84,.44,1),"ease-in-out-quart":Ie(.77,0,.175,1),"ease-in-quint":Ie(.755,.05,.855,.06),"ease-out-quint":Ie(.23,1,.32,1),"ease-in-out-quint":Ie(.86,0,.07,1),"ease-in-expo":Ie(.95,.05,.795,.035),"ease-out-expo":Ie(.19,1,.22,1),"ease-in-out-expo":Ie(1,0,0,1),"ease-in-circ":Ie(.6,.04,.98,.335),"ease-out-circ":Ie(.075,.82,.165,1),"ease-in-out-circ":Ie(.785,.135,.15,.86),spring:v(function(e,t,a){if(a===0)return Ua.linear;var n=$h(e,t,a);return function(i,s,o){return i+(s-i)*n(o)}},"spring"),"cubic-bezier":Ie};function Cs(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}v(Cs,"getEasedValue");function Ss(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}v(Ss,"getValue");function St(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var s=Ss(r,n),o=Ss(e,n);if(ie(s)&&ie(o))return Cs(i,s,o,t,a);if(Oe(s)&&Oe(o)){for(var l=[],u=0;u0?(g==="spring"&&h.push(s.duration),s.easingImpl=Ua[g].apply(null,h)):s.easingImpl=Ua[g]}var m=s.easingImpl,y;if(s.duration===0?y=1:y=(t-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var p=s.startPosition,b=s.position;if(b&&n&&!r.locked()){var w={};ra(p.x,b.x)&&(w.x=St(p.x,b.x,y,m)),ra(p.y,b.y)&&(w.y=St(p.y,b.y,y,m)),r.position(w)}var x=s.startPan,T=s.pan,C=i.pan,E=T!=null&&a;E&&(ra(x.x,T.x)&&(C.x=St(x.x,T.x,y,m)),ra(x.y,T.y)&&(C.y=St(x.y,T.y,y,m)),r.emit("pan"));var k=s.startZoom,S=s.zoom,L=S!=null&&a;L&&(ra(k,S)&&(i.zoom=da(i.minZoom,St(k,S,y,m),i.maxZoom)),r.emit("zoom")),(E||L)&&r.emit("viewport");var B=s.style;if(B&&B.length>0&&n){for(var M=0;M=0;E--){var k=C[E];k()}C.splice(0,C.length)},"callbacks"),b=g.length-1;b>=0;b--){var w=g[b],x=w._private;if(x.stopped){g.splice(b,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||Gh(f,w,r),Hh(f,w,r,c),x.applying&&(x.applying=!1),p(x.frames),x.step!=null&&x.step(r),w.completed()&&(g.splice(b,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.completes)),m=!0)}return!c&&g.length===0&&h.length===0&&a.push(f),m}v(n,"stepOne");for(var i=!1,s=0;s0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}v(Ts,"stepAll");var Kh={animate:Me.animate(),animation:Me.animation(),animated:Me.animated(),clearQueue:Me.clearQueue(),delay:Me.delay(),delayAnimation:Me.delayAnimation(),stop:Me.stop(),addToAnimationPool:v(function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},"addToAnimationPool"),stopAnimationLoop:v(function(){this._private.animationsRunning=!1},"stopAnimationLoop"),startAnimationLoop:v(function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&_a(v(function(i){Ts(i,e),t()},"animationStep"))}v(t,"headlessStep");var a=e.renderer();a&&a.beforeRender?a.beforeRender(v(function(i,s){Ts(s,e)},"rendererAnimationStep"),a.beforeRenderPriorities.animations):t()},"startAnimationLoop")},Wh={qualifierCompare:v(function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},"qualifierCompare"),eventMatches:v(function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&xa(a.target)&&n.matches(a.target):!0},"eventMatches"),addEventFields:v(function(e,t){t.cy=e,t.target=e},"addEventFields"),callbackContext:v(function(e,t,a){return t.qualifier!=null?a.target:e},"callbackContext")},Va=v(function(e){return he(e)?new et(e):e},"argSelector"),jo={createEmitter:v(function(){var e=this._private;return e.emitter||(e.emitter=new bn(Wh,this)),this},"createEmitter"),emitter:v(function(){return this._private.emitter},"emitter"),on:v(function(e,t,a){return this.emitter().on(e,Va(t),a),this},"on"),removeListener:v(function(e,t,a){return this.emitter().removeListener(e,Va(t),a),this},"removeListener"),removeAllListeners:v(function(){return this.emitter().removeAllListeners(),this},"removeAllListeners"),one:v(function(e,t,a){return this.emitter().one(e,Va(t),a),this},"one"),once:v(function(e,t,a){return this.emitter().one(e,Va(t),a),this},"once"),emit:v(function(e,t){return this.emitter().emit(e,t),this},"emit"),emitAndNotify:v(function(e,t){return this.emit(e),this.notify(e,t),this},"emitAndNotify")};Me.eventAliasesOn(jo);var Xn={png:v(function(e){var t=this._private.renderer;return e=e||{},t.png(e)},"png"),jpg:v(function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)},"jpg")};Xn.jpeg=Xn.jpg;var Ya={layout:v(function(e){var t=this;if(e==null){qe("Layout options must be specified to make a layout");return}if(e.name==null){qe("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){qe("No such layout `"+a+"` found.  Did you forget to import it and `cytoscape.use()` it?");return}var i;he(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var s=new n(we({},e,{cy:t,eles:i}));return s},"layout")};Ya.createLayout=Ya.makeLayout=Ya.layout;var Uh={notify:v(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)}},"notify"),notifications:v(function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},"notifications"),noNotifications:v(function(e){this.notifications(!1),e(),this.notifications(!0)},"noNotifications"),batching:v(function(){return this._private.batchCount>0},"batching"),startBatch:v(function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},"startBatch"),endBatch:v(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},"endBatch"),batch:v(function(e){return this.startBatch(),e(),this.endBatch(),this},"batch"),batchData:v(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=[]})},"destroyRenderer"),onRender:v(function(e){return this.on("render",e)},"onRender"),offRender:v(function(e){return this.off("render",e)},"offRender")};Zn.invalidateDimensions=Zn.resize;var Xa={collection:v(function(e,t){return he(e)?this.$(e):pr(e)?e.collection():Oe(e)?(t||(t={}),new er(this,e,t.unique,t.removed)):new er(this)},"collection"),nodes:v(function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},"nodes"),edges:v(function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},"edges"),$:v(function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},"$"),mutableElements:v(function(){return this._private.elements},"mutableElements")};Xa.elements=Xa.filter=Xa.$;var or={},oa="t",Xh="f";or.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(d||c&&g){var h=void 0;d&&g||d?h=u.properties:g&&(h=u.mappedProperties);for(var m=0;m1&&(x=1),o.color){var C=a.valueMin[0],E=a.valueMax[0],k=a.valueMin[1],S=a.valueMax[1],L=a.valueMin[2],B=a.valueMax[2],M=a.valueMin[3]==null?1:a.valueMin[3],A=a.valueMax[3]==null?1:a.valueMax[3],P=[Math.round(C+(E-C)*x),Math.round(k+(S-k)*x),Math.round(L+(B-L)*x),Math.round(M+(A-M)*x)];i={bypass:a.bypass,name:a.name,value:P,strValue:"rgb("+P[0]+", "+P[1]+", "+P[2]+")"}}else if(o.number){var I=a.valueMin+(a.valueMax-a.valueMin)*x;i=this.parse(a.name,I,a.bypass,d)}else return!1;if(!i)return m(),!1;i.mapping=a,a=i;break}case s.data:{for(var R=a.field.split("."),O=c.data,z=0;z0&&i>0){for(var o={},l=!1,u=0;u0?r.delayAnimation(s).play().promise().then(w):w()}).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)};or.checkTrigger=function(r,e,t,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(t,a)&&i(s)};or.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)})};or.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(t==="bezier"||a==="bezier")&&r.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(t==="none"||a==="none")&&r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};or.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a)};var Ta={};Ta.applyBypass=function(r,e,t,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}v(o,"removeSelAndBlockFromRemaining");function l(){i.length>s.length?i=i.substr(s.length):i=""}for(v(l,"removePropAndValFromRem");;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Le("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var c=f[1];if(c!=="core"){var d=new et(c);if(d.invalid){Le("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),o();continue}}var g=f[2],h=!1;i=g;for(var m=[];;){var y=i.match(/^\s*$/);if(y)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Le("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+g),h=!0;break}s=p[0];var b=p[1],w=p[2],x=e.properties[b];if(!x){Le("Skipping property: Invalid property name in: "+s),l();continue}var T=t.parse(b,w);if(!T){Le("Skipping property: Invalid property definition in: "+s),l();continue}m.push({name:b,val:w}),l()}if(h){o();break}t.selector(c);for(var C=0;C=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(t)return!1;var d=o.data;return{name:r,value:f,strValue:""+e,mapped:d,field:f[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(c=new RegExp(o.mapData.regex).exec(e))){if(t||u.multiple)return!1;var g=o.mapData;if(!(u.color||u.number))return!1;var h=this.parse(r,c[4]);if(!h||h.mapped)return!1;var m=this.parse(r,c[5]);if(!m||m.mapped)return!1;if(h.pfValue===m.pfValue||h.strValue===m.strValue)return Le("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+h.strValue+"`"),this.parse(r,h.strValue);if(u.color){var y=h.value,p=m.value,b=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(b)return!1}return{name:r,value:c,strValue:""+e,mapped:g,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:h.value,valueMax:m.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var w;if(l?w=e.split(/\s+/):Oe(e)?w=e:w=[e],u.evenMultiple&&w.length%2!==0)return null;for(var x=[],T=[],C=[],E="",k=!1,S=0;S0?" ":"")+L.strValue}return u.validate&&!u.validate(x,T)?null:u.singleEnum&&k?x.length===1&&he(x[0])?{name:r,value:x[0],strValue:x[0],bypass:t}:null:{name:r,value:x,pfValue:C,strValue:E,bypass:t,units:T}}var B=v(function(){for(var N=0;Nu.max||u.strictMax&&e===u.max))return null;var R={name:r,value:e,strValue:""+e+(M||""),units:M,bypass:t};return u.unitless||M!=="px"&&M!=="em"?R.pfValue=e:R.pfValue=M==="px"||!M?e:this.getEmSizeInPixels()*e,(M==="ms"||M==="s")&&(R.pfValue=M==="ms"?e:1e3*e),(M==="deg"||M==="rad")&&(R.pfValue=M==="rad"?e:Pv(e)),M==="%"&&(R.pfValue=e/100),R}else if(u.propList){var O=[],z=""+e;if(z!=="none"){for(var $=z.split(/\s*,\s*|\s+/),H=0;H<$.length;H++){var V=$[H].trim();n.properties[V]?O.push(V):Le("`"+V+"` is not a valid property name")}if(O.length===0)return null}return{name:r,value:O,strValue:O.length===0?"none":O.join(" "),bypass:t}}else if(u.color){var F=fl(e);return F?{name:r,value:F,pfValue:F,strValue:"rgb("+F[0]+","+F[1]+","+F[2]+")",bypass:t}:null}else if(u.regex||u.regexes){if(u.enums){var U=B();if(U)return U}for(var J=u.regexes?u.regexes:[u.regex],j=0;j0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*t)/a.w,(o-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.maxZoom=t),this},"zoomRange"),minZoom:v(function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},"minZoom"),maxZoom:v(function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},"maxZoom"),getZoomedViewport:v(function(e){var t=this._private,a=t.pan,n=t.zoom,i,s,o=!1;if(t.zoomingEnabled||(o=!0),ie(e)?s=e:Te(e)&&(s=e.level,e.position!=null?i=dn(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=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ie(u.x)&&(t.pan.x=u.x,o=!1),ie(u.y)&&(t.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},"viewport"),center:v(function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},"center"),getCenterPan:v(function(e,t){if(this._private.panningEnabled){if(he(e)){var a=e;e=this.mutableElements().filter(a)}else pr(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}}},"getCenterPan"),reset:v(function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},"reset"),invalidateSize:v(function(){this._private.sizeCache=null},"invalidateSize"),size:v(function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=v(function(o){return parseFloat(n.getPropertyValue(o))},"val");return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},"size"),width:v(function(){return this.size().width},"width"),height:v(function(){return this.size().height},"height"),extent:v(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},"extent"),renderedExtent:v(function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},"renderedExtent"),multiClickDebounceTime:v(function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this},"multiClickDebounceTime")};yt.centre=yt.center;yt.autolockNodes=yt.autolock;yt.autoungrabifyNodes=yt.autoungrabify;var ma={data:Me.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Me.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Me.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Me.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ma.attr=ma.data;ma.removeAttr=ma.removeData;var ba=v(function(e){var t=this;e=we({},e);var a=e.container;a&&!Ja(a)&&Ja(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=Ke!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=we({name:s?"grid":"null"},o.layout),o.renderer=we({name:s?"canvas":"null"},o.renderer);var l=v(function(h,m,y){return m!==void 0?m:y!==void 0?y:h},"defVal"),u=this._private={container:a,ready:!1,options:o,elements:new er(this),listeners:[],aniEles:new er(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ie(o.zoom)?o.zoom:1,pan:{x:Te(o.pan)&&ie(o.pan.x)?o.pan.x:0,y:Te(o.pan)&&ie(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=v(function(h,m){var y=h.some(_u);if(y)return qt.all(h).then(m);m(h)},"loadExtData");u.styleEnabled&&t.setStyle([]);var c=we({},o,o.renderer);t.initRenderer(c);var d=v(function(h,m,y){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),h!=null&&(Te(h)||Oe(h))&&t.add(h),t.one("layoutready",function(w){t.notifications(!0),t.emit(w),t.one("load",m),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",y),t.emit("done")});var b=we({},t._private.options.layout);b.eles=t.elements(),t.layout(b).run()},"setElesAndLayout");f([o.style,o.elements],function(g){var h=g[0],m=g[1];u.styleEnabled&&t.style().append(h),d(m,function(){t.startAnimationLoop(),u.ready=!0,Ve(o.ready)&&t.on("ready",o.ready);for(var y=0;y0,l=gr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),u;if(pr(e.roots))u=e.roots;else if(Oe(e.roots)){for(var f=[],c=0;c0;){var I=P(),R=L(I,M);if(R)I.outgoers().filter(function(ne){return ne.isNode()&&a.has(ne)}).forEach(A);else if(R===null){Le("Detected double maximal shift for node `"+I.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}S();var O=0;if(e.avoidOverlap)for(var z=0;z0&&p[0].length<=3?Ee/2:0),D=2*Math.PI/p[de].length*fe;return de===0&&p[0].length===1&&(_=1),{x:Z.x+_*Math.cos(D),y:Z.y+_*Math.sin(D)}}else{var De={x:Z.x+(fe+1-(ye+1)/2)*Be,y:(de+1)*Ce};return De}},"getPosition");return a.nodes().layoutPositions(this,e,ge),this};var jh={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:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function ru(r){this.options=we({},jh,r)}v(ru,"CircleLayout");ru.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=gr(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},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,c=0,d=0;d1&&e.avoidOverlap){c*=1.75;var p=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),w=Math.sqrt(c*c/(p*p+b*b));f=Math.max(w,f)}var x=v(function(C,E){var k=e.startAngle+E*u*(n?1:-1),S=f*Math.cos(k),L=f*Math.sin(k),B={x:o.x+S,y:o.y+L};return B},"getPos");return a.nodes().layoutPositions(this,e,x),this};var eg={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:v(function(e){return e.degree()},"concentric"),levelWidth:v(function(e){return e.maxDegree()/4},"levelWidth"),animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function tu(r){this.options=we({},eg,r)}v(tu,"ConcentricLayout");tu.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=gr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f0){var T=Math.abs(b[0].value-x.value);T>=y&&(b=[],p.push(b))}b.push(x)}var C=u+e.minNodeSpacing;if(!e.avoidOverlap){var E=p.length>0&&p[0].length>1,k=Math.min(s.w,s.h)/2-C,S=k/(p.length+E?1:0);C=Math.min(C,S)}for(var L=0,B=0;B1&&e.avoidOverlap){var I=Math.cos(P)-Math.cos(0),R=Math.sin(P)-Math.sin(0),O=Math.sqrt(C*C/(I*I+R*R));L=Math.max(O,L)}M.r=L,L+=C}if(e.equidistant){for(var z=0,$=0,H=0;H=r.numIter||(ug(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),_a(c)}},"frame");f()}else{for(;u;)u=s(l),l++;Ps(a,r),o()}return this};Sn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Sn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var tg=v(function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=gr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},f=0;f0){o.graphSet.push(k);for(var f=0;fn.count?0:n.graph},"findLCA"),ng=v(function r(e,t,a,n){var i=n.graphSet[a];if(-10)var c=n.nodeOverlap*f,d=Math.sqrt(o*o+l*l),g=c*o/d,h=c*l/d;else var m=sn(e,o,l),y=sn(t,-1*o,-1*l),p=y.x-m.x,b=y.y-m.y,w=p*p+b*b,d=Math.sqrt(w),c=(e.nodeRepulsion+t.nodeRepulsion)/w,g=c*p/d,h=c*b/d;e.isLocked||(e.offsetX-=g,e.offsetY-=h),t.isLocked||(t.offsetX+=g,t.offsetY+=h)}},"nodeRepulsion"),fg=v(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},"nodesOverlap"),sn=v(function(e,t,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/t,u=s/o,f={};return t===0&&0a?(f.x=n,f.y=i+s/2,f):0t&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/t,f):0=u)?(f.x=n+s*t/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*t/2/a,f.y=i-s/2),f)},"findClippingPoint"),cg=v(function(e,t){for(var a=0;aa){var y=t.gravity*g/m,p=t.gravity*h/m;d.offsetX+=y,d.offsetY+=p}}}}},"calculateGravityForces"),hg=v(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],l=e.layoutNodes[o],u=l.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},"limitForce"),yg=v(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&&(h+=y+t.componentSpacing,g=0,m=0,y=0)}}},"separateComponents"),mg={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:v(function(e){},"position"),sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:v(function(e,t){return!0},"animateFilter"),ready:void 0,stop:void 0,transform:v(function(e,t){return t},"transform")};function nu(r){this.options=we({},mg,r)}v(nu,"GridLayout");nu.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=gr(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),l=Math.round(o),u=Math.round(i.w/i.h*o),f=v(function(J){if(J==null)return Math.min(l,u);var j=Math.min(l,u);j==l?l=J:u=J},"small"),c=v(function(J){if(J==null)return Math.max(l,u);var j=Math.max(l,u);j==l?l=J:u=J},"large"),d=e.rows,g=e.cols!=null?e.cols:e.columns;if(d!=null&&g!=null)l=d,u=g;else if(d!=null&&g==null)l=d,u=Math.ceil(s/l);else if(d==null&&g!=null)u=g,l=Math.ceil(s/u);else if(u*l>s){var h=f(),m=c();(h-1)*m>=s?f(h-1):(m-1)*h>=s&&c(m-1)}else for(;u*l=s?c(p+1):f(y+1)}var b=i.w/u,w=i.h/l;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var x=0;x=u&&(I=0,P++)},"moveToNextCell"),O={},z=0;z(I=$v(r,e,R[O],R[O+1],R[O+2],R[O+3])))return y(E,I),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var R=S.allpts,O=0;O+5(I=qv(r,e,R[O],R[O+1],R[O+2],R[O+3],R[O+4],R[O+5])))return y(E,I),!0}for(var z=z||k.source,$=$||k.target,H=n.getArrowWidth(L,B),V=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],O=0;O0&&(p(z),p($))}v(b,"checkEdge");function w(E,k,S){return Pr(E,k,S)}v(w,"preprop");function x(E,k){var S=E._private,L=d,B;k?B=k+"-":B="",E.boundingBox();var M=S.labelBounds[k||"main"],A=E.pstyle(B+"label").value,P=E.pstyle("text-events").strValue==="yes";if(!(!P||!A)){var I=w(S.rscratch,"labelX",k),R=w(S.rscratch,"labelY",k),O=w(S.rscratch,"labelAngle",k),z=E.pstyle(B+"text-margin-x").pfValue,$=E.pstyle(B+"text-margin-y").pfValue,H=M.x1-L-z,V=M.x2+L-z,F=M.y1-L-$,U=M.y2+L-$;if(O){var J=Math.cos(O),j=Math.sin(O),ee=v(function(ge,ne){return ge=ge-I,ne=ne-R,{x:ge*J-ne*j+I,y:ge*j+ne*J+R}},"rotate"),re=ee(H,F),Y=ee(H,U),N=ee(V,F),X=ee(V,U),Z=[re.x+z,re.y+$,N.x+z,N.y+$,X.x+z,X.y+$,Y.x+z,Y.y+$];if(hr(r,e,Z))return y(E),!0}else if(It(M,r,e))return y(E),!0}}v(x,"checkLabel");for(var T=s.length-1;T>=0;T--){var C=s[T];C.isNode()?p(C)||x(C):b(C)||x(C)||x(C,"source")||x(C,"target")}return o};bt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(r,t),o=Math.max(r,t),l=Math.min(e,a),u=Math.max(e,a);r=s,t=o,e=l,a=u;for(var f=gr({x1:r,y1:e,x2:t,y2:a}),c=0;c0?-(Math.PI-e.ang):Math.PI+e.ang},"invertVec"),Sg=v(function(e,t,a,n,i){if(e!==Rs?Os(t,e,Rr):Cg(br,Rr),Os(t,a,br),Ls=Rr.nx*br.ny-Rr.ny*br.nx,As=Rr.nx*br.nx-Rr.ny*-br.ny,qr=Math.asin(Math.max(-1,Math.min(1,Ls))),Math.abs(qr)<1e-6){Qn=t.x,Jn=t.y,lt=Dt=0;return}vt=1,Za=!1,As<0?qr<0?qr=Math.PI+qr:(qr=Math.PI-qr,vt=-1,Za=!0):qr>0&&(vt=-1,Za=!0),t.radius!==void 0?Dt=t.radius:Dt=n,it=qr/2,qa=Math.min(Rr.len/2,br.len/2),i?(Ar=Math.abs(Math.cos(it)*Dt/Math.sin(it)),Ar>qa?(Ar=qa,lt=Math.abs(Ar*Math.sin(it)/Math.cos(it))):lt=Dt):(Ar=Math.min(qa,Dt),lt=Math.abs(Ar*Math.sin(it)/Math.cos(it))),_n=t.x+br.nx*Ar,jn=t.y+br.ny*Ar,Qn=_n-br.ny*lt*vt,Jn=jn+br.nx*lt*vt,uu=t.x+Rr.nx*Ar,lu=t.y+Rr.ny*Ar,Rs=t},"calcCornerArc");function vu(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}v(vu,"drawPreparedRoundCorner");function Ti(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Sg(r,e,t,a,n),{cx:Qn,cy:Jn,radius:lt,startX:uu,startY:lu,stopX:_n,stopY:jn,startAngle:Rr.ang+Math.PI/2*vt,endAngle:br.ang-Math.PI/2*vt,counterClockwise:Za})}v(Ti,"getRoundCorner");var ur={};ur.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=r.pstyle("source-endpoint"),o=r.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=v(function(T,C,E,k){var S=k-C,L=E-T,B=Math.sqrt(L*L+S*S);return{x:-S/B,y:L/B}},"recalcVectorNormInverse"),f=r.pstyle("edge-distances").value;switch(f){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var c=this.manualEndptToPx(r.source()[0],s),d=Dr(c,2),g=d[0],h=d[1],m=this.manualEndptToPx(r.target()[0],o),y=Dr(m,2),p=y[0],b=y[1],w={x1:g,y1:h,x2:p,y2:b};n=u(g,h,p,b),i=w}else Le("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};ur.findHaystackPoints=function(r){for(var e=0;e0?Math.max(me-be,0):Math.min(me+be,0)},"subDWH"),A=M(L,k),P=M(B,S),I=!1;b===u?p=Math.abs(A)>Math.abs(P)?n:a:b===l||b===o?(p=a,I=!0):(b===i||b===s)&&(p=n,I=!0);var R=p===a,O=R?P:A,z=R?B:L,$=ho(z),H=!1;!(I&&(x||C))&&(b===o&&z<0||b===l&&z>0||b===i&&z>0||b===s&&z<0)&&($*=-1,O=$*Math.abs(O),H=!0);var V;if(x){var F=T<0?1+T:T;V=F*O}else{var U=T<0?O:0;V=U+T*$}var J=v(function(me){return Math.abs(me)=Math.abs(O)},"getIsTooClose"),j=J(V),ee=J(Math.abs(O)-Math.abs(V)),re=j||ee;if(re&&!H)if(R){var Y=Math.abs(z)<=d/2,N=Math.abs(L)<=g/2;if(Y){var X=(f.x1+f.x2)/2,Z=f.y1,oe=f.y2;t.segpts=[X,Z,X,oe]}else if(N){var ge=(f.y1+f.y2)/2,ne=f.x1,se=f.x2;t.segpts=[ne,ge,se,ge]}else t.segpts=[f.x1,f.y2]}else{var le=Math.abs(z)<=c/2,de=Math.abs(B)<=h/2;if(le){var fe=(f.y1+f.y2)/2,ye=f.x1,Be=f.x2;t.segpts=[ye,fe,Be,fe]}else if(de){var Ce=(f.x1+f.x2)/2,Ee=f.y1,De=f.y2;t.segpts=[Ce,Ee,Ce,De]}else t.segpts=[f.x2,f.y1]}else if(R){var _=f.y1+V+(y?d/2*$:0),D=f.x1,q=f.x2;t.segpts=[D,_,q,_]}else{var Q=f.x1+V+(y?c/2*$:0),K=f.y1,G=f.y2;t.segpts=[Q,K,Q,G]}if(t.isRound){var ae=r.pstyle("taxi-radius").value,W=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(ae),t.isArcRadius=new Array(t.segpts.length/2).fill(W)}};ur.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,l=e.tgtH,u=e.srcShape,f=e.tgtShape,c=e.srcCornerRadius,d=e.tgtCornerRadius,g=e.srcRs,h=e.tgtRs,m=!ie(t.startX)||!ie(t.startY),y=!ie(t.arrowStartX)||!ie(t.arrowStartY),p=!ie(t.endX)||!ie(t.endY),b=!ie(t.arrowEndX)||!ie(t.arrowEndY),w=3,x=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,T=w*x,C=ht({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),E=CP.poolIndex()){var I=A;A=P,P=I}var R=S.srcPos=A.position(),O=S.tgtPos=P.position(),z=S.srcW=A.outerWidth(),$=S.srcH=A.outerHeight(),H=S.tgtW=P.outerWidth(),V=S.tgtH=P.outerHeight(),F=S.srcShape=t.nodeShapes[e.getNodeShape(A)],U=S.tgtShape=t.nodeShapes[e.getNodeShape(P)],J=S.srcCornerRadius=A.pstyle("corner-radius").value==="auto"?"auto":A.pstyle("corner-radius").pfValue,j=S.tgtCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,ee=S.tgtRs=P._private.rscratch,re=S.srcRs=A._private.rscratch;S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var Y=0;Y0){var oe=i,ge=ot(oe,Pt(t)),ne=ot(oe,Pt(Z)),se=ge;if(ne2){var le=ot(oe,{x:Z[2],y:Z[3]});le0){var G=s,ae=ot(G,Pt(t)),W=ot(G,Pt(K)),te=ae;if(W2){var me=ot(G,{x:K[2],y:K[3]});me=h||E){y={cp:x,segment:C};break}}if(y)break}var k=y.cp,S=y.segment,L=(h-p)/S.length,B=S.t1-S.t0,M=g?S.t0+B*L:S.t1-B*L;M=da(0,M,1),e=Mt(k.p0,k.p1,k.p2,M),d=Dg(k.p0,k.p1,k.p2,M);break}case"straight":case"segments":case"haystack":{for(var A=0,P,I,R,O,z=a.allpts.length,$=0;$+3=h));$+=2);var H=h-I,V=H/P;V=da(0,V,1),e=Mv(R,O,V),d=du(R,O);break}}s("labelX",c,e.x),s("labelY",c,e.y),s("labelAutoAngle",c,d)}},"calculateEndProjection");u("source"),u("target"),this.applyLabelDimensions(r)}};Nr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Nr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=this.calculateLabelDimensions(r,a),i=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,o=Pr(t.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,c=n.width,d=n.height+(l-1)*(i-1)*u;Xr(t.rstyle,"labelWidth",e,c),Xr(t.rscratch,"labelWidth",e,c),Xr(t.rstyle,"labelHeight",e,d),Xr(t.rscratch,"labelHeight",e,d),Xr(t.rscratch,"labelLineHeight",e,f)};Nr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,s=v(function(U,J){return J?(Xr(t.rscratch,U,e,J),J):Pr(t.rscratch,U,e)},"rscratch");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 l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",f=n.split(`
`),c=r.pstyle("text-max-width").pfValue,d=r.pstyle("text-overflow-wrap").value,g=d==="anywhere",h=[],m=/[\s\u200b]+|$/g,y=0;yc){var T=p.matchAll(m),C="",E=0,k=Xs(T),S;try{for(k.s();!(S=k.n()).done;){var L=S.value,B=L[0],M=p.substring(E,L.index);E=L.index+B.length;var A=C.length===0?M:C+M+B,P=this.calculateLabelDimensions(r,A),I=P.width;I<=c?C+=M+B:(C&&h.push(C),C=M+B)}}catch(F){k.e(F)}finally{k.f()}C.match(/^[\s\u200b]+$/)||h.push(C)}else h.push(p)}s("labelWrapCachedLines",h),n=s("labelWrapCachedText",h.join(`
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var R=r.pstyle("text-max-width").pfValue,O="",z="\u2026",$=!1;if(this.calculateLabelDimensions(r,n).widthR)break;O+=n[H],H===n.length-1&&($=!0)}return $||(O+=z),O}return n};Nr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Nr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=dt(e,r._private.labelDimsKey),s=t.labelDimCache||(t.labelDimCache=[]),o=s[i];if(o!=null)return o;var l=0,u=r.pstyle("font-style").strValue,f=r.pstyle("font-size").pfValue,c=r.pstyle("font-family").strValue,d=r.pstyle("font-weight").strValue,g=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!g){g=this.labelCalcCanvas=n.createElement("canvas"),h=this.labelCalcCanvasContext=g.getContext("2d");var m=g.style;m.position="absolute",m.left="-9999px",m.top="-9999px",m.zIndex="-1",m.visibility="hidden",m.pointerEvents="none"}h.font="".concat(u," ").concat(d," ").concat(f,"px ").concat(c);for(var y=0,p=0,b=e.split(`
`),w=0;w1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l=r.desktopTapThreshold2}var vr=n(D);Re&&(r.hoverData.tapholdCancelled=!0);var Er=v(function(){var Lr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Lr.length===0?(Lr.push(pe[0]),Lr.push(pe[1])):(Lr[0]+=pe[0],Lr[1]+=pe[1])},"updateDragDelta");Q=!0,a(ce,["mousemove","vmousemove","tapdrag"],D,{x:W[0],y:W[1]});var mr=v(function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||K.emit({originalEvent:D,type:"boxstart",position:{x:W[0],y:W[1]}}),be[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()},"goIntoBoxMode");if(r.hoverData.which===3){if(Re){var dr={originalEvent:D,type:"cxtdrag",position:{x:W[0],y:W[1]}};ve?ve.emit(dr):K.emit(dr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||ce!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:D,type:"cxtdragout",position:{x:W[0],y:W[1]}}),r.hoverData.cxtOver=ce,ce&&ce.emit({originalEvent:D,type:"cxtdragover",position:{x:W[0],y:W[1]}}))}}else if(r.hoverData.dragging){if(Q=!0,K.panningEnabled()&&K.userPanningEnabled()){var Mr;if(r.hoverData.justStartedPan){var Vr=r.hoverData.mdownPos;Mr={x:(W[0]-Vr[0])*G,y:(W[1]-Vr[1])*G},r.hoverData.justStartedPan=!1}else Mr={x:pe[0]*G,y:pe[1]*G};K.panBy(Mr),K.emit("dragpan"),r.hoverData.dragged=!0}W=r.projectIntoViewport(D.clientX,D.clientY)}else if(be[4]==1&&(ve==null||ve.pannable())){if(Re){if(!r.hoverData.dragging&&K.boxSelectionEnabled()&&(vr||!K.panningEnabled()||!K.userPanningEnabled()))mr();else if(!r.hoverData.selecting&&K.panningEnabled()&&K.userPanningEnabled()){var Cr=i(ve,r.hoverData.downs);Cr&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,be[4]=0,r.data.bgActivePosistion=Pt(te),r.redrawHint("select",!0),r.redraw())}ve&&ve.pannable()&&ve.active()&&ve.unactivate()}}else{if(ve&&ve.pannable()&&ve.active()&&ve.unactivate(),(!ve||!ve.grabbed())&&ce!=xe&&(xe&&a(xe,["mouseout","tapdragout"],D,{x:W[0],y:W[1]}),ce&&a(ce,["mouseover","tapdragover"],D,{x:W[0],y:W[1]}),r.hoverData.last=ce),ve)if(Re){if(K.boxSelectionEnabled()&&vr)ve&&ve.grabbed()&&(y(Fe),ve.emit("freeon"),Fe.emit("free"),r.dragData.didDrag&&(ve.emit("dragfreeon"),Fe.emit("dragfree"))),mr();else if(ve&&ve.grabbed()&&r.nodeIsDraggable(ve)){var Ge=!r.dragData.didDrag;Ge&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||h(Fe,{inDragLayer:!0});var Xe={x:0,y:0};if(ie(pe[0])&&ie(pe[1])&&(Xe.x+=pe[0],Xe.y+=pe[1],Ge)){var ar=r.hoverData.dragDelta;ar&&ie(ar[0])&&ie(ar[1])&&(Xe.x+=ar[0],Xe.y+=ar[1])}r.hoverData.draggingEles=!0,Fe.silentShift(Xe).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else Er();Q=!0}if(be[2]=W[0],be[3]=W[1],Q)return D.stopPropagation&&D.stopPropagation(),D.preventDefault&&D.preventDefault(),!1}},"mousemoveHandler"),!1);var L,B,M;r.registerBinding(e,"mouseup",v(function(D){if(!(r.hoverData.which===1&&D.which!==1&&r.hoverData.capture)){var q=r.hoverData.capture;if(q){r.hoverData.capture=!1;var Q=r.cy,K=r.projectIntoViewport(D.clientX,D.clientY),G=r.selection,ae=r.findNearestElement(K[0],K[1],!0,!1),W=r.dragData.possibleDragElements,te=r.hoverData.down,me=n(D);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,te&&te.unactivate(),r.hoverData.which===3){var be={originalEvent:D,type:"cxttapend",position:{x:K[0],y:K[1]}};if(te?te.emit(be):Q.emit(be),!r.hoverData.cxtDragged){var ce={originalEvent:D,type:"cxttap",position:{x:K[0],y:K[1]}};te?te.emit(ce):Q.emit(ce)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(ae,["mouseup","tapend","vmouseup"],D,{x:K[0],y:K[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(te,["click","tap","vclick"],D,{x:K[0],y:K[1]}),B=!1,D.timeStamp-M<=Q.multiClickDebounceTime()?(L&&clearTimeout(L),B=!0,M=null,a(te,["dblclick","dbltap","vdblclick"],D,{x:K[0],y:K[1]})):(L=setTimeout(function(){B||a(te,["oneclick","onetap","voneclick"],D,{x:K[0],y:K[1]})},Q.multiClickDebounceTime()),M=D.timeStamp)),te==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!n(D)&&(Q.$(t).unselect(["tapunselect"]),W.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=W=Q.collection()),ae==te&&!r.dragData.didDrag&&!r.hoverData.selecting&&ae!=null&&ae._private.selectable&&(r.hoverData.dragging||(Q.selectionType()==="additive"||me?ae.selected()?ae.unselect(["tapunselect"]):ae.select(["tapselect"]):me||(Q.$(t).unmerge(ae).unselect(["tapunselect"]),ae.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var xe=Q.collection(r.getAllInBox(G[0],G[1],G[2],G[3]));r.redrawHint("select",!0),xe.length>0&&r.redrawHint("eles",!0),Q.emit({type:"boxend",originalEvent:D,position:{x:K[0],y:K[1]}});var ve=v(function(Re){return Re.selectable()&&!Re.selected()},"eleWouldBeSelected");Q.selectionType()==="additive"||me||Q.$(t).unmerge(xe).unselect(),xe.emit("box").stdFilter(ve).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!G[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var pe=te&&te.grabbed();y(W),pe&&(te.emit("freeon"),W.emit("free"),r.dragData.didDrag&&(te.emit("dragfreeon"),W.emit("dragfree")))}}G[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}}},"mouseupHandler"),!1);var A=v(function(D){if(!r.scrollingPage){var q=r.cy,Q=q.zoom(),K=q.pan(),G=r.projectIntoViewport(D.clientX,D.clientY),ae=[G[0]*Q+K.x,G[1]*Q+K.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||k()){D.preventDefault();return}if(q.panningEnabled()&&q.userPanningEnabled()&&q.zoomingEnabled()&&q.userZoomingEnabled()){D.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 W;D.deltaY!=null?W=D.deltaY/-250:D.wheelDeltaY!=null?W=D.wheelDeltaY/1e3:W=D.wheelDelta/1e3,W=W*r.wheelSensitivity;var te=D.deltaMode===1;te&&(W*=33);var me=q.zoom()*Math.pow(10,W);D.type==="gesturechange"&&(me=r.gestureStartZoom*D.scale),q.zoom({level:me,renderedPosition:{x:ae[0],y:ae[1]}}),q.emit(D.type==="gesturechange"?"pinchzoom":"scrollzoom")}}},"wheelHandler");r.registerBinding(r.container,"wheel",A,!0),r.registerBinding(e,"scroll",v(function(D){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},"scrollHandler"),!0),r.registerBinding(r.container,"gesturestart",v(function(D){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||D.preventDefault()},"gestureStartHandler"),!0),r.registerBinding(r.container,"gesturechange",function(_){r.hasTouchStarted||A(_)},!0),r.registerBinding(r.container,"mouseout",v(function(D){var q=r.projectIntoViewport(D.clientX,D.clientY);r.cy.emit({originalEvent:D,type:"mouseout",position:{x:q[0],y:q[1]}})},"mouseOutHandler"),!1),r.registerBinding(r.container,"mouseover",v(function(D){var q=r.projectIntoViewport(D.clientX,D.clientY);r.cy.emit({originalEvent:D,type:"mouseover",position:{x:q[0],y:q[1]}})},"mouseOverHandler"),!1);var P,I,R,O,z,$,H,V,F,U,J,j,ee,re=v(function(D,q,Q,K){return Math.sqrt((Q-D)*(Q-D)+(K-q)*(K-q))},"distance"),Y=v(function(D,q,Q,K){return(Q-D)*(Q-D)+(K-q)*(K-q)},"distanceSq"),N;r.registerBinding(r.container,"touchstart",N=v(function(D){if(r.hasTouchStarted=!0,!!S(D)){b(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var q=r.cy,Q=r.touchData.now,K=r.touchData.earlier;if(D.touches[0]){var G=r.projectIntoViewport(D.touches[0].clientX,D.touches[0].clientY);Q[0]=G[0],Q[1]=G[1]}if(D.touches[1]){var G=r.projectIntoViewport(D.touches[1].clientX,D.touches[1].clientY);Q[2]=G[0],Q[3]=G[1]}if(D.touches[2]){var G=r.projectIntoViewport(D.touches[2].clientX,D.touches[2].clientY);Q[4]=G[0],Q[5]=G[1]}if(D.touches[1]){r.touchData.singleTouchMoved=!0,y(r.dragData.touchDragEles);var ae=r.findContainerClientCoords();F=ae[0],U=ae[1],J=ae[2],j=ae[3],P=D.touches[0].clientX-F,I=D.touches[0].clientY-U,R=D.touches[1].clientX-F,O=D.touches[1].clientY-U,ee=0<=P&&P<=J&&0<=R&&R<=J&&0<=I&&I<=j&&0<=O&&O<=j;var W=q.pan(),te=q.zoom();z=re(P,I,R,O),$=Y(P,I,R,O),H=[(P+R)/2,(I+O)/2],V=[(H[0]-W.x)/te,(H[1]-W.y)/te];var me=200,be=me*me;if($=1){for(var Qe=r.touchData.startPosition=[null,null,null,null,null,null],He=0;He=r.touchTapThreshold2}if(q&&r.touchData.cxt){D.preventDefault();var Qe=D.touches[0].clientX-F,He=D.touches[0].clientY-U,cr=D.touches[1].clientX-F,Je=D.touches[1].clientY-U,vr=Y(Qe,He,cr,Je),Er=vr/$,mr=150,dr=mr*mr,Mr=1.5,Vr=Mr*Mr;if(Er>=Vr||vr>=dr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Cr={originalEvent:D,type:"cxttapend",position:{x:G[0],y:G[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(Cr),r.touchData.start=null):K.emit(Cr)}}if(q&&r.touchData.cxt){var Cr={originalEvent:D,type:"cxtdrag",position:{x:G[0],y:G[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Cr):K.emit(Cr),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var Ge=r.findNearestElement(G[0],G[1],!0,!0);(!r.touchData.cxtOver||Ge!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:D,type:"cxtdragout",position:{x:G[0],y:G[1]}}),r.touchData.cxtOver=Ge,Ge&&Ge.emit({originalEvent:D,type:"cxtdragover",position:{x:G[0],y:G[1]}}))}else if(q&&D.touches[2]&&K.boxSelectionEnabled())D.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||K.emit({originalEvent:D,type:"boxstart",position:{x:G[0],y:G[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,Q[4]=1,!Q||Q.length===0||Q[0]===void 0?(Q[0]=(G[0]+G[2]+G[4])/3,Q[1]=(G[1]+G[3]+G[5])/3,Q[2]=(G[0]+G[2]+G[4])/3+1,Q[3]=(G[1]+G[3]+G[5])/3+1):(Q[2]=(G[0]+G[2]+G[4])/3,Q[3]=(G[1]+G[3]+G[5])/3),r.redrawHint("select",!0),r.redraw();else if(q&&D.touches[1]&&!r.touchData.didSelect&&K.zoomingEnabled()&&K.panningEnabled()&&K.userZoomingEnabled()&&K.userPanningEnabled()){D.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Xe=r.dragData.touchDragEles;if(Xe){r.redrawHint("drag",!0);for(var ar=0;ar0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},"touchmoveHandler"),!1);var Z;r.registerBinding(e,"touchcancel",Z=v(function(D){var q=r.touchData.start;r.touchData.capture=!1,q&&q.unactivate()},"touchcancelHandler"));var oe,ge,ne,se;if(r.registerBinding(e,"touchend",oe=v(function(D){var q=r.touchData.start,Q=r.touchData.capture;if(Q)D.touches.length===0&&(r.touchData.capture=!1),D.preventDefault();else return;var K=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var G=r.cy,ae=G.zoom(),W=r.touchData.now,te=r.touchData.earlier;if(D.touches[0]){var me=r.projectIntoViewport(D.touches[0].clientX,D.touches[0].clientY);W[0]=me[0],W[1]=me[1]}if(D.touches[1]){var me=r.projectIntoViewport(D.touches[1].clientX,D.touches[1].clientY);W[2]=me[0],W[3]=me[1]}if(D.touches[2]){var me=r.projectIntoViewport(D.touches[2].clientX,D.touches[2].clientY);W[4]=me[0],W[5]=me[1]}q&&q.unactivate();var be;if(r.touchData.cxt){if(be={originalEvent:D,type:"cxttapend",position:{x:W[0],y:W[1]}},q?q.emit(be):G.emit(be),!r.touchData.cxtDragged){var ce={originalEvent:D,type:"cxttap",position:{x:W[0],y:W[1]}};q?q.emit(ce):G.emit(ce)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!D.touches[2]&&G.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var xe=G.collection(r.getAllInBox(K[0],K[1],K[2],K[3]));K[0]=void 0,K[1]=void 0,K[2]=void 0,K[3]=void 0,K[4]=0,r.redrawHint("select",!0),G.emit({type:"boxend",originalEvent:D,position:{x:W[0],y:W[1]}});var ve=v(function(dr){return dr.selectable()&&!dr.selected()},"eleWouldBeSelected");xe.emit("box").stdFilter(ve).select().emit("boxselect"),xe.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(q?.unactivate(),D.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!D.touches[1]){if(!D.touches[0]){if(!D.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var pe=r.dragData.touchDragEles;if(q!=null){var Fe=q._private.grabbed;y(pe),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Fe&&(q.emit("freeon"),pe.emit("free"),r.dragData.didDrag&&(q.emit("dragfreeon"),pe.emit("dragfree"))),a(q,["touchend","tapend","vmouseup","tapdragout"],D,{x:W[0],y:W[1]}),q.unactivate(),r.touchData.start=null}else{var Re=r.findNearestElement(W[0],W[1],!0,!0);a(Re,["touchend","tapend","vmouseup","tapdragout"],D,{x:W[0],y:W[1]})}var lr=r.touchData.startPosition[0]-W[0],Qe=lr*lr,He=r.touchData.startPosition[1]-W[1],cr=He*He,Je=Qe+cr,vr=Je*ae*ae;r.touchData.singleTouchMoved||(q||G.$(":selected").unselect(["tapunselect"]),a(q,["tap","vclick"],D,{x:W[0],y:W[1]}),ge=!1,D.timeStamp-se<=G.multiClickDebounceTime()?(ne&&clearTimeout(ne),ge=!0,se=null,a(q,["dbltap","vdblclick"],D,{x:W[0],y:W[1]})):(ne=setTimeout(function(){ge||a(q,["onetap","voneclick"],D,{x:W[0],y:W[1]})},G.multiClickDebounceTime()),se=D.timeStamp)),q!=null&&!r.dragData.didDrag&&q._private.selectable&&vr"u"){var le=[],de=v(function(D){return{clientX:D.clientX,clientY:D.clientY,force:1,identifier:D.pointerId,pageX:D.pageX,pageY:D.pageY,radiusX:D.width/2,radiusY:D.height/2,screenX:D.screenX,screenY:D.screenY,target:D.target}},"makeTouch"),fe=v(function(D){return{event:D,touch:de(D)}},"makePointer"),ye=v(function(D){le.push(fe(D))},"addPointer"),Be=v(function(D){for(var q=0;q0)return F[0]}return null},"getCurveT"),h=Object.keys(d),m=0;m0?g:yo(i,s,e,t,a,n,o,l)},"intersectLine"),checkPoint:v(function(e,t,a,n,i,s,o,l){l=l==="auto"?gt(n,i):l;var u=2*l;if(Hr(e,t,this.points,s,o,n,i-u,[0,-1],a)||Hr(e,t,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,c=i/2+2*a,d=[s-f,o-c,s-f,o,s+f,o,s+f,o-c];return!!(hr(e,t,d)||ft(e,t,u,u,s+n/2-l,o+i/2-l,a)||ft(e,t,u,u,s-n/2+l,o+i/2-l,a))},"checkPoint")}};Kr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",fr(3,0)),this.generateRoundPolygon("round-triangle",fr(3,0)),this.generatePolygon("rectangle",fr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",fr(5,0)),this.generateRoundPolygon("round-pentagon",fr(5,0)),this.generatePolygon("hexagon",fr(6,0)),this.generateRoundPolygon("round-hexagon",fr(6,0)),this.generatePolygon("heptagon",fr(7,0)),this.generateRoundPolygon("round-heptagon",fr(7,0)),this.generatePolygon("octagon",fr(8,0)),this.generateRoundPolygon("round-octagon",fr(8,0));var a=new Array(20);{var n=Hn(5,0),i=Hn(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*x)break}else if(u){if(b>=e.deqCost*g||b>=e.deqAvgCost*d)break}else if(w>=e.deqNoDrawCost*Vn)break;var T=e.deq(a,y,m);if(T.length>0)for(var C=0;C0&&(e.onDeqd(a,h),!u&&e.shouldRedraw(a,h,y,m)&&i())},"dequeue"),o=e.priority||li;n.beforeRender(s,o(a))}},"setupDequeueingImpl")},"setupDequeueing")},Pg=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ja;ni(this,r),this.idsByKey=new Ir,this.keyForId=new Ir,this.cachesByLvl=new Ir,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return v(r,"ElementTextureCacheLookup"),ii(r,[{key:"getIdsFor",value:v(function(t){t==null&&qe("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new Vt,a.set(t,n)),n},"getIdsFor")},{key:"addIdForKey",value:v(function(t,a){t!=null&&this.getIdsFor(t).add(a)},"addIdForKey")},{key:"deleteIdForKey",value:v(function(t,a){t!=null&&this.getIdsFor(t).delete(a)},"deleteIdForKey")},{key:"getNumberOfIdsForKey",value:v(function(t){return t==null?0:this.getIdsFor(t).size},"getNumberOfIdsForKey")},{key:"updateKeyMappingFor",value:v(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)},"updateKeyMappingFor")},{key:"deleteKeyMappingFor",value:v(function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)},"deleteKeyMappingFor")},{key:"keyHasChangedFor",value:v(function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i},"keyHasChangedFor")},{key:"isInvalid",value:v(function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)},"isInvalid")},{key:"getCachesAt",value:v(function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Ir,a.set(t,i),n.push(t)),i},"getCachesAt")},{key:"getCache",value:v(function(t,a){return this.getCachesAt(a).get(t)},"getCache")},{key:"get",value:v(function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i},"get")},{key:"getForCachedKey",value:v(function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i},"getForCachedKey")},{key:"hasCache",value:v(function(t,a){return this.getCachesAt(a).has(t)},"hasCache")},{key:"has",value:v(function(t,a){var n=this.getKey(t);return this.hasCache(n,a)},"has")},{key:"setCache",value:v(function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)},"setCache")},{key:"set",value:v(function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)},"set")},{key:"deleteCache",value:v(function(t,a){this.getCachesAt(a).delete(t)},"deleteCache")},{key:"delete",value:v(function(t,a){var n=this.getKey(t);this.deleteCache(n,a)},"_delete")},{key:"invalidateKey",value:v(function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})},"invalidateKey")},{key:"invalidate",value:v(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},"invalidate")}]),r}(),Fs=25,$a=50,Qa=-4,ei=3,Bg=7.99,Mg=8,Lg=1024,Ag=1024,Rg=1024,Og=.2,Ig=.8,zg=10,Ng=.15,Fg=.1,Vg=.9,qg=.9,$g=100,Hg=1,Bt={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Gg=rr({getKey:null,doesEleInvalidateKey:ja,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:uo,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sa=v(function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=Gg(t);we(a,n),a.lookup=new Pg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},"ElementTextureCache"),Ye=sa.prototype;Ye.reasons=Bt;Ye.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ye.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ye.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ca(function(t,a){return a.reqs-t.reqs});return e};Ye.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ye.getElement=function(r,e,t,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(fi(o*t))),a=Bg||a>ei)return null;var u=Math.pow(2,a),f=e.h*u,c=e.w*u,d=s.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,d))return null;var g=l.get(r,a);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;var h;if(f<=Fs?h=Fs:f<=$a?h=$a:h=Math.ceil(f/$a)*$a,f>Rg||c>Ag)return null;var m=i.getTextureQueue(h),y=m[m.length-2],p=v(function(){return i.recycleTexture(h,c)||i.addTexture(h,c)},"addNewTxr");y||(y=m[m.length-1]),y||(y=p()),y.width-y.usedWidtha;B--)S=i.getElement(r,e,t,B,Bt.downscale);L()}else return i.queueElement(r,C.level-1),C;else{var M;if(!w&&!x&&!T)for(var A=a-1;A>=Qa;A--){var P=l.get(r,A);if(P){M=P;break}}if(b(M))return i.queueElement(r,a),M;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,r,e,d,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return g={x:y.usedWidth,texture:y,level:a,scale:u,width:c,height:f,scaledLabelShown:d},y.usedWidth+=Math.ceil(c+Mg),y.eleCaches.push(g),l.set(r,a,g),i.checkTextureFullness(y),g};Ye.invalidateElements=function(r){for(var e=0;e=Og*r.width&&this.retireTexture(r)};Ye.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Ig&&r.fullnessChecks>=zg?jr(t,r):r.fullnessChecks++};Ye.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;jr(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,vi(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),jr(n,s),a.push(s),s}};Ye.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}};Ye.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(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var c=e.getBoundingBox(u);e.getElement(u,c,r,o.level,Bt.dequeue)}return n};Ye.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=ui,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ye.onDequeue=function(r){this.onDequeues.push(r)};Ye.offDequeue=function(r){jr(this.onDequeues,r)};Ye.setupDequeueing=mu.setupDequeueing({deqRedrawThreshold:$g,deqCost:Ng,deqAvgCost:Fg,deqNoDrawCost:Vg,deqFastCost:qg,deq:v(function(e,t,a){return e.dequeue(t,a)},"deq"),onDeqd:v(function(e,t){for(var a=0;a=Wg||t>un)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),f=l[t]=l[t]||[],c,d=a.levelIsComplete(t,r),g,h=v(function(){var L=v(function(I){if(a.validateLayersElesOrdering(I,r),a.levelIsComplete(I,r))return g=l[I],!0},"canUseAsTmpLvl"),B=v(function(I){if(!g)for(var R=t+I;ua<=R&&R<=un&&!L(R);R+=I);},"checkLvls");B(1),B(-1);for(var M=f.length-1;M>=0;M--){var A=f[M];A.invalid&&jr(f,A)}},"checkTempLevels");if(!d)h();else return f;var m=v(function(){if(!c){c=gr();for(var L=0;Ljg)return null;var A=a.makeLayer(c,t);if(B!=null){var P=f.indexOf(B)+1;f.splice(P,0,A)}else(L.insert===void 0||L.insert)&&f.unshift(A);return A},"makeLayer");if(a.skipping&&!o)return null;for(var p=null,b=r.length/Kg,w=!o,x=0;x=b||!po(p.bb,T.boundingBox()))&&(p=y({insert:!0,after:p}),!p))return null;g||w?a.queueLayer(p,T):a.drawEleInLayer(p,T,t,e),p.eles.push(T),E[t]=p}return g||(w?null:f)};tr.getEleLevelForLayerLevel=function(r,e){return r};tr.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,ep),i.setImgSmoothing(s,!0))};tr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||s.invalid)return!1;n+=s.eles.length}return n===e.length};tr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a0){e=!0;break}}return e};tr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=$r(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,v(function(a,n,i){e.invalidateLayer(a)},"invalAssocLayers")))};tr.invalidateLayer=function(r){if(this.lastInvalidationTime=$r(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];jr(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 l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,c=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,g=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,m=e.pstyle("line-outline-width").value,y=e.pstyle("line-outline-color").value,p=u*f,b=u*f,w=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;c==="straight-triangle"?(s.eleStrokeStyle(r,e,I),s.drawEdgeTrianglePath(e,r,o.allpts)):(r.lineWidth=g,r.lineCap=h,s.eleStrokeStyle(r,e,I),s.drawEdgePath(e,r,o.allpts,d),r.lineCap="butt")},"drawLine"),x=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(r.lineWidth=g+m,r.lineCap=h,m>0)s.colorStrokeStyle(r,y[0],y[1],y[2],I);else{r.lineCap="butt";return}c==="straight-triangle"?s.drawEdgeTrianglePath(e,r,o.allpts):(s.drawEdgePath(e,r,o.allpts,d),r.lineCap="butt")},"drawLineOutline"),T=v(function(){n&&s.drawEdgeOverlay(r,e)},"drawOverlay"),C=v(function(){n&&s.drawEdgeUnderlay(r,e)},"drawUnderlay"),E=v(function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;s.drawArrowheads(r,e,I)},"drawArrows"),k=v(function(){s.drawElementText(r,e,null,a)},"drawText");r.lineJoin="round";var S=e.pstyle("ghost").value==="yes";if(S){var L=e.pstyle("ghost-offset-x").pfValue,B=e.pstyle("ghost-offset-y").pfValue,M=e.pstyle("ghost-opacity").value,A=p*M;r.translate(L,B),w(A),E(A),r.translate(-L,-B)}else x();C(),w(),E(),T(),k(),t&&r.translate(l.x1,l.y1)}};var xu=v(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,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,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")}}}},"drawEdgeOverlayUnderlay");Wr.drawEdgeOverlay=xu("overlay");Wr.drawEdgeUnderlay=xu("underlay");Wr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,f=r.pstyle("line-dash-offset").pfValue;if(l){var c=t.join("$"),d=n.pathCacheKey&&n.pathCacheKey===c;d?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=c,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var g=2;g+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),c=e.pstyle("source-label"),d=e.pstyle("target-label");if(u||(!f||!f.value)&&(!c||!c.value)&&(!d||!d.value))return;r.textAlign="center",r.textBaseline="bottom"}var g=!t,h;t&&(h=t,r.translate(-h.x1,-h.y1)),n==null?(s.drawText(r,e,null,g,i),e.isEdge()&&(s.drawText(r,e,"source",g,i),s.drawText(r,e,"target",g,i))):s.drawText(r,e,n,g,i),t&&r.translate(h.x1,h.y1)};wt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;r.font=a+" "+s+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],o),this.colorStrokeStyle(r,f[0],f[1],f[2],l)};function $n(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),s?r.stroke():r.fill()}v($n,"roundRect");wt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",s=r.pstyle(i+"text-rotation"),o=Pr(n,"labelAngle",e);return s.strValue==="autorotate"?t=r.isEdge()?o:0:s.strValue==="none"?t=0:t=s.pfValue,t};wt.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var l=Pr(s,"labelX",t),u=Pr(s,"labelY",t),f,c,d=this.getLabelText(e,t);if(d!=null&&d!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var g=t?t+"-":"",h=Pr(s,"labelWidth",t),m=Pr(s,"labelHeight",t),y=e.pstyle(g+"text-margin-x").pfValue,p=e.pstyle(g+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;b&&(w="center",x="center"),l+=y,u+=p;var T;switch(a?T=this.getTextAngle(e,t):T=0,T!==0&&(f=l,c=u,r.translate(f,c),r.rotate(T),l=0,u=0),x){case"top":break;case"center":u+=m/2;break;case"bottom":u+=m;break}var C=e.pstyle("text-background-opacity").value,E=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue,L=e.pstyle("text-background-shape").strValue,B=L.indexOf("round")===0,M=2;if(C>0||k>0&&E>0){var A=l-S;switch(w){case"left":A-=h;break;case"center":A-=h/2;break}var P=u-m-S,I=h+2*S,R=m+2*S;if(C>0){var O=r.fillStyle,z=e.pstyle("text-background-color").value;r.fillStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+C*o+")",B?$n(r,A,P,I,R,M):r.fillRect(A,P,I,R),r.fillStyle=O}if(k>0&&E>0){var $=r.strokeStyle,H=r.lineWidth,V=e.pstyle("text-border-color").value,F=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+V[0]+","+V[1]+","+V[2]+","+E*o+")",r.lineWidth=k,r.setLineDash)switch(F){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=k/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(B?$n(r,A,P,I,R,M,"stroke"):r.strokeRect(A,P,I,R),F==="double"){var U=k/2;B?$n(r,A+U,P+U,I-U*2,R-U*2,M,"stroke"):r.strokeRect(A+U,P+U,I-U*2,R-U*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=H,r.strokeStyle=$}}var J=2*e.pstyle("text-outline-width").pfValue;if(J>0&&(r.lineWidth=J),e.pstyle("text-wrap").value==="wrap"){var j=Pr(s,"labelWrapCachedLines",t),ee=Pr(s,"labelLineHeight",t),re=h/2,Y=this.getLabelJustification(e);switch(Y==="auto"||(w==="left"?Y==="left"?l+=-h:Y==="center"&&(l+=-re):w==="center"?Y==="left"?l+=-re:Y==="right"&&(l+=re):w==="right"&&(Y==="center"?l+=re:Y==="right"&&(l+=h))),x){case"top":u-=(j.length-1)*ee;break;case"center":case"bottom":u-=(j.length-1)*ee;break}for(var N=0;N0&&r.strokeText(j[N],l,u),r.fillText(j[N],l,u),u+=ee}else J>0&&r.strokeText(d,l,u),r.fillText(d,l,u);T!==0&&(r.rotate(-T),r.translate(-f,-c))}}};var Xt={};Xt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,f=u.rscratch,c=e.position();if(!(!ie(c.x)||!ie(c.y))&&!(i&&!e.visible())){var d=i?e.effectiveOpacity():1,g=s.usePaths(),h,m=!1,y=e.padding();o=e.width()+2*y,l=e.height()+2*y;var p;t&&(p=t,r.translate(-p.x1,-p.y1));for(var b=e.pstyle("background-image"),w=b.value,x=new Array(w.length),T=new Array(w.length),C=0,E=0;E0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(r,e,ae)},"setupShapeColor"),N=v(function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V;s.colorStrokeStyle(r,P[0],P[1],P[2],ae)},"setupBorderColor"),X=v(function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:j;s.colorStrokeStyle(r,U[0],U[1],U[2],ae)},"setupOutlineColor"),Z=v(function(ae,W,te,me){var be=s.nodePathCache=s.nodePathCache||[],ce=oo(te==="polygon"?te+","+me.join(","):te,""+W,""+ae,""+re),xe=be[ce],ve,pe=!1;return xe!=null?(ve=xe,pe=!0,f.pathCache=ve):(ve=new Path2D,be[ce]=f.pathCache=ve),{path:ve,cacheHit:pe}},"getPath"),oe=e.pstyle("shape").strValue,ge=e.pstyle("shape-polygon-points").pfValue;if(g){r.translate(c.x,c.y);var ne=Z(o,l,oe,ge);h=ne.path,m=ne.cacheHit}var se=v(function(){if(!m){var ae=c;g&&(ae={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(h||r,ae.x,ae.y,o,l,re,f)}g?r.fill(h):r.fill()},"drawShape"),le=v(function(){for(var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,te=u.backgrounding,me=0,be=0;be0&&arguments[0]!==void 0?arguments[0]:!1,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(e)&&(s.drawPie(r,e,W),ae&&(g||s.nodeShapes[s.getNodeShape(e)].draw(r,c.x,c.y,o,l,re,f)))},"drawPie"),fe=v(function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,W=(B>0?B:-B)*ae,te=B>0?0:255;B!==0&&(s.colorFillStyle(r,te,te,te,W),g?r.fill(h):r.fill())},"darken"),ye=v(function(){if(M>0){if(r.lineWidth=M,r.lineCap=O,r.lineJoin=R,r.setLineDash)switch(I){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash($),r.lineDashOffset=H;break;case"solid":case"double":r.setLineDash([]);break}if(z!=="center"){if(r.save(),r.lineWidth*=2,z==="inside")g?r.clip(h):r.clip();else{var ae=new Path2D;ae.rect(-o/2-M,-l/2-M,o+2*M,l+2*M),ae.addPath(h),r.clip(ae,"evenodd")}g?r.stroke(h):r.stroke(),r.restore()}else g?r.stroke(h):r.stroke();if(I==="double"){r.lineWidth=M/3;var W=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",g?r.stroke(h):r.stroke(),r.globalCompositeOperation=W}r.setLineDash&&r.setLineDash([])}},"drawBorder"),Be=v(function(){if(F>0){if(r.lineWidth=F,r.lineCap="butt",r.setLineDash)switch(J){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var ae=c;g&&(ae={x:0,y:0});var W=s.getNodeShape(e),te=M;z==="inside"&&(te=0),z==="outside"&&(te*=2);var me=(o+te+(F+ee))/o,be=(l+te+(F+ee))/l,ce=o*me,xe=l*be,ve=s.nodeShapes[W].points,pe;if(g){var Fe=Z(ce,xe,W,ve);pe=Fe.path}if(W==="ellipse")s.drawEllipsePath(pe||r,ae.x,ae.y,ce,xe);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(W)){var Re=0,lr=0,Qe=0;W==="round-diamond"?Re=(te+ee+F)*1.4:W==="round-heptagon"?(Re=(te+ee+F)*1.075,Qe=-(te/2+ee+F)/35):W==="round-hexagon"?Re=(te+ee+F)*1.12:W==="round-pentagon"?(Re=(te+ee+F)*1.13,Qe=-(te/2+ee+F)/15):W==="round-tag"?(Re=(te+ee+F)*1.12,lr=(te/2+F+ee)*.07):W==="round-triangle"&&(Re=(te+ee+F)*(Math.PI/2),Qe=-(te+ee/2+F)/Math.PI),Re!==0&&(me=(o+Re)/o,ce=o*me,["round-hexagon","round-tag"].includes(W)||(be=(l+Re)/l,xe=l*be)),re=re==="auto"?bo(ce,xe):re;for(var He=ce/2,cr=xe/2,Je=re+(te+F+ee)/2,vr=new Array(ve.length/2),Er=new Array(ve.length/2),mr=0;mr0){if(n=n||a.position(),i==null||s==null){var g=a.padding();i=a.width()+2*g,s=a.height()+2*g}o.colorFillStyle(t,f[0],f[1],f[2],u),o.nodeShapes[c].draw(t,n.x,n.y,i+l*2,s+l*2,d),t.fill()}}}},"drawNodeOverlayUnderlay");Xt.drawNodeOverlay=Eu("overlay");Xt.drawNodeUnderlay=Eu("underlay");Xt.hasPie=function(r){return r=r[0],r._private.hasPie};Xt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,c=0,d=this.usePaths();d&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var g=1;g<=n.pieBackgroundN;g++){var h=e.pstyle("pie-"+g+"-background-size").value,m=e.pstyle("pie-"+g+"-background-color").value,y=e.pstyle("pie-"+g+"-background-opacity").value*t,p=h/100;p+c>1&&(p=1-c);var b=1.5*Math.PI+2*Math.PI*c,w=2*Math.PI*p,x=b+w;h===0||c>=1||c+p>1||(r.beginPath(),r.moveTo(s,o),r.arc(s,o,f,b,x),r.closePath(),this.colorFillStyle(r,m[0],m[1],m[2],y),r.fill(),c+=p)}};var yr={},fp=100;yr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};yr.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&&!c&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var b=l.style(),w=l.zoom(),x=n!==void 0?n:w,T=l.pan(),C={x:T.x,y:T.y},E={zoom:w,pan:{x:T.x,y:T.y}},k=s.prevViewport,S=k===void 0||E.zoom!==k.zoom||E.pan.x!==k.pan.x||E.pan.y!==k.pan.y;!S&&!(m&&!h)&&(s.motionBlurPxRatio=1),i&&(C=i),x*=o,C.x*=o,C.y*=o;var L=s.getCachedZSortedEles();function B(ne,se,le,de,fe){var ye=ne.globalCompositeOperation;ne.globalCompositeOperation="destination-out",s.colorFillStyle(ne,255,255,255,s.motionBlurTransparency),ne.fillRect(se,le,de,fe),ne.globalCompositeOperation=ye}v(B,"mbclear");function M(ne,se){var le,de,fe,ye;!s.clearingMotionBlur&&(ne===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||ne===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(le={x:T.x*g,y:T.y*g},de=w*g,fe=s.canvasWidth*g,ye=s.canvasHeight*g):(le=C,de=x,fe=s.canvasWidth,ye=s.canvasHeight),ne.setTransform(1,0,0,1,0,0),se==="motionBlur"?B(ne,0,0,fe,ye):!e&&(se===void 0||se)&&ne.clearRect(0,0,fe,ye),t||(ne.translate(le.x,le.y),ne.scale(de,de)),i&&ne.translate(i.x,i.y),n&&ne.scale(n,n)}if(v(M,"setContextTransform"),c||(s.textureDrawLastFrame=!1),c){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var A=s.data.bufferContexts[s.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var E=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var P=u.contexts[s.NODE],I=s.textureCache.texture,E=s.textureCache.viewport;P.setTransform(1,0,0,1,0,0),d?B(P,0,0,E.width,E.height):P.clearRect(0,0,E.width,E.height);var R=b.core("outside-texture-bg-color").value,O=b.core("outside-texture-bg-opacity").value;s.colorFillStyle(P,R[0],R[1],R[2],O),P.fillRect(0,0,E.width,E.height);var w=l.zoom();M(P,!1),P.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/o,E.height/E.zoom/o),P.drawImage(I,E.mpan.x,E.mpan.y,E.width/E.zoom/o,E.height/E.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var z=l.extent(),$=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),H=s.hideEdgesOnViewport&&$,V=[];if(V[s.NODE]=!f[s.NODE]&&d&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,V[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),V[s.DRAG]=!f[s.DRAG]&&d&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,V[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||t||a||V[s.NODE]){var F=d&&!V[s.NODE]&&g!==1,P=e||(F?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),U=d&&!F?"motionBlur":void 0;M(P,U),H?s.drawCachedNodes(P,L.nondrag,o,z):s.drawLayeredElements(P,L.nondrag,o,z),s.debug&&s.drawDebugPoints(P,L.nondrag),!t&&!d&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||t||V[s.DRAG])){var F=d&&!V[s.DRAG]&&g!==1,P=e||(F?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);M(P,d&&!F?"motionBlur":void 0),H?s.drawCachedNodes(P,L.drag,o,z):s.drawCachedElements(P,L.drag,o,z),s.debug&&s.drawDebugPoints(P,L.drag),!t&&!d&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!t){var P=e||u.contexts[s.SELECT_BOX];if(M(P),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var w=s.cy.zoom(),J=b.core("selection-box-border-width").value/w;P.lineWidth=J,P.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",P.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),J>0&&(P.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",P.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var w=s.cy.zoom(),j=u.bgActivePosistion;P.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",P.beginPath(),P.arc(j.x,j.y,b.core("active-bg-size").pfValue/w,0,2*Math.PI),P.fill()}var ee=s.lastRedrawTime;if(s.showFps&&ee){ee=Math.round(ee);var re=Math.round(1e3/ee);P.setTransform(1,0,0,1,0,0),P.fillStyle="rgba(255, 0, 0, 0.75)",P.strokeStyle="rgba(255, 0, 0, 0.75)",P.lineWidth=1,P.fillText("1 frame = "+ee+" ms = "+re+" fps",0,20);var Y=60;P.strokeRect(0,30,250,20),P.fillRect(0,30,250*Math.min(re/Y,1),20)}t||(f[s.SELECT_BOX]=!1)}if(d&&g!==1){var N=u.contexts[s.NODE],X=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Z=u.contexts[s.DRAG],oe=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],ge=v(function(se,le,de){se.setTransform(1,0,0,1,0,0),de||!p?se.clearRect(0,0,s.canvasWidth,s.canvasHeight):B(se,0,0,s.canvasWidth,s.canvasHeight);var fe=g;se.drawImage(le,0,0,s.canvasWidth*fe,s.canvasHeight*fe,0,0,s.canvasWidth,s.canvasHeight)},"drawMotionBlur");(f[s.NODE]||V[s.NODE])&&(ge(N,X,V[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||V[s.DRAG])&&(ge(Z,oe,V[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=E,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),d&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!c,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},fp)),e||l.emit("render")};var nt={};nt.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 l=1;l0&&s>0){g.clearRect(0,0,i,s),g.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(r.full)g.translate(-a.x1*u,-a.y1*u),g.scale(u,u),this.drawElements(g,h),g.scale(1/u,1/u),g.translate(a.x1*u,a.y1*u);else{var m=e.pan(),y={x:m.x*u,y:m.y*u};u*=e.zoom(),g.translate(y.x,y.y),g.scale(u,u),this.drawElements(g,h),g.scale(1/u,1/u),g.translate(-y.x,-y.y)}r.bg&&(g.globalCompositeOperation="destination-over",g.fillStyle=r.bg,g.rect(0,0,i,s),g.fill())}return d};function cp(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":Ue(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[wu,Fr,Wr,ki,wt,Xt,yr,nt,Pa,Tu].forEach(function(r){we(ke,r)});var gp=[{name:"null",impl:ou},{name:"base",impl:yu},{name:"canvas",impl:dp}],pp=[{type:"layout",extensions:Eg},{type:"renderer",extensions:gp}],ku={},Pu={};function Bu(r,e,t){var a=t,n=v(function(k){Le("Can not register `"+e+"` for `"+r+"` since `"+k+"` already exists in the prototype and can not be overridden")},"overrideErr");if(r==="core"){if(ba.prototype[e])return n(e);ba.prototype[e]=t}else if(r==="collection"){if(er.prototype[e])return n(e);er.prototype[e]=t}else if(r==="layout"){for(var i=v(function(k){this.options=k,t.call(this,k),Te(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},"Layout"),s=i.prototype=Object.create(t.prototype),o=[],l=0;l




© 2015 - 2024 Weber Informatics LLC | Privacy Policy