f7cloud_client/apps/text/js/cytoscape.esm-D2wQNSMa.chunk.mjs
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

8 lines
369 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{g as Ti}from"./vue.runtime.esm-fahCO3eG.chunk.mjs";function We(e){"@babel/helpers - typeof";return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(e)}function ci(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vl(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function di(e,t,n){return t&&Vl(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function es(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dt(e,t){return Fl(e)||jl(e,t)||ts(e,t)||ql()}function Fl(e){if(Array.isArray(e))return e}function jl(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],a=!0,o=!1,i,u;try{for(n=n.call(e);!(a=(i=n.next()).done)&&(r.push(i.value),!(t&&r.length===t));a=!0);}catch(l){o=!0,u=l}finally{try{!a&&n.return!=null&&n.return()}finally{if(o)throw u}}return r}}function ts(e,t){if(e){if(typeof e=="string")return Bi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bi(e,t)}}function Bi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ql(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ns(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ts(e))||t){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}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 o=!0,i=!1,u;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){i=!0,u=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(i)throw u}}}}var Ye=typeof window>"u"?null:window,Oi=Ye?Ye.navigator:null;Ye&&Ye.document;var Yl=We(""),rs=We({}),Xl=We(function(){}),Wl=typeof HTMLElement>"u"?"undefined":We(HTMLElement),kr=function(e){return e&&e.instanceString&&ze(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&We(e)==Yl},ze=function(e){return e!=null&&We(e)===Xl},Be=function(e){return!gt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ke=function(e){return e!=null&&We(e)===rs&&!Be(e)&&e.constructor===Object},Ul=function(e){return e!=null&&We(e)===rs},ne=function(e){return e!=null&&We(e)===We(1)&&!isNaN(e)},Hl=function(e){return ne(e)&&Math.floor(e)===e},aa=function(e){if(Wl!=="undefined")return e!=null&&e instanceof HTMLElement},gt=function(e){return Cr(e)||as(e)},Cr=function(e){return kr(e)==="collection"&&e._private.single},as=function(e){return kr(e)==="collection"&&!e._private.single},hi=function(e){return kr(e)==="core"},is=function(e){return kr(e)==="stylesheet"},Gl=function(e){return kr(e)==="event"},tn=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Kl=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},$l=function(e){return ke(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},Zl=function(e){return Ul(e)&&ze(e.then)},Ql=function(){return Oi&&Oi.userAgent.match(/msie|trident|edge/i)},gr=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;a<arguments.length;a++)r.push(arguments[a]);return r.join("$")});var n=function r(){var a=this,o=arguments,i,u=t.apply(a,o),l=r.cache;return(i=l[u])||(i=l[u]=e.apply(a,o)),i};return n.cache={},n},pi=gr(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),fa=gr(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),os=gr(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),Ii=function(e){return tn(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Xe="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Jl="rgb[a]?\\(("+Xe+"[%]?)\\s*,\\s*("+Xe+"[%]?)\\s*,\\s*("+Xe+"[%]?)(?:\\s*,\\s*("+Xe+"))?\\)",eu="rgb[a]?\\((?:"+Xe+"[%]?)\\s*,\\s*(?:"+Xe+"[%]?)\\s*,\\s*(?:"+Xe+"[%]?)(?:\\s*,\\s*(?:"+Xe+"))?\\)",tu="hsl[a]?\\(("+Xe+")\\s*,\\s*("+Xe+"[%])\\s*,\\s*("+Xe+"[%])(?:\\s*,\\s*("+Xe+"))?\\)",nu="hsl[a]?\\((?:"+Xe+")\\s*,\\s*(?:"+Xe+"[%])\\s*,\\s*(?:"+Xe+"[%])(?:\\s*,\\s*(?:"+Xe+"))?\\)",ru="\\#[0-9a-fA-F]{3}",au="\\#[0-9a-fA-F]{6}",ss=function(e,t){return e<t?-1:e>t?1:0},iu=function(e,t){return-1*ss(e,t)},ge=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var a=Object.keys(r),o=0;o<a.length;o++){var i=a[o];e[i]=r[i]}}return e},ou=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,r,a,o=16;return t?(n=parseInt(e[1]+e[1],o),r=parseInt(e[2]+e[2],o),a=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),r=parseInt(e[3]+e[4],o),a=parseInt(e[5]+e[6],o)),[n,r,a]}},su=function(e){var t,n,r,a,o,i,u,l;function s(p,f,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?p+(f-p)*6*v:v<1/2?f:v<2/3?p+(f-p)*(2/3-v)*6:p}var c=new RegExp("^"+tu+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,r=parseFloat(c[2]),r<0||r>100||(r=r/100,a=parseFloat(c[3]),a<0||a>100)||(a=a/100,o=c[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(r===0)i=u=l=Math.round(a*255);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;i=Math.round(255*s(h,d,n+1/3)),u=Math.round(255*s(h,d,n)),l=Math.round(255*s(h,d,n-1/3))}t=[i,u,l,o]}return t},lu=function(e){var t,n=new RegExp("^"+Jl+"$").exec(e);if(n){t=[];for(var r=[],a=1;a<=3;a++){var o=n[a];if(o[o.length-1]==="%"&&(r[a]=!0),o=parseFloat(o),r[a]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var i=r[1]||r[2]||r[3],u=r[1]&&r[2]&&r[3];if(i&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},uu=function(e){return du[e.toLowerCase()]},cu=function(e){return(Be(e)?e:null)||uu(e)||ou(e)||lu(e)||su(e)},du={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]},ls=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var o=n[a];if(ke(o))throw Error("Tried to set map with object key");a<n.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},us=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var o=n[a];if(ke(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t};function hu(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var gn=hu,rr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ti<"u"?Ti:typeof self<"u"?self:{};function pu(e,t){return t={exports:{}},e(t,t.exports),t.exports}var fu=typeof rr=="object"&&rr&&rr.Object===Object&&rr,gu=fu,vu=typeof self=="object"&&self&&self.Object===Object&&self,yu=gu||vu||Function("return this")(),ga=yu,mu=function(){return ga.Date.now()},_a=mu,bu=/\s/;function xu(e){for(var t=e.length;t--&&bu.test(e.charAt(t)););return t}var wu=xu,Eu=/^\s+/;function ku(e){return e&&e.slice(0,wu(e)+1).replace(Eu,"")}var Cu=ku,Du=ga.Symbol,Yn=Du,cs=Object.prototype,Su=cs.hasOwnProperty,_u=cs.toString,Kn=Yn?Yn.toStringTag:void 0;function Pu(e){var t=Su.call(e,Kn),n=e[Kn];try{e[Kn]=void 0;var r=!0}catch{}var a=_u.call(e);return r&&(t?e[Kn]=n:delete e[Kn]),a}var Mu=Pu,Tu=Object.prototype,Bu=Tu.toString;function Ou(e){return Bu.call(e)}var Iu=Ou,Nu="[object Null]",Au="[object Undefined]",Ni=Yn?Yn.toStringTag:void 0;function zu(e){return e==null?e===void 0?Au:Nu:Ni&&Ni in Object(e)?Mu(e):Iu(e)}var ds=zu;function Ru(e){return e!=null&&typeof e=="object"}var Lu=Ru,Vu="[object Symbol]";function Fu(e){return typeof e=="symbol"||Lu(e)&&ds(e)==Vu}var Dr=Fu,Ai=NaN,ju=/^[-+]0x[0-9a-f]+$/i,qu=/^0b[01]+$/i,Yu=/^0o[0-7]+$/i,Xu=parseInt;function Wu(e){if(typeof e=="number")return e;if(Dr(e))return Ai;if(gn(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=gn(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Cu(e);var n=qu.test(e);return n||Yu.test(e)?Xu(e.slice(2),n?2:8):ju.test(e)?Ai:+e}var zi=Wu,Uu="Expected a function",Hu=Math.max,Gu=Math.min;function Ku(e,t,n){var r,a,o,i,u,l,s=0,c=!1,d=!1,h=!0;if(typeof e!="function")throw new TypeError(Uu);t=zi(t)||0,gn(n)&&(c=!!n.leading,d="maxWait"in n,o=d?Hu(zi(n.maxWait)||0,t):o,h="trailing"in n?!!n.trailing:h);function p(k){var x=r,C=a;return r=a=void 0,s=k,i=e.apply(C,x),i}function f(k){return s=k,u=setTimeout(g,t),c?p(k):i}function v(k){var x=k-l,C=k-s,T=t-x;return d?Gu(T,o-C):T}function m(k){var x=k-l,C=k-s;return l===void 0||x>=t||x<0||d&&C>=o}function g(){var k=_a();if(m(k))return y(k);u=setTimeout(g,v(k))}function y(k){return u=void 0,h&&r?p(k):(r=a=void 0,i)}function b(){u!==void 0&&clearTimeout(u),s=0,r=l=a=u=void 0}function w(){return u===void 0?i:y(_a())}function S(){var k=_a(),x=m(k);if(r=arguments,a=this,l=k,x){if(u===void 0)return f(l);if(d)return clearTimeout(u),u=setTimeout(g,t),p(l)}return u===void 0&&(u=setTimeout(g,t)),i}return S.cancel=b,S.flush=w,S}var va=Ku,Pa=Ye?Ye.performance:null,hs=Pa&&Pa.now?function(){return Pa.now()}:function(){return Date.now()},$u=(function(){if(Ye){if(Ye.requestAnimationFrame)return function(e){Ye.requestAnimationFrame(e)};if(Ye.mozRequestAnimationFrame)return function(e){Ye.mozRequestAnimationFrame(e)};if(Ye.webkitRequestAnimationFrame)return function(e){Ye.webkitRequestAnimationFrame(e)};if(Ye.msRequestAnimationFrame)return function(e){Ye.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(hs())},1e3/60)}})(),ia=function(e){return $u(e)},Yt=hs,zn=9261,ps=65599,ar=5381,fs=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zn,n=t,r;r=e.next(),!r.done;)n=n*ps+r.value|0;return n},vr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zn;return t*ps+e|0},yr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ar;return(t<<5)+t+e|0},Zu=function(e,t){return e*2097152+t},Xt=function(e){return e[0]*2097152+e[1]},Mr=function(e,t){return[vr(e[0],t[0]),yr(e[1],t[1])]},Qu=function(e,t){var n={value:0,done:!1},r=0,a=e.length,o={next:function(){return r<a?n.value=e[r++]:n.done=!0,n}};return fs(o,t)},vn=function(e,t){var n={value:0,done:!1},r=0,a=e.length,o={next:function(){return r<a?n.value=e.charCodeAt(r++):n.done=!0,n}};return fs(o,t)},gs=function(){return Ju(arguments)},Ju=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];n===0?t=vn(r):t=vn(r,t)}return t},Ri=!0,ec=console.warn!=null,tc=console.trace!=null,fi=Number.MAX_SAFE_INTEGER||9007199254740991,vs=function(){return!0},oa=function(){return!1},Li=function(){return 0},gi=function(){},Le=function(e){throw new Error(e)},ys=function(e){if(e!==void 0)Ri=!!e;else return Ri},Pe=function(e){ys()&&(ec?console.warn(e):(console.log(e),tc&&console.trace()))},nc=function(e){return ge({},e)},At=function(e){return e==null?e:Be(e)?e.slice():ke(e)?nc(e):e},rc=function(e){return e.slice()},ms=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},ac={},bs=function(){return ac},et=function(e){var t=Object.keys(e);return function(n){for(var r={},a=0;a<t.length;a++){var o=t[a],i=n?.[o];r[o]=i===void 0?e[o]:i}return r}},Zt=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},qa=function(e){e.splice(0,e.length)},ic=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},St=function(e,t,n){return n&&(t=os(n,t)),e[t]},Wt=function(e,t,n,r){n&&(t=os(n,t)),e[t]=r},oc=(function(){function e(){ci(this,e),this._obj={}}return di(e,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}]),e})(),zt=typeof Map<"u"?Map:oc,sc="undefined",lc=(function(){function e(t){if(ci(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return di(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}]),e})(),Xn=(typeof Set>"u"?"undefined":We(Set))!==sc?Set:lc,ya=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!hi(e)){Le("An element must have a core reference and parameters set");return}var r=t.group;if(r==null&&(t.data&&t.data.source!=null&&t.data.target!=null?r="edges":r="nodes"),r!=="nodes"&&r!=="edges"){Le("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var a=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:r,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?r==="edges":!!t.pannable,active:!1,classes:new Xn,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(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var o=t.renderedPosition,i=e.pan(),u=e.zoom();a.position={x:(o.x-i.x)/u,y:(o.y-i.y)/u}}var l=[];Be(t.classes)?l=t.classes:he(t.classes)&&(l=t.classes.split(/\s+/));for(var s=0,c=l.length;s<c;s++){var d=l[s];!d||d===""||a.classes.add(d)}this.createEmitter();var h=t.style||t.css;h&&(Pe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h)),(n===void 0||n)&&this.restore()},Vi=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var a;ke(t)&&!gt(t)&&(a=t,t=a.roots||a.root,n=a.visit,r=a.directed),r=arguments.length===2&&!ze(n)?n:r,n=ze(n)?n:function(){};for(var o=this._private.cy,i=t=he(t)?this.filter(t):t,u=[],l=[],s={},c={},d={},h=0,p,f=this.byGroup(),v=f.nodes,m=f.edges,g=0;g<i.length;g++){var y=i[g],b=y.id();y.isNode()&&(u.unshift(y),e.bfs&&(d[b]=!0,l.push(y)),c[b]=0)}for(var w=function(){var P=e.bfs?u.shift():u.pop(),M=P.id();if(e.dfs){if(d[M])return"continue";d[M]=!0,l.push(P)}var D=c[M],B=s[M],_=B!=null?B.source():null,N=B!=null?B.target():null,A=B==null?void 0:P.same(_)?N[0]:_[0],z=void 0;if(z=n(P,B,A,h++,D),z===!0)return p=P,"break";if(z===!1)return"break";for(var O=P.connectedEdges().filter(function(W){return(!r||W.source().same(P))&&m.has(W)}),R=0;R<O.length;R++){var Y=O[R],V=Y.connectedNodes().filter(function(W){return!W.same(P)&&v.has(W)}),F=V.id();V.length!==0&&!d[F]&&(V=V[0],u.push(V),e.bfs&&(d[F]=!0,l.push(V)),s[F]=Y,c[F]=c[M]+1)}};u.length!==0;){var S=w();if(S!=="continue"&&S==="break")break}for(var k=o.collection(),x=0;x<l.length;x++){var C=l[x],T=s[C.id()];T!=null&&k.push(T),k.push(C)}return{path:o.collection(k),found:o.collection(p)}}},ir={breadthFirstSearch:Vi({bfs:!0}),depthFirstSearch:Vi({dfs:!0})};ir.bfs=ir.breadthFirstSearch,ir.dfs=ir.depthFirstSearch;var uc=pu(function(e,t){(function(){var n,r,a,o,i,u,l,s,c,d,h,p,f,v,m;a=Math.floor,d=Math.min,r=function(g,y){return g<y?-1:g>y?1:0},c=function(g,y,b,w,S){var k;if(b==null&&(b=0),S==null&&(S=r),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);b<w;)k=a((b+w)/2),S(y,g[k])<0?w=k:b=k+1;return[].splice.apply(g,[b,b-b].concat(y)),y},u=function(g,y,b){return b==null&&(b=r),g.push(y),v(g,0,g.length-1,b)},i=function(g,y){var b,w;return y==null&&(y=r),b=g.pop(),g.length?(w=g[0],g[0]=b,m(g,0,y)):w=b,w},s=function(g,y,b){var w;return b==null&&(b=r),w=g[0],g[0]=y,m(g,0,b),w},l=function(g,y,b){var w;return b==null&&(b=r),g.length&&b(g[0],y)<0&&(w=[g[0],y],y=w[0],g[0]=w[1],m(g,0,b)),y},o=function(g,y){var b,w,S,k,x,C;for(y==null&&(y=r),k=function(){C=[];for(var T=0,P=a(g.length/2);0<=P?T<P:T>P;0<=P?T++:T--)C.push(T);return C}.apply(this).reverse(),x=[],w=0,S=k.length;w<S;w++)b=k[w],x.push(m(g,b,y));return x},f=function(g,y,b){var w;if(b==null&&(b=r),w=g.indexOf(y),w!==-1)return v(g,0,w,b),m(g,w,b)},h=function(g,y,b){var w,S,k,x,C;if(b==null&&(b=r),S=g.slice(0,y),!S.length)return S;for(o(S,b),C=g.slice(y),k=0,x=C.length;k<x;k++)w=C[k],l(S,w,b);return S.sort(b).reverse()},p=function(g,y,b){var w,S,k,x,C,T,P,M,D;if(b==null&&(b=r),y*10<=g.length){if(k=g.slice(0,y).sort(b),!k.length)return k;for(S=k[k.length-1],P=g.slice(y),x=0,T=P.length;x<T;x++)w=P[x],b(w,S)<0&&(c(k,w,0,null,b),k.pop(),S=k[k.length-1]);return k}for(o(g,b),D=[],C=0,M=d(y,g.length);0<=M?C<M:C>M;0<=M?++C:--C)D.push(i(g,b));return D},v=function(g,y,b,w){var S,k,x;for(w==null&&(w=r),S=g[b];b>y;){if(x=b-1>>1,k=g[x],w(S,k)<0){g[b]=k,b=x;continue}break}return g[b]=S},m=function(g,y,b){var w,S,k,x,C;for(b==null&&(b=r),S=g.length,C=y,k=g[y],w=2*y+1;w<S;)x=w+1,x<S&&!(b(g[w],g[x])<0)&&(w=x),g[y]=g[w],y=w,w=2*y+1;return g[y]=k,v(g,C,y,b)},n=(function(){g.push=u,g.pop=i,g.replace=s,g.pushpop=l,g.heapify=o,g.updateItem=f,g.nlargest=h,g.nsmallest=p;function g(y){this.cmp=y??r,this.nodes=[]}return g.prototype.push=function(y){return u(this.nodes,y,this.cmp)},g.prototype.pop=function(){return i(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},g.prototype.replace=function(y){return s(this.nodes,y,this.cmp)},g.prototype.pushpop=function(y){return l(this.nodes,y,this.cmp)},g.prototype.heapify=function(){return o(this.nodes,this.cmp)},g.prototype.updateItem=function(y){return f(this.nodes,y,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var y;return y=new g,y.nodes=this.nodes.slice(0),y},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g})(),(function(g,y){return e.exports=y()})(this,function(){return n})}).call(rr)}),Sr=uc,cc=et({root:null,weight:function(e){return 1},directed:!1}),dc={dijkstra:function(e){if(!ke(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=cc(e),r=n.root,a=n.weight,o=n.directed,i=this,u=a,l=he(r)?this.filter(r)[0]:r[0],s={},c={},d={},h=this.byGroup(),p=h.nodes,f=h.edges;f.unmergeBy(function(_){return _.isLoop()});for(var v=function(_){return s[_.id()]},m=function(_,N){s[_.id()]=N,g.updateItem(_)},g=new Sr(function(_,N){return v(_)-v(N)}),y=0;y<p.length;y++){var b=p[y];s[b.id()]=b.same(l)?0:1/0,g.push(b)}for(var w=function(_,N){for(var A=(o?_.edgesTo(N):_.edgesWith(N)).intersect(f),z=1/0,O,R=0;R<A.length;R++){var Y=A[R],V=u(Y);(V<z||!O)&&(z=V,O=Y)}return{edge:O,dist:z}};g.size()>0;){var S=g.pop(),k=v(S),x=S.id();if(d[x]=k,k!==1/0)for(var C=S.neighborhood().intersect(p),T=0;T<C.length;T++){var P=C[T],M=P.id(),D=w(S,P),B=k+D.dist;B<v(P)&&(m(P,B),c[M]={node:S,edge:D.edge})}}return{distanceTo:function(_){var N=he(_)?p.filter(_)[0]:_[0];return d[N.id()]},pathTo:function(_){var N=he(_)?p.filter(_)[0]:_[0],A=[],z=N,O=z.id();if(N.length>0)for(A.unshift(N);c[O];){var R=c[O];A.unshift(R.edge),A.unshift(R.node),z=R.node,O=z.id()}return i.spawn(A)}}}},hc={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,o=new Array(a),i=n,u=function(y){for(var b=0;b<o.length;b++){var w=o[b];if(w.has(y))return b}},l=0;l<a;l++)o[l]=this.spawn(n[l]);for(var s=r.sort(function(y,b){return e(y)-e(b)}),c=0;c<s.length;c++){var d=s[c],h=d.source()[0],p=d.target()[0],f=u(h),v=u(p),m=o[f],g=o[v];f!==v&&(i.merge(d),m.merge(g),o.splice(v,1))}return i}},pc=et({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),fc={aStar:function(e){var t=this.cy(),n=pc(e),r=n.root,a=n.goal,o=n.heuristic,i=n.directed,u=n.weight;r=t.collection(r)[0],a=t.collection(a)[0];var l=r.id(),s=a.id(),c={},d={},h={},p=new Sr(function(R,Y){return d[R.id()]-d[Y.id()]}),f=new Xn,v={},m={},g=function(R,Y){p.push(R),f.add(Y)},y,b,w=function(){y=p.pop(),b=y.id(),f.delete(b)},S=function(R){return f.has(R)};g(r,l),c[l]=0,d[l]=o(r);for(var k=0;p.size()>0;){if(w(),k++,b===s){for(var x=[],C=a,T=s,P=m[T];x.unshift(C),P!=null&&x.unshift(P),C=v[T],C!=null;)T=C.id(),P=m[T];return{found:!0,distance:c[b],path:this.spawn(x),steps:k}}h[b]=!0;for(var M=y._private.edges,D=0;D<M.length;D++){var B=M[D];if(this.hasElementWithId(B.id())&&!(i&&B.data("source")!==b)){var _=B.source(),N=B.target(),A=_.id()!==b?_:N,z=A.id();if(this.hasElementWithId(z)&&!h[z]){var O=c[b]+u(B);if(!S(z)){c[z]=O,d[z]=O+o(A),g(A,z),v[z]=y,m[z]=B;continue}O<c[z]&&(c[z]=O,d[z]=O+o(A),v[z]=y,m[z]=B)}}}}return{found:!1,distance:void 0,path:void 0,steps:k}}},gc=et({weight:function(e){return 1},directed:!1}),vc={floydWarshall:function(e){for(var t=this.cy(),n=gc(e),r=n.weight,a=n.directed,o=r,i=this.byGroup(),u=i.nodes,l=i.edges,s=u.length,c=s*s,d=function(V){return u.indexOf(V)},h=function(V){return u[V]},p=new Array(c),f=0;f<c;f++){var v=f%s,m=(f-v)/s;m===v?p[f]=0:p[f]=1/0}for(var g=new Array(c),y=new Array(c),b=0;b<l.length;b++){var w=l[b],S=w.source()[0],k=w.target()[0];if(S!==k){var x=d(S),C=d(k),T=x*s+C,P=o(w);if(p[T]>P&&(p[T]=P,g[T]=C,y[T]=w),!a){var M=C*s+x;!a&&p[M]>P&&(p[M]=P,g[M]=x,y[M]=w)}}}for(var D=0;D<s;D++)for(var B=0;B<s;B++)for(var _=B*s+D,N=0;N<s;N++){var A=B*s+N,z=D*s+N;p[_]+p[z]<p[A]&&(p[A]=p[_]+p[z],g[A]=g[_])}var O=function(V){return(he(V)?t.filter(V):V)[0]},R=function(V){return d(O(V))},Y={distance:function(V,F){var W=R(V),Q=R(F);return p[W*s+Q]},path:function(V,F){var W=R(V),Q=R(F),re=h(W);if(W===Q)return re.collection();if(g[W*s+Q]==null)return t.collection();var K=t.collection(),$=W,I;for(K.merge(re);W!==Q;)$=W,W=g[W*s+Q],I=y[$*s+W],K.merge(I),K.merge(h(W));return K}};return Y}},yc=et({weight:function(e){return 1},directed:!1,root:null}),mc={bellmanFord:function(e){var t=this,n=yc(e),r=n.weight,a=n.directed,o=n.root,i=r,u=this,l=this.cy(),s=this.byGroup(),c=s.edges,d=s.nodes,h=d.length,p=new zt,f=!1,v=[];o=l.collection(o)[0],c.unmergeBy(function(ae){return ae.isLoop()});for(var m=c.length,g=function(ae){var de=p.get(ae.id());return de||(de={},p.set(ae.id(),de)),de},y=function(ae){return(he(ae)?l.$(ae):ae)[0]},b=function(ae){return g(y(ae)).dist},w=function(ae){for(var de=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,ve=y(ae),be=[],xe=ve;;){if(xe==null)return t.spawn();var Me=g(xe),we=Me.edge,Ce=Me.pred;if(be.unshift(xe[0]),xe.same(de)&&be.length>0)break;we!=null&&be.unshift(we),xe=Ce}return u.spawn(be)},S=0;S<h;S++){var k=d[S],x=g(k);k.same(o)?x.dist=0:x.dist=1/0,x.pred=null,x.edge=null}for(var C=!1,T=function(ae,de,ve,be,xe,Me){var we=be.dist+Me;we<xe.dist&&!ve.same(be.edge)&&(xe.dist=we,xe.pred=ae,xe.edge=ve,C=!0)},P=1;P<h;P++){C=!1;for(var M=0;M<m;M++){var D=c[M],B=D.source(),_=D.target(),N=i(D),A=g(B),z=g(_);T(B,_,D,A,z,N),a||T(_,B,D,z,A,N)}if(!C)break}if(C)for(var O=[],R=0;R<m;R++){var Y=c[R],V=Y.source(),F=Y.target(),W=i(Y),Q=g(V).dist,re=g(F).dist;if(Q+W<re||!a&&re+W<Q)if(f||(Pe("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),e.findNegativeWeightCycles!==!1){var K=[];Q+W<re&&K.push(V),!a&&re+W<Q&&K.push(F);for(var $=K.length,I=0;I<$;I++){var H=K[I],U=[H];U.push(g(H).edge);for(var te=g(H).pred;U.indexOf(te)===-1;)U.push(te),U.push(g(te).edge),te=g(te).pred;U=U.slice(U.indexOf(te));for(var ce=U[0].id(),me=0,Z=2;Z<U.length;Z+=2)U[Z].id()<ce&&(ce=U[Z].id(),me=Z);U=U.slice(me).concat(U.slice(0,me)),U.push(U[0]);var oe=U.map(function(ae){return ae.id()}).join(",");O.indexOf(oe)===-1&&(v.push(u.spawn(U)),O.push(oe))}}else break}return{distanceTo:b,pathTo:w,hasNegativeWeightCycle:f,negativeWeightCycles:v}}},bc=Math.sqrt(2),xc=function(e,t,n){n.length===0&&Le("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],o=r[2],i=t[a],u=t[o],l=n,s=l.length-1;s>=0;s--){var c=l[s],d=c[1],h=c[2];(t[d]===i&&t[h]===u||t[d]===u&&t[h]===i)&&l.splice(s,1)}for(var p=0;p<l.length;p++){var f=l[p];f[1]===u?(l[p]=f.slice(),l[p][1]=i):f[2]===u&&(l[p]=f.slice(),l[p][2]=i)}for(var v=0;v<t.length;v++)t[v]===u&&(t[v]=i);return l},Ma=function(e,t,n,r){for(;n>r;){var a=Math.floor(Math.random()*t.length);t=xc(a,e,t),n--}return t},wc={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(z){return z.isLoop()});var a=n.length,o=r.length,i=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),u=Math.floor(a/bc);if(a<2){Le("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],s=0;s<o;s++){var c=r[s];l.push([s,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],p=new Array(a),f=new Array(a),v=new Array(a),m=function(z,O){for(var R=0;R<a;R++)O[R]=z[R]},g=0;g<=i;g++){for(var y=0;y<a;y++)f[y]=y;var b=Ma(f,l.slice(),a,u),w=b.slice();m(f,v);var S=Ma(f,b,u,2),k=Ma(v,w,u,2);S.length<=k.length&&S.length<d?(d=S.length,h=S,m(f,p)):k.length<=S.length&&k.length<d&&(d=k.length,h=k,m(v,p))}for(var x=this.spawn(h.map(function(z){return r[z[0]]})),C=this.spawn(),T=this.spawn(),P=p[0],M=0;M<p.length;M++){var D=p[M],B=n[M];D===P?C.merge(B):T.merge(B)}var _=function(z){var O=e.spawn();return z.forEach(function(R){O.merge(R),R.connectedEdges().forEach(function(Y){e.contains(Y)&&!x.contains(Y)&&O.merge(Y)})}),O},N=[_(C),_(T)],A={cut:x,components:N,partition1:C,partition2:T};return A}},Ec=function(e){return{x:e.x,y:e.y}},ma=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},xs=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Rn=function(e){return{x:e[0],y:e[1]}},kc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r=Math.min(o,r))}return r},Cc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r=Math.max(o,r))}return r},Dc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,a=0,o=t;o<n;o++){var i=e[o];isFinite(i)&&(r+=i,a++)}return r/a},Sc=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var i=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,i++):e.splice(u,1)}a&&e.sort(function(d,h){return d-h});var s=e.length,c=Math.floor(s/2);return s%2!==0?e[c+1+i]:(e[c-1+i]+e[c+i])/2},_c=function(e){return Math.PI*e/180},Tr=function(e,t){return Math.atan2(t,e)-Math.PI/2},vi=Math.log2||function(e){return Math.log(e)/Math.log(2)},Fi=function(e){return e>0?1:e<0?-1:0},yn=function(e,t){return Math.sqrt(ln(e,t))},ln=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Pc=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},Ge=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Fn=function(e,t,n,r){return{x:Ge(e.x,t.x,n.x,r),y:Ge(e.y,t.y,n.y,r)}},Mc=function(e,t,n,r){var a={x:t.x-e.x,y:t.y-e.y},o=yn(e,t),i={x:a.x/o,y:a.y/o};return n=n??0,r=r??n*o,{x:e.x+i.x*r,y:e.y+i.y*r}},mr=function(e,t,n){return Math.max(e,Math.min(n,t))},ht=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=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}}},Tc=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Bc=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Oc=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},ws=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},Ic=function(e,t,n){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,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Xr=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},Wr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,a,o;if(t.length===1)n=r=a=o=t[0];else if(t.length===2)n=a=t[0],o=r=t[1];else if(t.length===4){var i=Dt(t,4);n=i[0],r=i[1],a=i[2],o=i[3]}return e.x1-=o,e.x2+=r,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ji=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},yi=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},jn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Nc=function(e,t){return jn(e,t.x,t.y)},Es=function(e,t){return jn(e,t.x1,t.y1)&&jn(e,t.x2,t.y2)},qi=function(e,t,n,r,a,o,i){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?mn(a,o):u,s=a/2,c=o/2;l=Math.min(l,s,c);var d=l!==s,h=l!==c,p;if(d){var f=n-s+l-i,v=r-c-i,m=n+s-l+i,g=v;if(p=Qt(e,t,n,r,f,v,m,g,!1),p.length>0)return p}if(h){var y=n+s+i,b=r-c+l-i,w=y,S=r+c-l+i;if(p=Qt(e,t,n,r,y,b,w,S,!1),p.length>0)return p}if(d){var k=n-s+l-i,x=r+c+i,C=n+s-l+i,T=x;if(p=Qt(e,t,n,r,k,x,C,T,!1),p.length>0)return p}if(h){var P=n-s-i,M=r-c+l-i,D=P,B=r+c-l+i;if(p=Qt(e,t,n,r,P,M,D,B,!1),p.length>0)return p}var _;{var N=n-s+l,A=r-c+l;if(_=or(e,t,n,r,N,A,l+i),_.length>0&&_[0]<=N&&_[1]<=A)return[_[0],_[1]]}{var z=n+s-l,O=r-c+l;if(_=or(e,t,n,r,z,O,l+i),_.length>0&&_[0]>=z&&_[1]<=O)return[_[0],_[1]]}{var R=n+s-l,Y=r+c-l;if(_=or(e,t,n,r,R,Y,l+i),_.length>0&&_[0]>=R&&_[1]>=Y)return[_[0],_[1]]}{var V=n-s+l,F=r+c-l;if(_=or(e,t,n,r,V,F,l+i),_.length>0&&_[0]<=V&&_[1]>=F)return[_[0],_[1]]}return[]},Ac=function(e,t,n,r,a,o,i){var u=i,l=Math.min(n,a),s=Math.max(n,a),c=Math.min(r,o),d=Math.max(r,o);return l-u<=e&&e<=s+u&&c-u<=t&&t<=d+u},zc=function(e,t,n,r,a,o,i,u,l){var s={x1:Math.min(n,i,a)-l,x2:Math.max(n,i,a)+l,y1:Math.min(r,u,o)-l,y2:Math.max(r,u,o)+l};return!(e<s.x1||e>s.x2||t<s.y1||t>s.y2)},Rc=function(e,t,n,r){n-=r;var a=t*t-4*e*n;if(a<0)return[];var o=Math.sqrt(a),i=2*e,u=(-t+o)/i,l=(-t-o)/i;return[u,l]},Lc=function(e,t,n,r,a){var o=1e-5;e===0&&(e=o),t/=e,n/=e,r/=e;var i,u,l,s,c,d,h,p;if(u=(3*n-t*t)/9,l=-(27*r)+t*(9*n-2*(t*t)),l/=54,i=u*u*u+l*l,a[1]=0,h=t/3,i>0){c=l+Math.sqrt(i),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=l-Math.sqrt(i),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+c+d,h+=(c+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+c)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,i===0){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*p,a[4]=a[2]=-(p+h);return}u=-u,s=u*u*u,s=Math.acos(l/Math.sqrt(s)),p=2*Math.sqrt(u),a[0]=-h+p*Math.cos(s/3),a[2]=-h+p*Math.cos((s+2*Math.PI)/3),a[4]=-h+p*Math.cos((s+4*Math.PI)/3)},Vc=function(e,t,n,r,a,o,i,u){var l=1*n*n-4*n*a+2*n*i+4*a*a-4*a*i+i*i+r*r-4*r*o+2*r*u+4*o*o-4*o*u+u*u,s=9*n*a-3*n*n-3*n*i-6*a*a+3*a*i+9*r*o-3*r*r-3*r*u-6*o*o+3*o*u,c=3*n*n-6*n*a+n*i-n*e+2*a*a+2*a*e-i*e+3*r*r-6*r*o+r*u-r*t+2*o*o+2*o*t-u*t,d=1*n*a-n*n+n*e-a*e+r*o-r*r+r*t-o*t,h=[];Lc(l,s,c,d,h);for(var p=1e-7,f=[],v=0;v<6;v+=2)Math.abs(h[v+1])<p&&h[v]>=0&&h[v]<=1&&f.push(h[v]);f.push(1),f.push(0);for(var m=-1,g,y,b,w=0;w<f.length;w++)g=Math.pow(1-f[w],2)*n+2*(1-f[w])*f[w]*a+f[w]*f[w]*i,y=Math.pow(1-f[w],2)*r+2*(1-f[w])*f[w]*o+f[w]*f[w]*u,b=Math.pow(g-e,2)+Math.pow(y-t,2),m>=0?b<m&&(m=b):m=b;return m},Fc=function(e,t,n,r,a,o){var i=[e-n,t-r],u=[a-n,o-r],l=u[0]*u[0]+u[1]*u[1],s=i[0]*i[0]+i[1]*i[1],c=i[0]*u[0]+i[1]*u[1],d=c*c/l;return c<0?s:d>l?(e-a)*(e-a)+(t-o)*(t-o):s-d},dt=function(e,t,n){for(var r,a,o,i,u,l=0,s=0;s<n.length/2;s++)if(r=n[s*2],a=n[s*2+1],s+1<n.length/2?(o=n[(s+1)*2],i=n[(s+1)*2+1]):(o=n[(s+1-n.length/2)*2],i=n[(s+1-n.length/2)*2+1]),!(r==e&&o==e))if(r>=e&&e>=o||r<=e&&e<=o)u=(e-r)/(o-r)*(i-a)+a,u>t&&l++;else continue;return l%2!==0},Lt=function(e,t,n,r,a,o,i,u,l){var s=new Array(n.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var d=Math.cos(-c),h=Math.sin(-c),p=0;p<s.length/2;p++)s[p*2]=o/2*(n[p*2]*d-n[p*2+1]*h),s[p*2+1]=i/2*(n[p*2+1]*d+n[p*2]*h),s[p*2]+=r,s[p*2+1]+=a;var f;if(l>0){var v=la(s,-l);f=sa(v)}else f=s;return dt(e,t,f)},jc=function(e,t,n,r,a,o,i,u){for(var l=new Array(n.length*2),s=0;s<u.length;s++){var c=u[s];l[s*4+0]=c.startX,l[s*4+1]=c.startY,l[s*4+2]=c.stopX,l[s*4+3]=c.stopY;var d=Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2);if(d<=Math.pow(c.radius,2))return!0}return dt(e,t,l)},sa=function(e){for(var t=new Array(e.length/2),n,r,a,o,i,u,l,s,c=0;c<e.length/4;c++){n=e[c*4],r=e[c*4+1],a=e[c*4+2],o=e[c*4+3],c<e.length/4-1?(i=e[(c+1)*4],u=e[(c+1)*4+1],l=e[(c+1)*4+2],s=e[(c+1)*4+3]):(i=e[0],u=e[1],l=e[2],s=e[3]);var d=Qt(n,r,a,o,i,u,l,s,!0);t[c*2]=d[0],t[c*2+1]=d[1]}return t},la=function(e,t){for(var n=new Array(e.length*2),r,a,o,i,u=0;u<e.length/2;u++){r=e[u*2],a=e[u*2+1],u<e.length/2-1?(o=e[(u+1)*2],i=e[(u+1)*2+1]):(o=e[0],i=e[1]);var l=i-a,s=-(o-r),c=Math.sqrt(l*l+s*s),d=l/c,h=s/c;n[u*4]=r+d*t,n[u*4+1]=a+h*t,n[u*4+2]=o+d*t,n[u*4+3]=i+h*t}return n},qc=function(e,t,n,r,a,o){var i=n-e,u=r-t;i/=a,u/=o;var l=Math.sqrt(i*i+u*u),s=l-1;if(s<0)return[];var c=s/l;return[(n-e)*c+e,(r-t)*c+t]},rn=function(e,t,n,r,a,o,i){return e-=a,t-=o,e/=n/2+i,t/=r/2+i,e*e+t*t<=1},or=function(e,t,n,r,a,o,i){var u=[n-e,r-t],l=[e-a,t-o],s=u[0]*u[0]+u[1]*u[1],c=2*(l[0]*u[0]+l[1]*u[1]),d=l[0]*l[0]+l[1]*l[1]-i*i,h=c*c-4*s*d;if(h<0)return[];var p=(-c+Math.sqrt(h))/(2*s),f=(-c-Math.sqrt(h))/(2*s),v=Math.min(p,f),m=Math.max(p,f),g=[];if(v>=0&&v<=1&&g.push(v),m>=0&&m<=1&&g.push(m),g.length===0)return[];var y=g[0]*u[0]+e,b=g[0]*u[1]+t;if(g.length>1){if(g[0]==g[1])return[y,b];var w=g[1]*u[0]+e,S=g[1]*u[1]+t;return[y,b,w,S]}else return[y,b]},Ta=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Qt=function(e,t,n,r,a,o,i,u,l){var s=e-a,c=n-e,d=i-a,h=t-o,p=r-t,f=u-o,v=d*h-f*s,m=c*h-p*s,g=f*c-d*p;if(g!==0){var y=v/g,b=m/g,w=.001,S=0-w,k=1+w;return S<=y&&y<=k&&S<=b&&b<=k?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}else return v===0||m===0?Ta(e,n,i)===i?[i,u]:Ta(e,n,a)===a?[a,o]:Ta(a,i,n)===n?[n,r]:[]:[]},hr=function(e,t,n,r,a,o,i,u){var l=[],s,c=new Array(n.length),d=!0;o==null&&(d=!1);var h;if(d){for(var p=0;p<c.length/2;p++)c[p*2]=n[p*2]*o+r,c[p*2+1]=n[p*2+1]*i+a;if(u>0){var f=la(c,-u);h=sa(f)}else h=c}else h=n;for(var v,m,g,y,b=0;b<h.length/2;b++)v=h[b*2],m=h[b*2+1],b<h.length/2-1?(g=h[(b+1)*2],y=h[(b+1)*2+1]):(g=h[0],y=h[1]),s=Qt(e,t,r,a,v,m,g,y),s.length!==0&&l.push(s[0],s[1]);return l},Yc=function(e,t,n,r,a,o,i,u,l){var s=[],c,d=new Array(n.length*2);l.forEach(function(g,y){y===0?(d[d.length-2]=g.startX,d[d.length-1]=g.startY):(d[y*4-2]=g.startX,d[y*4-1]=g.startY),d[y*4]=g.stopX,d[y*4+1]=g.stopY,c=or(e,t,r,a,g.cx,g.cy,g.radius),c.length!==0&&s.push(c[0],c[1])});for(var h=0;h<d.length/4;h++)c=Qt(e,t,r,a,d[h*4],d[h*4+1],d[h*4+2],d[h*4+3],!1),c.length!==0&&s.push(c[0],c[1]);if(s.length>2){for(var p=[s[0],s[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),v=1;v<s.length/2;v++){var m=Math.pow(s[v*2]-e,2)+Math.pow(s[v*2+1]-t,2);m<=f&&(p[0]=s[v*2],p[1]=s[v*2+1],f=m)}return p}return s},Br=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),o=(a-n)/a;return o<0&&(o=1e-5),[t[0]+o*r[0],t[1]+o*r[1]]},lt=function(e,t){var n=Ya(e,t);return n=ks(n),n},ks=function(e){for(var t,n,r=e.length/2,a=1/0,o=1/0,i=-1/0,u=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],a=Math.min(a,t),i=Math.max(i,t),o=Math.min(o,n),u=Math.max(u,n);for(var s=2/(i-a),c=2/(u-o),d=0;d<r;d++)t=e[2*d]=e[2*d]*s,n=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),i=Math.max(i,t),o=Math.min(o,n),u=Math.max(u,n);if(o<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-o);return e},Ya=function(e,t){var n=1/e*2*Math.PI,r=e%2===0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var a=new Array(e*2),o,i=0;i<e;i++)o=i*n+r,a[2*i]=Math.cos(o),a[2*i+1]=Math.sin(-o);return a},mn=function(e,t){return Math.min(e/4,t/4,8)},Cs=function(e,t){return Math.min(e/10,t/10,8)},mi=function(){return 8},Xc=function(e,t,n){return[e-2*t+n,2*(t-e),e]},Xa=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Wc=et({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Uc={pageRank:function(e){for(var t=Wc(e),n=t.dampingFactor,r=t.precision,a=t.iterations,o=t.weight,i=this._private.cy,u=this.byGroup(),l=u.nodes,s=u.edges,c=l.length,d=c*c,h=s.length,p=new Array(d),f=new Array(c),v=(1-n)/c,m=0;m<c;m++){for(var g=0;g<c;g++){var y=m*c+g;p[y]=0}f[m]=0}for(var b=0;b<h;b++){var w=s[b],S=w.data("source"),k=w.data("target");if(S!==k){var x=l.indexOfId(S),C=l.indexOfId(k),T=o(w),P=C*c+x;p[P]+=T,f[x]+=T}}for(var M=1/c+v,D=0;D<c;D++)if(f[D]===0)for(var B=0;B<c;B++){var _=B*c+D;p[_]=M}else for(var N=0;N<c;N++){var A=N*c+D;p[A]=p[A]/f[D]+v}for(var z=new Array(c),O=new Array(c),R,Y=0;Y<c;Y++)z[Y]=1;for(var V=0;V<a;V++){for(var F=0;F<c;F++)O[F]=0;for(var W=0;W<c;W++)for(var Q=0;Q<c;Q++){var re=W*c+Q;O[W]+=p[re]*z[Q]}Pc(O),R=z,z=O,O=R;for(var K=0,$=0;$<c;$++){var I=R[$]-z[$];K+=I*I}if(K<r)break}var H={rank:function(U){return U=i.collection(U)[0],z[l.indexOf(U)]}};return H}},Yi=et({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Mn={degreeCentralityNormalized:function(e){e=Yi(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var a={},o={},i=0,u=0,l=0;l<r;l++){var s=n[l],c=s.id();e.root=s;var d=this.degreeCentrality(e);i<d.indegree&&(i=d.indegree),u<d.outdegree&&(u=d.outdegree),a[c]=d.indegree,o[c]=d.outdegree}return{indegree:function(g){return i==0?0:(he(g)&&(g=t.filter(g)),a[g.id()]/i)},outdegree:function(g){return u===0?0:(he(g)&&(g=t.filter(g)),o[g.id()]/u)}}}else{for(var h={},p=0,f=0;f<r;f++){var v=n[f];e.root=v;var m=this.degreeCentrality(e);p<m.degree&&(p=m.degree),h[v.id()]=m.degree}return{degree:function(g){return p===0?0:(he(g)&&(g=t.filter(g)),h[g.id()]/p)}}}},degreeCentrality:function(e){e=Yi(e);var t=this.cy(),n=this,r=e,a=r.root,o=r.weight,i=r.directed,u=r.alpha;if(a=t.collection(a)[0],i){for(var l=a.connectedEdges(),s=l.filter(function(S){return S.target().same(a)&&n.has(S)}),c=l.filter(function(S){return S.source().same(a)&&n.has(S)}),d=s.length,h=c.length,p=0,f=0,v=0;v<s.length;v++)p+=o(s[v]);for(var m=0;m<c.length;m++)f+=o(c[m]);return{indegree:Math.pow(d,1-u)*Math.pow(p,u),outdegree:Math.pow(h,1-u)*Math.pow(f,u)}}else{for(var g=a.connectedEdges().intersection(n),y=g.length,b=0,w=0;w<g.length;w++)b+=o(g[w]);return{degree:Math.pow(y,1-u)*Math.pow(b,u)}}}};Mn.dc=Mn.degreeCentrality,Mn.dcn=Mn.degreeCentralityNormalised=Mn.degreeCentralityNormalized;var Xi=et({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Tn={closenessCentralityNormalized:function(e){for(var t=Xi(e),n=t.harmonic,r=t.weight,a=t.directed,o=this.cy(),i={},u=0,l=this.nodes(),s=this.floydWarshall({weight:r,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],p=0;p<l.length;p++)if(c!==p){var f=s.distance(h,l[p]);n?d+=1/f:d+=f}n||(d=1/d),u<d&&(u=d),i[h.id()]=d}return{closeness:function(v){return u==0?0:(he(v)?v=o.filter(v)[0].id():v=v.id(),i[v]/u)}}},closenessCentrality:function(e){var t=Xi(e),n=t.root,r=t.weight,a=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var i=this.dijkstra({root:n,weight:r,directed:a}),u=0,l=this.nodes(),s=0;s<l.length;s++){var c=l[s];if(!c.same(n)){var d=i.distanceTo(c);o?u+=1/d:u+=d}}return o?u:1/u}};Tn.cc=Tn.closenessCentrality,Tn.ccn=Tn.closenessCentralityNormalised=Tn.closenessCentralityNormalized;var Hc=et({weight:null,directed:!1}),Wa={betweennessCentrality:function(e){for(var t=Hc(e),n=t.directed,r=t.weight,a=r!=null,o=this.cy(),i=this.nodes(),u={},l={},s=0,c={set:function(g,y){l[g]=y,y>s&&(s=y)},get:function(g){return l[g]}},d=0;d<i.length;d++){var h=i[d],p=h.id();n?u[p]=h.outgoers().nodes():u[p]=h.openNeighborhood().nodes(),c.set(p,0)}for(var f=function(g){for(var y=i[g].id(),b=[],w={},S={},k={},x=new Sr(function(W,Q){return k[W]-k[Q]}),C=0;C<i.length;C++){var T=i[C].id();w[T]=[],S[T]=0,k[T]=1/0}for(S[y]=1,k[y]=0,x.push(y);!x.empty();){var P=x.pop();if(b.push(P),a)for(var M=0;M<u[P].length;M++){var D=u[P][M],B=o.getElementById(P),_=void 0;B.edgesTo(D).length>0?_=B.edgesTo(D)[0]:_=D.edgesTo(B)[0];var N=r(_);D=D.id(),k[D]>k[P]+N&&(k[D]=k[P]+N,x.nodes.indexOf(D)<0?x.push(D):x.updateItem(D),S[D]=0,w[D]=[]),k[D]==k[P]+N&&(S[D]=S[D]+S[P],w[D].push(P))}else for(var A=0;A<u[P].length;A++){var z=u[P][A].id();k[z]==1/0&&(x.push(z),k[z]=k[P]+1),k[z]==k[P]+1&&(S[z]=S[z]+S[P],w[z].push(P))}}for(var O={},R=0;R<i.length;R++)O[i[R].id()]=0;for(;b.length>0;){for(var Y=b.pop(),V=0;V<w[Y].length;V++){var F=w[Y][V];O[F]=O[F]+S[F]/S[Y]*(1+O[Y])}Y!=i[g].id()&&c.set(Y,c.get(Y)+O[Y])}},v=0;v<i.length;v++)f(v);var m={betweenness:function(g){var y=o.collection(g).id();return c.get(y)},betweennessNormalized:function(g){if(s==0)return 0;var y=o.collection(g).id();return c.get(y)/s}};return m.betweennessNormalised=m.betweennessNormalized,m}};Wa.bc=Wa.betweennessCentrality;var Gc=et({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),Kc=function(e){return Gc(e)},$c=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Zc=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Ds=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var a=0;a<t;a++)n+=e[a*t+r];for(var o=0;o<t;o++)e[o*t+r]=e[o*t+r]/n}},Qc=function(e,t,n){for(var r=new Array(n*n),a=0;a<n;a++){for(var o=0;o<n;o++)r[a*n+o]=0;for(var i=0;i<n;i++)for(var u=0;u<n;u++)r[a*n+u]+=e[a*n+i]*t[i*n+u]}return r},Jc=function(e,t,n){for(var r=e.slice(0),a=1;a<n;a++)e=Qc(e,r,t);return e},ed=function(e,t,n){for(var r=new Array(t*t),a=0;a<t*t;a++)r[a]=Math.pow(e[a],n);return Ds(r,t),r},td=function(e,t,n,r){for(var a=0;a<n;a++){var o=Math.round(e[a]*Math.pow(10,r))/Math.pow(10,r),i=Math.round(t[a]*Math.pow(10,r))/Math.pow(10,r);if(o!==i)return!1}return!0},nd=function(e,t,n,r){for(var a=[],o=0;o<t;o++){for(var i=[],u=0;u<t;u++)Math.round(e[o*t+u]*1e3)/1e3>0&&i.push(n[u]);i.length!==0&&a.push(r.collection(i))}return a},rd=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},ad=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&rd(e[t],e[n])&&e.splice(n,1);return e},Wi=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),a=Kc(e),o={},i=0;i<t.length;i++)o[t[i].id()]=i;for(var u=t.length,l=u*u,s=new Array(l),c,d=0;d<l;d++)s[d]=0;for(var h=0;h<n.length;h++){var p=n[h],f=o[p.source().id()],v=o[p.target().id()],m=$c(p,a.attributes);s[f*u+v]+=m,s[v*u+f]+=m}Zc(s,u,a.multFactor),Ds(s,u);for(var g=!0,y=0;g&&y<a.maxIterations;)g=!1,c=Jc(s,u,a.expandFactor),s=ed(c,u,a.inflateFactor),td(s,c,l,4)||(g=!0),y++;var b=nd(s,u,t,r);return b=ad(b),b},id={markovClustering:Wi,mcl:Wi},od=function(e){return e},Ss=function(e,t){return Math.abs(t-e)},Ui=function(e,t,n){return e+Ss(t,n)},Hi=function(e,t,n){return e+Math.pow(n-t,2)},sd=function(e){return Math.sqrt(e)},ld=function(e,t,n){return Math.max(e,Ss(t,n))},$n=function(e,t,n,r,a){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:od,i=r,u,l,s=0;s<e;s++)u=t(s),l=n(s),i=a(i,u,l);return o(i)},Ln={euclidean:function(e,t,n){return e>=2?$n(e,t,n,0,Hi,sd):$n(e,t,n,0,Ui)},squaredEuclidean:function(e,t,n){return $n(e,t,n,0,Hi)},manhattan:function(e,t,n){return $n(e,t,n,0,Ui)},max:function(e,t,n){return $n(e,t,n,-1/0,ld)}};Ln["squared-euclidean"]=Ln.squaredEuclidean,Ln.squaredeuclidean=Ln.squaredEuclidean;function ba(e,t,n,r,a,o){var i;return ze(e)?i=e:i=Ln[e]||Ln.euclidean,t===0&&ze(e)?i(a,o):i(t,n,r,a,o)}var ud=et({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),bi=function(e){return ud(e)},ua=function(e,t,n,r,a){var o=a!=="kMedoids",i=o?function(c){return n[c]}:function(c){return r[c](n)},u=function(c){return r[c](t)},l=n,s=t;return ba(e,r.length,i,u,l,s)},Ba=function(e,t,n){for(var r=n.length,a=new Array(r),o=new Array(r),i=new Array(t),u=null,l=0;l<r;l++)a[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var s=0;s<t;s++){u=[];for(var c=0;c<r;c++)u[c]=Math.random()*(o[c]-a[c])+a[c];i[s]=u}return i},_s=function(e,t,n,r,a){for(var o=1/0,i=0,u=0;u<t.length;u++){var l=ua(n,e,t[u],r,a);l<o&&(o=l,i=u)}return i},Ps=function(e,t,n){for(var r=[],a=null,o=0;o<t.length;o++)a=t[o],n[a.id()]===e&&r.push(a);return r},cd=function(e,t,n){return Math.abs(t-e)<=n},dd=function(e,t,n){for(var r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++){var o=Math.abs(e[r][a]-t[r][a]);if(o>n)return!1}return!0},hd=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Gi=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var a=e[Math.floor(Math.random()*e.length)];hd(a,n,r);)a=e[Math.floor(Math.random()*e.length)];n[r]=a}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},Ki=function(e,t,n){for(var r=0,a=0;a<t.length;a++)r+=ua("manhattan",t[a],e,n,"kMedoids");return r},pd=function(e){var t=this.cy(),n=this.nodes(),r=null,a=bi(e),o=new Array(a.k),i={},u;a.testMode?typeof a.testCentroids=="number"?(a.testCentroids,u=Ba(n,a.k,a.attributes)):We(a.testCentroids)==="object"?u=a.testCentroids:u=Ba(n,a.k,a.attributes):u=Ba(n,a.k,a.attributes);for(var l=!0,s=0;l&&s<a.maxIterations;){for(var c=0;c<n.length;c++)r=n[c],i[r.id()]=_s(r,u,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var h=Ps(d,n,i);if(h.length!==0){for(var p=a.attributes.length,f=u[d],v=new Array(p),m=new Array(p),g=0;g<p;g++){m[g]=0;for(var y=0;y<h.length;y++)r=h[y],m[g]+=a.attributes[g](r);v[g]=m[g]/h.length,cd(v[g],f[g],a.sensitivityThreshold)||(l=!0)}u[d]=v,o[d]=t.collection(h)}}s++}return o},fd=function(e){var t=this.cy(),n=this.nodes(),r=null,a=bi(e),o=new Array(a.k),i,u={},l,s=new Array(a.k);a.testMode?typeof a.testCentroids=="number"||(We(a.testCentroids)==="object"?i=a.testCentroids:i=Gi(n,a.k)):i=Gi(n,a.k);for(var c=!0,d=0;c&&d<a.maxIterations;){for(var h=0;h<n.length;h++)r=n[h],u[r.id()]=_s(r,i,a.distance,a.attributes,"kMedoids");c=!1;for(var p=0;p<i.length;p++){var f=Ps(p,n,u);if(f.length!==0){s[p]=Ki(i[p],f,a.attributes);for(var v=0;v<f.length;v++)l=Ki(f[v],f,a.attributes),l<s[p]&&(s[p]=l,i[p]=f[v],c=!0);o[p]=t.collection(f)}}d++}return o},gd=function(e,t,n,r,a){for(var o,i,u=0;u<t.length;u++)for(var l=0;l<e.length;l++)r[u][l]=Math.pow(n[u][l],a.m);for(var s=0;s<e.length;s++)for(var c=0;c<a.attributes.length;c++){o=0,i=0;for(var d=0;d<t.length;d++)o+=r[d][s]*a.attributes[c](t[d]),i+=r[d][s];e[s][c]=o/i}},vd=function(e,t,n,r,a){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var i,u,l,s=2/(a.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){i=0;for(var h=0;h<n.length;h++)u=ua(a.distance,r[d],n[c],a.attributes,"cmeans"),l=ua(a.distance,r[d],n[h],a.attributes,"cmeans"),i+=Math.pow(u/l,s);e[d][c]=1/i}},yd=function(e,t,n,r){for(var a=new Array(n.k),o=0;o<a.length;o++)a[o]=[];for(var i,u,l=0;l<t.length;l++){i=-1/0,u=-1;for(var s=0;s<t[0].length;s++)t[l][s]>i&&(i=t[l][s],u=s);a[u].push(e[l])}for(var c=0;c<a.length;c++)a[c]=r.collection(a[c]);return a},$i=function(e){var t=this.cy(),n=this.nodes(),r=bi(e),a,o,i,u,l;u=new Array(n.length);for(var s=0;s<n.length;s++)u[s]=new Array(r.k);i=new Array(n.length);for(var c=0;c<n.length;c++)i[c]=new Array(r.k);for(var d=0;d<n.length;d++){for(var h=0,p=0;p<r.k;p++)i[d][p]=Math.random(),h+=i[d][p];for(var f=0;f<r.k;f++)i[d][f]=i[d][f]/h}o=new Array(r.k);for(var v=0;v<r.k;v++)o[v]=new Array(r.attributes.length);l=new Array(n.length);for(var m=0;m<n.length;m++)l[m]=new Array(r.k);for(var g=!0,y=0;g&&y<r.maxIterations;)g=!1,gd(o,n,i,l,r),vd(i,u,o,n,r),dd(i,u,r.sensitivityThreshold)||(g=!0),y++;return a=yd(n,i,r,t),{clusters:a,degreeOfMembership:i}},md={kMeans:pd,kMedoids:fd,fuzzyCMeans:$i,fcm:$i},bd=et({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),xd={single:"min",complete:"max"},wd=function(e){var t=bd(e),n=xd[t.linkage];return n!=null&&(t.linkage=n),t},Zi=function(e,t,n,r,a){for(var o=0,i=1/0,u,l=a.attributes,s=function(x,C){return ba(a.distance,l.length,function(T){return l[T](x)},function(T){return l[T](C)},x,C)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<i&&(o=d,i=h)}if(a.mode==="threshold"&&i>=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var p=t[o],f=t[r[o]],v;a.mode==="dendrogram"?v={left:p,right:f,key:p.key}:v={value:p.value.concat(f.value),key:p.key},e[p.index]=v,e.splice(f.index,1),t[p.key]=v;for(var m=0;m<e.length;m++){var g=e[m];p.key===g.key?u=1/0:a.linkage==="min"?(u=n[p.key][g.key],n[p.key][g.key]>n[f.key][g.key]&&(u=n[f.key][g.key])):a.linkage==="max"?(u=n[p.key][g.key],n[p.key][g.key]<n[f.key][g.key]&&(u=n[f.key][g.key])):a.linkage==="mean"?u=(n[p.key][g.key]*p.size+n[f.key][g.key]*f.size)/(p.size+f.size):a.mode==="dendrogram"?u=s(g.value,p.value):u=s(g.value[0],p.value[0]),n[p.key][g.key]=n[g.key][p.key]=u}for(var y=0;y<e.length;y++){var b=e[y].key;if(r[b]===p.key||r[b]===f.key){for(var w=b,S=0;S<e.length;S++){var k=e[S].key;n[b][k]<n[b][w]&&(w=k)}r[b]=w}e[y].index=y}return p.key=f.key=p.index=f.index=null,!0},Or=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},Ed=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),a=e(t.right,n),o=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:o.id()}}),n.add({group:"edges",data:{source:a,target:o.id()}}),o.id()}else if(t.value)return t.value.id()},kd=function e(t,n,r){if(!t)return[];var a=[],o=[],i=[];return n===0?(t.left&&Or(t.left,a),t.right&&Or(t.right,o),i=a.concat(o),[r.collection(i)]):n===1?t.value?[r.collection(t.value)]:(t.left&&Or(t.left,a),t.right&&Or(t.right,o),[r.collection(a),r.collection(o)]):t.value?[r.collection(t.value)]:(t.left&&(a=e(t.left,n-1,r)),t.right&&(o=e(t.right,n-1,r)),a.concat(o))},Qi=function(e){for(var t=this.cy(),n=this.nodes(),r=wd(e),a=r.attributes,o=function(g,y){return ba(r.distance,a.length,function(b){return a[b](g)},function(b){return a[b](y)},g,y)},i=[],u=[],l=[],s=[],c=0;c<n.length;c++){var d={value:r.mode==="dendrogram"?n[c]:[n[c]],key:c,index:c};i[c]=d,s[c]=d,u[c]=[],l[c]=0}for(var h=0;h<i.length;h++)for(var p=0;p<=h;p++){var f=void 0;r.mode==="dendrogram"?f=h===p?1/0:o(i[h].value,i[p].value):f=h===p?1/0:o(i[h].value[0],i[p].value[0]),u[h][p]=f,u[p][h]=f,f<u[h][l[h]]&&(l[h]=p)}for(var v=Zi(i,s,u,l,r);v;)v=Zi(i,s,u,l,r);var m;return r.mode==="dendrogram"?(m=kd(i[0],r.dendrogramDepth,t),r.addDendrogram&&Ed(i[0],t)):(m=new Array(i.length),i.forEach(function(g,y){g.key=g.index=null,m[y]=t.collection(g.value)})),m},Cd={hierarchicalClustering:Qi,hca:Qi},Dd=et({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Sd=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Le("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(a){return a===n})||ne(n)||Le("Preference must be one of [".concat(r.map(function(a){return"'".concat(a,"'")}).join(", "),"] or a number. Got: ").concat(n)),Dd(e)},_d=function(e,t,n,r){var a=function(o,i){return r[i](o)};return-ba(e,r.length,function(o){return a(t,o)},function(o){return a(n,o)},t,n)},Pd=function(e,t){var n=null;return t==="median"?n=Sc(e):t==="mean"?n=Dc(e):t==="min"?n=kc(e):t==="max"?n=Cc(e):n=t,n},Md=function(e,t,n){for(var r=[],a=0;a<e;a++)t[a*e+a]+n[a*e+a]>0&&r.push(a);return r},Ji=function(e,t,n){for(var r=[],a=0;a<e;a++){for(var o=-1,i=-1/0,u=0;u<n.length;u++){var l=n[u];t[a*e+l]>i&&(o=l,i=t[a*e+l])}o>0&&r.push(o)}for(var s=0;s<n.length;s++)r[n[s]]=n[s];return r},Td=function(e,t,n){for(var r=Ji(e,t,n),a=0;a<n.length;a++){for(var o=[],i=0;i<r.length;i++)r[i]===n[a]&&o.push(i);for(var u=-1,l=-1/0,s=0;s<o.length;s++){for(var c=0,d=0;d<o.length;d++)c+=t[o[d]*e+o[s]];c>l&&(u=s,l=c)}n[a]=o[u]}return r=Ji(e,t,n),r},eo=function(e){for(var t=this.cy(),n=this.nodes(),r=Sd(e),a={},o=0;o<n.length;o++)a[n[o].id()]=o;var i,u,l,s,c,d;i=n.length,u=i*i,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var p=0;p<i;p++)for(var f=0;f<i;f++)p!==f&&(l[p*i+f]=_d(r.distance,n[p],n[f],r.attributes));s=Pd(l,r.preference);for(var v=0;v<i;v++)l[v*i+v]=s;c=new Array(u);for(var m=0;m<u;m++)c[m]=0;d=new Array(u);for(var g=0;g<u;g++)d[g]=0;for(var y=new Array(i),b=new Array(i),w=new Array(i),S=0;S<i;S++)y[S]=0,b[S]=0,w[S]=0;for(var k=new Array(i*r.minIterations),x=0;x<k.length;x++)k[x]=0;var C;for(C=0;C<r.maxIterations;C++){for(var T=0;T<i;T++){for(var P=-1/0,M=-1/0,D=-1,B=0,_=0;_<i;_++)y[_]=c[T*i+_],B=d[T*i+_]+l[T*i+_],B>=P?(M=P,P=B,D=_):B>M&&(M=B);for(var N=0;N<i;N++)c[T*i+N]=(1-r.damping)*(l[T*i+N]-P)+r.damping*y[N];c[T*i+D]=(1-r.damping)*(l[T*i+D]-M)+r.damping*y[D]}for(var A=0;A<i;A++){for(var z=0,O=0;O<i;O++)y[O]=d[O*i+A],b[O]=Math.max(0,c[O*i+A]),z+=b[O];z-=b[A],b[A]=c[A*i+A],z+=b[A];for(var R=0;R<i;R++)d[R*i+A]=(1-r.damping)*Math.min(0,z-b[R])+r.damping*y[R];d[A*i+A]=(1-r.damping)*(z-b[A])+r.damping*y[A]}for(var Y=0,V=0;V<i;V++){var F=d[V*i+V]+c[V*i+V]>0?1:0;k[C%r.minIterations*i+V]=F,Y+=F}if(Y>0&&(C>=r.minIterations-1||C==r.maxIterations-1)){for(var W=0,Q=0;Q<i;Q++){w[Q]=0;for(var re=0;re<r.minIterations;re++)w[Q]+=k[re*i+Q];(w[Q]===0||w[Q]===r.minIterations)&&W++}if(W===i)break}}for(var K=Md(i,c,d),$=Td(i,l,K),I={},H=0;H<K.length;H++)I[K[H]]=[];for(var U=0;U<n.length;U++){var te=a[n[U].id()],ce=$[te];ce!=null&&I[ce].push(n[U])}for(var me=new Array(K.length),Z=0;Z<K.length;Z++)me[Z]=t.collection(I[K[Z]]);return me},Bd={affinityPropagation:eo,ap:eo},Od=et({root:void 0,directed:!1}),Id={hierholzer:function(e){if(!ke(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=Od(e),r=n.root,a=n.directed,o=this,i=!1,u,l,s;r&&(s=he(r)?this.filter(r)[0].id():r[0].id());var c={},d={};a?o.forEach(function(g){var y=g.id();if(g.isNode()){var b=g.indegree(!0),w=g.outdegree(!0),S=b-w,k=w-b;S==1?u?i=!0:u=y:k==1?l?i=!0:l=y:(k>1||S>1)&&(i=!0),c[y]=[],g.outgoers().forEach(function(x){x.isEdge()&&c[y].push(x.id())})}else d[y]=[void 0,g.target().id()]}):o.forEach(function(g){var y=g.id();if(g.isNode()){var b=g.degree(!0);b%2&&(u?l?i=!0:l=y:u=y),c[y]=[],g.connectedEdges().forEach(function(w){return c[y].push(w.id())})}else d[y]=[g.source().id(),g.target().id()]});var h={found:!1,trail:void 0};if(i)return h;if(l&&u)if(a){if(s&&l!=s)return h;s=l}else{if(s&&l!=s&&u!=s)return h;s||(s=l)}else s||(s=o[0].id());var p=function(g){for(var y=g,b=[g],w,S,k;c[y].length;)w=c[y].shift(),S=d[w][0],k=d[w][1],y!=k?(c[k]=c[k].filter(function(x){return x!=w}),y=k):!a&&y!=S&&(c[S]=c[S].filter(function(x){return x!=w}),y=S),b.unshift(w),b.unshift(y);return b},f=[],v=[];for(v=p(s);v.length!=1;)c[v[0]].length==0?(f.unshift(o.getElementById(v.shift())),f.unshift(o.getElementById(v.shift()))):v=p(v.shift()).concat(v);f.unshift(o.getElementById(v.shift()));for(var m in c)if(c[m].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},Ir=function(){var e=this,t={},n=0,r=0,a=[],o=[],i={},u=function(c,d){for(var h=o.length-1,p=[],f=e.spawn();o[h].x!=c||o[h].y!=d;)p.push(o.pop().edge),h--;p.push(o.pop().edge),p.forEach(function(v){var m=v.connectedNodes().intersection(e);f.merge(v),m.forEach(function(g){var y=g.id(),b=g.connectedEdges().intersection(e);f.merge(g),t[y].cutVertex?f.merge(b.filter(function(w){return w.isLoop()})):f.merge(b)})}),a.push(f)},l=function c(d,h,p){d===p&&(r+=1),t[h]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(h).connectedEdges().intersection(e);if(f.size()===0)a.push(e.spawn(e.getElementById(h)));else{var v,m,g,y;f.forEach(function(b){v=b.source().id(),m=b.target().id(),g=v===h?m:v,g!==p&&(y=b.id(),i[y]||(i[y]=!0,o.push({x:h,y:g,edge:b})),g in t?t[h].low=Math.min(t[h].low,t[g].id):(c(d,g,h),t[h].low=Math.min(t[h].low,t[g].low),t[h].id<=t[g].low&&(t[h].cutVertex=!0,u(h,g))))})}};e.forEach(function(c){if(c.isNode()){var d=c.id();d in t||(r=0,l(d,d),t[d].cutVertex=r>1)}});var s=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(s),components:a}},Nd={hopcroftTarjanBiconnected:Ir,htbc:Ir,htb:Ir,hopcroftTarjanBiconnectedComponents:Ir},Nr=function(){var e=this,t={},n=0,r=[],a=[],o=e.spawn(e),i=function u(l){a.push(l),t[l]={index:n,low:n++,explored:!1};var s=e.getElementById(l).connectedEdges().intersection(e);if(s.forEach(function(f){var v=f.target().id();v!==l&&(v in t||u(v),t[v].explored||(t[l].low=Math.min(t[l].low,t[v].low)))}),t[l].index===t[l].low){for(var c=e.spawn();;){var d=a.pop();if(c.merge(e.getElementById(d)),t[d].low=t[l].index,t[d].explored=!0,d===l)break}var h=c.edgesWith(c),p=c.merge(h);r.push(p),o=o.difference(p)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||i(l)}}),{cut:o,components:r}},Ad={tarjanStronglyConnected:Nr,tsc:Nr,tscc:Nr,tarjanStronglyConnectedComponents:Nr},Ms={};[ir,dc,hc,fc,vc,mc,wc,Uc,Mn,Tn,Wa,id,md,Cd,Bd,Id,Nd,Ad].forEach(function(e){ge(Ms,e)});var Ts=0,Bs=1,Os=2,qt=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=Ts,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};qt.prototype={fulfill:function(e){return to(this,Bs,"fulfillValue",e)},reject:function(e){return to(this,Os,"rejectReason",e)},then:function(e,t){var n=this,r=new qt;return n.onFulfilled.push(ro(e,r,"fulfill")),n.onRejected.push(ro(t,r,"reject")),Is(n),r.proxy}};var to=function(e,t,n,r){return e.state===Ts&&(e.state=t,e[n]=r,Is(e)),e},Is=function(e){e.state===Bs?no(e,"onFulfilled",e.fulfillValue):e.state===Os&&no(e,"onRejected",e.rejectReason)},no=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var o=0;o<r.length;o++)r[o](n)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},ro=function(e,t,n){return function(r){if(typeof e!="function")t[n].call(t,r);else{var a;try{a=e(r)}catch(o){t.reject(o);return}zd(t,a)}}},zd=function e(t,n){if(t===n||t.proxy===n){t.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(We(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(o){t.reject(o);return}if(typeof r=="function"){var a=!1;try{r.call(n,function(o){a||(a=!0,o===n?t.reject(new TypeError("circular thenable chain")):e(t,o))},function(o){a||(a=!0,t.reject(o))})}catch(o){a||t.reject(o)}return}t.fulfill(n)};qt.all=function(e){return new qt(function(t,n){for(var r=new Array(e.length),a=0,o=function(u,l){r[u]=l,a++,a===e.length&&t(r)},i=0;i<e.length;i++)(function(u){var l=e[u],s=l!=null&&l.then!=null;if(s)l.then(function(d){o(u,d)},function(d){n(d)});else{var c=l;o(u,c)}})(i)})},qt.resolve=function(e){return new qt(function(t,n){t(e)})},qt.reject=function(e){return new qt(function(t,n){n(e)})};var Wn=typeof Promise<"u"?Promise:qt,Ua=function(e,t,n){var r=hi(e),a=!r,o=this._private=ge({duration:1e3},t,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&ze(o.complete)&&o.completes.push(o.complete),a){var i=e.position();o.startPosition=o.startPosition||{x:i.x,y:i.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(r){var u=e.pan();o.startPan={x:u.x,y:u.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},an=Ua.prototype;ge(an,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),gt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(u,l){var s=e[u];s!=null&&(e[u]=e[l],e[l]=s)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],o=a.name,i=e.startStyle[o];e.startStyle[o]=a,e.style[r]=i}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new Wn(function(r,a){n.push(function(){r()})})}}),an.complete=an.completed,an.run=an.play,an.running=an.playing;var Rd={animated:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return!1;var a=n[0];if(a)return a._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var a=0;a<n.length;a++){var o=n[a];o._private.animation.queue=[]}return this}},delay:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],o=this._private.cy||this,i=!r,u=!i;if(!o.styleEnabled())return this;var l=o.style();e=ge({},e,t);var s=Object.keys(e).length===0;if(s)return new Ua(a[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200;break}if(u&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),u&&e.renderedPosition!=null){var c=e.renderedPosition,d=o.pan(),h=o.zoom();e.position=xs(c,h,d)}if(i&&e.panBy!=null){var p=e.panBy,f=o.pan();e.pan={x:f.x+p.x,y:f.y+p.y}}var v=e.center||e.centre;if(i&&v!=null){var m=o.getCenterPan(v.eles,e.zoom);m!=null&&(e.pan=m)}if(i&&e.fit!=null){var g=e.fit,y=o.getFitViewport(g.eles||g.boundingBox,g.padding);y!=null&&(e.pan=y.pan,e.zoom=y.zoom)}if(i&&ke(e.zoom)){var b=o.getZoomedViewport(e.zoom);b!=null?(b.zoomed&&(e.zoom=b.zoom),b.panned&&(e.pan=b.pan)):e.zoom=null}return new Ua(a[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;t&&(e=ge({},e,t));for(var i=0;i<a.length;i++){var u=a[i],l=u.animated()&&(e.queue===void 0||e.queue),s=u.animation(e,l?{queue:!0}:void 0);s.play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length!==void 0,a=r?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var i=0;i<a.length;i++){for(var u=a[i],l=u._private,s=l.animation.current,c=0;c<s.length;c++){var d=s[c],h=d._private;t&&(h.duration=0)}e&&(l.animation.queue=[]),t||(l.animation.current=[])}return o.notify("draw"),this}}},Ld=Array.isArray,xa=Ld,Vd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Fd=/^\w*$/;function jd(e,t){if(xa(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Dr(e)?!0:Fd.test(e)||!Vd.test(e)||t!=null&&e in Object(t)}var qd=jd,Yd="[object AsyncFunction]",Xd="[object Function]",Wd="[object GeneratorFunction]",Ud="[object Proxy]";function Hd(e){if(!gn(e))return!1;var t=ds(e);return t==Xd||t==Wd||t==Yd||t==Ud}var Gd=Hd,Kd=ga["__core-js_shared__"],Oa=Kd,ao=(function(){var e=/[^.]+$/.exec(Oa&&Oa.keys&&Oa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function $d(e){return!!ao&&ao in e}var Zd=$d,Qd=Function.prototype,Jd=Qd.toString;function eh(e){if(e!=null){try{return Jd.call(e)}catch{}try{return e+""}catch{}}return""}var th=eh,nh=/[\\^$.*+?()[\]{}|]/g,rh=/^\[object .+?Constructor\]$/,ah=Function.prototype,ih=Object.prototype,oh=ah.toString,sh=ih.hasOwnProperty,lh=RegExp("^"+oh.call(sh).replace(nh,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function uh(e){if(!gn(e)||Zd(e))return!1;var t=Gd(e)?lh:rh;return t.test(th(e))}var ch=uh;function dh(e,t){return e?.[t]}var hh=dh;function ph(e,t){var n=hh(e,t);return ch(n)?n:void 0}var xi=ph,fh=xi(Object,"create"),br=fh;function gh(){this.__data__=br?br(null):{},this.size=0}var vh=gh;function yh(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var mh=yh,bh="__lodash_hash_undefined__",xh=Object.prototype,wh=xh.hasOwnProperty;function Eh(e){var t=this.__data__;if(br){var n=t[e];return n===bh?void 0:n}return wh.call(t,e)?t[e]:void 0}var kh=Eh,Ch=Object.prototype,Dh=Ch.hasOwnProperty;function Sh(e){var t=this.__data__;return br?t[e]!==void 0:Dh.call(t,e)}var _h=Sh,Ph="__lodash_hash_undefined__";function Mh(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=br&&t===void 0?Ph:t,this}var Th=Mh;function Bn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Bn.prototype.clear=vh,Bn.prototype.delete=mh,Bn.prototype.get=kh,Bn.prototype.has=_h,Bn.prototype.set=Th;var io=Bn;function Bh(){this.__data__=[],this.size=0}var Oh=Bh;function Ih(e,t){return e===t||e!==e&&t!==t}var Ns=Ih;function Nh(e,t){for(var n=e.length;n--;)if(Ns(e[n][0],t))return n;return-1}var wa=Nh,Ah=Array.prototype,zh=Ah.splice;function Rh(e){var t=this.__data__,n=wa(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():zh.call(t,n,1),--this.size,!0}var Lh=Rh;function Vh(e){var t=this.__data__,n=wa(t,e);return n<0?void 0:t[n][1]}var Fh=Vh;function jh(e){return wa(this.__data__,e)>-1}var qh=jh;function Yh(e,t){var n=this.__data__,r=wa(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Xh=Yh;function On(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}On.prototype.clear=Oh,On.prototype.delete=Lh,On.prototype.get=Fh,On.prototype.has=qh,On.prototype.set=Xh;var Wh=On,Uh=xi(ga,"Map"),Hh=Uh;function Gh(){this.size=0,this.__data__={hash:new io,map:new(Hh||Wh),string:new io}}var Kh=Gh;function $h(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Zh=$h;function Qh(e,t){var n=e.__data__;return Zh(t)?n[typeof t=="string"?"string":"hash"]:n.map}var Ea=Qh;function Jh(e){var t=Ea(this,e).delete(e);return this.size-=t?1:0,t}var ep=Jh;function tp(e){return Ea(this,e).get(e)}var np=tp;function rp(e){return Ea(this,e).has(e)}var ap=rp;function ip(e,t){var n=Ea(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var op=ip;function In(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}In.prototype.clear=Kh,In.prototype.delete=ep,In.prototype.get=np,In.prototype.has=ap,In.prototype.set=op;var As=In,sp="Expected a function";function wi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(sp);var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],o=n.cache;if(o.has(a))return o.get(a);var i=e.apply(this,r);return n.cache=o.set(a,i)||o,i};return n.cache=new(wi.Cache||As),n}wi.Cache=As;var lp=wi,up=500;function cp(e){var t=lp(e,function(r){return n.size===up&&n.clear(),r}),n=t.cache;return t}var dp=cp,hp=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pp=/\\(\\)?/g,fp=dp(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(hp,function(n,r,a,o){t.push(a?o.replace(pp,"$1"):r||n)}),t}),zs=fp;function gp(e,t){for(var n=-1,r=e==null?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a}var Rs=gp,oo=Yn?Yn.prototype:void 0,so=oo?oo.toString:void 0;function Ls(e){if(typeof e=="string")return e;if(xa(e))return Rs(e,Ls)+"";if(Dr(e))return so?so.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var vp=Ls;function yp(e){return e==null?"":vp(e)}var Vs=yp;function mp(e,t){return xa(e)?e:qd(e,t)?[e]:zs(Vs(e))}var Fs=mp;function bp(e){if(typeof e=="string"||Dr(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Ei=bp;function xp(e,t){t=Fs(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ei(t[n++])];return n&&n==r?e:void 0}var wp=xp;function Ep(e,t,n){var r=e==null?void 0:wp(e,t);return r===void 0?n:r}var kp=Ep,Cp=(function(){try{var e=xi(Object,"defineProperty");return e({},"",{}),e}catch{}})(),lo=Cp;function Dp(e,t,n){t=="__proto__"&&lo?lo(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Sp=Dp,_p=Object.prototype,Pp=_p.hasOwnProperty;function Mp(e,t,n){var r=e[t];(!(Pp.call(e,t)&&Ns(r,n))||n===void 0&&!(t in e))&&Sp(e,t,n)}var Tp=Mp,Bp=9007199254740991,Op=/^(?:0|[1-9]\d*)$/;function Ip(e,t){var n=typeof e;return t=t??Bp,!!t&&(n=="number"||n!="symbol"&&Op.test(e))&&e>-1&&e%1==0&&e<t}var Np=Ip;function Ap(e,t,n,r){if(!gn(e))return e;t=Fs(t,e);for(var a=-1,o=t.length,i=o-1,u=e;u!=null&&++a<o;){var l=Ei(t[a]),s=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(a!=i){var c=u[l];s=r?r(c,l,u):void 0,s===void 0&&(s=gn(c)?c:Np(t[a+1])?[]:{})}Tp(u,l,s),u=u[l]}return e}var zp=Ap;function Rp(e,t,n){return e==null?e:zp(e,t,n)}var Lp=Rp;function Vp(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Fp=Vp;function jp(e){return xa(e)?Rs(e,Ei):Dr(e)?[e]:Fp(zs(Vs(e)))}var qp=jp,Yp={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,r){},onSet:function(n){},canSet:function(n){return!0}};return e=ge({},t,e),function(n,r){var a=e,o=this,i=o.length!==void 0,u=i?o:[o],l=i?o[0]:o;if(he(n)){var s=n.indexOf(".")!==-1,c=s&&qp(n);if(a.allowGetting&&r===void 0){var d;return l&&(a.beforeGet(l),c&&l._private[a.field][n]===void 0?d=kp(l._private[a.field],c):d=l._private[a.field][n]),d}else if(a.allowSetting&&r!==void 0){var h=!a.immutableKeys[n];if(h){var p=es({},n,r);a.beforeSet(o,p);for(var f=0,v=u.length;f<v;f++){var m=u[f];a.canSet(m)&&(c&&l._private[a.field][n]===void 0?Lp(m._private[a.field],c,r):m._private[a.field][n]=r)}a.updateStyle&&o.updateStyle(),a.onSet(o),a.settingTriggersEvent&&o[a.triggerFnName](a.settingEvent)}}}else if(a.allowSetting&&ke(n)){var g=n,y,b,w=Object.keys(g);a.beforeSet(o,g);for(var S=0;S<w.length;S++){y=w[S],b=g[y];var k=!a.immutableKeys[y];if(k)for(var x=0;x<u.length;x++){var C=u[x];a.canSet(C)&&(C._private[a.field][y]=b)}}a.updateStyle&&o.updateStyle(),a.onSet(o),a.settingTriggersEvent&&o[a.triggerFnName](a.settingEvent)}else if(a.allowBinding&&ze(n)){var T=n;o.on(a.bindingEvent,T)}else if(a.allowGetting&&n===void 0){var P;return l&&(a.beforeGet(l),P=l._private[a.field]),P}return o}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ge({},t,e),function(n){var r=e,a=this,o=a.length!==void 0,i=o?a:[a];if(he(n)){for(var u=n.split(/\s+/),l=u.length,s=0;s<l;s++){var c=u[s];if(!tn(c)){var d=!r.immutableKeys[c];if(d)for(var h=0,p=i.length;h<p;h++)i[h]._private[r.field][c]=void 0}}r.triggerEvent&&a[r.triggerFnName](r.event)}else if(n===void 0){for(var f=0,v=i.length;f<v;f++)for(var m=i[f]._private[r.field],g=Object.keys(m),y=0;y<g.length;y++){var b=g[y],w=!r.immutableKeys[b];w&&(m[b]=void 0)}r.triggerEvent&&a[r.triggerFnName](r.event)}return a}}},Xp={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,r){var a=this,o=Array.prototype.slice.call(arguments,0);return new Wn(function(i,u){var l=function(d){a.off.apply(a,c),i(d)},s=o.concat([l]),c=s.concat([]);a.on.apply(a,s)})}}},_e={};[Rd,Yp,Xp].forEach(function(e){ge(_e,e)});var Wp={animate:_e.animate(),animation:_e.animation(),animated:_e.animated(),clearQueue:_e.clearQueue(),delay:_e.delay(),delayAnimation:_e.delayAnimation(),stop:_e.stop()},Ur={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(p){return n.push(p)}),n}else Be(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],a=new Xn(e),o=0;o<t.length;o++){for(var i=t[o],u=i._private,l=u.classes,s=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d);if(!h){s=!0;break}}s||(s=l.size!==e.length),s&&(u.classes=a,r.push(i))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Be(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],o=0,i=n.length;o<i;o++)for(var u=n[o],l=u._private.classes,s=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),p=!1;t||r&&!h?(l.add(d),p=!0):(!t||r&&h)&&(l.delete(d),p=!0),!s&&p&&(a.push(u),s=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Ur.className=Ur.classNames=Ur.classes;var Ee={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Xe,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ee.variable="(?:[\\w-.]|(?:\\\\"+Ee.metaChar+"))+",Ee.className="(?:[\\w-]|(?:\\\\"+Ee.metaChar+"))+",Ee.value=Ee.string+"|"+Ee.number,Ee.id=Ee.variable,(function(){var e,t,n;for(e=Ee.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Ee.comparatorOp+="|@"+t;for(e=Ee.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(Ee.comparatorOp+="|\\!"+t)})();var Te=function(){return{checks:[]}},ie={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Ha=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return iu(e.selector,t.selector)}),Up=(function(){for(var e={},t,n=0;n<Ha.length;n++)t=Ha[n],e[t.selector]=t.matches;return e})(),Hp=function(e,t){return Up[e](t)},Gp="("+Ha.map(function(e){return e.selector}).join("|")+")",bn=function(e){return e.replace(new RegExp("\\\\("+Ee.metaChar+")","g"),function(t,n){return n})},Ut=function(e,t,n){e[e.length-1]=n},Ga=[{name:"group",query:!0,regex:"("+Ee.group+")",populate:function(e,t,n){var r=Dt(n,1),a=r[0];t.checks.push({type:ie.GROUP,value:a==="*"?a:a+"s"})}},{name:"state",query:!0,regex:Gp,populate:function(e,t,n){var r=Dt(n,1),a=r[0];t.checks.push({type:ie.STATE,value:a})}},{name:"id",query:!0,regex:"\\#("+Ee.id+")",populate:function(e,t,n){var r=Dt(n,1),a=r[0];t.checks.push({type:ie.ID,value:bn(a)})}},{name:"className",query:!0,regex:"\\.("+Ee.className+")",populate:function(e,t,n){var r=Dt(n,1),a=r[0];t.checks.push({type:ie.CLASS,value:bn(a)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ee.variable+")\\s*\\]",populate:function(e,t,n){var r=Dt(n,1),a=r[0];t.checks.push({type:ie.DATA_EXIST,field:bn(a)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ee.variable+")\\s*("+Ee.comparatorOp+")\\s*("+Ee.value+")\\s*\\]",populate:function(e,t,n){var r=Dt(n,3),a=r[0],o=r[1],i=r[2],u=new RegExp("^"+Ee.string+"$").exec(i)!=null;u?i=i.substring(1,i.length-1):i=parseFloat(i),t.checks.push({type:ie.DATA_COMPARE,field:bn(a),operator:o,value:i})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ee.boolOp+")\\s*("+Ee.variable+")\\s*\\]",populate:function(e,t,n){var r=Dt(n,2),a=r[0],o=r[1];t.checks.push({type:ie.DATA_BOOL,field:bn(o),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ee.meta+")\\s*("+Ee.comparatorOp+")\\s*("+Ee.number+")\\s*\\]\\]",populate:function(e,t,n){var r=Dt(n,3),a=r[0],o=r[1],i=r[2];t.checks.push({type:ie.META_COMPARE,field:bn(a),operator:o,value:parseFloat(i)})}},{name:"nextQuery",separator:!0,regex:Ee.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,a=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=r,o.compoundCount=a,e.edgeCount=0,e.compoundCount=0;var i=e[e.length++]=Te();return i}},{name:"directedEdge",separator:!0,regex:Ee.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Te(),r=t,a=Te();return n.checks.push({type:ie.DIRECTED_EDGE,source:r,target:a}),Ut(e,t,n),e.edgeCount++,a}else{var o=Te(),i=t,u=Te();return o.checks.push({type:ie.NODE_SOURCE,source:i,target:u}),Ut(e,t,o),e.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:Ee.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Te(),r=t,a=Te();return n.checks.push({type:ie.UNDIRECTED_EDGE,nodes:[r,a]}),Ut(e,t,n),e.edgeCount++,a}else{var o=Te(),i=t,u=Te();return o.checks.push({type:ie.NODE_NEIGHBOR,node:i,neighbor:u}),Ut(e,t,o),u}}},{name:"child",separator:!0,regex:Ee.child,populate:function(e,t){if(e.currentSubject==null){var n=Te(),r=Te(),a=e[e.length-1];return n.checks.push({type:ie.CHILD,parent:a,child:r}),Ut(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var o=Te(),i=e[e.length-1],u=Te(),l=Te(),s=Te(),c=Te();return o.checks.push({type:ie.COMPOUND_SPLIT,left:i,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:ie.TRUE}],c.checks.push({type:ie.TRUE}),u.checks.push({type:ie.PARENT,parent:c,child:s}),Ut(e,i,o),e.currentSubject=l,e.compoundCount++,s}else{var d=Te(),h=Te(),p=[{type:ie.PARENT,parent:d,child:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Ee.descendant,populate:function(e,t){if(e.currentSubject==null){var n=Te(),r=Te(),a=e[e.length-1];return n.checks.push({type:ie.DESCENDANT,ancestor:a,descendant:r}),Ut(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var o=Te(),i=e[e.length-1],u=Te(),l=Te(),s=Te(),c=Te();return o.checks.push({type:ie.COMPOUND_SPLIT,left:i,right:u,subject:l}),l.checks=t.checks,t.checks=[{type:ie.TRUE}],c.checks.push({type:ie.TRUE}),u.checks.push({type:ie.ANCESTOR,ancestor:c,descendant:s}),Ut(e,i,o),e.currentSubject=l,e.compoundCount++,s}else{var d=Te(),h=Te(),p=[{type:ie.ANCESTOR,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Ee.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Pe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],r=n.checks[0],a=r==null?null:r.type;a===ie.DIRECTED_EDGE?r.type=ie.NODE_TARGET:a===ie.UNDIRECTED_EDGE&&(r.type=ie.NODE_NEIGHBOR,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];Ga.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var Kp=function(e){for(var t,n,r,a=0;a<Ga.length;a++){var o=Ga[a],i=o.name,u=e.match(o.regexObj);if(u!=null){n=u,t=o,r=i;var l=u[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},$p=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},Zp=function(e){var t=this,n=t.inputText=e,r=t[0]=Te();for(t.length=1,n=$p(n);;){var a=Kp(n);if(a.expr==null)return Pe("The selector `"+e+"`is invalid"),!1;var o=a.match.slice(1),i=a.expr.populate(t,r,o);if(i===!1)return!1;if(i!=null&&(r=i),n=a.remaining,n.match(/^\s*$/))break}var u=t[t.length-1];t.currentSubject!=null&&(u.subject=t.currentSubject),u.edgeCount=t.edgeCount,u.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var s=t[l];if(s.compoundCount>0&&s.edgeCount>0)return Pe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(s.edgeCount>1)return Pe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;s.edgeCount===1&&Pe("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},Qp=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return he(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,s){var c=l.type,d=l.value;switch(c){case ie.GROUP:{var h=e(d);return h.substring(0,h.length-1)}case ie.DATA_COMPARE:{var p=l.field,f=l.operator;return"["+p+n(e(f))+t(d)+"]"}case ie.DATA_BOOL:{var v=l.operator,m=l.field;return"["+e(v)+m+"]"}case ie.DATA_EXIST:{var g=l.field;return"["+g+"]"}case ie.META_COMPARE:{var y=l.operator,b=l.field;return"[["+b+n(e(y))+t(d)+"]]"}case ie.STATE:return d;case ie.ID:return"#"+d;case ie.CLASS:return"."+d;case ie.PARENT:case ie.CHILD:return a(l.parent,s)+n(">")+a(l.child,s);case ie.ANCESTOR:case ie.DESCENDANT:return a(l.ancestor,s)+" "+a(l.descendant,s);case ie.COMPOUND_SPLIT:{var w=a(l.left,s),S=a(l.subject,s),k=a(l.right,s);return w+(w.length>0?" ":"")+S+k}case ie.TRUE:return""}},a=function(l,s){return l.checks.reduce(function(c,d,h){return c+(s===l&&h===0?"$":"")+r(d,s)},"")},o="",i=0;i<this.length;i++){var u=this[i];o+=a(u,u.subject),this.length>1&&i<this.length-1&&(o+=", ")}return this.toStringCache=o,o},Jp={parse:Zp,toString:Qp},uo=function(e,t,n){var r,a=he(e),o=ne(e),i=he(n),u,l,s=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),s=!0),(a||i||s)&&(u=!a&&!o?"":""+e,l=""+n),s&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":r=u.indexOf(l)>=0;break;case"$=":r=u.indexOf(l,u.length-l.length)>=0;break;case"^=":r=u.indexOf(l)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1;break}return c&&(e!=null||!d)&&(r=!r),r},ef=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},tf=function(e){return e!==void 0},Ia=function(e,t){return e.data(t)},nf=function(e,t){return e[t]()},Re=[],Ne=function(e,t){return e.checks.every(function(n){return Re[n.type](n,t)})};Re[ie.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()},Re[ie.STATE]=function(e,t){var n=e.value;return Hp(n,t)},Re[ie.ID]=function(e,t){var n=e.value;return t.id()===n},Re[ie.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},Re[ie.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return uo(nf(t,n),r,a)},Re[ie.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,a=e.value;return uo(Ia(t,n),r,a)},Re[ie.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return ef(Ia(t,n),r)},Re[ie.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,tf(Ia(t,n))},Re[ie.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),o=t.target();return Ne(n,a)&&Ne(r,o)||Ne(r,a)&&Ne(n,o)},Re[ie.NODE_NEIGHBOR]=function(e,t){return Ne(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&Ne(e.neighbor,n)})},Re[ie.DIRECTED_EDGE]=function(e,t){return Ne(e.source,t.source())&&Ne(e.target,t.target())},Re[ie.NODE_SOURCE]=function(e,t){return Ne(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&Ne(e.target,n)})},Re[ie.NODE_TARGET]=function(e,t){return Ne(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&Ne(e.source,n)})},Re[ie.CHILD]=function(e,t){return Ne(e.child,t)&&Ne(e.parent,t.parent())},Re[ie.PARENT]=function(e,t){return Ne(e.parent,t)&&t.children().some(function(n){return Ne(e.child,n)})},Re[ie.DESCENDANT]=function(e,t){return Ne(e.descendant,t)&&t.ancestors().some(function(n){return Ne(e.ancestor,n)})},Re[ie.ANCESTOR]=function(e,t){return Ne(e.ancestor,t)&&t.descendants().some(function(n){return Ne(e.descendant,n)})},Re[ie.COMPOUND_SPLIT]=function(e,t){return Ne(e.subject,t)&&Ne(e.left,t)&&Ne(e.right,t)},Re[ie.TRUE]=function(){return!0},Re[ie.COLLECTION]=function(e,t){var n=e.value;return n.has(t)},Re[ie.FILTER]=function(e,t){var n=e.value;return n(t)};var rf=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===ie.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(r){for(var a=0;a<t.length;a++){var o=t[a];if(Ne(o,r))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},af=function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(Ne(r,e))return!0}return!1},of={matches:af,filter:rf},nn=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||he(e)&&e.match(/^\s*$/)||(gt(e)?this.addQuery({checks:[{type:ie.COLLECTION,value:e.collection()}]}):ze(e)?this.addQuery({checks:[{type:ie.FILTER,value:e}]}):he(e)?this.parse(e)||(this.invalid=!0):Le("A selector must be created from a string; found "))},Ht=nn.prototype;[Jp,of].forEach(function(e){return ge(Ht,e)}),Ht.text=function(){return this.inputText},Ht.size=function(){return this.length},Ht.eq=function(e){return this[e]},Ht.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Ht.addQuery=function(e){this[this.length++]=e},Ht.selector=Ht.toString;var Kt={allAre:function(e){var t=new nn(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new nn(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(r)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!r)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(r){return e.hasElementWithId(r.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};Kt.allAreNeighbours=Kt.allAreNeighbors,Kt.has=Kt.contains,Kt.equal=Kt.equals=Kt.same;var mt=function(e,t){return function(n,r,a,o){var i=n,u=this,l;if(i==null?l="":gt(i)&&i.length===1&&(l=i.id()),u.length===1&&l){var s=u[0]._private,c=s.traversalCache=s.traversalCache||{},d=c[t]=c[t]||[],h=vn(l),p=d[h];return p||(d[h]=e.call(u,n,r,a,o))}else return e.call(u,n,r,a,o)}},qn={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var a=this[r],o=a._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n],a=r.parents();t=t||a,t=t.intersect(a)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:mt(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],a=r._private.children,o=0;o<a.length;o++)t.push(a[o]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(r){for(var a=0;a<r.length;a++){var o=r[a];t.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function ki(e,t,n,r){for(var a=[],o=new Xn,i=e.cy(),u=i.hasCompoundNodes(),l=0;l<e.length;l++){var s=e[l];n?a.push(s):u&&r(a,o,s)}for(;a.length>0;){var c=a.shift();t(c),o.add(c.id()),u&&r(a,o,c)}return e}function js(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var o=r[a];t.has(o.id())||e.push(o)}}qn.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,js)};function qs(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}qn.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,qs)};function sf(e,t,n){qs(e,t,n),js(e,t,n)}qn.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,sf)},qn.ancestors=qn.parents;var Zn,Ys;Zn=Ys={data:_e.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:_e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:_e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:_e.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:_e.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Zn.attr=Zn.data,Zn.removeAttr=Zn.removeData;var lf=Ys,ca={};function Na(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],o=a._private.edges,i=0;i<o.length;i++){var u=o[i];!t&&u.isLoop()||(r+=e(a,u))}return r}else return}}ge(ca,{degree:Na(function(e,t){return t.source().same(t.target())?2:1}),indegree:Na(function(e,t){return t.target().same(e)?1:0}),outdegree:Na(function(e,t){return t.source().same(e)?1:0})});function xn(e,t){return function(n){for(var r,a=this.nodes(),o=0;o<a.length;o++){var i=a[o],u=i[e](n);u!==void 0&&(r===void 0||t(u,r))&&(r=u)}return r}}ge(ca,{minDegree:xn("degree",function(e,t){return e<t}),maxDegree:xn("degree",function(e,t){return e>t}),minIndegree:xn("indegree",function(e,t){return e<t}),maxIndegree:xn("indegree",function(e,t){return e>t}),minOutdegree:xn("outdegree",function(e,t){return e<t}),maxOutdegree:xn("outdegree",function(e,t){return e>t})}),ge(ca,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var Ct,Xs,Ws=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(!a.locked()){var o=a._private.position,i={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};a.isParent()&&!(i.x===0&&i.y===0)&&a.children().shift(i,n),a.dirtyBoundingBoxCache()}}},co={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Ws(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ct=Xs={position:_e.data(co),silentPosition:_e.data(ge({},co,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Ws(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(ke(e))t?this.silentPosition(e):this.position(e);else if(ze(e)){var n=e,r=this.cy();r.startBatch();for(var a=0;a<this.length;a++){var o=this[a],i=void 0;(i=n(o,a))&&(t?o.silentPosition(i):o.position(i))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(ke(e)?(r={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},n=t):he(e)&&ne(t)&&(r={x:0,y:0},r[e]=t),r!=null){var a=this.cy();a.startBatch();for(var o=0;o<this.length;o++){var i=this[o];if(!(a.hasCompoundNodes()&&i.isChild()&&i.ancestors().anySame(this))){var u=i.position(),l={x:u.x+r.x,y:u.y+r.y};n?i.silentPosition(l):i.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return ke(e)?this.shift(e,!0):he(e)&&ne(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),a=r.zoom(),o=r.pan(),i=ke(e)?e:void 0,u=i!==void 0||t!==void 0&&he(e);if(n&&n.isNode())if(u)for(var l=0;l<this.length;l++){var s=this[l];t!==void 0?s.position(e,(t-o[e])/a):i!==void 0&&s.position(xs(i,a,o))}else{var c=n.position();return i=ma(c,a,o),e===void 0?i:i[e]}else if(!u)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),a=ke(e)?e:void 0,o=a!==void 0||t!==void 0&&he(e),i=r.hasCompoundNodes();if(n&&n.isNode())if(o)for(var u=0;u<this.length;u++){var l=this[u],s=i?l.parent():null,c=s&&s.length>0,d=c;c&&(s=s[0]);var h=d?s.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):a!==void 0&&l.position({x:a.x+h.x,y:a.y+h.y})}else{var p=n.position(),f=i?n.parent():null,v=f&&f.length>0,m=v;v&&(f=f[0]);var g=m?f.position():{x:0,y:0};return a={x:p.x-g.x,y:p.y-g.y},e===void 0?a:a[e]}else if(!o)return;return this}},Ct.modelPosition=Ct.point=Ct.position,Ct.modelPositions=Ct.points=Ct.positions,Ct.renderedPoint=Ct.renderedPosition,Ct.relativePoint=Ct.relativePosition;var uf=Xs,Nn,Jt;Nn=Jt={},Jt.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),o=t.x1*r+a.x,i=t.x2*r+a.x,u=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:o,x2:i,y1:u,y2:l,w:i-o,h:l-u}},Jt.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)},Jt.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(i){if(!i.isParent())return;var u=i._private,l=i.children(),s=i.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:i.pstyle("min-width").pfValue,left:i.pstyle("min-width-bias-left"),right:i.pstyle("min-width-bias-right")},height:{val:i.pstyle("min-height").pfValue,top:i.pstyle("min-height-bias-top"),bottom:i.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:s,includeOverlays:!1,useCache:!1}),h=u.position;(d.w===0||d.h===0)&&(d={w:i.pstyle("width").pfValue,h:i.pstyle("height").pfValue},d.x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);function p(T,P,M){var D=0,B=0,_=P+M;return T>0&&_>0&&(D=P/_*T,B=M/_*T),{biasDiff:D,biasComplementDiff:B}}function f(T,P,M,D){if(M.units==="%")switch(D){case"width":return T>0?M.pfValue*T:0;case"height":return P>0?M.pfValue*P:0;case"average":return T>0&&P>0?M.pfValue*(T+P)/2:0;case"min":return T>0&&P>0?T>P?M.pfValue*P:M.pfValue*T:0;case"max":return T>0&&P>0?T>P?M.pfValue*T:M.pfValue*P:0;default:return 0}else return M.units==="px"?M.pfValue:0}var v=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(m=m*100/c.width.val);var g=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(g=g*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var b=p(c.width.val-d.w,v,m),w=b.biasDiff,S=b.biasComplementDiff,k=p(c.height.val-d.h,g,y),x=k.biasDiff,C=k.biasComplementDiff;u.autoPadding=f(d.w,d.h,i.pstyle("padding"),i.pstyle("padding-relative-to").value),u.autoWidth=Math.max(d.w,c.width.val),h.x=(-w+d.x1+d.x2+S)/2,u.autoHeight=Math.max(d.h,c.height.val),h.y=(-x+d.y1+d.y2+C)/2}for(var r=0;r<this.length;r++){var a=this[r],o=a._private;(!o.compoundBoundsClean||e)&&(n(a),t.batching()||(o.compoundBoundsClean=!0))}return this};var yt=function(e){return e===1/0||e===-1/0?0:e},_t=function(e,t,n,r,a){r-t===0||a-n===0||t==null||n==null||r==null||a==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},un=function(e,t){return t==null?e:_t(e,t.x1,t.y1,t.x2,t.y2)},Qn=function(e,t,n){return St(e,t,n)},Ar=function(e,t,n){if(!t.cy().headless()){var r=t._private,a=r.rstyle,o=a.arrowWidth/2,i=t.pstyle(n+"-arrow-shape").value,u,l;if(i!=="none"){n==="source"?(u=a.srcX,l=a.srcY):n==="target"?(u=a.tgtX,l=a.tgtY):(u=a.midX,l=a.midY);var s=r.arrowBounds=r.arrowBounds||{},c=s[n]=s[n]||{};c.x1=u-o,c.y1=l-o,c.x2=u+o,c.y2=l+o,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Xr(c,1),_t(e,c.x1,c.y1,c.x2,c.y2)}}},Aa=function(e,t,n){if(!t.cy().headless()){var r;n?r=n+"-":r="";var a=t._private,o=a.rstyle,i=t.pstyle(r+"label").strValue;if(i){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),s=Qn(o,"labelWidth",n),c=Qn(o,"labelHeight",n),d=Qn(o,"labelX",n),h=Qn(o,"labelY",n),p=t.pstyle(r+"text-margin-x").pfValue,f=t.pstyle(r+"text-margin-y").pfValue,v=t.isEdge(),m=t.pstyle(r+"text-rotation"),g=t.pstyle("text-outline-width").pfValue,y=t.pstyle("text-border-width").pfValue,b=y/2,w=t.pstyle("text-background-padding").pfValue,S=2,k=c,x=s,C=x/2,T=k/2,P,M,D,B;if(v)P=d-C,M=d+C,D=h-T,B=h+T;else{switch(u.value){case"left":P=d-x,M=d;break;case"center":P=d-C,M=d+C;break;case"right":P=d,M=d+x;break}switch(l.value){case"top":D=h-k,B=h;break;case"center":D=h-T,B=h+T;break;case"bottom":D=h,B=h+k;break}}P+=p-Math.max(g,b)-w-S,M+=p+Math.max(g,b)+w+S,D+=f-Math.max(g,b)-w-S,B+=f+Math.max(g,b)+w+S;var _=n||"main",N=a.labelBounds,A=N[_]=N[_]||{};A.x1=P,A.y1=D,A.x2=M,A.y2=B,A.w=M-P,A.h=B-D;var z=v&&m.strValue==="autorotate",O=m.pfValue!=null&&m.pfValue!==0;if(z||O){var R=z?Qn(a.rstyle,"labelAngle",n):m.pfValue,Y=Math.cos(R),V=Math.sin(R),F=(P+M)/2,W=(D+B)/2;if(!v){switch(u.value){case"left":F=M;break;case"right":F=P;break}switch(l.value){case"top":W=B;break;case"bottom":W=D;break}}var Q=function(te,ce){return te=te-F,ce=ce-W,{x:te*Y-ce*V+F,y:te*V+ce*Y+W}},re=Q(P,D),K=Q(P,B),$=Q(M,D),I=Q(M,B);P=Math.min(re.x,K.x,$.x,I.x),M=Math.max(re.x,K.x,$.x,I.x),D=Math.min(re.y,K.y,$.y,I.y),B=Math.max(re.y,K.y,$.y,I.y)}var H=_+"Rot",U=N[H]=N[H]||{};U.x1=P,U.y1=D,U.x2=M,U.y2=B,U.w=M-P,U.h=B-D,_t(e,P,D,M,B),_t(a.labelBounds.all,P,D,M,B)}return e}},cf=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var a=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,i=r+a,u=(e.w+i*2)/e.w,l=(e.h+i*2)/e.h,s=0,c=0;["diamond","pentagon","round-triangle"].includes(o)?(u=(e.w+i*2.4)/e.w,c=-i/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?u=(e.w+i*2.4)/e.w:o==="star"?(u=(e.w+i*2.8)/e.w,l=(e.h+i*2.6)/e.h,c=-i/3.8):o==="triangle"?(u=(e.w+i*2.8)/e.w,l=(e.h+i*2.4)/e.h,c=-i/1.4):o==="vee"&&(u=(e.w+i*4.4)/e.w,l=(e.h+i*3.8)/e.h,c=-i*.5);var d=e.h*l-e.h,h=e.w*u-e.w;if(Wr(e,[Math.ceil(d/2),Math.ceil(h/2)]),s!=0||c!==0){var p=Oc(e,s,c);ws(e,p)}}}},df=function(e,t){var n=e._private.cy,r=n.styleEnabled(),a=n.headless(),o=ht(),i=e._private,u=e.isNode(),l=e.isEdge(),s,c,d,h,p,f,v=i.rstyle,m=u&&r?e.pstyle("bounds-expansion").pfValue:[0],g=function(Z){return Z.pstyle("display").value!=="none"},y=!r||g(e)&&(!l||g(e.source())&&g(e.target()));if(y){var b=0,w=0;r&&t.includeOverlays&&(b=e.pstyle("overlay-opacity").value,b!==0&&(w=e.pstyle("overlay-padding").value));var S=0,k=0;r&&t.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(k=e.pstyle("underlay-padding").value));var x=Math.max(w,k),C=0,T=0;if(r&&(C=e.pstyle("width").pfValue,T=C/2),u&&t.includeNodes){var P=e.position();p=P.x,f=P.y;var M=e.outerWidth(),D=M/2,B=e.outerHeight(),_=B/2;s=p-D,c=p+D,d=f-_,h=f+_,_t(o,s,d,c,h),r&&t.includeOutlines&&cf(o,e)}else if(l&&t.includeEdges)if(r&&!a){var N=e.pstyle("curve-style").strValue;if(s=Math.min(v.srcX,v.midX,v.tgtX),c=Math.max(v.srcX,v.midX,v.tgtX),d=Math.min(v.srcY,v.midY,v.tgtY),h=Math.max(v.srcY,v.midY,v.tgtY),s-=T,c+=T,d-=T,h+=T,_t(o,s,d,c,h),N==="haystack"){var A=v.haystackPts;if(A&&A.length===2){if(s=A[0].x,d=A[0].y,c=A[1].x,h=A[1].y,s>c){var z=s;s=c,c=z}if(d>h){var O=d;d=h,h=O}_t(o,s-T,d-T,c+T,h+T)}}else if(N==="bezier"||N==="unbundled-bezier"||N.endsWith("segments")||N.endsWith("taxi")){var R;switch(N){case"bezier":case"unbundled-bezier":R=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":R=v.linePts;break}if(R!=null)for(var Y=0;Y<R.length;Y++){var V=R[Y];s=V.x-T,c=V.x+T,d=V.y-T,h=V.y+T,_t(o,s,d,c,h)}}}else{var F=e.source(),W=F.position(),Q=e.target(),re=Q.position();if(s=W.x,c=re.x,d=W.y,h=re.y,s>c){var K=s;s=c,c=K}if(d>h){var $=d;d=h,h=$}s-=T,c+=T,d-=T,h+=T,_t(o,s,d,c,h)}if(r&&t.includeEdges&&l&&(Ar(o,e,"mid-source"),Ar(o,e,"mid-target"),Ar(o,e,"source"),Ar(o,e,"target")),r){var I=e.pstyle("ghost").value==="yes";if(I){var H=e.pstyle("ghost-offset-x").pfValue,U=e.pstyle("ghost-offset-y").pfValue;_t(o,o.x1+H,o.y1+U,o.x2+H,o.y2+U)}}var te=i.bodyBounds=i.bodyBounds||{};ji(te,o),Wr(te,m),Xr(te,1),r&&(s=o.x1,c=o.x2,d=o.y1,h=o.y2,_t(o,s-x,d-x,c+x,h+x));var ce=i.overlayBounds=i.overlayBounds||{};ji(ce,o),Wr(ce,m),Xr(ce,1);var me=i.labelBounds=i.labelBounds||{};me.all!=null?Bc(me.all):me.all=ht(),r&&t.includeLabels&&(t.includeMainLabels&&Aa(o,e,null),l&&(t.includeSourceLabels&&Aa(o,e,"source"),t.includeTargetLabels&&Aa(o,e,"target")))}return o.x1=yt(o.x1),o.y1=yt(o.y1),o.x2=yt(o.x2),o.y2=yt(o.y2),o.w=yt(o.x2-o.x1),o.h=yt(o.y2-o.y1),o.w>0&&o.h>0&&y&&(Wr(o,m),Xr(o,1)),o},Us=function(e){var t=0,n=function(a){return(a?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},Hs=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(a){return Math.round(a)};return Qu([r(t.x),r(t.y),r(n.x),r(n.y)])}else return 0},ho=function(e,t){var n=e._private,r,a=e.isEdge(),o=t==null?po:Us(t),i=o===po,u=Hs(e),l=n.bbCachePosKey===u,s=t.useCache&&l,c=function(p){return p._private.bbCache==null||p._private.styleDirty},d=!s||c(e)||a&&c(e.source())||c(e.target());if(d?(l||e.recalculateRenderedStyle(s),r=df(e,xr),n.bbCache=r,n.bbCachePosKey=u):r=n.bbCache,!i){var h=e.isNode();r=ht(),(t.includeNodes&&h||t.includeEdges&&!h)&&(t.includeOverlays?un(r,n.overlayBounds):un(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?un(r,n.labelBounds.all):(t.includeMainLabels&&un(r,n.labelBounds.mainRot),t.includeSourceLabels&&un(r,n.labelBounds.sourceRot),t.includeTargetLabels&&un(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},xr={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},po=Us(xr),fo=et(xr);Jt.boundingBox=function(e){var t;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(e===void 0||e.useCache===void 0||e.useCache===!0))e===void 0?e=xr:e=fo(e),t=ho(this[0],e);else{t=ht(),e=e||xr;var n=fo(e),r=this,a=r.cy(),o=a.styleEnabled();if(o)for(var i=0;i<r.length;i++){var u=r[i],l=u._private,s=Hs(u),c=l.bbCachePosKey===s,d=n.useCache&&c&&!l.styleDirty;u.recalculateRenderedStyle(d)}this.updateCompoundBounds(!e.useCache);for(var h=0;h<r.length;h++){var p=r[h];un(t,ho(p,n))}}return t.x1=yt(t.x1),t.y1=yt(t.y1),t.x2=yt(t.x2),t.y2=yt(t.y2),t.w=yt(t.x2-t.x1),t.h=yt(t.y2-t.y1),t},Jt.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},Jt.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter(function(s){return s.isParent()}),t=t.not(a)),ke(e)){var o=e;e=function(){return o}}var i=function(s,c){return s._private.bbAtOldPos=e(s,c)},u=function(s){return s._private.bbAtOldPos};n.startBatch(),t.forEach(i).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var l=Tc(this.boundingBox({useCache:!1}));return t.silentPositions(u),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),l},Nn.boundingbox=Nn.bb=Nn.boundingBox,Nn.renderedBoundingbox=Nn.renderedBoundingBox;var hf=Jt,sr,pr;sr=pr={};var go=function(e){e.uppercaseName=Ii(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Ii(e.outerName),sr[e.name]=function(){var t=this[0],n=t._private,r=n.cy,a=r._private.styleEnabled;if(t)if(a){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var o=t.pstyle(e.name);return o.strValue==="label"?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):o.pfValue}else return 1},sr["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,a=r._private.styleEnabled;if(t)if(a){var o=t[e.name](),i=t.pstyle("border-width").pfValue,u=2*t.padding();return o+i+u}else return 1},sr["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){var n=t[e.name]();return n*this.cy().zoom()}},sr["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){var n=t[e.outerName]();return n*this.cy().zoom()}}};go({name:"width"}),go({name:"height"}),pr.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},pr.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},pr.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var pf=pr,ff=function(e,t){if(e.isEdge())return t(e)},gf=function(e,t){if(e.isEdge()){var n=e.cy();return ma(t(e),n.zoom(),n.pan())}},vf=function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),a=n.zoom();return t(e).map(function(o){return ma(o,a,r)})}},yf=function(e){return e.renderer().getControlPoints(e)},mf=function(e){return e.renderer().getSegmentPoints(e)},bf=function(e){return e.renderer().getSourceEndpoint(e)},xf=function(e){return e.renderer().getTargetEndpoint(e)},wf=function(e){return e.renderer().getEdgeMidpoint(e)},vo={controlPoints:{get:yf,mult:!0},segmentPoints:{get:mf,mult:!0},sourceEndpoint:{get:bf},targetEndpoint:{get:xf},midpoint:{get:wf}},Ef=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},kf=Object.keys(vo).reduce(function(e,t){var n=vo[t],r=Ef(t);return e[t]=function(){return ff(this,n.get)},n.mult?e[r]=function(){return vf(this,n.get)}:e[r]=function(){return gf(this,n.get)},e},{}),Cf=ge({},uf,hf,pf,kf),Gs=function(e,t){this.recycle(e,t)};function Jn(){return!1}function zr(){return!0}Gs.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Jn,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?zr:Jn):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=zr;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=zr;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=zr,this.stopPropagation()},isDefaultPrevented:Jn,isPropagationStopped:Jn,isImmediatePropagationStopped:Jn};var Ks=/^([^.]+)(\.(?:[^.]+))?$/,Df=".*",$s={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},yo=Object.keys($s),Sf={};function ka(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Sf,t=arguments.length>1?arguments[1]:void 0,n=0;n<yo.length;n++){var r=yo[n];this[r]=e[r]||$s[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Gt=ka.prototype,mo=function(e,t,n,r,a,o,i){ze(r)&&(a=r,r=null),i&&(o==null?o=i:o=ge({},o,i));for(var u=Be(n)?n:n.split(/\s+/),l=0;l<u.length;l++){var s=u[l];if(!tn(s)){var c=s.match(Ks);if(c){var d=c[1],h=c[2]?c[2]:null,p=t(e,s,d,h,r,a,o);if(p===!1)break}}}},bo=function(e,t){return e.addEventFields(e.context,t),new Gs(t.type,t)},_f=function(e,t,n){if(Gl(n)){t(e,n);return}else if(ke(n)){t(e,bo(e,n));return}for(var r=Be(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var o=r[a];if(!tn(o)){var i=o.match(Ks);if(i){var u=i[1],l=i[2]?i[2]:null,s=bo(e,{type:u,namespace:l,target:e.context});t(e,s)}}}};Gt.on=Gt.addListener=function(e,t,n,r,a){return mo(this,function(o,i,u,l,s,c,d){ze(c)&&o.listeners.push({event:i,callback:c,type:u,namespace:l,qualifier:s,conf:d})},e,t,n,r,a),this},Gt.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Gt.removeListener=Gt.off=function(e,t,n,r){var a=this;this.emitting!==0&&(this.listeners=rc(this.listeners));for(var o=this.listeners,i=function(l){var s=o[l];mo(a,function(c,d,h,p,f,v){if((s.type===h||e==="*")&&(!p&&s.namespace!==".*"||s.namespace===p)&&(!f||c.qualifierCompare(s.qualifier,f))&&(!v||s.callback===v))return o.splice(l,1),!1},e,t,n,r)},u=o.length-1;u>=0;u--)i(u);return this},Gt.removeAllListeners=function(){return this.removeListener("*")},Gt.emit=Gt.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Be(t)||(t=[t]),_f(this,function(o,i){n!=null&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var u=function(s){var c=r[s];if(c.type===i.type&&(!c.namespace||c.namespace===i.namespace||c.namespace===Df)&&o.eventMatches(o.context,c,i)){var d=[i];t!=null&&ic(d,t),o.beforeEmit(o.context,c,i),c.conf&&c.conf.one&&(o.listeners=o.listeners.filter(function(f){return f!==c}));var h=o.callbackContext(o.context,c,i),p=c.callback.apply(h,d);o.afterEmit(o.context,c,i),p===!1&&(i.stopPropagation(),i.preventDefault())}},l=0;l<a;l++)u(l);o.bubble(o.context)&&!i.isPropagationStopped()&&o.parent(o.context).emit(i,t)},e),this.emitting--,this};var Pf={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Cr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Rr=function(e){return he(e)?new nn(e):e},Zs={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new ka(Pf,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Rr(t),a=0;a<this.length;a++){var o=this[a];o.emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Rr(t),a=0;a<this.length;a++){var o=this[a];o.emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Rr(t),a=0;a<this.length;a++){var o=this[a];o.emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Rr(t),a=0;a<this.length;a++){var o=this[a];o.emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var r=this[n];r.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};_e.eventAliasesOn(Zs);var Qs={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(he(e)||gt(e))return new nn(e).filter(this);if(ze(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var o=r[a],i=t?e.apply(t,[o,a,r]):e(o,a,r);i&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){he(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n],a=e.has(r);a||t.push(r)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(he(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,a=e,o=this.length<e.length,i=o?r:a,u=o?a:r,l=0;l<i.length;l++){var s=i[l];u.has(s)&&n.push(s)}return n},xor:function(e){var t=this._private.cy;he(e)&&(e=t.$(e));var n=this.spawn(),r=this,a=e,o=function(i,u){for(var l=0;l<i.length;l++){var s=i[l],c=s._private.data.id,d=u.hasElementWithId(c);d||n.push(s)}};return o(r,a),o(a,r),n},diff:function(e){var t=this._private.cy;he(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),o=this,i=e,u=function(l,s,c){for(var d=0;d<l.length;d++){var h=l[d],p=h._private.data.id,f=s.hasElementWithId(p);f?a.merge(h):c.push(h)}};return u(o,i,n),u(i,o,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(he(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var o=e[a],i=!this.has(o);i&&r.push(o)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&he(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=t.map,o=0;o<e.length;o++){var i=e[o],u=i._private.data.id,l=!a.has(u);if(l){var s=this.length++;this[s]=i,a.set(u,{ele:i,index:s})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),r=this._private,a=r.map;this[e]=void 0,a.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var i=this.length-1,u=this[i],l=u._private.data.id;this[i]=void 0,this[e]=u,a.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,a=r.get(n);if(!a)return this;var o=a.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&he(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var o=r[a],i=t?e.apply(t,[o,a,r]):e(o,a,r);n.push(i)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n=-1/0,r,a=this,o=0;o<a.length;o++){var i=a[o],u=t?e.apply(t,[i,o,a]):e(i,o,a);u>n&&(n=u,r=i)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,a=this,o=0;o<a.length;o++){var i=a[o],u=t?e.apply(t,[i,o,a]):e(i,o,a);u<n&&(n=u,r=i)}return{value:n,ele:r}}},De=Qs;De.u=De["|"]=De["+"]=De.union=De.or=De.add,De["\\"]=De["!"]=De["-"]=De.difference=De.relativeComplement=De.subtract=De.not,De.n=De["&"]=De["."]=De.and=De.intersection=De.intersect,De["^"]=De["(+)"]=De["(-)"]=De.symmetricDifference=De.symdiff=De.xor,De.fnFilter=De.filterFn=De.stdFilter=De.filter,De.complement=De.abscomp=De.absoluteComplement;var Mf={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Js=function(e,t){var n=e.cy(),r=n.hasCompoundNodes();function a(s){var c=s.pstyle("z-compound-depth");return c.value==="auto"?r?s.zDepth():0:c.value==="bottom"?-1:c.value==="top"?fi:0}var o=a(e)-a(t);if(o!==0)return o;function i(s){var c=s.pstyle("z-index-compare");return c.value==="auto"&&s.isNode()?1:0}var u=i(e)-i(t);if(u!==0)return u;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},da={forEach:function(e,t){if(ze(e))for(var n=this.length,r=0;r<n;r++){var a=this[r],o=t?e.apply(t,[a,r,this]):e(a,r,this);if(o===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t==null&&(t=r),e==null&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!ze(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Js)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:fi-1}else{var a=t.source,o=t.target,i=a.zDepth(),u=o.zDepth();return Math.max(i,u,0)}}}};da.each=da.forEach;var Tf=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":We(Symbol))!=e&&We(Symbol.iterator)!=e;t&&(da[Symbol.iterator]=function(){var n=this,r={value:void 0,done:!1},a=0,o=this.length;return es({next:function(){return a<o?r.value=n[a++]:(r.value=void 0,r.done=!0),r}},Symbol.iterator,function(){return this})})};Tf();var Bf=et({nodeDimensionsIncludeLabels:!1}),Hr={layoutDimensions:function(e){e=Bf(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(w){return!w.isParent()}),a=this.cy(),o=t.eles,i=function(w){return w.id()},u=gr(n,i);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(w,S,k){var x={x:S.x1+S.w/2,y:S.y1+S.h/2},C={x:(k.x-x.x)*w,y:(k.y-x.y)*w};return{x:x.x+C.x,y:x.y+C.y}},s=t.spacingFactor&&t.spacingFactor!==1,c=function(){if(!s)return null;for(var w=ht(),S=0;S<r.length;S++){var k=r[S],x=u(k,S);Ic(w,x.x,x.y)}return w},d=c(),h=gr(function(w,S){var k=u(w,S);if(s){var x=Math.abs(t.spacingFactor);k=l(x,d,k)}return t.transform!=null&&(k=t.transform(w,k)),k},i);if(t.animate){for(var p=0;p<r.length;p++){var f=r[p],v=h(f,p),m=t.animateFilter==null||t.animateFilter(f,p);if(m){var g=f.animation({position:v,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else f.position(v)}if(t.fit){var y=a.animation({fit:{boundingBox:o.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}else if(t.zoom!==void 0&&t.pan!==void 0){var b=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}e.animations.forEach(function(w){return w.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Wn.all(e.animations.map(function(w){return w.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(h),t.fit&&a.fit(t.eles,t.padding),t.zoom!=null&&a.zoom(t.zoom),t.pan&&a.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(ge({},e,{eles:this}))}};Hr.createLayout=Hr.makeLayout=Hr.layout;function el(e,t,n){var r=n._private,a=r.styleCache=r.styleCache||[],o;return(o=a[e])!=null||(o=a[e]=t(n)),o}function Ca(e,t){return e=vn(e),function(n){return el(e,t,n)}}function ha(e,t){e=vn(e);var n=function(r){return t.call(r)};return function(){var r=this[0];if(r)return el(e,n,r)}}var Qe={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(r){return r._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(r){t(r),r.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var r=t.hasCompoundNodes(),a=this;e=!!(e||e===void 0),r&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=a;return e?o.emitAndNotify("style"):o.emit("style"),a.forEach(function(i){return i._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(ke(e)){var o=e;a.applyBypass(this,o,r),this.emitAndNotify("style")}else if(he(e))if(t===void 0){var i=this[0];return i?a.getStylePropertyValue(i,e):void 0}else a.applyBypass(this,e,t,r),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?a.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var o=0;o<a.length;o++){var i=a[o];r.removeAllBypasses(i,n)}else{e=e.split(/\s+/);for(var u=0;u<a.length;u++){var l=a[u];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var o=r.data.parent?n.parents():null;if(o)for(var i=0;i<o.length;i++){var u=o[i],l=u.pstyle("opacity").value;a=l*a}return a}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function za(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var a=0;a<r.length;a++){var o=r[a];if(!t(o))return!1}return!0}function Ci(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var a=this.cy();if(!a.styleEnabled())return!0;var o=this[0],i=a.hasCompoundNodes();if(o){var u=o._private;if(!t(o))return!1;if(o.isNode())return!i||za(o,r);var l=u.source,s=u.target;return n(l)&&(!i||za(l,n))&&(l===s||n(s)&&(!i||za(s,n)))}}}var Un=Ca("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});Qe.takesUpSpace=ha("takesUpSpace",Ci({ok:Un}));var Of=Ca("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&Un(e)}),If=Ca("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&Un(e)});Qe.interactive=ha("interactive",Ci({ok:Of,parentOk:If,edgeOkViaNode:Un})),Qe.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Nf=Ca("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&Un(e)}),Af=Un;Qe.visible=ha("visible",Ci({ok:Nf,edgeOkViaNode:Af})),Qe.hidden=function(){var e=this[0];if(e)return!e.visible()},Qe.isBundledBezier=ha("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Qe.bypass=Qe.css=Qe.style,Qe.renderedCss=Qe.renderedStyle,Qe.removeBypass=Qe.removeCss=Qe.removeStyle,Qe.pstyle=Qe.parsedStyle;var en={};function xo(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(t.length===1&&ze(t[0])){var o=t[0];this.on(e.event,o)}else if(t.length===0||t.length===1&&Be(t[0])){for(var i=t.length===1?t[0]:null,u=0;u<this.length;u++){var l=this[u],s=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(d!==void 0&&(s=d,!d))return this}s&&(l._private[e.field]=e.value,c&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),i&&h.emit(i)}return this}}function wn(e){en[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},en[e.on]=xo({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),en[e.off]=xo({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}wn({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),wn({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),wn({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),wn({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),en.deselect=en.unselect,en.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},wn({field:"active",on:"activate",off:"unactivate"}),wn({field:"pannable",on:"panify",off:"unpanify"}),en.inactive=function(){var e=this[0];if(e)return!e._private.active};var it={},wo=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var o=n[a];if(o.isNode()){for(var i=!1,u=o.connectedEdges(),l=0;l<u.length;l++){var s=u[l],c=s.source(),d=s.target();if(e.noIncomingEdges&&d===o&&c!==o||e.noOutgoingEdges&&c===o&&d!==o){i=!0;break}}i||r.push(o)}}return this.spawn(r,!0).filter(t)}},Eo=function(e){return function(t){for(var n=this,r=[],a=0;a<n.length;a++){var o=n[a];if(o.isNode())for(var i=o.connectedEdges(),u=0;u<i.length;u++){var l=i[u],s=l.source(),c=l.target();e.outgoing&&s===o?(r.push(l),r.push(c)):e.incoming&&c===o&&(r.push(l),r.push(s))}}return this.spawn(r,!0).filter(t)}},ko=function(e){return function(t){for(var n=this,r=[],a={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var i=!1,u=0;u<o.length;u++){var l=o[u],s=l.id();a[s]||(a[s]=!0,r.push(l),i=!0)}if(!i)break;n=o}return this.spawn(r,!0).filter(t)}};it.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},ge(it,{roots:wo({noIncomingEdges:!0}),leaves:wo({noOutgoingEdges:!0}),outgoers:mt(Eo({outgoing:!0}),"outgoers"),successors:ko({outgoing:!0}),incomers:mt(Eo({incoming:!0}),"incomers"),predecessors:ko({})}),ge(it,{neighborhood:mt(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],o=a.connectedEdges(),i=0;i<o.length;i++){var u=o[i],l=u.source(),s=u.target(),c=a===l?s:l;c.length>0&&t.push(c[0]),t.push(u[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),it.neighbourhood=it.neighborhood,it.closedNeighbourhood=it.closedNeighborhood,it.openNeighbourhood=it.openNeighborhood,ge(it,{source:mt(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:mt(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:Co({attr:"source"}),targets:Co({attr:"target"})});function Co(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r],o=a._private[e.attr];o&&n.push(o)}return this.spawn(n,!0).filter(t)}}ge(it,{edgesWith:mt(Do(),"edgesWith"),edgesTo:mt(Do({thisIsSrc:!0}),"edgesTo")});function Do(e){return function(t){var n=[],r=this._private.cy,a=e||{};he(t)&&(t=r.$(t));for(var o=0;o<t.length;o++)for(var i=t[o]._private.edges,u=0;u<i.length;u++){var l=i[u],s=l._private.data,c=this.hasElementWithId(s.source)&&t.hasElementWithId(s.target),d=t.hasElementWithId(s.source)&&this.hasElementWithId(s.target),h=c||d;h&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!c||a.thisIsTgt&&!d)||n.push(l))}return this.spawn(n,!0)}}ge(it,{connectedEdges:mt(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];if(a.isNode())for(var o=a._private.edges,i=0;i<o.length;i++){var u=o[i];t.push(u)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:mt(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var a=n[r];a.isEdge()&&(t.push(a.source()[0]),t.push(a.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:mt(So(),"parallelEdges"),codirectedEdges:mt(So({codirected:!0}),"codirectedEdges")});function So(e){var t={codirected:!1};return e=ge({},t,e),function(n){for(var r=[],a=this.edges(),o=e,i=0;i<a.length;i++)for(var u=a[i],l=u._private,s=l.source,c=s._private.data.id,d=l.data.target,h=s._private.edges,p=0;p<h.length;p++){var f=h[p],v=f._private.data,m=v.target,g=v.source,y=m===d&&g===c,b=c===m&&d===g;(o.codirected&&y||!o.codirected&&(y||b))&&r.push(f)}return this.spawn(r,!0).filter(n)}}ge(it,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=e==null?t.nodes():e.nodes(),o=[];e!=null&&a.empty()&&(a=e.sources());var i=function(l,s){r.merge(l),a.unmerge(l),s.merge(l)};if(a.empty())return t.spawn();var u=function(){var l=n.collection();o.push(l);var s=a[0];i(s,l),t.bfs({directed:!1,roots:s,visit:function(c){return i(c,l)}}),l.forEach(function(c){c.connectedEdges().forEach(function(d){t.has(d)&&l.has(d.source())&&l.has(d.target())&&l.merge(d)})})};do u();while(a.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),it.componentsOf=it.components;var Je=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Le("A collection must have a reference to the core");return}var a=new zt,o=!1;if(!t)t=[];else if(t.length>0&&ke(t[0])&&!Cr(t[0])){o=!0;for(var i=[],u=new Xn,l=0,s=t.length;l<s;l++){var c=t[l];c.data==null&&(c.data={});var d=c.data;if(d.id==null)d.id=ms();else if(e.hasElementWithId(d.id)||u.has(d.id))continue;var h=new ya(e,c,!1);i.push(h),u.add(d.id)}t=i}this.length=0;for(var p=0,f=t.length;p<f;p++){var v=t[p][0];if(v!=null){var m=v._private.data.id;(!n||!a.has(m))&&(n&&a.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(g){this.lazyMap=g},rebuildMap:function(){for(var g=this.lazyMap=new zt,y=this.eles,b=0;b<y.length;b++){var w=y[b];g.set(w.id(),{index:b,ele:w})}}},n&&(this._private.map=a),o&&!r&&this.restore()},Oe=ya.prototype=Je.prototype=Object.create(Array.prototype);Oe.instanceString=function(){return"collection"},Oe.spawn=function(e,t){return new Je(this.cy(),e,t)},Oe.spawnSelf=function(){return this.spawn(this)},Oe.cy=function(){return this._private.cy},Oe.renderer=function(){return this._private.cy.renderer()},Oe.element=function(){return this[0]},Oe.collection=function(){return as(this)?this:new Je(this._private.cy,[this])},Oe.unique=function(){return new Je(this._private.cy,this,!0)},Oe.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Oe.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Je(t)},Oe.$id=Oe.getElementById,Oe.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index},Oe.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Oe.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Oe.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(ke(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var o=!1,i={},u=e.data.source,l=e.data.target;u!=null&&u!=a.source&&(i.source=""+u,o=!0),l!=null&&l!=a.target&&(i.target=""+l,o=!0),o&&(t=t.move(i))}else{var s="parent"in e.data,c=e.data.parent;s&&(c!=null||a.parent!=null)&&c!=a.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(f,v,m){var g=e[f];g!=null&&g!==r[f]&&(g?t[v]():t[m]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var h={data:At(r.data),position:At(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};h.classes="";var p=0;return r.classes.forEach(function(f){return h.classes+=p++===0?f:" "+f}),h}}},Oe.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e},Oe.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],a=r.json(),o=new ya(e,a,!1);t.push(o)}return new Je(e,t)},Oe.copy=Oe.clone,Oe.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,o=[],i=[],u,l=0,s=n.length;l<s;l++){var c=n[l];t&&!c.removed()||(c.isNode()?o.push(c):i.push(c))}u=o.concat(i);var d,h=function(){u.splice(d,1),d--};for(d=0;d<u.length;d++){var p=u[d],f=p._private,v=f.data;if(p.clearTraversalCache(),!(!t&&!f.removed)){if(v.id===void 0)v.id=ms();else if(ne(v.id))v.id=""+v.id;else if(tn(v.id)||!he(v.id)){Le("Can not create element with invalid string ID `"+v.id+"`"),h();continue}else if(r.hasElementWithId(v.id)){Le("Can not create second element with ID `"+v.id+"`"),h();continue}}var m=v.id;if(p.isNode()){var g=f.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(p.isEdge()){for(var y=p,b=["source","target"],w=b.length,S=!1,k=0;k<w;k++){var x=b[k],C=v[x];ne(C)&&(C=v[x]=""+v[x]),C==null||C===""?(Le("Can not create edge `"+m+"` with unspecified "+x),S=!0):r.hasElementWithId(C)||(Le("Can not create edge `"+m+"` with nonexistant "+x+" `"+C+"`"),S=!0)}if(S){h();continue}var T=r.getElementById(v.source),P=r.getElementById(v.target);T.same(P)?T._private.edges.push(y):(T._private.edges.push(y),P._private.edges.push(y)),y._private.source=T,y._private.target=P}f.map=new zt,f.map.set(m,{ele:p,index:0}),f.removed=!1,t&&r.addToPool(p)}for(var M=0;M<o.length;M++){var D=o[M],B=D._private.data;ne(B.parent)&&(B.parent=""+B.parent);var _=B.parent,N=_!=null;if(N||D._private.parent){var A=D._private.parent?r.collection().merge(D._private.parent):r.getElementById(_);if(A.empty())B.parent=void 0;else if(A[0].removed())Pe("Node added with missing parent, reference to parent removed"),B.parent=void 0,D._private.parent=null;else{for(var z=!1,O=A;!O.empty();){if(D.same(O)){z=!0,B.parent=void 0;break}O=O.parent()}z||(A[0]._private.children.push(D),D._private.parent=A[0],a.hasCompoundNodes=!0)}}}if(u.length>0){for(var R=u.length===n.length?n:new Je(r,u),Y=0;Y<R.length;Y++){var V=R[Y];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}var F;a.hasCompoundNodes?F=r.collection().merge(R).merge(R.connectedNodes()).merge(R.parent()):F=R,F.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?R.emitAndNotify("add"):t&&R.emit("add")}return n},Oe.removed=function(){var e=this[0];return e&&e._private.removed},Oe.inside=function(){var e=this[0];return e&&!e._private.removed},Oe.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},o=n._private.cy;function i(_){for(var N=_._private.edges,A=0;A<N.length;A++)l(N[A])}function u(_){for(var N=_._private.children,A=0;A<N.length;A++)l(N[A])}function l(_){var N=a[_.id()];t&&_.removed()||N||(a[_.id()]=!0,_.isNode()?(r.push(_),i(_),u(_)):r.unshift(_))}for(var s=0,c=n.length;s<c;s++){var d=n[s];l(d)}function h(_,N){var A=_._private.edges;Zt(A,N),_.clearTraversalCache()}function p(_){_.clearTraversalCache()}var f=[];f.ids={};function v(_,N){N=N[0],_=_[0];var A=_._private.children,z=_.id();Zt(A,N),N._private.parent=null,f.ids[z]||(f.ids[z]=!0,f.push(_))}n.dirtyCompoundBoundsCache(),t&&o.removeFromPool(r);for(var m=0;m<r.length;m++){var g=r[m];if(g.isEdge()){var y=g.source()[0],b=g.target()[0];h(y,g),h(b,g);for(var w=g.parallelEdges(),S=0;S<w.length;S++){var k=w[S];p(k),k.isBundledBezier()&&k.dirtyBoundingBoxCache()}}else{var x=g.parent();x.length!==0&&v(x,g)}t&&(g._private.removed=!0)}var C=o._private.elements;o._private.hasCompoundNodes=!1;for(var T=0;T<C.length;T++){var P=C[T];if(P.isParent()){o._private.hasCompoundNodes=!0;break}}var M=new Je(this.cy(),r);M.size()>0&&(e?M.emitAndNotify("remove"):t&&M.emit("remove"));for(var D=0;D<f.length;D++){var B=f[D];(!t||!B.removed())&&B.updateStyle()}return M},Oe.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,o=function(p){return p==null?p:""+p};if(e.source!==void 0||e.target!==void 0){var i=o(e.source),u=o(e.target),l=i!=null&&t.hasElementWithId(i),s=u!=null&&t.hasElementWithId(u);(l||s)&&(t.batch(function(){n.remove(r,a),n.emitAndNotify("moveout");for(var p=0;p<n.length;p++){var f=n[p],v=f._private.data;f.isEdge()&&(l&&(v.source=i),s&&(v.target=u))}n.restore(r,a)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var c=o(e.parent),d=c===null||t.hasElementWithId(c);if(d){var h=c===null?void 0:c;t.batch(function(){var p=n.remove(r,a);p.emitAndNotify("moveout");for(var f=0;f<n.length;f++){var v=n[f],m=v._private.data;v.isNode()&&(m.parent=h)}p.restore(r,a)}),n.emitAndNotify("move")}}return this},[Ms,Wp,Ur,Kt,qn,lf,ca,Cf,Zs,Qs,Mf,da,Hr,Qe,en,it].forEach(function(e){ge(Oe,e)});var zf={add:function(e){var t,n=this;if(gt(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],o=0;o<r.length;o++){var i=r[o];a.push(i.json())}t=new Je(n,a)}}else if(Be(e)){var u=e;t=new Je(n,u)}else if(ke(e)&&(Be(e.nodes)||Be(e.edges))){for(var l=e,s=[],c=["nodes","edges"],d=0,h=c.length;d<h;d++){var p=c[d],f=l[p];if(Be(f))for(var v=0,m=f.length;v<m;v++){var g=ge({group:p},f[v]);s.push(g)}}t=new Je(n,s)}else{var y=e;t=new ya(n,y).collection()}return t},remove:function(e){if(!gt(e)&&he(e)){var t=e;e=this.$(t)}return e.remove()}};function Rf(e,t,n,r){var a=4,o=.001,i=1e-7,u=10,l=11,s=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var d=0;d<4;++d)if(typeof arguments[d]!="number"||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(l):new Array(l);function p(P,M){return 1-3*M+3*P}function f(P,M){return 3*M-6*P}function v(P){return 3*P}function m(P,M,D){return((p(M,D)*P+f(M,D))*P+v(M))*P}function g(P,M,D){return 3*p(M,D)*P*P+2*f(M,D)*P+v(M)}function y(P,M){for(var D=0;D<a;++D){var B=g(M,e,n);if(B===0)return M;var _=m(M,e,n)-P;M-=_/B}return M}function b(){for(var P=0;P<l;++P)h[P]=m(P*s,e,n)}function w(P,M,D){var B,_,N=0;do _=M+(D-M)/2,B=m(_,e,n)-P,B>0?D=_:M=_;while(Math.abs(B)>i&&++N<u);return _}function S(P){for(var M=0,D=1,B=l-1;D!==B&&h[D]<=P;++D)M+=s;--D;var _=(P-h[D])/(h[D+1]-h[D]),N=M+_*s,A=g(N,e,n);return A>=o?y(P,N):A===0?N:w(P,M,M+s)}var k=!1;function x(){k=!0,(e!==t||n!==r)&&b()}var C=function(P){return k||x(),e===t&&n===r?P:P===0?0:P===1?1:m(S(P),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return T},C}var Lf=(function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,o){var i={x:r.x+o.dx*a,v:r.v+o.dv*a,tension:r.tension,friction:r.friction};return{dx:i.v,dv:e(i)}}function n(r,a){var o={dx:r.v,dv:e(r)},i=t(r,a*.5,o),u=t(r,a*.5,i),l=t(r,a,u),s=1/6*(o.dx+2*(i.dx+u.dx)+l.dx),c=1/6*(o.dv+2*(i.dv+u.dv)+l.dv);return r.x=r.x+s*a,r.v=r.v+c*a,r}return function r(a,o,i){var u={x:-1,v:0,tension:null,friction:null},l=[0],s=0,c=1/1e4,d=16/1e3,h,p,f;for(a=parseFloat(a)||500,o=parseFloat(o)||20,i=i||null,u.tension=a,u.friction=o,h=i!==null,h?(s=r(a,o),p=s/i*d):p=d;f=n(f||u,p),l.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return h?function(v){return l[v*(l.length-1)|0]}:s}})(),Ie=function(e,t,n,r){var a=Rf(e,t,n,r);return function(o,i,u){return o+(i-o)*a(u)}},Gr={linear:function(e,t,n){return e+(t-e)*n},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:function(e,t,n){if(n===0)return Gr.linear;var r=Lf(e,t,n);return function(a,o,i){return a+(o-a)*r(i)}},"cubic-bezier":Ie};function _o(e,t,n,r,a){if(r===1||t===n)return n;var o=a(t,n,r);return e==null||((e.roundValue||e.color)&&(o=Math.round(o)),e.min!==void 0&&(o=Math.max(o,e.min)),e.max!==void 0&&(o=Math.min(o,e.max))),o}function Po(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function En(e,t,n,r,a){var o=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var i=Po(e,a),u=Po(t,a);if(ne(i)&&ne(u))return _o(o,i,u,n,r);if(Be(i)&&Be(u)){for(var l=[],s=0;s<u.length;s++){var c=i[s],d=u[s];if(c!=null&&d!=null){var h=_o(o,c,d,n,r);l.push(h)}else l.push(d)}return l}}function Vf(e,t,n,r){var a=!r,o=e._private,i=t._private,u=i.easing,l=i.startTime,s=r?e:e.cy(),c=s.style();if(!i.easingImpl)if(u==null)i.easingImpl=Gr.linear;else{var d;if(he(u)){var h=c.parse("transition-timing-function",u);d=h.value}else d=u;var p,f;he(d)?(p=d,f=[]):(p=d[1],f=d.slice(2).map(function(R){return+R})),f.length>0?(p==="spring"&&f.push(i.duration),i.easingImpl=Gr[p].apply(null,f)):i.easingImpl=Gr[p]}var v=i.easingImpl,m;if(i.duration===0?m=1:m=(n-l)/i.duration,i.applying&&(m=i.progress),m<0?m=0:m>1&&(m=1),i.delay==null){var g=i.startPosition,y=i.position;if(y&&a&&!e.locked()){var b={};er(g.x,y.x)&&(b.x=En(g.x,y.x,m,v)),er(g.y,y.y)&&(b.y=En(g.y,y.y,m,v)),e.position(b)}var w=i.startPan,S=i.pan,k=o.pan,x=S!=null&&r;x&&(er(w.x,S.x)&&(k.x=En(w.x,S.x,m,v)),er(w.y,S.y)&&(k.y=En(w.y,S.y,m,v)),e.emit("pan"));var C=i.startZoom,T=i.zoom,P=T!=null&&r;P&&(er(C,T)&&(o.zoom=mr(o.minZoom,En(C,T,m,v),o.maxZoom)),e.emit("zoom")),(x||P)&&e.emit("viewport");var M=i.style;if(M&&M.length>0&&a){for(var D=0;D<M.length;D++){var B=M[D],_=B.name,N=B,A=i.startStyle[_],z=c.properties[A.name],O=En(A,N,m,v,z);c.overrideBypass(e,_,O)}e.emit("style")}}return i.progress=m,m}function er(e,t){return e==null||t==null?!1:ne(e)&&ne(t)?!0:!!(e&&t)}function Ff(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function Mo(e,t){var n=t._private.aniEles,r=[];function a(c,d){var h=c._private,p=h.animation.current,f=h.animation.queue,v=!1;if(p.length===0){var m=f.shift();m&&p.push(m)}for(var g=function(S){for(var k=S.length-1;k>=0;k--){var x=S[k];x()}S.splice(0,S.length)},y=p.length-1;y>=0;y--){var b=p[y],w=b._private;if(w.stopped){p.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Ff(c,b,e),Vf(c,b,e,d),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(e),b.completed()&&(p.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),v=!0)}return!d&&p.length===0&&f.length===0&&r.push(c),v}for(var o=!1,i=0;i<n.length;i++){var u=n[i],l=a(u);o=o||l}var s=a(t,!0);(o||s)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var jf={animate:_e.animate(),animation:_e.animation(),animated:_e.animated(),clearQueue:_e.clearQueue(),delay:_e.delay(),delayAnimation:_e.delayAnimation(),stop:_e.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&ia(function(r){Mo(r,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(r,a){Mo(a,e)},n.beforeRenderPriorities.animations):t()}},qf={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Cr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Lr=function(e){return he(e)?new nn(e):e},tl={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ka(qf,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Lr(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Lr(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Lr(t),n),this},once:function(e,t,n){return this.emitter().one(e,Lr(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};_e.eventAliasesOn(tl);var Ka={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Ka.jpeg=Ka.jpg;var Kr={layout:function(e){var t=this;if(e==null){Le("Layout options must be specified to make a layout");return}if(e.name==null){Le("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension("layout",n);if(r==null){Le("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;he(e.eles)?a=t.$(e.eles):a=e.eles!=null?e.eles:t.$();var o=new r(ge({},e,{cy:t,eles:a}));return o}};Kr.createLayout=Kr.makeLayout=Kr.layout;var Yf={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var a=n[r],o=e[a],i=t.getElementById(a);i.data(o)}})}},Xf=et({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),$a={renderTo:function(e,t,n,r){var a=this._private.renderer;return a.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){Le("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Pe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Xf(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};$a.invalidateDimensions=$a.resize;var $r={collection:function(e,t){return he(e)?this.$(e):gt(e)?e.collection():Be(e)?(t||(t={}),new Je(this,e,t.unique,t.removed)):new Je(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};$r.elements=$r.filter=$r.$;var rt={},tr="t",Wf="f";rt.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),o=0;o<e.length;o++){var i=e[o],u=t.getContextMeta(i);if(!u.empty){var l=t.getContextStyle(u),s=t.applyContextStyle(u,l,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0;var c=t.updateStyleHints(i);c&&a.push(i)}}return a},rt.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,o=r[a];if(o)return o;for(var i=[],u={},l=0;l<n.length;l++){var s=n[l],c=e[l]===tr,d=t[l]===tr,h=c!==d,p=s.mappedProperties.length>0;if(h||d&&p){var f=void 0;h&&p||h?f=s.properties:p&&(f=s.mappedProperties);for(var v=0;v<f.length;v++){for(var m=f[v],g=m.name,y=!1,b=l+1;b<n.length;b++){var w=n[b],S=t[b]===tr;if(S&&(y=w.properties[m.name]!=null,y))break}!u[g]&&!y&&(u[g]=!0,i.push(g))}}}return r[a]=i,i},rt.getContextMeta=function(e){for(var t=this,n="",r,a=e._private.styleCxtKey||"",o=0;o<t.length;o++){var i=t[o],u=i.selector&&i.selector.matches(e);u?n+=tr:n+=Wf}return r=t.getPropertiesDiff(a,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},rt.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var a={_private:{key:t}},o=0;o<n.length;o++){var i=n[o],u=t[o]===tr;if(u)for(var l=0;l<i.properties.length;l++){var s=i.properties[l];a[s.name]=s}}return r[t]=a,a},rt.applyContextStyle=function(e,t,n){for(var r=this,a=e.diffPropNames,o={},i=r.types,u=0;u<a.length;u++){var l=a[u],s=t[l],c=n.pstyle(l);if(!s)if(c)c.bypass?s={name:l,deleteBypassed:!0}:s={name:l,delete:!0};else continue;if(c!==s){if(s.mapped===i.fn&&c!=null&&c.mapping!=null&&c.mapping.value===s.value){var d=c.mapping,h=d.fnValue=s.value(n);if(h===d.prevFnValue)continue}var p=o[l]={prev:c};r.applyParsedProperty(n,s),p.next=n.pstyle(l),p.next&&p.next.bypass&&(p.next=p.next.bypassed)}}return{diffProps:o}},rt.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,o=function(U,te,ce){return n.getPropertiesHash(U,te,ce)},i=t.styleKey;if(e.removed())return!1;var u=t.group==="nodes",l=e._private.style;r=Object.keys(l);for(var s=0;s<a.length;s++){var c=a[s];t.styleKeys[c]=[zn,ar]}for(var d=function(U,te){return t.styleKeys[te][0]=vr(U,t.styleKeys[te][0])},h=function(U,te){return t.styleKeys[te][1]=yr(U,t.styleKeys[te][1])},p=function(U,te){d(U,te),h(U,te)},f=function(U,te){for(var ce=0;ce<U.length;ce++){var me=U.charCodeAt(ce);d(me,te),h(me,te)}},v=2e9,m=function(U){return-128<U&&U<128&&Math.floor(U)!==U?v-(U*1024|0):U},g=0;g<r.length;g++){var y=r[g],b=l[y];if(b!=null){var w=this.properties[y],S=w.type,k=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(e,b):b.pfValue!=null&&(x=b.pfValue);var C=w.enums==null?b.value:null,T=x!=null,P=C!=null,M=T||P,D=b.units;if(S.number&&M&&!S.multiple){var B=T?x:C;p(m(B),k),!T&&D!=null&&f(D,k)}else f(b.strValue,k)}}for(var _=[zn,ar],N=0;N<a.length;N++){var A=a[N],z=t.styleKeys[A];_[0]=vr(z[0],_[0]),_[1]=yr(z[1],_[1])}t.styleKey=Zu(_[0],_[1]);var O=t.styleKeys;t.labelDimsKey=Xt(O.labelDimensions);var R=o(e,["label"],O.labelDimensions);if(t.labelKey=Xt(R),t.labelStyleKey=Xt(Mr(O.commonLabel,R)),!u){var Y=o(e,["source-label"],O.labelDimensions);t.sourceLabelKey=Xt(Y),t.sourceLabelStyleKey=Xt(Mr(O.commonLabel,Y));var V=o(e,["target-label"],O.labelDimensions);t.targetLabelKey=Xt(V),t.targetLabelStyleKey=Xt(Mr(O.commonLabel,V))}if(u){var F=t.styleKeys,W=F.nodeBody,Q=F.nodeBorder,re=F.nodeOutline,K=F.backgroundImage,$=F.compound,I=F.pie,H=[W,Q,re,K,$,I].filter(function(U){return U!=null}).reduce(Mr,[zn,ar]);t.nodeKey=Xt(H),t.hasPie=I!=null&&I[0]!==zn&&I[1]!==ar}return i!==t.styleKey},rt.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},rt.applyParsedProperty=function(e,t){var n=this,r=t,a=e._private.style,o,i=n.types,u=n.properties[r.name].type,l=r.bypass,s=a[r.name],c=s&&s.bypass,d=e._private,h="mapping",p=function(F){return F==null?null:F.pfValue!=null?F.pfValue:F.value},f=function(){var F=p(s),W=p(r);n.checkTriggers(e,r.name,F,W)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",l)),r.delete)return a[r.name]=void 0,f(),!0;if(r.deleteBypassed)return s?s.bypass?(s.bypassed=void 0,f(),!0):!1:(f(),!0);if(r.deleteBypass)return s?s.bypass?(a[r.name]=s.bypassed,f(),!0):!1:(f(),!0);var v=function(){Pe("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case i.mapData:{for(var m=r.field.split("."),g=d.data,y=0;y<m.length&&g;y++){var b=m[y];g=g[b]}if(g==null)return v(),!1;var w;if(ne(g)){var S=r.fieldMax-r.fieldMin;S===0?w=0:w=(g-r.fieldMin)/S}else return Pe("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+g+"` for `"+e.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),u.color){var k=r.valueMin[0],x=r.valueMax[0],C=r.valueMin[1],T=r.valueMax[1],P=r.valueMin[2],M=r.valueMax[2],D=r.valueMin[3]==null?1:r.valueMin[3],B=r.valueMax[3]==null?1:r.valueMax[3],_=[Math.round(k+(x-k)*w),Math.round(C+(T-C)*w),Math.round(P+(M-P)*w),Math.round(D+(B-D)*w)];o={bypass:r.bypass,name:r.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else if(u.number){var N=r.valueMin+(r.valueMax-r.valueMin)*w;o=this.parse(r.name,N,r.bypass,h)}else return!1;if(!o)return v(),!1;o.mapping=r,r=o;break}case i.data:{for(var A=r.field.split("."),z=d.data,O=0;O<A.length&&z;O++){var R=A[O];z=z[R]}if(z!=null&&(o=this.parse(r.name,z,r.bypass,h)),!o)return v(),!1;o.mapping=r,r=o;break}case i.fn:{var Y=r.value,V=r.fnValue!=null?r.fnValue:Y(e);if(r.prevFnValue=V,V==null)return Pe("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(o=this.parse(r.name,V,r.bypass,h),!o)return Pe("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;o.mapping=At(r),r=o;break}case void 0:break;default:return!1}return l?(c?r.bypassed=s.bypassed:r.bypassed=s,a[r.name]=r):c?s.bypassed=r:a[r.name]=r,f(),!0},rt.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var a=r._private.style,o=Object.keys(a),i=0;i<o.length;i++){var u=o[i],l=a[u];l!=null&&(l.bypass?l.bypassed=null:a[u]=null)}}},rt.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()},rt.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,o=e.pstyle("transition-duration").pfValue,i=e.pstyle("transition-delay").pfValue;if(a.length>0&&o>0){for(var u={},l=!1,s=0;s<a.length;s++){var c=a[s],d=e.pstyle(c),h=t[c];if(h){var p=h.prev,f=p,v=h.next!=null?h.next:d,m=!1,g=void 0,y=1e-6;f&&(ne(f.pfValue)&&ne(v.pfValue)?(m=v.pfValue-f.pfValue,g=f.pfValue+y*m):ne(f.value)&&ne(v.value)?(m=v.value-f.value,g=f.value+y*m):Be(f.value)&&Be(v.value)&&(m=f.value[0]!==v.value[0]||f.value[1]!==v.value[1]||f.value[2]!==v.value[2],g=f.strValue),m&&(u[c]=v.strValue,this.applyBypass(e,c,g),l=!0))}}if(!l)return;r.transitioning=!0,new Wn(function(b){i>0?e.delayAnimation(i).play().promise().then(b):b()}).then(function(){return e.animation({style:u,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},rt.checkTrigger=function(e,t,n,r,a,o){var i=this.properties[t],u=a(i);u!=null&&u(n,r)&&o(i)},rt.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(o){return o.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},rt.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&t==="curve-style"&&(n==="bezier"||r==="bezier")&&e.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&t==="display"&&(n==="none"||r==="none")&&e.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})},rt.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var lr={};lr.applyBypass=function(e,t,n,r){var a=this,o=[],i=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var u=0;u<a.properties.length;u++){var l=a.properties[u],s=l.name,c=this.parse(s,n,!0);c&&o.push(c)}}else if(he(t)){var d=this.parse(t,n,!0);d&&o.push(d)}else if(ke(t)){var h=t;r=n;for(var p=Object.keys(h),f=0;f<p.length;f++){var v=p[f],m=h[v];if(m===void 0&&(m=h[fa(v)]),m!==void 0){var g=this.parse(v,m,!0);g&&o.push(g)}}}else return!1;if(o.length===0)return!1;for(var y=!1,b=0;b<e.length;b++){for(var w=e[b],S={},k=void 0,x=0;x<o.length;x++){var C=o[x];if(r){var T=w.pstyle(C.name);k=S[C.name]={prev:T}}y=this.applyParsedProperty(w,At(C))||y,r&&(k.next=w.pstyle(C.name))}y&&this.updateStyleHints(w),r&&this.updateTransitions(w,S,i)}return y},lr.overrideBypass=function(e,t,n){t=pi(t);for(var r=0;r<e.length;r++){var a=e[r],o=a._private.style[t],i=this.properties[t].type,u=i.color,l=i.mutiple,s=o?o.pfValue!=null?o.pfValue:o.value:null;!o||!o.bypass?this.applyBypass(a,t,n):(o.value=n,o.pfValue!=null&&(o.pfValue=n),u?o.strValue="rgb("+n.join(",")+")":l?o.strValue=n.join(" "):o.strValue=""+n,this.updateStyleHints(a)),this.checkTriggers(a,t,s,n)}},lr.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},lr.removeBypasses=function(e,t,n){for(var r=!0,a=0;a<e.length;a++){for(var o=e[a],i={},u=0;u<t.length;u++){var l=t[u],s=this.properties[l],c=o.pstyle(s.name);if(!(!c||!c.bypass)){var d="",h=this.parse(l,d,!0),p=i[s.name]={prev:c};this.applyParsedProperty(o,h),p.next=o.pstyle(s.name)}}this.updateStyleHints(o),n&&this.updateTransitions(o,i,r)}};var Za={};Za.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1},Za.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var Bt={};Bt.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},Bt.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},a=0;a<n.properties.length;a++){var o=n.properties[a],i=n.getStylePropertyValue(e,o.name,t);i!=null&&(r[o.name]=i,r[fa(o.name)]=i)}return r}},Bt.getIndexedStyle=function(e,t,n,r){var a=e.pstyle(t)[n][r];return a??e.cy().style().getDefaultProperty(t)[n][0]},Bt.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var a=r.properties[t];a.alias&&(a=a.pointsTo);var o=a.type,i=e.pstyle(a.name);if(i){var u=i.value,l=i.units,s=i.strValue;if(n&&o.number&&u!=null&&ne(u)){var c=e.cy().zoom(),d=function(v){return v*c},h=function(v,m){return d(v)+m},p=Be(u),f=p?l.every(function(v){return v!=null}):l!=null;return f?p?u.map(function(v,m){return h(v,l[m])}).join(" "):h(u,l):p?u.map(function(v){return he(v)?v:""+d(v)}).join(" "):""+d(u)}else if(s!=null)return s}return null}},Bt.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r],o=a.name,i=e.pstyle(o);i!==void 0&&(ke(i)?i=this.parse(o,i.strValue):i=this.parse(o,i)),i&&(n[o]=i)}return n},Bt.getPropsList=function(e){var t=this,n=[],r=e,a=t.properties;if(r)for(var o=Object.keys(r),i=0;i<o.length;i++){var u=o[i],l=r[u],s=a[u]||a[pi(u)],c=this.parse(s.name,l);c&&n.push(c)}return n},Bt.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),a,o,i,u,l,s;for(l=0;l<t.length;l++)if(a=t[l],o=e.pstyle(a,!1),o!=null)if(o.pfValue!=null)r[0]=vr(u,r[0]),r[1]=yr(u,r[1]);else for(i=o.strValue,s=0;s<i.length;s++)u=i.charCodeAt(s),r[0]=vr(u,r[0]),r[1]=yr(u,r[1]);return r},Bt.getPropertiesHash=Bt.getNonDefaultPropertiesHash;var Zr={};Zr.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,o=r.style||r.css,i=Object.keys(o);t.selector(a);for(var u=0;u<i.length;u++){var l=i[u],s=o[l];t.css(l,s)}}return t},Zr.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},Zr.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,o={},i=0;i<a.length;i++){var u=a[i];o[u.name]=u.strValue}e.push({selector:r?r.toString():"core",style:o})}return e};var Qa={};Qa.appendFromString=function(e){var t=this,n=this,r=""+e,a,o,i;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function u(){r.length>a.length?r=r.substr(a.length):r=""}function l(){o.length>i.length?o=o.substr(i.length):o=""}for(;;){var s=r.match(/^\s*$/);if(s)break;var c=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Pe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=c[0];var d=c[1];if(d!=="core"){var h=new nn(d);if(h.invalid){Pe("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),u();continue}}var p=c[2],f=!1;o=p;for(var v=[];;){var m=o.match(/^\s*$/);if(m)break;var g=o.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Pe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}i=g[0];var y=g[1],b=g[2],w=t.properties[y];if(!w){Pe("Skipping property: Invalid property name in: "+i),l();continue}var S=n.parse(y,b);if(!S){Pe("Skipping property: Invalid property definition in: "+i),l();continue}v.push({name:y,val:b}),l()}if(f){u();break}n.selector(d);for(var k=0;k<v.length;k++){var x=v[k];n.css(x.name,x.val)}u()}return n},Qa.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var Ze={};(function(){var e=Xe,t=eu,n=nu,r=ru,a=au,o=function(I){return"^"+I+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},i=function(I){var H=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+a;return"^"+I+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+H+")\\s*\\,\\s*("+H+")\\)$"},u=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ze.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:o("data")},layoutData:{mapping:!0,regex:o("layoutData")},scratch:{mapping:!0,regex:o("scratch")},mapData:{mapping:!0,regex:i("mapData")},mapLayoutData:{mapping:!0,regex:i("mapLayoutData")},mapScratch:{mapping:!0,regex:i("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:u,singleRegexMatchValue:!0},urls:{regexes:u,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(I,H){switch(I.length){case 2:return H[0]!=="deg"&&H[0]!=="rad"&&H[1]!=="deg"&&H[1]!=="rad";case 1:return he(I[0])||H[0]==="deg"||H[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(I){var H=I.length;return H===1||H===2||H===4}}};var l={zeroNonZero:function(I,H){return(I==null||H==null)&&I!==H||I==0&&H!=0?!0:I!=0&&H==0},any:function(I,H){return I!=H},emptyNonEmpty:function(I,H){var U=tn(I),te=tn(H);return U&&!te||!U&&te}},s=Ze.types,c=[{name:"label",type:s.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any}],d=[{name:"source-label",type:s.text,triggersBounds:l.any},{name:"source-text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:s.size,triggersBounds:l.any}],h=[{name:"target-label",type:s.text,triggersBounds:l.any},{name:"target-text-rotation",type:s.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:s.size,triggersBounds:l.any}],p=[{name:"font-family",type:s.fontFamily,triggersBounds:l.any},{name:"font-style",type:s.fontStyle,triggersBounds:l.any},{name:"font-weight",type:s.fontWeight,triggersBounds:l.any},{name:"font-size",type:s.size,triggersBounds:l.any},{name:"text-transform",type:s.textTransform,triggersBounds:l.any},{name:"text-wrap",type:s.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:s.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:s.size,triggersBounds:l.any},{name:"text-outline-width",type:s.size,triggersBounds:l.any},{name:"line-height",type:s.positiveNumber,triggersBounds:l.any}],f=[{name:"text-valign",type:s.valign,triggersBounds:l.any},{name:"text-halign",type:s.halign,triggersBounds:l.any},{name:"color",type:s.color},{name:"text-outline-color",type:s.color},{name:"text-outline-opacity",type:s.zeroOneNumber},{name:"text-background-color",type:s.color},{name:"text-background-opacity",type:s.zeroOneNumber},{name:"text-background-padding",type:s.size,triggersBounds:l.any},{name:"text-border-opacity",type:s.zeroOneNumber},{name:"text-border-color",type:s.color},{name:"text-border-width",type:s.size,triggersBounds:l.any},{name:"text-border-style",type:s.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:s.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:s.justification}],v=[{name:"events",type:s.bool,triggersZOrder:l.any},{name:"text-events",type:s.bool,triggersZOrder:l.any}],m=[{name:"display",type:s.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:s.visibility,triggersZOrder:l.any},{name:"opacity",type:s.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:s.zeroOneNumber},{name:"min-zoomed-font-size",type:s.size},{name:"z-compound-depth",type:s.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:s.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:s.number,triggersZOrder:l.any}],g=[{name:"overlay-padding",type:s.size,triggersBounds:l.any},{name:"overlay-color",type:s.color},{name:"overlay-opacity",type:s.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:s.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:s.cornerRadius}],y=[{name:"underlay-padding",type:s.size,triggersBounds:l.any},{name:"underlay-color",type:s.color},{name:"underlay-opacity",type:s.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:s.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:s.cornerRadius}],b=[{name:"transition-property",type:s.propList},{name:"transition-duration",type:s.time},{name:"transition-delay",type:s.time},{name:"transition-timing-function",type:s.easing}],w=function(I,H){return H.value==="label"?-I.poolIndex():H.pfValue},S=[{name:"height",type:s.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:s.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:s.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:s.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:s.cornerRadius},{name:"background-color",type:s.color},{name:"background-fill",type:s.fill},{name:"background-opacity",type:s.zeroOneNumber},{name:"background-blacken",type:s.nOneOneNumber},{name:"background-gradient-stop-colors",type:s.colors},{name:"background-gradient-stop-positions",type:s.percentages},{name:"background-gradient-direction",type:s.gradientDirection},{name:"padding",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:s.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:s.boundsExpansion,triggersBounds:l.any}],k=[{name:"border-color",type:s.color},{name:"border-opacity",type:s.zeroOneNumber},{name:"border-width",type:s.size,triggersBounds:l.any},{name:"border-style",type:s.borderStyle},{name:"border-cap",type:s.lineCap},{name:"border-join",type:s.lineJoin},{name:"border-dash-pattern",type:s.numbers},{name:"border-dash-offset",type:s.number},{name:"border-position",type:s.linePosition}],x=[{name:"outline-color",type:s.color},{name:"outline-opacity",type:s.zeroOneNumber},{name:"outline-width",type:s.size,triggersBounds:l.any},{name:"outline-style",type:s.borderStyle},{name:"outline-offset",type:s.size,triggersBounds:l.any}],C=[{name:"background-image",type:s.urls},{name:"background-image-crossorigin",type:s.bgCrossOrigin},{name:"background-image-opacity",type:s.zeroOneNumbers},{name:"background-image-containment",type:s.bgContainment},{name:"background-image-smoothing",type:s.bools},{name:"background-position-x",type:s.bgPos},{name:"background-position-y",type:s.bgPos},{name:"background-width-relative-to",type:s.bgRelativeTo},{name:"background-height-relative-to",type:s.bgRelativeTo},{name:"background-repeat",type:s.bgRepeat},{name:"background-fit",type:s.bgFit},{name:"background-clip",type:s.bgClip},{name:"background-width",type:s.bgWH},{name:"background-height",type:s.bgWH},{name:"background-offset-x",type:s.bgPos},{name:"background-offset-y",type:s.bgPos}],T=[{name:"position",type:s.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:s.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:s.size,triggersBounds:l.any},{name:"min-width-bias-left",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:s.size,triggersBounds:l.any},{name:"min-height-bias-top",type:s.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:s.sizeMaybePercent,triggersBounds:l.any}],P=[{name:"line-style",type:s.lineStyle},{name:"line-color",type:s.color},{name:"line-fill",type:s.fill},{name:"line-cap",type:s.lineCap},{name:"line-opacity",type:s.zeroOneNumber},{name:"line-dash-pattern",type:s.numbers},{name:"line-dash-offset",type:s.number},{name:"line-outline-width",type:s.size},{name:"line-outline-color",type:s.color},{name:"line-gradient-stop-colors",type:s.colors},{name:"line-gradient-stop-positions",type:s.percentages},{name:"curve-style",type:s.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:s.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:s.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:s.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:s.size,triggersBounds:l.any},{name:"control-point-distances",type:s.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:s.numbers,triggersBounds:l.any},{name:"segment-distances",type:s.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:s.numbers,triggersBounds:l.any},{name:"segment-radii",type:s.numbers,triggersBounds:l.any},{name:"radius-type",type:s.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:s.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:s.size,triggersBounds:l.any},{name:"taxi-direction",type:s.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:s.number,triggersBounds:l.any},{name:"edge-distances",type:s.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:s.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:s.angle,triggersBounds:l.any},{name:"loop-sweep",type:s.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:s.size,triggersBounds:l.any},{name:"target-distance-from-node",type:s.size,triggersBounds:l.any}],M=[{name:"ghost",type:s.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:s.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:s.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:s.zeroOneNumber}],D=[{name:"selection-box-color",type:s.color},{name:"selection-box-opacity",type:s.zeroOneNumber},{name:"selection-box-border-color",type:s.color},{name:"selection-box-border-width",type:s.size},{name:"active-bg-color",type:s.color},{name:"active-bg-opacity",type:s.zeroOneNumber},{name:"active-bg-size",type:s.size},{name:"outside-texture-bg-color",type:s.color},{name:"outside-texture-bg-opacity",type:s.zeroOneNumber}],B=[];Ze.pieBackgroundN=16,B.push({name:"pie-size",type:s.sizeMaybePercent});for(var _=1;_<=Ze.pieBackgroundN;_++)B.push({name:"pie-"+_+"-background-color",type:s.color}),B.push({name:"pie-"+_+"-background-size",type:s.percent}),B.push({name:"pie-"+_+"-background-opacity",type:s.zeroOneNumber});var N=[],A=Ze.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:s.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:s.color},{name:"arrow-fill",type:s.arrowFill},{name:"arrow-width",type:s.arrowWidth}].forEach(function(I){A.forEach(function(H){var U=H+"-"+I.name,te=I.type,ce=I.triggersBounds;N.push({name:U,type:te,triggersBounds:ce})})},{});var z=Ze.properties=[].concat(v,b,m,g,y,M,f,p,c,d,h,S,k,x,C,B,T,P,N,D),O=Ze.propertyGroups={behavior:v,transition:b,visibility:m,overlay:g,underlay:y,ghost:M,commonLabel:f,labelDimensions:p,mainLabel:c,sourceLabel:d,targetLabel:h,nodeBody:S,nodeBorder:k,nodeOutline:x,backgroundImage:C,pie:B,compound:T,edgeLine:P,edgeArrow:N,core:D},R=Ze.propertyGroupNames={},Y=Ze.propertyGroupKeys=Object.keys(O);Y.forEach(function(I){R[I]=O[I].map(function(H){return H.name}),O[I].forEach(function(H){return H.groupKey=I})});var V=Ze.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Ze.propertyNames=z.map(function(I){return I.name});for(var F=0;F<z.length;F++){var W=z[F];z[W.name]=W}for(var Q=0;Q<V.length;Q++){var re=V[Q],K=z[re.pointsTo],$={name:re.name,alias:!0,pointsTo:K};z.push($),z[re.name]=$}})(),Ze.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Ze.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=ge({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,s){for(var c=1;c<=Ze.pieBackgroundN;c++){var d=s.name.replace("{{i}}",c),h=s.value;l[d]=h}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(l,s){return Ze.arrowPrefixes.forEach(function(c){var d=c+"-"+s.name,h=s.value;l[d]=h}),l},{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var o=a.name,i=t[o],u=this.parse(o,i);n[o]=u}}return e.defaultProperties=n,e.defaultProperties},Ze.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Qr={};Qr.parse=function(e,t,n,r){var a=this;if(ze(t))return a.parseImplWarn(e,t,n,r);var o=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,i=n?"t":"f",u=""+t,l=gs(e,u,i,o),s=a.propCache=a.propCache||[],c;return(c=s[l])||(c=s[l]=a.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(c=At(c),c&&(c.value=At(c.value))),c},Qr.parseImplWarn=function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return!a&&t!=null&&Pe("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&(a.name==="width"||a.name==="height")&&t==="label"&&Pe("The style value of `label` is deprecated for `"+a.name+"`"),a},Qr.parseImpl=function(e,t,n,r){var a=this;e=pi(e);var o=a.properties[e],i=t,u=a.types;if(!o||t===void 0)return null;o.alias&&(o=o.pointsTo,e=o.name);var l=he(t);l&&(t=t.trim());var s=o.type;if(!s)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(ze(t))return{name:e,value:t,strValue:"fn",mapped:u.fn,bypass:n};var c,d;if(!(!l||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(c=new RegExp(u.data.regex).exec(t))){if(n)return!1;var h=u.data;return{name:e,value:c,strValue:""+t,mapped:h,field:c[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(d=new RegExp(u.mapData.regex).exec(t))){if(n||s.multiple)return!1;var p=u.mapData;if(!(s.color||s.number))return!1;var f=this.parse(e,d[4]);if(!f||f.mapped)return!1;var v=this.parse(e,d[5]);if(!v||v.mapped)return!1;if(f.pfValue===v.pfValue||f.strValue===v.strValue)return Pe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(s.color){var m=f.value,g=v.value,y=m[0]===g[0]&&m[1]===g[1]&&m[2]===g[2]&&(m[3]===g[3]||(m[3]==null||m[3]===1)&&(g[3]==null||g[3]===1));if(y)return!1}return{name:e,value:d,strValue:""+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:f.value,valueMax:v.value,bypass:n}}}if(s.multiple&&r!=="multiple"){var b;if(l?b=t.split(/\s+/):Be(t)?b=t:b=[t],s.evenMultiple&&b.length%2!==0)return null;for(var w=[],S=[],k=[],x="",C=!1,T=0;T<b.length;T++){var P=a.parse(e,b[T],n,"multiple");C=C||he(P.value),w.push(P.value),k.push(P.pfValue!=null?P.pfValue:P.value),S.push(P.units),x+=(T>0?" ":"")+P.strValue}return s.validate&&!s.validate(w,S)?null:s.singleEnum&&C?w.length===1&&he(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:k,strValue:x,bypass:n,units:S}}var M=function(){for(var I=0;I<s.enums.length;I++){var H=s.enums[I];if(H===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(s.number){var D,B="px";if(s.units&&(D=s.units),s.implicitUnits&&(B=s.implicitUnits),!s.unitless)if(l){var _="px|em"+(s.allowPercent?"|\\%":"");D&&(_=D);var N=t.match("^("+Xe+")("+_+")?$");N&&(t=N[1],D=N[2]||B)}else(!D||s.implicitUnits)&&(D=B);if(t=parseFloat(t),isNaN(t)&&s.enums===void 0)return null;if(isNaN(t)&&s.enums!==void 0)return t=i,M();if(s.integer&&!Hl(t)||s.min!==void 0&&(t<s.min||s.strictMin&&t===s.min)||s.max!==void 0&&(t>s.max||s.strictMax&&t===s.max))return null;var A={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:n};return s.unitless||D!=="px"&&D!=="em"?A.pfValue=t:A.pfValue=D==="px"||!D?t:this.getEmSizeInPixels()*t,(D==="ms"||D==="s")&&(A.pfValue=D==="ms"?t:1e3*t),(D==="deg"||D==="rad")&&(A.pfValue=D==="rad"?t:_c(t)),D==="%"&&(A.pfValue=t/100),A}else if(s.propList){var z=[],O=""+t;if(O!=="none"){for(var R=O.split(/\s*,\s*|\s+/),Y=0;Y<R.length;Y++){var V=R[Y].trim();a.properties[V]?z.push(V):Pe("`"+V+"` is not a valid property name")}if(z.length===0)return null}return{name:e,value:z,strValue:z.length===0?"none":z.join(" "),bypass:n}}else if(s.color){var F=cu(t);return F?{name:e,value:F,pfValue:F,strValue:"rgb("+F[0]+","+F[1]+","+F[2]+")",bypass:n}:null}else if(s.regex||s.regexes){if(s.enums){var W=M();if(W)return W}for(var Q=s.regexes?s.regexes:[s.regex],re=0;re<Q.length;re++){var K=new RegExp(Q[re]),$=K.exec(t);if($)return{name:e,value:s.singleRegexMatchValue?$[1]:$,strValue:""+t,bypass:n}}return null}else return s.string?{name:e,value:""+t,strValue:""+t,bypass:n}:s.enums?M():null};var ot=function e(t){if(!(this instanceof e))return new e(t);if(!hi(t)){Le("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},nt=ot.prototype;nt.instanceString=function(){return"style"},nt.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(a){var o=a[0]._private;o.styleDirty=!0,o.appliedInitStyle=!1}),this},nt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},nt.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},nt.selector=function(e){var t=e==="core"?null:new nn(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},nt.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var a=e.properties[r],o=n[a.name];o===void 0&&(o=n[fa(a.name)]),o!==void 0&&this.cssRule(a.name,o)}else t.length===2&&this.cssRule(t[0],t[1]);return this},nt.style=nt.css,nt.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n);var a=!this[r].selector;a&&(this._private.coreStyle[n.name]=n)}return this},nt.append=function(e){return is(e)?e.appendToStyle(this):Be(e)?this.appendFromJson(e):he(e)&&this.appendFromString(e),this},ot.fromJson=function(e,t){var n=new ot(e);return n.fromJson(t),n},ot.fromString=function(e,t){return new ot(e).fromString(t)},[rt,lr,Za,Bt,Zr,Qa,Ze,Qr].forEach(function(e){ge(nt,e)}),ot.types=nt.types,ot.properties=nt.properties,ot.propertyGroups=nt.propertyGroups,ot.propertyGroupNames=nt.propertyGroupNames,ot.propertyGroupKeys=nt.propertyGroupKeys;var Uf={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return is(e)?t.style=e.generateStyle(this):Be(e)?t.style=ot.fromJson(this,e):he(e)?t.style=ot.fromString(this,e):t.style=ot(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Hf="single",cn={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Hf),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,a,o,i;switch(e.length){case 0:return t;case 1:if(he(e[0]))return n=e[0],t[n];if(ke(e[0])){if(!this._private.panningEnabled)return this;a=e[0],o=a.x,i=a.y,ne(o)&&(t.x=o),ne(i)&&(t.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n==="x"||n==="y")&&ne(r)&&(t[n]=r),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,r=this._private.pan,a,o,i,u,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:ke(e)&&(i=n[0],u=i.x,l=i.y,ne(u)&&(r.x+=u),ne(l)&&(r.y+=l),this.emit("pan viewport"));break;case 2:a=e,o=t,(a==="x"||a==="y")&&ne(o)&&(r[a]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ne(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(he(e)){var r=e;e=this.$(r)}else if($l(e)){var a=e;n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else gt(e)||(e=this.mutableElements());if(!(gt(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),i=this.height(),u;if(t=ne(t)?t:0,!isNaN(o)&&!isNaN(i)&&o>0&&i>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*t)/n.w,(i-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(o-u*(n.x1+n.x2))/2,y:(i-u*(n.y1+n.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return ne(e)&&ne(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ne(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:ne(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,a,o,i=!1;if(t.zoomingEnabled||(i=!0),ne(e)?o=e:ke(e)&&(o=e.level,e.position!=null?a=ma(e.position,r,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!t.panningEnabled&&(i=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,i||!ne(o)||o===r||a!=null&&(!ne(a.x)||!ne(a.y)))return null;if(a!=null){var u=n,l=r,s=o,c={x:-s/l*(a.x-u.x)+a.x,y:-s/l*(a.y-u.y)+a.y};return{zoomed:!0,panned:!0,zoom:s,pan:c}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],o=!1,i=!1;if(!e)return this;if(ne(e.zoom)||(n=!1),ke(e.pan)||(r=!1),!n&&!r)return this;if(n){var u=e.zoom;u<t.minZoom||u>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=u,a.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ne(l.x)&&(t.pan.x=l.x,i=!1),ne(l.y)&&(t.pan.y=l.y,i=!1),i||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(he(e)){var n=e;e=this.mutableElements().filter(n)}else gt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var i={x:(a-t*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2};return i}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?(function(){var r=n.window().getComputedStyle(t),a=function(o){return parseFloat(r.getPropertyValue(o))};return{width:t.clientWidth-a("padding-left")-a("padding-right"),height:t.clientHeight-a("padding-top")-a("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};cn.centre=cn.center,cn.autolockNodes=cn.autolock,cn.autoungrabifyNodes=cn.autoungrabify;var ur={data:_e.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:_e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:_e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ur.attr=ur.data,ur.removeAttr=ur.removeData;var wr=function(e){var t=this;e=ge({},e);var n=e.container;n&&!aa(n)&&aa(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=Ye!==void 0&&n!==void 0&&!e.headless,i=e;i.layout=ge({name:o?"grid":"null"},i.layout),i.renderer=ge({name:o?"canvas":"null"},i.renderer);var u=function(h,p,f){return p!==void 0?p:f!==void 0?f:h},l=this._private={container:n,ready:!1,options:i,elements:new Je(this),listeners:[],aniEles:new Je(this),data:i.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,i.zoomingEnabled),userZoomingEnabled:u(!0,i.userZoomingEnabled),panningEnabled:u(!0,i.panningEnabled),userPanningEnabled:u(!0,i.userPanningEnabled),boxSelectionEnabled:u(!0,i.boxSelectionEnabled),autolock:u(!1,i.autolock,i.autolockNodes),autoungrabify:u(!1,i.autoungrabify,i.autoungrabifyNodes),autounselectify:u(!1,i.autounselectify),styleEnabled:i.styleEnabled===void 0?o:i.styleEnabled,zoom:ne(i.zoom)?i.zoom:1,pan:{x:ke(i.pan)&&ne(i.pan.x)?i.pan.x:0,y:ke(i.pan)&&ne(i.pan.y)?i.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,i.multiClickDebounceTime)};this.createEmitter(),this.selectionType(i.selectionType),this.zoomRange({min:i.minZoom,max:i.maxZoom});var s=function(h,p){var f=h.some(Zl);if(f)return Wn.all(h).then(p);p(h)};l.styleEnabled&&t.setStyle([]);var c=ge({},i,i.renderer);t.initRenderer(c);var d=function(h,p,f){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),h!=null&&(ke(h)||Be(h))&&t.add(h),t.one("layoutready",function(g){t.notifications(!0),t.emit(g),t.one("load",p),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",f),t.emit("done")});var m=ge({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};s([i.style,i.elements],function(h){var p=h[0],f=h[1];l.styleEnabled&&t.style().append(p),d(f,function(){t.startAnimationLoop(),l.ready=!0,ze(i.ready)&&t.on("ready",i.ready);for(var v=0;v<a.length;v++){var m=a[v];t.on("ready",m)}r&&(r.readies=[]),t.emit("ready")},i.done)})},Vr=wr.prototype;ge(Vr,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return Ye;var t=this._private.container.ownerDocument;return t===void 0||t==null?Ye:t.defaultView||Ye},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!aa(e)&&aa(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(ge({},r,r.renderer,{name:r.renderer.name==="null"?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return At(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),a=function(y){return t.getElementById(y.id())};if(ke(e)){if(t.startBatch(),e.elements){var o={},i=function(y,b){for(var w=[],S=[],k=0;k<y.length;k++){var x=y[k];if(!x.data.id){Pe("cy.json() cannot handle elements without an ID attribute");continue}var C=""+x.data.id,T=t.getElementById(C);o[C]=!0,T.length!==0?S.push({ele:T,json:x}):(b&&(x.group=b),w.push(x))}t.add(w);for(var P=0;P<S.length;P++){var M=S[P],D=M.ele,B=M.json;D.json(B)}};if(Be(e.elements))i(e.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var s=u[l],c=e.elements[s];Be(c)&&i(c,s)}var d=t.collection();r.filter(function(y){return!o[y.id()]}).forEach(function(y){y.isParent()?d.merge(y):y.remove()}),d.forEach(function(y){return y.children().move({parent:null})}),d.forEach(function(y){return a(y).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],p=0;p<h.length;p++){var f=h[p];e[f]!=null&&t[f](e[f])}return t.endBatch(),this}else{var v=!!e,m={};v?m.elements=this.elements().map(function(y){return y.json()}):(m.elements={},r.forEach(function(y){var b=y.group();m.elements[b]||(m.elements[b]=[]),m.elements[b].push(y.json())})),this._private.styleEnabled&&(m.style=t.style().json()),m.data=At(t.data());var g=n.options;return m.zoomingEnabled=n.zoomingEnabled,m.userZoomingEnabled=n.userZoomingEnabled,m.zoom=n.zoom,m.minZoom=n.minZoom,m.maxZoom=n.maxZoom,m.panningEnabled=n.panningEnabled,m.userPanningEnabled=n.userPanningEnabled,m.pan=At(n.pan),m.boxSelectionEnabled=n.boxSelectionEnabled,m.renderer=At(g.renderer),m.hideEdgesOnViewport=g.hideEdgesOnViewport,m.textureOnViewport=g.textureOnViewport,m.wheelSensitivity=g.wheelSensitivity,m.motionBlur=g.motionBlur,m.multiClickDebounceTime=g.multiClickDebounceTime,m}}}),Vr.$id=Vr.getElementById,[zf,jf,tl,Ka,Kr,Yf,$a,$r,Uf,cn,ur].forEach(function(e){ge(Vr,e)});var Gf={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Kf={maximal:!1,acyclic:!1},kn=function(e){return e.scratch("breadthfirst")},To=function(e,t){return e.scratch("breadthfirst",t)};function nl(e){this.options=ge({},Gf,Kf,e)}nl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().filter(function(Z){return!Z.isParent()}),o=r,i=t.directed,u=t.acyclic||t.maximal||t.maximalAdjustments>0,l=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s;if(gt(t.roots))s=t.roots;else if(Be(t.roots)){for(var c=[],d=0;d<t.roots.length;d++){var h=t.roots[d],p=n.getElementById(h);c.push(p)}s=n.collection(c)}else if(he(t.roots))s=n.$(t.roots);else if(i)s=a.roots();else{var f=r.components();s=n.collection();for(var v=function(Z){var oe=f[Z],ae=oe.maxDegree(!1),de=oe.filter(function(ve){return ve.degree(!1)===ae});s=s.add(de)},m=0;m<f.length;m++)v(m)}var g=[],y={},b=function(Z,oe){g[oe]==null&&(g[oe]=[]);var ae=g[oe].length;g[oe].push(Z),To(Z,{index:ae,depth:oe})},w=function(Z,oe){var ae=kn(Z),de=ae.depth,ve=ae.index;g[de][ve]=null,b(Z,oe)};o.bfs({roots:s,directed:t.directed,visit:function(Z,oe,ae,de,ve){var be=Z[0],xe=be.id();b(be,ve),y[xe]=!0}});for(var S=[],k=0;k<a.length;k++){var x=a[k];y[x.id()]||S.push(x)}var C=function(Z){for(var oe=g[Z],ae=0;ae<oe.length;ae++){var de=oe[ae];if(de==null){oe.splice(ae,1),ae--;continue}To(de,{depth:Z,index:ae})}},T=function(){for(var Z=0;Z<g.length;Z++)C(Z)},P=function(Z,oe){for(var ae=kn(Z),de=Z.incomers().filter(function(E){return E.isNode()&&r.has(E)}),ve=-1,be=Z.id(),xe=0;xe<de.length;xe++){var Me=de[xe],we=kn(Me);ve=Math.max(ve,we.depth)}if(ae.depth<=ve){if(!t.acyclic&&oe[be])return null;var Ce=ve+1;return w(Z,Ce),oe[be]=Ce,!0}return!1};if(i&&u){var M=[],D={},B=function(Z){return M.push(Z)},_=function(){return M.shift()};for(a.forEach(function(Z){return M.push(Z)});M.length>0;){var N=_(),A=P(N,D);if(A)N.outgoers().filter(function(Z){return Z.isNode()&&r.has(Z)}).forEach(B);else if(A===null){Pe("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}T();var z=0;if(t.avoidOverlap)for(var O=0;O<a.length;O++){var R=a[O],Y=R.layoutDimensions(t),V=Y.w,F=Y.h;z=Math.max(z,V,F)}var W={},Q=function(Z){if(W[Z.id()])return W[Z.id()];for(var oe=kn(Z).depth,ae=Z.neighborhood(),de=0,ve=0,be=0;be<ae.length;be++){var xe=ae[be];if(!(xe.isEdge()||xe.isParent()||!a.has(xe))){var Me=kn(xe);if(Me!=null){var we=Me.index,Ce=Me.depth;if(!(we==null||Ce==null)){var E=g[Ce].length;Ce<oe&&(de+=we/E,ve++)}}}}return ve=Math.max(1,ve),de=de/ve,ve===0&&(de=0),W[Z.id()]=de,de},re=function(Z,oe){var ae=Q(Z),de=Q(oe),ve=ae-de;return ve===0?ss(Z.id(),oe.id()):ve};t.depthSort!==void 0&&(re=t.depthSort);for(var K=0;K<g.length;K++)g[K].sort(re),C(K);for(var $=[],I=0;I<S.length;I++)$.push(S[I]);g.unshift($),T();for(var H=0,U=0;U<g.length;U++)H=Math.max(g[U].length,H);var te={x:l.x1+l.w/2,y:l.x1+l.h/2},ce=g.reduce(function(Z,oe){return Math.max(Z,oe.length)},0),me=function(Z){var oe=kn(Z),ae=oe.depth,de=oe.index,ve=g[ae].length,be=Math.max(l.w/((t.grid?ce:ve)+1),z),xe=Math.max(l.h/(g.length+1),z),Me=Math.min(l.w/2/g.length,l.h/2/g.length);if(Me=Math.max(Me,z),t.circle){var we=Me*ae+Me-(g.length>0&&g[0].length<=3?Me/2:0),Ce=2*Math.PI/g[ae].length*de;return ae===0&&g[0].length===1&&(we=1),{x:te.x+we*Math.cos(Ce),y:te.y+we*Math.sin(Ce)}}else{var E={x:te.x+(de+1-(ve+1)/2)*be,y:(ae+1)*xe};return E}};return r.nodes().layoutPositions(this,t,me),this};var $f={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function rl(e){this.options=ge({},$f,e)}rl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var i=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:i.x1+i.w/2,y:i.y1+i.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/o.length:t.sweep,s=l/Math.max(1,o.length-1),c,d=0,h=0;h<o.length;h++){var p=o[h],f=p.layoutDimensions(t),v=f.w,m=f.h;d=Math.max(d,v,m)}if(ne(t.radius)?c=t.radius:o.length<=1?c=0:c=Math.min(i.h,i.w)/2-d,o.length>1&&t.avoidOverlap){d*=1.75;var g=Math.cos(s)-Math.cos(0),y=Math.sin(s)-Math.sin(0),b=Math.sqrt(d*d/(g*g+y*y));c=Math.max(b,c)}var w=function(S,k){var x=t.startAngle+k*s*(a?1:-1),C=c*Math.cos(x),T=c*Math.sin(x),P={x:u.x+C,y:u.y+T};return P};return r.nodes().layoutPositions(this,t,w),this};var Zf={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function al(e){this.options=ge({},Zf,e)}al.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,o=a.nodes().not(":parent"),i=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:i.x1+i.w/2,y:i.y1+i.h/2},l=[],s=0,c=0;c<o.length;c++){var d=o[c],h=void 0;h=t.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}o.updateStyle();for(var p=0;p<o.length;p++){var f=o[p],v=f.layoutDimensions(t);s=Math.max(s,v.w,v.h)}l.sort(function(Z,oe){return oe.value-Z.value});for(var m=t.levelWidth(o),g=[[]],y=g[0],b=0;b<l.length;b++){var w=l[b];if(y.length>0){var S=Math.abs(y[0].value-w.value);S>=m&&(y=[],g.push(y))}y.push(w)}var k=s+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,C=Math.min(i.w,i.h)/2-k,T=C/(g.length+x?1:0);k=Math.min(k,T)}for(var P=0,M=0;M<g.length;M++){var D=g[M],B=t.sweep===void 0?2*Math.PI-2*Math.PI/D.length:t.sweep,_=D.dTheta=B/Math.max(1,D.length-1);if(D.length>1&&t.avoidOverlap){var N=Math.cos(_)-Math.cos(0),A=Math.sin(_)-Math.sin(0),z=Math.sqrt(k*k/(N*N+A*A));P=Math.max(z,P)}D.r=P,P+=k}if(t.equidistant){for(var O=0,R=0,Y=0;Y<g.length;Y++){var V=g[Y],F=V.r-R;O=Math.max(O,F)}R=0;for(var W=0;W<g.length;W++){var Q=g[W];W===0&&(R=Q.r),Q.r=R,R+=O}}for(var re={},K=0;K<g.length;K++)for(var $=g[K],I=$.dTheta,H=$.r,U=0;U<$.length;U++){var te=$[U],ce=t.startAngle+(n?1:-1)*I*U,me={x:u.x+H*Math.cos(ce),y:u.y+H*Math.sin(ce)};re[te.node.id()]=me}return a.nodes().layoutPositions(this,t,function(Z){var oe=Z.id();return re[oe]}),this};var Ra,Qf={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Jr(e){this.options=ge({},Qf,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(a){var o=a.source().data("id"),i=a.target().data("id"),u=t.some(function(s){return s.data("id")===o}),l=t.some(function(s){return s.data("id")===i});return!u||!l});this.options.eles=this.options.eles.not(r)}Jr.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?Ra=!0:Ra=!1;var r=Jf(t,n,e);Ra&&ng(r),e.randomize&&rg(r);var a=Yt(),o=function(){ag(r,t,e),e.fit===!0&&t.fit(e.padding)},i=function(d){return!(n.stopped||d>=e.numIter||(ig(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},u=function(){if(e.animate===!0||e.animate===!1)o(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var d=e.eles.nodes(),h=il(r,e,d);d.layoutPositions(n,e,h)}},l=0,s=!0;if(e.animate===!0){var c=function d(){for(var h=0;s&&h<e.refresh;)s=i(l),l++,h++;if(!s)Oo(r,e),u();else{var p=Yt();p-a>=e.animationThreshold&&o(),ia(d)}};c()}else{for(;s;)s=i(l),l++;Oo(r,e),u()}return this},Jr.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Jr.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Jf=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),o=ht(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),l={},s=0;s<u.length;s++)for(var c=u[s],d=0;d<c.length;d++){var h=c[d];l[h.id()]=s}for(var s=0;s<i.nodeSize;s++){var p=a[s],f=p.layoutDimensions(n),v={};v.isLocked=p.locked(),v.id=p.data("id"),v.parentId=p.data("parent"),v.cmptId=l[p.id()],v.children=[],v.positionX=p.position("x"),v.positionY=p.position("y"),v.offsetX=0,v.offsetY=0,v.height=f.w,v.width=f.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(p.style("padding")),v.padRight=parseFloat(p.style("padding")),v.padTop=parseFloat(p.style("padding")),v.padBottom=parseFloat(p.style("padding")),v.nodeRepulsion=ze(n.nodeRepulsion)?n.nodeRepulsion(p):n.nodeRepulsion,i.layoutNodes.push(v),i.idToIndex[v.id]=s}for(var m=[],g=0,y=-1,b=[],s=0;s<i.nodeSize;s++){var p=i.layoutNodes[s],w=p.parentId;w!=null?i.layoutNodes[i.idToIndex[w]].children.push(p.id):(m[++y]=p.id,b.push(p.id))}for(i.graphSet.push(b);g<=y;){var S=m[g++],k=i.idToIndex[S],h=i.layoutNodes[k],x=h.children;if(x.length>0){i.graphSet.push(x);for(var s=0;s<x.length;s++)m[++y]=x[s]}}for(var s=0;s<i.graphSet.length;s++)for(var C=i.graphSet[s],d=0;d<C.length;d++){var T=i.idToIndex[C[d]];i.indexToGraph[T]=s}for(var s=0;s<i.edgeSize;s++){var P=r[s],M={};M.id=P.data("id"),M.sourceId=P.data("source"),M.targetId=P.data("target");var D=ze(n.idealEdgeLength)?n.idealEdgeLength(P):n.idealEdgeLength,B=ze(n.edgeElasticity)?n.edgeElasticity(P):n.edgeElasticity,_=i.idToIndex[M.sourceId],N=i.idToIndex[M.targetId],A=i.indexToGraph[_],z=i.indexToGraph[N];if(A!=z){for(var O=eg(M.sourceId,M.targetId,i),R=i.graphSet[O],Y=0,v=i.layoutNodes[_];R.indexOf(v.id)===-1;)v=i.layoutNodes[i.idToIndex[v.parentId]],Y++;for(v=i.layoutNodes[N];R.indexOf(v.id)===-1;)v=i.layoutNodes[i.idToIndex[v.parentId]],Y++;D*=Y*n.nestingFactor}M.idealLength=D,M.elasticity=B,i.layoutEdges.push(M)}return i},eg=function(e,t,n){var r=tg(e,t,0,n);return 2>r.count?0:r.graph},tg=function e(t,n,r,a){var o=a.graphSet[r];if(-1<o.indexOf(t)&&-1<o.indexOf(n))return{count:2,graph:r};for(var i=0,u=0;u<o.length;u++){var l=o[u],s=a.idToIndex[l],c=a.layoutNodes[s].children;if(c.length!==0){var d=a.indexToGraph[a.idToIndex[c[0]]],h=e(t,n,d,a);if(h.count!==0)if(h.count===1){if(i++,i===2)break}else return h}}return{count:i,graph:r}},ng,rg=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var o=e.layoutNodes[a];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*r)}},il=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(o){var i=e.layoutNodes[e.idToIndex[o.data("id")]];a.x1=Math.min(a.x1,i.positionX),a.x2=Math.max(a.x2,i.positionX),a.y1=Math.min(a.y1,i.positionY),a.y2=Math.max(a.y2,i.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(o,i){var u=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var l=(u.positionX-a.x1)/a.w,s=(u.positionY-a.y1)/a.h;return{x:r.x1+l*r.w,y:r.y1+s*r.h}}else return{x:u.positionX,y:u.positionY}}},ag=function(e,t,n){var r=n.layout,a=n.eles.nodes(),o=il(e,n,a);a.positions(o),e.ready!==!0&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ig=function(e,t,n){og(e,t),ug(e),cg(e,t),dg(e),hg(e)},og=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,o=0;o<a;o++)for(var i=e.layoutNodes[e.idToIndex[r[o]]],u=o+1;u<a;u++){var l=e.layoutNodes[e.idToIndex[r[u]]];sg(i,l,e,t)}},Bo=function(e){return-e+2*e*Math.random()},sg=function(e,t,n,r){var a=e.cmptId,o=t.cmptId;if(!(a!==o&&!n.isCompound)){var i=t.positionX-e.positionX,u=t.positionY-e.positionY,l=1;i===0&&u===0&&(i=Bo(l),u=Bo(l));var s=lg(e,t,i,u);if(s>0)var m=r.nodeOverlap*s,v=Math.sqrt(i*i+u*u),g=m*i/v,y=m*u/v;else var c=pa(e,i,u),d=pa(t,-1*i,-1*u),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,v=Math.sqrt(f),m=(e.nodeRepulsion+t.nodeRepulsion)/f,g=m*h/v,y=m*p/v;e.isLocked||(e.offsetX-=g,e.offsetY-=y),t.isLocked||(t.offsetX+=g,t.offsetY+=y)}},lg=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return a>=0&&o>=0?Math.sqrt(a*a+o*o):0},pa=function(e,t,n){var r=e.positionX,a=e.positionY,o=e.height||1,i=e.width||1,u=n/t,l=o/i,s={};return t===0&&0<n||t===0&&0>n?(s.x=r,s.y=a+o/2,s):0<t&&-1*l<=u&&u<=l?(s.x=r+i/2,s.y=a+i*n/2/t,s):0>t&&-1*l<=u&&u<=l?(s.x=r-i/2,s.y=a-i*n/2/t,s):0<n&&(u<=-1*l||u>=l)?(s.x=r+o*t/2/n,s.y=a+o/2,s):(0>n&&(u<=-1*l||u>=l)&&(s.x=r-o*t/2/n,s.y=a-o/2),s)},ug=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],o=e.layoutNodes[a],i=e.idToIndex[r.targetId],u=e.layoutNodes[i],l=u.positionX-o.positionX,s=u.positionY-o.positionY;if(!(l===0&&s===0)){var c=pa(o,l,s),d=pa(u,-1*l,-1*s),h=d.x-c.x,p=d.y-c.y,f=Math.sqrt(h*h+p*p),v=Math.pow(r.idealLength-f,2)/r.elasticity;if(f!==0)var m=v*h/f,g=v*p/f;else var m=0,g=0;o.isLocked||(o.offsetX+=m,o.offsetY+=g),u.isLocked||(u.offsetX-=m,u.offsetY-=g)}}},cg=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var a=e.graphSet[r],o=a.length;if(r===0)var l=e.clientHeight/2,s=e.clientWidth/2;else var i=e.layoutNodes[e.idToIndex[a[0]]],u=e.layoutNodes[e.idToIndex[i.parentId]],l=u.positionX,s=u.positionY;for(var c=0;c<o;c++){var d=e.layoutNodes[e.idToIndex[a[c]]];if(!d.isLocked){var h=l-d.positionX,p=s-d.positionY,f=Math.sqrt(h*h+p*p);if(f>n){var v=t.gravity*h/f,m=t.gravity*p/f;d.offsetX+=v,d.offsetY+=m}}}}},dg=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var o=n[r++],i=e.idToIndex[o],u=e.layoutNodes[i],l=u.children;if(0<l.length&&!u.isLocked){for(var s=u.offsetX,c=u.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=s,h.offsetY+=c,n[++a]=l[d]}u.offsetX=0,u.offsetY=0}}},hg=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var a=pg(r.offsetX,r.offsetY,e.temperature);r.positionX+=a.x,r.positionY+=a.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,fg(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},pg=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else var a={x:e,y:t};return a},fg=function e(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],o=!1;if((a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,o=!0),(a.minX==null||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,o=!0),(a.maxY==null||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,o=!0),(a.minY==null||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,o=!0),o)return e(a,n)}},Oo=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var o=n[a],i=o.cmptId,u=r[i]=r[i]||[];u.push(o)}for(var l=0,a=0;a<r.length;a++){var s=r[a];if(s){s.x1=1/0,s.x2=-1/0,s.y1=1/0,s.y2=-1/0;for(var c=0;c<s.length;c++){var d=s[c];s.x1=Math.min(s.x1,d.positionX-d.width/2),s.x2=Math.max(s.x2,d.positionX+d.width/2),s.y1=Math.min(s.y1,d.positionY-d.height/2),s.y2=Math.max(s.y2,d.positionY+d.height/2)}s.w=s.x2-s.x1,s.h=s.y2-s.y1,l+=s.w*s.h}}r.sort(function(g,y){return y.w*y.h-g.w*g.h});for(var h=0,p=0,f=0,v=0,m=Math.sqrt(l)*e.clientWidth/e.clientHeight,a=0;a<r.length;a++){var s=r[a];if(s){for(var c=0;c<s.length;c++){var d=s[c];d.isLocked||(d.positionX+=h-s.x1,d.positionY+=p-s.y1)}h+=s.w+t.componentSpacing,f+=s.w+t.componentSpacing,v=Math.max(v,s.h),f>m&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}},gg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ol(e){this.options=ge({},gg,e)}ol.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var o=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(o.h===0||o.w===0)r.nodes().layoutPositions(this,t,function(W){return{x:o.x1,y:o.y1}});else{var i=a.size(),u=Math.sqrt(i*o.h/o.w),l=Math.round(u),s=Math.round(o.w/o.h*u),c=function(W){if(W==null)return Math.min(l,s);var Q=Math.min(l,s);Q==l?l=W:s=W},d=function(W){if(W==null)return Math.max(l,s);var Q=Math.max(l,s);Q==l?l=W:s=W},h=t.rows,p=t.cols!=null?t.cols:t.columns;if(h!=null&&p!=null)l=h,s=p;else if(h!=null&&p==null)l=h,s=Math.ceil(i/l);else if(h==null&&p!=null)s=p,l=Math.ceil(i/s);else if(s*l>i){var f=c(),v=d();(f-1)*v>=i?c(f-1):(v-1)*f>=i&&d(v-1)}else for(;s*l<i;){var m=c(),g=d();(g+1)*m>=i?d(g+1):c(m+1)}var y=o.w/s,b=o.h/l;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var w=0;w<a.length;w++){var S=a[w],k=S._private.position;(k.x==null||k.y==null)&&(k.x=0,k.y=0);var x=S.layoutDimensions(t),C=t.avoidOverlapPadding,T=x.w+C,P=x.h+C;y=Math.max(y,T),b=Math.max(b,P)}for(var M={},D=function(W,Q){return!!M["c-"+W+"-"+Q]},B=function(W,Q){M["c-"+W+"-"+Q]=!0},_=0,N=0,A=function(){N++,N>=s&&(N=0,_++)},z={},O=0;O<a.length;O++){var R=a[O],Y=t.position(R);if(Y&&(Y.row!==void 0||Y.col!==void 0)){var V={row:Y.row,col:Y.col};if(V.col===void 0)for(V.col=0;D(V.row,V.col);)V.col++;else if(V.row===void 0)for(V.row=0;D(V.row,V.col);)V.row++;z[R.id()]=V,B(V.row,V.col)}}var F=function(W,Q){var re,K;if(W.locked()||W.isParent())return!1;var $=z[W.id()];if($)re=$.col*y+y/2+o.x1,K=$.row*b+b/2+o.y1;else{for(;D(_,N);)A();re=N*y+y/2+o.x1,K=_*b+b/2+o.y1,B(_,N),A()}return{x:re,y:K}};a.layoutPositions(this,t,F)}return this};var vg={ready:function(){},stop:function(){}};function Ja(e){this.options=ge({},vg,e)}Ja.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Ja.prototype.stop=function(){return this};var yg={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sl(e){this.options=ge({},yg,e)}sl.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=ze(e.positions);function a(o){if(e.positions==null)return Ec(o.position());if(r)return e.positions(o);var i=e.positions[o._private.data.id];return i??null}return n.layoutPositions(this,e,function(o,i){var u=a(o);return o.locked()||u==null?!1:u}),this};var mg={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ll(e){this.options=ge({},mg,e)}ll.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=ht(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),a=function(o,i){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,a),this};var bg=[{name:"breadthfirst",impl:nl},{name:"circle",impl:rl},{name:"concentric",impl:al},{name:"cose",impl:Jr},{name:"grid",impl:ol},{name:"null",impl:Ja},{name:"preset",impl:sl},{name:"random",impl:ll}];function ul(e){this.options=e,this.notifications=0}var Io=function(){},No=function(){throw new Error("A headless instance can not render images")};ul.prototype={recalculateRenderedStyle:Io,notify:function(){this.notifications++},init:Io,isHeadless:function(){return!0},png:No,jpg:No};var ei={};ei.arrowShapeWidth=.3,ei.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(l,s,c,d,h,p,f){var v=h.x-c/2-f,m=h.x+c/2+f,g=h.y-c/2-f,y=h.y+c/2+f,b=v<=l&&l<=m&&g<=s&&s<=y;return b},r=function(l,s,c,d,h){var p=l*Math.cos(d)-s*Math.sin(d),f=l*Math.sin(d)+s*Math.cos(d),v=p*c,m=f*c,g=v+h.x,y=m+h.y;return{x:g,y}},a=function(l,s,c,d){for(var h=[],p=0;p<l.length;p+=2){var f=l[p],v=l[p+1];h.push(r(f,v,s,c,d))}return h},o=function(l){for(var s=[],c=0;c<l.length;c++){var d=l[c];s.push(d.x,d.y)}return s},i=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},u=function(l,s){he(s)&&(s=e[s]),e[l]=ge({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,d,h,p,f,v){var m=o(a(this.points,h+2*v,p,f)),g=dt(c,d,m);return g},roughCollide:n,draw:function(c,d,h,p){var f=a(this.points,d,h,p);t.arrowShapeImpl("polygon")(c,f)},spacing:function(c){return 0},gap:i},s)};u("none",{collide:oa,roughCollide:oa,draw:gi,spacing:Li,gap:Li}),u("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),u("arrow","triangle"),u("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(l,s,c,d,h){var p=a(this.points,s,c,d),f=this.controlPoint,v=r(f[0],f[1],s,c,d);t.arrowShapeImpl(this.name)(l,p,v)},gap:function(l){return i(l)*.8}}),u("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,s,c,d,h,p,f){var v=o(a(this.points,c+2*f,d,h)),m=o(a(this.pointsTee,c+2*f,d,h)),g=dt(l,s,v)||dt(l,s,m);return g},draw:function(l,s,c,d,h){var p=a(this.points,s,c,d),f=a(this.pointsTee,s,c,d);t.arrowShapeImpl(this.name)(l,p,f)}}),u("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,s,c,d,h,p,f){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-s,2)<=Math.pow((c+2*f)*this.radius,2),g=o(a(this.points,c+2*f,d,h));return dt(l,s,g)||m},draw:function(l,s,c,d,h){var p=a(this.pointsTr,s,c,d);t.arrowShapeImpl(this.name)(l,p,d.x,d.y,this.radius*s)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),u("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,s){var c=this.baseCrossLinePts.slice(),d=s/l,h=3,p=5;return c[h]=c[h]-d,c[p]=c[p]-d,c},collide:function(l,s,c,d,h,p,f){var v=o(a(this.points,c+2*f,d,h)),m=o(a(this.crossLinePts(c,p),c+2*f,d,h)),g=dt(l,s,v)||dt(l,s,m);return g},draw:function(l,s,c,d,h){var p=a(this.points,s,c,d),f=a(this.crossLinePts(s,h),s,c,d);t.arrowShapeImpl(this.name)(l,p,f)}}),u("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return i(l)*.525}}),u("circle",{radius:.15,collide:function(l,s,c,d,h,p,f){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-s,2)<=Math.pow((c+2*f)*this.radius,2);return m},draw:function(l,s,c,d,h){t.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*s)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),u("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),u("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),u("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),u("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var dn={};dn.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],o=r[1],i=r[4],u=n.pan(),l=n.zoom(),s=((e-a)/i-u.x)/l,c=((t-o)/i-u.y)/l;return[s,c]},dn.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(m){return parseFloat(n.getPropertyValue(m))},a={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},o={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},i=e.clientWidth,u=e.clientHeight,l=a.left+a.right,s=a.top+a.bottom,c=o.left+o.right,d=t.width/(i+c),h=i-l,p=u-s,f=t.left+a.left+o.left,v=t.top+a.top+o.top;return this.containerBB=[f,v,h,p,d]},dn.invalidateContainerClientCoordsCache=function(){this.containerBB=null},dn.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},dn.findNearestElements=function(e,t,n,r){var a=this,o=this,i=o.getCachedZSortedEles(),u=[],l=o.cy.zoom(),s=o.cy.hasCompoundNodes(),c=(r?24:8)/l,d=(r?8:2)/l,h=(r?8:2)/l,p=1/0,f,v;n&&(i=i.interactive);function m(x,C){if(x.isNode()){if(v)return;v=x,u.push(x)}if(x.isEdge()&&(C==null||C<p))if(f){if(f.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&f.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var T=0;T<u.length;T++)if(u[T].isEdge()){u[T]=x,f=x,p=C??p;break}}}else u.push(x),f=x,p=C??p}function g(x){var C=x.outerWidth()+2*d,T=x.outerHeight()+2*d,P=C/2,M=T/2,D=x.position(),B=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,_=x._private.rscratch;if(D.x-P<=e&&e<=D.x+P&&D.y-M<=t&&t<=D.y+M){var N=o.nodeShapes[a.getNodeShape(x)];if(N.checkPoint(e,t,0,C,T,D.x,D.y,B,_))return m(x,0),!0}}function y(x){var C=x._private,T=C.rscratch,P=x.pstyle("width").pfValue,M=x.pstyle("arrow-scale").value,D=P/2+c,B=D*D,_=D*2,N=C.source,A=C.target,z;if(T.edgeType==="segments"||T.edgeType==="straight"||T.edgeType==="haystack"){for(var O=T.allpts,R=0;R+3<O.length;R+=2)if(Ac(e,t,O[R],O[R+1],O[R+2],O[R+3],_)&&B>(z=Fc(e,t,O[R],O[R+1],O[R+2],O[R+3])))return m(x,z),!0}else if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"){for(var O=T.allpts,R=0;R+5<T.allpts.length;R+=4)if(zc(e,t,O[R],O[R+1],O[R+2],O[R+3],O[R+4],O[R+5],_)&&B>(z=Vc(e,t,O[R],O[R+1],O[R+2],O[R+3],O[R+4],O[R+5])))return m(x,z),!0}for(var N=N||C.source,A=A||C.target,Y=a.getArrowWidth(P,M),V=[{name:"source",x:T.arrowStartX,y:T.arrowStartY,angle:T.srcArrowAngle},{name:"target",x:T.arrowEndX,y:T.arrowEndY,angle:T.tgtArrowAngle},{name:"mid-source",x:T.midX,y:T.midY,angle:T.midsrcArrowAngle},{name:"mid-target",x:T.midX,y:T.midY,angle:T.midtgtArrowAngle}],R=0;R<V.length;R++){var F=V[R],W=o.arrowShapes[x.pstyle(F.name+"-arrow-shape").value],Q=x.pstyle("width").pfValue;if(W.roughCollide(e,t,Y,F.angle,{x:F.x,y:F.y},Q,c)&&W.collide(e,t,Y,F.angle,{x:F.x,y:F.y},Q,c))return m(x),!0}s&&u.length>0&&(g(N),g(A))}function b(x,C,T){return St(x,C,T)}function w(x,C){var T=x._private,P=h,M;C?M=C+"-":M="",x.boundingBox();var D=T.labelBounds[C||"main"],B=x.pstyle(M+"label").value,_=x.pstyle("text-events").strValue==="yes";if(!(!_||!B)){var N=b(T.rscratch,"labelX",C),A=b(T.rscratch,"labelY",C),z=b(T.rscratch,"labelAngle",C),O=x.pstyle(M+"text-margin-x").pfValue,R=x.pstyle(M+"text-margin-y").pfValue,Y=D.x1-P-O,V=D.x2+P-O,F=D.y1-P-R,W=D.y2+P-R;if(z){var Q=Math.cos(z),re=Math.sin(z),K=function(ce,me){return ce=ce-N,me=me-A,{x:ce*Q-me*re+N,y:ce*re+me*Q+A}},$=K(Y,F),I=K(Y,W),H=K(V,F),U=K(V,W),te=[$.x+O,$.y+R,H.x+O,H.y+R,U.x+O,U.y+R,I.x+O,I.y+R];if(dt(e,t,te))return m(x),!0}else if(jn(D,e,t))return m(x),!0}}for(var S=i.length-1;S>=0;S--){var k=i[S];k.isNode()?g(k)||w(k):y(k)||w(k)||w(k,"source")||w(k,"target")}return u},dn.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],i=Math.min(e,n),u=Math.max(e,n),l=Math.min(t,r),s=Math.max(t,r);e=i,n=u,t=l,r=s;for(var c=ht({x1:e,y1:t,x2:n,y2:r}),d=0;d<a.length;d++){var h=a[d];if(h.isNode()){var p=h,f=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});yi(c,f)&&!Es(f,c)&&o.push(p)}else{var v=h,m=v._private,g=m.rscratch;if(g.startX!=null&&g.startY!=null&&!jn(c,g.startX,g.startY)||g.endX!=null&&g.endY!=null&&!jn(c,g.endX,g.endY))continue;if(g.edgeType==="bezier"||g.edgeType==="multibezier"||g.edgeType==="self"||g.edgeType==="compound"||g.edgeType==="segments"||g.edgeType==="haystack"){for(var y=m.rstyle.bezierPts||m.rstyle.linePts||m.rstyle.haystackPts,b=!0,w=0;w<y.length;w++)if(!Nc(c,y[w])){b=!1;break}b&&o.push(v)}else(g.edgeType==="haystack"||g.edgeType==="straight")&&o.push(v)}}return o};var ea={};ea.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",a=t.edgeType==="multibezier",o=t.edgeType==="segments",i=t.edgeType==="compound",u=t.edgeType==="self",l,s,c,d,h,p,g,y;if(n?(c=t.haystackPts[0],d=t.haystackPts[1],h=t.haystackPts[2],p=t.haystackPts[3]):(c=t.arrowStartX,d=t.arrowStartY,h=t.arrowEndX,p=t.arrowEndY),g=t.midX,y=t.midY,o)l=c-t.segpts[0],s=d-t.segpts[1];else if(a||i||u||r){var f=t.allpts,v=Ge(f[0],f[2],f[4],.1),m=Ge(f[1],f[3],f[5],.1);l=c-v,s=d-m}else l=c-g,s=d-y;t.srcArrowAngle=Tr(l,s);var g=t.midX,y=t.midY;if(n&&(g=(c+h)/2,y=(d+p)/2),l=h-c,s=p-d,o){var f=t.allpts;if(f.length/2%2===0){var b=f.length/2,w=b-2;l=f[b]-f[w],s=f[b+1]-f[w+1]}else if(t.isRound)l=t.midVector[1],s=-t.midVector[0];else{var b=f.length/2-1,w=b-2;l=f[b]-f[w],s=f[b+1]-f[w+1]}}else if(a||i||u){var f=t.allpts,S=t.ctrlpts,k,x,C,T;if(S.length/2%2===0){var P=f.length/2-1,M=P+2,D=M+2;k=Ge(f[P],f[M],f[D],0),x=Ge(f[P+1],f[M+1],f[D+1],0),C=Ge(f[P],f[M],f[D],1e-4),T=Ge(f[P+1],f[M+1],f[D+1],1e-4)}else{var M=f.length/2-1,P=M-2,D=M+2;k=Ge(f[P],f[M],f[D],.4999),x=Ge(f[P+1],f[M+1],f[D+1],.4999),C=Ge(f[P],f[M],f[D],.5),T=Ge(f[P+1],f[M+1],f[D+1],.5)}l=C-k,s=T-x}if(t.midtgtArrowAngle=Tr(l,s),t.midDispX=l,t.midDispY=s,l*=-1,s*=-1,o){var f=t.allpts;if(f.length/2%2!==0&&!t.isRound){var b=f.length/2-1,B=b+2;l=-(f[B]-f[b]),s=-(f[B+1]-f[b+1])}}if(t.midsrcArrowAngle=Tr(l,s),o)l=h-t.segpts[t.segpts.length-2],s=p-t.segpts[t.segpts.length-1];else if(a||i||u||r){var f=t.allpts,_=f.length,v=Ge(f[_-6],f[_-4],f[_-2],.9),m=Ge(f[_-5],f[_-3],f[_-1],.9);l=h-v,s=p-m}else l=h-g,s=p-y;t.tgtArrowAngle=Tr(l,s)},ea.getArrowWidth=ea.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var ti,ni,Ot={},vt={},Ao,zo,pn,ta,Vt,on,hn,Tt,Cn,Fr,cl,dl,ri,ai,Ro,Lo=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},xg=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},wg=function(e,t,n,r,a){if(e!==Ro?Lo(t,e,Ot):xg(vt,Ot),Lo(t,n,vt),Ao=Ot.nx*vt.ny-Ot.ny*vt.nx,zo=Ot.nx*vt.nx-Ot.ny*-vt.ny,Vt=Math.asin(Math.max(-1,Math.min(1,Ao))),Math.abs(Vt)<1e-6){ti=t.x,ni=t.y,hn=Cn=0;return}pn=1,ta=!1,zo<0?Vt<0?Vt=Math.PI+Vt:(Vt=Math.PI-Vt,pn=-1,ta=!0):Vt>0&&(pn=-1,ta=!0),t.radius!==void 0?Cn=t.radius:Cn=r,on=Vt/2,Fr=Math.min(Ot.len/2,vt.len/2),a?(Tt=Math.abs(Math.cos(on)*Cn/Math.sin(on)),Tt>Fr?(Tt=Fr,hn=Math.abs(Tt*Math.sin(on)/Math.cos(on))):hn=Cn):(Tt=Math.min(Fr,Cn),hn=Math.abs(Tt*Math.sin(on)/Math.cos(on))),ri=t.x+vt.nx*Tt,ai=t.y+vt.ny*Tt,ti=ri-vt.ny*hn*pn,ni=ai+vt.nx*hn*pn,cl=t.x+Ot.nx*Tt,dl=t.y+Ot.ny*Tt,Ro=t};function hl(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Di(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(wg(e,t,n,r,a),{cx:ti,cy:ni,radius:hn,startX:cl,startY:dl,stopX:ri,stopY:ai,startAngle:Ot.ang+Math.PI/2*pn,endAngle:vt.ang-Math.PI/2*pn,counterClockwise:ta})}var at={};at.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,o,i=e.pstyle("source-endpoint"),u=e.pstyle("target-endpoint"),l=i.units!=null&&u.units!=null,s=function(w,S,k,x){var C=x-S,T=k-w,P=Math.sqrt(T*T+C*C);return{x:-C/P,y:T/P}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":o=n;break;case"intersection":o=r;break;case"endpoints":{if(l){var d=this.manualEndptToPx(e.source()[0],i),h=Dt(d,2),p=h[0],f=h[1],v=this.manualEndptToPx(e.target()[0],u),m=Dt(v,2),g=m[0],y=m[1],b={x1:p,y1:f,x2:g,y2:y};a=s(p,f,g,y),o=b}else Pe("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),o=r;break}}return{midptPts:o,vectorNormInverse:a}},at.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var o=Math.random()*2*Math.PI;a.source={x:Math.cos(o),y:Math.sin(o)},o=Math.random()*2*Math.PI,a.target={x:Math.cos(o),y:Math.sin(o)}}var i=r.source,u=r.target,l=i.position(),s=u.position(),c=i.width(),d=u.width(),h=i.height(),p=u.height(),f=n.pstyle("haystack-radius").value,v=f/2;a.haystackPts=a.allpts=[a.source.x*c*v+l.x,a.source.y*h*v+l.y,a.target.x*d*v+s.x,a.target.y*p*v+s.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},at.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),o=e.pstyle("segment-radii"),i=e.pstyle("radius-type"),u=Math.min(r.pfValue.length,a.pfValue.length),l=o.pfValue[o.pfValue.length-1],s=i.pfValue[i.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<u;c++){var d=r.pfValue[c],h=a.pfValue[c],p=1-d,f=d,v=this.findMidptPtsEtc(e,t),m=v.midptPts,g=v.vectorNormInverse,y={x:m.x1*p+m.x2*f,y:m.y1*p+m.y2*f};n.segpts.push(y.x+g.x*h,y.y+g.y*h),n.radii.push(o.pfValue[c]!==void 0?o.pfValue[c]:l),n.isArcRadius.push((i.pfValue[c]!==void 0?i.pfValue[c]:s)==="arc-radius")}},at.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,o=t.dirCounts,i=t.srcPos,u=e.pstyle("control-point-distances"),l=u?u.pfValue[0]:void 0,s=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,p=d;r&&(h=0,p=l);var f=s-Math.PI/2,v=f-c/2,m=f+c/2,g=s+"_"+c;h=o[g]===void 0?o[g]=0:++o[g],a.ctrlpts=[i.x+Math.cos(v)*1.4*p*(h/3+1),i.y+Math.sin(v)*1.4*p*(h/3+1),i.x+Math.cos(m)*1.4*p*(h/3+1),i.y+Math.sin(m)*1.4*p*(h/3+1)]},at.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var o=t.srcPos,i=t.tgtPos,u=t.srcW,l=t.srcH,s=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),p=h?h.pfValue[0]:void 0,f=n,v=d;r&&(f=0,v=p);var m=50,g={x:o.x-u/2,y:o.y-l/2},y={x:i.x-s/2,y:i.y-c/2},b={x:Math.min(g.x,y.x),y:Math.min(g.y,y.y)},w=.5,S=Math.max(w,Math.log(u*.01)),k=Math.max(w,Math.log(s*.01));a.ctrlpts=[b.x,b.y-(1+Math.pow(m,1.12)/100)*v*(f/3+1)*S,b.x-(1+Math.pow(m,1.12)/100)*v*(f/3+1)*k,b.y]},at.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},at.findBezierPoints=function(e,t,n,r,a){var o=e._private.rscratch,i=e.pstyle("control-point-step-size").pfValue,u=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),s=u&&l?Math.min(u.value.length,l.value.length):1,c=u?u.pfValue[0]:void 0,d=l.value[0],h=r;o.edgeType=h?"multibezier":"bezier",o.ctrlpts=[];for(var p=0;p<s;p++){var f=(.5-t.eles.length/2+n)*i*(a?-1:1),v=void 0,m=Fi(f);h&&(c=u?u.pfValue[p]:i,d=l.value[p]),r?v=c:v=c!==void 0?m*c:void 0;var g=v!==void 0?v:f,y=1-d,b=d,w=this.findMidptPtsEtc(e,t),S=w.midptPts,k=w.vectorNormInverse,x={x:S.x1*y+S.x2*b,y:S.y1*y+S.y2*b};o.ctrlpts.push(x.x+k.x*g,x.y+k.y*g)}},at.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",o="leftward",i="rightward",u="downward",l="upward",s="auto",c=t.posPts,d=t.srcW,h=t.srcH,p=t.tgtW,f=t.tgtH,v=e.pstyle("edge-distances").value,m=v!=="node-position",g=e.pstyle("taxi-direction").value,y=g,b=e.pstyle("taxi-turn"),w=b.units==="%",S=b.pfValue,k=S<0,x=e.pstyle("taxi-turn-min-distance").pfValue,C=m?(d+p)/2:0,T=m?(h+f)/2:0,P=c.x2-c.x1,M=c.y2-c.y1,D=function(pe,fe){return pe>0?Math.max(pe-fe,0):Math.min(pe+fe,0)},B=D(P,C),_=D(M,T),N=!1;y===s?g=Math.abs(B)>Math.abs(_)?a:r:y===l||y===u?(g=r,N=!0):(y===o||y===i)&&(g=a,N=!0);var A=g===r,z=A?_:B,O=A?M:P,R=Fi(O),Y=!1;!(N&&(w||k))&&(y===u&&O<0||y===l&&O>0||y===o&&O>0||y===i&&O<0)&&(R*=-1,z=R*Math.abs(z),Y=!0);var V;if(w){var F=S<0?1+S:S;V=F*z}else{var W=S<0?z:0;V=W+S*R}var Q=function(pe){return Math.abs(pe)<x||Math.abs(pe)>=Math.abs(z)},re=Q(V),K=Q(Math.abs(z)-Math.abs(V)),$=re||K;if($&&!Y)if(A){var I=Math.abs(O)<=h/2,H=Math.abs(P)<=p/2;if(I){var U=(c.x1+c.x2)/2,te=c.y1,ce=c.y2;n.segpts=[U,te,U,ce]}else if(H){var me=(c.y1+c.y2)/2,Z=c.x1,oe=c.x2;n.segpts=[Z,me,oe,me]}else n.segpts=[c.x1,c.y2]}else{var ae=Math.abs(O)<=d/2,de=Math.abs(M)<=f/2;if(ae){var ve=(c.y1+c.y2)/2,be=c.x1,xe=c.x2;n.segpts=[be,ve,xe,ve]}else if(de){var Me=(c.x1+c.x2)/2,we=c.y1,Ce=c.y2;n.segpts=[Me,we,Me,Ce]}else n.segpts=[c.x2,c.y1]}else if(A){var E=c.y1+V+(m?h/2*R:0),L=c.x1,G=c.x2;n.segpts=[L,E,G,E]}else{var X=c.x1+V+(m?d/2*R:0),j=c.y1,ee=c.y2;n.segpts=[X,j,X,ee]}if(n.isRound){var q=e.pstyle("taxi-radius").value,J=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(q),n.isArcRadius=new Array(n.segpts.length/2).fill(J)}},at.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,o=t.srcW,i=t.srcH,u=t.tgtW,l=t.tgtH,s=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,v=!ne(n.startX)||!ne(n.startY),m=!ne(n.arrowStartX)||!ne(n.arrowStartY),g=!ne(n.endX)||!ne(n.endY),y=!ne(n.arrowEndX)||!ne(n.arrowEndY),b=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=b*w,k=yn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=k<S,C=yn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),T=C<S,P=!1;if(v||m||x){P=!0;var M={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},D=Math.sqrt(M.x*M.x+M.y*M.y),B={x:M.x/D,y:M.y/D},_=Math.max(o,i),N={x:n.ctrlpts[0]+B.x*2*_,y:n.ctrlpts[1]+B.y*2*_},A=s.intersectLine(r.x,r.y,o,i,N.x,N.y,0,d,p);x?(n.ctrlpts[0]=n.ctrlpts[0]+B.x*(S-k),n.ctrlpts[1]=n.ctrlpts[1]+B.y*(S-k)):(n.ctrlpts[0]=A[0]+B.x*S,n.ctrlpts[1]=A[1]+B.y*S)}if(g||y||T){P=!0;var z={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},O=Math.sqrt(z.x*z.x+z.y*z.y),R={x:z.x/O,y:z.y/O},Y=Math.max(o,i),V={x:n.ctrlpts[0]+R.x*2*Y,y:n.ctrlpts[1]+R.y*2*Y},F=c.intersectLine(a.x,a.y,u,l,V.x,V.y,0,h,f);T?(n.ctrlpts[0]=n.ctrlpts[0]+R.x*(S-C),n.ctrlpts[1]=n.ctrlpts[1]+R.y*(S-C)):(n.ctrlpts[0]=F[0]+R.x*S,n.ctrlpts[1]=F[1]+R.y*S)}P&&this.findEndpoints(e)}},at.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,a;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,a=.5,t.midX=Ge(t.allpts[r],t.allpts[r+2],t.allpts[r+4],a),t.midY=Ge(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],a))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var o=2;o+3<t.allpts.length;o+=2){var i=t.radii[o/2-1],u=t.isArcRadius[o/2-1];t.roundCorners.push(Di({x:t.allpts[o-2],y:t.allpts[o-1]},{x:t.allpts[o],y:t.allpts[o+1],radius:i},{x:t.allpts[o+2],y:t.allpts[o+3]},i,u))}}if(t.segpts.length%4===0){var l=t.segpts.length/2,s=l-2;t.midX=(t.segpts[s]+t.segpts[l])/2,t.midY=(t.segpts[s+1]+t.segpts[l+1])/2}else{var c=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[c],t.midY=t.segpts[c+1];else{var d={x:t.segpts[c],y:t.segpts[c+1]},h=t.roundCorners[c/2],p=[d.x-h.cx,d.y-h.cy],f=h.radius/Math.sqrt(Math.pow(p[0],2)+Math.pow(p[1],2));p=p.map(function(v){return v*f}),t.midX=h.cx+p[0],t.midY=h.cy+p[1],t.midVector=p}}}},at.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ne(t.startX)&&ne(t.startY)&&ne(t.endX)&&ne(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Pe("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},at.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,a=r.hasCompoundNodes(),o={map:new zt,get:function(k){var x=this.map.get(k[0]);return x!=null?x.get(k[1]):null},set:function(k,x){var C=this.map.get(k[0]);C==null&&(C=new zt,this.map.set(k[0],C)),C.set(k[1],x)}},i=[],u=[],l=0;l<e.length;l++){var s=e[l],c=s._private,d=s.pstyle("curve-style").value;if(!(s.removed()||!s.takesUpSpace())){if(d==="haystack"){u.push(s);continue}var h=d==="unbundled-bezier"||d.endsWith("segments")||d==="straight"||d==="straight-triangle"||d.endsWith("taxi"),p=d==="unbundled-bezier"||d==="bezier",f=c.source,v=c.target,m=f.poolIndex(),g=v.poolIndex(),y=[m,g].sort(),b=o.get(y);b==null&&(b={eles:[]},o.set(y,b),i.push(y)),b.eles.push(s),h&&(b.hasUnbundled=!0),p&&(b.hasBezier=!0)}}for(var w=function(k){var x=i[k],C=o.get(x),T=void 0;if(!C.hasUnbundled){var P=C.eles[0].parallelEdges().filter(function(G){return G.isBundledBezier()});qa(C.eles),P.forEach(function(G){return C.eles.push(G)}),C.eles.sort(function(G,X){return G.poolIndex()-X.poolIndex()})}var M=C.eles[0],D=M.source(),B=M.target();if(D.poolIndex()>B.poolIndex()){var _=D;D=B,B=_}var N=C.srcPos=D.position(),A=C.tgtPos=B.position(),z=C.srcW=D.outerWidth(),O=C.srcH=D.outerHeight(),R=C.tgtW=B.outerWidth(),Y=C.tgtH=B.outerHeight(),V=C.srcShape=n.nodeShapes[t.getNodeShape(D)],F=C.tgtShape=n.nodeShapes[t.getNodeShape(B)],W=C.srcCornerRadius=D.pstyle("corner-radius").value==="auto"?"auto":D.pstyle("corner-radius").pfValue,Q=C.tgtCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,re=C.tgtRs=B._private.rscratch,K=C.srcRs=D._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var $=0;$<C.eles.length;$++){var I=C.eles[$],H=I[0]._private.rscratch,U=I.pstyle("curve-style").value,te=U==="unbundled-bezier"||U.endsWith("segments")||U.endsWith("taxi"),ce=!D.same(I.source());if(!C.calculatedIntersection&&D!==B&&(C.hasBezier||C.hasUnbundled)){C.calculatedIntersection=!0;var me=V.intersectLine(N.x,N.y,z,O,A.x,A.y,0,W,K),Z=C.srcIntn=me,oe=F.intersectLine(A.x,A.y,R,Y,N.x,N.y,0,Q,re),ae=C.tgtIntn=oe,de=C.intersectionPts={x1:me[0],x2:oe[0],y1:me[1],y2:oe[1]},ve=C.posPts={x1:N.x,x2:A.x,y1:N.y,y2:A.y},be=oe[1]-me[1],xe=oe[0]-me[0],Me=Math.sqrt(xe*xe+be*be),we=C.vector={x:xe,y:be},Ce=C.vectorNorm={x:we.x/Me,y:we.y/Me},E={x:-Ce.y,y:Ce.x};C.nodesOverlap=!ne(Me)||F.checkPoint(me[0],me[1],0,R,Y,A.x,A.y,Q,re)||V.checkPoint(oe[0],oe[1],0,z,O,N.x,N.y,W,K),C.vectorNormInverse=E,T={nodesOverlap:C.nodesOverlap,dirCounts:C.dirCounts,calculatedIntersection:!0,hasBezier:C.hasBezier,hasUnbundled:C.hasUnbundled,eles:C.eles,srcPos:A,tgtPos:N,srcW:R,srcH:Y,tgtW:z,tgtH:O,srcIntn:ae,tgtIntn:Z,srcShape:F,tgtShape:V,posPts:{x1:ve.x2,y1:ve.y2,x2:ve.x1,y2:ve.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-we.x,y:-we.y},vectorNorm:{x:-Ce.x,y:-Ce.y},vectorNormInverse:{x:-E.x,y:-E.y}}}var L=ce?T:C;H.nodesOverlap=L.nodesOverlap,H.srcIntn=L.srcIntn,H.tgtIntn=L.tgtIntn,H.isRound=U.startsWith("round"),a&&(D.isParent()||D.isChild()||B.isParent()||B.isChild())&&(D.parents().anySame(B)||B.parents().anySame(D)||D.same(B)&&D.isParent())?t.findCompoundLoopPoints(I,L,$,te):D===B?t.findLoopPoints(I,L,$,te):U.endsWith("segments")?t.findSegmentsPoints(I,L):U.endsWith("taxi")?t.findTaxiPoints(I,L):U==="straight"||!te&&C.eles.length%2===1&&$===Math.floor(C.eles.length/2)?t.findStraightEdgePoints(I):t.findBezierPoints(I,L,$,te,ce),t.findEndpoints(I),t.tryToCorrectInvalidPoints(I,L),t.checkForInvalidEdgeWarning(I),t.storeAllpts(I),t.storeEdgeProjections(I),t.calculateArrowAngles(I),t.recalculateEdgeLabelProjections(I),t.calculateLabelAngles(I)}},S=0;S<i.length;S++)w(S);this.findHaystackPoints(u)}};function Vo(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}at.getSegmentPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="segments")return this.recalculateRenderedStyle(e),Vo(t.segpts)},at.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return this.recalculateRenderedStyle(e),Vo(t.ctrlpts)},at.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var cr={};cr.manualEndptToPx=function(e,t){var n=this,r=e.position(),a=e.outerWidth(),o=e.outerHeight(),i=e._private.rscratch;if(t.value.length===2){var u=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(u[0]=u[0]*a),t.units[1]==="%"&&(u[1]=u[1]*o),u[0]+=r.x,u[1]+=r.y,u}else{var l=t.pfValue[0];l=-Math.PI/2+l;var s=2*Math.max(a,o),c=[r.x+Math.cos(l)*s,r.y+Math.sin(l)*s];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,a,o,c[0],c[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,i)}},cr.findEndpoints=function(e){var t=this,n,r=e.source()[0],a=e.target()[0],o=r.position(),i=a.position(),u=e.pstyle("target-arrow-shape").value,l=e.pstyle("source-arrow-shape").value,s=e.pstyle("target-distance-from-node").pfValue,c=e.pstyle("source-distance-from-node").pfValue,d=r._private.rscratch,h=a._private.rscratch,p=e.pstyle("curve-style").value,f=e._private.rscratch,v=f.edgeType,m=p==="taxi",g=v==="self"||v==="compound",y=v==="bezier"||v==="multibezier"||g,b=v!=="bezier",w=v==="straight"||v==="segments",S=v==="segments",k=y||b||w,x=g||m,C=e.pstyle("source-endpoint"),T=x?"outside-to-node":C.value,P=r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,M=e.pstyle("target-endpoint"),D=x?"outside-to-node":M.value,B=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue;f.srcManEndpt=C,f.tgtManEndpt=M;var _,N,A,z;if(y){var O=[f.ctrlpts[0],f.ctrlpts[1]],R=b?[f.ctrlpts[f.ctrlpts.length-2],f.ctrlpts[f.ctrlpts.length-1]]:O;_=R,N=O}else if(w){var Y=S?f.segpts.slice(0,2):[i.x,i.y],V=S?f.segpts.slice(f.segpts.length-2):[o.x,o.y];_=V,N=Y}if(D==="inside-to-node")n=[i.x,i.y];else if(M.units)n=this.manualEndptToPx(a,M);else if(D==="outside-to-line")n=f.tgtIntn;else if(D==="outside-to-node"||D==="outside-to-node-or-label"?A=_:(D==="outside-to-line"||D==="outside-to-line-or-label")&&(A=[o.x,o.y]),n=t.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),A[0],A[1],0,B,h),D==="outside-to-node-or-label"||D==="outside-to-line-or-label"){var F=a._private.rscratch,W=F.labelWidth,Q=F.labelHeight,re=F.labelX,K=F.labelY,$=W/2,I=Q/2,H=a.pstyle("text-valign").value;H==="top"?K-=I:H==="bottom"&&(K+=I);var U=a.pstyle("text-halign").value;U==="left"?re-=$:U==="right"&&(re+=$);var te=hr(A[0],A[1],[re-$,K-I,re+$,K-I,re+$,K+I,re-$,K+I],i.x,i.y);if(te.length>0){var ce=o,me=ln(ce,Rn(n)),Z=ln(ce,Rn(te)),oe=me;if(Z<me&&(n=te,oe=Z),te.length>2){var ae=ln(ce,{x:te[2],y:te[3]});ae<oe&&(n=[te[2],te[3]])}}}var de=Br(n,_,t.arrowShapes[u].spacing(e)+s),ve=Br(n,_,t.arrowShapes[u].gap(e)+s);if(f.endX=ve[0],f.endY=ve[1],f.arrowEndX=de[0],f.arrowEndY=de[1],T==="inside-to-node")n=[o.x,o.y];else if(C.units)n=this.manualEndptToPx(r,C);else if(T==="outside-to-line")n=f.srcIntn;else if(T==="outside-to-node"||T==="outside-to-node-or-label"?z=N:(T==="outside-to-line"||T==="outside-to-line-or-label")&&(z=[i.x,i.y]),n=t.nodeShapes[this.getNodeShape(r)].intersectLine(o.x,o.y,r.outerWidth(),r.outerHeight(),z[0],z[1],0,P,d),T==="outside-to-node-or-label"||T==="outside-to-line-or-label"){var be=r._private.rscratch,xe=be.labelWidth,Me=be.labelHeight,we=be.labelX,Ce=be.labelY,E=xe/2,L=Me/2,G=r.pstyle("text-valign").value;G==="top"?Ce-=L:G==="bottom"&&(Ce+=L);var X=r.pstyle("text-halign").value;X==="left"?we-=E:X==="right"&&(we+=E);var j=hr(z[0],z[1],[we-E,Ce-L,we+E,Ce-L,we+E,Ce+L,we-E,Ce+L],o.x,o.y);if(j.length>0){var ee=i,q=ln(ee,Rn(n)),J=ln(ee,Rn(j)),pe=q;if(J<q&&(n=[j[0],j[1]],pe=J),j.length>2){var fe=ln(ee,{x:j[2],y:j[3]});fe<pe&&(n=[j[2],j[3]])}}}var le=Br(n,N,t.arrowShapes[l].spacing(e)+c),ye=Br(n,N,t.arrowShapes[l].gap(e)+c);f.startX=ye[0],f.startY=ye[1],f.arrowStartX=le[0],f.arrowStartY=le[1],k&&(!ne(f.startX)||!ne(f.startY)||!ne(f.endX)||!ne(f.endY)?f.badLine=!0:f.badLine=!1)},cr.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),t.edgeType)==="haystack"?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},cr.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),t.edgeType)==="haystack"?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var ii={};function Eg(e,t,n){for(var r=function(l,s,c,d){return Ge(l,s,c,d)},a=t._private,o=a.rstyle.bezierPts,i=0;i<e.bezierProjPcts.length;i++){var u=e.bezierProjPcts[i];o.push({x:r(n[0],n[2],n[4],u),y:r(n[1],n[3],n[5],u)})}}ii.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)Eg(this,e,n.allpts.slice(a,a+6))}else if(r==="segments")for(var o=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)o.push({x:n.allpts[a],y:n.allpts[a+1]});else if(r==="haystack"){var i=n.haystackPts;t.rstyle.haystackPts=[{x:i[0],y:i[1]},{x:i[2],y:i[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},ii.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var It={};It.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!tn(t)){var n,r,a=e._private,o=e.width(),i=e.height(),u=e.padding(),l=e.position(),s=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(s){case"left":n=l.x-o/2-u;break;case"right":n=l.x+o/2+u;break;default:n=l.x}switch(c){case"top":r=l.y-i/2-u;break;case"bottom":r=l.y+i/2+u;break;default:r=l.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var pl=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},fl=function(e,t){var n=t.x-e.x,r=t.y-e.y;return pl(n,r)},kg=function(e,t,n,r){var a=mr(0,r-.001,1),o=mr(0,r+.001,1),i=Fn(e,t,n,a),u=Fn(e,t,n,o);return fl(i,u)};It.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,o={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(o.mid||o.source||o.target){t={x:r.midX,y:r.midY};var i=function(c,d,h){Wt(n.rscratch,c,d,h),Wt(n.rstyle,c,d,h)};i("labelX",null,t.x),i("labelY",null,t.y);var u=pl(r.midDispX,r.midDispY);i("labelAutoAngle",null,u);var l=function c(){if(c.cache)return c.cache;for(var d=[],h=0;h+5<r.allpts.length;h+=4){var p={x:r.allpts[h],y:r.allpts[h+1]},f={x:r.allpts[h+2],y:r.allpts[h+3]},v={x:r.allpts[h+4],y:r.allpts[h+5]};d.push({p0:p,p1:f,p2:v,startDist:0,length:0,segments:[]})}var m=n.rstyle.bezierPts,g=a.bezierProjPcts.length;function y(x,C,T,P,M){var D=yn(C,T),B=x.segments[x.segments.length-1],_={p0:C,p1:T,t0:P,t1:M,startDist:B?B.startDist+B.length:0,length:D};x.segments.push(_),x.length+=D}for(var b=0;b<d.length;b++){var w=d[b],S=d[b-1];S&&(w.startDist=S.startDist+S.length),y(w,w.p0,m[b*g],0,a.bezierProjPcts[0]);for(var k=0;k<g-1;k++)y(w,m[b*g+k],m[b*g+k+1],a.bezierProjPcts[k],a.bezierProjPcts[k+1]);y(w,m[b*g+g-1],w.p2,a.bezierProjPcts[g-1],1)}return c.cache=d},s=function(c){var d,h=c==="source";if(o[c]){var p=e.pstyle(c+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var f=l(),v,m=0,g=0,y=0;y<f.length;y++){for(var b=f[h?y:f.length-1-y],w=0;w<b.segments.length;w++){var S=b.segments[h?w:b.segments.length-1-w],k=y===f.length-1&&w===b.segments.length-1;if(m=g,g+=S.length,g>=p||k){v={cp:b,segment:S};break}}if(v)break}var x=v.cp,C=v.segment,T=(p-m)/C.length,P=C.t1-C.t0,M=h?C.t0+P*T:C.t1-P*T;M=mr(0,M,1),t=Fn(x.p0,x.p1,x.p2,M),d=kg(x.p0,x.p1,x.p2,M);break}case"straight":case"segments":case"haystack":{for(var D=0,B,_,N,A,z=r.allpts.length,O=0;O+3<z&&(h?(N={x:r.allpts[O],y:r.allpts[O+1]},A={x:r.allpts[O+2],y:r.allpts[O+3]}):(N={x:r.allpts[z-2-O],y:r.allpts[z-1-O]},A={x:r.allpts[z-4-O],y:r.allpts[z-3-O]}),B=yn(N,A),_=D,D+=B,!(D>=p));O+=2);var R=p-_,Y=R/B;Y=mr(0,Y,1),t=Mc(N,A,Y),d=fl(N,A);break}}i("labelX",c,t.x),i("labelY",c,t.y),i("labelAutoAngle",c,d)}};s("source"),s("target"),this.applyLabelDimensions(e)}},It.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},It.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,i=e.pstyle("text-wrap").strValue,u=St(n.rscratch,"labelWrapCachedLines",t)||[],l=i!=="wrap"?1:Math.max(u.length,1),s=a.height/l,c=s*o,d=a.width,h=a.height+(l-1)*(o-1)*s;Wt(n.rstyle,"labelWidth",t,d),Wt(n.rscratch,"labelWidth",t,d),Wt(n.rstyle,"labelHeight",t,h),Wt(n.rscratch,"labelHeight",t,h),Wt(n.rscratch,"labelLineHeight",t,c)},It.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,i=function(F,W){return W?(Wt(n.rscratch,F,t,W),W):St(n.rscratch,F,t)};if(!a)return"";o=="none"||(o=="uppercase"?a=a.toUpperCase():o=="lowercase"&&(a=a.toLowerCase()));var u=e.pstyle("text-wrap").value;if(u==="wrap"){var l=i("labelKey");if(l!=null&&i("labelWrapKey")===l)return i("labelWrapCachedText");for(var s="",c=a.split(`
`),d=e.pstyle("text-max-width").pfValue,h=e.pstyle("text-overflow-wrap").value,p=h==="anywhere",f=[],v=/[\s\u200b]+|$/g,m=0;m<c.length;m++){var g=c[m],y=this.calculateLabelDimensions(e,g),b=y.width;if(p){var w=g.split("").join(s);g=w}if(b>d){var S=g.matchAll(v),k="",x=0,C=ns(S),T;try{for(C.s();!(T=C.n()).done;){var P=T.value,M=P[0],D=g.substring(x,P.index);x=P.index+M.length;var B=k.length===0?D:k+D+M,_=this.calculateLabelDimensions(e,B),N=_.width;N<=d?k+=D+M:(k&&f.push(k),k=D+M)}}catch(F){C.e(F)}finally{C.f()}k.match(/^[\s\u200b]+$/)||f.push(k)}else f.push(g)}i("labelWrapCachedLines",f),a=i("labelWrapCachedText",f.join(`
`)),i("labelWrapKey",l)}else if(u==="ellipsis"){var A=e.pstyle("text-max-width").pfValue,z="",O="…",R=!1;if(this.calculateLabelDimensions(e,a).width<A)return a;for(var Y=0;Y<a.length;Y++){var V=this.calculateLabelDimensions(e,z+a[Y]+O).width;if(V>A)break;z+=a[Y],Y===a.length-1&&(R=!0)}return R||(z+=O),z}return a},It.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},It.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,o=vn(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),u=i[o];if(u!=null)return u;var l=0,s=e.pstyle("font-style").strValue,c=e.pstyle("font-size").pfValue,d=e.pstyle("font-family").strValue,h=e.pstyle("font-weight").strValue,p=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!p){p=this.labelCalcCanvas=a.createElement("canvas"),f=this.labelCalcCanvasContext=p.getContext("2d");var v=p.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}f.font="".concat(s," ").concat(h," ").concat(c,"px ").concat(d);for(var m=0,g=0,y=t.split(`
`),b=0;b<y.length;b++){var w=y[b],S=f.measureText(w),k=Math.ceil(S.width),x=c;m=Math.max(k,m),g+=x}return m+=l,g+=l,i[o]={width:m,height:g}},It.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,a=e.isEdge(),o=t?t+"-":"",i=e.pstyle(o+"text-rotation"),u=i.strValue;return u==="none"?0:a&&u==="autorotate"?r.labelAutoAngle:u==="autorotate"?0:i.pfValue},It.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,a=r.rscratch;a.labelAngle=t.calculateLabelAngle(e),n&&(a.sourceLabelAngle=t.calculateLabelAngle(e,"source"),a.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var gl={},Fo=28,jo=!1;gl.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<Fo||e.height()<Fo))return jo||(Pe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),jo=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var na={};na.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(o){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(o),i)for(var u=0;u<o.length;u++){var l=o[u],s=l._private,c=s.rstyle;c.clean=!1,c.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(o){var i=o.target;r(i)}).on("style.* background.*",function(o){var i=o.target;r(i,!1)});var a=function(o){if(o){var i=n.onUpdateEleCalcsFns;t.cleanStyle();for(var u=0;u<t.length;u++){var l=t[u],s=l._private.rstyle;l.isNode()&&!s.cleanConnected&&(r(l.connectedEdges()),s.cleanConnected=!0)}if(i)for(var c=0;c<i.length;c++){var d=i[c];d(o,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},na.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},na.recalculateRenderedStyle=function(e,t){var n=function(b){return b._private.rstyle.cleanConnected},r=[],a=[];if(!this.destroyed){t===void 0&&(t=!0);for(var o=0;o<e.length;o++){var i=e[o],u=i._private,l=u.rstyle;i.isEdge()&&(!n(i.source())||!n(i.target()))&&(l.clean=!1),!(t&&l.clean||i.removed())&&i.pstyle("display").value!=="none"&&(u.group==="nodes"?a.push(i):r.push(i),l.clean=!0)}for(var s=0;s<a.length;s++){var c=a[s],d=c._private,h=d.rstyle,p=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=p.x,h.nodeY=p.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var v=r[f],m=v._private,g=m.rstyle,y=m.rscratch;g.srcX=y.arrowStartX,g.srcY=y.arrowStartY,g.tgtX=y.arrowEndX,g.tgtY=y.arrowEndY,g.midX=y.midX,g.midY=y.midY,g.labelAngle=y.labelAngle,g.sourceLabelAngle=y.sourceLabelAngle,g.targetLabelAngle=y.targetLabelAngle}}};var ra={};ra.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],a=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):a.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},ra.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},ra.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Js),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var vl={};[dn,ea,at,cr,ii,It,gl,na,ra].forEach(function(e){ge(vl,e)});var yl={};yl.getCachedImage=function(e,t,n){var r=this,a=r.imageCache=r.imageCache||{},o=a[e];if(o)return o.image.complete||o.image.addEventListener("load",n),o.image;o=a[e]=a[e]||{};var i=o.image=new Image;i.addEventListener("load",n),i.addEventListener("error",function(){i.error=!0});var u="data:",l=e.substring(0,u.length).toLowerCase()===u;return l||(t=t==="null"?null:t,i.crossOrigin=t),i.src=e,i};var An={};An.registerBinding=function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]),o=this.binder(e);return o.on.apply(o,a)},An.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||Kl(e);if(t.supportsPassiveEvents==null){var a=!1;try{var o=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,o)}catch{}t.supportsPassiveEvents=a}var i=function(u,l,s){var c=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(c[2]={capture:s??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:c}),(e.addEventListener||e.on).apply(e,c),this};return{on:i,addEventListener:i,addListener:i,bind:i}},An.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},An.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},An.load=function(){var e=this,t=e.cy.window(),n=function(E){return E.selected()},r=function(E,L,G,X){E==null&&(E=e.cy);for(var j=0;j<L.length;j++){var ee=L[j];E.emit({originalEvent:G,type:ee,position:X})}},a=function(E){return E.shiftKey||E.metaKey||E.ctrlKey},o=function(E,L){var G=!0;if(e.cy.hasCompoundNodes()&&E&&E.pannable())for(var X=0;L&&X<L.length;X++){var E=L[X];if(E.isNode()&&E.isParent()&&!E.pannable()){G=!1;break}}else G=!0;return G},i=function(E){E[0]._private.grabbed=!0},u=function(E){E[0]._private.grabbed=!1},l=function(E){E[0]._private.rscratch.inDragLayer=!0},s=function(E){E[0]._private.rscratch.inDragLayer=!1},c=function(E){E[0]._private.rscratch.isGrabTarget=!0},d=function(E){E[0]._private.rscratch.isGrabTarget=!1},h=function(E,L){var G=L.addToList,X=G.has(E);!X&&E.grabbable()&&!E.locked()&&(G.merge(E),i(E))},p=function(E,L){if(E.cy().hasCompoundNodes()&&!(L.inDragLayer==null&&L.addToList==null)){var G=E.descendants();L.inDragLayer&&(G.forEach(l),G.connectedEdges().forEach(l)),L.addToList&&h(G,L)}},f=function(E,L){L=L||{};var G=E.cy().hasCompoundNodes();L.inDragLayer&&(E.forEach(l),E.neighborhood().stdFilter(function(X){return!G||X.isEdge()}).forEach(l)),L.addToList&&E.forEach(function(X){h(X,L)}),p(E,L),g(E,{inDragLayer:L.inDragLayer}),e.updateCachedGrabbedEles()},v=f,m=function(E){E&&(e.getCachedZSortedEles().forEach(function(L){u(L),s(L),d(L)}),e.updateCachedGrabbedEles())},g=function(E,L){if(!(L.inDragLayer==null&&L.addToList==null)&&E.cy().hasCompoundNodes()){var G=E.ancestors().orphans();if(!G.same(E)){var X=G.descendants().spawnSelf().merge(G).unmerge(E).unmerge(E.descendants()),j=X.connectedEdges();L.inDragLayer&&(j.forEach(l),X.forEach(l)),L.addToList&&X.forEach(function(ee){h(ee,L)})}}},y=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";b?(e.removeObserver=new MutationObserver(function(E){for(var L=0;L<E.length;L++){var G=E[L],X=G.removedNodes;if(X)for(var j=0;j<X.length;j++){var ee=X[j];if(ee===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(E){e.destroy()});var S=va(function(){e.cy.resize()},100);b&&(e.styleObserver=new MutationObserver(S),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",S),w&&(e.resizeObserver=new ResizeObserver(S),e.resizeObserver.observe(e.container));var k=function(E,L){for(;E!=null;)L(E),E=E.parentNode},x=function(){e.invalidateContainerClientCoordsCache()};k(e.container,function(E){e.registerBinding(E,"transitionend",x),e.registerBinding(E,"animationend",x),e.registerBinding(E,"scroll",x)}),e.registerBinding(e.container,"contextmenu",function(E){E.preventDefault()});var C=function(){return e.selection[4]!==0},T=function(E){for(var L=e.findContainerClientCoords(),G=L[0],X=L[1],j=L[2],ee=L[3],q=E.touches?E.touches:[E],J=!1,pe=0;pe<q.length;pe++){var fe=q[pe];if(G<=fe.clientX&&fe.clientX<=G+j&&X<=fe.clientY&&fe.clientY<=X+ee){J=!0;break}}if(!J)return!1;for(var le=e.container,ye=E.target,se=ye.parentNode,ue=!1;se;){if(se===le){ue=!0;break}se=se.parentNode}return!!ue};e.registerBinding(e.container,"mousedown",function(E){if(T(E)&&!(e.hoverData.which===1&&E.which!==1)){E.preventDefault(),y(),e.hoverData.capture=!0,e.hoverData.which=E.which;var L=e.cy,G=[E.clientX,E.clientY],X=e.projectIntoViewport(G[0],G[1]),j=e.selection,ee=e.findNearestElements(X[0],X[1],!0,!1),q=ee[0],J=e.dragData.possibleDragElements;e.hoverData.mdownPos=X,e.hoverData.mdownGPos=G;var pe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var ue=e.hoverData.down;ue?ue.emit({originalEvent:E,type:"taphold",position:{x:X[0],y:X[1]}}):L.emit({originalEvent:E,type:"taphold",position:{x:X[0],y:X[1]}})}},e.tapholdDuration)};if(E.which==3){e.hoverData.cxtStarted=!0;var fe={originalEvent:E,type:"cxttapstart",position:{x:X[0],y:X[1]}};q?(q.activate(),q.emit(fe),e.hoverData.down=q):L.emit(fe),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(E.which==1){q&&q.activate();{if(q!=null&&e.nodeIsGrabbable(q)){var le=function(ue){return{originalEvent:E,type:ue,position:{x:X[0],y:X[1]}}},ye=function(ue){ue.emit(le("grab"))};if(c(q),!q.selected())J=e.dragData.possibleDragElements=L.collection(),v(q,{addToList:J}),q.emit(le("grabon")).emit(le("grab"));else{J=e.dragData.possibleDragElements=L.collection();var se=L.$(function(ue){return ue.isNode()&&ue.selected()&&e.nodeIsGrabbable(ue)});f(se,{addToList:J}),q.emit(le("grabon")),se.forEach(ye)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=q,e.hoverData.downs=ee,e.hoverData.downTime=new Date().getTime()}r(q,["mousedown","tapstart","vmousedown"],E,{x:X[0],y:X[1]}),q==null?(j[4]=1,e.data.bgActivePosistion={x:X[0],y:X[1]},e.redrawHint("select",!0),e.redraw()):q.pannable()&&(j[4]=1),pe()}j[0]=j[2]=X[0],j[1]=j[3]=X[1]}},!1),e.registerBinding(t,"mousemove",function(E){var L=e.hoverData.capture;if(!(!L&&!T(E))){var G=!1,X=e.cy,j=X.zoom(),ee=[E.clientX,E.clientY],q=e.projectIntoViewport(ee[0],ee[1]),J=e.hoverData.mdownPos,pe=e.hoverData.mdownGPos,fe=e.selection,le=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(le=e.findNearestElement(q[0],q[1],!0,!1));var ye=e.hoverData.last,se=e.hoverData.down,ue=[q[0]-fe[2],q[1]-fe[3]],Ve=e.dragData.possibleDragElements,Ae;if(pe){var st=ee[0]-pe[0],Ke=st*st,Fe=ee[1]-pe[1],ut=Fe*Fe,Ue=Ke+ut;e.hoverData.isOverThresholdDrag=Ae=Ue>=e.desktopTapThreshold2}var pt=a(E);Ae&&(e.hoverData.tapholdCancelled=!0);var bt=function(){var Mt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Mt.length===0?(Mt.push(ue[0]),Mt.push(ue[1])):(Mt[0]+=ue[0],Mt[1]+=ue[1])};G=!0,r(le,["mousemove","vmousemove","tapdrag"],E,{x:q[0],y:q[1]});var ct=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||X.emit({originalEvent:E,type:"boxstart",position:{x:q[0],y:q[1]}}),fe[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Ae){var xt={originalEvent:E,type:"cxtdrag",position:{x:q[0],y:q[1]}};se?se.emit(xt):X.emit(xt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||le!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:E,type:"cxtdragout",position:{x:q[0],y:q[1]}}),e.hoverData.cxtOver=le,le&&le.emit({originalEvent:E,type:"cxtdragover",position:{x:q[0],y:q[1]}}))}}else if(e.hoverData.dragging){if(G=!0,X.panningEnabled()&&X.userPanningEnabled()){var Pt;if(e.hoverData.justStartedPan){var Rt=e.hoverData.mdownPos;Pt={x:(q[0]-Rt[0])*j,y:(q[1]-Rt[1])*j},e.hoverData.justStartedPan=!1}else Pt={x:ue[0]*j,y:ue[1]*j};X.panBy(Pt),X.emit("dragpan"),e.hoverData.dragged=!0}q=e.projectIntoViewport(E.clientX,E.clientY)}else if(fe[4]==1&&(se==null||se.pannable())){if(Ae){if(!e.hoverData.dragging&&X.boxSelectionEnabled()&&(pt||!X.panningEnabled()||!X.userPanningEnabled()))ct();else if(!e.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var wt=o(se,e.hoverData.downs);wt&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,fe[4]=0,e.data.bgActivePosistion=Rn(J),e.redrawHint("select",!0),e.redraw())}se&&se.pannable()&&se.active()&&se.unactivate()}}else{if(se&&se.pannable()&&se.active()&&se.unactivate(),(!se||!se.grabbed())&&le!=ye&&(ye&&r(ye,["mouseout","tapdragout"],E,{x:q[0],y:q[1]}),le&&r(le,["mouseover","tapdragover"],E,{x:q[0],y:q[1]}),e.hoverData.last=le),se)if(Ae){if(X.boxSelectionEnabled()&&pt)se&&se.grabbed()&&(m(Ve),se.emit("freeon"),Ve.emit("free"),e.dragData.didDrag&&(se.emit("dragfreeon"),Ve.emit("dragfree"))),ct();else if(se&&se.grabbed()&&e.nodeIsDraggable(se)){var je=!e.dragData.didDrag;je&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(Ve,{inDragLayer:!0});var He={x:0,y:0};if(ne(ue[0])&&ne(ue[1])&&(He.x+=ue[0],He.y+=ue[1],je)){var tt=e.hoverData.dragDelta;tt&&ne(tt[0])&&ne(tt[1])&&(He.x+=tt[0],He.y+=tt[1])}e.hoverData.draggingEles=!0,Ve.silentShift(He).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else bt();G=!0}if(fe[2]=q[0],fe[3]=q[1],G)return E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault(),!1}},!1);var P,M,D;e.registerBinding(t,"mouseup",function(E){if(!(e.hoverData.which===1&&E.which!==1&&e.hoverData.capture)){var L=e.hoverData.capture;if(L){e.hoverData.capture=!1;var G=e.cy,X=e.projectIntoViewport(E.clientX,E.clientY),j=e.selection,ee=e.findNearestElement(X[0],X[1],!0,!1),q=e.dragData.possibleDragElements,J=e.hoverData.down,pe=a(E);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,J&&J.unactivate(),e.hoverData.which===3){var fe={originalEvent:E,type:"cxttapend",position:{x:X[0],y:X[1]}};if(J?J.emit(fe):G.emit(fe),!e.hoverData.cxtDragged){var le={originalEvent:E,type:"cxttap",position:{x:X[0],y:X[1]}};J?J.emit(le):G.emit(le)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(ee,["mouseup","tapend","vmouseup"],E,{x:X[0],y:X[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(r(J,["click","tap","vclick"],E,{x:X[0],y:X[1]}),M=!1,E.timeStamp-D<=G.multiClickDebounceTime()?(P&&clearTimeout(P),M=!0,D=null,r(J,["dblclick","dbltap","vdblclick"],E,{x:X[0],y:X[1]})):(P=setTimeout(function(){M||r(J,["oneclick","onetap","voneclick"],E,{x:X[0],y:X[1]})},G.multiClickDebounceTime()),D=E.timeStamp)),J==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(E)&&(G.$(n).unselect(["tapunselect"]),q.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=q=G.collection()),ee==J&&!e.dragData.didDrag&&!e.hoverData.selecting&&ee!=null&&ee._private.selectable&&(e.hoverData.dragging||(G.selectionType()==="additive"||pe?ee.selected()?ee.unselect(["tapunselect"]):ee.select(["tapselect"]):pe||(G.$(n).unmerge(ee).unselect(["tapunselect"]),ee.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var ye=G.collection(e.getAllInBox(j[0],j[1],j[2],j[3]));e.redrawHint("select",!0),ye.length>0&&e.redrawHint("eles",!0),G.emit({type:"boxend",originalEvent:E,position:{x:X[0],y:X[1]}});var se=function(Ve){return Ve.selectable()&&!Ve.selected()};G.selectionType()==="additive"||pe||G.$(n).unmerge(ye).unselect(),ye.emit("box").stdFilter(se).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!j[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ue=J&&J.grabbed();m(q),ue&&(J.emit("freeon"),q.emit("free"),e.dragData.didDrag&&(J.emit("dragfreeon"),q.emit("dragfree")))}}j[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var B=function(E){if(!e.scrollingPage){var L=e.cy,G=L.zoom(),X=L.pan(),j=e.projectIntoViewport(E.clientX,E.clientY),ee=[j[0]*G+X.x,j[1]*G+X.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){E.preventDefault();return}if(L.panningEnabled()&&L.userPanningEnabled()&&L.zoomingEnabled()&&L.userZoomingEnabled()){E.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var q;E.deltaY!=null?q=E.deltaY/-250:E.wheelDeltaY!=null?q=E.wheelDeltaY/1e3:q=E.wheelDelta/1e3,q=q*e.wheelSensitivity;var J=E.deltaMode===1;J&&(q*=33);var pe=L.zoom()*Math.pow(10,q);E.type==="gesturechange"&&(pe=e.gestureStartZoom*E.scale),L.zoom({level:pe,renderedPosition:{x:ee[0],y:ee[1]}}),L.emit(E.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",B,!0),e.registerBinding(t,"scroll",function(E){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(E){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||E.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(E){e.hasTouchStarted||B(E)},!0),e.registerBinding(e.container,"mouseout",function(E){var L=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseout",position:{x:L[0],y:L[1]}})},!1),e.registerBinding(e.container,"mouseover",function(E){var L=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseover",position:{x:L[0],y:L[1]}})},!1);var _,N,A,z,O,R,Y,V,F,W,Q,re,K,$=function(E,L,G,X){return Math.sqrt((G-E)*(G-E)+(X-L)*(X-L))},I=function(E,L,G,X){return(G-E)*(G-E)+(X-L)*(X-L)},H;e.registerBinding(e.container,"touchstart",H=function(E){if(e.hasTouchStarted=!0,!!T(E)){y(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var L=e.cy,G=e.touchData.now,X=e.touchData.earlier;if(E.touches[0]){var j=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);G[0]=j[0],G[1]=j[1]}if(E.touches[1]){var j=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);G[2]=j[0],G[3]=j[1]}if(E.touches[2]){var j=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);G[4]=j[0],G[5]=j[1]}if(E.touches[1]){e.touchData.singleTouchMoved=!0,m(e.dragData.touchDragEles);var ee=e.findContainerClientCoords();F=ee[0],W=ee[1],Q=ee[2],re=ee[3],_=E.touches[0].clientX-F,N=E.touches[0].clientY-W,A=E.touches[1].clientX-F,z=E.touches[1].clientY-W,K=0<=_&&_<=Q&&0<=A&&A<=Q&&0<=N&&N<=re&&0<=z&&z<=re;var q=L.pan(),J=L.zoom();O=$(_,N,A,z),R=I(_,N,A,z),Y=[(_+A)/2,(N+z)/2],V=[(Y[0]-q.x)/J,(Y[1]-q.y)/J];var pe=200,fe=pe*pe;if(R<fe&&!E.touches[2]){var le=e.findNearestElement(G[0],G[1],!0,!0),ye=e.findNearestElement(G[2],G[3],!0,!0);le&&le.isNode()?(le.activate().emit({originalEvent:E,type:"cxttapstart",position:{x:G[0],y:G[1]}}),e.touchData.start=le):ye&&ye.isNode()?(ye.activate().emit({originalEvent:E,type:"cxttapstart",position:{x:G[0],y:G[1]}}),e.touchData.start=ye):L.emit({originalEvent:E,type:"cxttapstart",position:{x:G[0],y:G[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(E.touches[2])L.boxSelectionEnabled()&&E.preventDefault();else if(!E.touches[1]&&E.touches[0]){var se=e.findNearestElements(G[0],G[1],!0,!0),ue=se[0];if(ue!=null&&(ue.activate(),e.touchData.start=ue,e.touchData.starts=se,e.nodeIsGrabbable(ue))){var Ve=e.dragData.touchDragEles=L.collection(),Ae=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ue.selected()?(Ae=L.$(function(Ue){return Ue.selected()&&e.nodeIsGrabbable(Ue)}),f(Ae,{addToList:Ve})):v(ue,{addToList:Ve}),c(ue);var st=function(Ue){return{originalEvent:E,type:Ue,position:{x:G[0],y:G[1]}}};ue.emit(st("grabon")),Ae?Ae.forEach(function(Ue){Ue.emit(st("grab"))}):ue.emit(st("grab"))}r(ue,["touchstart","tapstart","vmousedown"],E,{x:G[0],y:G[1]}),ue==null&&(e.data.bgActivePosistion={x:j[0],y:j[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&r(e.touchData.start,["taphold"],E,{x:G[0],y:G[1]})},e.tapholdDuration)}if(E.touches.length>=1){for(var Ke=e.touchData.startPosition=[null,null,null,null,null,null],Fe=0;Fe<G.length;Fe++)Ke[Fe]=X[Fe]=G[Fe];var ut=E.touches[0];e.touchData.startGPosition=[ut.clientX,ut.clientY]}}},!1);var U;e.registerBinding(t,"touchmove",U=function(E){var L=e.touchData.capture;if(!(!L&&!T(E))){var G=e.selection,X=e.cy,j=e.touchData.now,ee=e.touchData.earlier,q=X.zoom();if(E.touches[0]){var J=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);j[0]=J[0],j[1]=J[1]}if(E.touches[1]){var J=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);j[2]=J[0],j[3]=J[1]}if(E.touches[2]){var J=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);j[4]=J[0],j[5]=J[1]}var pe=e.touchData.startGPosition,fe;if(L&&E.touches[0]&&pe){for(var le=[],ye=0;ye<j.length;ye++)le[ye]=j[ye]-ee[ye];var se=E.touches[0].clientX-pe[0],ue=se*se,Ve=E.touches[0].clientY-pe[1],Ae=Ve*Ve,st=ue+Ae;fe=st>=e.touchTapThreshold2}if(L&&e.touchData.cxt){E.preventDefault();var Ke=E.touches[0].clientX-F,Fe=E.touches[0].clientY-W,ut=E.touches[1].clientX-F,Ue=E.touches[1].clientY-W,pt=I(Ke,Fe,ut,Ue),bt=pt/R,ct=150,xt=ct*ct,Pt=1.5,Rt=Pt*Pt;if(bt>=Rt||pt>=xt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var wt={originalEvent:E,type:"cxttapend",position:{x:j[0],y:j[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(wt),e.touchData.start=null):X.emit(wt)}}if(L&&e.touchData.cxt){var wt={originalEvent:E,type:"cxtdrag",position:{x:j[0],y:j[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(wt):X.emit(wt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var je=e.findNearestElement(j[0],j[1],!0,!0);(!e.touchData.cxtOver||je!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:E,type:"cxtdragout",position:{x:j[0],y:j[1]}}),e.touchData.cxtOver=je,je&&je.emit({originalEvent:E,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}else if(L&&E.touches[2]&&X.boxSelectionEnabled())E.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||X.emit({originalEvent:E,type:"boxstart",position:{x:j[0],y:j[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,G[4]=1,!G||G.length===0||G[0]===void 0?(G[0]=(j[0]+j[2]+j[4])/3,G[1]=(j[1]+j[3]+j[5])/3,G[2]=(j[0]+j[2]+j[4])/3+1,G[3]=(j[1]+j[3]+j[5])/3+1):(G[2]=(j[0]+j[2]+j[4])/3,G[3]=(j[1]+j[3]+j[5])/3),e.redrawHint("select",!0),e.redraw();else if(L&&E.touches[1]&&!e.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){E.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var He=e.dragData.touchDragEles;if(He){e.redrawHint("drag",!0);for(var tt=0;tt<He.length;tt++){var Mt=He[tt]._private;Mt.grabbed=!1,Mt.rscratch.inDragLayer=!1}}var _r=e.touchData.start,Ke=E.touches[0].clientX-F,Fe=E.touches[0].clientY-W,ut=E.touches[1].clientX-F,Ue=E.touches[1].clientY-W,Si=$(Ke,Fe,ut,Ue),Tl=Si/O;if(K){var Bl=Ke-_,Ol=Fe-N,Il=ut-A,Nl=Ue-z,Al=(Bl+Il)/2,zl=(Ol+Nl)/2,Hn=X.zoom(),Da=Hn*Tl,Pr=X.pan(),_i=V[0]*Hn+Pr.x,Pi=V[1]*Hn+Pr.y,Rl={x:-Da/Hn*(_i-Pr.x-Al)+_i,y:-Da/Hn*(Pi-Pr.y-zl)+Pi};if(_r&&_r.active()){var He=e.dragData.touchDragEles;m(He),e.redrawHint("drag",!0),e.redrawHint("eles",!0),_r.unactivate().emit("freeon"),He.emit("free"),e.dragData.didDrag&&(_r.emit("dragfreeon"),He.emit("dragfree"))}X.viewport({zoom:Da,pan:Rl,cancelOnFailedZoom:!0}),X.emit("pinchzoom"),O=Si,_=Ke,N=Fe,A=ut,z=Ue,e.pinching=!0}if(E.touches[0]){var J=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);j[0]=J[0],j[1]=J[1]}if(E.touches[1]){var J=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);j[2]=J[0],j[3]=J[1]}if(E.touches[2]){var J=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);j[4]=J[0],j[5]=J[1]}}else if(E.touches[0]&&!e.touchData.didSelect){var Et=e.touchData.start,Sa=e.touchData.last,je;if(!e.hoverData.draggingEles&&!e.swipePanning&&(je=e.findNearestElement(j[0],j[1],!0,!0)),L&&Et!=null&&E.preventDefault(),L&&Et!=null&&e.nodeIsDraggable(Et))if(fe){var He=e.dragData.touchDragEles,Mi=!e.dragData.didDrag;Mi&&f(He,{inDragLayer:!0}),e.dragData.didDrag=!0;var Gn={x:0,y:0};if(ne(le[0])&&ne(le[1])&&(Gn.x+=le[0],Gn.y+=le[1],Mi)){e.redrawHint("eles",!0);var kt=e.touchData.dragDelta;kt&&ne(kt[0])&&ne(kt[1])&&(Gn.x+=kt[0],Gn.y+=kt[1])}e.hoverData.draggingEles=!0,He.silentShift(Gn).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==ee[0]&&e.touchData.startPosition[1]==ee[1]&&e.redrawHint("eles",!0),e.redraw()}else{var kt=e.touchData.dragDelta=e.touchData.dragDelta||[];kt.length===0?(kt.push(le[0]),kt.push(le[1])):(kt[0]+=le[0],kt[1]+=le[1])}if(r(Et||je,["touchmove","tapdrag","vmousemove"],E,{x:j[0],y:j[1]}),(!Et||!Et.grabbed())&&je!=Sa&&(Sa&&Sa.emit({originalEvent:E,type:"tapdragout",position:{x:j[0],y:j[1]}}),je&&je.emit({originalEvent:E,type:"tapdragover",position:{x:j[0],y:j[1]}})),e.touchData.last=je,L)for(var tt=0;tt<j.length;tt++)j[tt]&&e.touchData.startPosition[tt]&&fe&&(e.touchData.singleTouchMoved=!0);if(L&&(Et==null||Et.pannable())&&X.panningEnabled()&&X.userPanningEnabled()){var Ll=o(Et,e.touchData.starts);Ll&&(E.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Rn(e.touchData.startPosition)),e.swipePanning?(X.panBy({x:le[0]*q,y:le[1]*q}),X.emit("dragpan")):fe&&(e.swipePanning=!0,X.panBy({x:se*q,y:Ve*q}),X.emit("dragpan"),Et&&(Et.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var J=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);j[0]=J[0],j[1]=J[1]}}for(var ye=0;ye<j.length;ye++)ee[ye]=j[ye];L&&E.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var te;e.registerBinding(t,"touchcancel",te=function(E){var L=e.touchData.start;e.touchData.capture=!1,L&&L.unactivate()});var ce,me,Z,oe;if(e.registerBinding(t,"touchend",ce=function(E){var L=e.touchData.start,G=e.touchData.capture;if(G)E.touches.length===0&&(e.touchData.capture=!1),E.preventDefault();else return;var X=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var j=e.cy,ee=j.zoom(),q=e.touchData.now,J=e.touchData.earlier;if(E.touches[0]){var pe=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);q[0]=pe[0],q[1]=pe[1]}if(E.touches[1]){var pe=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);q[2]=pe[0],q[3]=pe[1]}if(E.touches[2]){var pe=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);q[4]=pe[0],q[5]=pe[1]}L&&L.unactivate();var fe;if(e.touchData.cxt){if(fe={originalEvent:E,type:"cxttapend",position:{x:q[0],y:q[1]}},L?L.emit(fe):j.emit(fe),!e.touchData.cxtDragged){var le={originalEvent:E,type:"cxttap",position:{x:q[0],y:q[1]}};L?L.emit(le):j.emit(le)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!E.touches[2]&&j.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var ye=j.collection(e.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,e.redrawHint("select",!0),j.emit({type:"boxend",originalEvent:E,position:{x:q[0],y:q[1]}});var se=function(ct){return ct.selectable()&&!ct.selected()};ye.emit("box").stdFilter(se).select().emit("boxselect"),ye.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(L?.unactivate(),E.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!E.touches[1]&&!E.touches[0]&&!E.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ue=e.dragData.touchDragEles;if(L!=null){var Ve=L._private.grabbed;m(ue),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Ve&&(L.emit("freeon"),ue.emit("free"),e.dragData.didDrag&&(L.emit("dragfreeon"),ue.emit("dragfree"))),r(L,["touchend","tapend","vmouseup","tapdragout"],E,{x:q[0],y:q[1]}),L.unactivate(),e.touchData.start=null}else{var Ae=e.findNearestElement(q[0],q[1],!0,!0);r(Ae,["touchend","tapend","vmouseup","tapdragout"],E,{x:q[0],y:q[1]})}var st=e.touchData.startPosition[0]-q[0],Ke=st*st,Fe=e.touchData.startPosition[1]-q[1],ut=Fe*Fe,Ue=Ke+ut,pt=Ue*ee*ee;e.touchData.singleTouchMoved||(L||j.$(":selected").unselect(["tapunselect"]),r(L,["tap","vclick"],E,{x:q[0],y:q[1]}),me=!1,E.timeStamp-oe<=j.multiClickDebounceTime()?(Z&&clearTimeout(Z),me=!0,oe=null,r(L,["dbltap","vdblclick"],E,{x:q[0],y:q[1]})):(Z=setTimeout(function(){me||r(L,["onetap","voneclick"],E,{x:q[0],y:q[1]})},j.multiClickDebounceTime()),oe=E.timeStamp)),L!=null&&!e.dragData.didDrag&&L._private.selectable&&pt<e.touchTapThreshold2&&!e.pinching&&(j.selectionType()==="single"?(j.$(n).unmerge(L).unselect(["tapunselect"]),L.select(["tapselect"])):L.selected()?L.unselect(["tapunselect"]):L.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var bt=0;bt<q.length;bt++)J[bt]=q[bt];e.dragData.didDrag=!1,E.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),E.touches.length<2&&(E.touches.length===1&&(e.touchData.startGPosition=[E.touches[0].clientX,E.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var ae=[],de=function(E){return{clientX:E.clientX,clientY:E.clientY,force:1,identifier:E.pointerId,pageX:E.pageX,pageY:E.pageY,radiusX:E.width/2,radiusY:E.height/2,screenX:E.screenX,screenY:E.screenY,target:E.target}},ve=function(E){return{event:E,touch:de(E)}},be=function(E){ae.push(ve(E))},xe=function(E){for(var L=0;L<ae.length;L++){var G=ae[L];if(G.event.pointerId===E.pointerId){ae.splice(L,1);return}}},Me=function(E){var L=ae.filter(function(G){return G.event.pointerId===E.pointerId})[0];L.event=E,L.touch=de(E)},we=function(E){E.touches=ae.map(function(L){return L.touch})},Ce=function(E){return E.pointerType==="mouse"||E.pointerType===4};e.registerBinding(e.container,"pointerdown",function(E){Ce(E)||(E.preventDefault(),be(E),we(E),H(E))}),e.registerBinding(e.container,"pointerup",function(E){Ce(E)||(xe(E),we(E),ce(E))}),e.registerBinding(e.container,"pointercancel",function(E){Ce(E)||(xe(E),we(E),te(E))}),e.registerBinding(e.container,"pointermove",function(E){Ce(E)||(E.preventDefault(),Me(E),we(E),U(E))})}};var Ft={};Ft.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,a,o,i,u){this.renderer.nodeShapeImpl("polygon",n,r,a,o,i,this.points)},intersectLine:function(n,r,a,o,i,u,l,s){return hr(i,u,this.points,n,r,a/2,o/2,l)},checkPoint:function(n,r,a,o,i,u,l,s){return Lt(n,r,this.points,u,l,o,i,[0,-1],a)}}},Ft.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,o){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,o,i,u){return qc(a,o,e,t,n/2+i,r/2+i)},checkPoint:function(e,t,n,r,a,o,i,u){return rn(e,t,r,a,o,i,n)}}},Ft.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(n,r,a,o,i,u,l){if(u[l]!==void 0&&u[l+"-cx"]===n&&u[l+"-cy"]===r)return u[l];u[l]=new Array(t.length/2),u[l+"-cx"]=n,u[l+"-cy"]=r;var s=a/2,c=o/2;i=i==="auto"?Cs(a,o):i;for(var d=new Array(t.length/2),h=0;h<t.length/2;h++)d[h]={x:n+s*t[h*2],y:r+c*t[h*2+1]};var p,f,v,m,g=d.length;for(f=d[g-1],p=0;p<g;p++)v=d[p%g],m=d[(p+1)%g],u[l][p]=Di(f,v,m,i),f=v,v=m;return u[l]},draw:function(n,r,a,o,i,u,l){this.renderer.nodeShapeImpl("round-polygon",n,r,a,o,i,this.points,this.getOrCreateCorners(r,a,o,i,u,l,"drawCorners"))},intersectLine:function(n,r,a,o,i,u,l,s,c){return Yc(i,u,this.points,n,r,a,o,l,this.getOrCreateCorners(n,r,a,o,s,c,"corners"))},checkPoint:function(n,r,a,o,i,u,l,s,c){return jc(n,r,this.points,u,l,o,i,this.getOrCreateCorners(u,l,o,i,s,c,"corners"))}}},Ft.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:lt(4,0),draw:function(e,t,n,r,a,o){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,o)},intersectLine:function(e,t,n,r,a,o,i,u){return qi(a,o,e,t,n,r,i,u)},checkPoint:function(e,t,n,r,a,o,i,u){var l=r/2,s=a/2;u=u==="auto"?mn(r,a):u,u=Math.min(l,s,u);var c=u*2;return!!(Lt(e,t,this.points,o,i,r,a-c,[0,-1],n)||Lt(e,t,this.points,o,i,r-c,a,[0,-1],n)||rn(e,t,c,c,o-l+u,i-s+u,n)||rn(e,t,c,c,o+l-u,i-s+u,n)||rn(e,t,c,c,o+l-u,i+s-u,n)||rn(e,t,c,c,o-l+u,i+s-u,n))}}},Ft.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:mi(),points:lt(4,0),draw:function(e,t,n,r,a,o){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,o)},generateCutTrianglePts:function(e,t,n,r,a){var o=a==="auto"?this.cornerLength:a,i=t/2,u=e/2,l=n-u,s=n+u,c=r-i,d=r+i;return{topLeft:[l,c+o,l+o,c,l+o,c+o],topRight:[s-o,c,s,c+o,s-o,c+o],bottomRight:[s,d-o,s-o,d,s-o,d-o],bottomLeft:[l+o,d,l,d-o,l+o,d-o]}},intersectLine:function(e,t,n,r,a,o,i,u){var l=this.generateCutTrianglePts(n+2*i,r+2*i,e,t,u),s=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return hr(a,o,s,e,t)},checkPoint:function(e,t,n,r,a,o,i,u){var l=u==="auto"?this.cornerLength:u;if(Lt(e,t,this.points,o,i,r,a-2*l,[0,-1],n)||Lt(e,t,this.points,o,i,r-2*l,a,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,a,o,i);return dt(e,t,s.topLeft)||dt(e,t,s.topRight)||dt(e,t,s.bottomRight)||dt(e,t,s.bottomLeft)}}},Ft.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:lt(4,0),draw:function(e,t,n,r,a,o){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,o,i,u){var l=.15,s=.5,c=.85,d=this.generateBarrelBezierPts(n+2*i,r+2*i,e,t),h=function(f){var v=Fn({x:f[0],y:f[1]},{x:f[2],y:f[3]},{x:f[4],y:f[5]},l),m=Fn({x:f[0],y:f[1]},{x:f[2],y:f[3]},{x:f[4],y:f[5]},s),g=Fn({x:f[0],y:f[1]},{x:f[2],y:f[3]},{x:f[4],y:f[5]},c);return[f[0],f[1],v.x,v.y,m.x,m.y,g.x,g.y,f[4],f[5]]},p=[].concat(h(d.topLeft),h(d.topRight),h(d.bottomRight),h(d.bottomLeft));return hr(a,o,p,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,o=e/2,i=n-o,u=n+o,l=r-a,s=r+a,c=Xa(e,t),d=c.heightOffset,h=c.widthOffset,p=c.ctrlPtOffsetPct*e,f={topLeft:[i,l+d,i+p,l,i+h,l],topRight:[u-h,l,u-p,l,u,l+d],bottomRight:[u,s-d,u-p,s,u-h,s],bottomLeft:[i+h,s,i+p,s,i,s-d]};return f.topLeft.isTop=!0,f.topRight.isTop=!0,f.bottomLeft.isBottom=!0,f.bottomRight.isBottom=!0,f},checkPoint:function(e,t,n,r,a,o,i,u){var l=Xa(r,a),s=l.heightOffset,c=l.widthOffset;if(Lt(e,t,this.points,o,i,r,a-2*s,[0,-1],n)||Lt(e,t,this.points,o,i,r-2*c,a,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,a,o,i),h=function(k,x,C){var T=C[4],P=C[2],M=C[0],D=C[5],B=C[1],_=Math.min(T,M),N=Math.max(T,M),A=Math.min(D,B),z=Math.max(D,B);if(_<=k&&k<=N&&A<=x&&x<=z){var O=Xc(T,P,M),R=Rc(O[0],O[1],O[2],k),Y=R.filter(function(V){return 0<=V&&V<=1});if(Y.length>0)return Y[0]}return null},p=Object.keys(d),f=0;f<p.length;f++){var v=p[f],m=d[v],g=h(e,t,m);if(g!=null){var y=m[5],b=m[3],w=m[1],S=Ge(y,b,w,g);if(m.isTop&&S<=t||m.isBottom&&t<=S)return!0}}return!1}}},Ft.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:lt(4,0),draw:function(e,t,n,r,a,o){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,o)},intersectLine:function(e,t,n,r,a,o,i,u){var l=e-(n/2+i),s=t-(r/2+i),c=s,d=e+(n/2+i),h=Qt(a,o,e,t,l,s,d,c,!1);return h.length>0?h:qi(a,o,e,t,n,r,i,u)},checkPoint:function(e,t,n,r,a,o,i,u){u=u==="auto"?mn(r,a):u;var l=2*u;if(Lt(e,t,this.points,o,i,r,a-l,[0,-1],n)||Lt(e,t,this.points,o,i,r-l,a,[0,-1],n))return!0;var s=r/2+2*n,c=a/2+2*n,d=[o-s,i-c,o-s,i,o+s,i,o+s,i-c];return!!(dt(e,t,d)||rn(e,t,l,l,o+r/2-u,i+a/2-u,n)||rn(e,t,l,l,o-r/2+u,i+a/2-u,n))}}},Ft.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",lt(3,0)),this.generateRoundPolygon("round-triangle",lt(3,0)),this.generatePolygon("rectangle",lt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",lt(5,0)),this.generateRoundPolygon("round-pentagon",lt(5,0)),this.generatePolygon("hexagon",lt(6,0)),this.generateRoundPolygon("round-hexagon",lt(6,0)),this.generatePolygon("heptagon",lt(7,0)),this.generateRoundPolygon("round-heptagon",lt(7,0)),this.generatePolygon("octagon",lt(8,0)),this.generateRoundPolygon("round-octagon",lt(8,0));var r=new Array(20);{var a=Ya(5,0),o=Ya(5,Math.PI/5),i=.5*(3-Math.sqrt(5));i*=1.57;for(var u=0;u<o.length/2;u++)o[u*2]*=i,o[u*2+1]*=i;for(var u=0;u<20/4;u++)r[u*4]=a[u*2],r[u*4+1]=a[u*2+1],r[u*4+2]=o[u*2],r[u*4+3]=o[u*2+1]}r=ks(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}e.makePolygon=function(s){var c=s.join("$"),d="polygon-"+c,h;return(h=this[d])?h:t.generatePolygon(d,s)}};var fr={};fr.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},fr.redraw=function(e){e=e||bs();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},fr.beforeRender=function(e,t){if(!this.destroyed){t==null&&Le("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,a){return a.priority-r.priority})}};var qo=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};fr.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function r(a){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){qo(e,!0,a);var o=Yt();e.render(e.renderOptions);var i=e.lastDrawTime=Yt();e.averageRedrawTime===void 0&&(e.averageRedrawTime=i-o),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var u=i-o;e.redrawTotalTime+=u,e.lastRedrawTime=u,e.averageRedrawTime=e.averageRedrawTime/2+u/2,e.requestedFrame=!1}else qo(e,!1,a);e.skipFrame=!1,ia(r)}};ia(n)}};var Cg=function(e){this.init(e)},ml=Cg,Dn=ml.prototype;Dn.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Dn.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,o=a.head,i="__________cytoscape_stylesheet",u="__________cytoscape_container",l=a.getElementById(i)!=null;if(n.className.indexOf(u)<0&&(n.className=(n.className||"")+" "+u),!l){var s=a.createElement("style");s.id=i,s.textContent="."+u+" { position: relative; }",o.insertBefore(s,o.children[0])}var c=r.getComputedStyle(n),d=c.getPropertyValue("position");d==="static"&&Pe("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ne(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Dn.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},Dn.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,a=r.target;(a.off||a.removeEventListener).apply(a,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},Dn.isHeadless=function(){return!1},[ei,vl,yl,An,Ft,fr].forEach(function(e){ge(Dn,e)});var La=1e3/60,bl={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=va(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=function(i,u){var l=Yt(),s=n.averageRedrawTime,c=n.lastRedrawTime,d=[],h=n.cy.extent(),p=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var f=Yt(),v=f-l,m=f-u;if(c<La){var g=La-(i?s:0);if(m>=e.deqFastCost*g)break}else if(i){if(v>=e.deqCost*c||v>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*La)break;var y=e.deq(t,p,h);if(y.length>0)for(var b=0;b<y.length;b++)d.push(y[b]);else break}d.length>0&&(e.onDeqd(t,d),!i&&e.shouldRedraw(t,d,p,h)&&r())},o=e.priority||gi;n.beforeRender(a,o(t))}}}},Dg=(function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oa;ci(this,e),this.idsByKey=new zt,this.keyForId=new zt,this.cachesByLvl=new zt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return di(e,[{key:"getIdsFor",value:function(t){t==null&&Le("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new Xn,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);return r!==a}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new zt,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),a=this.getCache(r,n);return a}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e})(),Yo=25,jr=50,qr=-4,Va=3,Sg=7.99,_g=8,Pg=1024,Mg=1024,Tg=1024,Bg=.2,Og=.8,Ig=10,Ng=.15,Ag=.1,zg=.9,Rg=.9,Lg=100,Vg=1,Sn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Fg=et({getKey:null,doesEleInvalidateKey:oa,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:vs,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),dr=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Fg(t);ge(n,r),n.lookup=new Dg(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},qe=dr.prototype;qe.reasons=Sn,qe.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},qe.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},qe.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Sr(function(n,r){return r.reqs-n.reqs});return t},qe.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},qe.getElement=function(e,t,n,r,a){var o=this,i=this.renderer,u=i.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(vi(u*n))),r<qr)r=qr;else if(u>=Sg||r>Va)return null;var s=Math.pow(2,r),c=t.h*s,d=t.w*s,h=i.eleTextBiggerThanMin(e,s);if(!this.isVisible(e,h))return null;var p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var f;if(c<=Yo?f=Yo:c<=jr?f=jr:f=Math.ceil(c/jr)*jr,c>Tg||d>Mg)return null;var v=o.getTextureQueue(f),m=v[v.length-2],g=function(){return o.recycleTexture(f,d)||o.addTexture(f,d)};m||(m=v[v.length-1]),m||(m=g()),m.width-m.usedWidth<d&&(m=g());for(var y=function(N){return N&&N.scaledLabelShown===h},b=a&&a===Sn.dequeue,w=a&&a===Sn.highQuality,S=a&&a===Sn.downscale,k,x=r+1;x<=Va;x++){var C=l.get(e,x);if(C){k=C;break}}var T=k&&k.level===r+1?k:null,P=function(){m.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,m.usedWidth,0,d,c)};if(m.context.setTransform(1,0,0,1,0,0),m.context.clearRect(m.usedWidth,0,d,f),y(T))P();else if(y(k))if(w){for(var M=k.level;M>r;M--)T=o.getElement(e,t,n,M,Sn.downscale);P()}else return o.queueElement(e,k.level-1),k;else{var D;if(!b&&!w&&!S)for(var B=r-1;B>=qr;B--){var _=l.get(e,B);if(_){D=_;break}}if(y(D))return o.queueElement(e,r),D;m.context.translate(m.usedWidth,0),m.context.scale(s,s),this.drawElement(m.context,e,t,h,!1),m.context.scale(1/s,1/s),m.context.translate(-m.usedWidth,0)}return p={x:m.usedWidth,texture:m,level:r,scale:s,width:d,height:c,scaledLabelShown:h},m.usedWidth+=Math.ceil(d+_g),m.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(m),p},qe.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},qe.invalidateElement=function(e){var t=this,n=t.lookup,r=[],a=n.isInvalid(e);if(a){for(var o=qr;o<=Va;o++){var i=n.getForCachedKey(e,o);i&&r.push(i)}var u=n.invalidate(e);if(u)for(var l=0;l<r.length;l++){var s=r[l],c=s.texture;c.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},qe.checkTextureUtility=function(e){e.invalidatedWidth>=Bg*e.width&&this.retireTexture(e)},qe.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Og&&e.fullnessChecks>=Ig?Zt(n,e):e.fullnessChecks++},qe.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;Zt(r,e),e.retired=!0;for(var o=e.eleCaches,i=0;i<o.length;i++){var u=o[i];a.deleteCache(u.key,u.level)}qa(o);var l=t.getRetiredTextureQueue(n);l.push(e)},qe.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),a={};return r.push(a),a.eleCaches=[],a.height=e,a.width=Math.max(Pg,t),a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,a.canvas=n.renderer.makeOffscreenCanvas(a.width,a.height),a.context=a.canvas.getContext("2d"),a},qe.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),a=n.getRetiredTextureQueue(e),o=0;o<a.length;o++){var i=a[o];if(i.width>=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,qa(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),Zt(a,i),r.push(i),i}},qe.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),o=this.getKey(e),i=a[o];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,r.updateItem(i);else{var u={eles:e.spawn().merge(e),level:t,reqs:1,key:o};r.push(u),a[o]=u}},qe.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],o=t.lookup,i=0;i<Vg&&n.size()>0;i++){var u=n.pop(),l=u.key,s=u.eles[0],c=o.hasCache(s,u.level);if(r[l]=null,!c){a.push(u);var d=t.getBoundingBox(s);t.getElement(s,d,e,u.level,Sn.dequeue)}}return a},qe.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),o=r[a];o!=null&&(o.eles.length===1?(o.reqs=fi,n.updateItem(o),n.pop(),r[a]=null):o.eles.unmerge(e))},qe.onDequeue=function(e){this.onDequeues.push(e)},qe.offDequeue=function(e){Zt(this.onDequeues,e)},qe.setupDequeueing=bl.setupDequeueing({deqRedrawThreshold:Lg,deqCost:Ng,deqAvgCost:Ag,deqNoDrawCost:zg,deqFastCost:Rg,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var o=t[a].eles,i=0;i<o.length;i++){var u=o[i].boundingBox();if(yi(u,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var jg=1,nr=-4,Yr=2,qg=3.99,Yg=50,Xg=50,Wg=.15,Ug=.1,Hg=.9,Gg=.9,Kg=1,Xo=250,$g=4e3*4e3,Zg=!0,xl=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Yt()-2*Xo,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=va(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Xg),n.beforeRender(function(o,i){i-t.lastInvalidationTime<=Xo?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var a=function(o,i){return i.reqs-o.reqs};t.layersQueue=new Sr(a),t.setupDequeueing()},$e=xl.prototype,Wo=0,Qg=Math.pow(2,53)-1;$e.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),o=this.renderer.makeOffscreenCanvas(r,a),i={id:Wo=++Wo%Qg,bb:e,level:t,width:r,height:a,canvas:o,context:o.getContext("2d"),eles:[],elesQueue:[],reqs:0},u=i.context,l=-i.bb.x1,s=-i.bb.y1;return u.scale(n,n),u.translate(l,s),i},$e.getLayers=function(e,t,n){var r=this,a=r.renderer,o=a.cy,i=o.zoom(),u=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(vi(i*t)),n<nr)n=nr;else if(i>=qg||n>Yr)return null}r.validateLayersElesOrdering(n,e);var l=r.layersByLevel,s=Math.pow(2,n),c=l[n]=l[n]||[],d,h=r.levelIsComplete(n,e),p,f=function(){var T=function(B){if(r.validateLayersElesOrdering(B,e),r.levelIsComplete(B,e))return p=l[B],!0},P=function(B){if(!p)for(var _=n+B;nr<=_&&_<=Yr&&!T(_);_+=B);};P(1),P(-1);for(var M=c.length-1;M>=0;M--){var D=c[M];D.invalid&&Zt(c,D)}};if(!h)f();else return c;var v=function(){if(!d){d=ht();for(var T=0;T<e.length;T++)ws(d,e[T].boundingBox())}return d},m=function(T){T=T||{};var P=T.after;v();var M=d.w*s*(d.h*s);if(M>$g)return null;var D=r.makeLayer(d,n);if(P!=null){var B=c.indexOf(P)+1;c.splice(B,0,D)}else(T.insert===void 0||T.insert)&&c.unshift(D);return D};if(r.skipping&&!u)return null;for(var g=null,y=e.length/jg,b=!u,w=0;w<e.length;w++){var S=e[w],k=S._private.rscratch,x=k.imgLayerCaches=k.imgLayerCaches||{},C=x[n];if(C){g=C;continue}if((!g||g.eles.length>=y||!Es(g.bb,S.boundingBox()))&&(g=m({insert:!0,after:g}),!g))return null;p||b?r.queueLayer(g,S):r.drawEleInLayer(g,S,n,t),g.eles.push(S),x[n]=g}return p||(b?null:c)},$e.getEleLevelForLayerLevel=function(e,t){return e},$e.drawEleInLayer=function(e,t,n,r){var a=this,o=this.renderer,i=e.context,u=t.boundingBox();u.w===0||u.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),o.setImgSmoothing(i,!1),o.drawCachedElement(i,t,null,null,n,Zg),o.setImgSmoothing(i,!0))},$e.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,o=0;o<r.length;o++){var i=r[o];if(i.reqs>0||i.invalid)return!1;a+=i.eles.length}return a===t.length},$e.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],o=-1,i=0;i<t.length;i++)if(a.eles[0]===t[i]){o=i;break}if(o<0){this.invalidateLayer(a);continue}for(var u=o,i=0;i<a.eles.length;i++)if(a.eles[i]!==t[u+i]){this.invalidateLayer(a);break}}},$e.updateElementsInLayers=function(e,t){for(var n=this,r=Cr(e[0]),a=0;a<e.length;a++)for(var o=r?null:e[a],i=r?e[a]:e[a].ele,u=i._private.rscratch,l=u.imgLayerCaches=u.imgLayerCaches||{},s=nr;s<=Yr;s++){var c=l[s];c&&(o&&n.getEleLevelForLayerLevel(c.level)!==o.level||t(c,i,o))}},$e.haveLayers=function(){for(var e=this,t=!1,n=nr;n<=Yr;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},$e.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Yt(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},$e.invalidateLayer=function(e){if(this.lastInvalidationTime=Yt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Zt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var o=n[a]._private.rscratch.imgLayerCaches;o&&(o[t]=null)}}},$e.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,a){var o=n.replacement;if(o||(o=n.replacement=t.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var i=0;i<o.eles.length;i++)t.queueLayer(o,o.eles[i])})},$e.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},$e.queueLayer=function(e,t){var n=this,r=n.layersQueue,a=e.elesQueue,o=a.hasId=a.hasId||{};if(!e.replacement){if(t){if(o[t.id()])return;a.push(t),o[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},$e.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<Kg&&n.size()!==0;){var o=n.peek();if(o.replacement){n.pop();continue}if(o.replaces&&o!==o.replaces.replacement){n.pop();continue}if(o.invalid){n.pop();continue}var i=o.elesQueue.shift();i&&(t.drawEleInLayer(o,i,o.level,e),a++),r.length===0&&r.push(!0),o.elesQueue.length===0&&(n.pop(),o.reqs=0,o.replaces&&t.applyLayerReplacement(o),t.requestRedraw())}return r},$e.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,a=n.indexOf(r);if(!(a<0||r.invalid)){n[a]=e;for(var o=0;o<e.eles.length;o++){var i=e.eles[o]._private,u=i.imgLayerCaches=i.imgLayerCaches||{};u&&(u[e.level]=e)}t.requestRedraw()}},$e.requestRedraw=va(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),$e.setupDequeueing=bl.setupDequeueing({deqRedrawThreshold:Yg,deqCost:Wg,deqAvgCost:Ug,deqNoDrawCost:Hg,deqFastCost:Gg,deq:function(e,t){return e.dequeue(t)},onDeqd:gi,shouldRedraw:vs,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var wl={},Uo;function Jg(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function ev(e,t,n){for(var r,a=0;a<t.length;a++){var o=t[a];a===0&&(r=o),e.lineTo(o.x,o.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Ho(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var o=r[a];e.lineTo(o.x,o.y)}var i=n,u=n[0];e.moveTo(u.x,u.y);for(var a=1;a<i.length;a++){var o=i[a];e.lineTo(o.x,o.y)}e.closePath&&e.closePath()}function tv(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,Math.PI*2,!1);var o=t,i=o[0];e.moveTo(i.x,i.y);for(var u=0;u<o.length;u++){var l=o[u];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function nv(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}wl.arrowShapeImpl=function(e){return(Uo||(Uo={polygon:Jg,"triangle-backcurve":ev,"triangle-tee":Ho,"circle-triangle":tv,"triangle-cross":Ho,circle:nv}))[e]};var Nt={};Nt.drawElement=function(e,t,n,r,a,o){var i=this;t.isNode()?i.drawNode(e,t,n,r,a,o):i.drawEdge(e,t,n,r,a,o)},Nt.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},Nt.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},Nt.drawCachedElementPortion=function(e,t,n,r,a,o,i,u){var l=this,s=n.getBoundingBox(t);if(!(s.w===0||s.h===0)){var c=n.getElement(t,s,r,a,o);if(c!=null){var d=u(l,t);if(d===0)return;var h=i(l,t),p=s.x1,f=s.y1,v=s.w,m=s.h,g,y,b,w,S;if(h!==0){var k=n.getRotationPoint(t);b=k.x,w=k.y,e.translate(b,w),e.rotate(h),S=l.getImgSmoothing(e),S||l.setImgSmoothing(e,!0);var x=n.getRotationOffset(t);g=x.x,y=x.y}else g=p,y=f;var C;d!==1&&(C=e.globalAlpha,e.globalAlpha=C*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,g,y,v,m),d!==1&&(e.globalAlpha=C),h!==0&&(e.rotate(-h),e.translate(-b,-w),S||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var rv=function(){return 0},av=function(e,t){return e.getTextAngle(t,null)},iv=function(e,t){return e.getTextAngle(t,"source")},ov=function(e,t){return e.getTextAngle(t,"target")},sv=function(e,t){return t.effectiveOpacity()},Fa=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Nt.drawCachedElement=function(e,t,n,r,a,o){var i=this,u=i.data,l=u.eleTxrCache,s=u.lblTxrCache,c=u.slbTxrCache,d=u.tlbTxrCache,h=t.boundingBox(),p=o===!0?l.reasons.highQuality:null;if(!(h.w===0||h.h===0||!t.visible())&&(!r||yi(h,r))){var f=t.isEdge(),v=t.element()._private.rscratch.badLine;i.drawElementUnderlay(e,t),i.drawCachedElementPortion(e,t,l,n,a,p,rv,sv),(!f||!v)&&i.drawCachedElementPortion(e,t,s,n,a,p,av,Fa),f&&!v&&(i.drawCachedElementPortion(e,t,c,n,a,p,iv,Fa),i.drawCachedElementPortion(e,t,d,n,a,p,ov,Fa)),i.drawElementOverlay(e,t)}},Nt.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var a=t[r];n.drawElement(e,a)}},Nt.drawCachedElements=function(e,t,n,r){for(var a=this,o=0;o<t.length;o++){var i=t[o];a.drawCachedElement(e,i,n,r)}},Nt.drawCachedNodes=function(e,t,n,r){for(var a=this,o=0;o<t.length;o++){var i=t[o];i.isNode()&&a.drawCachedElement(e,i,n,r)}},Nt.drawLayeredElements=function(e,t,n,r){var a=this,o=a.data.lyrTxrCache.getLayers(t,n);if(o)for(var i=0;i<o.length;i++){var u=o[i],l=u.bb;l.w===0||l.h===0||e.drawImage(u.canvas,l.x1,l.y1,l.w,l.h)}else a.drawCachedElements(e,t,n,r)};var jt={};jt.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,u=t._private.rscratch;if(!(o&&!t.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var s=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,m=t.pstyle("line-outline-color").value,g=s*c,y=s*c,b=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;d==="straight-triangle"?(i.eleStrokeStyle(e,t,_),i.drawEdgeTrianglePath(t,e,u.allpts)):(e.lineWidth=p,e.lineCap=f,i.eleStrokeStyle(e,t,_),i.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},w=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(e.lineWidth=p+v,e.lineCap=f,v>0)i.colorStrokeStyle(e,m[0],m[1],m[2],_);else{e.lineCap="butt";return}d==="straight-triangle"?i.drawEdgeTrianglePath(t,e,u.allpts):(i.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},S=function(){a&&i.drawEdgeOverlay(e,t)},k=function(){a&&i.drawEdgeUnderlay(e,t)},x=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;i.drawArrowheads(e,t,_)},C=function(){i.drawElementText(e,t,null,r)};e.lineJoin="round";var T=t.pstyle("ghost").value==="yes";if(T){var P=t.pstyle("ghost-offset-x").pfValue,M=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,B=g*D;e.translate(P,M),b(B),x(B),e.translate(-P,-M)}else w();k(),b(),x(),S(),C(),n&&e.translate(l.x1,l.y1)}};var Go=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,o=a.usePaths(),i=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,i.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",a.colorStrokeStyle(t,s[0],s[1],s[2],r),a.drawEdgePath(n,t,i.allpts,"solid")}}}};jt.drawEdgeOverlay=Go("overlay"),jt.drawEdgeUnderlay=Go("underlay"),jt.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,o=t,i,u=!1,l=this.usePaths(),s=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===d;h?(i=t=a.pathCache,u=!0):(i=t=new Path2D,a.pathCacheKey=d,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(s),o.lineDashOffset=c;break;case"solid":o.setLineDash([]);break}if(!u&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+3<n.length;p+=4)t.quadraticCurveTo(n[p],n[p+1],n[p+2],n[p+3]);break;case"straight":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1]);break;case"segments":if(a.isRound){var v=ns(a.roundCorners),m;try{for(v.s();!(m=v.n()).done;){var g=m.value;hl(t,g)}}catch(b){v.e(b)}finally{v.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var y=2;y+1<n.length;y+=2)t.lineTo(n[y],n[y+1]);break}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},jt.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var o=[n[a+2]-n[a],n[a+3]-n[a+1]],i=Math.sqrt(o[0]*o[0]+o[1]*o[1]),u=[o[1]/i,-o[0]/i],l=[u[0]*r/2,u[1]*r/2];t.beginPath(),t.moveTo(n[a]-l[0],n[a+1]-l[1]),t.lineTo(n[a]+l[0],n[a+1]+l[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},jt.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a=r.edgeType==="haystack";a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},jt.drawArrowhead=function(e,t,n,r,a,o,i){if(!(isNaN(r)||r==null||isNaN(a)||a==null||isNaN(o)||o==null)){var u=this,l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var s=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),p=h.value==="match-line"?d:h.pfValue;h.units==="%"&&(p*=d);var f=t.pstyle("opacity").value;i===void 0&&(i=f);var v=e.globalCompositeOperation;(i!==1||c==="hollow")&&(e.globalCompositeOperation="destination-out",u.colorFillStyle(e,255,255,255,1),u.colorStrokeStyle(e,255,255,255,1),u.drawArrowShape(t,e,s,d,l,p,r,a,o),e.globalCompositeOperation=v);var m=t.pstyle(n+"-arrow-color").value;u.colorFillStyle(e,m[0],m[1],m[2],i),u.colorStrokeStyle(e,m[0],m[1],m[2],i),u.drawArrowShape(t,e,c,d,l,p,r,a,o)}}},jt.drawArrowShape=function(e,t,n,r,a,o,i,u,l){var s=this,c=this.usePaths()&&a!=="triangle-cross",d=!1,h,p=t,f={x:i,y:u},v=e.pstyle("arrow-scale").value,m=this.getArrowWidth(r,v),g=s.arrowShapes[a];if(c){var y=s.arrowPathCache=s.arrowPathCache||[],b=vn(a),w=y[b];w!=null?(h=t=w,d=!0):(h=t=new Path2D,y[b]=h)}d||(t.beginPath&&t.beginPath(),c?g.draw(t,1,0,{x:0,y:0},1):g.draw(t,m,l,f,r),t.closePath&&t.closePath()),t=p,c&&(t.translate(i,u),t.rotate(l),t.scale(m,m)),(n==="filled"||n==="both")&&(c?t.fill(h):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=o/(c?m:1),t.lineJoin="miter",c?t.stroke(h):t.stroke()),c&&(t.scale(1/m,1/m),t.rotate(-l),t.translate(-i,-u))};var oi={};oi.safeDrawImage=function(e,t,n,r,a,o,i,u,l,s){if(!(a<=0||o<=0||l<=0||s<=0))try{e.drawImage(t,n,r,a,o,i,u,l,s)}catch(c){Pe(c)}},oi.drawInscribedImage=function(e,t,n,r,a){var o=this,i=n.position(),u=i.x,l=i.y,s=n.cy().style(),c=s.getIndexedStyle.bind(s),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),p=n.width(),f=n.height(),v=n.padding()*2,m=p+(c(n,"background-width-relative-to","value",r)==="inner"?0:v),g=f+(c(n,"background-height-relative-to","value",r)==="inner"?0:v),y=n._private.rscratch,b=c(n,"background-clip","value",r),w=b==="node",S=c(n,"background-image-opacity","value",r)*a,k=c(n,"background-image-smoothing","value",r),x=n.pstyle("corner-radius").value;x!=="auto"&&(x=n.pstyle("corner-radius").pfValue);var C=t.width||t.cachedW,T=t.height||t.cachedH;(C==null||T==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,T=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var P=C,M=T;if(c(n,"background-width","value",r)!=="auto"&&(c(n,"background-width","units",r)==="%"?P=c(n,"background-width","pfValue",r)*m:P=c(n,"background-width","pfValue",r)),c(n,"background-height","value",r)!=="auto"&&(c(n,"background-height","units",r)==="%"?M=c(n,"background-height","pfValue",r)*g:M=c(n,"background-height","pfValue",r)),!(P===0||M===0)){if(d==="contain"){var D=Math.min(m/P,g/M);P*=D,M*=D}else if(d==="cover"){var D=Math.max(m/P,g/M);P*=D,M*=D}var B=u-m/2,_=c(n,"background-position-x","units",r),N=c(n,"background-position-x","pfValue",r);_==="%"?B+=(m-P)*N:B+=N;var A=c(n,"background-offset-x","units",r),z=c(n,"background-offset-x","pfValue",r);A==="%"?B+=(m-P)*z:B+=z;var O=l-g/2,R=c(n,"background-position-y","units",r),Y=c(n,"background-position-y","pfValue",r);R==="%"?O+=(g-M)*Y:O+=Y;var V=c(n,"background-offset-y","units",r),F=c(n,"background-offset-y","pfValue",r);V==="%"?O+=(g-M)*F:O+=F,y.pathCache&&(B-=u,O-=l,u=0,l=0);var W=e.globalAlpha;e.globalAlpha=S;var Q=o.getImgSmoothing(e),re=!1;if(k==="no"&&Q?(o.setImgSmoothing(e,!1),re=!0):k==="yes"&&!Q&&(o.setImgSmoothing(e,!0),re=!0),h==="no-repeat")w&&(e.save(),y.pathCache?e.clip(y.pathCache):(o.nodeShapes[o.getNodeShape(n)].draw(e,u,l,m,g,x,y),e.clip())),o.safeDrawImage(e,t,0,0,C,T,B,O,P,M),w&&e.restore();else{var K=e.createPattern(t,h);e.fillStyle=K,o.nodeShapes[o.getNodeShape(n)].draw(e,u,l,m,g,x,y),e.translate(B,O),e.fill(),e.translate(-B,-O)}e.globalAlpha=W,re&&o.setImgSmoothing(e,Q)}};var fn={};fn.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(vi(n*r));t=Math.pow(2,a)}var o=e.pstyle("font-size").pfValue*t,i=e.pstyle("min-zoomed-font-size").pfValue;return!(o<i)},fn.drawElementText=function(e,t,n,r,a){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this;if(r==null){if(o&&!i.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var u=t.pstyle("label");if(!u||!u.value)return;var l=i.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var s=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(s||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p=!n,f;n&&(f=n,e.translate(-f.x1,-f.y1)),a==null?(i.drawText(e,t,null,p,o),t.isEdge()&&(i.drawText(e,t,"source",p,o),i.drawText(e,t,"target",p,o))):i.drawText(e,t,a,p,o),n&&e.translate(f.x1,f.y1)},fn.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},fn.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,i=t.pstyle("font-weight").strValue,u=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*u,s=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+i+" "+a+" "+o,e.lineJoin="round",this.colorFillStyle(e,s[0],s[1],s[2],u),this.colorStrokeStyle(e,c[0],c[1],c[2],l)};function ja(e,t,n,r,a){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,i=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),i?e.stroke():e.fill()}fn.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,o=t?t+"-":"",i=e.pstyle(o+"text-rotation"),u=St(a,"labelAngle",t);return i.strValue==="autorotate"?n=e.isEdge()?u:0:i.strValue==="none"?n=0:n=i.pfValue,n},fn.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=t._private,i=o.rscratch,u=a?t.effectiveOpacity():1;if(!(a&&(u===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var l=St(i,"labelX",n),s=St(i,"labelY",n),c,d,h=this.getLabelText(t,n);if(h!=null&&h!==""&&!isNaN(l)&&!isNaN(s)){this.setupTextStyle(e,t,a);var p=n?n+"-":"",f=St(i,"labelWidth",n),v=St(i,"labelHeight",n),m=t.pstyle(p+"text-margin-x").pfValue,g=t.pstyle(p+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;y&&(b="center",w="center"),l+=m,s+=g;var S;switch(r?S=this.getTextAngle(t,n):S=0,S!==0&&(c=l,d=s,e.translate(c,d),e.rotate(S),l=0,s=0),w){case"top":break;case"center":s+=v/2;break;case"bottom":s+=v;break}var k=t.pstyle("text-background-opacity").value,x=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,T=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,M=P.indexOf("round")===0,D=2;if(k>0||C>0&&x>0){var B=l-T;switch(b){case"left":B-=f;break;case"center":B-=f/2;break}var _=s-v-T,N=f+2*T,A=v+2*T;if(k>0){var z=e.fillStyle,O=t.pstyle("text-background-color").value;e.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*u+")",M?ja(e,B,_,N,A,D):e.fillRect(B,_,N,A),e.fillStyle=z}if(C>0&&x>0){var R=e.strokeStyle,Y=e.lineWidth,V=t.pstyle("text-border-color").value,F=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+V[0]+","+V[1]+","+V[2]+","+x*u+")",e.lineWidth=C,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(M?ja(e,B,_,N,A,D,"stroke"):e.strokeRect(B,_,N,A),F==="double"){var W=C/2;M?ja(e,B+W,_+W,N-W*2,A-W*2,D,"stroke"):e.strokeRect(B+W,_+W,N-W*2,A-W*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=Y,e.strokeStyle=R}}var Q=2*t.pstyle("text-outline-width").pfValue;if(Q>0&&(e.lineWidth=Q),t.pstyle("text-wrap").value==="wrap"){var re=St(i,"labelWrapCachedLines",n),K=St(i,"labelLineHeight",n),$=f/2,I=this.getLabelJustification(t);switch(I==="auto"||(b==="left"?I==="left"?l+=-f:I==="center"&&(l+=-$):b==="center"?I==="left"?l+=-$:I==="right"&&(l+=$):b==="right"&&(I==="center"?l+=$:I==="right"&&(l+=f))),w){case"top":s-=(re.length-1)*K;break;case"center":case"bottom":s-=(re.length-1)*K;break}for(var H=0;H<re.length;H++)Q>0&&e.strokeText(re[H],l,s),e.fillText(re[H],l,s),s+=K}else Q>0&&e.strokeText(h,l,s),e.fillText(h,l,s);S!==0&&(e.rotate(-S),e.translate(-c,-d))}}};var Vn={};Vn.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,u,l,s=t._private,c=s.rscratch,d=t.position();if(!(!ne(d.x)||!ne(d.y))&&!(o&&!t.visible())){var h=o?t.effectiveOpacity():1,p=i.usePaths(),f,v=!1,m=t.padding();u=t.width()+2*m,l=t.height()+2*m;var g;n&&(g=n,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image"),b=y.value,w=new Array(b.length),S=new Array(b.length),k=0,x=0;x<b.length;x++){var C=b[x],T=w[x]=C!=null&&C!=="none";if(T){var P=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",x);k++,S[x]=i.getCachedImage(C,P,function(){s.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var M=t.pstyle("background-blacken").value,D=t.pstyle("border-width").pfValue,B=t.pstyle("background-opacity").value*h,_=t.pstyle("border-color").value,N=t.pstyle("border-style").value,A=t.pstyle("border-join").value,z=t.pstyle("border-cap").value,O=t.pstyle("border-position").value,R=t.pstyle("border-dash-pattern").pfValue,Y=t.pstyle("border-dash-offset").pfValue,V=t.pstyle("border-opacity").value*h,F=t.pstyle("outline-width").pfValue,W=t.pstyle("outline-color").value,Q=t.pstyle("outline-style").value,re=t.pstyle("outline-opacity").value*h,K=t.pstyle("outline-offset").value,$=t.pstyle("corner-radius").value;$!=="auto"&&($=t.pstyle("corner-radius").pfValue);var I=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:B;i.eleFillStyle(e,t,ee)},H=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V;i.colorStrokeStyle(e,_[0],_[1],_[2],ee)},U=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:re;i.colorStrokeStyle(e,W[0],W[1],W[2],ee)},te=function(ee,q,J,pe){var fe=i.nodePathCache=i.nodePathCache||[],le=gs(J==="polygon"?J+","+pe.join(","):J,""+q,""+ee,""+$),ye=fe[le],se,ue=!1;return ye!=null?(se=ye,ue=!0,c.pathCache=se):(se=new Path2D,fe[le]=c.pathCache=se),{path:se,cacheHit:ue}},ce=t.pstyle("shape").strValue,me=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(d.x,d.y);var Z=te(u,l,ce,me);f=Z.path,v=Z.cacheHit}var oe=function(){if(!v){var ee=d;p&&(ee={x:0,y:0}),i.nodeShapes[i.getNodeShape(t)].draw(f||e,ee.x,ee.y,u,l,$,c)}p?e.fill(f):e.fill()},ae=function(){for(var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,J=s.backgrounding,pe=0,fe=0;fe<S.length;fe++){var le=t.cy().style().getIndexedStyle(t,"background-image-containment","value",fe);if(q&&le==="over"||!q&&le==="inside"){pe++;continue}w[fe]&&S[fe].complete&&!S[fe].error&&(pe++,i.drawInscribedImage(e,S[fe],t,fe,ee))}s.backgrounding=pe!==k,J!==s.backgrounding&&t.updateStyle(!1)},de=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;i.hasPie(t)&&(i.drawPie(e,t,q),ee&&(p||i.nodeShapes[i.getNodeShape(t)].draw(e,d.x,d.y,u,l,$,c)))},ve=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,q=(M>0?M:-M)*ee,J=M>0?0:255;M!==0&&(i.colorFillStyle(e,J,J,J,q),p?e.fill(f):e.fill())},be=function(){if(D>0){if(e.lineWidth=D,e.lineCap=z,e.lineJoin=A,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(R),e.lineDashOffset=Y;break;case"solid":case"double":e.setLineDash([]);break}if(O!=="center"){if(e.save(),e.lineWidth*=2,O==="inside")p?e.clip(f):e.clip();else{var ee=new Path2D;ee.rect(-u/2-D,-l/2-D,u+2*D,l+2*D),ee.addPath(f),e.clip(ee,"evenodd")}p?e.stroke(f):e.stroke(),e.restore()}else p?e.stroke(f):e.stroke();if(N==="double"){e.lineWidth=D/3;var q=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(f):e.stroke(),e.globalCompositeOperation=q}e.setLineDash&&e.setLineDash([])}},xe=function(){if(F>0){if(e.lineWidth=F,e.lineCap="butt",e.setLineDash)switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ee=d;p&&(ee={x:0,y:0});var q=i.getNodeShape(t),J=D;O==="inside"&&(J=0),O==="outside"&&(J*=2);var pe=(u+J+(F+K))/u,fe=(l+J+(F+K))/l,le=u*pe,ye=l*fe,se=i.nodeShapes[q].points,ue;if(p){var Ve=te(le,ye,q,se);ue=Ve.path}if(q==="ellipse")i.drawEllipsePath(ue||e,ee.x,ee.y,le,ye);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(q)){var Ae=0,st=0,Ke=0;q==="round-diamond"?Ae=(J+K+F)*1.4:q==="round-heptagon"?(Ae=(J+K+F)*1.075,Ke=-(J/2+K+F)/35):q==="round-hexagon"?Ae=(J+K+F)*1.12:q==="round-pentagon"?(Ae=(J+K+F)*1.13,Ke=-(J/2+K+F)/15):q==="round-tag"?(Ae=(J+K+F)*1.12,st=(J/2+F+K)*.07):q==="round-triangle"&&(Ae=(J+K+F)*(Math.PI/2),Ke=-(J+K/2+F)/Math.PI),Ae!==0&&(pe=(u+Ae)/u,le=u*pe,["round-hexagon","round-tag"].includes(q)||(fe=(l+Ae)/l,ye=l*fe)),$=$==="auto"?Cs(le,ye):$;for(var Fe=le/2,ut=ye/2,Ue=$+(J+F+K)/2,pt=new Array(se.length/2),bt=new Array(se.length/2),ct=0;ct<se.length/2;ct++)pt[ct]={x:ee.x+st+Fe*se[ct*2],y:ee.y+Ke+ut*se[ct*2+1]};var xt,Pt,Rt,wt,je=pt.length;for(Pt=pt[je-1],xt=0;xt<je;xt++)Rt=pt[xt%je],wt=pt[(xt+1)%je],bt[xt]=Di(Pt,Rt,wt,Ue),Pt=Rt,Rt=wt;i.drawRoundPolygonPath(ue||e,ee.x+st,ee.y+Ke,u*pe,l*fe,se,bt)}else if(["roundrectangle","round-rectangle"].includes(q))$=$==="auto"?mn(le,ye):$,i.drawRoundRectanglePath(ue||e,ee.x,ee.y,le,ye,$+(J+F+K)/2);else if(["cutrectangle","cut-rectangle"].includes(q))$=$==="auto"?mi():$,i.drawCutRectanglePath(ue||e,ee.x,ee.y,le,ye,null,$+(J+F+K)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(q))$=$==="auto"?mn(le,ye):$,i.drawBottomRoundRectanglePath(ue||e,ee.x,ee.y,le,ye,$+(J+F+K)/2);else if(q==="barrel")i.drawBarrelPath(ue||e,ee.x,ee.y,le,ye);else if(q.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(q)){var He=(J+F+K)/u;se=sa(la(se,He)),i.drawPolygonPath(ue||e,ee.x,ee.y,u,l,se)}else{var tt=(J+F+K)/u;se=sa(la(se,-tt)),i.drawPolygonPath(ue||e,ee.x,ee.y,u,l,se)}if(p?e.stroke(ue):e.stroke(),Q==="double"){e.lineWidth=J/3;var Mt=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(ue):e.stroke(),e.globalCompositeOperation=Mt}e.setLineDash&&e.setLineDash([])}},Me=function(){a&&i.drawNodeOverlay(e,t,d,u,l)},we=function(){a&&i.drawNodeUnderlay(e,t,d,u,l)},Ce=function(){i.drawElementText(e,t,null,r)},E=t.pstyle("ghost").value==="yes";if(E){var L=t.pstyle("ghost-offset-x").pfValue,G=t.pstyle("ghost-offset-y").pfValue,X=t.pstyle("ghost-opacity").value,j=X*h;e.translate(L,G),U(),xe(),I(X*B),oe(),ae(j,!0),H(X*V),be(),de(M!==0||D!==0),ae(j,!1),ve(j),e.translate(-L,-G)}p&&e.translate(-d.x,-d.y),we(),p&&e.translate(d.x,d.y),U(),xe(),I(),oe(),ae(h,!0),H(),be(),de(M!==0||D!==0),ae(h,!1),ve(),p&&e.translate(-d.x,-d.y),Ce(),Me(),n&&e.translate(g.x1,g.y1)}};var Ko=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,o){var i=this;if(n.visible()){var u=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,s=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value,d=n.pstyle("".concat(e,"-corner-radius")).value;if(l>0){if(r=r||n.position(),a==null||o==null){var h=n.padding();a=n.width()+2*h,o=n.height()+2*h}i.colorFillStyle(t,s[0],s[1],s[2],l),i.nodeShapes[c].draw(t,r.x,r.y,a+u*2,o+u*2,d),t.fill()}}}};Vn.drawNodeOverlay=Ko("overlay"),Vn.drawNodeUnderlay=Ko("underlay"),Vn.hasPie=function(e){return e=e[0],e._private.hasPie},Vn.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),o=t.pstyle("pie-size"),i=r.x,u=r.y,l=t.width(),s=t.height(),c=Math.min(l,s)/2,d=0,h=this.usePaths();h&&(i=0,u=0),o.units==="%"?c=c*o.pfValue:o.pfValue!==void 0&&(c=o.pfValue/2);for(var p=1;p<=a.pieBackgroundN;p++){var f=t.pstyle("pie-"+p+"-background-size").value,v=t.pstyle("pie-"+p+"-background-color").value,m=t.pstyle("pie-"+p+"-background-opacity").value*n,g=f/100;g+d>1&&(g=1-d);var y=1.5*Math.PI+2*Math.PI*d,b=2*Math.PI*g,w=y+b;f===0||d>=1||d+g>1||(e.beginPath(),e.moveTo(i,u),e.arc(i,u,c,y,w),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],m),e.fill(),d+=g)}};var ft={},lv=100;ft.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},ft.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;a<t.length;a++)if(r=t[a],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},ft.createGradientStyleFor=function(e,t,n,r,a){var o,i=this.usePaths(),u=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var s=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=yn(s,d),p=yn(c,d);o=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,p))}else{var f=i?{x:0,y:0}:n.position(),v=n.paddedWidth(),m=n.paddedHeight();o=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(v,m))}else if(n.isEdge()){var g=n.sourceEndpoint(),y=n.targetEndpoint();o=e.createLinearGradient(g.x,g.y,y.x,y.y)}else{var b=i?{x:0,y:0}:n.position(),w=n.paddedWidth(),S=n.paddedHeight(),k=w/2,x=S/2,C=n.pstyle("background-gradient-direction").value;switch(C){case"to-bottom":o=e.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":o=e.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":o=e.createLinearGradient(b.x+k,b.y,b.x-k,b.y);break;case"to-right":o=e.createLinearGradient(b.x-k,b.y,b.x+k,b.y);break;case"to-bottom-right":case"to-right-bottom":o=e.createLinearGradient(b.x-k,b.y-x,b.x+k,b.y+x);break;case"to-top-right":case"to-right-top":o=e.createLinearGradient(b.x-k,b.y+x,b.x+k,b.y-x);break;case"to-bottom-left":case"to-left-bottom":o=e.createLinearGradient(b.x+k,b.y-x,b.x-k,b.y+x);break;case"to-top-left":case"to-left-top":o=e.createLinearGradient(b.x+k,b.y+x,b.x-k,b.y-x);break}}if(!o)return null;for(var T=l.length===u.length,P=u.length,M=0;M<P;M++)o.addColorStop(T?l[M]:M/(P-1),"rgba("+u[M][0]+","+u[M][1]+","+u[M][2]+","+a+")");return o},ft.gradientFillStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},ft.colorFillStyle=function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},ft.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},ft.gradientStrokeStyle=function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},ft.colorStrokeStyle=function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},ft.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},ft.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],o=r[3],i=t.getPixelRatio(),u=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(i=u);var l=a*i,s=o*i,c;if(!(l===t.canvasWidth&&s===t.canvasHeight)){t.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=o+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)c=n.canvases[h],c.width=l,c.height=s,c.style.width=a+"px",c.style.height=o+"px";for(var h=0;h<t.BUFFER_COUNT;h++)c=n.bufferCanvases[h],c.width=l,c.height=s,c.style.width=a+"px",c.style.height=o+"px";t.textureMult=1,i<=1&&(c=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,c.width=l*t.textureMult,c.height=s*t.textureMult),t.canvasWidth=l,t.canvasHeight=s}},ft.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},ft.render=function(e){e=e||bs();var t=e.forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,a=e.forcedZoom,o=e.forcedPan,i=this,u=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=i.cy,s=i.data,c=s.canvasNeedsRedraw,d=i.textureOnViewport&&!t&&(i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming),h=e.motionBlur!==void 0?e.motionBlur:i.motionBlur,p=i.motionBlurPxRatio,f=l.hasCompoundNodes(),v=i.hoverData.draggingEles,m=!!(i.hoverData.selecting||i.touchData.selecting);h=h&&!t&&i.motionBlurEnabled&&!m;var g=h;t||(i.prevPxRatio!==u&&(i.invalidateContainerClientCoordsCache(),i.matchCanvasSize(i.container),i.redrawHint("eles",!0),i.redrawHint("drag",!0)),i.prevPxRatio=u),!t&&i.motionBlurTimeout&&clearTimeout(i.motionBlurTimeout),h&&(i.mbFrames==null&&(i.mbFrames=0),i.mbFrames++,i.mbFrames<3&&(g=!1),i.mbFrames>i.minMbLowQualFrames&&(i.motionBlurPxRatio=i.mbPxRBlurry)),i.clearingMotionBlur&&(i.motionBlurPxRatio=1),i.textureDrawLastFrame&&!d&&(c[i.NODE]=!0,c[i.SELECT_BOX]=!0);var y=l.style(),b=l.zoom(),w=a!==void 0?a:b,S=l.pan(),k={x:S.x,y:S.y},x={zoom:b,pan:{x:S.x,y:S.y}},C=i.prevViewport,T=C===void 0||x.zoom!==C.zoom||x.pan.x!==C.pan.x||x.pan.y!==C.pan.y;!T&&!(v&&!f)&&(i.motionBlurPxRatio=1),o&&(k=o),w*=u,k.x*=u,k.y*=u;var P=i.getCachedZSortedEles();function M(Z,oe,ae,de,ve){var be=Z.globalCompositeOperation;Z.globalCompositeOperation="destination-out",i.colorFillStyle(Z,255,255,255,i.motionBlurTransparency),Z.fillRect(oe,ae,de,ve),Z.globalCompositeOperation=be}function D(Z,oe){var ae,de,ve,be;!i.clearingMotionBlur&&(Z===s.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]||Z===s.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG])?(ae={x:S.x*p,y:S.y*p},de=b*p,ve=i.canvasWidth*p,be=i.canvasHeight*p):(ae=k,de=w,ve=i.canvasWidth,be=i.canvasHeight),Z.setTransform(1,0,0,1,0,0),oe==="motionBlur"?M(Z,0,0,ve,be):!t&&(oe===void 0||oe)&&Z.clearRect(0,0,ve,be),n||(Z.translate(ae.x,ae.y),Z.scale(de,de)),o&&Z.translate(o.x,o.y),a&&Z.scale(a,a)}if(d||(i.textureDrawLastFrame=!1),d){if(i.textureDrawLastFrame=!0,!i.textureCache){i.textureCache={},i.textureCache.bb=l.mutableElements().boundingBox(),i.textureCache.texture=i.data.bufferCanvases[i.TEXTURE_BUFFER];var B=i.data.bufferContexts[i.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,i.canvasWidth*i.textureMult,i.canvasHeight*i.textureMult),i.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:u*i.textureMult});var x=i.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:i.canvasWidth,height:i.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}c[i.DRAG]=!1,c[i.NODE]=!1;var _=s.contexts[i.NODE],N=i.textureCache.texture,x=i.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?M(_,0,0,x.width,x.height):_.clearRect(0,0,x.width,x.height);var A=y.core("outside-texture-bg-color").value,z=y.core("outside-texture-bg-opacity").value;i.colorFillStyle(_,A[0],A[1],A[2],z),_.fillRect(0,0,x.width,x.height);var b=l.zoom();D(_,!1),_.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),_.drawImage(N,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else i.textureOnViewport&&!t&&(i.textureCache=null);var O=l.extent(),R=i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming||i.hoverData.draggingEles||i.cy.animated(),Y=i.hideEdgesOnViewport&&R,V=[];if(V[i.NODE]=!c[i.NODE]&&h&&!i.clearedForMotionBlur[i.NODE]||i.clearingMotionBlur,V[i.NODE]&&(i.clearedForMotionBlur[i.NODE]=!0),V[i.DRAG]=!c[i.DRAG]&&h&&!i.clearedForMotionBlur[i.DRAG]||i.clearingMotionBlur,V[i.DRAG]&&(i.clearedForMotionBlur[i.DRAG]=!0),c[i.NODE]||n||r||V[i.NODE]){var F=h&&!V[i.NODE]&&p!==1,_=t||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]:s.contexts[i.NODE]),W=h&&!F?"motionBlur":void 0;D(_,W),Y?i.drawCachedNodes(_,P.nondrag,u,O):i.drawLayeredElements(_,P.nondrag,u,O),i.debug&&i.drawDebugPoints(_,P.nondrag),!n&&!h&&(c[i.NODE]=!1)}if(!r&&(c[i.DRAG]||n||V[i.DRAG])){var F=h&&!V[i.DRAG]&&p!==1,_=t||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]:s.contexts[i.DRAG]);D(_,h&&!F?"motionBlur":void 0),Y?i.drawCachedNodes(_,P.drag,u,O):i.drawCachedElements(_,P.drag,u,O),i.debug&&i.drawDebugPoints(_,P.drag),!n&&!h&&(c[i.DRAG]=!1)}if(i.showFps||!r&&c[i.SELECT_BOX]&&!n){var _=t||s.contexts[i.SELECT_BOX];if(D(_),i.selection[4]==1&&(i.hoverData.selecting||i.touchData.selecting)){var b=i.cy.zoom(),Q=y.core("selection-box-border-width").value/b;_.lineWidth=Q,_.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",_.fillRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]),Q>0&&(_.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",_.strokeRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]))}if(s.bgActivePosistion&&!i.hoverData.selecting){var b=i.cy.zoom(),re=s.bgActivePosistion;_.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",_.beginPath(),_.arc(re.x,re.y,y.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var K=i.lastRedrawTime;if(i.showFps&&K){K=Math.round(K);var $=Math.round(1e3/K);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+K+" ms = "+$+" fps",0,20);var I=60;_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min($/I,1),20)}n||(c[i.SELECT_BOX]=!1)}if(h&&p!==1){var H=s.contexts[i.NODE],U=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE],te=s.contexts[i.DRAG],ce=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG],me=function(Z,oe,ae){Z.setTransform(1,0,0,1,0,0),ae||!g?Z.clearRect(0,0,i.canvasWidth,i.canvasHeight):M(Z,0,0,i.canvasWidth,i.canvasHeight);var de=p;Z.drawImage(oe,0,0,i.canvasWidth*de,i.canvasHeight*de,0,0,i.canvasWidth,i.canvasHeight)};(c[i.NODE]||V[i.NODE])&&(me(H,U,V[i.NODE]),c[i.NODE]=!1),(c[i.DRAG]||V[i.DRAG])&&(me(te,ce,V[i.DRAG]),c[i.DRAG]=!1)}i.prevViewport=x,i.clearingMotionBlur&&(i.clearingMotionBlur=!1,i.motionBlurCleared=!0,i.motionBlur=!0),h&&(i.motionBlurTimeout=setTimeout(function(){i.motionBlurTimeout=null,i.clearedForMotionBlur[i.NODE]=!1,i.clearedForMotionBlur[i.DRAG]=!1,i.motionBlur=!1,i.clearingMotionBlur=!d,i.mbFrames=0,c[i.NODE]=!0,c[i.DRAG]=!0,i.redraw()},lv)),t||l.emit("render")};var $t={};$t.drawPolygonPath=function(e,t,n,r,a,o){var i=r/2,u=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+i*o[0],n+u*o[1]);for(var l=1;l<o.length/2;l++)e.lineTo(t+i*o[l*2],n+u*o[l*2+1]);e.closePath()},$t.drawRoundPolygonPath=function(e,t,n,r,a,o,i){i.forEach(function(u){return hl(e,u)}),e.closePath()},$t.drawRoundRectanglePath=function(e,t,n,r,a,o){var i=r/2,u=a/2,l=o==="auto"?mn(r,a):Math.min(o,u,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-u),e.arcTo(t+i,n-u,t+i,n,l),e.arcTo(t+i,n+u,t,n+u,l),e.arcTo(t-i,n+u,t-i,n,l),e.arcTo(t-i,n-u,t,n-u,l),e.lineTo(t,n-u),e.closePath()},$t.drawBottomRoundRectanglePath=function(e,t,n,r,a,o){var i=r/2,u=a/2,l=o==="auto"?mn(r,a):o;e.beginPath&&e.beginPath(),e.moveTo(t,n-u),e.lineTo(t+i,n-u),e.lineTo(t+i,n),e.arcTo(t+i,n+u,t,n+u,l),e.arcTo(t-i,n+u,t-i,n,l),e.lineTo(t-i,n-u),e.lineTo(t,n-u),e.closePath()},$t.drawCutRectanglePath=function(e,t,n,r,a,o,i){var u=r/2,l=a/2,s=i==="auto"?mi():i;e.beginPath&&e.beginPath(),e.moveTo(t-u+s,n-l),e.lineTo(t+u-s,n-l),e.lineTo(t+u,n-l+s),e.lineTo(t+u,n+l-s),e.lineTo(t+u-s,n+l),e.lineTo(t-u+s,n+l),e.lineTo(t-u,n+l-s),e.lineTo(t-u,n-l+s),e.closePath()},$t.drawBarrelPath=function(e,t,n,r,a){var o=r/2,i=a/2,u=t-o,l=t+o,s=n-i,c=n+i,d=Xa(r,a),h=d.widthOffset,p=d.heightOffset,f=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(u,s+p),e.lineTo(u,c-p),e.quadraticCurveTo(u+f,c,u+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-f,c,l,c-p),e.lineTo(l,s+p),e.quadraticCurveTo(l-f,s,l-h,s),e.lineTo(u+h,s),e.quadraticCurveTo(u+f,s,u,s+p),e.closePath()};for(var $o=Math.sin(0),Zo=Math.cos(0),si={},li={},El=Math.PI/40,_n=0*Math.PI;_n<2*Math.PI;_n+=El)si[_n]=Math.sin(_n),li[_n]=Math.cos(_n);$t.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var o,i,u=r/2,l=a/2,s=0*Math.PI;s<2*Math.PI;s+=El)o=t-u*si[s]*$o+u*li[s]*Zo,i=n+l*li[s]*$o+l*si[s]*Zo,s===0?e.moveTo(o,i):e.lineTo(o,i);e.closePath()};var Er={};Er.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Er.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),a=this.findContainerClientCoords(),o=e.full?Math.ceil(r.w):a[2],i=e.full?Math.ceil(r.h):a[3],u=ne(e.maxWidth)||ne(e.maxHeight),l=this.getPixelRatio(),s=1;if(e.scale!==void 0)o*=e.scale,i*=e.scale,s=e.scale;else if(u){var c=1/0,d=1/0;ne(e.maxWidth)&&(c=s*e.maxWidth/o),ne(e.maxHeight)&&(d=s*e.maxHeight/i),s=Math.min(c,d),o*=s,i*=s}u||(o*=l,i*=l,s*=l);var h=document.createElement("canvas");h.width=o,h.height=i,h.style.width=o+"px",h.style.height=i+"px";var p=h.getContext("2d");if(o>0&&i>0){p.clearRect(0,0,o,i),p.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)p.translate(-r.x1*s,-r.y1*s),p.scale(s,s),this.drawElements(p,f),p.scale(1/s,1/s),p.translate(r.x1*s,r.y1*s);else{var v=t.pan(),m={x:v.x*s,y:v.y*s};s*=t.zoom(),p.translate(m.x,m.y),p.scale(s,s),this.drawElements(p,f),p.scale(1/s,1/s),p.translate(-m.x,-m.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,o,i),p.fill())}return h};function uv(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),o=0;o<n.length;o++)a[o]=n.charCodeAt(o);return new Blob([r],{type:t})}function Qo(e){var t=e.indexOf(",");return e.substr(t+1)}function Jo(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Wn(function(a,o){try{t.toBlob(function(i){i!=null?a(i):o(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(i){o(i)}});case"blob":return uv(Qo(r()),n);case"base64":return Qo(r());default:return r()}}Er.png=function(e){return Jo(e,this.bufferCanvasImage(e),"image/png")},Er.jpg=function(e){return Jo(e,this.bufferCanvasImage(e),"image/jpeg")};var kl={};kl.nodeShapeImpl=function(e,t,n,r,a,o,i,u){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,o);case"polygon":return this.drawPolygonPath(t,n,r,a,o,i);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,o,i,u);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,o,u);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,o,i,u);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,o,u);case"barrel":return this.drawBarrelPath(t,n,r,a,o)}};var cv=Cl,Se=Cl.prototype;Se.CANVAS_LAYERS=3,Se.SELECT_BOX=0,Se.DRAG=1,Se.NODE=2,Se.BUFFER_COUNT=3,Se.TEXTURE_BUFFER=0,Se.MOTIONBLUR_BUFFER_NODE=1,Se.MOTIONBLUR_BUFFER_DRAG=2;function Cl(e){var t=this,n=t.cy.window(),r=n.document;t.data={canvases:new Array(Se.CANVAS_LAYERS),contexts:new Array(Se.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Se.CANVAS_LAYERS),bufferCanvases:new Array(Se.BUFFER_COUNT),bufferContexts:new Array(Se.CANVAS_LAYERS)};var a="-webkit-tap-highlight-color",o="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[a]=o,i.position="relative",i.zIndex="0",i.overflow="hidden";var u=e.cy.container();u.appendChild(t.data.canvasContainer),u.style[a]=o;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Ql()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var s=0;s<Se.CANVAS_LAYERS;s++){var c=t.data.canvases[s]=r.createElement("canvas");t.data.contexts[s]=c.getContext("2d"),Object.keys(l).forEach(function(I){c.style[I]=l[I]}),c.style.position="absolute",c.setAttribute("data-id","layer"+s),c.style.zIndex=String(Se.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[s]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Se.NODE].setAttribute("data-id","layer"+Se.NODE+"-node"),t.data.canvases[Se.SELECT_BOX].setAttribute("data-id","layer"+Se.SELECT_BOX+"-selectbox"),t.data.canvases[Se.DRAG].setAttribute("data-id","layer"+Se.DRAG+"-drag");for(var s=0;s<Se.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=r.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var d=ht(),h=function(I){return{x:(I.x1+I.x2)/2,y:(I.y1+I.y2)/2}},p=function(I){return{x:-I.w/2,y:-I.h/2}},f=function(I){var H=I[0]._private,U=H.oldBackgroundTimestamp===H.backgroundTimestamp;return!U},v=function(I){return I[0]._private.nodeKey},m=function(I){return I[0]._private.labelStyleKey},g=function(I){return I[0]._private.sourceLabelStyleKey},y=function(I){return I[0]._private.targetLabelStyleKey},b=function(I,H,U,te,ce){return t.drawElement(I,H,U,!1,!1,ce)},w=function(I,H,U,te,ce){return t.drawElementText(I,H,U,te,"main",ce)},S=function(I,H,U,te,ce){return t.drawElementText(I,H,U,te,"source",ce)},k=function(I,H,U,te,ce){return t.drawElementText(I,H,U,te,"target",ce)},x=function(I){return I.boundingBox(),I[0]._private.bodyBounds},C=function(I){return I.boundingBox(),I[0]._private.labelBounds.main||d},T=function(I){return I.boundingBox(),I[0]._private.labelBounds.source||d},P=function(I){return I.boundingBox(),I[0]._private.labelBounds.target||d},M=function(I,H){return H},D=function(I){return h(x(I))},B=function(I,H,U){var te=I?I+"-":"";return{x:H.x+U.pstyle(te+"text-margin-x").pfValue,y:H.y+U.pstyle(te+"text-margin-y").pfValue}},_=function(I,H,U){var te=I[0]._private.rscratch;return{x:te[H],y:te[U]}},N=function(I){return B("",_(I,"labelX","labelY"),I)},A=function(I){return B("source",_(I,"sourceLabelX","sourceLabelY"),I)},z=function(I){return B("target",_(I,"targetLabelX","targetLabelY"),I)},O=function(I){return p(x(I))},R=function(I){return p(T(I))},Y=function(I){return p(P(I))},V=function(I){var H=C(I),U=p(C(I));if(I.isNode()){switch(I.pstyle("text-halign").value){case"left":U.x=-H.w;break;case"right":U.x=0;break}switch(I.pstyle("text-valign").value){case"top":U.y=-H.h;break;case"bottom":U.y=0;break}}return U},F=t.data.eleTxrCache=new dr(t,{getKey:v,doesEleInvalidateKey:f,drawElement:b,getBoundingBox:x,getRotationPoint:D,getRotationOffset:O,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=t.data.lblTxrCache=new dr(t,{getKey:m,drawElement:w,getBoundingBox:C,getRotationPoint:N,getRotationOffset:V,isVisible:M}),Q=t.data.slbTxrCache=new dr(t,{getKey:g,drawElement:S,getBoundingBox:T,getRotationPoint:A,getRotationOffset:R,isVisible:M}),re=t.data.tlbTxrCache=new dr(t,{getKey:y,drawElement:k,getBoundingBox:P,getRotationPoint:z,getRotationOffset:Y,isVisible:M}),K=t.data.lyrTxrCache=new xl(t);t.onUpdateEleCalcs(function(I,H){F.invalidateElements(H),W.invalidateElements(H),Q.invalidateElements(H),re.invalidateElements(H),K.invalidateElements(H);for(var U=0;U<H.length;U++){var te=H[U]._private;te.oldBackgroundTimestamp=te.backgroundTimestamp}});var $=function(I){for(var H=0;H<I.length;H++)K.enqueueElementRefinement(I[H].ele)};F.onDequeue($),W.onDequeue($),Q.onDequeue($),re.onDequeue($)}Se.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Se.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Se.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Se.SELECT_BOX]=t;break}};var dv=typeof Path2D<"u";Se.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},Se.usePaths=function(){return dv&&this.pathsEnabled},Se.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Se.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Se.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":We(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n},[wl,Nt,jt,oi,fn,Vn,ft,$t,Er,kl].forEach(function(e){ge(Se,e)});var hv=[{name:"null",impl:ul},{name:"base",impl:ml},{name:"canvas",impl:cv}],pv=[{type:"layout",extensions:bg},{type:"renderer",extensions:hv}],Dl={},Sl={};function _l(e,t,n){var r=n,a=function(x){Pe("Can not register `"+t+"` for `"+e+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(wr.prototype[t])return a(t);wr.prototype[t]=n}else if(e==="collection"){if(Je.prototype[t])return a(t);Je.prototype[t]=n}else if(e==="layout"){for(var o=function(x){this.options=x,n.call(this,x),ke(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},i=o.prototype=Object.create(n.prototype),u=[],l=0;l<u.length;l++){var s=u[l];i[s]=i[s]||function(){return this}}i.start&&!i.run?i.run=function(){return this.start(),this}:!i.start&&i.run&&(i.start=function(){return this.run(),this});var c=n.prototype.stop;i.stop=function(){var x=this.options;if(x&&x.animate){var C=this.animations;if(C)for(var T=0;T<C.length;T++)C[T].stop()}return c?c.call(this):this.emit("layoutstop"),this},i.destroy||(i.destroy=function(){return this}),i.cy=function(){return this._private.cy};var d=function(x){return x._private.cy},h={addEventFields:function(x,C){C.layout=x,C.cy=d(x),C.target=x},bubble:function(){return!0},parent:function(x){return d(x)}};ge(i,{createEmitter:function(){return this._private.emitter=new ka(h,this),this},emitter:function(){return this._private.emitter},on:function(x,C){return this.emitter().on(x,C),this},one:function(x,C){return this.emitter().one(x,C),this},once:function(x,C){return this.emitter().one(x,C),this},removeListener:function(x,C){return this.emitter().removeListener(x,C),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(x,C){return this.emitter().emit(x,C),this}}),_e.eventAliasesOn(i),r=o}else if(e==="renderer"&&t!=="null"&&t!=="base"){var p=Pl("renderer","base"),f=p.prototype,v=n,m=n.prototype,g=function(){p.apply(this,arguments),v.apply(this,arguments)},y=g.prototype;for(var b in f){var w=f[b],S=m[b]!=null;if(S)return a(b);y[b]=w}for(var k in m)y[k]=m[k];f.clientFunctions.forEach(function(x){y[x]=y[x]||function(){Le("Renderer does not implement `renderer."+x+"()` on its prototype")}}),r=g}else if(e==="__proto__"||e==="constructor"||e==="prototype")return Le(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return ls({map:Dl,keys:[e,t],value:r})}function Pl(e,t){return us({map:Dl,keys:[e,t]})}function fv(e,t,n,r,a){return ls({map:Sl,keys:[e,t,n,r],value:a})}function gv(e,t,n,r){return us({map:Sl,keys:[e,t,n,r]})}var ui=function(){if(arguments.length===2)return Pl.apply(null,arguments);if(arguments.length===3)return _l.apply(null,arguments);if(arguments.length===4)return gv.apply(null,arguments);if(arguments.length===5)return fv.apply(null,arguments);Le("Invalid extension access syntax")};wr.prototype.extension=ui,pv.forEach(function(e){e.extensions.forEach(function(t){_l(e.type,t.name,t.impl)})});var Ml=function e(){if(!(this instanceof e))return new e;this.length=0},sn=Ml.prototype;sn.instanceString=function(){return"stylesheet"},sn.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},sn.css=function(e,t){var n=this.length-1;if(he(e))this[n].properties.push({name:e,value:t});else if(ke(e))for(var r=e,a=Object.keys(r),o=0;o<a.length;o++){var i=a[o],u=r[i];if(u!=null){var l=ot.properties[i]||ot.properties[fa(i)];if(l!=null){var s=l.name,c=u;this[n].properties.push({name:s,value:c})}}}return this},sn.style=sn.css,sn.generateStyle=function(e){var t=new ot(e);return this.appendToStyle(t)},sn.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var o=0;o<a.length;o++){var i=a[o];e.css(i.name,i.value)}}return e};var vv="3.30.2",Pn=function(e){if(e===void 0&&(e={}),ke(e))return new wr(e);if(he(e))return ui.apply(ui,arguments)};Pn.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Pn),e.apply(null,t),this},Pn.warnings=function(e){return ys(e)},Pn.version=vv,Pn.stylesheet=Pn.Stylesheet=Ml;export{Pn as c};
//# sourceMappingURL=cytoscape.esm-D2wQNSMa.chunk.mjs.map