md/assets/cytoscape.esm-Bc_jmh-U.js
2024-09-08 14:05:57 +00:00

17 lines
370 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{an as Li}from"./index-DEkCliAN.js";function We(r){"@babel/helpers - typeof";return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(r)}function ai(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qu(r,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,a.key,a)}}function ni(r,e,t){return e&&qu(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Uo(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Tr(r,e){return $u(r)||Hu(r,e)||Yo(r,e)||Gu()}function $u(r){if(Array.isArray(r))return r}function Hu(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a=[],n=!0,i=!1,o,s;try{for(t=t.call(r);!(n=(o=t.next()).done)&&(a.push(o.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,s=l}finally{try{!n&&t.return!=null&&t.return()}finally{if(i)throw s}}return a}}function Yo(r,e){if(r){if(typeof r=="string")return Ai(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ai(r,e)}}function Ai(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=new Array(e);t<e;t++)a[t]=r[t];return a}function Gu(){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 Xo(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Yo(r))||e){t&&(r=t);var a=0,n=function(){};return{s:n,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}}}var Ge=typeof window>"u"?null:window,Ri=Ge?Ge.navigator:null;Ge&&Ge.document;var Ku=We(""),Zo=We({}),Wu=We(function(){}),Uu=typeof HTMLElement>"u"?"undefined":We(HTMLElement),ba=function(e){return e&&e.instanceString&&Fe(e.instanceString)?e.instanceString():null},de=function(e){return e!=null&&We(e)==Ku},Fe=function(e){return e!=null&&We(e)===Wu},Re=function(e){return!gr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Se=function(e){return e!=null&&We(e)===Zo&&!Re(e)&&e.constructor===Object},Yu=function(e){return e!=null&&We(e)===Zo},ne=function(e){return e!=null&&We(e)===We(1)&&!isNaN(e)},Xu=function(e){return ne(e)&&Math.floor(e)===e},Qa=function(e){if(Uu!=="undefined")return e!=null&&e instanceof HTMLElement},gr=function(e){return wa(e)||Qo(e)},wa=function(e){return ba(e)==="collection"&&e._private.single},Qo=function(e){return ba(e)==="collection"&&!e._private.single},ii=function(e){return ba(e)==="core"},Jo=function(e){return ba(e)==="stylesheet"},Zu=function(e){return ba(e)==="event"},Jr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Qu=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Ju=function(e){return Se(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},_u=function(e){return Yu(e)&&Fe(e.then)},ju=function(){return Ri&&Ri.userAgent.match(/msie|trident|edge/i)},ua=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function n(){var i=this,o=arguments,s,l=t.apply(i,o),u=n.cache;return(s=u[l])||(s=u[l]=e.apply(i,o)),s};return a.cache={},a},oi=ua(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),un=ua(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),_o=ua(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),Oi=function(e){return Jr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ke="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",el="rgb[a]?\\(("+Ke+"[%]?)\\s*,\\s*("+Ke+"[%]?)\\s*,\\s*("+Ke+"[%]?)(?:\\s*,\\s*("+Ke+"))?\\)",rl="rgb[a]?\\((?:"+Ke+"[%]?)\\s*,\\s*(?:"+Ke+"[%]?)\\s*,\\s*(?:"+Ke+"[%]?)(?:\\s*,\\s*(?:"+Ke+"))?\\)",tl="hsl[a]?\\(("+Ke+")\\s*,\\s*("+Ke+"[%])\\s*,\\s*("+Ke+"[%])(?:\\s*,\\s*("+Ke+"))?\\)",al="hsl[a]?\\((?:"+Ke+")\\s*,\\s*(?:"+Ke+"[%])\\s*,\\s*(?:"+Ke+"[%])(?:\\s*,\\s*(?:"+Ke+"))?\\)",nl="\\#[0-9a-fA-F]{3}",il="\\#[0-9a-fA-F]{6}",jo=function(e,t){return e<t?-1:e>t?1:0},ol=function(e,t){return-1*jo(e,t)},be=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var a=e[t];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];r[o]=a[o]}}return r},sl=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,a,n,i,o=16;return t?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},ul=function(e){var t,a,n,i,o,s,l,u;function v(d,y,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(y-d)*6*p:p<1/2?y:p<2/3?d+(y-d)*(2/3-p)*6:d}var f=new RegExp("^"+tl+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,o=f[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*v(h,c,a+1/3)),l=Math.round(255*v(h,c,a)),u=Math.round(255*v(h,c,a-1/3))}t=[s,l,u,o]}return t},ll=function(e){var t,a=new RegExp("^"+el+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(s&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},vl=function(e){return cl[e.toLowerCase()]},fl=function(e){return(Re(e)?e:null)||vl(e)||sl(e)||ll(e)||ul(e)},cl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},es=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Se(o))throw Error("Tried to set map with object key");i<a.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},rs=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(Se(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t};function dl(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}var vt=dl,ra=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Li<"u"?Li:typeof self<"u"?self:{};function hl(r,e){return e={exports:{}},r(e,e.exports),e.exports}var gl=typeof ra=="object"&&ra&&ra.Object===Object&&ra,pl=gl,yl=typeof self=="object"&&self&&self.Object===Object&&self,ml=pl||yl||Function("return this")(),ln=ml,bl=function(){return ln.Date.now()},Pn=bl,wl=/\s/;function xl(r){for(var e=r.length;e--&&wl.test(r.charAt(e)););return e}var El=xl,Cl=/^\s+/;function Sl(r){return r&&r.slice(0,El(r)+1).replace(Cl,"")}var Tl=Sl,Dl=ln.Symbol,Rt=Dl,ts=Object.prototype,kl=ts.hasOwnProperty,Pl=ts.toString,Qt=Rt?Rt.toStringTag:void 0;function Bl(r){var e=kl.call(r,Qt),t=r[Qt];try{r[Qt]=void 0;var a=!0}catch{}var n=Pl.call(r);return a&&(e?r[Qt]=t:delete r[Qt]),n}var Ml=Bl,Ll=Object.prototype,Al=Ll.toString;function Rl(r){return Al.call(r)}var Ol=Rl,Il="[object Null]",zl="[object Undefined]",Ii=Rt?Rt.toStringTag:void 0;function Nl(r){return r==null?r===void 0?zl:Il:Ii&&Ii in Object(r)?Ml(r):Ol(r)}var as=Nl;function Fl(r){return r!=null&&typeof r=="object"}var Vl=Fl,ql="[object Symbol]";function $l(r){return typeof r=="symbol"||Vl(r)&&as(r)==ql}var xa=$l,zi=NaN,Hl=/^[-+]0x[0-9a-f]+$/i,Gl=/^0b[01]+$/i,Kl=/^0o[0-7]+$/i,Wl=parseInt;function Ul(r){if(typeof r=="number")return r;if(xa(r))return zi;if(vt(r)){var e=typeof r.valueOf=="function"?r.valueOf():r;r=vt(e)?e+"":e}if(typeof r!="string")return r===0?r:+r;r=Tl(r);var t=Gl.test(r);return t||Kl.test(r)?Wl(r.slice(2),t?2:8):Hl.test(r)?zi:+r}var Ni=Ul,Yl="Expected a function",Xl=Math.max,Zl=Math.min;function Ql(r,e,t){var a,n,i,o,s,l,u=0,v=!1,f=!1,c=!0;if(typeof r!="function")throw new TypeError(Yl);e=Ni(e)||0,vt(t)&&(v=!!t.leading,f="maxWait"in t,i=f?Xl(Ni(t.maxWait)||0,e):i,c="trailing"in t?!!t.trailing:c);function h(E){var x=a,D=n;return a=n=void 0,u=E,o=r.apply(D,x),o}function d(E){return u=E,s=setTimeout(g,e),v?h(E):o}function y(E){var x=E-l,D=E-u,C=e-x;return f?Zl(C,i-D):C}function p(E){var x=E-l,D=E-u;return l===void 0||x>=e||x<0||f&&D>=i}function g(){var E=Pn();if(p(E))return m(E);s=setTimeout(g,y(E))}function m(E){return s=void 0,c&&a?h(E):(a=n=void 0,o)}function b(){s!==void 0&&clearTimeout(s),u=0,a=l=n=s=void 0}function w(){return s===void 0?o:m(Pn())}function S(){var E=Pn(),x=p(E);if(a=arguments,n=this,l=E,x){if(s===void 0)return d(l);if(f)return clearTimeout(s),s=setTimeout(g,e),h(l)}return s===void 0&&(s=setTimeout(g,e)),o}return S.cancel=b,S.flush=w,S}var vn=Ql,Bn=Ge?Ge.performance:null,ns=Bn&&Bn.now?function(){return Bn.now()}:function(){return Date.now()},Jl=function(){if(Ge){if(Ge.requestAnimationFrame)return function(r){Ge.requestAnimationFrame(r)};if(Ge.mozRequestAnimationFrame)return function(r){Ge.mozRequestAnimationFrame(r)};if(Ge.webkitRequestAnimationFrame)return function(r){Ge.webkitRequestAnimationFrame(r)};if(Ge.msRequestAnimationFrame)return function(r){Ge.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(ns())},1e3/60)}}(),Ja=function(e){return Jl(e)},qr=ns,Dt=9261,is=65599,ta=5381,os=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dt,a=t,n;n=e.next(),!n.done;)a=a*is+n.value|0;return a},la=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dt;return t*is+e|0},va=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ta;return(t<<5)+t+e|0},_l=function(e,t){return e*2097152+t},Wr=function(e){return e[0]*2097152+e[1]},Ba=function(e,t){return[la(e[0],t[0]),va(e[1],t[1])]},jl=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return os(o,t)},ft=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return os(o,t)},ss=function(){return ev(arguments)},ev=function(e){for(var t,a=0;a<e.length;a++){var n=e[a];a===0?t=ft(n):t=ft(n,t)}return t},Fi=!0,rv=console.warn!=null,tv=console.trace!=null,si=Number.MAX_SAFE_INTEGER||9007199254740991,us=function(){return!0},_a=function(){return!1},Vi=function(){return 0},ui=function(){},Ve=function(e){throw new Error(e)},ls=function(e){if(e!==void 0)Fi=!!e;else return Fi},Me=function(e){ls()&&(rv?console.warn(e):(console.log(e),tv&&console.trace()))},av=function(e){return be({},e)},Rr=function(e){return e==null?e:Re(e)?e.slice():Se(e)?av(e):e},nv=function(e){return e.slice()},vs=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},iv={},fs=function(){return iv},er=function(e){var t=Object.keys(e);return function(a){for(var n={},i=0;i<t.length;i++){var o=t[i],s=a==null?void 0:a[o];n[o]=s===void 0?e[o]:s}return n}},_r=function(e,t,a){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},li=function(e){e.splice(0,e.length)},ov=function(e,t){for(var a=0;a<t.length;a++){var n=t[a];e.push(n)}},kr=function(e,t,a){return a&&(t=_o(a,t)),e[t]},Yr=function(e,t,a,n){a&&(t=_o(a,t)),e[t]=n},sv=function(){function r(){ai(this,r),this._obj={}}return ni(r,[{key:"set",value:function(t,a){return this._obj[t]=a,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]}}]),r}(),Or=typeof Map<"u"?Map:sv,uv="undefined",lv=function(){function r(e){if(ai(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var a=0;a<t.length;a++)this.add(t[a])}}return ni(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var a=this._obj;a[t]!==1&&(a[t]=1,this.size++)}},{key:"delete",value:function(t){var a=this._obj;a[t]===1&&(a[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(a){return t.has(a)})}},{key:"forEach",value:function(t,a){return this.toArray().forEach(t,a)}}]),r}(),Ft=(typeof Set>"u"?"undefined":We(Set))!==uv?Set:lv,fn=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!ii(e)){Ve("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ve("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new Ft,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),l=e.zoom();i.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];Re(t.classes)?u=t.classes:de(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;v<f;v++){var c=u[v];!c||c===""||i.classes.add(c)}this.createEmitter();var h=t.style||t.css;h&&(Me("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h)),(a===void 0||a)&&this.restore()},qi=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;Se(a)&&!gr(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!Fe(n)?n:i,n=Fe(n)?n:function(){};for(var s=this._private.cy,l=a=de(a)?this.filter(a):a,u=[],v=[],f={},c={},h={},d=0,y,p=this.byGroup(),g=p.nodes,m=p.edges,b=0;b<l.length;b++){var w=l[b],S=w.id();w.isNode()&&(u.unshift(w),e.bfs&&(h[S]=!0,v.push(w)),c[S]=0)}for(var E=function(){var L=e.bfs?u.shift():u.pop(),k=L.id();if(e.dfs){if(h[k])return"continue";h[k]=!0,v.push(L)}var O=c[k],A=f[k],R=A!=null?A.source():null,I=A!=null?A.target():null,q=A==null?void 0:L.same(R)?I[0]:R[0],$=void 0;if($=n(L,A,q,d++,O),$===!0)return y=L,"break";if($===!1)return"break";for(var F=L.connectedEdges().filter(function(j){return(!i||j.source().same(L))&&m.has(j)}),N=0;N<F.length;N++){var W=F[N],Q=W.connectedNodes().filter(function(j){return!j.same(L)&&g.has(j)}),_=Q.id();Q.length!==0&&!h[_]&&(Q=Q[0],u.push(Q),e.bfs&&(h[_]=!0,v.push(Q)),f[_]=W,c[_]=c[k]+1)}};u.length!==0;){var x=E();if(x!=="continue"&&x==="break")break}for(var D=s.collection(),C=0;C<v.length;C++){var M=v[C],P=f[M.id()];P!=null&&D.push(P),D.push(M)}return{path:s.collection(D),found:s.collection(y)}}},fa={breadthFirstSearch:qi({bfs:!0}),depthFirstSearch:qi({dfs:!0})};fa.bfs=fa.breadthFirstSearch;fa.dfs=fa.depthFirstSearch;var vv=hl(function(r,e){(function(){var t,a,n,i,o,s,l,u,v,f,c,h,d,y,p;n=Math.floor,f=Math.min,a=function(g,m){return g<m?-1:g>m?1:0},v=function(g,m,b,w,S){var E;if(b==null&&(b=0),S==null&&(S=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);b<w;)E=n((b+w)/2),S(m,g[E])<0?w=E:b=E+1;return[].splice.apply(g,[b,b-b].concat(m)),m},s=function(g,m,b){return b==null&&(b=a),g.push(m),y(g,0,g.length-1,b)},o=function(g,m){var b,w;return m==null&&(m=a),b=g.pop(),g.length?(w=g[0],g[0]=b,p(g,0,m)):w=b,w},u=function(g,m,b){var w;return b==null&&(b=a),w=g[0],g[0]=m,p(g,0,b),w},l=function(g,m,b){var w;return b==null&&(b=a),g.length&&b(g[0],m)<0&&(w=[g[0],m],m=w[0],g[0]=w[1],p(g,0,b)),m},i=function(g,m){var b,w,S,E,x,D;for(m==null&&(m=a),E=(function(){D=[];for(var C=0,M=n(g.length/2);0<=M?C<M:C>M;0<=M?C++:C--)D.push(C);return D}).apply(this).reverse(),x=[],w=0,S=E.length;w<S;w++)b=E[w],x.push(p(g,b,m));return x},d=function(g,m,b){var w;if(b==null&&(b=a),w=g.indexOf(m),w!==-1)return y(g,0,w,b),p(g,w,b)},c=function(g,m,b){var w,S,E,x,D;if(b==null&&(b=a),S=g.slice(0,m),!S.length)return S;for(i(S,b),D=g.slice(m),E=0,x=D.length;E<x;E++)w=D[E],l(S,w,b);return S.sort(b).reverse()},h=function(g,m,b){var w,S,E,x,D,C,M,P,B;if(b==null&&(b=a),m*10<=g.length){if(E=g.slice(0,m).sort(b),!E.length)return E;for(S=E[E.length-1],M=g.slice(m),x=0,C=M.length;x<C;x++)w=M[x],b(w,S)<0&&(v(E,w,0,null,b),E.pop(),S=E[E.length-1]);return E}for(i(g,b),B=[],D=0,P=f(m,g.length);0<=P?D<P:D>P;0<=P?++D:--D)B.push(o(g,b));return B},y=function(g,m,b,w){var S,E,x;for(w==null&&(w=a),S=g[b];b>m;){if(x=b-1>>1,E=g[x],w(S,E)<0){g[b]=E,b=x;continue}break}return g[b]=S},p=function(g,m,b){var w,S,E,x,D;for(b==null&&(b=a),S=g.length,D=m,E=g[m],w=2*m+1;w<S;)x=w+1,x<S&&!(b(g[w],g[x])<0)&&(w=x),g[m]=g[w],m=w,w=2*m+1;return g[m]=E,y(g,D,m,b)},t=function(){g.push=s,g.pop=o,g.replace=u,g.pushpop=l,g.heapify=i,g.updateItem=d,g.nlargest=c,g.nsmallest=h;function g(m){this.cmp=m??a,this.nodes=[]}return g.prototype.push=function(m){return s(this.nodes,m,this.cmp)},g.prototype.pop=function(){return o(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},g.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},g.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(m){return d(this.nodes,m,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 m;return m=new g,m.nodes=this.nodes.slice(0),m},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,m){return r.exports=m()}(this,function(){return t})}).call(ra)}),Ea=vv,fv=er({root:null,weight:function(e){return 1},directed:!1}),cv={dijkstra:function(e){if(!Se(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var a=fv(e),n=a.root,i=a.weight,o=a.directed,s=this,l=i,u=de(n)?this.filter(n)[0]:n[0],v={},f={},c={},h=this.byGroup(),d=h.nodes,y=h.edges;y.unmergeBy(function(O){return O.isLoop()});for(var p=function(A){return v[A.id()]},g=function(A,R){v[A.id()]=R,m.updateItem(A)},m=new Ea(function(O,A){return p(O)-p(A)}),b=0;b<d.length;b++){var w=d[b];v[w.id()]=w.same(u)?0:1/0,m.push(w)}for(var S=function(A,R){for(var I=(o?A.edgesTo(R):A.edgesWith(R)).intersect(y),q=1/0,$,F=0;F<I.length;F++){var N=I[F],W=l(N);(W<q||!$)&&(q=W,$=N)}return{edge:$,dist:q}};m.size()>0;){var E=m.pop(),x=p(E),D=E.id();if(c[D]=x,x!==1/0)for(var C=E.neighborhood().intersect(d),M=0;M<C.length;M++){var P=C[M],B=P.id(),L=S(E,P),k=x+L.dist;k<p(P)&&(g(P,k),f[B]={node:E,edge:L.edge})}}return{distanceTo:function(A){var R=de(A)?d.filter(A)[0]:A[0];return c[R.id()]},pathTo:function(A){var R=de(A)?d.filter(A)[0]:A[0],I=[],q=R,$=q.id();if(R.length>0)for(I.unshift(R);f[$];){var F=f[$];I.unshift(F.edge),I.unshift(F.node),q=F.node,$=q.id()}return s.spawn(I)}}}},dv={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,o=new Array(i),s=a,l=function(w){for(var S=0;S<o.length;S++){var E=o[S];if(E.has(w))return S}},u=0;u<i;u++)o[u]=this.spawn(a[u]);for(var v=n.sort(function(b,w){return e(b)-e(w)}),f=0;f<v.length;f++){var c=v[f],h=c.source()[0],d=c.target()[0],y=l(h),p=l(d),g=o[y],m=o[p];y!==p&&(s.merge(c),g.merge(m),o.splice(p,1))}return s}},hv=er({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),gv={aStar:function(e){var t=this.cy(),a=hv(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,l=a.weight;n=t.collection(n)[0],i=t.collection(i)[0];var u=n.id(),v=i.id(),f={},c={},h={},d=new Ea(function($,F){return c[$.id()]-c[F.id()]}),y=new Ft,p={},g={},m=function(F,N){d.push(F),y.add(N)},b,w,S=function(){b=d.pop(),w=b.id(),y.delete(w)},E=function(F){return y.has(F)};m(n,u),f[u]=0,c[u]=o(n);for(var x=0;d.size()>0;){if(S(),x++,w===v){for(var D=[],C=i,M=v,P=g[M];D.unshift(C),P!=null&&D.unshift(P),C=p[M],C!=null;)M=C.id(),P=g[M];return{found:!0,distance:f[w],path:this.spawn(D),steps:x}}h[w]=!0;for(var B=b._private.edges,L=0;L<B.length;L++){var k=B[L];if(this.hasElementWithId(k.id())&&!(s&&k.data("source")!==w)){var O=k.source(),A=k.target(),R=O.id()!==w?O:A,I=R.id();if(this.hasElementWithId(I)&&!h[I]){var q=f[w]+l(k);if(!E(I)){f[I]=q,c[I]=q+o(R),m(R,I),p[I]=b,g[I]=k;continue}q<f[I]&&(f[I]=q,c[I]=q+o(R),p[I]=b,g[I]=k)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},pv=er({weight:function(e){return 1},directed:!1}),yv={floydWarshall:function(e){for(var t=this.cy(),a=pv(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),l=s.nodes,u=s.edges,v=l.length,f=v*v,c=function(W){return l.indexOf(W)},h=function(W){return l[W]},d=new Array(f),y=0;y<f;y++){var p=y%v,g=(y-p)/v;g===p?d[y]=0:d[y]=1/0}for(var m=new Array(f),b=new Array(f),w=0;w<u.length;w++){var S=u[w],E=S.source()[0],x=S.target()[0];if(E!==x){var D=c(E),C=c(x),M=D*v+C,P=o(S);if(d[M]>P&&(d[M]=P,m[M]=C,b[M]=S),!i){var B=C*v+D;!i&&d[B]>P&&(d[B]=P,m[B]=D,b[B]=S)}}}for(var L=0;L<v;L++)for(var k=0;k<v;k++)for(var O=k*v+L,A=0;A<v;A++){var R=k*v+A,I=L*v+A;d[O]+d[I]<d[R]&&(d[R]=d[O]+d[I],m[R]=m[O])}var q=function(W){return(de(W)?t.filter(W):W)[0]},$=function(W){return c(q(W))},F={distance:function(W,Q){var _=$(W),j=$(Q);return d[_*v+j]},path:function(W,Q){var _=$(W),j=$(Q),ee=h(_);if(_===j)return ee.collection();if(m[_*v+j]==null)return t.collection();var U=t.collection(),z=_,Y;for(U.merge(ee);_!==j;)z=_,_=m[_*v+j],Y=b[z*v+_],U.merge(Y),U.merge(h(_));return U}};return F}},mv=er({weight:function(e){return 1},directed:!1,root:null}),bv={bellmanFord:function(e){var t=this,a=mv(e),n=a.weight,i=a.directed,o=a.root,s=n,l=this,u=this.cy(),v=this.byGroup(),f=v.edges,c=v.nodes,h=c.length,d=new Or,y=!1,p=[];o=u.collection(o)[0],f.unmergeBy(function(ce){return ce.isLoop()});for(var g=f.length,m=function(ve){var pe=d.get(ve.id());return pe||(pe={},d.set(ve.id(),pe)),pe},b=function(ve){return(de(ve)?u.$(ve):ve)[0]},w=function(ve){return m(b(ve)).dist},S=function(ve){for(var pe=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,Pe=b(ve),Ee=[],xe=Pe;;){if(xe==null)return t.spawn();var Te=m(xe),J=Te.edge,T=Te.pred;if(Ee.unshift(xe[0]),xe.same(pe)&&Ee.length>0)break;J!=null&&Ee.unshift(J),xe=T}return l.spawn(Ee)},E=0;E<h;E++){var x=c[E],D=m(x);x.same(o)?D.dist=0:D.dist=1/0,D.pred=null,D.edge=null}for(var C=!1,M=function(ve,pe,Pe,Ee,xe,Te){var J=Ee.dist+Te;J<xe.dist&&!Pe.same(Ee.edge)&&(xe.dist=J,xe.pred=ve,xe.edge=Pe,C=!0)},P=1;P<h;P++){C=!1;for(var B=0;B<g;B++){var L=f[B],k=L.source(),O=L.target(),A=s(L),R=m(k),I=m(O);M(k,O,L,R,I,A),i||M(O,k,L,I,R,A)}if(!C)break}if(C)for(var q=[],$=0;$<g;$++){var F=f[$],N=F.source(),W=F.target(),Q=s(F),_=m(N).dist,j=m(W).dist;if(_+Q<j||!i&&j+Q<_)if(y||(Me("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var ee=[];_+Q<j&&ee.push(N),!i&&j+Q<_&&ee.push(W);for(var U=ee.length,z=0;z<U;z++){var Y=ee[z],X=[Y];X.push(m(Y).edge);for(var oe=m(Y).pred;X.indexOf(oe)===-1;)X.push(oe),X.push(m(oe).edge),oe=m(oe).pred;X=X.slice(X.indexOf(oe));for(var he=X[0].id(),ae=0,ie=2;ie<X.length;ie+=2)X[ie].id()<he&&(he=X[ie].id(),ae=ie);X=X.slice(ae).concat(X.slice(0,ae)),X.push(X[0]);var ue=X.map(function(ce){return ce.id()}).join(",");q.indexOf(ue)===-1&&(p.push(l.spawn(X)),q.push(ue))}}else break}return{distanceTo:w,pathTo:S,hasNegativeWeightCycle:y,negativeWeightCycles:p}}},wv=Math.sqrt(2),xv=function(e,t,a){a.length===0&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=t[i],l=t[o],u=a,v=u.length-1;v>=0;v--){var f=u[v],c=f[1],h=f[2];(t[c]===s&&t[h]===l||t[c]===l&&t[h]===s)&&u.splice(v,1)}for(var d=0;d<u.length;d++){var y=u[d];y[1]===l?(u[d]=y.slice(),u[d][1]=s):y[2]===l&&(u[d]=y.slice(),u[d][2]=s)}for(var p=0;p<t.length;p++)t[p]===l&&(t[p]=s);return u},Mn=function(e,t,a,n){for(;a>n;){var i=Math.floor(Math.random()*t.length);t=xv(i,e,t),a--}return t},Ev={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(I){return I.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/wv);if(i<2){Ve("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],v=0;v<o;v++){var f=n[v];u.push([v,a.indexOf(f.source()),a.indexOf(f.target())])}for(var c=1/0,h=[],d=new Array(i),y=new Array(i),p=new Array(i),g=function(q,$){for(var F=0;F<i;F++)$[F]=q[F]},m=0;m<=s;m++){for(var b=0;b<i;b++)y[b]=b;var w=Mn(y,u.slice(),i,l),S=w.slice();g(y,p);var E=Mn(y,w,l,2),x=Mn(p,S,l,2);E.length<=x.length&&E.length<c?(c=E.length,h=E,g(y,d)):x.length<=E.length&&x.length<c&&(c=x.length,h=x,g(p,d))}for(var D=this.spawn(h.map(function(I){return n[I[0]]})),C=this.spawn(),M=this.spawn(),P=d[0],B=0;B<d.length;B++){var L=d[B],k=a[B];L===P?C.merge(k):M.merge(k)}var O=function(q){var $=e.spawn();return q.forEach(function(F){$.merge(F),F.connectedEdges().forEach(function(N){e.contains(N)&&!D.contains(N)&&$.merge(N)})}),$},A=[O(C),O(M)],R={cut:D,components:A,partition1:C,partition2:M};return R}},Cv=function(e){return{x:e.x,y:e.y}},cn=function(e,t,a){return{x:e.x*t+a.x,y:e.y*t+a.y}},cs=function(e,t,a){return{x:(e.x-a.x)/t,y:(e.y-a.y)/t}},kt=function(e){return{x:e[0],y:e[1]}},Sv=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},Tv=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},Dv=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=t;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},kv=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a<e.length&&e.splice(a,e.length-a),t>0&&e.splice(0,t));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,s++):e.splice(l,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},Pv=function(e){return Math.PI*e/180},Ma=function(e,t){return Math.atan2(t,e)-Math.PI/2},vi=Math.log2||function(r){return Math.log(r)/Math.log(2)},ds=function(e){return e>0?1:e<0?-1:0},ct=function(e,t){return Math.sqrt(it(e,t))},it=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Bv=function(e){for(var t=e.length,a=0,n=0;n<t;n++)a+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/a;return e},Xe=function(e,t,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*a},Bt=function(e,t,a,n){return{x:Xe(e.x,t.x,a.x,n),y:Xe(e.y,t.y,a.y,n)}},Mv=function(e,t,a,n){var i={x:t.x-e.x,y:t.y-e.y},o=ct(e,t),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},ca=function(e,t,a){return Math.max(e,Math.min(a,t))},hr=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}}},Lv=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Av=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Rv=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},hs=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},Ov=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},$a=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},Ha=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(t.length===1)a=n=i=o=t[0];else if(t.length===2)a=i=t[0],o=n=t[1];else if(t.length===4){var s=Tr(t,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},$i=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},fi=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)},Ot=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Iv=function(e,t){return Ot(e,t.x,t.y)},gs=function(e,t){return Ot(e,t.x1,t.y1)&&Ot(e,t.x2,t.y2)},ps=function(e,t,a,n,i,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?dt(i,o):l,v=i/2,f=o/2;u=Math.min(u,v,f);var c=u!==v,h=u!==f,d;if(c){var y=a-v+u-s,p=n-f-s,g=a+v-u+s,m=p;if(d=Xr(e,t,a,n,y,p,g,m,!1),d.length>0)return d}if(h){var b=a+v+s,w=n-f+u-s,S=b,E=n+f-u+s;if(d=Xr(e,t,a,n,b,w,S,E,!1),d.length>0)return d}if(c){var x=a-v+u-s,D=n+f+s,C=a+v-u+s,M=D;if(d=Xr(e,t,a,n,x,D,C,M,!1),d.length>0)return d}if(h){var P=a-v-s,B=n-f+u-s,L=P,k=n+f-u+s;if(d=Xr(e,t,a,n,P,B,L,k,!1),d.length>0)return d}var O;{var A=a-v+u,R=n-f+u;if(O=aa(e,t,a,n,A,R,u+s),O.length>0&&O[0]<=A&&O[1]<=R)return[O[0],O[1]]}{var I=a+v-u,q=n-f+u;if(O=aa(e,t,a,n,I,q,u+s),O.length>0&&O[0]>=I&&O[1]<=q)return[O[0],O[1]]}{var $=a+v-u,F=n+f-u;if(O=aa(e,t,a,n,$,F,u+s),O.length>0&&O[0]>=$&&O[1]>=F)return[O[0],O[1]]}{var N=a-v+u,W=n+f-u;if(O=aa(e,t,a,n,N,W,u+s),O.length>0&&O[0]<=N&&O[1]>=W)return[O[0],O[1]]}return[]},zv=function(e,t,a,n,i,o,s){var l=s,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,o),c=Math.max(n,o);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},Nv=function(e,t,a,n,i,o,s,l,u){var v={x1:Math.min(a,s,i)-u,x2:Math.max(a,s,i)+u,y1:Math.min(n,l,o)-u,y2:Math.max(n,l,o)+u};return!(e<v.x1||e>v.x2||t<v.y1||t>v.y2)},Fv=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,l=(-t+o)/s,u=(-t-o)/s;return[l,u]},Vv=function(e,t,a,n,i){var o=1e-5;e===0&&(e=o),t/=e,a/=e,n/=e;var s,l,u,v,f,c,h,d;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,s=l*l*l+u*u,i[1]=0,h=t/3,s>0){f=u+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=u-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),d=2*Math.sqrt(l),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)},qv=function(e,t,a,n,i,o,s,l){var u=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*l+4*o*o-4*o*l+l*l,v=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*l-6*o*o+3*o*l,f=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*l-n*t+2*o*o+2*o*t-l*t,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*t-o*t,h=[];Vv(u,v,f,c,h);for(var d=1e-7,y=[],p=0;p<6;p+=2)Math.abs(h[p+1])<d&&h[p]>=0&&h[p]<=1&&y.push(h[p]);y.push(1),y.push(0);for(var g=-1,m,b,w,S=0;S<y.length;S++)m=Math.pow(1-y[S],2)*a+2*(1-y[S])*y[S]*i+y[S]*y[S]*s,b=Math.pow(1-y[S],2)*n+2*(1-y[S])*y[S]*o+y[S]*y[S]*l,w=Math.pow(m-e,2)+Math.pow(b-t,2),g>=0?w<g&&(g=w):g=w;return g},$v=function(e,t,a,n,i,o){var s=[e-a,t-n],l=[i-a,o-n],u=l[0]*l[0]+l[1]*l[1],v=s[0]*s[0]+s[1]*s[1],f=s[0]*l[0]+s[1]*l[1],c=f*f/u;return f<0?v:c>u?(e-i)*(e-i)+(t-o)*(t-o):v-c},dr=function(e,t,a){for(var n,i,o,s,l,u=0,v=0;v<a.length/2;v++)if(n=a[v*2],i=a[v*2+1],v+1<a.length/2?(o=a[(v+1)*2],s=a[(v+1)*2+1]):(o=a[(v+1-a.length/2)*2],s=a[(v+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)l=(e-n)/(o-n)*(s-i)+i,l>t&&u++;else continue;return u%2!==0},$r=function(e,t,a,n,i,o,s,l,u){var v=new Array(a.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d<v.length/2;d++)v[d*2]=o/2*(a[d*2]*c-a[d*2+1]*h),v[d*2+1]=s/2*(a[d*2+1]*c+a[d*2]*h),v[d*2]+=n,v[d*2+1]+=i;var y;if(u>0){var p=en(v,-u);y=ja(p)}else y=v;return dr(e,t,y)},Hv=function(e,t,a,n,i,o,s,l){for(var u=new Array(a.length*2),v=0;v<l.length;v++){var f=l[v];u[v*4+0]=f.startX,u[v*4+1]=f.startY,u[v*4+2]=f.stopX,u[v*4+3]=f.stopY;var c=Math.pow(f.cx-e,2)+Math.pow(f.cy-t,2);if(c<=Math.pow(f.radius,2))return!0}return dr(e,t,u)},ja=function(e){for(var t=new Array(e.length/2),a,n,i,o,s,l,u,v,f=0;f<e.length/4;f++){a=e[f*4],n=e[f*4+1],i=e[f*4+2],o=e[f*4+3],f<e.length/4-1?(s=e[(f+1)*4],l=e[(f+1)*4+1],u=e[(f+1)*4+2],v=e[(f+1)*4+3]):(s=e[0],l=e[1],u=e[2],v=e[3]);var c=Xr(a,n,i,o,s,l,u,v,!0);t[f*2]=c[0],t[f*2+1]=c[1]}return t},en=function(e,t){for(var a=new Array(e.length*2),n,i,o,s,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(o=e[(l+1)*2],s=e[(l+1)*2+1]):(o=e[0],s=e[1]);var u=s-i,v=-(o-n),f=Math.sqrt(u*u+v*v),c=u/f,h=v/f;a[l*4]=n+c*t,a[l*4+1]=i+h*t,a[l*4+2]=o+c*t,a[l*4+3]=s+h*t}return a},Gv=function(e,t,a,n,i,o){var s=a-e,l=n-t;s/=i,l/=o;var u=Math.sqrt(s*s+l*l),v=u-1;if(v<0)return[];var f=v/u;return[(a-e)*f+e,(n-t)*f+t]},lt=function(e,t,a,n,i,o,s){return e-=i,t-=o,e/=a/2+s,t/=n/2+s,e*e+t*t<=1},aa=function(e,t,a,n,i,o,s){var l=[a-e,n-t],u=[e-i,t-o],v=l[0]*l[0]+l[1]*l[1],f=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-s*s,h=f*f-4*v*c;if(h<0)return[];var d=(-f+Math.sqrt(h))/(2*v),y=(-f-Math.sqrt(h))/(2*v),p=Math.min(d,y),g=Math.max(d,y),m=[];if(p>=0&&p<=1&&m.push(p),g>=0&&g<=1&&m.push(g),m.length===0)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var S=m[1]*l[0]+e,E=m[1]*l[1]+t;return[b,w,S,E]}else return[b,w]},Ln=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},Xr=function(e,t,a,n,i,o,s,l,u){var v=e-i,f=a-e,c=s-i,h=t-o,d=n-t,y=l-o,p=c*h-y*v,g=f*h-d*v,m=y*f-c*d;if(m!==0){var b=p/m,w=g/m,S=.001,E=0-S,x=1+S;return E<=b&&b<=x&&E<=w&&w<=x?[e+b*f,t+b*d]:u?[e+b*f,t+b*d]:[]}else return p===0||g===0?Ln(e,a,s)===s?[s,l]:Ln(e,a,i)===i?[i,o]:Ln(i,s,a)===a?[a,n]:[]:[]},da=function(e,t,a,n,i,o,s,l){var u=[],v,f=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d<f.length/2;d++)f[d*2]=a[d*2]*o+n,f[d*2+1]=a[d*2+1]*s+i;if(l>0){var y=en(f,-l);h=ja(y)}else h=f}else h=a;for(var p,g,m,b,w=0;w<h.length/2;w++)p=h[w*2],g=h[w*2+1],w<h.length/2-1?(m=h[(w+1)*2],b=h[(w+1)*2+1]):(m=h[0],b=h[1]),v=Xr(e,t,n,i,p,g,m,b),v.length!==0&&u.push(v[0],v[1]);return u},Kv=function(e,t,a,n,i,o,s,l,u){var v=[],f,c=new Array(a.length*2);u.forEach(function(m,b){b===0?(c[c.length-2]=m.startX,c[c.length-1]=m.startY):(c[b*4-2]=m.startX,c[b*4-1]=m.startY),c[b*4]=m.stopX,c[b*4+1]=m.stopY,f=aa(e,t,n,i,m.cx,m.cy,m.radius),f.length!==0&&v.push(f[0],f[1])});for(var h=0;h<c.length/4;h++)f=Xr(e,t,n,i,c[h*4],c[h*4+1],c[h*4+2],c[h*4+3],!1),f.length!==0&&v.push(f[0],f[1]);if(v.length>2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),p=1;p<v.length/2;p++){var g=Math.pow(v[p*2]-e,2)+Math.pow(v[p*2+1]-t,2);g<=y&&(d[0]=v[p*2],d[1]=v[p*2+1],y=g)}return d}return v},La=function(e,t,a){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[t[0]+o*n[0],t[1]+o*n[1]]},vr=function(e,t){var a=$n(e,t);return a=ys(a),a},ys=function(e){for(var t,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u<n;u++)t=e[2*u],a=e[2*u+1],i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,a),l=Math.max(l,a);for(var v=2/(s-i),f=2/(l-o),c=0;c<n;c++)t=e[2*c]=e[2*c]*v,a=e[2*c+1]=e[2*c+1]*f,i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,a),l=Math.max(l,a);if(o<-1)for(var h=0;h<n;h++)a=e[2*h+1]=e[2*h+1]+(-1-o);return e},$n=function(e,t){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=t;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},dt=function(e,t){return Math.min(e/4,t/4,8)},ms=function(e,t){return Math.min(e/10,t/10,8)},ci=function(){return 8},Wv=function(e,t,a){return[e-2*t+a,2*(t-e),e]},Hn=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Uv=er({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Yv={pageRank:function(e){for(var t=Uv(e),a=t.dampingFactor,n=t.precision,i=t.iterations,o=t.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,v=l.edges,f=u.length,c=f*f,h=v.length,d=new Array(c),y=new Array(f),p=(1-a)/f,g=0;g<f;g++){for(var m=0;m<f;m++){var b=g*f+m;d[b]=0}y[g]=0}for(var w=0;w<h;w++){var S=v[w],E=S.data("source"),x=S.data("target");if(E!==x){var D=u.indexOfId(E),C=u.indexOfId(x),M=o(S),P=C*f+D;d[P]+=M,y[D]+=M}}for(var B=1/f+p,L=0;L<f;L++)if(y[L]===0)for(var k=0;k<f;k++){var O=k*f+L;d[O]=B}else for(var A=0;A<f;A++){var R=A*f+L;d[R]=d[R]/y[L]+p}for(var I=new Array(f),q=new Array(f),$,F=0;F<f;F++)I[F]=1;for(var N=0;N<i;N++){for(var W=0;W<f;W++)q[W]=0;for(var Q=0;Q<f;Q++)for(var _=0;_<f;_++){var j=Q*f+_;q[Q]+=d[j]*I[_]}Bv(q),$=I,I=q,q=$;for(var ee=0,U=0;U<f;U++){var z=$[U]-I[U];ee+=z*z}if(ee<n)break}var Y={rank:function(oe){return oe=s.collection(oe)[0],I[u.indexOf(oe)]}};return Y}},Hi=er({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Mt={degreeCentralityNormalized:function(e){e=Hi(e);var t=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var v={},f={},c=0,h=0,d=0;d<n;d++){var y=a[d],p=y.id();e.root=y;var g=this.degreeCentrality(e);c<g.indegree&&(c=g.indegree),h<g.outdegree&&(h=g.outdegree),v[p]=g.indegree,f[p]=g.outdegree}return{indegree:function(b){return c==0?0:(de(b)&&(b=t.filter(b)),v[b.id()]/c)},outdegree:function(b){return h===0?0:(de(b)&&(b=t.filter(b)),f[b.id()]/h)}}}else{for(var i={},o=0,s=0;s<n;s++){var l=a[s];e.root=l;var u=this.degreeCentrality(e);o<u.degree&&(o=u.degree),i[l.id()]=u.degree}return{degree:function(b){return o===0?0:(de(b)&&(b=t.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=Hi(e);var t=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,l=n.alpha;if(i=t.collection(i)[0],s){for(var h=i.connectedEdges(),d=h.filter(function(E){return E.target().same(i)&&a.has(E)}),y=h.filter(function(E){return E.source().same(i)&&a.has(E)}),p=d.length,g=y.length,m=0,b=0,w=0;w<d.length;w++)m+=o(d[w]);for(var S=0;S<y.length;S++)b+=o(y[S]);return{indegree:Math.pow(p,1-l)*Math.pow(m,l),outdegree:Math.pow(g,1-l)*Math.pow(b,l)}}else{for(var u=i.connectedEdges().intersection(a),v=u.length,f=0,c=0;c<u.length;c++)f+=o(u[c]);return{degree:Math.pow(v,1-l)*Math.pow(f,l)}}}};Mt.dc=Mt.degreeCentrality;Mt.dcn=Mt.degreeCentralityNormalised=Mt.degreeCentralityNormalized;var Gi=er({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Lt={closenessCentralityNormalized:function(e){for(var t=Gi(e),a=t.harmonic,n=t.weight,i=t.directed,o=this.cy(),s={},l=0,u=this.nodes(),v=this.floydWarshall({weight:n,directed:i}),f=0;f<u.length;f++){for(var c=0,h=u[f],d=0;d<u.length;d++)if(f!==d){var y=v.distance(h,u[d]);a?c+=1/y:c+=y}a||(c=1/c),l<c&&(l=c),s[h.id()]=c}return{closeness:function(g){return l==0?0:(de(g)?g=o.filter(g)[0].id():g=g.id(),s[g]/l)}}},closenessCentrality:function(e){var t=Gi(e),a=t.root,n=t.weight,i=t.directed,o=t.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),v=0;v<u.length;v++){var f=u[v];if(!f.same(a)){var c=s.distanceTo(f);o?l+=1/c:l+=c}}return o?l:1/l}};Lt.cc=Lt.closenessCentrality;Lt.ccn=Lt.closenessCentralityNormalised=Lt.closenessCentralityNormalized;var Xv=er({weight:null,directed:!1}),Gn={betweennessCentrality:function(e){for(var t=Xv(e),a=t.directed,n=t.weight,i=n!=null,o=this.cy(),s=this.nodes(),l={},u={},v=0,f={set:function(b,w){u[b]=w,w>v&&(v=w)},get:function(b){return u[b]}},c=0;c<s.length;c++){var h=s[c],d=h.id();a?l[d]=h.outgoers().nodes():l[d]=h.openNeighborhood().nodes(),f.set(d,0)}for(var y=function(b){for(var w=s[b].id(),S=[],E={},x={},D={},C=new Ea(function(_,j){return D[_]-D[j]}),M=0;M<s.length;M++){var P=s[M].id();E[P]=[],x[P]=0,D[P]=1/0}for(x[w]=1,D[w]=0,C.push(w);!C.empty();){var B=C.pop();if(S.push(B),i)for(var L=0;L<l[B].length;L++){var k=l[B][L],O=o.getElementById(B),A=void 0;O.edgesTo(k).length>0?A=O.edgesTo(k)[0]:A=k.edgesTo(O)[0];var R=n(A);k=k.id(),D[k]>D[B]+R&&(D[k]=D[B]+R,C.nodes.indexOf(k)<0?C.push(k):C.updateItem(k),x[k]=0,E[k]=[]),D[k]==D[B]+R&&(x[k]=x[k]+x[B],E[k].push(B))}else for(var I=0;I<l[B].length;I++){var q=l[B][I].id();D[q]==1/0&&(C.push(q),D[q]=D[B]+1),D[q]==D[B]+1&&(x[q]=x[q]+x[B],E[q].push(B))}}for(var $={},F=0;F<s.length;F++)$[s[F].id()]=0;for(;S.length>0;){for(var N=S.pop(),W=0;W<E[N].length;W++){var Q=E[N][W];$[Q]=$[Q]+x[Q]/x[N]*(1+$[N])}N!=s[b].id()&&f.set(N,f.get(N)+$[N])}},p=0;p<s.length;p++)y(p);var g={betweenness:function(b){var w=o.collection(b).id();return f.get(w)},betweennessNormalized:function(b){if(v==0)return 0;var w=o.collection(b).id();return f.get(w)/v}};return g.betweennessNormalised=g.betweennessNormalized,g}};Gn.bc=Gn.betweennessCentrality;var Zv=er({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Qv=function(e){return Zv(e)},Jv=function(e,t){for(var a=0,n=0;n<t.length;n++)a+=t[n](e);return a},_v=function(e,t,a){for(var n=0;n<t;n++)e[n*t+n]=a},bs=function(e,t){for(var a,n=0;n<t;n++){a=0;for(var i=0;i<t;i++)a+=e[i*t+n];for(var o=0;o<t;o++)e[o*t+n]=e[o*t+n]/a}},jv=function(e,t,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+s]*t[s*a+l]}return n},ef=function(e,t,a){for(var n=e.slice(0),i=1;i<a;i++)e=jv(e,n,t);return e},rf=function(e,t,a){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],a);return bs(n,t),n},tf=function(e,t,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},af=function(e,t,a,n){for(var i=[],o=0;o<t;o++){for(var s=[],l=0;l<t;l++)Math.round(e[o*t+l]*1e3)/1e3>0&&s.push(a[l]);s.length!==0&&i.push(n.collection(s))}return i},nf=function(e,t){for(var a=0;a<e.length;a++)if(!t[a]||e[a].id()!==t[a].id())return!1;return!0},of=function(e){for(var t=0;t<e.length;t++)for(var a=0;a<e.length;a++)t!=a&&nf(e[t],e[a])&&e.splice(a,1);return e},Ki=function(e){for(var t=this.nodes(),a=this.edges(),n=this.cy(),i=Qv(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var l=t.length,u=l*l,v=new Array(u),f,c=0;c<u;c++)v[c]=0;for(var h=0;h<a.length;h++){var d=a[h],y=o[d.source().id()],p=o[d.target().id()],g=Jv(d,i.attributes);v[y*l+p]+=g,v[p*l+y]+=g}_v(v,l,i.multFactor),bs(v,l);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,f=ef(v,l,i.expandFactor),v=rf(f,l,i.inflateFactor),tf(v,f,u,4)||(m=!0),b++;var w=af(v,l,t,n);return w=of(w),w},sf={markovClustering:Ki,mcl:Ki},uf=function(e){return e},ws=function(e,t){return Math.abs(t-e)},Wi=function(e,t,a){return e+ws(t,a)},Ui=function(e,t,a){return e+Math.pow(a-t,2)},lf=function(e){return Math.sqrt(e)},vf=function(e,t,a){return Math.max(e,ws(t,a))},Jt=function(e,t,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:uf,s=n,l,u,v=0;v<e;v++)l=t(v),u=a(v),s=i(s,l,u);return o(s)},It={euclidean:function(e,t,a){return e>=2?Jt(e,t,a,0,Ui,lf):Jt(e,t,a,0,Wi)},squaredEuclidean:function(e,t,a){return Jt(e,t,a,0,Ui)},manhattan:function(e,t,a){return Jt(e,t,a,0,Wi)},max:function(e,t,a){return Jt(e,t,a,-1/0,vf)}};It["squared-euclidean"]=It.squaredEuclidean;It.squaredeuclidean=It.squaredEuclidean;function dn(r,e,t,a,n,i){var o;return Fe(r)?o=r:o=It[r]||It.euclidean,e===0&&Fe(r)?o(n,i):o(e,t,a,n,i)}var ff=er({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),di=function(e){return ff(e)},rn=function(e,t,a,n,i){var o=i!=="kMedoids",s=o?function(f){return a[f]}:function(f){return n[f](a)},l=function(c){return n[c](t)},u=a,v=t;return dn(e,n.length,s,l,u,v)},An=function(e,t,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(t),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,o[u]=e.max(a[u]).value;for(var v=0;v<t;v++){l=[];for(var f=0;f<n;f++)l[f]=Math.random()*(o[f]-i[f])+i[f];s[v]=l}return s},xs=function(e,t,a,n,i){for(var o=1/0,s=0,l=0;l<t.length;l++){var u=rn(a,e,t[l],n,i);u<o&&(o=u,s=l)}return s},Es=function(e,t,a){for(var n=[],i=null,o=0;o<t.length;o++)i=t[o],a[i.id()]===e&&n.push(i);return n},cf=function(e,t,a){return Math.abs(t-e)<=a},df=function(e,t,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-t[n][i]);if(o>a)return!1}return!0},hf=function(e,t,a){for(var n=0;n<a;n++)if(e===t[n])return!0;return!1},Yi=function(e,t){var a=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];hf(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<t;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},Xi=function(e,t,a){for(var n=0,i=0;i<t.length;i++)n+=rn("manhattan",t[i],e,a,"kMedoids");return n},gf=function(e){var t=this.cy(),a=this.nodes(),n=null,i=di(e),o=new Array(i.k),s={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=An(a,i.k,i.attributes)):We(i.testCentroids)==="object"?l=i.testCentroids:l=An(a,i.k,i.attributes):l=An(a,i.k,i.attributes);for(var u=!0,v=0;u&&v<i.maxIterations;){for(var f=0;f<a.length;f++)n=a[f],s[n.id()]=xs(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var h=Es(c,a,s);if(h.length!==0){for(var d=i.attributes.length,y=l[c],p=new Array(d),g=new Array(d),m=0;m<d;m++){g[m]=0;for(var b=0;b<h.length;b++)n=h[b],g[m]+=i.attributes[m](n);p[m]=g[m]/h.length,cf(p[m],y[m],i.sensitivityThreshold)||(u=!0)}l[c]=p,o[c]=t.collection(h)}}v++}return o},pf=function(e){var t=this.cy(),a=this.nodes(),n=null,i=di(e),o=new Array(i.k),s,l={},u,v=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(We(i.testCentroids)==="object"?s=i.testCentroids:s=Yi(a,i.k)):s=Yi(a,i.k);for(var f=!0,c=0;f&&c<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],l[n.id()]=xs(n,s,i.distance,i.attributes,"kMedoids");f=!1;for(var d=0;d<s.length;d++){var y=Es(d,a,l);if(y.length!==0){v[d]=Xi(s[d],y,i.attributes);for(var p=0;p<y.length;p++)u=Xi(y[p],y,i.attributes),u<v[d]&&(v[d]=u,s[d]=y[p],f=!0);o[d]=t.collection(y)}}c++}return o},yf=function(e,t,a,n,i){for(var o,s,l=0;l<t.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var v=0;v<e.length;v++)for(var f=0;f<i.attributes.length;f++){o=0,s=0;for(var c=0;c<t.length;c++)o+=n[c][v]*i.attributes[f](t[c]),s+=n[c][v];e[v][f]=o/s}},mf=function(e,t,a,n,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var s,l,u,v=2/(i.m-1),f=0;f<a.length;f++)for(var c=0;c<n.length;c++){s=0;for(var h=0;h<a.length;h++)l=rn(i.distance,n[c],a[f],i.attributes,"cmeans"),u=rn(i.distance,n[c],a[h],i.attributes,"cmeans"),s+=Math.pow(l/u,v);e[c][f]=1/s}},bf=function(e,t,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,l,u=0;u<t.length;u++){s=-1/0,l=-1;for(var v=0;v<t[0].length;v++)t[u][v]>s&&(s=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f<i.length;f++)i[f]=n.collection(i[f]);return i},Zi=function(e){var t=this.cy(),a=this.nodes(),n=di(e),i,o,s,l,u;l=new Array(a.length);for(var v=0;v<a.length;v++)l[v]=new Array(n.k);s=new Array(a.length);for(var f=0;f<a.length;f++)s[f]=new Array(n.k);for(var c=0;c<a.length;c++){for(var h=0,d=0;d<n.k;d++)s[c][d]=Math.random(),h+=s[c][d];for(var y=0;y<n.k;y++)s[c][y]=s[c][y]/h}o=new Array(n.k);for(var p=0;p<n.k;p++)o[p]=new Array(n.attributes.length);u=new Array(a.length);for(var g=0;g<a.length;g++)u[g]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,yf(o,a,s,u,n),mf(s,l,o,a,n),df(s,l,n.sensitivityThreshold)||(m=!0),b++;return i=bf(a,s,n,t),{clusters:i,degreeOfMembership:s}},wf={kMeans:gf,kMedoids:pf,fuzzyCMeans:Zi,fcm:Zi},xf=er({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Ef={single:"min",complete:"max"},Cf=function(e){var t=xf(e),a=Ef[t.linkage];return a!=null&&(t.linkage=a),t},Qi=function(e,t,a,n,i){for(var o=0,s=1/0,l,u=i.attributes,v=function(C,M){return dn(i.distance,u.length,function(P){return u[P](C)},function(P){return u[P](M)},C,M)},f=0;f<e.length;f++){var c=e[f].key,h=a[c][n[c]];h<s&&(o=c,s=h)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[o],y=t[n[o]],p;i.mode==="dendrogram"?p={left:d,right:y,key:d.key}:p={value:d.value.concat(y.value),key:d.key},e[d.index]=p,e.splice(y.index,1),t[d.key]=p;for(var g=0;g<e.length;g++){var m=e[g];d.key===m.key?l=1/0:i.linkage==="min"?(l=a[d.key][m.key],a[d.key][m.key]>a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]<a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="mean"?l=(a[d.key][m.key]*d.size+a[y.key][m.key]*y.size)/(d.size+y.size):i.mode==="dendrogram"?l=v(m.value,d.value):l=v(m.value[0],d.value[0]),a[d.key][m.key]=a[m.key][d.key]=l}for(var b=0;b<e.length;b++){var w=e[b].key;if(n[w]===d.key||n[w]===y.key){for(var S=w,E=0;E<e.length;E++){var x=e[E].key;a[w][x]<a[w][S]&&(S=x)}n[w]=S}e[b].index=b}return d.key=y.key=d.index=y.index=null,!0},Aa=function r(e,t,a){e&&(e.value?t.push(e.value):(e.left&&r(e.left,t),e.right&&r(e.right,t)))},Sf=function r(e,t){if(!e)return"";if(e.left&&e.right){var a=r(e.left,t),n=r(e.right,t),i=t.add({group:"nodes",data:{id:a+","+n}});return t.add({group:"edges",data:{source:a,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Tf=function r(e,t,a){if(!e)return[];var n=[],i=[],o=[];return t===0?(e.left&&Aa(e.left,n),e.right&&Aa(e.right,i),o=n.concat(i),[a.collection(o)]):t===1?e.value?[a.collection(e.value)]:(e.left&&Aa(e.left,n),e.right&&Aa(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=r(e.left,t-1,a)),e.right&&(i=r(e.right,t-1,a)),n.concat(i))},Ji=function(e){for(var t=this.cy(),a=this.nodes(),n=Cf(e),i=n.attributes,o=function(b,w){return dn(n.distance,i.length,function(S){return i[S](b)},function(S){return i[S](w)},b,w)},s=[],l=[],u=[],v=[],f=0;f<a.length;f++){var c={value:n.mode==="dendrogram"?a[f]:[a[f]],key:f,index:f};s[f]=c,v[f]=c,l[f]=[],u[f]=0}for(var h=0;h<s.length;h++)for(var d=0;d<=h;d++){var y=void 0;n.mode==="dendrogram"?y=h===d?1/0:o(s[h].value,s[d].value):y=h===d?1/0:o(s[h].value[0],s[d].value[0]),l[h][d]=y,l[d][h]=y,y<l[h][u[h]]&&(u[h]=d)}for(var p=Qi(s,v,l,u,n);p;)p=Qi(s,v,l,u,n);var g;return n.mode==="dendrogram"?(g=Tf(s[0],n.dendrogramDepth,t),n.addDendrogram&&Sf(s[0],t)):(g=new Array(s.length),s.forEach(function(m,b){m.key=m.index=null,g[b]=t.collection(m.value)})),g},Df={hierarchicalClustering:Ji,hca:Ji},kf=er({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Pf=function(e){var t=e.damping,a=e.preference;.5<=t&&t<1||Ve("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ne(a)||Ve("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),kf(e)},Bf=function(e,t,a,n){var i=function(s,l){return n[l](s)};return-dn(e,n.length,function(o){return i(t,o)},function(o){return i(a,o)},t,a)},Mf=function(e,t){var a=null;return t==="median"?a=kv(e):t==="mean"?a=Dv(e):t==="min"?a=Sv(e):t==="max"?a=Tv(e):a=t,a},Lf=function(e,t,a){for(var n=[],i=0;i<e;i++)t[i*e+i]+a[i*e+i]>0&&n.push(i);return n},_i=function(e,t,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,l=0;l<a.length;l++){var u=a[l];t[i*e+u]>s&&(o=u,s=t[i*e+u])}o>0&&n.push(o)}for(var v=0;v<a.length;v++)n[a[v]]=a[v];return n},Af=function(e,t,a){for(var n=_i(e,t,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var l=-1,u=-1/0,v=0;v<o.length;v++){for(var f=0,c=0;c<o.length;c++)f+=t[o[c]*e+o[v]];f>u&&(l=v,u=f)}a[i]=o[l]}return n=_i(e,t,a),n},ji=function(e){for(var t=this.cy(),a=this.nodes(),n=Pf(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,l,u,v,f,c;s=a.length,l=s*s,u=new Array(l);for(var h=0;h<l;h++)u[h]=-1/0;for(var d=0;d<s;d++)for(var y=0;y<s;y++)d!==y&&(u[d*s+y]=Bf(n.distance,a[d],a[y],n.attributes));v=Mf(u,n.preference);for(var p=0;p<s;p++)u[p*s+p]=v;f=new Array(l);for(var g=0;g<l;g++)f[g]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var b=new Array(s),w=new Array(s),S=new Array(s),E=0;E<s;E++)b[E]=0,w[E]=0,S[E]=0;for(var x=new Array(s*n.minIterations),D=0;D<x.length;D++)x[D]=0;var C;for(C=0;C<n.maxIterations;C++){for(var M=0;M<s;M++){for(var P=-1/0,B=-1/0,L=-1,k=0,O=0;O<s;O++)b[O]=f[M*s+O],k=c[M*s+O]+u[M*s+O],k>=P?(B=P,P=k,L=O):k>B&&(B=k);for(var A=0;A<s;A++)f[M*s+A]=(1-n.damping)*(u[M*s+A]-P)+n.damping*b[A];f[M*s+L]=(1-n.damping)*(u[M*s+L]-B)+n.damping*b[L]}for(var R=0;R<s;R++){for(var I=0,q=0;q<s;q++)b[q]=c[q*s+R],w[q]=Math.max(0,f[q*s+R]),I+=w[q];I-=w[R],w[R]=f[R*s+R],I+=w[R];for(var $=0;$<s;$++)c[$*s+R]=(1-n.damping)*Math.min(0,I-w[$])+n.damping*b[$];c[R*s+R]=(1-n.damping)*(I-w[R])+n.damping*b[R]}for(var F=0,N=0;N<s;N++){var W=c[N*s+N]+f[N*s+N]>0?1:0;x[C%n.minIterations*s+N]=W,F+=W}if(F>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var Q=0,_=0;_<s;_++){S[_]=0;for(var j=0;j<n.minIterations;j++)S[_]+=x[j*s+_];(S[_]===0||S[_]===n.minIterations)&&Q++}if(Q===s)break}}for(var ee=Lf(s,f,c),U=Af(s,u,ee),z={},Y=0;Y<ee.length;Y++)z[ee[Y]]=[];for(var X=0;X<a.length;X++){var oe=i[a[X].id()],he=U[oe];he!=null&&z[he].push(a[X])}for(var ae=new Array(ee.length),ie=0;ie<ee.length;ie++)ae[ie]=t.collection(z[ee[ie]]);return ae},Rf={affinityPropagation:ji,ap:ji},Of=er({root:void 0,directed:!1}),If={hierholzer:function(e){if(!Se(e)){var t=arguments;e={root:t[0],directed:t[1]}}var a=Of(e),n=a.root,i=a.directed,o=this,s=!1,l,u,v;n&&(v=de(n)?this.filter(n)[0].id():n[0].id());var f={},c={};i?o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.indegree(!0),S=m.outdegree(!0),E=w-S,x=S-w;E==1?l?s=!0:l=b:x==1?u?s=!0:u=b:(x>1||E>1)&&(s=!0),f[b]=[],m.outgoers().forEach(function(D){D.isEdge()&&f[b].push(D.id())})}else c[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(l?u?s=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(S){return f[b].push(S.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(u&&l)if(i){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=o[0].id());var d=function(b){for(var w=b,S=[b],E,x,D;f[w].length;)E=f[w].shift(),x=c[E][0],D=c[E][1],w!=D?(f[D]=f[D].filter(function(C){return C!=E}),w=D):!i&&w!=x&&(f[x]=f[x].filter(function(C){return C!=E}),w=x),S.unshift(E),S.unshift(w);return S},y=[],p=[];for(p=d(v);p.length!=1;)f[p[0]].length==0?(y.unshift(o.getElementById(p.shift())),y.unshift(o.getElementById(p.shift()))):p=d(p.shift()).concat(p);y.unshift(o.getElementById(p.shift()));for(var g in f)if(f[g].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},Ra=function(){var e=this,t={},a=0,n=0,i=[],o=[],s={},l=function(c,h){for(var d=o.length-1,y=[],p=e.spawn();o[d].x!=c||o[d].y!=h;)y.push(o.pop().edge),d--;y.push(o.pop().edge),y.forEach(function(g){var m=g.connectedNodes().intersection(e);p.merge(g),m.forEach(function(b){var w=b.id(),S=b.connectedEdges().intersection(e);p.merge(b),t[w].cutVertex?p.merge(S.filter(function(E){return E.isLoop()})):p.merge(S)})}),i.push(p)},u=function f(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var p,g,m,b;y.forEach(function(w){p=w.source().id(),g=w.target().id(),m=p===h?g:p,m!==d&&(b=w.id(),s[b]||(s[b]=!0,o.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(f(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,l(h,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},zf={hopcroftTarjanBiconnected:Ra,htbc:Ra,htb:Ra,hopcroftTarjanBiconnectedComponents:Ra},Oa=function(){var e=this,t={},a=0,n=[],i=[],o=e.spawn(e),s=function l(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(y){var p=y.target().id();p!==u&&(p in t||l(p),t[p].explored||(t[u].low=Math.min(t[u].low,t[p].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||s(u)}}),{cut:o,components:n}},Nf={tarjanStronglyConnected:Oa,tsc:Oa,tscc:Oa,tarjanStronglyConnectedComponents:Oa},Cs={};[fa,cv,dv,gv,yv,bv,Ev,Yv,Mt,Lt,Gn,sf,wf,Df,Rf,If,zf,Nf].forEach(function(r){be(Cs,r)});/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/var Ss=0,Ts=1,Ds=2,Hr=function r(e){if(!(this instanceof r))return new r(e);this.id="Thenable/1.0.7",this.state=Ss,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Hr.prototype={fulfill:function(e){return eo(this,Ts,"fulfillValue",e)},reject:function(e){return eo(this,Ds,"rejectReason",e)},then:function(e,t){var a=this,n=new Hr;return a.onFulfilled.push(to(e,n,"fulfill")),a.onRejected.push(to(t,n,"reject")),ks(a),n.proxy}};var eo=function(e,t,a,n){return e.state===Ss&&(e.state=t,e[a]=n,ks(e)),e},ks=function(e){e.state===Ts?ro(e,"onFulfilled",e.fulfillValue):e.state===Ds&&ro(e,"onRejected",e.rejectReason)},ro=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},to=function(e,t,a){return function(n){if(typeof e!="function")t[a].call(t,n);else{var i;try{i=e(n)}catch(o){t.reject(o);return}Ff(t,i)}}},Ff=function r(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(We(t)==="object"&&t!==null||typeof t=="function")try{a=t.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):r(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(t)};Hr.all=function(r){return new Hr(function(e,t){for(var a=new Array(r.length),n=0,i=function(l,u){a[l]=u,n++,n===r.length&&e(a)},o=0;o<r.length;o++)(function(s){var l=r[s],u=l!=null&&l.then!=null;if(u)l.then(function(f){i(s,f)},function(f){t(f)});else{var v=l;i(s,v)}})(o)})};Hr.resolve=function(r){return new Hr(function(e,t){e(r)})};Hr.reject=function(r){return new Hr(function(e,t){t(r)})};var Vt=typeof Promise<"u"?Promise:Hr,Kn=function(e,t,a){var n=ii(e),i=!n,o=this._private=be({duration:1e3},t,a);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&&Fe(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var l=e.pan();o.startPan={x:l.x,y:l.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},ht=Kn.prototype;be(ht,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,a=e.target._private.animation;e.queue?t=a.queue:t=a.current,t.push(this),gr(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,a=t.playing;return e===void 0?t.progress:(a&&this.pause(),t.progress=e,t.started=!1,a&&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 a=function(u,v){var f=e[u];f!=null&&(e[u]=e[v],e[v]=f)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return t&&this.play(),this},promise:function(e){var t=this._private,a;switch(e){case"frame":a=t.frames;break;default:case"complete":case"completed":a=t.completes}return new Vt(function(n,i){a.push(function(){n()})})}});ht.complete=ht.completed;ht.run=ht.play;ht.running=ht.playing;var Vf={animated:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:t,duration:t,complete:a}):this}},delayAnimation:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:t,duration:t,complete:a}):this}},animation:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,l=!i,u=!l;if(!s.styleEnabled())return this;var v=s.style();t=be({},t,a);var f=Object.keys(t).length===0;if(f)return new Kn(o[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(u&&(t.style=v.getPropsList(t.style||t.css),t.css=void 0),u&&t.renderedPosition!=null){var c=t.renderedPosition,h=s.pan(),d=s.zoom();t.position=cs(c,d,h)}if(l&&t.panBy!=null){var y=t.panBy,p=s.pan();t.pan={x:p.x+y.x,y:p.y+y.y}}var g=t.center||t.centre;if(l&&g!=null){var m=s.getCenterPan(g.eles,t.zoom);m!=null&&(t.pan=m)}if(l&&t.fit!=null){var b=t.fit,w=s.getFitViewport(b.eles||b.boundingBox,b.padding);w!=null&&(t.pan=w.pan,t.zoom=w.zoom)}if(l&&Se(t.zoom)){var S=s.getZoomedViewport(t.zoom);S!=null?(S.zoomed&&(t.zoom=S.zoom),S.panned&&(t.pan=S.pan)):t.zoom=null}return new Kn(o[0],t)}},animate:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(t=be({},t,a));for(var l=0;l<o.length;l++){var u=o[l],v=u.animated()&&(t.queue===void 0||t.queue),f=u.animation(t,v?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var l=0;l<o.length;l++){for(var u=o[l],v=u._private,f=v.animation.current,c=0;c<f.length;c++){var h=f[c],d=h._private;a&&(d.duration=0)}t&&(v.animation.queue=[]),a||(v.animation.current=[])}return s.notify("draw"),this}}},qf=Array.isArray,hn=qf,$f=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hf=/^\w*$/;function Gf(r,e){if(hn(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||xa(r)?!0:Hf.test(r)||!$f.test(r)||e!=null&&r in Object(e)}var Kf=Gf,Wf="[object AsyncFunction]",Uf="[object Function]",Yf="[object GeneratorFunction]",Xf="[object Proxy]";function Zf(r){if(!vt(r))return!1;var e=as(r);return e==Uf||e==Yf||e==Wf||e==Xf}var Qf=Zf,Jf=ln["__core-js_shared__"],Rn=Jf,ao=function(){var r=/[^.]+$/.exec(Rn&&Rn.keys&&Rn.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function _f(r){return!!ao&&ao in r}var jf=_f,ec=Function.prototype,rc=ec.toString;function tc(r){if(r!=null){try{return rc.call(r)}catch{}try{return r+""}catch{}}return""}var ac=tc,nc=/[\\^$.*+?()[\]{}|]/g,ic=/^\[object .+?Constructor\]$/,oc=Function.prototype,sc=Object.prototype,uc=oc.toString,lc=sc.hasOwnProperty,vc=RegExp("^"+uc.call(lc).replace(nc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function fc(r){if(!vt(r)||jf(r))return!1;var e=Qf(r)?vc:ic;return e.test(ac(r))}var cc=fc;function dc(r,e){return r==null?void 0:r[e]}var hc=dc;function gc(r,e){var t=hc(r,e);return cc(t)?t:void 0}var hi=gc,pc=hi(Object,"create"),ha=pc;function yc(){this.__data__=ha?ha(null):{},this.size=0}var mc=yc;function bc(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var wc=bc,xc="__lodash_hash_undefined__",Ec=Object.prototype,Cc=Ec.hasOwnProperty;function Sc(r){var e=this.__data__;if(ha){var t=e[r];return t===xc?void 0:t}return Cc.call(e,r)?e[r]:void 0}var Tc=Sc,Dc=Object.prototype,kc=Dc.hasOwnProperty;function Pc(r){var e=this.__data__;return ha?e[r]!==void 0:kc.call(e,r)}var Bc=Pc,Mc="__lodash_hash_undefined__";function Lc(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=ha&&e===void 0?Mc:e,this}var Ac=Lc;function qt(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var a=r[e];this.set(a[0],a[1])}}qt.prototype.clear=mc;qt.prototype.delete=wc;qt.prototype.get=Tc;qt.prototype.has=Bc;qt.prototype.set=Ac;var no=qt;function Rc(){this.__data__=[],this.size=0}var Oc=Rc;function Ic(r,e){return r===e||r!==r&&e!==e}var Ps=Ic;function zc(r,e){for(var t=r.length;t--;)if(Ps(r[t][0],e))return t;return-1}var gn=zc,Nc=Array.prototype,Fc=Nc.splice;function Vc(r){var e=this.__data__,t=gn(e,r);if(t<0)return!1;var a=e.length-1;return t==a?e.pop():Fc.call(e,t,1),--this.size,!0}var qc=Vc;function $c(r){var e=this.__data__,t=gn(e,r);return t<0?void 0:e[t][1]}var Hc=$c;function Gc(r){return gn(this.__data__,r)>-1}var Kc=Gc;function Wc(r,e){var t=this.__data__,a=gn(t,r);return a<0?(++this.size,t.push([r,e])):t[a][1]=e,this}var Uc=Wc;function $t(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var a=r[e];this.set(a[0],a[1])}}$t.prototype.clear=Oc;$t.prototype.delete=qc;$t.prototype.get=Hc;$t.prototype.has=Kc;$t.prototype.set=Uc;var Yc=$t,Xc=hi(ln,"Map"),Zc=Xc;function Qc(){this.size=0,this.__data__={hash:new no,map:new(Zc||Yc),string:new no}}var Jc=Qc;function _c(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}var jc=_c;function ed(r,e){var t=r.__data__;return jc(e)?t[typeof e=="string"?"string":"hash"]:t.map}var pn=ed;function rd(r){var e=pn(this,r).delete(r);return this.size-=e?1:0,e}var td=rd;function ad(r){return pn(this,r).get(r)}var nd=ad;function id(r){return pn(this,r).has(r)}var od=id;function sd(r,e){var t=pn(this,r),a=t.size;return t.set(r,e),this.size+=t.size==a?0:1,this}var ud=sd;function Ht(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var a=r[e];this.set(a[0],a[1])}}Ht.prototype.clear=Jc;Ht.prototype.delete=td;Ht.prototype.get=nd;Ht.prototype.has=od;Ht.prototype.set=ud;var Bs=Ht,ld="Expected a function";function gi(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(ld);var t=function(){var a=arguments,n=e?e.apply(this,a):a[0],i=t.cache;if(i.has(n))return i.get(n);var o=r.apply(this,a);return t.cache=i.set(n,o)||i,o};return t.cache=new(gi.Cache||Bs),t}gi.Cache=Bs;var vd=gi,fd=500;function cd(r){var e=vd(r,function(a){return t.size===fd&&t.clear(),a}),t=e.cache;return e}var dd=cd,hd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,gd=/\\(\\)?/g,pd=dd(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(hd,function(t,a,n,i){e.push(n?i.replace(gd,"$1"):a||t)}),e}),Ms=pd;function yd(r,e){for(var t=-1,a=r==null?0:r.length,n=Array(a);++t<a;)n[t]=e(r[t],t,r);return n}var Ls=yd,md=1/0,io=Rt?Rt.prototype:void 0,oo=io?io.toString:void 0;function As(r){if(typeof r=="string")return r;if(hn(r))return Ls(r,As)+"";if(xa(r))return oo?oo.call(r):"";var e=r+"";return e=="0"&&1/r==-md?"-0":e}var bd=As;function wd(r){return r==null?"":bd(r)}var Rs=wd;function xd(r,e){return hn(r)?r:Kf(r,e)?[r]:Ms(Rs(r))}var Os=xd,Ed=1/0;function Cd(r){if(typeof r=="string"||xa(r))return r;var e=r+"";return e=="0"&&1/r==-Ed?"-0":e}var pi=Cd;function Sd(r,e){e=Os(e,r);for(var t=0,a=e.length;r!=null&&t<a;)r=r[pi(e[t++])];return t&&t==a?r:void 0}var Td=Sd;function Dd(r,e,t){var a=r==null?void 0:Td(r,e);return a===void 0?t:a}var kd=Dd,Pd=function(){try{var r=hi(Object,"defineProperty");return r({},"",{}),r}catch{}}(),so=Pd;function Bd(r,e,t){e=="__proto__"&&so?so(r,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[e]=t}var Md=Bd,Ld=Object.prototype,Ad=Ld.hasOwnProperty;function Rd(r,e,t){var a=r[e];(!(Ad.call(r,e)&&Ps(a,t))||t===void 0&&!(e in r))&&Md(r,e,t)}var Od=Rd,Id=9007199254740991,zd=/^(?:0|[1-9]\d*)$/;function Nd(r,e){var t=typeof r;return e=e??Id,!!e&&(t=="number"||t!="symbol"&&zd.test(r))&&r>-1&&r%1==0&&r<e}var Fd=Nd;function Vd(r,e,t,a){if(!vt(r))return r;e=Os(e,r);for(var n=-1,i=e.length,o=i-1,s=r;s!=null&&++n<i;){var l=pi(e[n]),u=t;if(l==="__proto__"||l==="constructor"||l==="prototype")return r;if(n!=o){var v=s[l];u=a?a(v,l,s):void 0,u===void 0&&(u=vt(v)?v:Fd(e[n+1])?[]:{})}Od(s,l,u),s=s[l]}return r}var qd=Vd;function $d(r,e,t){return r==null?r:qd(r,e,t)}var Hd=$d;function Gd(r,e){var t=-1,a=r.length;for(e||(e=Array(a));++t<a;)e[t]=r[t];return e}var Kd=Gd;function Wd(r){return hn(r)?Ls(r,pi):xa(r)?[r]:Kd(Ms(Rs(r)))}var Ud=Wd,Yd={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,i){},onSet:function(n){},canSet:function(n){return!0}};return e=be({},t,e),function(n,i){var o=e,s=this,l=s.length!==void 0,u=l?s:[s],v=l?s[0]:s;if(de(n)){var f=n.indexOf(".")!==-1,c=f&&Ud(n);if(o.allowGetting&&i===void 0){var h;return v&&(o.beforeGet(v),c&&v._private[o.field][n]===void 0?h=kd(v._private[o.field],c):h=v._private[o.field][n]),h}else if(o.allowSetting&&i!==void 0){var d=!o.immutableKeys[n];if(d){var y=Uo({},n,i);o.beforeSet(s,y);for(var p=0,g=u.length;p<g;p++){var m=u[p];o.canSet(m)&&(c&&v._private[o.field][n]===void 0?Hd(m._private[o.field],c,i):m._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&Se(n)){var b=n,w,S,E=Object.keys(b);o.beforeSet(s,b);for(var x=0;x<E.length;x++){w=E[x],S=b[w];var D=!o.immutableKeys[w];if(D)for(var C=0;C<u.length;C++){var M=u[C];o.canSet(M)&&(M._private[o.field][w]=S)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&Fe(n)){var P=n;s.on(o.bindingEvent,P)}else if(o.allowGetting&&n===void 0){var B;return v&&(o.beforeGet(v),B=v._private[o.field]),B}return s}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=be({},t,e),function(n){var i=e,o=this,s=o.length!==void 0,l=s?o:[o];if(de(n)){for(var u=n.split(/\s+/),v=u.length,f=0;f<v;f++){var c=u[f];if(!Jr(c)){var h=!i.immutableKeys[c];if(h)for(var d=0,y=l.length;d<y;d++)l[d]._private[i.field][c]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var p=0,g=l.length;p<g;p++)for(var m=l[p]._private[i.field],b=Object.keys(m),w=0;w<b.length;w++){var S=b[w],E=!i.immutableKeys[S];E&&(m[S]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},Xd={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(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new Vt(function(s,l){var u=function(h){i.off.apply(i,f),s(h)},v=o.concat([u]),f=v.concat([]);i.on.apply(i,v)})}}},Be={};[Vf,Yd,Xd].forEach(function(r){be(Be,r)});var Zd={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.stop()},Ga={classes:function(e){var t=this;if(e===void 0){var a=[];return t[0]._private.classes.forEach(function(d){return a.push(d)}),a}else Re(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new Ft(e),o=0;o<t.length;o++){for(var s=t[o],l=s._private,u=l.classes,v=!1,f=0;f<e.length;f++){var c=e[f],h=u.has(c);if(!h){v=!0;break}}v||(v=u.size!==e.length),v&&(l.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Re(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],o=0,s=a.length;o<s;o++)for(var l=a[o],u=l._private.classes,v=!1,f=0;f<e.length;f++){var c=e[f],h=u.has(c),d=!1;t||n&&!h?(u.add(c),d=!0):(!t||n&&h)&&(u.delete(c),d=!0),!v&&d&&(i.push(l),v=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};Ga.className=Ga.classNames=Ga.classes;var Ce={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ke,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ce.variable="(?:[\\w-.]|(?:\\\\"+Ce.metaChar+"))+";Ce.className="(?:[\\w-]|(?:\\\\"+Ce.metaChar+"))+";Ce.value=Ce.string+"|"+Ce.number;Ce.id=Ce.variable;(function(){var r,e,t;for(r=Ce.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],Ce.comparatorOp+="|@"+e;for(r=Ce.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(Ce.comparatorOp+="|\\!"+e)})();var Le=function(){return{checks:[]}},se={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},Wn=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return ol(r.selector,e.selector)}),Qd=function(){for(var r={},e,t=0;t<Wn.length;t++)e=Wn[t],r[e.selector]=e.matches;return r}(),Jd=function(e,t){return Qd[e](t)},_d="("+Wn.map(function(r){return r.selector}).join("|")+")",wt=function(e){return e.replace(new RegExp("\\\\("+Ce.metaChar+")","g"),function(t,a){return a})},Ur=function(e,t,a){e[e.length-1]=a},Un=[{name:"group",query:!0,regex:"("+Ce.group+")",populate:function(e,t,a){var n=Tr(a,1),i=n[0];t.checks.push({type:se.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:_d,populate:function(e,t,a){var n=Tr(a,1),i=n[0];t.checks.push({type:se.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Ce.id+")",populate:function(e,t,a){var n=Tr(a,1),i=n[0];t.checks.push({type:se.ID,value:wt(i)})}},{name:"className",query:!0,regex:"\\.("+Ce.className+")",populate:function(e,t,a){var n=Tr(a,1),i=n[0];t.checks.push({type:se.CLASS,value:wt(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ce.variable+")\\s*\\]",populate:function(e,t,a){var n=Tr(a,1),i=n[0];t.checks.push({type:se.DATA_EXIST,field:wt(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ce.variable+")\\s*("+Ce.comparatorOp+")\\s*("+Ce.value+")\\s*\\]",populate:function(e,t,a){var n=Tr(a,3),i=n[0],o=n[1],s=n[2],l=new RegExp("^"+Ce.string+"$").exec(s)!=null;l?s=s.substring(1,s.length-1):s=parseFloat(s),t.checks.push({type:se.DATA_COMPARE,field:wt(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ce.boolOp+")\\s*("+Ce.variable+")\\s*\\]",populate:function(e,t,a){var n=Tr(a,2),i=n[0],o=n[1];t.checks.push({type:se.DATA_BOOL,field:wt(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ce.meta+")\\s*("+Ce.comparatorOp+")\\s*("+Ce.number+")\\s*\\]\\]",populate:function(e,t,a){var n=Tr(a,3),i=n[0],o=n[1],s=n[2];t.checks.push({type:se.META_COMPARE,field:wt(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:Ce.separator,populate:function(e,t){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=Le();return s}},{name:"directedEdge",separator:!0,regex:Ce.directedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Le(),n=t,i=Le();return a.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),Ur(e,t,a),e.edgeCount++,i}else{var o=Le(),s=t,l=Le();return o.checks.push({type:se.NODE_SOURCE,source:s,target:l}),Ur(e,t,o),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Ce.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Le(),n=t,i=Le();return a.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),Ur(e,t,a),e.edgeCount++,i}else{var o=Le(),s=t,l=Le();return o.checks.push({type:se.NODE_NEIGHBOR,node:s,neighbor:l}),Ur(e,t,o),l}}},{name:"child",separator:!0,regex:Ce.child,populate:function(e,t){if(e.currentSubject==null){var a=Le(),n=Le(),i=e[e.length-1];return a.checks.push({type:se.CHILD,parent:i,child:n}),Ur(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var o=Le(),s=e[e.length-1],l=Le(),u=Le(),v=Le(),f=Le();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),l.checks.push({type:se.PARENT,parent:f,child:v}),Ur(e,s,o),e.currentSubject=u,e.compoundCount++,v}else{var c=Le(),h=Le(),d=[{type:se.PARENT,parent:c,child:h}];return c.checks=t.checks,t.checks=d,e.compoundCount++,h}}},{name:"descendant",separator:!0,regex:Ce.descendant,populate:function(e,t){if(e.currentSubject==null){var a=Le(),n=Le(),i=e[e.length-1];return a.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),Ur(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var o=Le(),s=e[e.length-1],l=Le(),u=Le(),v=Le(),f=Le();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),l.checks.push({type:se.ANCESTOR,ancestor:f,descendant:v}),Ur(e,s,o),e.currentSubject=u,e.compoundCount++,v}else{var c=Le(),h=Le(),d=[{type:se.ANCESTOR,ancestor:c,descendant:h}];return c.checks=t.checks,t.checks=d,e.compoundCount++,h}}},{name:"subject",modifier:!0,regex:Ce.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Me("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===se.DIRECTED_EDGE?n.type=se.NODE_TARGET:i===se.UNDIRECTED_EDGE&&(n.type=se.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Un.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var jd=function(e){for(var t,a,n,i=0;i<Un.length;i++){var o=Un[i],s=o.name,l=e.match(o.regexObj);if(l!=null){a=l,t=o,n=s;var u=l[0];e=e.substring(u.length);break}}return{expr:t,match:a,name:n,remaining:e}},eh=function(e){var t=e.match(/^\s+/);if(t){var a=t[0];e=e.substring(a.length)}return e},rh=function(e){var t=this,a=t.inputText=e,n=t[0]=Le();for(t.length=1,a=eh(a);;){var i=jd(a);if(i.expr==null)return Me("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(t,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var l=t[t.length-1];t.currentSubject!=null&&(l.subject=t.currentSubject),l.edgeCount=t.edgeCount,l.compoundCount=t.compoundCount;for(var u=0;u<t.length;u++){var v=t[u];if(v.compoundCount>0&&v.edgeCount>0)return Me("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Me("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Me("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},th=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return de(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,h=v.value;switch(c){case se.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case se.DATA_COMPARE:{var y=v.field,p=v.operator;return"["+y+a(e(p))+t(h)+"]"}case se.DATA_BOOL:{var g=v.operator,m=v.field;return"["+e(g)+m+"]"}case se.DATA_EXIST:{var b=v.field;return"["+b+"]"}case se.META_COMPARE:{var w=v.operator,S=v.field;return"[["+S+a(e(w))+t(h)+"]]"}case se.STATE:return h;case se.ID:return"#"+h;case se.CLASS:return"."+h;case se.PARENT:case se.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case se.COMPOUND_SPLIT:{var E=i(v.left,f),x=i(v.subject,f),D=i(v.right,f);return E+(E.length>0?" ":"")+x+D}case se.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&d===0?"$":"")+n(h,f)},"")},o="",s=0;s<this.length;s++){var l=this[s];o+=i(l,l.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},ah={parse:rh,toString:th},Is=function(e,t,a){var n,i=de(e),o=ne(e),s=de(a),l,u,v=!1,f=!1,c=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||s||v)&&(l=!i&&!o?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return f&&(e!=null||!c)&&(n=!n),n},nh=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},ih=function(e){return e!==void 0},yi=function(e,t){return e.data(t)},oh=function(e,t){return e[t]()},qe=[],ze=function(e,t){return e.checks.every(function(a){return qe[a.type](a,t)})};qe[se.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};qe[se.STATE]=function(r,e){var t=r.value;return Jd(t,e)};qe[se.ID]=function(r,e){var t=r.value;return e.id()===t};qe[se.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};qe[se.META_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return Is(oh(e,t),a,n)};qe[se.DATA_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return Is(yi(e,t),a,n)};qe[se.DATA_BOOL]=function(r,e){var t=r.field,a=r.operator;return nh(yi(e,t),a)};qe[se.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,ih(yi(e,t))};qe[se.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],a=r.nodes[1],n=e.source(),i=e.target();return ze(t,n)&&ze(a,i)||ze(a,n)&&ze(t,i)};qe[se.NODE_NEIGHBOR]=function(r,e){return ze(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&ze(r.neighbor,t)})};qe[se.DIRECTED_EDGE]=function(r,e){return ze(r.source,e.source())&&ze(r.target,e.target())};qe[se.NODE_SOURCE]=function(r,e){return ze(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&ze(r.target,t)})};qe[se.NODE_TARGET]=function(r,e){return ze(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&ze(r.source,t)})};qe[se.CHILD]=function(r,e){return ze(r.child,e)&&ze(r.parent,e.parent())};qe[se.PARENT]=function(r,e){return ze(r.parent,e)&&e.children().some(function(t){return ze(r.child,t)})};qe[se.DESCENDANT]=function(r,e){return ze(r.descendant,e)&&e.ancestors().some(function(t){return ze(r.ancestor,t)})};qe[se.ANCESTOR]=function(r,e){return ze(r.ancestor,e)&&e.descendants().some(function(t){return ze(r.descendant,t)})};qe[se.COMPOUND_SPLIT]=function(r,e){return ze(r.subject,e)&&ze(r.left,e)&&ze(r.right,e)};qe[se.TRUE]=function(){return!0};qe[se.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};qe[se.FILTER]=function(r,e){var t=r.value;return t(e)};var sh=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===se.ID)return e.getElementById(t[0].checks[0].value).collection();var a=function(i){for(var o=0;o<t.length;o++){var s=t[o];if(ze(s,i))return!0}return!1};return t.text()==null&&(a=function(){return!0}),e.filter(a)},uh=function(e){for(var t=this,a=0;a<t.length;a++){var n=t[a];if(ze(n,e))return!0}return!1},lh={matches:uh,filter:sh},jr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||de(e)&&e.match(/^\s*$/)||(gr(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):Fe(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):de(e)?this.parse(e)||(this.invalid=!0):Ve("A selector must be created from a string; found "))},et=jr.prototype;[ah,lh].forEach(function(r){return be(et,r)});et.text=function(){return this.inputText};et.size=function(){return this.length};et.eq=function(r){return this[r]};et.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};et.addQuery=function(r){this[this.length++]=r};et.selector=et.toString;var Zr={allAre:function(e){var t=new jr(e);return this.every(function(a){return t.matches(a)})},is:function(e){var t=new jr(e);return this.some(function(a){return t.matches(a)})},some:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,a=e.length;return t!==a?!1:t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.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(a){return t.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(a){return t.hasElementWithId(a.id())})}};Zr.allAreNeighbours=Zr.allAreNeighbors;Zr.has=Zr.contains;Zr.equal=Zr.equals=Zr.same;var wr=function(e,t){return function(n,i,o,s){var l=n,u=this,v;if(l==null?v="":gr(l)&&l.length===1&&(v=l.id()),u.length===1&&v){var f=u[0]._private,c=f.traversalCache=f.traversalCache||{},h=c[t]=c[t]||[],d=ft(v),y=h[d];return y||(h[d]=e.call(u,n,i,o,s))}else return e.call(u,n,i,o,s)}},zt={parent:function(e){var t=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];t.push(i)}a=a.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,a=0;a<this.length;a++){var n=this[a],i=n.parents();t=t||i,t=t.intersect(i)}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:wr(function(r){for(var e=[],t=0;t<this.length;t++)for(var a=this[t],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(r)},"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 a(n){for(var i=0;i<n.length;i++){var o=n[i];t.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(t,!0).filter(e)}};function mi(r,e,t,a){for(var n=[],i=new Ft,o=r.cy(),s=o.hasCompoundNodes(),l=0;l<r.length;l++){var u=r[l];t?n.push(u):s&&a(n,i,u)}for(;n.length>0;){var v=n.shift();e(v),i.add(v.id()),s&&a(n,i,v)}return r}function zs(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||r.push(i)}}zt.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,zs)};function Ns(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}zt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,Ns)};function vh(r,e,t){Ns(r,e,t),zs(r,e,t)}zt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,vh)};zt.ancestors=zt.parents;var ga,Fs;ga=Fs={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Be.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Be.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ga.attr=ga.data;ga.removeAttr=ga.removeData;var fh=Fs,yn={};function On(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=r(n,s))}return a}else return}}be(yn,{degree:On(function(r,e){return e.source().same(e.target())?2:1}),indegree:On(function(r,e){return e.target().same(r)?1:0}),outdegree:On(function(r,e){return e.source().same(r)?1:0})});function xt(r,e){return function(t){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[r](t);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}be(yn,{minDegree:xt("degree",function(r,e){return r<e}),maxDegree:xt("degree",function(r,e){return r>e}),minIndegree:xt("indegree",function(r,e){return r<e}),maxIndegree:xt("indegree",function(r,e){return r>e}),minOutdegree:xt("outdegree",function(r,e){return r<e}),maxOutdegree:xt("outdegree",function(r,e){return r>e})});be(yn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n<a.length;n++)t+=a[n].degree(e);return t}});var Pr,Vs,qs=function(e,t,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},uo={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){qs(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Pr=Vs={position:Be.data(uo),silentPosition:Be.data(be({},uo,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){qs(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(Se(e))t?this.silentPosition(e):this.position(e);else if(Fe(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(t?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,a){var n;if(Se(e)?(n={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},a=t):de(e)&&ne(t)&&(n={x:0,y:0},n[e]=t),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var l=s.position(),u={x:l.x+n.x,y:l.y+n.y};a?s.silentPosition(u):s.position(u)}}i.endBatch()}return this},silentShift:function(e,t){return Se(e)?this.shift(e,!0):de(e)&&ne(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=Se(e)?e:void 0,l=s!==void 0||t!==void 0&&de(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var v=this[u];t!==void 0?v.position(e,(t-o[e])/i):s!==void 0&&v.position(cs(s,i,o))}else{var f=a.position();return s=cn(f,i,o),e===void 0?s:s[e]}else if(!l)return;return this},relativePosition:function(e,t){var a=this[0],n=this.cy(),i=Se(e)?e:void 0,o=i!==void 0||t!==void 0&&de(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var l=0;l<this.length;l++){var u=this[l],v=s?u.parent():null,f=v&&v.length>0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};t!==void 0?u.position(e,t+h[e]):i!==void 0&&u.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),y=s?a.parent():null,p=y&&y.length>0,g=p;p&&(y=y[0]);var m=g?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Pr.modelPosition=Pr.point=Pr.position;Pr.modelPositions=Pr.points=Pr.positions;Pr.renderedPoint=Pr.renderedPosition;Pr.relativePoint=Pr.relativePosition;var ch=Vs,At,tt;At=tt={};tt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}};tt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};tt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function h(C,M,P){var B=0,L=0,k=M+P;return C>0&&k>0&&(B=M/k*C,L=P/k*C),{biasDiff:B,biasComplementDiff:L}}function d(C,M,P,B){if(P.units==="%")switch(B){case"width":return C>0?P.pfValue*C:0;case"height":return M>0?P.pfValue*M:0;case"average":return C>0&&M>0?P.pfValue*(C+M)/2:0;case"min":return C>0&&M>0?C>M?P.pfValue*M:P.pfValue*C:0;case"max":return C>0&&M>0?C>M?P.pfValue*C:P.pfValue*M:0;default:return 0}else return P.units==="px"?P.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var p=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(p=p*100/v.width.val);var g=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(g=g*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=h(v.width.val-f.w,y,p),w=b.biasDiff,S=b.biasComplementDiff,E=h(v.height.val-f.h,g,m),x=E.biasDiff,D=E.biasComplementDiff;s.autoPadding=d(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+S)/2,s.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+D)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||r)&&(t(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var br=function(e){return e===1/0||e===-1/0?0:e},Dr=function(e,t,a,n,i){n-t===0||i-a===0||t==null||a==null||n==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ot=function(e,t){return t==null?e:Dr(e,t.x1,t.y1,t.x2,t.y2)},_t=function(e,t,a){return kr(e,t,a)},Ia=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,o=i.arrowWidth/2,s=t.pstyle(a+"-arrow-shape").value,l,u;if(s!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-o,f.y1=u-o,f.x2=l+o,f.y2=u+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,$a(f,1),Dr(e,f.x1,f.y1,f.x2,f.y2)}}},In=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,o=i.rstyle,s=t.pstyle(n+"label").strValue;if(s){var l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=_t(o,"labelWidth",a),f=_t(o,"labelHeight",a),c=_t(o,"labelX",a),h=_t(o,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,p=t.isEdge(),g=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,S=t.pstyle("text-background-padding").pfValue,E=2,x=f,D=v,C=D/2,M=x/2,P,B,L,k;if(p)P=c-C,B=c+C,L=h-M,k=h+M;else{switch(l.value){case"left":P=c-D,B=c;break;case"center":P=c-C,B=c+C;break;case"right":P=c,B=c+D;break}switch(u.value){case"top":L=h-x,k=h;break;case"center":L=h-M,k=h+M;break;case"bottom":L=h,k=h+x;break}}P+=d-Math.max(m,w)-S-E,B+=d+Math.max(m,w)+S+E,L+=y-Math.max(m,w)-S-E,k+=y+Math.max(m,w)+S+E;var O=a||"main",A=i.labelBounds,R=A[O]=A[O]||{};R.x1=P,R.y1=L,R.x2=B,R.y2=k,R.w=B-P,R.h=k-L;var I=p&&g.strValue==="autorotate",q=g.pfValue!=null&&g.pfValue!==0;if(I||q){var $=I?_t(i.rstyle,"labelAngle",a):g.pfValue,F=Math.cos($),N=Math.sin($),W=(P+B)/2,Q=(L+k)/2;if(!p){switch(l.value){case"left":W=B;break;case"right":W=P;break}switch(u.value){case"top":Q=k;break;case"bottom":Q=L;break}}var _=function(he,ae){return he=he-W,ae=ae-Q,{x:he*F-ae*N+W,y:he*N+ae*F+Q}},j=_(P,L),ee=_(P,k),U=_(B,L),z=_(B,k);P=Math.min(j.x,ee.x,U.x,z.x),B=Math.max(j.x,ee.x,U.x,z.x),L=Math.min(j.y,ee.y,U.y,z.y),k=Math.max(j.y,ee.y,U.y,z.y)}var Y=O+"Rot",X=A[Y]=A[Y]||{};X.x1=P,X.y1=L,X.x2=B,X.y2=k,X.w=B-P,X.h=k-L,Dr(e,P,L,B,k),Dr(i.labelBounds.all,P,L,B,k)}return e}},dh=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,s=n+i,l=(e.w+s*2)/e.w,u=(e.h+s*2)/e.h,v=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(l=(e.w+s*2.4)/e.w,f=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?l=(e.w+s*2.4)/e.w:o==="star"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.6)/e.h,f=-s/3.8):o==="triangle"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.4)/e.h,f=-s/1.4):o==="vee"&&(l=(e.w+s*4.4)/e.w,u=(e.h+s*3.8)/e.h,f=-s*.5);var c=e.h*u-e.h,h=e.w*l-e.w;if(Ha(e,[Math.ceil(c/2),Math.ceil(h/2)]),v!=0||f!==0){var d=Rv(e,v,f);hs(e,d)}}}},hh=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=hr(),s=e._private,l=e.isNode(),u=e.isEdge(),v,f,c,h,d,y,p=s.rstyle,g=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(ue){return ue.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var w=0,S=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(S=e.pstyle("overlay-padding").value));var E=0,x=0;n&&t.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(x=e.pstyle("underlay-padding").value));var D=Math.max(S,x),C=0,M=0;if(n&&(C=e.pstyle("width").pfValue,M=C/2),l&&t.includeNodes){var P=e.position();d=P.x,y=P.y;var B=e.outerWidth(),L=B/2,k=e.outerHeight(),O=k/2;v=d-L,f=d+L,c=y-O,h=y+O,Dr(o,v,c,f,h),n&&t.includeOutlines&&dh(o,e)}else if(u&&t.includeEdges)if(n&&!i){var A=e.pstyle("curve-style").strValue;if(v=Math.min(p.srcX,p.midX,p.tgtX),f=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),h=Math.max(p.srcY,p.midY,p.tgtY),v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h),A==="haystack"){var R=p.haystackPts;if(R&&R.length===2){if(v=R[0].x,c=R[0].y,f=R[1].x,h=R[1].y,v>f){var I=v;v=f,f=I}if(c>h){var q=c;c=h,h=q}Dr(o,v-M,c-M,f+M,h+M)}}else if(A==="bezier"||A==="unbundled-bezier"||A.endsWith("segments")||A.endsWith("taxi")){var $;switch(A){case"bezier":case"unbundled-bezier":$=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":$=p.linePts;break}if($!=null)for(var F=0;F<$.length;F++){var N=$[F];v=N.x-M,f=N.x+M,c=N.y-M,h=N.y+M,Dr(o,v,c,f,h)}}}else{var W=e.source(),Q=W.position(),_=e.target(),j=_.position();if(v=Q.x,f=j.x,c=Q.y,h=j.y,v>f){var ee=v;v=f,f=ee}if(c>h){var U=c;c=h,h=U}v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h)}if(n&&t.includeEdges&&u&&(Ia(o,e,"mid-source"),Ia(o,e,"mid-target"),Ia(o,e,"source"),Ia(o,e,"target")),n){var z=e.pstyle("ghost").value==="yes";if(z){var Y=e.pstyle("ghost-offset-x").pfValue,X=e.pstyle("ghost-offset-y").pfValue;Dr(o,o.x1+Y,o.y1+X,o.x2+Y,o.y2+X)}}var oe=s.bodyBounds=s.bodyBounds||{};$i(oe,o),Ha(oe,g),$a(oe,1),n&&(v=o.x1,f=o.x2,c=o.y1,h=o.y2,Dr(o,v-D,c-D,f+D,h+D));var he=s.overlayBounds=s.overlayBounds||{};$i(he,o),Ha(he,g),$a(he,1);var ae=s.labelBounds=s.labelBounds||{};ae.all!=null?Av(ae.all):ae.all=hr(),n&&t.includeLabels&&(t.includeMainLabels&&In(o,e,null),u&&(t.includeSourceLabels&&In(o,e,"source"),t.includeTargetLabels&&In(o,e,"target")))}return o.x1=br(o.x1),o.y1=br(o.y1),o.x2=br(o.x2),o.y2=br(o.y2),o.w=br(o.x2-o.x1),o.h=br(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Ha(o,g),$a(o,1)),o},$s=function(e){var t=0,a=function(o){return(o?1:0)<<t++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Hs=function(e){if(e.isEdge()){var t=e.source().position(),a=e.target().position(),n=function(o){return Math.round(o)};return jl([n(t.x),n(t.y),n(a.x),n(a.y)])}else return 0},lo=function(e,t){var a=e._private,n,i=e.isEdge(),o=t==null?vo:$s(t),s=o===vo,l=Hs(e),u=a.bbCachePosKey===l,v=t.useCache&&u,f=function(y){return y._private.bbCache==null||y._private.styleDirty},c=!v||f(e)||i&&f(e.source())||f(e.target());if(c?(u||e.recalculateRenderedStyle(v),n=hh(e,pa),a.bbCache=n,a.bbCachePosKey=l):n=a.bbCache,!s){var h=e.isNode();n=hr(),(t.includeNodes&&h||t.includeEdges&&!h)&&(t.includeOverlays?ot(n,a.overlayBounds):ot(n,a.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ot(n,a.labelBounds.all):(t.includeMainLabels&&ot(n,a.labelBounds.mainRot),t.includeSourceLabels&&ot(n,a.labelBounds.sourceRot),t.includeTargetLabels&&ot(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},pa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},vo=$s(pa),fo=er(pa);tt.boundingBox=function(r){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(r===void 0||r.useCache===void 0||r.useCache===!0))r===void 0?r=pa:r=fo(r),e=lo(this[0],r);else{e=hr(),r=r||pa;var t=fo(r),a=this,n=a.cy(),i=n.styleEnabled();if(i)for(var o=0;o<a.length;o++){var s=a[o],l=s._private,u=Hs(s),v=l.bbCachePosKey===u,f=t.useCache&&v&&!l.styleDirty;s.recalculateRenderedStyle(f)}this.updateCompoundBounds(!r.useCache);for(var c=0;c<a.length;c++){var h=a[c];ot(e,lo(h,t))}}return e.x1=br(e.x1),e.y1=br(e.y1),e.x2=br(e.x2),e.y2=br(e.y2),e.w=br(e.x2-e.x1),e.h=br(e.y2-e.y1),e};tt.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};tt.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),a=t.hasCompoundNodes(),n=t.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),Se(r)){var i=r;r=function(){return i}}var o=function(v,f){return v._private.bbAtOldPos=r(v,f)},s=function(v){return v._private.bbAtOldPos};t.startBatch(),e.forEach(o).silentPositions(r),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=Lv(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),t.endBatch(),l};At.boundingbox=At.bb=At.boundingBox;At.renderedBoundingbox=At.renderedBoundingBox;var gh=tt,na,Ca;na=Ca={};var Gs=function(e){e.uppercaseName=Oi(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Oi(e.outerName),na[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);switch(s.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},na["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return s+l+u}else return 1},na["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},na["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};Gs({name:"width"});Gs({name:"height"});Ca.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};Ca.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};Ca.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var ph=Ca,yh=function(e,t){if(e.isEdge())return t(e)},mh=function(e,t){if(e.isEdge()){var a=e.cy();return cn(t(e),a.zoom(),a.pan())}},bh=function(e,t){if(e.isEdge()){var a=e.cy(),n=a.pan(),i=a.zoom();return t(e).map(function(o){return cn(o,i,n)})}},wh=function(e){return e.renderer().getControlPoints(e)},xh=function(e){return e.renderer().getSegmentPoints(e)},Eh=function(e){return e.renderer().getSourceEndpoint(e)},Ch=function(e){return e.renderer().getTargetEndpoint(e)},Sh=function(e){return e.renderer().getEdgeMidpoint(e)},co={controlPoints:{get:wh,mult:!0},segmentPoints:{get:xh,mult:!0},sourceEndpoint:{get:Eh},targetEndpoint:{get:Ch},midpoint:{get:Sh}},Th=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Dh=Object.keys(co).reduce(function(r,e){var t=co[e],a=Th(e);return r[e]=function(){return yh(this,t.get)},t.mult?r[a]=function(){return bh(this,t.get)}:r[a]=function(){return mh(this,t.get)},r},{}),kh=be({},ch,gh,ph,Dh);/*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*/var Ks=function(e,t){this.recycle(e,t)};function jt(){return!1}function za(){return!0}Ks.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=jt,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?za:jt):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 a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=za;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=za;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=za,this.stopPropagation()},isDefaultPrevented:jt,isPropagationStopped:jt,isImmediatePropagationStopped:jt};var Ws=/^([^.]+)(\.(?:[^.]+))?$/,Ph=".*",Us={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},ho=Object.keys(Us),Bh={};function mn(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bh,e=arguments.length>1?arguments[1]:void 0,t=0;t<ho.length;t++){var a=ho[t];this[a]=r[a]||Us[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var rt=mn.prototype,Ys=function(e,t,a,n,i,o,s){Fe(n)&&(i=n,n=null),s&&(o==null?o=s:o=be({},o,s));for(var l=Re(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var v=l[u];if(!Jr(v)){var f=v.match(Ws);if(f){var c=f[1],h=f[2]?f[2]:null,d=t(e,v,c,h,n,i,o);if(d===!1)break}}}},go=function(e,t){return e.addEventFields(e.context,t),new Ks(t.type,t)},Mh=function(e,t,a){if(Zu(a)){t(e,a);return}else if(Se(a)){t(e,go(e,a));return}for(var n=Re(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!Jr(o)){var s=o.match(Ws);if(s){var l=s[1],u=s[2]?s[2]:null,v=go(e,{type:l,namespace:u,target:e.context});t(e,v)}}}};rt.on=rt.addListener=function(r,e,t,a,n){return Ys(this,function(i,o,s,l,u,v,f){Fe(v)&&i.listeners.push({event:o,callback:v,type:s,namespace:l,qualifier:u,conf:f})},r,e,t,a,n),this};rt.one=function(r,e,t,a){return this.on(r,e,t,a,{one:!0})};rt.removeListener=rt.off=function(r,e,t,a){var n=this;this.emitting!==0&&(this.listeners=nv(this.listeners));for(var i=this.listeners,o=function(u){var v=i[u];Ys(n,function(f,c,h,d,y,p){if((v.type===h||r==="*")&&(!d&&v.namespace!==".*"||v.namespace===d)&&(!y||f.qualifierCompare(v.qualifier,y))&&(!p||v.callback===p))return i.splice(u,1),!1},r,e,t,a)},s=i.length-1;s>=0;s--)o(s);return this};rt.removeAllListeners=function(){return this.removeListener("*")};rt.emit=rt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Re(e)||(e=[e]),Mh(this,function(i,o){t!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],n=a.length);for(var s=function(v){var f=a[v];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===Ph)&&i.eventMatches(i.context,f,o)){var c=[o];e!=null&&ov(c,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(y){return y!==f}));var h=i.callbackContext(i.context,f,o),d=f.callback.apply(h,c);i.afterEmit(i.context,f,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<n;l++)s(l);i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},r),this.emitting--,this};var Lh={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.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()}},Na=function(e){return de(e)?new jr(e):e},Xs={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],a=t._private;a.emitter||(a.emitter=new mn(Lh,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,a){for(var n=Na(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,t,a){for(var n=Na(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}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,a){for(var n=Na(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,t,a){for(var n=Na(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,t){for(var a=0;a<this.length;a++){var n=this[a];n.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}};Be.eventAliasesOn(Xs);var Zs={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(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(de(e)||gr(e))return new jr(e).filter(this);if(Fe(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=t?e.apply(t,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){de(e)&&(e=this.filter(e));for(var t=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||t.push(n)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(de(e)){var t=e;return this.filter(t)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,l=o?i:n,u=0;u<s.length;u++){var v=s[u];l.has(v)&&a.push(v)}return a},xor:function(e){var t=this._private.cy;de(e)&&(e=t.$(e));var a=this.spawn(),n=this,i=e,o=function(l,u){for(var v=0;v<l.length;v++){var f=l[v],c=f._private.data.id,h=u.hasElementWithId(c);h||a.push(f)}};return o(n,i),o(i,n),a},diff:function(e){var t=this._private.cy;de(e)&&(e=t.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,l=function(v,f,c){for(var h=0;h<v.length;h++){var d=v[h],y=d._private.data.id,p=f.hasElementWithId(y);p?i.merge(d):c.push(d)}};return l(o,s,a),l(s,o,n),{left:a,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(de(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var t=this._private,a=t.cy;if(!e)return this;if(e&&de(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=t.map,o=0;o<e.length;o++){var s=e[o],l=s._private.data.id,u=!i.has(l);if(u){var v=this.length++;this[v]=s,i.set(l,{ele:s,index:v})}}return this},unmergeAt:function(e){var t=this[e],a=t.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&de(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=t?e.apply(t,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,t){for(var a=t,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,t){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],l=t?e.apply(t,[s,o,i]):e(s,o,i);l>a&&(a=l,n=s)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],l=t?e.apply(t,[s,o,i]):e(s,o,i);l<a&&(a=l,n=s)}return{value:a,ele:n}}},ke=Zs;ke.u=ke["|"]=ke["+"]=ke.union=ke.or=ke.add;ke["\\"]=ke["!"]=ke["-"]=ke.difference=ke.relativeComplement=ke.subtract=ke.not;ke.n=ke["&"]=ke["."]=ke.and=ke.intersection=ke.intersect;ke["^"]=ke["(+)"]=ke["(-)"]=ke.symmetricDifference=ke.symdiff=ke.xor;ke.fnFilter=ke.filterFn=ke.stdFilter=ke.filter;ke.complement=ke.abscomp=ke.absoluteComplement;var Ah={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}},Qs=function(e,t){var a=e.cy(),n=a.hasCompoundNodes();function i(v){var f=v.pstyle("z-compound-depth");return f.value==="auto"?n?v.zDepth():0:f.value==="bottom"?-1:f.value==="top"?si:0}var o=i(e)-i(t);if(o!==0)return o;function s(v){var f=v.pstyle("z-index-compare");return f.value==="auto"&&v.isNode()?1:0}var l=s(e)-s(t);if(l!==0)return l;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return u!==0?u:e.poolIndex()-t.poolIndex()},tn={forEach:function(e,t){if(Fe(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=t?e.apply(t,[i,n,this]):e(i,n,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 a=[],n=this.length;t==null&&(t=n),e==null&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)a.push(this[i]);return this.spawn(a)},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(!Fe(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Qs)},zDepth:function(){var e=this[0];if(e){var t=e._private,a=t.group;if(a==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:si-1}else{var i=t.source,o=t.target,s=i.zDepth(),l=o.zDepth();return Math.max(s,l,0)}}}};tn.each=tn.forEach;var Rh=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":We(Symbol))!=e&&We(Symbol.iterator)!=e;t&&(tn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Uo({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Rh();var Oh=er({nodeDimensionsIncludeLabels:!1}),Ka={layoutDimensions:function(e){e=Oh(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();t={w:a.w,h:a.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,a){var n=this.nodes().filter(function(S){return!S.isParent()}),i=this.cy(),o=t.eles,s=function(E){return E.id()},l=ua(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(E,x,D){var C={x:x.x1+x.w/2,y:x.y1+x.h/2},M={x:(D.x-C.x)*E,y:(D.y-C.y)*E};return{x:C.x+M.x,y:C.y+M.y}},v=t.spacingFactor&&t.spacingFactor!==1,f=function(){if(!v)return null;for(var E=hr(),x=0;x<n.length;x++){var D=n[x],C=l(D,x);Ov(E,C.x,C.y)}return E},c=f(),h=ua(function(S,E){var x=l(S,E);if(v){var D=Math.abs(t.spacingFactor);x=u(D,c,x)}return t.transform!=null&&(x=t.transform(S,x)),x},s);if(t.animate){for(var d=0;d<n.length;d++){var y=n[d],p=h(y,d),g=t.animateFilter==null||t.animateFilter(y,d);if(g){var m=y.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else y.position(p)}if(t.fit){var b=i.animation({fit:{boundingBox:o.boundingBoxAt(h),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else if(t.zoom!==void 0&&t.pan!==void 0){var w=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(w)}e.animations.forEach(function(S){return S.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Vt.all(e.animations.map(function(S){return S.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(h),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.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(be({},e,{eles:this}))}};Ka.createLayout=Ka.makeLayout=Ka.layout;function Js(r,e,t){var a=t._private,n=a.styleCache=a.styleCache||[],i;return(i=n[r])!=null||(i=n[r]=e(t)),i}function bn(r,e){return r=ft(r),function(a){return Js(r,e,a)}}function wn(r,e){r=ft(r);var t=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Js(r,t,n)}}var _e={recalculateRenderedStyle:function(e){var t=this.cy(),a=t.renderer(),n=t.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(t)}else this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var a=t._private.batchStyleEles;return a.merge(this),this}var n=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var a=this[t];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Se(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(de(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,e,a)}}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(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!t)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var l=o[s],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],a=t.cy().hasCompoundNodes();if(t)return a?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 zn(r,e){var t=r._private,a=t.data.parent?r.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function bi(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,a=r.parentOk||r.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||zn(i,a);var l=s.source,u=s.target;return t(l)&&(!o||zn(l,t))&&(l===u||t(u)&&(!o||zn(u,t)))}}}var Gt=bn("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});_e.takesUpSpace=wn("takesUpSpace",bi({ok:Gt}));var Ih=bn("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&Gt(r)}),zh=bn("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&Gt(r)});_e.interactive=wn("interactive",bi({ok:Ih,parentOk:zh,edgeOkViaNode:Gt}));_e.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var Nh=bn("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&Gt(r)}),Fh=Gt;_e.visible=wn("visible",bi({ok:Nh,edgeOkViaNode:Fh}));_e.hidden=function(){var r=this[0];if(r)return!r.visible()};_e.isBundledBezier=wn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});_e.bypass=_e.css=_e.style;_e.renderedCss=_e.renderedStyle;_e.removeBypass=_e.removeCss=_e.removeStyle;_e.pstyle=_e.parsedStyle;var Qr={};function po(r){return function(){var e=arguments,t=[];if(e.length===2){var a=e[0],n=e[1];this.on(r.event,a,n)}else if(e.length===1&&Fe(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&Re(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var l=this[s],u=!r.ableField||l._private[r.ableField],v=l._private[r.field]!=r.value;if(r.overrideAble){var f=r.overrideAble(l);if(f!==void 0&&(u=f,!f))return this}u&&(l._private[r.field]=r.value,v&&t.push(l))}var c=this.spawn(t);c.updateStyle(),c.emit(r.event),o&&c.emit(o)}return this}}function Kt(r){Qr[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},Qr[r.on]=po({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),Qr[r.off]=po({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}Kt({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Kt({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Kt({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Kt({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});Qr.deselect=Qr.unselect;Qr.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};Kt({field:"active",on:"activate",off:"unactivate"});Kt({field:"pannable",on:"panify",off:"unpanify"});Qr.inactive=function(){var r=this[0];if(r)return!r._private.active};var nr={},yo=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var l=!1,u=s.connectedEdges(),v=0;v<u.length;v++){var f=u[v],c=f.source(),h=f.target();if(e.noIncomingEdges&&h===s&&c!==s||e.noOutgoingEdges&&c===s&&h!==s){l=!0;break}}l||i.push(s)}}return this.spawn(i,!0).filter(a)}},mo=function(e){return function(t){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),l=0;l<s.length;l++){var u=s[l],v=u.source(),f=u.target();e.outgoing&&v===o?(n.push(u),n.push(f)):e.incoming&&f===o&&(n.push(u),n.push(v))}}return this.spawn(n,!0).filter(t)}},bo=function(e){return function(t){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,l=0;l<o.length;l++){var u=o[l],v=u.id();i[v]||(i[v]=!0,n.push(u),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(t)}};nr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};be(nr,{roots:yo({noIncomingEdges:!0}),leaves:yo({noOutgoingEdges:!0}),outgoers:wr(mo({outgoing:!0}),"outgoers"),successors:bo({outgoing:!0}),incomers:wr(mo({incoming:!0}),"incomers"),predecessors:bo({incoming:!0})});be(nr,{neighborhood:wr(function(r){for(var e=[],t=this.nodes(),a=0;a<t.length;a++)for(var n=t[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target(),v=n===l?u:l;v.length>0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});nr.neighbourhood=nr.neighborhood;nr.closedNeighbourhood=nr.closedNeighborhood;nr.openNeighbourhood=nr.openNeighborhood;be(nr,{source:wr(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:wr(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:wo({attr:"source"}),targets:wo({attr:"target"})});function wo(r){return function(t){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[r.attr];o&&a.push(o)}return this.spawn(a,!0).filter(t)}}be(nr,{edgesWith:wr(xo(),"edgesWith"),edgesTo:wr(xo({thisIsSrc:!0}),"edgesTo")});function xo(r){return function(t){var a=[],n=this._private.cy,i=r||{};de(t)&&(t=n.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,l=0;l<s.length;l++){var u=s[l],v=u._private.data,f=this.hasElementWithId(v.source)&&t.hasElementWithId(v.target),c=t.hasElementWithId(v.source)&&this.hasElementWithId(v.target),h=f||c;h&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!c)||a.push(u))}return this.spawn(a,!0)}}be(nr,{connectedEdges:wr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:wr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:wr(Eo(),"parallelEdges"),codirectedEdges:wr(Eo({codirected:!0}),"codirectedEdges")});function Eo(r){var e={codirected:!1};return r=be({},e,r),function(a){for(var n=[],i=this.edges(),o=r,s=0;s<i.length;s++)for(var l=i[s],u=l._private,v=u.source,f=v._private.data.id,c=u.data.target,h=v._private.edges,d=0;d<h.length;d++){var y=h[d],p=y._private.data,g=p.target,m=p.source,b=g===c&&m===f,w=f===g&&c===m;(o.codirected&&b||!o.codirected&&(b||w))&&n.push(y)}return this.spawn(n,!0).filter(a)}}be(nr,{components:function(e){var t=this,a=t.cy(),n=a.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(v,f){n.merge(v),i.unmerge(v),f.merge(v)};if(i.empty())return t.spawn();var l=function(){var v=a.collection();o.push(v);var f=i[0];s(f,v),t.bfs({directed:!1,roots:f,visit:function(h){return s(h,v)}}),v.forEach(function(c){c.connectedEdges().forEach(function(h){t.has(h)&&v.has(h.source())&&v.has(h.target())&&v.merge(h)})})};do l();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});nr.componentsOf=nr.components;var je=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ve("A collection must have a reference to the core");return}var i=new Or,o=!1;if(!t)t=[];else if(t.length>0&&Se(t[0])&&!wa(t[0])){o=!0;for(var s=[],l=new Ft,u=0,v=t.length;u<v;u++){var f=t[u];f.data==null&&(f.data={});var c=f.data;if(c.id==null)c.id=vs();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var h=new fn(e,f,!1);s.push(h),l.add(c.id)}t=s}this.length=0;for(var d=0,y=t.length;d<y;d++){var p=t[d][0];if(p!=null){var g=p._private.data.id;(!a||!i.has(g))&&(a&&i.set(g,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var b=this.lazyMap=new Or,w=this.eles,S=0;S<w.length;S++){var E=w[S];b.set(E.id(),{index:S,ele:E})}}},a&&(this._private.map=i),o&&!n&&this.restore()},Ie=fn.prototype=je.prototype=Object.create(Array.prototype);Ie.instanceString=function(){return"collection"};Ie.spawn=function(r,e){return new je(this.cy(),r,e)};Ie.spawnSelf=function(){return this.spawn(this)};Ie.cy=function(){return this._private.cy};Ie.renderer=function(){return this._private.cy.renderer()};Ie.element=function(){return this[0]};Ie.collection=function(){return Qo(this)?this:new je(this._private.cy,[this])};Ie.unique=function(){return new je(this._private.cy,this,!0)};Ie.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};Ie.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new je(e)};Ie.$id=Ie.getElementById;Ie.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};Ie.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};Ie.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};Ie.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var a=e._private;if(Se(r)){if(t.startBatch(),r.data){e.data(r.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=r.data.source,l=r.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),l!=null&&l!=n.target&&(o.target=""+l,i=!0),i&&(e=e.move(o))}else{var u="parent"in r.data,v=r.data.parent;u&&(v!=null||n.parent!=null)&&v!=n.parent&&(v===void 0&&(v=null),v!=null&&(v=""+v),e=e.move({parent:v}))}}r.position&&e.position(r.position);var f=function(y,p,g){var m=r[y];m!=null&&m!==a[y]&&(m?e[p]():e[g]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var c={data:Rr(a.data),position:Rr(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var h=0;return a.classes.forEach(function(d){return c.classes+=h++===0?d:" "+d}),c}}};Ie.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],a=t.json();r.push(a)}return r};Ie.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t],n=a.json(),i=new fn(r,n,!1);e.push(i)}return new je(r,e)};Ie.copy=Ie.clone;Ie.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],o=[],s,l=0,u=t.length;l<u;l++){var v=t[l];e&&!v.removed()||(v.isNode()?i.push(v):o.push(v))}s=i.concat(o);var f,c=function(){s.splice(f,1),f--};for(f=0;f<s.length;f++){var h=s[f],d=h._private,y=d.data;if(h.clearTraversalCache(),!(!e&&!d.removed)){if(y.id===void 0)y.id=vs();else if(ne(y.id))y.id=""+y.id;else if(Jr(y.id)||!de(y.id)){Ve("Can not create element with invalid string ID `"+y.id+"`"),c();continue}else if(a.hasElementWithId(y.id)){Ve("Can not create second element with ID `"+y.id+"`"),c();continue}}var p=y.id;if(h.isNode()){var g=d.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(h.isEdge()){for(var m=h,b=["source","target"],w=b.length,S=!1,E=0;E<w;E++){var x=b[E],D=y[x];ne(D)&&(D=y[x]=""+y[x]),D==null||D===""?(Ve("Can not create edge `"+p+"` with unspecified "+x),S=!0):a.hasElementWithId(D)||(Ve("Can not create edge `"+p+"` with nonexistant "+x+" `"+D+"`"),S=!0)}if(S){c();continue}var C=a.getElementById(y.source),M=a.getElementById(y.target);C.same(M)?C._private.edges.push(m):(C._private.edges.push(m),M._private.edges.push(m)),m._private.source=C,m._private.target=M}d.map=new Or,d.map.set(p,{ele:h,index:0}),d.removed=!1,e&&a.addToPool(h)}for(var P=0;P<i.length;P++){var B=i[P],L=B._private.data;ne(L.parent)&&(L.parent=""+L.parent);var k=L.parent,O=k!=null;if(O||B._private.parent){var A=B._private.parent?a.collection().merge(B._private.parent):a.getElementById(k);if(A.empty())L.parent=void 0;else if(A[0].removed())Me("Node added with missing parent, reference to parent removed"),L.parent=void 0,B._private.parent=null;else{for(var R=!1,I=A;!I.empty();){if(B.same(I)){R=!0,L.parent=void 0;break}I=I.parent()}R||(A[0]._private.children.push(B),B._private.parent=A[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var q=s.length===t.length?t:new je(a,s),$=0;$<q.length;$++){var F=q[$];F.isNode()||(F.parallelEdges().clearTraversalCache(),F.source().clearTraversalCache(),F.target().clearTraversalCache())}var N;n.hasCompoundNodes?N=a.collection().merge(q).merge(q.connectedNodes()).merge(q.parent()):N=q,N.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?q.emitAndNotify("add"):e&&q.emit("add")}return t};Ie.removed=function(){var r=this[0];return r&&r._private.removed};Ie.inside=function(){var r=this[0];return r&&!r._private.removed};Ie.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function o(k){for(var O=k._private.edges,A=0;A<O.length;A++)l(O[A])}function s(k){for(var O=k._private.children,A=0;A<O.length;A++)l(O[A])}function l(k){var O=n[k.id()];e&&k.removed()||O||(n[k.id()]=!0,k.isNode()?(a.push(k),o(k),s(k)):a.unshift(k))}for(var u=0,v=t.length;u<v;u++){var f=t[u];l(f)}function c(k,O){var A=k._private.edges;_r(A,O),k.clearTraversalCache()}function h(k){k.clearTraversalCache()}var d=[];d.ids={};function y(k,O){O=O[0],k=k[0];var A=k._private.children,R=k.id();_r(A,O),O._private.parent=null,d.ids[R]||(d.ids[R]=!0,d.push(k))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var p=0;p<a.length;p++){var g=a[p];if(g.isEdge()){var m=g.source()[0],b=g.target()[0];c(m,g),c(b,g);for(var w=g.parallelEdges(),S=0;S<w.length;S++){var E=w[S];h(E),E.isBundledBezier()&&E.dirtyBoundingBoxCache()}}else{var x=g.parent();x.length!==0&&y(x,g)}e&&(g._private.removed=!0)}var D=i._private.elements;i._private.hasCompoundNodes=!1;for(var C=0;C<D.length;C++){var M=D[C];if(M.isParent()){i._private.hasCompoundNodes=!0;break}}var P=new je(this.cy(),a);P.size()>0&&(r?P.emitAndNotify("remove"):e&&P.emit("remove"));for(var B=0;B<d.length;B++){var L=d[B];(!e||!L.removed())&&L.updateStyle()}return P};Ie.move=function(r){var e=this._private.cy,t=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(r.source!==void 0||r.target!==void 0){var o=i(r.source),s=i(r.target),l=o!=null&&e.hasElementWithId(o),u=s!=null&&e.hasElementWithId(s);(l||u)&&(e.batch(function(){t.remove(a,n),t.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var d=t[h],y=d._private.data;d.isEdge()&&(l&&(y.source=o),u&&(y.target=s))}t.restore(a,n)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var v=i(r.parent),f=v===null||e.hasElementWithId(v);if(f){var c=v===null?void 0:v;e.batch(function(){var h=t.remove(a,n);h.emitAndNotify("moveout");for(var d=0;d<t.length;d++){var y=t[d],p=y._private.data;y.isNode()&&(p.parent=c)}h.restore(a,n)}),t.emitAndNotify("move")}}return this};[Cs,Zd,Ga,Zr,zt,fh,yn,kh,Xs,Zs,Ah,tn,Ka,_e,Qr,nr].forEach(function(r){be(Ie,r)});var Vh={add:function(e){var t,a=this;if(gr(e)){var n=e;if(n._private.cy===a)t=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}t=new je(a,i)}}else if(Re(e)){var l=e;t=new je(a,l)}else if(Se(e)&&(Re(e.nodes)||Re(e.edges))){for(var u=e,v=[],f=["nodes","edges"],c=0,h=f.length;c<h;c++){var d=f[c],y=u[d];if(Re(y))for(var p=0,g=y.length;p<g;p++){var m=be({group:d},y[p]);v.push(m)}}t=new je(a,v)}else{var b=e;t=new fn(a,b).collection()}return t},remove:function(e){if(!gr(e)){if(de(e)){var t=e;e=this.$(t)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function qh(r,e,t,a){var n=4,i=.001,o=1e-7,s=10,l=11,u=1/(l-1),v=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var c=v?new Float32Array(l):new Array(l);function h(M,P){return 1-3*P+3*M}function d(M,P){return 3*P-6*M}function y(M){return 3*M}function p(M,P,B){return((h(P,B)*M+d(P,B))*M+y(P))*M}function g(M,P,B){return 3*h(P,B)*M*M+2*d(P,B)*M+y(P)}function m(M,P){for(var B=0;B<n;++B){var L=g(P,r,t);if(L===0)return P;var k=p(P,r,t)-M;P-=k/L}return P}function b(){for(var M=0;M<l;++M)c[M]=p(M*u,r,t)}function w(M,P,B){var L,k,O=0;do k=P+(B-P)/2,L=p(k,r,t)-M,L>0?B=k:P=k;while(Math.abs(L)>o&&++O<s);return k}function S(M){for(var P=0,B=1,L=l-1;B!==L&&c[B]<=M;++B)P+=u;--B;var k=(M-c[B])/(c[B+1]-c[B]),O=P+k*u,A=g(O,r,t);return A>=i?m(M,O):A===0?O:w(M,P,P+u)}var E=!1;function x(){E=!0,(r!==e||t!==a)&&b()}var D=function(P){return E||x(),r===e&&t===a?P:P===0?0:P===1?1:p(S(P),e,a)};D.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var C="generateBezier("+[r,e,t,a]+")";return D.toString=function(){return C},D}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var $h=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:r(o)}}function t(a,n){var i={dx:a.v,dv:r(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),l=e(a,n,s),u=1/6*(i.dx+2*(o.dx+s.dx)+l.dx),v=1/6*(i.dv+2*(o.dv+s.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(u=a(n,i),h=u/o*f):h=f;d=t(d||s,h),l.push(1+d.x),u+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),Oe=function(e,t,a,n){var i=qh(e,t,a,n);return function(o,s,l){return o+(s-o)*i(l)}},Wa={linear:function(e,t,a){return e+(t-e)*a},ease:Oe(.25,.1,.25,1),"ease-in":Oe(.42,0,1,1),"ease-out":Oe(0,0,.58,1),"ease-in-out":Oe(.42,0,.58,1),"ease-in-sine":Oe(.47,0,.745,.715),"ease-out-sine":Oe(.39,.575,.565,1),"ease-in-out-sine":Oe(.445,.05,.55,.95),"ease-in-quad":Oe(.55,.085,.68,.53),"ease-out-quad":Oe(.25,.46,.45,.94),"ease-in-out-quad":Oe(.455,.03,.515,.955),"ease-in-cubic":Oe(.55,.055,.675,.19),"ease-out-cubic":Oe(.215,.61,.355,1),"ease-in-out-cubic":Oe(.645,.045,.355,1),"ease-in-quart":Oe(.895,.03,.685,.22),"ease-out-quart":Oe(.165,.84,.44,1),"ease-in-out-quart":Oe(.77,0,.175,1),"ease-in-quint":Oe(.755,.05,.855,.06),"ease-out-quint":Oe(.23,1,.32,1),"ease-in-out-quint":Oe(.86,0,.07,1),"ease-in-expo":Oe(.95,.05,.795,.035),"ease-out-expo":Oe(.19,1,.22,1),"ease-in-out-expo":Oe(1,0,0,1),"ease-in-circ":Oe(.6,.04,.98,.335),"ease-out-circ":Oe(.075,.82,.165,1),"ease-in-out-circ":Oe(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return Wa.linear;var n=$h(e,t,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":Oe};function Co(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function So(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Et(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var o=So(r,n),s=So(e,n);if(ne(o)&&ne(s))return Co(i,o,s,t,a);if(Re(o)&&Re(s)){for(var l=[],u=0;u<s.length;u++){var v=o[u],f=s[u];if(v!=null&&f!=null){var c=Co(i,v,f,t,a);l.push(c)}else l.push(f)}return l}}function Hh(r,e,t,a){var n=!a,i=r._private,o=e._private,s=o.easing,l=o.startTime,u=a?r:r.cy(),v=u.style();if(!o.easingImpl)if(s==null)o.easingImpl=Wa.linear;else{var f;if(de(s)){var c=v.parse("transition-timing-function",s);f=c.value}else f=s;var h,d;de(f)?(h=f,d=[]):(h=f[1],d=f.slice(2).map(function(q){return+q})),d.length>0?(h==="spring"&&d.push(o.duration),o.easingImpl=Wa[h].apply(null,d)):o.easingImpl=Wa[h]}var y=o.easingImpl,p;if(o.duration===0?p=1:p=(t-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),o.delay==null){var g=o.startPosition,m=o.position;if(m&&n&&!r.locked()){var b={};ea(g.x,m.x)&&(b.x=Et(g.x,m.x,p,y)),ea(g.y,m.y)&&(b.y=Et(g.y,m.y,p,y)),r.position(b)}var w=o.startPan,S=o.pan,E=i.pan,x=S!=null&&a;x&&(ea(w.x,S.x)&&(E.x=Et(w.x,S.x,p,y)),ea(w.y,S.y)&&(E.y=Et(w.y,S.y,p,y)),r.emit("pan"));var D=o.startZoom,C=o.zoom,M=C!=null&&a;M&&(ea(D,C)&&(i.zoom=ca(i.minZoom,Et(D,C,p,y),i.maxZoom)),r.emit("zoom")),(x||M)&&r.emit("viewport");var P=o.style;if(P&&P.length>0&&n){for(var B=0;B<P.length;B++){var L=P[B],k=L.name,O=L,A=o.startStyle[k],R=v.properties[A.name],I=Et(A,O,p,y,R);v.overrideBypass(r,k,I)}r.emit("style")}}return o.progress=p,p}function ea(r,e){return r==null||e==null?!1:ne(r)&&ne(e)?!0:!!(r&&e)}function Gh(r,e,t,a){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}function To(r,e){var t=e._private.aniEles,a=[];function n(v,f){var c=v._private,h=c.animation.current,d=c.animation.queue,y=!1;if(h.length===0){var p=d.shift();p&&h.push(p)}for(var g=function(E){for(var x=E.length-1;x>=0;x--){var D=E[x];D()}E.splice(0,E.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;if(w.stopped){h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Gh(v,b,r),Hh(v,b,r,f),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),y=!0)}return!f&&h.length===0&&d.length===0&&a.push(v),y}for(var i=!1,o=0;o<t.length;o++){var s=t[o],l=n(s);i=i||l}var u=n(e,!0);(i||u)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var Kh={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Ja(function(i){To(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){To(o,e)},a.beforeRenderPriorities.animations):t()}},Wh={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},Fa=function(e){return de(e)?new jr(e):e},_s={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new mn(Wh,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,Fa(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,Fa(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,Fa(t),a),this},once:function(e,t,a){return this.emitter().one(e,Fa(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Be.eventAliasesOn(_s);var Yn={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)}};Yn.jpeg=Yn.jpg;var Ua={layout:function(e){var t=this;if(e==null){Ve("Layout options must be specified to make a layout");return}if(e.name==null){Ve("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){Ve("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;de(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new n(be({},e,{cy:t,eles:i}));return o}};Ua.createLayout=Ua.makeLayout=Ua.layout;var Uh={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=t.getElementById(i);s.data(o)}})}},Yh=er({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Xn={renderTo:function(e,t,a,n){var i=this._private.renderer;return i.renderTo(e,t,a,n),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,a=t.extension("renderer",e.name);if(a==null){Ve("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&&Me("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 n=Yh(e);n.cy=t,t._private.renderer=new a(n),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(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Xn.invalidateDimensions=Xn.resize;var Ya={collection:function(e,t){return de(e)?this.$(e):gr(e)?e.collection():Re(e)?(t||(t={}),new je(this,e,t.unique,t.removed)):new je(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ya.elements=Ya.filter=Ya.$;var or={},oa="t",Xh="f";or.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i<r.length;i++){var o=r[i],s=e.getContextMeta(o);if(!s.empty){var l=e.getContextStyle(s),u=e.applyContextStyle(s,l,o);o._private.appliedInitStyle?e.updateTransitions(o,u.diffProps):o._private.appliedInitStyle=!0;var v=e.updateStyleHints(o);v&&n.push(o)}}return n};or.getPropertiesDiff=function(r,e){var t=this,a=t._private.propDiffs=t._private.propDiffs||{},n=r+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},l=0;l<t.length;l++){var u=t[l],v=r[l]===oa,f=e[l]===oa,c=v!==f,h=u.mappedProperties.length>0;if(c||f&&h){var d=void 0;c&&h||c?d=u.properties:h&&(d=u.mappedProperties);for(var y=0;y<d.length;y++){for(var p=d[y],g=p.name,m=!1,b=l+1;b<t.length;b++){var w=t[b],S=e[b]===oa;if(S&&(m=w.properties[p.name]!=null,m))break}!s[g]&&!m&&(s[g]=!0,o.push(g))}}}return a[n]=o,o};or.getContextMeta=function(r){for(var e=this,t="",a,n=r._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(r);s?t+=oa:t+=Xh}return a=e.getPropertiesDiff(n,t),r._private.styleCxtKey=t,{key:t,diffPropNames:a,empty:a.length===0}};or.getContextStyle=function(r){var e=r.key,t=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<t.length;i++){var o=t[i],s=e[i]===oa;if(s)for(var l=0;l<o.properties.length;l++){var u=o.properties[l];n[u.name]=u}}return a[e]=n,n};or.applyContextStyle=function(r,e,t){for(var a=this,n=r.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var l=n[s],u=e[l],v=t.pstyle(l);if(!u)if(v)v.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(v!==u){if(u.mapped===o.fn&&v!=null&&v.mapping!=null&&v.mapping.value===u.value){var f=v.mapping,c=f.fnValue=u.value(t);if(c===f.prevFnValue)continue}var h=i[l]={prev:v};a.applyParsedProperty(t,u),h.next=t.pstyle(l),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}};or.updateStyleHints=function(r){var e=r._private,t=this,a=t.propertyGroupNames,n=t.propertyGroupKeys,i=function(X,oe,he){return t.getPropertiesHash(X,oe,he)},o=e.styleKey;if(r.removed())return!1;var s=e.group==="nodes",l=r._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var v=n[u];e.styleKeys[v]=[Dt,ta]}for(var f=function(X,oe){return e.styleKeys[oe][0]=la(X,e.styleKeys[oe][0])},c=function(X,oe){return e.styleKeys[oe][1]=va(X,e.styleKeys[oe][1])},h=function(X,oe){f(X,oe),c(X,oe)},d=function(X,oe){for(var he=0;he<X.length;he++){var ae=X.charCodeAt(he);f(ae,oe),c(ae,oe)}},y=2e9,p=function(X){return-128<X&&X<128&&Math.floor(X)!==X?y-(X*1024|0):X},g=0;g<a.length;g++){var m=a[g],b=l[m];if(b!=null){var w=this.properties[m],S=w.type,E=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(r,b):b.pfValue!=null&&(x=b.pfValue);var D=w.enums==null?b.value:null,C=x!=null,M=D!=null,P=C||M,B=b.units;if(S.number&&P&&!S.multiple){var L=C?x:D;h(p(L),E),!C&&B!=null&&d(B,E)}else d(b.strValue,E)}}for(var k=[Dt,ta],O=0;O<n.length;O++){var A=n[O],R=e.styleKeys[A];k[0]=la(R[0],k[0]),k[1]=va(R[1],k[1])}e.styleKey=_l(k[0],k[1]);var I=e.styleKeys;e.labelDimsKey=Wr(I.labelDimensions);var q=i(r,["label"],I.labelDimensions);if(e.labelKey=Wr(q),e.labelStyleKey=Wr(Ba(I.commonLabel,q)),!s){var $=i(r,["source-label"],I.labelDimensions);e.sourceLabelKey=Wr($),e.sourceLabelStyleKey=Wr(Ba(I.commonLabel,$));var F=i(r,["target-label"],I.labelDimensions);e.targetLabelKey=Wr(F),e.targetLabelStyleKey=Wr(Ba(I.commonLabel,F))}if(s){var N=e.styleKeys,W=N.nodeBody,Q=N.nodeBorder,_=N.nodeOutline,j=N.backgroundImage,ee=N.compound,U=N.pie,z=[W,Q,_,j,ee,U].filter(function(Y){return Y!=null}).reduce(Ba,[Dt,ta]);e.nodeKey=Wr(z),e.hasPie=U!=null&&U[0]!==Dt&&U[1]!==ta}return o!==e.styleKey};or.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null};or.applyParsedProperty=function(r,e){var t=this,a=e,n=r._private.style,i,o=t.types,s=t.properties[a.name].type,l=a.bypass,u=n[a.name],v=u&&u.bypass,f=r._private,c="mapping",h=function(W){return W==null?null:W.pfValue!=null?W.pfValue:W.value},d=function(){var W=h(u),Q=h(a);t.checkTriggers(r,a.name,W,Q)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(a=e=this.parse(e.name,"bezier",l)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return u?u.bypass?(n[a.name]=u.bypassed,d(),!0):!1:(d(),!0);var y=function(){Me("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var p=a.field.split("."),g=f.data,m=0;m<p.length&&g;m++){var b=p[m];g=g[b]}if(g==null)return y(),!1;var w;if(ne(g)){var S=a.fieldMax-a.fieldMin;S===0?w=0:w=(g-a.fieldMin)/S}else return Me("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+g+"` for `"+r.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),s.color){var E=a.valueMin[0],x=a.valueMax[0],D=a.valueMin[1],C=a.valueMax[1],M=a.valueMin[2],P=a.valueMax[2],B=a.valueMin[3]==null?1:a.valueMin[3],L=a.valueMax[3]==null?1:a.valueMax[3],k=[Math.round(E+(x-E)*w),Math.round(D+(C-D)*w),Math.round(M+(P-M)*w),Math.round(B+(L-B)*w)];i={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else if(s.number){var O=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,O,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case o.data:{for(var A=a.field.split("."),R=f.data,I=0;I<A.length&&R;I++){var q=A[I];R=R[q]}if(R!=null&&(i=this.parse(a.name,R,a.bypass,c)),!i)return y(),!1;i.mapping=a,a=i;break}case o.fn:{var $=a.value,F=a.fnValue!=null?a.fnValue:$(r);if(a.prevFnValue=F,F==null)return Me("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(a.name,F,a.bypass,c),!i)return Me("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=Rr(a),a=i;break}case void 0:break;default:return!1}return l?(v?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):v?u.bypassed=a:n[a.name]=a,d(),!0};or.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var a=r[t];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],l=n[s];l!=null&&(l.bypass?l.bypassed=null:n[s]=null)}}};or.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};or.updateTransitions=function(r,e){var t=this,a=r._private,n=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,o=r.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},l=!1,u=0;u<n.length;u++){var v=n[u],f=r.pstyle(v),c=e[v];if(c){var h=c.prev,d=h,y=c.next!=null?c.next:f,p=!1,g=void 0,m=1e-6;d&&(ne(d.pfValue)&&ne(y.pfValue)?(p=y.pfValue-d.pfValue,g=d.pfValue+m*p):ne(d.value)&&ne(y.value)?(p=y.value-d.value,g=d.value+m*p):Re(d.value)&&Re(y.value)&&(p=d.value[0]!==y.value[0]||d.value[1]!==y.value[1]||d.value[2]!==y.value[2],g=d.strValue),p&&(s[v]=y.strValue,this.applyBypass(r,v,g),l=!0))}}if(!l)return;a.transitioning=!0,new Vt(function(b){o>0?r.delayAnimation(o).play().promise().then(b):b()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};or.checkTrigger=function(r,e,t,a,n,i){var o=this.properties[e],s=n(o);s!=null&&s(t,a)&&i(o)};or.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};or.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(t==="bezier"||a==="bezier")&&r.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(t==="none"||a==="none")&&r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};or.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a)};var Sa={};Sa.applyBypass=function(r,e,t,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;s<n.properties.length;s++){var l=n.properties[s],u=l.name,v=this.parse(u,t,!0);v&&i.push(v)}}else if(de(e)){var f=this.parse(e,t,!0);f&&i.push(f)}else if(Se(e)){var c=e;a=t;for(var h=Object.keys(c),d=0;d<h.length;d++){var y=h[d],p=c[y];if(p===void 0&&(p=c[un(y)]),p!==void 0){var g=this.parse(y,p,!0);g&&i.push(g)}}}else return!1;if(i.length===0)return!1;for(var m=!1,b=0;b<r.length;b++){for(var w=r[b],S={},E=void 0,x=0;x<i.length;x++){var D=i[x];if(a){var C=w.pstyle(D.name);E=S[D.name]={prev:C}}m=this.applyParsedProperty(w,Rr(D))||m,a&&(E.next=w.pstyle(D.name))}m&&this.updateStyleHints(w),a&&this.updateTransitions(w,S,o)}return m};Sa.overrideBypass=function(r,e,t){e=oi(e);for(var a=0;a<r.length;a++){var n=r[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,l=o.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),s?i.strValue="rgb("+t.join(",")+")":l?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(n)),this.checkTriggers(n,e,u,t)}};Sa.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};Sa.removeBypasses=function(r,e,t){for(var a=!0,n=0;n<r.length;n++){for(var i=r[n],o={},s=0;s<e.length;s++){var l=e[s],u=this.properties[l],v=i.pstyle(u.name);if(!(!v||!v.bypass)){var f="",c=this.parse(l,f,!0),h=o[u.name]={prev:v};this.applyParsedProperty(i,c),h.next=i.pstyle(u.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,o,a)}};var wi={};wi.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};wi.containerCss=function(r){var e=this._private.cy,t=e.container(),a=e.window();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(r)};var Ir={};Ir.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};Ir.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var a={},n=0;n<t.properties.length;n++){var i=t.properties[n],o=t.getStylePropertyValue(r,i.name,e);o!=null&&(a[i.name]=o,a[un(i.name)]=o)}return a}};Ir.getIndexedStyle=function(r,e,t,a){var n=r.pstyle(e)[t][a];return n??r.cy().style().getDefaultProperty(e)[t][0]};Ir.getStylePropertyValue=function(r,e,t){var a=this;if(r=r[0],r){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=r.pstyle(n.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(t&&i.number&&s!=null&&ne(s)){var v=r.cy().zoom(),f=function(p){return p*v},c=function(p,g){return f(p)+g},h=Re(s),d=h?l.every(function(y){return y!=null}):l!=null;return d?h?s.map(function(y,p){return c(y,l[p])}).join(" "):c(s,l):h?s.map(function(y){return de(y)?y:""+f(y)}).join(" "):""+f(s)}else if(u!=null)return u}return null}};Ir.getAnimationStartStyle=function(r,e){for(var t={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=r.pstyle(i);o!==void 0&&(Se(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(t[i]=o)}return t};Ir.getPropsList=function(r){var e=this,t=[],a=r,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],l=a[s],u=n[s]||n[oi(s)],v=this.parse(u.name,l);v&&t.push(v)}return t};Ir.getNonDefaultPropertiesHash=function(r,e,t){var a=t.slice(),n,i,o,s,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=r.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=la(s,a[0]),a[1]=va(s,a[1]);else for(o=i.strValue,u=0;u<o.length;u++)s=o.charCodeAt(u),a[0]=la(s,a[0]),a[1]=va(s,a[1]);return a};Ir.getPropertiesHash=Ir.getNonDefaultPropertiesHash;var xn={};xn.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var a=r[t],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var l=o[s],u=i[l];e.css(l,u)}}return e};xn.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};xn.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],a=t.selector,n=t.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}r.push({selector:a?a.toString():"core",style:i})}return r};var xi={};xi.appendFromString=function(r){var e=this,t=this,a=""+r,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Me("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new jr(f);if(c.invalid){Me("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var h=v[2],d=!1;i=h;for(var y=[];;){var p=i.match(/^\s*$/);if(p)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Me("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=g[0];var m=g[1],b=g[2],w=e.properties[m];if(!w){Me("Skipping property: Invalid property name in: "+o),l();continue}var S=t.parse(m,b);if(!S){Me("Skipping property: Invalid property definition in: "+o),l();continue}y.push({name:m,val:b}),l()}if(d){s();break}t.selector(f);for(var E=0;E<y.length;E++){var x=y[E];t.css(x.name,x.val)}s()}return t};xi.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var Je={};(function(){var r=Ke,e=rl,t=al,a=nl,n=il,i=function(z){return"^"+z+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(z){var Y=r+"|\\w+|"+e+"|"+t+"|"+a+"|"+n;return"^"+z+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+Y+")\\s*\\,\\s*("+Y+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Je.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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,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(z,Y){switch(z.length){case 2:return Y[0]!=="deg"&&Y[0]!=="rad"&&Y[1]!=="deg"&&Y[1]!=="rad";case 1:return de(z[0])||Y[0]==="deg"||Y[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\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(z){var Y=z.length;return Y===1||Y===2||Y===4}}};var l={zeroNonZero:function(z,Y){return(z==null||Y==null)&&z!==Y||z==0&&Y!=0?!0:z!=0&&Y==0},any:function(z,Y){return z!=Y},emptyNonEmpty:function(z,Y){var X=Jr(z),oe=Jr(Y);return X&&!oe||!X&&oe}},u=Je.types,v=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],f=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],c=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],h=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],d=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],y=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],p=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],g=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],w=function(z,Y){return Y.value==="label"?-z.poolIndex():Y.pfValue},S=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],E=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],x=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],D=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],C=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],M=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],P=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],B=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],L=[];Je.pieBackgroundN=16,L.push({name:"pie-size",type:u.sizeMaybePercent});for(var k=1;k<=Je.pieBackgroundN;k++)L.push({name:"pie-"+k+"-background-color",type:u.color}),L.push({name:"pie-"+k+"-background-size",type:u.percent}),L.push({name:"pie-"+k+"-background-opacity",type:u.zeroOneNumber});var O=[],A=Je.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(U){A.forEach(function(z){var Y=z+"-"+U.name,X=U.type,oe=U.triggersBounds;O.push({name:Y,type:X,triggersBounds:oe})})},{});var R=Je.properties=[].concat(y,b,p,g,m,P,d,h,v,f,c,S,E,x,D,L,C,M,O,B),I=Je.propertyGroups={behavior:y,transition:b,visibility:p,overlay:g,underlay:m,ghost:P,commonLabel:d,labelDimensions:h,mainLabel:v,sourceLabel:f,targetLabel:c,nodeBody:S,nodeBorder:E,nodeOutline:x,backgroundImage:D,pie:L,compound:C,edgeLine:M,edgeArrow:O,core:B},q=Je.propertyGroupNames={},$=Je.propertyGroupKeys=Object.keys(I);$.forEach(function(U){q[U]=I[U].map(function(z){return z.name}),I[U].forEach(function(z){return z.groupKey=U})});var F=Je.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"}];Je.propertyNames=R.map(function(U){return U.name});for(var N=0;N<R.length;N++){var W=R[N];R[W.name]=W}for(var Q=0;Q<F.length;Q++){var _=F[Q],j=R[_.pointsTo],ee={name:_.name,alias:!0,pointsTo:j};R.push(ee),R[_.name]=ee}})();Je.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};Je.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=be({"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,u){for(var v=1;v<=Je.pieBackgroundN;v++){var f=u.name.replace("{{i}}",v),c=u.value;l[f]=c}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,u){return Je.arrowPrefixes.forEach(function(v){var f=v+"-"+u.name,c=u.value;l[f]=c}),l},{})),t={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);t[i]=s}}return r.defaultProperties=t,r.defaultProperties};Je.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 En={};En.parse=function(r,e,t,a){var n=this;if(Fe(e))return n.parseImplWarn(r,e,t,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=t?"t":"f",s=""+e,l=ss(r,s,o,i),u=n.propCache=n.propCache||[],v;return(v=u[l])||(v=u[l]=n.parseImplWarn(r,e,t,a)),(t||a==="mapping")&&(v=Rr(v),v&&(v.value=Rr(v.value))),v};En.parseImplWarn=function(r,e,t,a){var n=this.parseImpl(r,e,t,a);return!n&&e!=null&&Me("The style property `".concat(r,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Me("The style value of `label` is deprecated for `"+n.name+"`"),n};En.parseImpl=function(r,e,t,a){var n=this;r=oi(r);var i=n.properties[r],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var l=de(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(Fe(e))return{name:r,value:e,strValue:"fn",mapped:s.fn,bypass:t};var v,f;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(t)return!1;var c=s.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=s.mapData;if(!(u.color||u.number))return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Me("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(u.color){var p=d.value,g=y.value,m=p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(p[3]==null||p[3]===1)&&(g[3]==null||g[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):Re(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var w=[],S=[],E=[],x="",D=!1,C=0;C<b.length;C++){var M=n.parse(r,b[C],t,"multiple");D=D||de(M.value),w.push(M.value),E.push(M.pfValue!=null?M.pfValue:M.value),S.push(M.units),x+=(C>0?" ":"")+M.strValue}return u.validate&&!u.validate(w,S)?null:u.singleEnum&&D?w.length===1&&de(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:E,strValue:x,bypass:t,units:S}}var P=function(){for(var z=0;z<u.enums.length;z++){var Y=u.enums[z];if(Y===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(u.number){var B,L="px";if(u.units&&(B=u.units),u.implicitUnits&&(L=u.implicitUnits),!u.unitless)if(l){var k="px|em"+(u.allowPercent?"|\\%":"");B&&(k=B);var O=e.match("^("+Ke+")("+k+")?$");O&&(e=O[1],B=O[2]||L)}else(!B||u.implicitUnits)&&(B=L);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=o,P();if(u.integer&&!Xu(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var A={name:r,value:e,strValue:""+e+(B||""),units:B,bypass:t};return u.unitless||B!=="px"&&B!=="em"?A.pfValue=e:A.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(A.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(A.pfValue=B==="rad"?e:Pv(e)),B==="%"&&(A.pfValue=e/100),A}else if(u.propList){var R=[],I=""+e;if(I!=="none"){for(var q=I.split(/\s*,\s*|\s+/),$=0;$<q.length;$++){var F=q[$].trim();n.properties[F]?R.push(F):Me("`"+F+"` is not a valid property name")}if(R.length===0)return null}return{name:r,value:R,strValue:R.length===0?"none":R.join(" "),bypass:t}}else if(u.color){var N=fl(e);return N?{name:r,value:N,pfValue:N,strValue:"rgb("+N[0]+","+N[1]+","+N[2]+")",bypass:t}:null}else if(u.regex||u.regexes){if(u.enums){var W=P();if(W)return W}for(var Q=u.regexes?u.regexes:[u.regex],_=0;_<Q.length;_++){var j=new RegExp(Q[_]),ee=j.exec(e);if(ee)return{name:r,value:u.singleRegexMatchValue?ee[1]:ee,strValue:""+e,bypass:t}}return null}else return u.string?{name:r,value:""+e,strValue:""+e,bypass:t}:u.enums?P():null};var ar=function r(e){if(!(this instanceof r))return new r(e);if(!ii(e)){Ve("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},ir=ar.prototype;ir.instanceString=function(){return"style"};ir.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};ir.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};ir.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};ir.selector=function(r){var e=r==="core"?null:new jr(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};ir.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],a=0;a<r.properties.length;a++){var n=r.properties[a],i=t[n.name];i===void 0&&(i=t[un(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};ir.style=ir.css;ir.cssRule=function(r,e){var t=this.parse(r,e);if(t){var a=this.length-1;this[a].properties.push(t),this[a].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.mapped&&this[a].mappedProperties.push(t);var n=!this[a].selector;n&&(this._private.coreStyle[t.name]=t)}return this};ir.append=function(r){return Jo(r)?r.appendToStyle(this):Re(r)?this.appendFromJson(r):de(r)&&this.appendFromString(r),this};ar.fromJson=function(r,e){var t=new ar(r);return t.fromJson(e),t};ar.fromString=function(r,e){return new ar(r).fromString(e)};[or,Sa,wi,Ir,xn,xi,Je,En].forEach(function(r){be(ir,r)});ar.types=ir.types;ar.properties=ir.properties;ar.propertyGroups=ir.propertyGroups;ar.propertyGroupNames=ir.propertyGroupNames;ar.propertyGroupKeys=ir.propertyGroupKeys;var Zh={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return Jo(e)?t.style=e.generateStyle(this):Re(e)?t.style=ar.fromJson(this,e):de(e)?t.style=ar.fromString(this,e):t.style=ar(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Qh="single",gt={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=Qh),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,a,n,i,o,s;switch(e.length){case 0:return t;case 1:if(de(e[0]))return a=e[0],t[a];if(Se(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,ne(o)&&(t.x=o),ne(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ne(n)&&(t[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var a=arguments,n=this._private.pan,i,o,s,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Se(e)&&(s=a[0],l=s.x,u=s.y,ne(l)&&(n.x+=l),ne(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&ne(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,t){var a=this.getFitViewport(e,t);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.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 a;if(de(e)){var n=e;e=this.$(n)}else if(Ju(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else gr(e)||(e=this.mutableElements());if(!(gr(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),l;if(t=ne(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((o-2*t)/a.w,(s-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(o-l*(a.x1+a.x2))/2,y:(s-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,t){var a=this._private;if(t==null){var n=e;e=n.min,t=n.max}return ne(e)&&ne(t)&&e<=t?(a.minZoom=e,a.maxZoom=t):ne(e)&&t===void 0&&e<=a.maxZoom?a.minZoom=e:ne(t)&&e===void 0&&t>=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,a=t.pan,n=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),ne(e)?o=e:Se(e)&&(o=e.level,e.position!=null?i=cn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,s||!ne(o)||o===n||i!=null&&(!ne(i.x)||!ne(i.y)))return null;if(i!=null){var l=a,u=n,v=o,f={x:-v/u*(i.x-l.x)+i.x,y:-v/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:v,pan:f}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),a=this._private;return t==null||!t.zoomed?this:(a.zoom=t.zoom,t.panned&&(a.pan.x=t.pan.x,a.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(ne(e.zoom)||(a=!1),Se(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ne(u.x)&&(t.pan.x=u.x,s=!1),ne(u.y)&&(t.pan.y=u.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(de(e)){var a=e;e=this.mutableElements().filter(a)}else gr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(n.x1+n.x2))/2,y:(o-t*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};gt.centre=gt.center;gt.autolockNodes=gt.autolock;gt.autoungrabifyNodes=gt.autoungrabify;var ya={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ya.attr=ya.data;ya.removeAttr=ya.removeData;var ma=function(e){var t=this;e=be({},e);var a=e.container;a&&!Qa(a)&&Qa(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var o=Ge!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=be({name:o?"grid":"null"},s.layout),s.renderer=be({name:o?"canvas":"null"},s.renderer);var l=function(d,y,p){return y!==void 0?y:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:s,elements:new je(this),listeners:[],aniEles:new je(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ne(s.zoom)?s.zoom:1,pan:{x:Se(s.pan)&&ne(s.pan.x)?s.pan.x:0,y:Se(s.pan)&&ne(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var v=function(d,y){var p=d.some(_u);if(p)return Vt.all(d).then(y);y(d)};u.styleEnabled&&t.setStyle([]);var f=be({},s,s.renderer);t.initRenderer(f);var c=function(d,y,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),d!=null&&(Se(d)||Re(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var m=be({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([s.style,s.elements],function(h){var d=h[0],y=h[1];u.styleEnabled&&t.style().append(d),c(y,function(){t.startAnimationLoop(),u.ready=!0,Fe(s.ready)&&t.on("ready",s.ready);for(var p=0;p<i.length;p++){var g=i[p];t.on("ready",g)}n&&(n.readies=[]),t.emit("ready")},s.done)})},an=ma.prototype;be(an,{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 Ge;var t=this._private.container.ownerDocument;return t===void 0||t==null?Ge:t.defaultView||Ge},mount:function(e){if(e!=null){var t=this,a=t._private,n=a.options;return!Qa(e)&&Qa(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),a.container=e,a.styleEnabled=!0,t.invalidateSize(),t.initRenderer(be({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.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 Rr(this._private.options)},json:function(e){var t=this,a=t._private,n=t.mutableElements(),i=function(w){return t.getElementById(w.id())};if(Se(e)){if(t.startBatch(),e.elements){var o={},s=function(w,S){for(var E=[],x=[],D=0;D<w.length;D++){var C=w[D];if(!C.data.id){Me("cy.json() cannot handle elements without an ID attribute");continue}var M=""+C.data.id,P=t.getElementById(M);o[M]=!0,P.length!==0?x.push({ele:P,json:C}):(S&&(C.group=S),E.push(C))}t.add(E);for(var B=0;B<x.length;B++){var L=x[B],k=L.ele,O=L.json;k.json(O)}};if(Re(e.elements))s(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var v=l[u],f=e.elements[v];Re(f)&&s(f,v)}var c=t.collection();n.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?c.merge(b):b.remove()}),c.forEach(function(b){return b.children().move({parent:null})}),c.forEach(function(b){return i(b).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.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"],d=0;d<h.length;d++){var y=h[d];e[y]!=null&&t[y](e[y])}return t.endBatch(),this}else{var p=!!e,g={};p?g.elements=this.elements().map(function(b){return b.json()}):(g.elements={},n.forEach(function(b){var w=b.group();g.elements[w]||(g.elements[w]=[]),g.elements[w].push(b.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=Rr(t.data());var m=a.options;return g.zoomingEnabled=a.zoomingEnabled,g.userZoomingEnabled=a.userZoomingEnabled,g.zoom=a.zoom,g.minZoom=a.minZoom,g.maxZoom=a.maxZoom,g.panningEnabled=a.panningEnabled,g.userPanningEnabled=a.userPanningEnabled,g.pan=Rr(a.pan),g.boxSelectionEnabled=a.boxSelectionEnabled,g.renderer=Rr(m.renderer),g.hideEdgesOnViewport=m.hideEdgesOnViewport,g.textureOnViewport=m.textureOnViewport,g.wheelSensitivity=m.wheelSensitivity,g.motionBlur=m.motionBlur,g.multiClickDebounceTime=m.multiClickDebounceTime,g}}});an.$id=an.getElementById;[Vh,Kh,_s,Yn,Ua,Uh,Xn,Ya,Zh,gt,ya].forEach(function(r){be(an,r)});var Jh={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}},_h={maximal:!1,acyclic:!1},Ct=function(e){return e.scratch("breadthfirst")},Do=function(e,t){return e.scratch("breadthfirst",t)};function js(r){this.options=be({},Jh,_h,r)}js.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().filter(function(ae){return!ae.isParent()}),i=a,o=e.directed,s=e.acyclic||e.maximal||e.maximalAdjustments>0,l=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),u;if(gr(e.roots))u=e.roots;else if(Re(e.roots)){for(var v=[],f=0;f<e.roots.length;f++){var c=e.roots[f],h=t.getElementById(c);v.push(h)}u=t.collection(v)}else if(de(e.roots))u=t.$(e.roots);else if(o)u=n.roots();else{var d=a.components();u=t.collection();for(var y=function(ie){var ue=d[ie],ce=ue.maxDegree(!1),ve=ue.filter(function(pe){return pe.degree(!1)===ce});u=u.add(ve)},p=0;p<d.length;p++)y(p)}var g=[],m={},b=function(ie,ue){g[ue]==null&&(g[ue]=[]);var ce=g[ue].length;g[ue].push(ie),Do(ie,{index:ce,depth:ue})},w=function(ie,ue){var ce=Ct(ie),ve=ce.depth,pe=ce.index;g[ve][pe]=null,b(ie,ue)};i.bfs({roots:u,directed:e.directed,visit:function(ie,ue,ce,ve,pe){var Pe=ie[0],Ee=Pe.id();b(Pe,pe),m[Ee]=!0}});for(var S=[],E=0;E<n.length;E++){var x=n[E];m[x.id()]||S.push(x)}var D=function(ie){for(var ue=g[ie],ce=0;ce<ue.length;ce++){var ve=ue[ce];if(ve==null){ue.splice(ce,1),ce--;continue}Do(ve,{depth:ie,index:ce})}},C=function(){for(var ie=0;ie<g.length;ie++)D(ie)},M=function(ie,ue){for(var ce=Ct(ie),ve=ie.incomers().filter(function(T){return T.isNode()&&a.has(T)}),pe=-1,Pe=ie.id(),Ee=0;Ee<ve.length;Ee++){var xe=ve[Ee],Te=Ct(xe);pe=Math.max(pe,Te.depth)}if(ce.depth<=pe){if(!e.acyclic&&ue[Pe])return null;var J=pe+1;return w(ie,J),ue[Pe]=J,!0}return!1};if(o&&s){var P=[],B={},L=function(ie){return P.push(ie)},k=function(){return P.shift()};for(n.forEach(function(ae){return P.push(ae)});P.length>0;){var O=k(),A=M(O,B);if(A)O.outgoers().filter(function(ae){return ae.isNode()&&a.has(ae)}).forEach(L);else if(A===null){Me("Detected double maximal shift for node `"+O.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var R=0;if(e.avoidOverlap)for(var I=0;I<n.length;I++){var q=n[I],$=q.layoutDimensions(e),F=$.w,N=$.h;R=Math.max(R,F,N)}var W={},Q=function(ie){if(W[ie.id()])return W[ie.id()];for(var ue=Ct(ie).depth,ce=ie.neighborhood(),ve=0,pe=0,Pe=0;Pe<ce.length;Pe++){var Ee=ce[Pe];if(!(Ee.isEdge()||Ee.isParent()||!n.has(Ee))){var xe=Ct(Ee);if(xe!=null){var Te=xe.index,J=xe.depth;if(!(Te==null||J==null)){var T=g[J].length;J<ue&&(ve+=Te/T,pe++)}}}}return pe=Math.max(1,pe),ve=ve/pe,pe===0&&(ve=0),W[ie.id()]=ve,ve},_=function(ie,ue){var ce=Q(ie),ve=Q(ue),pe=ce-ve;return pe===0?jo(ie.id(),ue.id()):pe};e.depthSort!==void 0&&(_=e.depthSort);for(var j=0;j<g.length;j++)g[j].sort(_),D(j);for(var ee=[],U=0;U<S.length;U++)ee.push(S[U]);g.unshift(ee),C();for(var z=0,Y=0;Y<g.length;Y++)z=Math.max(g[Y].length,z);var X={x:l.x1+l.w/2,y:l.x1+l.h/2},oe=g.reduce(function(ae,ie){return Math.max(ae,ie.length)},0),he=function(ie){var ue=Ct(ie),ce=ue.depth,ve=ue.index,pe=g[ce].length,Pe=Math.max(l.w/((e.grid?oe:pe)+1),R),Ee=Math.max(l.h/(g.length+1),R),xe=Math.min(l.w/2/g.length,l.h/2/g.length);if(xe=Math.max(xe,R),e.circle){var J=xe*ce+xe-(g.length>0&&g[0].length<=3?xe/2:0),T=2*Math.PI/g[ce].length*ve;return ce===0&&g[0].length===1&&(J=1),{x:X.x+J*Math.cos(T),y:X.y+J*Math.sin(T)}}else{var Te={x:X.x+(ve+1-(pe+1)/2)*Pe,y:(ce+1)*Ee};return Te}};return a.nodes().layoutPositions(this,e,he),this};var jh={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function eu(r){this.options=be({},jh,r)}eu.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),v,f=0,c=0;c<i.length;c++){var h=i[c],d=h.layoutDimensions(e),y=d.w,p=d.h;f=Math.max(f,y,p)}if(ne(e.radius)?v=e.radius:i.length<=1?v=0:v=Math.min(o.h,o.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var g=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(g*g+m*m));v=Math.max(b,v)}var w=function(E,x){var D=e.startAngle+x*u*(n?1:-1),C=v*Math.cos(D),M=v*Math.sin(D),P={x:s.x+C,y:s.y+M};return P};return a.nodes().layoutPositions(this,e,w),this};var eg={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric: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 ru(r){this.options=be({},eg,r)}ru.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),o=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,v=0;v<i.length;v++){var f=i[v],c=void 0;c=e.concentric(f),l.push({value:c,node:f}),f._private.scratch.concentric=c}i.updateStyle();for(var h=0;h<i.length;h++){var d=i[h],y=d.layoutDimensions(e);u=Math.max(u,y.w,y.h)}l.sort(function(ae,ie){return ie.value-ae.value});for(var p=e.levelWidth(i),g=[[]],m=g[0],b=0;b<l.length;b++){var w=l[b];if(m.length>0){var S=Math.abs(m[0].value-w.value);S>=p&&(m=[],g.push(m))}m.push(w)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,D=Math.min(o.w,o.h)/2-E,C=D/(g.length+x?1:0);E=Math.min(E,C)}for(var M=0,P=0;P<g.length;P++){var B=g[P],L=e.sweep===void 0?2*Math.PI-2*Math.PI/B.length:e.sweep,k=B.dTheta=L/Math.max(1,B.length-1);if(B.length>1&&e.avoidOverlap){var O=Math.cos(k)-Math.cos(0),A=Math.sin(k)-Math.sin(0),R=Math.sqrt(E*E/(O*O+A*A));M=Math.max(R,M)}B.r=M,M+=E}if(e.equidistant){for(var I=0,q=0,$=0;$<g.length;$++){var F=g[$],N=F.r-q;I=Math.max(I,N)}q=0;for(var W=0;W<g.length;W++){var Q=g[W];W===0&&(q=Q.r),Q.r=q,q+=I}}for(var _={},j=0;j<g.length;j++)for(var ee=g[j],U=ee.dTheta,z=ee.r,Y=0;Y<ee.length;Y++){var X=ee[Y],oe=e.startAngle+(t?1:-1)*U*Y,he={x:s.x+z*Math.cos(oe),y:s.y+z*Math.sin(oe)};_[X.node.id()]=he}return n.nodes().layoutPositions(this,e,function(ae){var ie=ae.id();return _[ie]}),this};var Nn,rg={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 Cn(r){this.options=be({},rg,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),a=t.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===o});return!s||!l});this.options.eles=this.options.eles.not(a)}Cn.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?Nn=!0:Nn=!1;var a=tg(e,t,r);Nn&&ig(a),r.randomize&&og(a);var n=qr(),i=function(){sg(a,e,r),r.fit===!0&&e.fit(r.padding)},o=function(c){return!(t.stopped||c>=r.numIter||(ug(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature<r.minTemp))},s=function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var c=r.eles.nodes(),h=tu(a,r,c);c.layoutPositions(t,r,h)}},l=0,u=!0;if(r.animate===!0){var v=function f(){for(var c=0;u&&c<r.refresh;)u=o(l),l++,c++;if(!u)Po(a,r),s();else{var h=qr();h-n>=r.animationThreshold&&i(),Ja(f)}};v()}else{for(;u;)u=o(l),l++;Po(a,r),s()}return this};Cn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Cn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var tg=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=hr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=a.eles.components(),u={},v=0;v<l.length;v++)for(var f=l[v],c=0;c<f.length;c++){var h=f[c];u[h.id()]=v}for(var v=0;v<s.nodeSize;v++){var d=i[v],y=d.layoutDimensions(a),p={};p.isLocked=d.locked(),p.id=d.data("id"),p.parentId=d.data("parent"),p.cmptId=u[d.id()],p.children=[],p.positionX=d.position("x"),p.positionY=d.position("y"),p.offsetX=0,p.offsetY=0,p.height=y.w,p.width=y.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(d.style("padding")),p.padRight=parseFloat(d.style("padding")),p.padTop=parseFloat(d.style("padding")),p.padBottom=parseFloat(d.style("padding")),p.nodeRepulsion=Fe(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,s.layoutNodes.push(p),s.idToIndex[p.id]=v}for(var g=[],m=0,b=-1,w=[],v=0;v<s.nodeSize;v++){var d=s.layoutNodes[v],S=d.parentId;S!=null?s.layoutNodes[s.idToIndex[S]].children.push(d.id):(g[++b]=d.id,w.push(d.id))}for(s.graphSet.push(w);m<=b;){var E=g[m++],x=s.idToIndex[E],h=s.layoutNodes[x],D=h.children;if(D.length>0){s.graphSet.push(D);for(var v=0;v<D.length;v++)g[++b]=D[v]}}for(var v=0;v<s.graphSet.length;v++)for(var C=s.graphSet[v],c=0;c<C.length;c++){var M=s.idToIndex[C[c]];s.indexToGraph[M]=v}for(var v=0;v<s.edgeSize;v++){var P=n[v],B={};B.id=P.data("id"),B.sourceId=P.data("source"),B.targetId=P.data("target");var L=Fe(a.idealEdgeLength)?a.idealEdgeLength(P):a.idealEdgeLength,k=Fe(a.edgeElasticity)?a.edgeElasticity(P):a.edgeElasticity,O=s.idToIndex[B.sourceId],A=s.idToIndex[B.targetId],R=s.indexToGraph[O],I=s.indexToGraph[A];if(R!=I){for(var q=ag(B.sourceId,B.targetId,s),$=s.graphSet[q],F=0,p=s.layoutNodes[O];$.indexOf(p.id)===-1;)p=s.layoutNodes[s.idToIndex[p.parentId]],F++;for(p=s.layoutNodes[A];$.indexOf(p.id)===-1;)p=s.layoutNodes[s.idToIndex[p.parentId]],F++;L*=F*a.nestingFactor}B.idealLength=L,B.elasticity=k,s.layoutEdges.push(B)}return s},ag=function(e,t,a){var n=ng(e,t,0,a);return 2>n.count?0:n.graph},ng=function r(e,t,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var l=i[s],u=n.idToIndex[l],v=n.layoutNodes[u].children;if(v.length!==0){var f=n.indexToGraph[n.idToIndex[v[0]]],c=r(e,t,f,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},ig,og=function(e,t){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},tu=function(e,t,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var l=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var u=(l.positionX-i.x1)/i.w,v=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+v*n.h}}else return{x:l.positionX,y:l.positionY}}},sg=function(e,t,a){var n=a.layout,i=a.eles.nodes(),o=tu(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},ug=function(e,t,a){lg(e,t),cg(e),dg(e,t),hg(e),gg(e)},lg=function(e,t){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],l=o+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];vg(s,u,e,t)}},ko=function(e){return-e+2*e*Math.random()},vg=function(e,t,a,n){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!a.isCompound)){var s=t.positionX-e.positionX,l=t.positionY-e.positionY,u=1;s===0&&l===0&&(s=ko(u),l=ko(u));var v=fg(e,t,s,l);if(v>0)var f=n.nodeOverlap*v,c=Math.sqrt(s*s+l*l),h=f*s/c,d=f*l/c;else var y=nn(e,s,l),p=nn(t,-1*s,-1*l),g=p.x-y.x,m=p.y-y.y,b=g*g+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*g/c,d=f*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},fg=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},nn=function(e,t,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,l=a/t,u=o/s,v={};return t===0&&0<a||t===0&&0>a?(v.x=n,v.y=i+o/2,v):0<t&&-1*u<=l&&l<=u?(v.x=n+s/2,v.y=i+s*a/2/t,v):0>t&&-1*u<=l&&l<=u?(v.x=n-s/2,v.y=i-s*a/2/t,v):0<a&&(l<=-1*u||l>=u)?(v.x=n+o*t/2/a,v.y=i+o/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-o*t/2/a,v.y=i-o/2),v)},cg=function(e,t){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],l=e.layoutNodes[s],u=l.positionX-o.positionX,v=l.positionY-o.positionY;if(!(u===0&&v===0)){var f=nn(o,u,v),c=nn(l,-1*u,-1*v),h=c.x-f.x,d=c.y-f.y,y=Math.sqrt(h*h+d*d),p=Math.pow(n.idealLength-y,2)/n.elasticity;if(y!==0)var g=p*h/y,m=p*d/y;else var g=0,m=0;o.isLocked||(o.offsetX+=g,o.offsetY+=m),l.isLocked||(l.offsetX-=g,l.offsetY-=m)}}},dg=function(e,t){if(t.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],v=e.layoutNodes[e.idToIndex[u.parentId]],s=v.positionX,l=v.positionY;for(var f=0;f<o;f++){var c=e.layoutNodes[e.idToIndex[i[f]]];if(!c.isLocked){var h=s-c.positionX,d=l-c.positionY,y=Math.sqrt(h*h+d*d);if(y>a){var p=t.gravity*h/y,g=t.gravity*d/y;c.offsetX+=p,c.offsetY+=g}}}}},hg=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],l=e.layoutNodes[s],u=l.children;if(0<u.length&&!l.isLocked){for(var v=l.offsetX,f=l.offsetY,c=0;c<u.length;c++){var h=e.layoutNodes[e.idToIndex[u[c]]];h.offsetX+=v,h.offsetY+=f,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},gg=function(e,t){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=pg(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,yg(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},pg=function(e,t,a){var n=Math.sqrt(e*e+t*t);if(n>a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},yg=function r(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return r(n,t)}},Po=function(e,t){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,l=n[s]=n[s]||[];l.push(o)}for(var u=0,i=0;i<n.length;i++){var v=n[i];if(v){v.x1=1/0,v.x2=-1/0,v.y1=1/0,v.y2=-1/0;for(var f=0;f<v.length;f++){var c=v[f];v.x1=Math.min(v.x1,c.positionX-c.width/2),v.x2=Math.max(v.x2,c.positionX+c.width/2),v.y1=Math.min(v.y1,c.positionY-c.height/2),v.y2=Math.max(v.y2,c.positionY+c.height/2)}v.w=v.x2-v.x1,v.h=v.y2-v.y1,u+=v.w*v.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var h=0,d=0,y=0,p=0,g=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var v=n[i];if(v){for(var f=0;f<v.length;f++){var c=v[f];c.isLocked||(c.positionX+=h-v.x1,c.positionY+=d-v.y1)}h+=v.w+t.componentSpacing,y+=v.w+t.componentSpacing,p=Math.max(p,v.h),y>g&&(d+=p+t.componentSpacing,h=0,y=0,p=0)}}},mg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position: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 au(r){this.options=be({},mg,r)}au.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),v=function(Q){if(Q==null)return Math.min(l,u);var _=Math.min(l,u);_==l?l=Q:u=Q},f=function(Q){if(Q==null)return Math.max(l,u);var _=Math.max(l,u);_==l?l=Q:u=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)l=c,u=h;else if(c!=null&&h==null)l=c,u=Math.ceil(o/l);else if(c==null&&h!=null)u=h,l=Math.ceil(o/u);else if(u*l>o){var d=v(),y=f();(d-1)*y>=o?v(d-1):(y-1)*d>=o&&f(y-1)}else for(;u*l<o;){var p=v(),g=f();(g+1)*p>=o?f(g+1):v(p+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var S=n[w],E=S._private.position;(E.x==null||E.y==null)&&(E.x=0,E.y=0);var x=S.layoutDimensions(e),D=e.avoidOverlapPadding,C=x.w+D,M=x.h+D;m=Math.max(m,C),b=Math.max(b,M)}for(var P={},B=function(Q,_){return!!P["c-"+Q+"-"+_]},L=function(Q,_){P["c-"+Q+"-"+_]=!0},k=0,O=0,A=function(){O++,O>=u&&(O=0,k++)},R={},I=0;I<n.length;I++){var q=n[I],$=e.position(q);if($&&($.row!==void 0||$.col!==void 0)){var F={row:$.row,col:$.col};if(F.col===void 0)for(F.col=0;B(F.row,F.col);)F.col++;else if(F.row===void 0)for(F.row=0;B(F.row,F.col);)F.row++;R[q.id()]=F,L(F.row,F.col)}}var N=function(Q,_){var j,ee;if(Q.locked()||Q.isParent())return!1;var U=R[Q.id()];if(U)j=U.col*m+m/2+i.x1,ee=U.row*b+b/2+i.y1;else{for(;B(k,O);)A();j=O*m+m/2+i.x1,ee=k*b+b/2+i.y1,L(k,O),A()}return{x:j,y:ee}};n.layoutPositions(this,e,N)}return this};var bg={ready:function(){},stop:function(){}};function Ei(r){this.options=be({},bg,r)}Ei.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};Ei.prototype.stop=function(){return this};var wg={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 nu(r){this.options=be({},wg,r)}nu.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),a=Fe(r.positions);function n(i){if(r.positions==null)return Cv(i.position());if(a)return r.positions(i);var o=r.positions[i._private.data.id];return o??null}return t.layoutPositions(this,r,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var xg={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 iu(r){this.options=be({},xg,r)}iu.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=hr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return t.nodes().layoutPositions(this,r,n),this};var Eg=[{name:"breadthfirst",impl:js},{name:"circle",impl:eu},{name:"concentric",impl:ru},{name:"cose",impl:Cn},{name:"grid",impl:au},{name:"null",impl:Ei},{name:"preset",impl:nu},{name:"random",impl:iu}];function ou(r){this.options=r,this.notifications=0}var Bo=function(){},Mo=function(){throw new Error("A headless instance can not render images")};ou.prototype={recalculateRenderedStyle:Bo,notify:function(){this.notifications++},init:Bo,isHeadless:function(){return!0},png:Mo,jpg:Mo};var Ci={};Ci.arrowShapeWidth=.3;Ci.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(u,v,f,c,h,d,y){var p=h.x-f/2-y,g=h.x+f/2+y,m=h.y-f/2-y,b=h.y+f/2+y,w=p<=u&&u<=g&&m<=v&&v<=b;return w},a=function(u,v,f,c,h){var d=u*Math.cos(c)-v*Math.sin(c),y=u*Math.sin(c)+v*Math.cos(c),p=d*f,g=y*f,m=p+h.x,b=g+h.y;return{x:m,y:b}},n=function(u,v,f,c){for(var h=[],d=0;d<u.length;d+=2){var y=u[d],p=u[d+1];h.push(a(y,p,v,f,c))}return h},i=function(u){for(var v=[],f=0;f<u.length;f++){var c=u[f];v.push(c.x,c.y)}return v},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},s=function(u,v){de(v)&&(v=r[v]),r[u]=be({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,d,y,p,g){var m=i(n(this.points,d+2*g,y,p)),b=dr(c,h,m);return b},roughCollide:t,draw:function(c,h,d,y){var p=n(this.points,h,d,y);e.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:o},v)};s("none",{collide:_a,roughCollide:_a,draw:ui,spacing:Vi,gap:Vi}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=this.controlPoint,p=a(y[0],y[1],v,f,c);e.arrowShapeImpl(this.name)(u,d,p)},gap:function(u){return o(u)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,v,f,c,h,d,y){var p=i(n(this.points,f+2*y,c,h)),g=i(n(this.pointsTee,f+2*y,c,h)),m=dr(u,v,p)||dr(u,v,g);return m},draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=n(this.pointsTee,v,f,c);e.arrowShapeImpl(this.name)(u,d,y)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,v,f,c,h,d,y){var p=h,g=Math.pow(p.x-u,2)+Math.pow(p.y-v,2)<=Math.pow((f+2*y)*this.radius,2),m=i(n(this.points,f+2*y,c,h));return dr(u,v,m)||g},draw:function(u,v,f,c,h){var d=n(this.pointsTr,v,f,c);e.arrowShapeImpl(this.name)(u,d,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,v){var f=this.baseCrossLinePts.slice(),c=v/u,h=3,d=5;return f[h]=f[h]-c,f[d]=f[d]-c,f},collide:function(u,v,f,c,h,d,y){var p=i(n(this.points,f+2*y,c,h)),g=i(n(this.crossLinePts(f,d),f+2*y,c,h)),m=dr(u,v,p)||dr(u,v,g);return m},draw:function(u,v,f,c,h){var d=n(this.points,v,f,c),y=n(this.crossLinePts(v,h),v,f,c);e.arrowShapeImpl(this.name)(u,d,y)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return o(u)*.525}}),s("circle",{radius:.15,collide:function(u,v,f,c,h,d,y){var p=h,g=Math.pow(p.x-u,2)+Math.pow(p.y-v,2)<=Math.pow((f+2*y)*this.radius,2);return g},draw:function(u,v,f,c,h){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var yt={};yt.projectIntoViewport=function(r,e){var t=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=t.pan(),l=t.zoom(),u=((r-n)/o-s.x)/l,v=((e-i)/o-s.y)/l;return[u,v]};yt.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),a=function(g){return parseFloat(t.getPropertyValue(g))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=r.clientWidth,s=r.clientHeight,l=n.left+n.right,u=n.top+n.bottom,v=i.left+i.right,f=e.width/(o+v),c=o-l,h=s-u,d=e.left+n.left+i.left,y=e.top+n.top+i.top;return this.containerBB=[d,y,c,h,f]};yt.invalidateContainerClientCoordsCache=function(){this.containerBB=null};yt.findNearestElement=function(r,e,t,a){return this.findNearestElements(r,e,t,a)[0]};yt.findNearestElements=function(r,e,t,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),v=(a?24:8)/l,f=(a?8:2)/l,c=(a?8:2)/l,h=1/0,d,y;t&&(o=o.interactive);function p(x,D){if(x.isNode()){if(y)return;y=x,s.push(x)}if(x.isEdge()&&(D==null||D<h))if(d){if(d.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var C=0;C<s.length;C++)if(s[C].isEdge()){s[C]=x,d=x,h=D??h;break}}}else s.push(x),d=x,h=D??h}function g(x){var D=x.outerWidth()+2*f,C=x.outerHeight()+2*f,M=D/2,P=C/2,B=x.position(),L=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,k=x._private.rscratch;if(B.x-M<=r&&r<=B.x+M&&B.y-P<=e&&e<=B.y+P){var O=i.nodeShapes[n.getNodeShape(x)];if(O.checkPoint(r,e,0,D,C,B.x,B.y,L,k))return p(x,0),!0}}function m(x){var D=x._private,C=D.rscratch,M=x.pstyle("width").pfValue,P=x.pstyle("arrow-scale").value,B=M/2+v,L=B*B,k=B*2,I=D.source,q=D.target,O;if(C.edgeType==="segments"||C.edgeType==="straight"||C.edgeType==="haystack"){for(var A=C.allpts,R=0;R+3<A.length;R+=2)if(zv(r,e,A[R],A[R+1],A[R+2],A[R+3],k)&&L>(O=$v(r,e,A[R],A[R+1],A[R+2],A[R+3])))return p(x,O),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var A=C.allpts,R=0;R+5<C.allpts.length;R+=4)if(Nv(r,e,A[R],A[R+1],A[R+2],A[R+3],A[R+4],A[R+5],k)&&L>(O=qv(r,e,A[R],A[R+1],A[R+2],A[R+3],A[R+4],A[R+5])))return p(x,O),!0}for(var I=I||D.source,q=q||D.target,$=n.getArrowWidth(M,P),F=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],R=0;R<F.length;R++){var N=F[R],W=i.arrowShapes[x.pstyle(N.name+"-arrow-shape").value],Q=x.pstyle("width").pfValue;if(W.roughCollide(r,e,$,N.angle,{x:N.x,y:N.y},Q,v)&&W.collide(r,e,$,N.angle,{x:N.x,y:N.y},Q,v))return p(x),!0}u&&s.length>0&&(g(I),g(q))}function b(x,D,C){return kr(x,D,C)}function w(x,D){var C=x._private,M=c,P;D?P=D+"-":P="",x.boundingBox();var B=C.labelBounds[D||"main"],L=x.pstyle(P+"label").value,k=x.pstyle("text-events").strValue==="yes";if(!(!k||!L)){var O=b(C.rscratch,"labelX",D),A=b(C.rscratch,"labelY",D),R=b(C.rscratch,"labelAngle",D),I=x.pstyle(P+"text-margin-x").pfValue,q=x.pstyle(P+"text-margin-y").pfValue,$=B.x1-M-I,F=B.x2+M-I,N=B.y1-M-q,W=B.y2+M-q;if(R){var Q=Math.cos(R),_=Math.sin(R),j=function(he,ae){return he=he-O,ae=ae-A,{x:he*Q-ae*_+O,y:he*_+ae*Q+A}},ee=j($,N),U=j($,W),z=j(F,N),Y=j(F,W),X=[ee.x+I,ee.y+q,z.x+I,z.y+q,Y.x+I,Y.y+q,U.x+I,U.y+q];if(dr(r,e,X))return p(x),!0}else if(Ot(B,r,e))return p(x),!0}}for(var S=o.length-1;S>=0;S--){var E=o[S];E.isNode()?g(E)||w(E):m(E)||w(E)||w(E,"source")||w(E,"target")}return s};yt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],o=Math.min(r,t),s=Math.max(r,t),l=Math.min(e,a),u=Math.max(e,a);r=o,t=s,e=l,a=u;for(var v=hr({x1:r,y1:e,x2:t,y2:a}),f=0;f<n.length;f++){var c=n[f];if(c.isNode()){var h=c,d=h.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});fi(v,d)&&!gs(d,v)&&i.push(h)}else{var y=c,p=y._private,g=p.rscratch;if(g.startX!=null&&g.startY!=null&&!Ot(v,g.startX,g.startY)||g.endX!=null&&g.endY!=null&&!Ot(v,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 m=p.rstyle.bezierPts||p.rstyle.linePts||p.rstyle.haystackPts,b=!0,w=0;w<m.length;w++)if(!Iv(v,m[w])){b=!1;break}b&&i.push(y)}else(g.edgeType==="haystack"||g.edgeType==="straight")&&i.push(y)}}return i};var on={};on.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",l,u,v,f,c,h,g,m;if(t?(v=e.haystackPts[0],f=e.haystackPts[1],c=e.haystackPts[2],h=e.haystackPts[3]):(v=e.arrowStartX,f=e.arrowStartY,c=e.arrowEndX,h=e.arrowEndY),g=e.midX,m=e.midY,i)l=v-e.segpts[0],u=f-e.segpts[1];else if(n||o||s||a){var d=e.allpts,y=Xe(d[0],d[2],d[4],.1),p=Xe(d[1],d[3],d[5],.1);l=v-y,u=f-p}else l=v-g,u=f-m;e.srcArrowAngle=Ma(l,u);var g=e.midX,m=e.midY;if(t&&(g=(v+c)/2,m=(f+h)/2),l=c-v,u=h-f,i){var d=e.allpts;if(d.length/2%2===0){var b=d.length/2,w=b-2;l=d[b]-d[w],u=d[b+1]-d[w+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var b=d.length/2-1,w=b-2;l=d[b]-d[w],u=d[b+1]-d[w+1]}}else if(n||o||s){var d=e.allpts,S=e.ctrlpts,E,x,D,C;if(S.length/2%2===0){var M=d.length/2-1,P=M+2,B=P+2;E=Xe(d[M],d[P],d[B],0),x=Xe(d[M+1],d[P+1],d[B+1],0),D=Xe(d[M],d[P],d[B],1e-4),C=Xe(d[M+1],d[P+1],d[B+1],1e-4)}else{var P=d.length/2-1,M=P-2,B=P+2;E=Xe(d[M],d[P],d[B],.4999),x=Xe(d[M+1],d[P+1],d[B+1],.4999),D=Xe(d[M],d[P],d[B],.5),C=Xe(d[M+1],d[P+1],d[B+1],.5)}l=D-E,u=C-x}if(e.midtgtArrowAngle=Ma(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var b=d.length/2-1,L=b+2;l=-(d[L]-d[b]),u=-(d[L+1]-d[b+1])}}}if(e.midsrcArrowAngle=Ma(l,u),i)l=c-e.segpts[e.segpts.length-2],u=h-e.segpts[e.segpts.length-1];else if(n||o||s||a){var d=e.allpts,k=d.length,y=Xe(d[k-6],d[k-4],d[k-2],.9),p=Xe(d[k-5],d[k-3],d[k-1],.9);l=c-y,u=h-p}else l=c-g,u=h-m;e.tgtArrowAngle=Ma(l,u)};on.getArrowWidth=on.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},a=t[r+", "+e];return a||(a=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=a,a)};var Zn,Qn,Ar={},mr={},Lo,Ao,ut,Xa,Vr,nt,st,Lr,St,Va,su,uu,Jn,_n,Ro,Oo=function(e,t,a){a.x=t.x-e.x,a.y=t.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},Cg=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},Sg=function(e,t,a,n,i){if(e!==Ro?Oo(t,e,Ar):Cg(mr,Ar),Oo(t,a,mr),Lo=Ar.nx*mr.ny-Ar.ny*mr.nx,Ao=Ar.nx*mr.nx-Ar.ny*-mr.ny,Vr=Math.asin(Math.max(-1,Math.min(1,Lo))),Math.abs(Vr)<1e-6){Zn=t.x,Qn=t.y,st=St=0;return}ut=1,Xa=!1,Ao<0?Vr<0?Vr=Math.PI+Vr:(Vr=Math.PI-Vr,ut=-1,Xa=!0):Vr>0&&(ut=-1,Xa=!0),t.radius!==void 0?St=t.radius:St=n,nt=Vr/2,Va=Math.min(Ar.len/2,mr.len/2),i?(Lr=Math.abs(Math.cos(nt)*St/Math.sin(nt)),Lr>Va?(Lr=Va,st=Math.abs(Lr*Math.sin(nt)/Math.cos(nt))):st=St):(Lr=Math.min(Va,St),st=Math.abs(Lr*Math.sin(nt)/Math.cos(nt))),Jn=t.x+mr.nx*Lr,_n=t.y+mr.ny*Lr,Zn=Jn-mr.ny*st*ut,Qn=_n+mr.nx*st*ut,su=t.x+Ar.nx*Lr,uu=t.y+Ar.ny*Lr,Ro=t};function lu(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Si(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Sg(r,e,t,a,n),{cx:Zn,cy:Qn,radius:st,startX:su,startY:uu,stopX:Jn,stopY:_n,startAngle:Ar.ang+Math.PI/2*ut,endAngle:mr.ang-Math.PI/2*ut,counterClockwise:Xa})}var sr={};sr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),l=o.units!=null&&s.units!=null,u=function(S,E,x,D){var C=D-E,M=x-S,P=Math.sqrt(M*M+C*C);return{x:-C/P,y:M/P}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(r.source()[0],o),c=Tr(f,2),h=c[0],d=c[1],y=this.manualEndptToPx(r.target()[0],s),p=Tr(y,2),g=p[0],m=p[1],b={x1:h,y1:d,x2:g,y2:m};n=u(h,d,g,m),i=b}else Me("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};sr.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],a=t._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,l=o.position(),u=s.position(),v=o.width(),f=s.width(),c=o.height(),h=s.height(),d=t.pstyle("haystack-radius").value,y=d/2;n.haystackPts=n.allpts=[n.source.x*v*y+l.x,n.source.y*c*y+l.y,n.target.x*f*y+u.x,n.target.y*h*y+u.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};sr.findSegmentsPoints=function(r,e){var t=r._private.rscratch,a=r.pstyle("segment-weights"),n=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),o=r.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var v=0;v<s;v++){var f=a.pfValue[v],c=n.pfValue[v],h=1-f,d=f,y=this.findMidptPtsEtc(r,e),p=y.midptPts,g=y.vectorNormInverse,m={x:p.x1*h+p.x2*d,y:p.y1*h+p.y2*d};t.segpts.push(m.x+g.x*c,m.y+g.y*c),t.radii.push(i.pfValue[v]!==void 0?i.pfValue[v]:l),t.isArcRadius.push((o.pfValue[v]!==void 0?o.pfValue[v]:u)==="arc-radius")}};sr.findLoopPoints=function(r,e,t,a){var n=r._private.rscratch,i=e.dirCounts,o=e.srcPos,s=r.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=r.pstyle("loop-direction").pfValue,v=r.pstyle("loop-sweep").pfValue,f=r.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=t,h=f;a&&(c=0,h=l);var d=u-Math.PI/2,y=d-v/2,p=d+v/2,g=u+"_"+v;c=i[g]===void 0?i[g]=0:++i[g],n.ctrlpts=[o.x+Math.cos(y)*1.4*h*(c/3+1),o.y+Math.sin(y)*1.4*h*(c/3+1),o.x+Math.cos(p)*1.4*h*(c/3+1),o.y+Math.sin(p)*1.4*h*(c/3+1)]};sr.findCompoundLoopPoints=function(r,e,t,a){var n=r._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,l=e.srcH,u=e.tgtW,v=e.tgtH,f=r.pstyle("control-point-step-size").pfValue,c=r.pstyle("control-point-distances"),h=c?c.pfValue[0]:void 0,d=t,y=f;a&&(d=0,y=h);var p=50,g={x:i.x-s/2,y:i.y-l/2},m={x:o.x-u/2,y:o.y-v/2},b={x:Math.min(g.x,m.x),y:Math.min(g.y,m.y)},w=.5,S=Math.max(w,Math.log(s*.01)),E=Math.max(w,Math.log(u*.01));n.ctrlpts=[b.x,b.y-(1+Math.pow(p,1.12)/100)*y*(d/3+1)*S,b.x-(1+Math.pow(p,1.12)/100)*y*(d/3+1)*E,b.y]};sr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};sr.findBezierPoints=function(r,e,t,a,n){var i=r._private.rscratch,o=r.pstyle("control-point-step-size").pfValue,s=r.pstyle("control-point-distances"),l=r.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,v=s?s.pfValue[0]:void 0,f=l.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var h=0;h<u;h++){var d=(.5-e.eles.length/2+t)*o*(n?-1:1),y=void 0,p=ds(d);c&&(v=s?s.pfValue[h]:o,f=l.value[h]),a?y=v:y=v!==void 0?p*v:void 0;var g=y!==void 0?y:d,m=1-f,b=f,w=this.findMidptPtsEtc(r,e),S=w.midptPts,E=w.vectorNormInverse,x={x:S.x1*m+S.x2*b,y:S.y1*m+S.y2*b};i.ctrlpts.push(x.x+E.x*g,x.y+E.y*g)}};sr.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",l="upward",u="auto",v=e.posPts,f=e.srcW,c=e.srcH,h=e.tgtW,d=e.tgtH,y=r.pstyle("edge-distances").value,p=y!=="node-position",g=r.pstyle("taxi-direction").value,m=g,b=r.pstyle("taxi-turn"),w=b.units==="%",S=b.pfValue,E=S<0,x=r.pstyle("taxi-turn-min-distance").pfValue,D=p?(f+h)/2:0,C=p?(c+d)/2:0,M=v.x2-v.x1,P=v.y2-v.y1,B=function(ye,me){return ye>0?Math.max(ye-me,0):Math.min(ye+me,0)},L=B(M,D),k=B(P,C),O=!1;m===u?g=Math.abs(L)>Math.abs(k)?n:a:m===l||m===s?(g=a,O=!0):(m===i||m===o)&&(g=n,O=!0);var A=g===a,R=A?k:L,I=A?P:M,q=ds(I),$=!1;!(O&&(w||E))&&(m===s&&I<0||m===l&&I>0||m===i&&I>0||m===o&&I<0)&&(q*=-1,R=q*Math.abs(R),$=!0);var F;if(w){var N=S<0?1+S:S;F=N*R}else{var W=S<0?R:0;F=W+S*q}var Q=function(ye){return Math.abs(ye)<x||Math.abs(ye)>=Math.abs(R)},_=Q(F),j=Q(Math.abs(R)-Math.abs(F)),ee=_||j;if(ee&&!$)if(A){var U=Math.abs(I)<=c/2,z=Math.abs(M)<=h/2;if(U){var Y=(v.x1+v.x2)/2,X=v.y1,oe=v.y2;t.segpts=[Y,X,Y,oe]}else if(z){var he=(v.y1+v.y2)/2,ae=v.x1,ie=v.x2;t.segpts=[ae,he,ie,he]}else t.segpts=[v.x1,v.y2]}else{var ue=Math.abs(I)<=f/2,ce=Math.abs(P)<=d/2;if(ue){var ve=(v.y1+v.y2)/2,pe=v.x1,Pe=v.x2;t.segpts=[pe,ve,Pe,ve]}else if(ce){var Ee=(v.x1+v.x2)/2,xe=v.y1,Te=v.y2;t.segpts=[Ee,xe,Ee,Te]}else t.segpts=[v.x2,v.y1]}else if(A){var J=v.y1+F+(p?c/2*q:0),T=v.x1,V=v.x2;t.segpts=[T,J,V,J]}else{var Z=v.x1+F+(p?f/2*q:0),G=v.y1,H=v.y2;t.segpts=[Z,G,Z,H]}if(t.isRound){var te=r.pstyle("taxi-radius").value,K=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(te),t.isArcRadius=new Array(t.segpts.length/2).fill(K)}};sr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!ne(t.startX)||!ne(t.startY),p=!ne(t.arrowStartX)||!ne(t.arrowStartY),g=!ne(t.endX)||!ne(t.endY),m=!ne(t.arrowEndX)||!ne(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=b*w,E=ct({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=E<S,D=ct({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),C=D<S,M=!1;if(y||p||x){M=!0;var P={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},B=Math.sqrt(P.x*P.x+P.y*P.y),L={x:P.x/B,y:P.y/B},k=Math.max(i,o),O={x:t.ctrlpts[0]+L.x*2*k,y:t.ctrlpts[1]+L.y*2*k},A=u.intersectLine(a.x,a.y,i,o,O.x,O.y,0,f,h);x?(t.ctrlpts[0]=t.ctrlpts[0]+L.x*(S-E),t.ctrlpts[1]=t.ctrlpts[1]+L.y*(S-E)):(t.ctrlpts[0]=A[0]+L.x*S,t.ctrlpts[1]=A[1]+L.y*S)}if(g||m||C){M=!0;var R={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},I=Math.sqrt(R.x*R.x+R.y*R.y),q={x:R.x/I,y:R.y/I},$=Math.max(i,o),F={x:t.ctrlpts[0]+q.x*2*$,y:t.ctrlpts[1]+q.y*2*$},N=v.intersectLine(n.x,n.y,s,l,F.x,F.y,0,c,d);C?(t.ctrlpts[0]=t.ctrlpts[0]+q.x*(S-D),t.ctrlpts[1]=t.ctrlpts[1]+q.y*(S-D)):(t.ctrlpts[0]=N[0]+q.x*S,t.ctrlpts[1]=N[1]+q.y*S)}M&&this.findEndpoints(r)}};sr.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=Xe(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Xe(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(Si({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var v=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[v],e.midY=e.segpts[v+1];else{var f={x:e.segpts[v],y:e.segpts[v+1]},c=e.roundCorners[v/2],h=[f.x-c.cx,f.y-c.cy],d=c.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map(function(y){return y*d}),e.midX=c.cx+h[0],e.midY=c.cy+h[1],e.midVector=h}}}};sr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||ne(e.startX)&&ne(e.startY)&&ne(e.endX)&&ne(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Me("Edge `"+r.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."))};sr.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,a=t.cy,n=a.hasCompoundNodes(),i={map:new Or,get:function(x){var D=this.map.get(x[0]);return D!=null?D.get(x[1]):null},set:function(x,D){var C=this.map.get(x[0]);C==null&&(C=new Or,this.map.set(x[0],C)),C.set(x[1],D)}},o=[],s=[],l=0;l<r.length;l++){var u=r[l],v=u._private,f=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(f==="haystack"){s.push(u);continue}var c=f==="unbundled-bezier"||f.endsWith("segments")||f==="straight"||f==="straight-triangle"||f.endsWith("taxi"),h=f==="unbundled-bezier"||f==="bezier",d=v.source,y=v.target,p=d.poolIndex(),g=y.poolIndex(),m=[p,g].sort(),b=i.get(m);b==null&&(b={eles:[]},i.set(m,b),o.push(m)),b.eles.push(u),c&&(b.hasUnbundled=!0),h&&(b.hasBezier=!0)}}for(var w=function(x){var D=o[x],C=i.get(D),M=void 0;if(!C.hasUnbundled){var P=C.eles[0].parallelEdges().filter(function(Z){return Z.isBundledBezier()});li(C.eles),P.forEach(function(Z){return C.eles.push(Z)}),C.eles.sort(function(Z,G){return Z.poolIndex()-G.poolIndex()})}var B=C.eles[0],L=B.source(),k=B.target();if(L.poolIndex()>k.poolIndex()){var O=L;L=k,k=O}var A=C.srcPos=L.position(),R=C.tgtPos=k.position(),I=C.srcW=L.outerWidth(),q=C.srcH=L.outerHeight(),$=C.tgtW=k.outerWidth(),F=C.tgtH=k.outerHeight(),N=C.srcShape=t.nodeShapes[e.getNodeShape(L)],W=C.tgtShape=t.nodeShapes[e.getNodeShape(k)],Q=C.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,_=C.tgtCornerRadius=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,j=C.tgtRs=k._private.rscratch,ee=C.srcRs=L._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var U=0;U<C.eles.length;U++){var z=C.eles[U],Y=z[0]._private.rscratch,X=z.pstyle("curve-style").value,oe=X==="unbundled-bezier"||X.endsWith("segments")||X.endsWith("taxi"),he=!L.same(z.source());if(!C.calculatedIntersection&&L!==k&&(C.hasBezier||C.hasUnbundled)){C.calculatedIntersection=!0;var ae=N.intersectLine(A.x,A.y,I,q,R.x,R.y,0,Q,ee),ie=C.srcIntn=ae,ue=W.intersectLine(R.x,R.y,$,F,A.x,A.y,0,_,j),ce=C.tgtIntn=ue,ve=C.intersectionPts={x1:ae[0],x2:ue[0],y1:ae[1],y2:ue[1]},pe=C.posPts={x1:A.x,x2:R.x,y1:A.y,y2:R.y},Pe=ue[1]-ae[1],Ee=ue[0]-ae[0],xe=Math.sqrt(Ee*Ee+Pe*Pe),Te=C.vector={x:Ee,y:Pe},J=C.vectorNorm={x:Te.x/xe,y:Te.y/xe},T={x:-J.y,y:J.x};C.nodesOverlap=!ne(xe)||W.checkPoint(ae[0],ae[1],0,$,F,R.x,R.y,_,j)||N.checkPoint(ue[0],ue[1],0,I,q,A.x,A.y,Q,ee),C.vectorNormInverse=T,M={nodesOverlap:C.nodesOverlap,dirCounts:C.dirCounts,calculatedIntersection:!0,hasBezier:C.hasBezier,hasUnbundled:C.hasUnbundled,eles:C.eles,srcPos:R,tgtPos:A,srcW:$,srcH:F,tgtW:I,tgtH:q,srcIntn:ce,tgtIntn:ie,srcShape:W,tgtShape:N,posPts:{x1:pe.x2,y1:pe.y2,x2:pe.x1,y2:pe.y1},intersectionPts:{x1:ve.x2,y1:ve.y2,x2:ve.x1,y2:ve.y1},vector:{x:-Te.x,y:-Te.y},vectorNorm:{x:-J.x,y:-J.y},vectorNormInverse:{x:-T.x,y:-T.y}}}var V=he?M:C;Y.nodesOverlap=V.nodesOverlap,Y.srcIntn=V.srcIntn,Y.tgtIntn=V.tgtIntn,Y.isRound=X.startsWith("round"),n&&(L.isParent()||L.isChild()||k.isParent()||k.isChild())&&(L.parents().anySame(k)||k.parents().anySame(L)||L.same(k)&&L.isParent())?e.findCompoundLoopPoints(z,V,U,oe):L===k?e.findLoopPoints(z,V,U,oe):X.endsWith("segments")?e.findSegmentsPoints(z,V):X.endsWith("taxi")?e.findTaxiPoints(z,V):X==="straight"||!oe&&C.eles.length%2===1&&U===Math.floor(C.eles.length/2)?e.findStraightEdgePoints(z):e.findBezierPoints(z,V,U,oe,he),e.findEndpoints(z),e.tryToCorrectInvalidPoints(z,V),e.checkForInvalidEdgeWarning(z),e.storeAllpts(z),e.storeEdgeProjections(z),e.calculateArrowAngles(z),e.recalculateEdgeLabelProjections(z),e.calculateLabelAngles(z)}},S=0;S<o.length;S++)w(S);this.findHaystackPoints(s)}};function vu(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var a=r[t],n=r[t+1];e.push({x:a,y:n})}return e}}sr.getSegmentPoints=function(r){var e=r[0]._private.rscratch,t=e.edgeType;if(t==="segments")return this.recalculateRenderedStyle(r),vu(e.segpts)};sr.getControlPoints=function(r){var e=r[0]._private.rscratch,t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return this.recalculateRenderedStyle(r),vu(e.ctrlpts)};sr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ta={};Ta.manualEndptToPx=function(r,e){var t=this,a=r.position(),n=r.outerWidth(),i=r.outerHeight(),o=r._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(n,i),v=[a.x+Math.cos(l)*u,a.y+Math.sin(l)*u];return t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,n,i,v[0],v[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,o)}};Ta.findEndpoints=function(r){var e=this,t,a=r.source()[0],n=r.target()[0],i=a.position(),o=n.position(),s=r.pstyle("target-arrow-shape").value,l=r.pstyle("source-arrow-shape").value,u=r.pstyle("target-distance-from-node").pfValue,v=r.pstyle("source-distance-from-node").pfValue,f=a._private.rscratch,c=n._private.rscratch,h=r.pstyle("curve-style").value,d=r._private.rscratch,y=d.edgeType,p=h==="taxi",g=y==="self"||y==="compound",m=y==="bezier"||y==="multibezier"||g,b=y!=="bezier",w=y==="straight"||y==="segments",S=y==="segments",E=m||b||w,x=g||p,D=r.pstyle("source-endpoint"),C=x?"outside-to-node":D.value,M=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,P=r.pstyle("target-endpoint"),B=x?"outside-to-node":P.value,L=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue;d.srcManEndpt=D,d.tgtManEndpt=P;var k,O,A,R;if(m){var I=[d.ctrlpts[0],d.ctrlpts[1]],q=b?[d.ctrlpts[d.ctrlpts.length-2],d.ctrlpts[d.ctrlpts.length-1]]:I;k=q,O=I}else if(w){var $=S?d.segpts.slice(0,2):[o.x,o.y],F=S?d.segpts.slice(d.segpts.length-2):[i.x,i.y];k=F,O=$}if(B==="inside-to-node")t=[o.x,o.y];else if(P.units)t=this.manualEndptToPx(n,P);else if(B==="outside-to-line")t=d.tgtIntn;else if(B==="outside-to-node"||B==="outside-to-node-or-label"?A=k:(B==="outside-to-line"||B==="outside-to-line-or-label")&&(A=[i.x,i.y]),t=e.nodeShapes[this.getNodeShape(n)].intersectLine(o.x,o.y,n.outerWidth(),n.outerHeight(),A[0],A[1],0,L,c),B==="outside-to-node-or-label"||B==="outside-to-line-or-label"){var N=n._private.rscratch,W=N.labelWidth,Q=N.labelHeight,_=N.labelX,j=N.labelY,ee=W/2,U=Q/2,z=n.pstyle("text-valign").value;z==="top"?j-=U:z==="bottom"&&(j+=U);var Y=n.pstyle("text-halign").value;Y==="left"?_-=ee:Y==="right"&&(_+=ee);var X=da(A[0],A[1],[_-ee,j-U,_+ee,j-U,_+ee,j+U,_-ee,j+U],o.x,o.y);if(X.length>0){var oe=i,he=it(oe,kt(t)),ae=it(oe,kt(X)),ie=he;if(ae<he&&(t=X,ie=ae),X.length>2){var ue=it(oe,{x:X[2],y:X[3]});ue<ie&&(t=[X[2],X[3]])}}}var ce=La(t,k,e.arrowShapes[s].spacing(r)+u),ve=La(t,k,e.arrowShapes[s].gap(r)+u);if(d.endX=ve[0],d.endY=ve[1],d.arrowEndX=ce[0],d.arrowEndY=ce[1],C==="inside-to-node")t=[i.x,i.y];else if(D.units)t=this.manualEndptToPx(a,D);else if(C==="outside-to-line")t=d.srcIntn;else if(C==="outside-to-node"||C==="outside-to-node-or-label"?R=O:(C==="outside-to-line"||C==="outside-to-line-or-label")&&(R=[o.x,o.y]),t=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),R[0],R[1],0,M,f),C==="outside-to-node-or-label"||C==="outside-to-line-or-label"){var pe=a._private.rscratch,Pe=pe.labelWidth,Ee=pe.labelHeight,xe=pe.labelX,Te=pe.labelY,J=Pe/2,T=Ee/2,V=a.pstyle("text-valign").value;V==="top"?Te-=T:V==="bottom"&&(Te+=T);var Z=a.pstyle("text-halign").value;Z==="left"?xe-=J:Z==="right"&&(xe+=J);var G=da(R[0],R[1],[xe-J,Te-T,xe+J,Te-T,xe+J,Te+T,xe-J,Te+T],i.x,i.y);if(G.length>0){var H=o,te=it(H,kt(t)),K=it(H,kt(G)),re=te;if(K<te&&(t=[G[0],G[1]],re=K),G.length>2){var ye=it(H,{x:G[2],y:G[3]});ye<re&&(t=[G[2],G[3]])}}}var me=La(t,O,e.arrowShapes[l].spacing(r)+v),fe=La(t,O,e.arrowShapes[l].gap(r)+v);d.startX=fe[0],d.startY=fe[1],d.arrowStartX=me[0],d.arrowStartY=me[1],E&&(!ne(d.startX)||!ne(d.startY)||!ne(d.endX)||!ne(d.endY)?d.badLine=!0:d.badLine=!1)};Ta.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ta.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Ti={};function Tg(r,e,t){for(var a=function(u,v,f,c){return Xe(u,v,f,c)},n=e._private,i=n.rstyle.bezierPts,o=0;o<r.bezierProjPcts.length;o++){var s=r.bezierProjPcts[o];i.push({x:a(t[0],t[2],t[4],s),y:a(t[1],t[3],t[5],s)})}}Ti.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,a=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<t.allpts.length;n+=4)Tg(this,r,t.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<t.allpts.length;n+=2)i.push({x:t.allpts[n],y:t.allpts[n+1]});else if(a==="haystack"){var o=t.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};Ti.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var zr={};zr.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!Jr(e)){var t,a,n=r._private,i=r.width(),o=r.height(),s=r.padding(),l=r.position(),u=r.pstyle("text-halign").strValue,v=r.pstyle("text-valign").strValue,f=n.rscratch,c=n.rstyle;switch(u){case"left":t=l.x-i/2-s;break;case"right":t=l.x+i/2+s;break;default:t=l.x}switch(v){case"top":a=l.y-o/2-s;break;case"bottom":a=l.y+o/2+s;break;default:a=l.y}f.labelX=t,f.labelY=a,c.labelX=t,c.labelY=a,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var fu=function(e,t){var a=Math.atan(t/e);return e===0&&a<0&&(a=a*-1),a},cu=function(e,t){var a=t.x-e.x,n=t.y-e.y;return fu(a,n)},Dg=function(e,t,a,n){var i=ca(0,n-.001,1),o=ca(0,n+.001,1),s=Bt(e,t,a,i),l=Bt(e,t,a,o);return cu(s,l)};zr.recalculateEdgeLabelProjections=function(r){var e,t=r._private,a=t.rscratch,n=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(f,c,h){Yr(t.rscratch,f,c,h),Yr(t.rstyle,f,c,h)};o("labelX",null,e.x),o("labelY",null,e.y);var s=fu(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var l=function v(){if(v.cache)return v.cache;for(var f=[],c=0;c+5<a.allpts.length;c+=4){var h={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},y={x:a.allpts[c+4],y:a.allpts[c+5]};f.push({p0:h,p1:d,p2:y,startDist:0,length:0,segments:[]})}var p=t.rstyle.bezierPts,g=n.bezierProjPcts.length;function m(x,D,C,M,P){var B=ct(D,C),L=x.segments[x.segments.length-1],k={p0:D,p1:C,t0:M,t1:P,startDist:L?L.startDist+L.length:0,length:B};x.segments.push(k),x.length+=B}for(var b=0;b<f.length;b++){var w=f[b],S=f[b-1];S&&(w.startDist=S.startDist+S.length),m(w,w.p0,p[b*g],0,n.bezierProjPcts[0]);for(var E=0;E<g-1;E++)m(w,p[b*g+E],p[b*g+E+1],n.bezierProjPcts[E],n.bezierProjPcts[E+1]);m(w,p[b*g+g-1],w.p2,n.bezierProjPcts[g-1],1)}return v.cache=f},u=function(f){var c,h=f==="source";if(i[f]){var d=r.pstyle(f+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=l(),p,g=0,m=0,b=0;b<y.length;b++){for(var w=y[h?b:y.length-1-b],S=0;S<w.segments.length;S++){var E=w.segments[h?S:w.segments.length-1-S],x=b===y.length-1&&S===w.segments.length-1;if(g=m,m+=E.length,m>=d||x){p={cp:w,segment:E};break}}if(p)break}var D=p.cp,C=p.segment,M=(d-g)/C.length,P=C.t1-C.t0,B=h?C.t0+P*M:C.t1-P*M;B=ca(0,B,1),e=Bt(D.p0,D.p1,D.p2,B),c=Dg(D.p0,D.p1,D.p2,B);break}case"straight":case"segments":case"haystack":{for(var L=0,k,O,A,R,I=a.allpts.length,q=0;q+3<I&&(h?(A={x:a.allpts[q],y:a.allpts[q+1]},R={x:a.allpts[q+2],y:a.allpts[q+3]}):(A={x:a.allpts[I-2-q],y:a.allpts[I-1-q]},R={x:a.allpts[I-4-q],y:a.allpts[I-3-q]}),k=ct(A,R),O=L,L+=k,!(L>=d));q+=2);var $=d-O,F=$/k;F=ca(0,F,1),e=Mv(A,R,F),c=cu(A,R);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}};zr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};zr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=this.calculateLabelDimensions(r,a),i=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,s=kr(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(s.length,1),u=n.height/l,v=u*i,f=n.width,c=n.height+(l-1)*(i-1)*u;Yr(t.rstyle,"labelWidth",e,f),Yr(t.rscratch,"labelWidth",e,f),Yr(t.rstyle,"labelHeight",e,c),Yr(t.rscratch,"labelHeight",e,c),Yr(t.rscratch,"labelLineHeight",e,v)};zr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,o=function(W,Q){return Q?(Yr(t.rscratch,W,e,Q),Q):kr(t.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="",v=n.split(`
`),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],y=/[\s\u200b]+|$/g,p=0;p<v.length;p++){var g=v[p],m=this.calculateLabelDimensions(r,g),b=m.width;if(h){var w=g.split("").join(u);g=w}if(b>f){var S=g.matchAll(y),E="",x=0,D=Xo(S),C;try{for(D.s();!(C=D.n()).done;){var M=C.value,P=M[0],B=g.substring(x,M.index);x=M.index+P.length;var L=E.length===0?B:E+B+P,k=this.calculateLabelDimensions(r,L),O=k.width;O<=f?E+=B+P:(E&&d.push(E),E=B+P)}}catch(N){D.e(N)}finally{D.f()}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(g)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(`
`)),o("labelWrapKey",l)}else if(s==="ellipsis"){var A=r.pstyle("text-max-width").pfValue,R="",I="…",q=!1;if(this.calculateLabelDimensions(r,n).width<A)return n;for(var $=0;$<n.length;$++){var F=this.calculateLabelDimensions(r,R+n[$]+I).width;if(F>A)break;R+=n[$],$===n.length-1&&(q=!0)}return q||(R+=I),R}return n};zr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};zr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=ft(e,r._private.labelDimsKey),o=t.labelDimCache||(t.labelDimCache=[]),s=o[i];if(s!=null)return s;var l=0,u=r.pstyle("font-style").strValue,v=r.pstyle("font-size").pfValue,f=r.pstyle("font-family").strValue,c=r.pstyle("font-weight").strValue,h=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=n.createElement("canvas"),d=this.labelCalcCanvasContext=h.getContext("2d");var y=h.style;y.position="absolute",y.left="-9999px",y.top="-9999px",y.zIndex="-1",y.visibility="hidden",y.pointerEvents="none"}d.font="".concat(u," ").concat(c," ").concat(v,"px ").concat(f);for(var p=0,g=0,m=e.split(`
`),b=0;b<m.length;b++){var w=m[b],S=d.measureText(w),E=Math.ceil(S.width),x=v;p=Math.max(E,p),g+=x}return p+=l,g+=l,o[i]={width:p,height:g}};zr.calculateLabelAngle=function(r,e){var t=r._private,a=t.rscratch,n=r.isEdge(),i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue};zr.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),a=r._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(r),t&&(n.sourceLabelAngle=e.calculateLabelAngle(r,"source"),n.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var du={},Io=28,zo=!1;du.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<Io||r.height()<Io))return zo||(Me("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),zo=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var a=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return t};var Sn={};Sn.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var l=0;l<o.length;l++){var u=o[l],v=u._private,f=v.rstyle;f.clean=!1,f.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=t.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],v=u._private.rstyle;u.isNode()&&!v.cleanConnected&&(a(u.connectedEdges()),v.cleanConnected=!0)}if(s)for(var f=0;f<s.length;f++){var c=s[f];c(o,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){n(!0)},t.beforeRender(n,t.beforeRenderPriorities.eleCalcs)};Sn.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};Sn.recalculateRenderedStyle=function(r,e){var t=function(w){return w._private.rstyle.cleanConnected},a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var o=r[i],s=o._private,l=s.rstyle;o.isEdge()&&(!t(o.source())||!t(o.target()))&&(l.clean=!1),!(e&&l.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),l.clean=!0)}for(var u=0;u<n.length;u++){var v=n[u],f=v._private,c=f.rstyle,h=v.position();this.recalculateNodeLabelProjection(v),c.nodeX=h.x,c.nodeY=h.y,c.nodeW=v.pstyle("width").pfValue,c.nodeH=v.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var y=a[d],p=y._private,g=p.rstyle,m=p.rscratch;g.srcX=m.arrowStartX,g.srcY=m.arrowStartY,g.tgtX=m.arrowEndX,g.tgtY=m.arrowEndY,g.midX=m.midX,g.midY=m.midY,g.labelAngle=m.labelAngle,g.sourceLabelAngle=m.sourceLabelAngle,g.targetLabelAngle=m.targetLabelAngle}}};var Tn={};Tn.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var a=r[t],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?r.drag.push(a):r.nondrag.push(a)}for(var t=0;t<e.length;t++){var a=e[t];r.drag.push(a)}}};Tn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Tn.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Qs),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var hu={};[yt,on,sr,Ta,Ti,zr,du,Sn,Tn].forEach(function(r){be(hu,r)});var gu={};gu.getCachedImage=function(r,e,t){var a=this,n=a.imageCache=a.imageCache||{},i=n[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=n[r]=n[r]||{};var o=i.image=new Image;o.addEventListener("load",t),o.addEventListener("error",function(){o.error=!0});var s="data:",l=r.substring(0,s.length).toLowerCase()===s;return l||(e=e==="null"?null:e,o.crossOrigin=e),o.src=r,o};var Wt={};Wt.registerBinding=function(r,e,t,a){var n=Array.prototype.slice.apply(arguments,[1]),i=this.binder(r);return i.on.apply(i,n)};Wt.binder=function(r){var e=this,t=e.cy.window(),a=r===t||r===t.document||r===t.document.body||Qu(r);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(l,u,v){var f=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(f[2]={capture:v??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:f}),(r.addEventListener||r.on).apply(r,f),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Wt.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};Wt.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};Wt.load=function(){var r=this,e=r.cy.window(),t=function(T){return T.selected()},a=function(T,V,Z,G){T==null&&(T=r.cy);for(var H=0;H<V.length;H++){var te=V[H];T.emit({originalEvent:Z,type:te,position:G})}},n=function(T){return T.shiftKey||T.metaKey||T.ctrlKey},i=function(T,V){var Z=!0;if(r.cy.hasCompoundNodes()&&T&&T.pannable())for(var G=0;V&&G<V.length;G++){var T=V[G];if(T.isNode()&&T.isParent()&&!T.pannable()){Z=!1;break}}else Z=!0;return Z},o=function(T){T[0]._private.grabbed=!0},s=function(T){T[0]._private.grabbed=!1},l=function(T){T[0]._private.rscratch.inDragLayer=!0},u=function(T){T[0]._private.rscratch.inDragLayer=!1},v=function(T){T[0]._private.rscratch.isGrabTarget=!0},f=function(T){T[0]._private.rscratch.isGrabTarget=!1},c=function(T,V){var Z=V.addToList,G=Z.has(T);!G&&T.grabbable()&&!T.locked()&&(Z.merge(T),o(T))},h=function(T,V){if(T.cy().hasCompoundNodes()&&!(V.inDragLayer==null&&V.addToList==null)){var Z=T.descendants();V.inDragLayer&&(Z.forEach(l),Z.connectedEdges().forEach(l)),V.addToList&&c(Z,V)}},d=function(T,V){V=V||{};var Z=T.cy().hasCompoundNodes();V.inDragLayer&&(T.forEach(l),T.neighborhood().stdFilter(function(G){return!Z||G.isEdge()}).forEach(l)),V.addToList&&T.forEach(function(G){c(G,V)}),h(T,V),g(T,{inDragLayer:V.inDragLayer}),r.updateCachedGrabbedEles()},y=d,p=function(T){T&&(r.getCachedZSortedEles().forEach(function(V){s(V),u(V),f(V)}),r.updateCachedGrabbedEles())},g=function(T,V){if(!(V.inDragLayer==null&&V.addToList==null)&&T.cy().hasCompoundNodes()){var Z=T.ancestors().orphans();if(!Z.same(T)){var G=Z.descendants().spawnSelf().merge(Z).unmerge(T).unmerge(T.descendants()),H=G.connectedEdges();V.inDragLayer&&(H.forEach(l),G.forEach(l)),V.addToList&&G.forEach(function(te){c(te,V)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},b=typeof MutationObserver<"u",w=typeof ResizeObserver<"u";b?(r.removeObserver=new MutationObserver(function(J){for(var T=0;T<J.length;T++){var V=J[T],Z=V.removedNodes;if(Z)for(var G=0;G<Z.length;G++){var H=Z[G];if(H===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(J){r.destroy()});var S=vn(function(){r.cy.resize()},100);b&&(r.styleObserver=new MutationObserver(S),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",S),w&&(r.resizeObserver=new ResizeObserver(S),r.resizeObserver.observe(r.container));var E=function(T,V){for(;T!=null;)V(T),T=T.parentNode},x=function(){r.invalidateContainerClientCoordsCache()};E(r.container,function(J){r.registerBinding(J,"transitionend",x),r.registerBinding(J,"animationend",x),r.registerBinding(J,"scroll",x)}),r.registerBinding(r.container,"contextmenu",function(J){J.preventDefault()});var D=function(){return r.selection[4]!==0},C=function(T){for(var V=r.findContainerClientCoords(),Z=V[0],G=V[1],H=V[2],te=V[3],K=T.touches?T.touches:[T],re=!1,ye=0;ye<K.length;ye++){var me=K[ye];if(Z<=me.clientX&&me.clientX<=Z+H&&G<=me.clientY&&me.clientY<=G+te){re=!0;break}}if(!re)return!1;for(var fe=r.container,we=T.target,le=we.parentNode,ge=!1;le;){if(le===fe){ge=!0;break}le=le.parentNode}return!!ge};r.registerBinding(r.container,"mousedown",function(T){if(C(T)&&!(r.hoverData.which===1&&T.which!==1)){T.preventDefault(),m(),r.hoverData.capture=!0,r.hoverData.which=T.which;var V=r.cy,Z=[T.clientX,T.clientY],G=r.projectIntoViewport(Z[0],Z[1]),H=r.selection,te=r.findNearestElements(G[0],G[1],!0,!1),K=te[0],re=r.dragData.possibleDragElements;r.hoverData.mdownPos=G,r.hoverData.mdownGPos=Z;var ye=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Ne=r.hoverData.down;Ne?Ne.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}}):V.emit({originalEvent:T,type:"taphold",position:{x:G[0],y:G[1]}})}},r.tapholdDuration)};if(T.which==3){r.hoverData.cxtStarted=!0;var me={originalEvent:T,type:"cxttapstart",position:{x:G[0],y:G[1]}};K?(K.activate(),K.emit(me),r.hoverData.down=K):V.emit(me),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(T.which==1){K&&K.activate();{if(K!=null&&r.nodeIsGrabbable(K)){var fe=function(Ne){return{originalEvent:T,type:Ne,position:{x:G[0],y:G[1]}}},we=function(Ne){Ne.emit(fe("grab"))};if(v(K),!K.selected())re=r.dragData.possibleDragElements=V.collection(),y(K,{addToList:re}),K.emit(fe("grabon")).emit(fe("grab"));else{re=r.dragData.possibleDragElements=V.collection();var le=V.$(function(ge){return ge.isNode()&&ge.selected()&&r.nodeIsGrabbable(ge)});d(le,{addToList:re}),K.emit(fe("grabon")),le.forEach(we)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=K,r.hoverData.downs=te,r.hoverData.downTime=new Date().getTime()}a(K,["mousedown","tapstart","vmousedown"],T,{x:G[0],y:G[1]}),K==null?(H[4]=1,r.data.bgActivePosistion={x:G[0],y:G[1]},r.redrawHint("select",!0),r.redraw()):K.pannable()&&(H[4]=1),ye()}H[0]=H[2]=G[0],H[1]=H[3]=G[1]}},!1),r.registerBinding(e,"mousemove",function(T){var V=r.hoverData.capture;if(!(!V&&!C(T))){var Z=!1,G=r.cy,H=G.zoom(),te=[T.clientX,T.clientY],K=r.projectIntoViewport(te[0],te[1]),re=r.hoverData.mdownPos,ye=r.hoverData.mdownGPos,me=r.selection,fe=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(fe=r.findNearestElement(K[0],K[1],!0,!1));var we=r.hoverData.last,le=r.hoverData.down,ge=[K[0]-me[2],K[1]-me[3]],Ne=r.dragData.possibleDragElements,Ae;if(ye){var ur=te[0]-ye[0],Ze=ur*ur,$e=te[1]-ye[1],fr=$e*$e,Qe=Ze+fr;r.hoverData.isOverThresholdDrag=Ae=Qe>=r.desktopTapThreshold2}var lr=n(T);Ae&&(r.hoverData.tapholdCancelled=!0);var xr=function(){var Mr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Mr.length===0?(Mr.push(ge[0]),Mr.push(ge[1])):(Mr[0]+=ge[0],Mr[1]+=ge[1])};Z=!0,a(fe,["mousemove","vmousemove","tapdrag"],T,{x:K[0],y:K[1]});var yr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:K[0],y:K[1]}}),me[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Ae){var cr={originalEvent:T,type:"cxtdrag",position:{x:K[0],y:K[1]}};le?le.emit(cr):G.emit(cr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||fe!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:K[0],y:K[1]}}),r.hoverData.cxtOver=fe,fe&&fe.emit({originalEvent:T,type:"cxtdragover",position:{x:K[0],y:K[1]}}))}}else if(r.hoverData.dragging){if(Z=!0,G.panningEnabled()&&G.userPanningEnabled()){var Br;if(r.hoverData.justStartedPan){var Fr=r.hoverData.mdownPos;Br={x:(K[0]-Fr[0])*H,y:(K[1]-Fr[1])*H},r.hoverData.justStartedPan=!1}else Br={x:ge[0]*H,y:ge[1]*H};G.panBy(Br),G.emit("dragpan"),r.hoverData.dragged=!0}K=r.projectIntoViewport(T.clientX,T.clientY)}else if(me[4]==1&&(le==null||le.pannable())){if(Ae){if(!r.hoverData.dragging&&G.boxSelectionEnabled()&&(lr||!G.panningEnabled()||!G.userPanningEnabled()))yr();else if(!r.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Er=i(le,r.hoverData.downs);Er&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,me[4]=0,r.data.bgActivePosistion=kt(re),r.redrawHint("select",!0),r.redraw())}le&&le.pannable()&&le.active()&&le.unactivate()}}else{if(le&&le.pannable()&&le.active()&&le.unactivate(),(!le||!le.grabbed())&&fe!=we&&(we&&a(we,["mouseout","tapdragout"],T,{x:K[0],y:K[1]}),fe&&a(fe,["mouseover","tapdragover"],T,{x:K[0],y:K[1]}),r.hoverData.last=fe),le)if(Ae){if(G.boxSelectionEnabled()&&lr)le&&le.grabbed()&&(p(Ne),le.emit("freeon"),Ne.emit("free"),r.dragData.didDrag&&(le.emit("dragfreeon"),Ne.emit("dragfree"))),yr();else if(le&&le.grabbed()&&r.nodeIsDraggable(le)){var He=!r.dragData.didDrag;He&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||d(Ne,{inDragLayer:!0});var Ye={x:0,y:0};if(ne(ge[0])&&ne(ge[1])&&(Ye.x+=ge[0],Ye.y+=ge[1],He)){var tr=r.hoverData.dragDelta;tr&&ne(tr[0])&&ne(tr[1])&&(Ye.x+=tr[0],Ye.y+=tr[1])}r.hoverData.draggingEles=!0,Ne.silentShift(Ye).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else xr();Z=!0}if(me[2]=K[0],me[3]=K[1],Z)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var M,P,B;r.registerBinding(e,"mouseup",function(T){if(!(r.hoverData.which===1&&T.which!==1&&r.hoverData.capture)){var V=r.hoverData.capture;if(V){r.hoverData.capture=!1;var Z=r.cy,G=r.projectIntoViewport(T.clientX,T.clientY),H=r.selection,te=r.findNearestElement(G[0],G[1],!0,!1),K=r.dragData.possibleDragElements,re=r.hoverData.down,ye=n(T);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,re&&re.unactivate(),r.hoverData.which===3){var me={originalEvent:T,type:"cxttapend",position:{x:G[0],y:G[1]}};if(re?re.emit(me):Z.emit(me),!r.hoverData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:G[0],y:G[1]}};re?re.emit(fe):Z.emit(fe)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(te,["mouseup","tapend","vmouseup"],T,{x:G[0],y:G[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(re,["click","tap","vclick"],T,{x:G[0],y:G[1]}),P=!1,T.timeStamp-B<=Z.multiClickDebounceTime()?(M&&clearTimeout(M),P=!0,B=null,a(re,["dblclick","dbltap","vdblclick"],T,{x:G[0],y:G[1]})):(M=setTimeout(function(){P||a(re,["oneclick","onetap","voneclick"],T,{x:G[0],y:G[1]})},Z.multiClickDebounceTime()),B=T.timeStamp)),re==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!n(T)&&(Z.$(t).unselect(["tapunselect"]),K.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=K=Z.collection()),te==re&&!r.dragData.didDrag&&!r.hoverData.selecting&&te!=null&&te._private.selectable&&(r.hoverData.dragging||(Z.selectionType()==="additive"||ye?te.selected()?te.unselect(["tapunselect"]):te.select(["tapselect"]):ye||(Z.$(t).unmerge(te).unselect(["tapunselect"]),te.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var we=Z.collection(r.getAllInBox(H[0],H[1],H[2],H[3]));r.redrawHint("select",!0),we.length>0&&r.redrawHint("eles",!0),Z.emit({type:"boxend",originalEvent:T,position:{x:G[0],y:G[1]}});var le=function(Ae){return Ae.selectable()&&!Ae.selected()};Z.selectionType()==="additive"||ye||Z.$(t).unmerge(we).unselect(),we.emit("box").stdFilter(le).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!H[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var ge=re&&re.grabbed();p(K),ge&&(re.emit("freeon"),K.emit("free"),r.dragData.didDrag&&(re.emit("dragfreeon"),K.emit("dragfree")))}}H[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var L=function(T){if(!r.scrollingPage){var V=r.cy,Z=V.zoom(),G=V.pan(),H=r.projectIntoViewport(T.clientX,T.clientY),te=[H[0]*Z+G.x,H[1]*Z+G.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||D()){T.preventDefault();return}if(V.panningEnabled()&&V.userPanningEnabled()&&V.zoomingEnabled()&&V.userZoomingEnabled()){T.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var K;T.deltaY!=null?K=T.deltaY/-250:T.wheelDeltaY!=null?K=T.wheelDeltaY/1e3:K=T.wheelDelta/1e3,K=K*r.wheelSensitivity;var re=T.deltaMode===1;re&&(K*=33);var ye=V.zoom()*Math.pow(10,K);T.type==="gesturechange"&&(ye=r.gestureStartZoom*T.scale),V.zoom({level:ye,renderedPosition:{x:te[0],y:te[1]}}),V.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",L,!0),r.registerBinding(e,"scroll",function(T){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(T){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||T.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(J){r.hasTouchStarted||L(J)},!0),r.registerBinding(r.container,"mouseout",function(T){var V=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseout",position:{x:V[0],y:V[1]}})},!1),r.registerBinding(r.container,"mouseover",function(T){var V=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseover",position:{x:V[0],y:V[1]}})},!1);var k,O,A,R,I,q,$,F,N,W,Q,_,j,ee=function(T,V,Z,G){return Math.sqrt((Z-T)*(Z-T)+(G-V)*(G-V))},U=function(T,V,Z,G){return(Z-T)*(Z-T)+(G-V)*(G-V)},z;r.registerBinding(r.container,"touchstart",z=function(T){if(r.hasTouchStarted=!0,!!C(T)){m(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var V=r.cy,Z=r.touchData.now,G=r.touchData.earlier;if(T.touches[0]){var H=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Z[0]=H[0],Z[1]=H[1]}if(T.touches[1]){var H=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Z[2]=H[0],Z[3]=H[1]}if(T.touches[2]){var H=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Z[4]=H[0],Z[5]=H[1]}if(T.touches[1]){r.touchData.singleTouchMoved=!0,p(r.dragData.touchDragEles);var te=r.findContainerClientCoords();N=te[0],W=te[1],Q=te[2],_=te[3],k=T.touches[0].clientX-N,O=T.touches[0].clientY-W,A=T.touches[1].clientX-N,R=T.touches[1].clientY-W,j=0<=k&&k<=Q&&0<=A&&A<=Q&&0<=O&&O<=_&&0<=R&&R<=_;var K=V.pan(),re=V.zoom();I=ee(k,O,A,R),q=U(k,O,A,R),$=[(k+A)/2,(O+R)/2],F=[($[0]-K.x)/re,($[1]-K.y)/re];var ye=200,me=ye*ye;if(q<me&&!T.touches[2]){var fe=r.findNearestElement(Z[0],Z[1],!0,!0),we=r.findNearestElement(Z[2],Z[3],!0,!0);fe&&fe.isNode()?(fe.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),r.touchData.start=fe):we&&we.isNode()?(we.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),r.touchData.start=we):V.emit({originalEvent:T,type:"cxttapstart",position:{x:Z[0],y:Z[1]}}),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(T.touches[2])V.boxSelectionEnabled()&&T.preventDefault();else if(!T.touches[1]){if(T.touches[0]){var le=r.findNearestElements(Z[0],Z[1],!0,!0),ge=le[0];if(ge!=null&&(ge.activate(),r.touchData.start=ge,r.touchData.starts=le,r.nodeIsGrabbable(ge))){var Ne=r.dragData.touchDragEles=V.collection(),Ae=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),ge.selected()?(Ae=V.$(function(Qe){return Qe.selected()&&r.nodeIsGrabbable(Qe)}),d(Ae,{addToList:Ne})):y(ge,{addToList:Ne}),v(ge);var ur=function(lr){return{originalEvent:T,type:lr,position:{x:Z[0],y:Z[1]}}};ge.emit(ur("grabon")),Ae?Ae.forEach(function(Qe){Qe.emit(ur("grab"))}):ge.emit(ur("grab"))}a(ge,["touchstart","tapstart","vmousedown"],T,{x:Z[0],y:Z[1]}),ge==null&&(r.data.bgActivePosistion={x:H[0],y:H[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&a(r.touchData.start,["taphold"],T,{x:Z[0],y:Z[1]})},r.tapholdDuration)}}if(T.touches.length>=1){for(var Ze=r.touchData.startPosition=[null,null,null,null,null,null],$e=0;$e<Z.length;$e++)Ze[$e]=G[$e]=Z[$e];var fr=T.touches[0];r.touchData.startGPosition=[fr.clientX,fr.clientY]}}},!1);var Y;r.registerBinding(e,"touchmove",Y=function(T){var V=r.touchData.capture;if(!(!V&&!C(T))){var Z=r.selection,G=r.cy,H=r.touchData.now,te=r.touchData.earlier,K=G.zoom();if(T.touches[0]){var re=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);H[0]=re[0],H[1]=re[1]}if(T.touches[1]){var re=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);H[2]=re[0],H[3]=re[1]}if(T.touches[2]){var re=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);H[4]=re[0],H[5]=re[1]}var ye=r.touchData.startGPosition,me;if(V&&T.touches[0]&&ye){for(var fe=[],we=0;we<H.length;we++)fe[we]=H[we]-te[we];var le=T.touches[0].clientX-ye[0],ge=le*le,Ne=T.touches[0].clientY-ye[1],Ae=Ne*Ne,ur=ge+Ae;me=ur>=r.touchTapThreshold2}if(V&&r.touchData.cxt){T.preventDefault();var Ze=T.touches[0].clientX-N,$e=T.touches[0].clientY-W,fr=T.touches[1].clientX-N,Qe=T.touches[1].clientY-W,lr=U(Ze,$e,fr,Qe),xr=lr/q,yr=150,cr=yr*yr,Br=1.5,Fr=Br*Br;if(xr>=Fr||lr>=cr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Er={originalEvent:T,type:"cxttapend",position:{x:H[0],y:H[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(Er),r.touchData.start=null):G.emit(Er)}}if(V&&r.touchData.cxt){var Er={originalEvent:T,type:"cxtdrag",position:{x:H[0],y:H[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Er):G.emit(Er),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var He=r.findNearestElement(H[0],H[1],!0,!0);(!r.touchData.cxtOver||He!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:H[0],y:H[1]}}),r.touchData.cxtOver=He,He&&He.emit({originalEvent:T,type:"cxtdragover",position:{x:H[0],y:H[1]}}))}else if(V&&T.touches[2]&&G.boxSelectionEnabled())T.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:H[0],y:H[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,Z[4]=1,!Z||Z.length===0||Z[0]===void 0?(Z[0]=(H[0]+H[2]+H[4])/3,Z[1]=(H[1]+H[3]+H[5])/3,Z[2]=(H[0]+H[2]+H[4])/3+1,Z[3]=(H[1]+H[3]+H[5])/3+1):(Z[2]=(H[0]+H[2]+H[4])/3,Z[3]=(H[1]+H[3]+H[5])/3),r.redrawHint("select",!0),r.redraw();else if(V&&T.touches[1]&&!r.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){T.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Ye=r.dragData.touchDragEles;if(Ye){r.redrawHint("drag",!0);for(var tr=0;tr<Ye.length;tr++){var bt=Ye[tr]._private;bt.grabbed=!1,bt.rscratch.inDragLayer=!1}}var Mr=r.touchData.start,Ze=T.touches[0].clientX-N,$e=T.touches[0].clientY-W,fr=T.touches[1].clientX-N,Qe=T.touches[1].clientY-W,ki=ee(Ze,$e,fr,Qe),Lu=ki/I;if(j){var Au=Ze-k,Ru=$e-O,Ou=fr-A,Iu=Qe-R,zu=(Au+Ou)/2,Nu=(Ru+Iu)/2,Xt=G.zoom(),Dn=Xt*Lu,Pa=G.pan(),Pi=F[0]*Xt+Pa.x,Bi=F[1]*Xt+Pa.y,Fu={x:-Dn/Xt*(Pi-Pa.x-zu)+Pi,y:-Dn/Xt*(Bi-Pa.y-Nu)+Bi};if(Mr&&Mr.active()){var Ye=r.dragData.touchDragEles;p(Ye),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Mr.unactivate().emit("freeon"),Ye.emit("free"),r.dragData.didDrag&&(Mr.emit("dragfreeon"),Ye.emit("dragfree"))}G.viewport({zoom:Dn,pan:Fu,cancelOnFailedZoom:!0}),G.emit("pinchzoom"),I=ki,k=Ze,O=$e,A=fr,R=Qe,r.pinching=!0}if(T.touches[0]){var re=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);H[0]=re[0],H[1]=re[1]}if(T.touches[1]){var re=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);H[2]=re[0],H[3]=re[1]}if(T.touches[2]){var re=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);H[4]=re[0],H[5]=re[1]}}else if(T.touches[0]&&!r.touchData.didSelect){var Cr=r.touchData.start,kn=r.touchData.last,He;if(!r.hoverData.draggingEles&&!r.swipePanning&&(He=r.findNearestElement(H[0],H[1],!0,!0)),V&&Cr!=null&&T.preventDefault(),V&&Cr!=null&&r.nodeIsDraggable(Cr))if(me){var Ye=r.dragData.touchDragEles,Mi=!r.dragData.didDrag;Mi&&d(Ye,{inDragLayer:!0}),r.dragData.didDrag=!0;var Zt={x:0,y:0};if(ne(fe[0])&&ne(fe[1])&&(Zt.x+=fe[0],Zt.y+=fe[1],Mi)){r.redrawHint("eles",!0);var Sr=r.touchData.dragDelta;Sr&&ne(Sr[0])&&ne(Sr[1])&&(Zt.x+=Sr[0],Zt.y+=Sr[1])}r.hoverData.draggingEles=!0,Ye.silentShift(Zt).emit("position drag"),r.redrawHint("drag",!0),r.touchData.startPosition[0]==te[0]&&r.touchData.startPosition[1]==te[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Sr=r.touchData.dragDelta=r.touchData.dragDelta||[];Sr.length===0?(Sr.push(fe[0]),Sr.push(fe[1])):(Sr[0]+=fe[0],Sr[1]+=fe[1])}if(a(Cr||He,["touchmove","tapdrag","vmousemove"],T,{x:H[0],y:H[1]}),(!Cr||!Cr.grabbed())&&He!=kn&&(kn&&kn.emit({originalEvent:T,type:"tapdragout",position:{x:H[0],y:H[1]}}),He&&He.emit({originalEvent:T,type:"tapdragover",position:{x:H[0],y:H[1]}})),r.touchData.last=He,V)for(var tr=0;tr<H.length;tr++)H[tr]&&r.touchData.startPosition[tr]&&me&&(r.touchData.singleTouchMoved=!0);if(V&&(Cr==null||Cr.pannable())&&G.panningEnabled()&&G.userPanningEnabled()){var Vu=i(Cr,r.touchData.starts);Vu&&(T.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=kt(r.touchData.startPosition)),r.swipePanning?(G.panBy({x:fe[0]*K,y:fe[1]*K}),G.emit("dragpan")):me&&(r.swipePanning=!0,G.panBy({x:le*K,y:Ne*K}),G.emit("dragpan"),Cr&&(Cr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var re=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);H[0]=re[0],H[1]=re[1]}}for(var we=0;we<H.length;we++)te[we]=H[we];V&&T.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var X;r.registerBinding(e,"touchcancel",X=function(T){var V=r.touchData.start;r.touchData.capture=!1,V&&V.unactivate()});var oe,he,ae,ie;if(r.registerBinding(e,"touchend",oe=function(T){var V=r.touchData.start,Z=r.touchData.capture;if(Z)T.touches.length===0&&(r.touchData.capture=!1),T.preventDefault();else return;var G=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var H=r.cy,te=H.zoom(),K=r.touchData.now,re=r.touchData.earlier;if(T.touches[0]){var ye=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);K[0]=ye[0],K[1]=ye[1]}if(T.touches[1]){var ye=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);K[2]=ye[0],K[3]=ye[1]}if(T.touches[2]){var ye=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);K[4]=ye[0],K[5]=ye[1]}V&&V.unactivate();var me;if(r.touchData.cxt){if(me={originalEvent:T,type:"cxttapend",position:{x:K[0],y:K[1]}},V?V.emit(me):H.emit(me),!r.touchData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:K[0],y:K[1]}};V?V.emit(fe):H.emit(fe)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!T.touches[2]&&H.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var we=H.collection(r.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,r.redrawHint("select",!0),H.emit({type:"boxend",originalEvent:T,position:{x:K[0],y:K[1]}});var le=function(cr){return cr.selectable()&&!cr.selected()};we.emit("box").stdFilter(le).select().emit("boxselect"),we.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(V!=null&&V.unactivate(),T.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ge=r.dragData.touchDragEles;if(V!=null){var Ne=V._private.grabbed;p(ge),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ne&&(V.emit("freeon"),ge.emit("free"),r.dragData.didDrag&&(V.emit("dragfreeon"),ge.emit("dragfree"))),a(V,["touchend","tapend","vmouseup","tapdragout"],T,{x:K[0],y:K[1]}),V.unactivate(),r.touchData.start=null}else{var Ae=r.findNearestElement(K[0],K[1],!0,!0);a(Ae,["touchend","tapend","vmouseup","tapdragout"],T,{x:K[0],y:K[1]})}var ur=r.touchData.startPosition[0]-K[0],Ze=ur*ur,$e=r.touchData.startPosition[1]-K[1],fr=$e*$e,Qe=Ze+fr,lr=Qe*te*te;r.touchData.singleTouchMoved||(V||H.$(":selected").unselect(["tapunselect"]),a(V,["tap","vclick"],T,{x:K[0],y:K[1]}),he=!1,T.timeStamp-ie<=H.multiClickDebounceTime()?(ae&&clearTimeout(ae),he=!0,ie=null,a(V,["dbltap","vdblclick"],T,{x:K[0],y:K[1]})):(ae=setTimeout(function(){he||a(V,["onetap","voneclick"],T,{x:K[0],y:K[1]})},H.multiClickDebounceTime()),ie=T.timeStamp)),V!=null&&!r.dragData.didDrag&&V._private.selectable&&lr<r.touchTapThreshold2&&!r.pinching&&(H.selectionType()==="single"?(H.$(t).unmerge(V).unselect(["tapunselect"]),V.select(["tapselect"])):V.selected()?V.unselect(["tapunselect"]):V.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var xr=0;xr<K.length;xr++)re[xr]=K[xr];r.dragData.didDrag=!1,T.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),T.touches.length<2&&(T.touches.length===1&&(r.touchData.startGPosition=[T.touches[0].clientX,T.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var ue=[],ce=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},ve=function(T){return{event:T,touch:ce(T)}},pe=function(T){ue.push(ve(T))},Pe=function(T){for(var V=0;V<ue.length;V++){var Z=ue[V];if(Z.event.pointerId===T.pointerId){ue.splice(V,1);return}}},Ee=function(T){var V=ue.filter(function(Z){return Z.event.pointerId===T.pointerId})[0];V.event=T,V.touch=ce(T)},xe=function(T){T.touches=ue.map(function(V){return V.touch})},Te=function(T){return T.pointerType==="mouse"||T.pointerType===4};r.registerBinding(r.container,"pointerdown",function(J){Te(J)||(J.preventDefault(),pe(J),xe(J),z(J))}),r.registerBinding(r.container,"pointerup",function(J){Te(J)||(Pe(J),xe(J),oe(J))}),r.registerBinding(r.container,"pointercancel",function(J){Te(J)||(Pe(J),xe(J),X(J))}),r.registerBinding(r.container,"pointermove",function(J){Te(J)||(J.preventDefault(),Ee(J),xe(J),Y(J))})}};var Gr={};Gr.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(a,n,i,o,s,l){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,l,u,v){return da(s,l,this.points,a,n,i/2,o/2,u)},checkPoint:function(a,n,i,o,s,l,u,v){return $r(a,n,this.points,l,u,o,s,[0,-1],i)}}};Gr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,o,s,l){return Gv(i,o,e,t,a/2+s,n/2+s)},checkPoint:function(e,t,a,n,i,o,s,l){return lt(e,t,n,i,o,s,a)}}};Gr.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(a,n,i,o,s,l,u){if(l[u]!==void 0&&l[u+"-cx"]===a&&l[u+"-cy"]===n)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=a,l[u+"-cy"]=n;var v=i/2,f=o/2;s=s==="auto"?ms(i,o):s;for(var c=new Array(e.length/2),h=0;h<e.length/2;h++)c[h]={x:a+v*e[h*2],y:n+f*e[h*2+1]};var d,y,p,g,m=c.length;for(y=c[m-1],d=0;d<m;d++)p=c[d%m],g=c[(d+1)%m],l[u][d]=Si(y,p,g,s),y=p,p=g;return l[u]},draw:function(a,n,i,o,s,l,u){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,l,u,"drawCorners"))},intersectLine:function(a,n,i,o,s,l,u,v,f){return Kv(s,l,this.points,a,n,i,o,u,this.getOrCreateCorners(a,n,i,o,v,f,"corners"))},checkPoint:function(a,n,i,o,s,l,u,v,f){return Hv(a,n,this.points,l,u,o,s,this.getOrCreateCorners(l,u,o,s,v,f,"corners"))}}};Gr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:vr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,o)},intersectLine:function(e,t,a,n,i,o,s,l){return ps(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){var u=n/2,v=i/2;l=l==="auto"?dt(n,i):l,l=Math.min(u,v,l);var f=l*2;return!!($r(e,t,this.points,o,s,n,i-f,[0,-1],a)||$r(e,t,this.points,o,s,n-f,i,[0,-1],a)||lt(e,t,f,f,o-u+l,s-v+l,a)||lt(e,t,f,f,o+u-l,s-v+l,a)||lt(e,t,f,f,o+u-l,s+v-l,a)||lt(e,t,f,f,o-u+l,s+v-l,a))}}};Gr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:ci(),points:vr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,null,o)},generateCutTrianglePts:function(e,t,a,n,i){var o=i==="auto"?this.cornerLength:i,s=t/2,l=e/2,u=a-l,v=a+l,f=n-s,c=n+s;return{topLeft:[u,f+o,u+o,f,u+o,f+o],topRight:[v-o,f,v,f+o,v-o,f+o],bottomRight:[v,c-o,v-o,c,v-o,c-o],bottomLeft:[u+o,c,u,c-o,u+o,c-o]}},intersectLine:function(e,t,a,n,i,o,s,l){var u=this.generateCutTrianglePts(a+2*s,n+2*s,e,t,l),v=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return da(i,o,v,e,t)},checkPoint:function(e,t,a,n,i,o,s,l){var u=l==="auto"?this.cornerLength:l;if($r(e,t,this.points,o,s,n,i-2*u,[0,-1],a)||$r(e,t,this.points,o,s,n-2*u,i,[0,-1],a))return!0;var v=this.generateCutTrianglePts(n,i,o,s);return dr(e,t,v.topLeft)||dr(e,t,v.topRight)||dr(e,t,v.bottomRight)||dr(e,t,v.bottomLeft)}}};Gr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:vr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,o,s,l){var u=.15,v=.5,f=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,t),h=function(p){var g=Bt({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),m=Bt({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},v),b=Bt({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},f);return[p[0],p[1],g.x,g.y,m.x,m.y,b.x,b.y,p[4],p[5]]},d=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return da(i,o,d,e,t)},generateBarrelBezierPts:function(e,t,a,n){var i=t/2,o=e/2,s=a-o,l=a+o,u=n-i,v=n+i,f=Hn(e,t),c=f.heightOffset,h=f.widthOffset,d=f.ctrlPtOffsetPct*e,y={topLeft:[s,u+c,s+d,u,s+h,u],topRight:[l-h,u,l-d,u,l,u+c],bottomRight:[l,v-c,l-d,v,l-h,v],bottomLeft:[s+h,v,s+d,v,s,v-c]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,t,a,n,i,o,s,l){var u=Hn(n,i),v=u.heightOffset,f=u.widthOffset;if($r(e,t,this.points,o,s,n,i-2*v,[0,-1],a)||$r(e,t,this.points,o,s,n-2*f,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),h=function(D,C,M){var P=M[4],B=M[2],L=M[0],k=M[5],O=M[1],A=Math.min(P,L),R=Math.max(P,L),I=Math.min(k,O),q=Math.max(k,O);if(A<=D&&D<=R&&I<=C&&C<=q){var $=Wv(P,B,L),F=Fv($[0],$[1],$[2],D),N=F.filter(function(W){return 0<=W&&W<=1});if(N.length>0)return N[0]}return null},d=Object.keys(c),y=0;y<d.length;y++){var p=d[y],g=c[p],m=h(e,t,g);if(m!=null){var b=g[5],w=g[3],S=g[1],E=Xe(b,w,S,m);if(g.isTop&&E<=t||g.isBottom&&t<=E)return!0}}return!1}}};Gr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:vr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,o)},intersectLine:function(e,t,a,n,i,o,s,l){var u=e-(a/2+s),v=t-(n/2+s),f=v,c=e+(a/2+s),h=Xr(i,o,e,t,u,v,c,f,!1);return h.length>0?h:ps(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){l=l==="auto"?dt(n,i):l;var u=2*l;if($r(e,t,this.points,o,s,n,i-u,[0,-1],a)||$r(e,t,this.points,o,s,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[o-v,s-f,o-v,s,o+v,s,o+v,s-f];return!!(dr(e,t,c)||lt(e,t,u,u,o+n/2-l,s+i/2-l,a)||lt(e,t,u,u,o-n/2+l,s+i/2-l,a))}}};Gr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",vr(3,0)),this.generateRoundPolygon("round-triangle",vr(3,0)),this.generatePolygon("rectangle",vr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",vr(5,0)),this.generateRoundPolygon("round-pentagon",vr(5,0)),this.generatePolygon("hexagon",vr(6,0)),this.generateRoundPolygon("round-hexagon",vr(6,0)),this.generatePolygon("heptagon",vr(7,0)),this.generateRoundPolygon("round-heptagon",vr(7,0)),this.generatePolygon("octagon",vr(8,0)),this.generateRoundPolygon("round-octagon",vr(8,0));var a=new Array(20);{var n=$n(5,0),i=$n(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=ys(a),this.generatePolygon("star",a),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)}r.makePolygon=function(u){var v=u.join("$"),f="polygon-"+v,c;return(c=this[f])?c:e.generatePolygon(f,u)}};var Da={};Da.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Da.redraw=function(r){r=r||fs();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};Da.beforeRender=function(r,e){if(!this.destroyed){e==null&&Ve("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(a,n){return n.priority-a.priority})}};var No=function(e,t,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,a)};Da.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function a(n){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){No(r,!0,n);var i=qr();r.render(r.renderOptions);var o=r.lastDrawTime=qr();r.averageRedrawTime===void 0&&(r.averageRedrawTime=o-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var s=o-i;r.redrawTotalTime+=s,r.lastRedrawTime=s,r.averageRedrawTime=r.averageRedrawTime/2+s/2,r.requestedFrame=!1}else No(r,!1,n);r.skipFrame=!1,Ja(a)}};Ja(t)}};var kg=function(e){this.init(e)},pu=kg,Ut=pu.prototype;Ut.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Ut.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=n.getElementById(o)!=null;if(t.className.indexOf(s)<0&&(t.className=(t.className||"")+" "+s),!l){var u=n.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",i.insertBefore(u,i.children[0])}var v=a.getComputedStyle(t),f=v.getPropertyValue("position");f==="static"&&Me("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=ne(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Ut.notify=function(r,e){var t=this,a=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&a.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Ut.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],a=t,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}};Ut.isHeadless=function(){return!1};[Ci,hu,gu,Wt,Gr,Da].forEach(function(r){be(Ut,r)});var Fn=1e3/60,yu={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=vn(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(u,v){var f=qr(),c=n.averageRedrawTime,h=n.lastRedrawTime,d=[],y=n.cy.extent(),p=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var g=qr(),m=g-f,b=g-v;if(h<Fn){var w=Fn-(u?c:0);if(b>=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*Fn)break;var S=e.deq(a,p,y);if(S.length>0)for(var E=0;E<S.length;E++)d.push(S[E]);else break}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,y)&&i())},s=e.priority||ui;n.beforeRender(o,s(a))}}}},Pg=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_a;ai(this,r),this.idsByKey=new Or,this.keyForId=new Or,this.cachesByLvl=new Or,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return ni(r,[{key:"getIdsFor",value:function(t){t==null&&Ve("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new Ft,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Or,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),r}(),Fo=25,qa=50,Za=-4,jn=3,Bg=7.99,Mg=8,Lg=1024,Ag=1024,Rg=1024,Og=.2,Ig=.8,zg=10,Ng=.15,Fg=.1,Vg=.9,qg=.9,$g=100,Hg=1,Pt={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Gg=er({getKey:null,doesEleInvalidateKey:_a,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:us,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ia=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=Gg(t);be(a,n),a.lookup=new Pg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ue=ia.prototype;Ue.reasons=Pt;Ue.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ue.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ue.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ea(function(t,a){return a.reqs-t.reqs});return e};Ue.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ue.getElement=function(r,e,t,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(vi(s*t))),a<Za)a=Za;else if(s>=Bg||a>jn)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=o.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var h=l.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(v<=Fo?d=Fo:v<=qa?d=qa:d=Math.ceil(v/qa)*qa,v>Rg||f>Ag)return null;var y=i.getTextureQueue(d),p=y[y.length-2],g=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};p||(p=y[y.length-1]),p||(p=g()),p.width-p.usedWidth<f&&(p=g());for(var m=function(A){return A&&A.scaledLabelShown===c},b=n&&n===Pt.dequeue,w=n&&n===Pt.highQuality,S=n&&n===Pt.downscale,E,x=a+1;x<=jn;x++){var D=l.get(r,x);if(D){E=D;break}}var C=E&&E.level===a+1?E:null,M=function(){p.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,p.usedWidth,0,f,v)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,f,d),m(C))M();else if(m(E))if(w){for(var P=E.level;P>a;P--)C=i.getElement(r,e,t,P,Pt.downscale);M()}else return i.queueElement(r,E.level-1),E;else{var B;if(!b&&!w&&!S)for(var L=a-1;L>=Za;L--){var k=l.get(r,L);if(k){B=k;break}}if(m(B))return i.queueElement(r,a),B;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,r,e,c,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return h={x:p.usedWidth,texture:p,level:a,scale:u,width:f,height:v,scaledLabelShown:c},p.usedWidth+=Math.ceil(f+Mg),p.eleCaches.push(h),l.set(r,a,h),i.checkTextureFullness(p),h};Ue.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};Ue.invalidateElement=function(r){var e=this,t=e.lookup,a=[],n=t.isInvalid(r);if(n){for(var i=Za;i<=jn;i++){var o=t.getForCachedKey(r,i);o&&a.push(o)}var s=t.invalidate(r);if(s)for(var l=0;l<a.length;l++){var u=a[l],v=u.texture;v.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(v)}e.removeFromQueue(r)}};Ue.checkTextureUtility=function(r){r.invalidatedWidth>=Og*r.width&&this.retireTexture(r)};Ue.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Ig&&r.fullnessChecks>=zg?_r(t,r):r.fullnessChecks++};Ue.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;_r(a,r),r.retired=!0;for(var i=r.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}li(i);var l=e.getRetiredTextureQueue(t);l.push(r)};Ue.addTexture=function(r,e){var t=this,a=t.getTextureQueue(r),n={};return a.push(n),n.eleCaches=[],n.height=r,n.width=Math.max(Lg,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=t.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};Ue.recycleTexture=function(r,e){for(var t=this,a=t.getTextureQueue(r),n=t.getRetiredTextureQueue(r),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,li(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),_r(n,o),a.push(o),o}};Ue.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,a.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(s),n[i]=s}};Ue.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Hg&&t.size()>0;o++){var s=t.pop(),l=s.key,u=s.eles[0],v=i.hasCache(u,s.level);if(a[l]=null,v)continue;n.push(s);var f=e.getBoundingBox(u);e.getElement(u,f,r,s.level,Pt.dequeue)}return n};Ue.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=si,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ue.onDequeue=function(r){this.onDequeues.push(r)};Ue.offDequeue=function(r){_r(this.onDequeues,r)};Ue.setupDequeueing=yu.setupDequeueing({deqRedrawThreshold:$g,deqCost:Ng,deqAvgCost:Fg,deqNoDrawCost:Vg,deqFastCost:qg,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(t)}},shouldRedraw:function(e,t,a,n){for(var i=0;i<t.length;i++)for(var o=t[i].eles,s=0;s<o.length;s++){var l=o[s].boundingBox();if(fi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Kg=1,sa=-4,sn=2,Wg=3.99,Ug=50,Yg=50,Xg=.15,Zg=.1,Qg=.9,Jg=.9,_g=1,Vo=250,jg=4e3*4e3,ep=!0,mu=function(e){var t=this,a=t.renderer=e,n=a.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=qr()-2*Vo,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=vn(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},Yg),a.beforeRender(function(o,s){s-t.lastInvalidationTime<=Vo?t.skipping=!0:t.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,l){return l.reqs-s.reqs};t.layersQueue=new Ea(i),t.setupDequeueing()},rr=mu.prototype,qo=0,rp=Math.pow(2,53)-1;rr.makeLayer=function(r,e){var t=Math.pow(2,e),a=Math.ceil(r.w*t),n=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(a,n),o={id:qo=++qo%rp,bb:r,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(t,t),s.translate(l,u),o};rr.getLayers=function(r,e,t){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,t==null){if(t=Math.ceil(vi(o*e)),t<sa)t=sa;else if(o>=Wg||t>sn)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[],f,c=a.levelIsComplete(t,r),h,d=function(){var M=function(O){if(a.validateLayersElesOrdering(O,r),a.levelIsComplete(O,r))return h=l[O],!0},P=function(O){if(!h)for(var A=t+O;sa<=A&&A<=sn&&!M(A);A+=O);};P(1),P(-1);for(var B=v.length-1;B>=0;B--){var L=v[B];L.invalid&&_r(v,L)}};if(!c)d();else return v;var y=function(){if(!f){f=hr();for(var M=0;M<r.length;M++)hs(f,r[M].boundingBox())}return f},p=function(M){M=M||{};var P=M.after;y();var B=f.w*u*(f.h*u);if(B>jg)return null;var L=a.makeLayer(f,t);if(P!=null){var k=v.indexOf(P)+1;v.splice(k,0,L)}else(M.insert===void 0||M.insert)&&v.unshift(L);return L};if(a.skipping&&!s)return null;for(var g=null,m=r.length/Kg,b=!s,w=0;w<r.length;w++){var S=r[w],E=S._private.rscratch,x=E.imgLayerCaches=E.imgLayerCaches||{},D=x[t];if(D){g=D;continue}if((!g||g.eles.length>=m||!gs(g.bb,S.boundingBox()))&&(g=p({insert:!0,after:g}),!g))return null;h||b?a.queueLayer(g,S):a.drawEleInLayer(g,S,t,e),g.eles.push(S),x[t]=g}return h||(b?null:v)};rr.getEleLevelForLayerLevel=function(r,e){return r};rr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,ep),i.setImgSmoothing(o,!0))};rr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length};rr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a<t.length;a++){for(var n=t[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};rr.updateElementsInLayers=function(r,e){for(var t=this,a=wa(r[0]),n=0;n<r.length;n++)for(var i=a?null:r[n],o=a?r[n]:r[n].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=sa;u<=sn;u++){var v=l[u];v&&(i&&t.getEleLevelForLayerLevel(v.level)!==i.level||e(v,o,i))}};rr.haveLayers=function(){for(var r=this,e=!1,t=sa;t<=sn;t++){var a=r.layersByLevel[t];if(a&&a.length>0){e=!0;break}}return e};rr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=qr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};rr.invalidateLayer=function(r){if(this.lastInvalidationTime=qr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];_r(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n<t.length;n++){var i=t[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};rr.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};rr.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};rr.queueLayer=function(r,e){var t=this,a=t.layersQueue,n=r.elesQueue,i=n.hasId=n.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,a.updateItem(r)):(r.reqs=1,a.push(r))}};rr.dequeue=function(r){for(var e=this,t=e.layersQueue,a=[],n=0;n<_g&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,r),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};rr.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],a=r.replaces,n=t.indexOf(a);if(!(n<0||a.invalid)){t[n]=r;for(var i=0;i<r.eles.length;i++){var o=r.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[r.level]=r)}e.requestRedraw()}};rr.requestRedraw=vn(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);rr.setupDequeueing=yu.setupDequeueing({deqRedrawThreshold:Ug,deqCost:Xg,deqAvgCost:Zg,deqNoDrawCost:Qg,deqFastCost:Jg,deq:function(e,t){return e.dequeue(t)},onDeqd:ui,shouldRedraw:us,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var bu={},$o;function tp(r,e){for(var t=0;t<e.length;t++){var a=e[t];r.lineTo(a.x,a.y)}}function ap(r,e,t){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,a.x,a.y)}function Ho(r,e,t){r.beginPath&&r.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];r.lineTo(i.x,i.y)}var o=t,s=t[0];r.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function np(r,e,t,a,n){r.beginPath&&r.beginPath(),r.arc(t,a,n,0,Math.PI*2,!1);var i=e,o=i[0];r.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var l=i[s];r.lineTo(l.x,l.y)}r.closePath&&r.closePath()}function ip(r,e,t,a){r.arc(e,t,a,0,Math.PI*2,!1)}bu.arrowShapeImpl=function(r){return($o||($o={polygon:tp,"triangle-backcurve":ap,"triangle-tee":Ho,"circle-triangle":np,"triangle-cross":Ho,circle:ip}))[r]};var Nr={};Nr.drawElement=function(r,e,t,a,n,i){var o=this;e.isNode()?o.drawNode(r,e,t,a,n,i):o.drawEdge(r,e,t,a,n,i)};Nr.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};Nr.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};Nr.drawCachedElementPortion=function(r,e,t,a,n,i,o,s){var l=this,u=t.getBoundingBox(e);if(!(u.w===0||u.h===0)){var v=t.getElement(e,u,a,n,i);if(v!=null){var f=s(l,e);if(f===0)return;var c=o(l,e),h=u.x1,d=u.y1,y=u.w,p=u.h,g,m,b,w,S;if(c!==0){var E=t.getRotationPoint(e);b=E.x,w=E.y,r.translate(b,w),r.rotate(c),S=l.getImgSmoothing(r),S||l.setImgSmoothing(r,!0);var x=t.getRotationOffset(e);g=x.x,m=x.y}else g=h,m=d;var D;f!==1&&(D=r.globalAlpha,r.globalAlpha=D*f),r.drawImage(v.texture.canvas,v.x,0,v.width,v.height,g,m,y,p),f!==1&&(r.globalAlpha=D),c!==0&&(r.rotate(-c),r.translate(-b,-w),S||l.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var op=function(){return 0},sp=function(e,t){return e.getTextAngle(t,null)},up=function(e,t){return e.getTextAngle(t,"source")},lp=function(e,t){return e.getTextAngle(t,"target")},vp=function(e,t){return t.effectiveOpacity()},Vn=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Nr.drawCachedElement=function(r,e,t,a,n,i){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,v=s.slbTxrCache,f=s.tlbTxrCache,c=e.boundingBox(),h=i===!0?l.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||fi(c,a))){var d=e.isEdge(),y=e.element()._private.rscratch.badLine;o.drawElementUnderlay(r,e),o.drawCachedElementPortion(r,e,l,t,n,h,op,vp),(!d||!y)&&o.drawCachedElementPortion(r,e,u,t,n,h,sp,Vn),d&&!y&&(o.drawCachedElementPortion(r,e,v,t,n,h,up,Vn),o.drawCachedElementPortion(r,e,f,t,n,h,lp,Vn)),o.drawElementOverlay(r,e)}};Nr.drawElements=function(r,e){for(var t=this,a=0;a<e.length;a++){var n=e[a];t.drawElement(r,n)}};Nr.drawCachedElements=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(r,o,t,a)}};Nr.drawCachedNodes=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(r,o,t,a)}};Nr.drawLayeredElements=function(r,e,t,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,t);if(i)for(var o=0;o<i.length;o++){var s=i[o],l=s.bb;l.w===0||l.h===0||r.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(r,e,t,a)};var Kr={};Kr.drawEdge=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,g=u*v,m=u*v,b=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;f==="straight-triangle"?(o.eleStrokeStyle(r,e,O),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=h,r.lineCap=d,o.eleStrokeStyle(r,e,O),o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},w=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(r.lineWidth=h+y,r.lineCap=d,y>0)o.colorStrokeStyle(r,p[0],p[1],p[2],O);else{r.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},S=function(){n&&o.drawEdgeOverlay(r,e)},E=function(){n&&o.drawEdgeUnderlay(r,e)},x=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(r,e,O)},D=function(){o.drawElementText(r,e,null,a)};r.lineJoin="round";var C=e.pstyle("ghost").value==="yes";if(C){var M=e.pstyle("ghost-offset-x").pfValue,P=e.pstyle("ghost-offset-y").pfValue,B=e.pstyle("ghost-opacity").value,L=g*B;r.translate(M,P),b(L),x(L),r.translate(-M,-P)}else w();E(),b(),x(),S(),D(),t&&r.translate(l.x1,l.y1)}};var wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,s.allpts,"solid")}}}};Kr.drawEdgeOverlay=wu("overlay");Kr.drawEdgeUnderlay=wu("underlay");Kr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,o,s=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=f,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<t.length;h+=4)e.quadraticCurveTo(t[h],t[h+1],t[h+2],t[h+3]);break;case"straight":case"haystack":for(var d=2;d+1<t.length;d+=2)e.lineTo(t[d],t[d+1]);break;case"segments":if(n.isRound){var y=Xo(n.roundCorners),p;try{for(y.s();!(p=y.n()).done;){var g=p.value;lu(e,g)}}catch(b){y.e(b)}finally{y.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var m=2;m+1<t.length;m+=2)e.lineTo(t[m],t[m+1]);break}e=i,l?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Kr.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var a=r.pstyle("width").pfValue,n=0;n+1<t.length;n+=2){var i=[t[n+2]-t[n],t[n+3]-t[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(t[n]-l[0],t[n+1]-l[1]),e.lineTo(t[n]+l[0],t[n+1]+l[1]),e.lineTo(t[n+2],t[n+3]),e.closePath(),e.fill()}};Kr.drawArrowheads=function(r,e,t){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(r,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,t),n||this.drawArrowhead(r,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,t)};Kr.drawArrowhead=function(r,e,t,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,l=e.pstyle(t+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",v=e.pstyle(t+"-arrow-fill").value,f=e.pstyle("width").pfValue,c=e.pstyle(t+"-arrow-width"),h=c.value==="match-line"?f:c.pfValue;c.units==="%"&&(h*=f);var d=e.pstyle("opacity").value;o===void 0&&(o=d);var y=r.globalCompositeOperation;(o!==1||v==="hollow")&&(r.globalCompositeOperation="destination-out",s.colorFillStyle(r,255,255,255,1),s.colorStrokeStyle(r,255,255,255,1),s.drawArrowShape(e,r,u,f,l,h,a,n,i),r.globalCompositeOperation=y);var p=e.pstyle(t+"-arrow-color").value;s.colorFillStyle(r,p[0],p[1],p[2],o),s.colorStrokeStyle(r,p[0],p[1],p[2],o),s.drawArrowShape(e,r,v,f,l,h,a,n,i)}}};Kr.drawArrowShape=function(r,e,t,a,n,i,o,s,l){var u=this,v=this.usePaths()&&n!=="triangle-cross",f=!1,c,h=e,d={x:o,y:s},y=r.pstyle("arrow-scale").value,p=this.getArrowWidth(a,y),g=u.arrowShapes[n];if(v){var m=u.arrowPathCache=u.arrowPathCache||[],b=ft(n),w=m[b];w!=null?(c=e=w,f=!0):(c=e=new Path2D,m[b]=c)}f||(e.beginPath&&e.beginPath(),v?g.draw(e,1,0,{x:0,y:0},1):g.draw(e,p,l,d,a),e.closePath&&e.closePath()),e=h,v&&(e.translate(o,s),e.rotate(l),e.scale(p,p)),(t==="filled"||t==="both")&&(v?e.fill(c):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(v?p:1),e.lineJoin="miter",v?e.stroke(c):e.stroke()),v&&(e.scale(1/p,1/p),e.rotate(-l),e.translate(-o,-s))};var Di={};Di.safeDrawImage=function(r,e,t,a,n,i,o,s,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{r.drawImage(e,t,a,n,i,o,s,l,u)}catch(v){Me(v)}};Di.drawInscribedImage=function(r,e,t,a,n){var i=this,o=t.position(),s=o.x,l=o.y,u=t.cy().style(),v=u.getIndexedStyle.bind(u),f=v(t,"background-fit","value",a),c=v(t,"background-repeat","value",a),h=t.width(),d=t.height(),y=t.padding()*2,p=h+(v(t,"background-width-relative-to","value",a)==="inner"?0:y),g=d+(v(t,"background-height-relative-to","value",a)==="inner"?0:y),m=t._private.rscratch,b=v(t,"background-clip","value",a),w=b==="node",S=v(t,"background-image-opacity","value",a)*n,E=v(t,"background-image-smoothing","value",a),x=t.pstyle("corner-radius").value;x!=="auto"&&(x=t.pstyle("corner-radius").pfValue);var D=e.width||e.cachedW,C=e.height||e.cachedH;(D==null||C==null)&&(document.body.appendChild(e),D=e.cachedW=e.width||e.offsetWidth,C=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var M=D,P=C;if(v(t,"background-width","value",a)!=="auto"&&(v(t,"background-width","units",a)==="%"?M=v(t,"background-width","pfValue",a)*p:M=v(t,"background-width","pfValue",a)),v(t,"background-height","value",a)!=="auto"&&(v(t,"background-height","units",a)==="%"?P=v(t,"background-height","pfValue",a)*g:P=v(t,"background-height","pfValue",a)),!(M===0||P===0)){if(f==="contain"){var B=Math.min(p/M,g/P);M*=B,P*=B}else if(f==="cover"){var B=Math.max(p/M,g/P);M*=B,P*=B}var L=s-p/2,k=v(t,"background-position-x","units",a),O=v(t,"background-position-x","pfValue",a);k==="%"?L+=(p-M)*O:L+=O;var A=v(t,"background-offset-x","units",a),R=v(t,"background-offset-x","pfValue",a);A==="%"?L+=(p-M)*R:L+=R;var I=l-g/2,q=v(t,"background-position-y","units",a),$=v(t,"background-position-y","pfValue",a);q==="%"?I+=(g-P)*$:I+=$;var F=v(t,"background-offset-y","units",a),N=v(t,"background-offset-y","pfValue",a);F==="%"?I+=(g-P)*N:I+=N,m.pathCache&&(L-=s,I-=l,s=0,l=0);var W=r.globalAlpha;r.globalAlpha=S;var Q=i.getImgSmoothing(r),_=!1;if(E==="no"&&Q?(i.setImgSmoothing(r,!1),_=!0):E==="yes"&&!Q&&(i.setImgSmoothing(r,!0),_=!0),c==="no-repeat")w&&(r.save(),m.pathCache?r.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,s,l,p,g,x,m),r.clip())),i.safeDrawImage(r,e,0,0,D,C,L,I,M,P),w&&r.restore();else{var j=r.createPattern(e,c);r.fillStyle=j,i.nodeShapes[i.getNodeShape(t)].draw(r,s,l,p,g,x,m),r.translate(L,I),r.fill(),r.translate(-L,-I)}r.globalAlpha=W,_&&i.setImgSmoothing(r,Q)}};var mt={};mt.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(vi(t*a));e=Math.pow(2,n)}var i=r.pstyle("font-size").pfValue*e,o=r.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};mt.drawElementText=function(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(o.drawText(r,e,null,h,i),e.isEdge()&&(o.drawText(r,e,"source",h,i),o.drawText(r,e,"target",h,i))):o.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};mt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};mt.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*s,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+o+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],s),this.colorStrokeStyle(r,v[0],v[1],v[2],l)};function qn(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),o?r.stroke():r.fill()}mt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=kr(n,"labelAngle",e);return o.strValue==="autorotate"?t=r.isEdge()?s:0:o.strValue==="none"?t=0:t=o.pfValue,t};mt.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var l=kr(o,"labelX",t),u=kr(o,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=kr(o,"labelWidth",t),y=kr(o,"labelHeight",t),p=e.pstyle(h+"text-margin-x").pfValue,g=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),l+=p,u+=g;var S;switch(a?S=this.getTextAngle(e,t):S=0,S!==0&&(v=l,f=u,r.translate(v,f),r.rotate(S),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var E=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,D=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,M=e.pstyle("text-background-shape").strValue,P=M.indexOf("round")===0,B=2;if(E>0||D>0&&x>0){var L=l-C;switch(b){case"left":L-=d;break;case"center":L-=d/2;break}var k=u-y-C,O=d+2*C,A=y+2*C;if(E>0){var R=r.fillStyle,I=e.pstyle("text-background-color").value;r.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",P?qn(r,L,k,O,A,B):r.fillRect(L,k,O,A),r.fillStyle=R}if(D>0&&x>0){var q=r.strokeStyle,$=r.lineWidth,F=e.pstyle("text-border-color").value,N=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+x*s+")",r.lineWidth=D,r.setLineDash)switch(N){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=D/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(P?qn(r,L,k,O,A,B,"stroke"):r.strokeRect(L,k,O,A),N==="double"){var W=D/2;P?qn(r,L+W,k+W,O-W*2,A-W*2,B,"stroke"):r.strokeRect(L+W,k+W,O-W*2,A-W*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=$,r.strokeStyle=q}}var Q=2*e.pstyle("text-outline-width").pfValue;if(Q>0&&(r.lineWidth=Q),e.pstyle("text-wrap").value==="wrap"){var _=kr(o,"labelWrapCachedLines",t),j=kr(o,"labelLineHeight",t),ee=d/2,U=this.getLabelJustification(e);switch(U==="auto"||(b==="left"?U==="left"?l+=-d:U==="center"&&(l+=-ee):b==="center"?U==="left"?l+=-ee:U==="right"&&(l+=ee):b==="right"&&(U==="center"?l+=ee:U==="right"&&(l+=d))),w){case"top":u-=(_.length-1)*j;break;case"center":case"bottom":u-=(_.length-1)*j;break}for(var z=0;z<_.length;z++)Q>0&&r.strokeText(_[z],l,u),r.fillText(_[z],l,u),u+=j}else Q>0&&r.strokeText(c,l,u),r.fillText(c,l,u);S!==0&&(r.rotate(-S),r.translate(-v,-f))}}};var Yt={};Yt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,l,u=e._private,v=u.rscratch,f=e.position();if(!(!ne(f.x)||!ne(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,y=!1,p=e.padding();s=e.width()+2*p,l=e.height()+2*p;var g;t&&(g=t,r.translate(-g.x1,-g.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),S=new Array(b.length),E=0,x=0;x<b.length;x++){var D=b[x],C=w[x]=D!=null&&D!=="none";if(C){var M=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",x);E++,S[x]=o.getCachedImage(D,M,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var P=e.pstyle("background-blacken").value,B=e.pstyle("border-width").pfValue,L=e.pstyle("background-opacity").value*c,k=e.pstyle("border-color").value,O=e.pstyle("border-style").value,A=e.pstyle("border-join").value,R=e.pstyle("border-cap").value,I=e.pstyle("border-position").value,q=e.pstyle("border-dash-pattern").pfValue,$=e.pstyle("border-dash-offset").pfValue,F=e.pstyle("border-opacity").value*c,N=e.pstyle("outline-width").pfValue,W=e.pstyle("outline-color").value,Q=e.pstyle("outline-style").value,_=e.pstyle("outline-opacity").value*c,j=e.pstyle("outline-offset").value,ee=e.pstyle("corner-radius").value;ee!=="auto"&&(ee=e.pstyle("corner-radius").pfValue);var U=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(r,e,te)},z=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(r,k[0],k[1],k[2],te)},Y=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;o.colorStrokeStyle(r,W[0],W[1],W[2],te)},X=function(te,K,re,ye){var me=o.nodePathCache=o.nodePathCache||[],fe=ss(re==="polygon"?re+","+ye.join(","):re,""+K,""+te,""+ee),we=me[fe],le,ge=!1;return we!=null?(le=we,ge=!0,v.pathCache=le):(le=new Path2D,me[fe]=v.pathCache=le),{path:le,cacheHit:ge}},oe=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var ae=X(s,l,oe,he);d=ae.path,y=ae.cacheHit}var ie=function(){if(!y){var te=f;h&&(te={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||r,te.x,te.y,s,l,ee,v)}h?r.fill(d):r.fill()},ue=function(){for(var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,re=u.backgrounding,ye=0,me=0;me<S.length;me++){var fe=e.cy().style().getIndexedStyle(e,"background-image-containment","value",me);if(K&&fe==="over"||!K&&fe==="inside"){ye++;continue}w[me]&&S[me].complete&&!S[me].error&&(ye++,o.drawInscribedImage(r,S[me],e,me,te))}u.backgrounding=ye!==E,re!==u.backgrounding&&e.updateStyle(!1)},ce=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(r,e,K),te&&(h||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,l,ee,v)))},ve=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,K=(P>0?P:-P)*te,re=P>0?0:255;P!==0&&(o.colorFillStyle(r,re,re,re,K),h?r.fill(d):r.fill())},pe=function(){if(B>0){if(r.lineWidth=B,r.lineCap=R,r.lineJoin=A,r.setLineDash)switch(O){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(q),r.lineDashOffset=$;break;case"solid":case"double":r.setLineDash([]);break}if(I!=="center"){if(r.save(),r.lineWidth*=2,I==="inside")h?r.clip(d):r.clip();else{var te=new Path2D;te.rect(-s/2-B,-l/2-B,s+2*B,l+2*B),te.addPath(d),r.clip(te,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(O==="double"){r.lineWidth=B/3;var K=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=K}r.setLineDash&&r.setLineDash([])}},Pe=function(){if(N>0){if(r.lineWidth=N,r.lineCap="butt",r.setLineDash)switch(Q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var te=f;h&&(te={x:0,y:0});var K=o.getNodeShape(e),re=B;I==="inside"&&(re=0),I==="outside"&&(re*=2);var ye=(s+re+(N+j))/s,me=(l+re+(N+j))/l,fe=s*ye,we=l*me,le=o.nodeShapes[K].points,ge;if(h){var Ne=X(fe,we,K,le);ge=Ne.path}if(K==="ellipse")o.drawEllipsePath(ge||r,te.x,te.y,fe,we);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(K)){var Ae=0,ur=0,Ze=0;K==="round-diamond"?Ae=(re+j+N)*1.4:K==="round-heptagon"?(Ae=(re+j+N)*1.075,Ze=-(re/2+j+N)/35):K==="round-hexagon"?Ae=(re+j+N)*1.12:K==="round-pentagon"?(Ae=(re+j+N)*1.13,Ze=-(re/2+j+N)/15):K==="round-tag"?(Ae=(re+j+N)*1.12,ur=(re/2+N+j)*.07):K==="round-triangle"&&(Ae=(re+j+N)*(Math.PI/2),Ze=-(re+j/2+N)/Math.PI),Ae!==0&&(ye=(s+Ae)/s,fe=s*ye,["round-hexagon","round-tag"].includes(K)||(me=(l+Ae)/l,we=l*me)),ee=ee==="auto"?ms(fe,we):ee;for(var $e=fe/2,fr=we/2,Qe=ee+(re+N+j)/2,lr=new Array(le.length/2),xr=new Array(le.length/2),yr=0;yr<le.length/2;yr++)lr[yr]={x:te.x+ur+$e*le[yr*2],y:te.y+Ze+fr*le[yr*2+1]};var cr,Br,Fr,Er,He=lr.length;for(Br=lr[He-1],cr=0;cr<He;cr++)Fr=lr[cr%He],Er=lr[(cr+1)%He],xr[cr]=Si(Br,Fr,Er,Qe),Br=Fr,Fr=Er;o.drawRoundPolygonPath(ge||r,te.x+ur,te.y+Ze,s*ye,l*me,le,xr)}else if(["roundrectangle","round-rectangle"].includes(K))ee=ee==="auto"?dt(fe,we):ee,o.drawRoundRectanglePath(ge||r,te.x,te.y,fe,we,ee+(re+N+j)/2);else if(["cutrectangle","cut-rectangle"].includes(K))ee=ee==="auto"?ci():ee,o.drawCutRectanglePath(ge||r,te.x,te.y,fe,we,null,ee+(re+N+j)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(K))ee=ee==="auto"?dt(fe,we):ee,o.drawBottomRoundRectanglePath(ge||r,te.x,te.y,fe,we,ee+(re+N+j)/2);else if(K==="barrel")o.drawBarrelPath(ge||r,te.x,te.y,fe,we);else if(K.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(K)){var Ye=(re+N+j)/s;le=ja(en(le,Ye)),o.drawPolygonPath(ge||r,te.x,te.y,s,l,le)}else{var tr=(re+N+j)/s;le=ja(en(le,-tr)),o.drawPolygonPath(ge||r,te.x,te.y,s,l,le)}if(h?r.stroke(ge):r.stroke(),Q==="double"){r.lineWidth=re/3;var bt=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(ge):r.stroke(),r.globalCompositeOperation=bt}r.setLineDash&&r.setLineDash([])}},Ee=function(){n&&o.drawNodeOverlay(r,e,f,s,l)},xe=function(){n&&o.drawNodeUnderlay(r,e,f,s,l)},Te=function(){o.drawElementText(r,e,null,a)},J=e.pstyle("ghost").value==="yes";if(J){var T=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue,Z=e.pstyle("ghost-opacity").value,G=Z*c;r.translate(T,V),Y(),Pe(),U(Z*L),ie(),ue(G,!0),z(Z*F),pe(),ce(P!==0||B!==0),ue(G,!1),ve(G),r.translate(-T,-V)}h&&r.translate(-f.x,-f.y),xe(),h&&r.translate(f.x,f.y),Y(),Pe(),U(),ie(),ue(c,!0),z(),pe(),ce(P!==0||B!==0),ue(c,!1),ve(),h&&r.translate(-f.x,-f.y),Te(),Ee(),t&&r.translate(g.x1,g.y1)}};var xu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,o){var s=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,v=a.pstyle("".concat(e,"-color")).value,f=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(t,v[0],v[1],v[2],u),s.nodeShapes[f].draw(t,n.x,n.y,i+l*2,o+l*2,c),t.fill()}}}};Yt.drawNodeOverlay=xu("overlay");Yt.drawNodeUnderlay=xu("underlay");Yt.hasPie=function(r){return r=r[0],r._private.hasPie};Yt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=a.x,s=a.y,l=e.width(),u=e.height(),v=Math.min(l,u)/2,f=0,c=this.usePaths();c&&(o=0,s=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2);for(var h=1;h<=n.pieBackgroundN;h++){var d=e.pstyle("pie-"+h+"-background-size").value,y=e.pstyle("pie-"+h+"-background-color").value,p=e.pstyle("pie-"+h+"-background-opacity").value*t,g=d/100;g+f>1&&(g=1-f);var m=1.5*Math.PI+2*Math.PI*f,b=2*Math.PI*g,w=m+b;d===0||f>=1||f+g>1||(r.beginPath(),r.moveTo(o,s),r.arc(o,s,v,m,w),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],p),r.fill(),f+=g)}};var pr={},fp=100;pr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};pr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===r){t=!1;break}return t&&(a={context:r},e.push(a)),a};pr.createGradientStyleFor=function(r,e,t,a,n){var i,o=this.usePaths(),s=t.pstyle(e+"-gradient-stop-colors").value,l=t.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(t.isEdge()){var u=t.sourceEndpoint(),v=t.targetEndpoint(),f=t.midpoint(),c=ct(u,f),h=ct(v,f);i=r.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(c,h))}else{var d=o?{x:0,y:0}:t.position(),y=t.paddedWidth(),p=t.paddedHeight();i=r.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(y,p))}else if(t.isEdge()){var g=t.sourceEndpoint(),m=t.targetEndpoint();i=r.createLinearGradient(g.x,g.y,m.x,m.y)}else{var b=o?{x:0,y:0}:t.position(),w=t.paddedWidth(),S=t.paddedHeight(),E=w/2,x=S/2,D=t.pstyle("background-gradient-direction").value;switch(D){case"to-bottom":i=r.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":i=r.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":i=r.createLinearGradient(b.x+E,b.y,b.x-E,b.y);break;case"to-right":i=r.createLinearGradient(b.x-E,b.y,b.x+E,b.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(b.x-E,b.y-x,b.x+E,b.y+x);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(b.x-E,b.y+x,b.x+E,b.y-x);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(b.x+E,b.y-x,b.x-E,b.y+x);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(b.x+E,b.y+x,b.x-E,b.y-x);break}}if(!i)return null;for(var C=l.length===s.length,M=s.length,P=0;P<M;P++)i.addColorStop(C?l[P]:P/(M-1),"rgba("+s[P][0]+","+s[P][1]+","+s[P][2]+","+n+")");return i};pr.gradientFillStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"background",e,t,a);if(!n)return null;r.fillStyle=n};pr.colorFillStyle=function(r,e,t,a,n){r.fillStyle="rgba("+e+","+t+","+a+","+n+")"};pr.eleFillStyle=function(r,e,t){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(r,e,a,t);else{var n=e.pstyle("background-color").value;this.colorFillStyle(r,n[0],n[1],n[2],t)}};pr.gradientStrokeStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"line",e,t,a);if(!n)return null;r.strokeStyle=n};pr.colorStrokeStyle=function(r,e,t,a,n){r.strokeStyle="rgba("+e+","+t+","+a+","+n+")"};pr.eleStrokeStyle=function(r,e,t){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(r,e,a,t);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(r,n[0],n[1],n[2],t)}};pr.matchCanvasSize=function(r){var e=this,t=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=n*o,u=i*o,v;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var f=t.canvasContainer;f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)v=t.canvases[c],v.width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)v=t.bufferCanvases[c],v.width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";e.textureMult=1,o<=1&&(v=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,v.width=l*e.textureMult,v.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u}};pr.renderTo=function(r,e,t,a){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:a})};pr.render=function(r){r=r||fs();var e=r.forcedContext,t=r.drawAllLayers,a=r.drawOnlyNodeLayer,n=r.forcedZoom,i=r.forcedPan,o=this,s=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,l=o.cy,u=o.data,v=u.canvasNeedsRedraw,f=o.textureOnViewport&&!e&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),c=r.motionBlur!==void 0?r.motionBlur:o.motionBlur,h=o.motionBlurPxRatio,d=l.hasCompoundNodes(),y=o.hoverData.draggingEles,p=!!(o.hoverData.selecting||o.touchData.selecting);c=c&&!e&&o.motionBlurEnabled&&!p;var g=c;e||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!e&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),c&&(o.mbFrames==null&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(g=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(v[o.NODE]=!0,v[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),w=n!==void 0?n:b,S=l.pan(),E={x:S.x,y:S.y},x={zoom:b,pan:{x:S.x,y:S.y}},D=o.prevViewport,C=D===void 0||x.zoom!==D.zoom||x.pan.x!==D.pan.x||x.pan.y!==D.pan.y;!C&&!(y&&!d)&&(o.motionBlurPxRatio=1),i&&(E=i),w*=s,E.x*=s,E.y*=s;var M=o.getCachedZSortedEles();function P(ae,ie,ue,ce,ve){var pe=ae.globalCompositeOperation;ae.globalCompositeOperation="destination-out",o.colorFillStyle(ae,255,255,255,o.motionBlurTransparency),ae.fillRect(ie,ue,ce,ve),ae.globalCompositeOperation=pe}function B(ae,ie){var ue,ce,ve,pe;!o.clearingMotionBlur&&(ae===u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||ae===u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ue={x:S.x*h,y:S.y*h},ce=b*h,ve=o.canvasWidth*h,pe=o.canvasHeight*h):(ue=E,ce=w,ve=o.canvasWidth,pe=o.canvasHeight),ae.setTransform(1,0,0,1,0,0),ie==="motionBlur"?P(ae,0,0,ve,pe):!e&&(ie===void 0||ie)&&ae.clearRect(0,0,ve,pe),t||(ae.translate(ue.x,ue.y),ae.scale(ce,ce)),i&&ae.translate(i.x,i.y),n&&ae.scale(n,n)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var x=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[o.DRAG]=!1,v[o.NODE]=!1;var k=u.contexts[o.NODE],O=o.textureCache.texture,x=o.textureCache.viewport;k.setTransform(1,0,0,1,0,0),c?P(k,0,0,x.width,x.height):k.clearRect(0,0,x.width,x.height);var A=m.core("outside-texture-bg-color").value,R=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(k,A[0],A[1],A[2],R),k.fillRect(0,0,x.width,x.height);var b=l.zoom();B(k,!1),k.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s),k.drawImage(O,x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s)}else o.textureOnViewport&&!e&&(o.textureCache=null);var I=l.extent(),q=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),$=o.hideEdgesOnViewport&&q,F=[];if(F[o.NODE]=!v[o.NODE]&&c&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,F[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),F[o.DRAG]=!v[o.DRAG]&&c&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,F[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),v[o.NODE]||t||a||F[o.NODE]){var N=c&&!F[o.NODE]&&h!==1,k=e||(N?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),W=c&&!N?"motionBlur":void 0;B(k,W),$?o.drawCachedNodes(k,M.nondrag,s,I):o.drawLayeredElements(k,M.nondrag,s,I),o.debug&&o.drawDebugPoints(k,M.nondrag),!t&&!c&&(v[o.NODE]=!1)}if(!a&&(v[o.DRAG]||t||F[o.DRAG])){var N=c&&!F[o.DRAG]&&h!==1,k=e||(N?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);B(k,c&&!N?"motionBlur":void 0),$?o.drawCachedNodes(k,M.drag,s,I):o.drawCachedElements(k,M.drag,s,I),o.debug&&o.drawDebugPoints(k,M.drag),!t&&!c&&(v[o.DRAG]=!1)}if(o.showFps||!a&&v[o.SELECT_BOX]&&!t){var k=e||u.contexts[o.SELECT_BOX];if(B(k),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var b=o.cy.zoom(),Q=m.core("selection-box-border-width").value/b;k.lineWidth=Q,k.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",k.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),Q>0&&(k.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",k.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var b=o.cy.zoom(),_=u.bgActivePosistion;k.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",k.beginPath(),k.arc(_.x,_.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),k.fill()}var j=o.lastRedrawTime;if(o.showFps&&j){j=Math.round(j);var ee=Math.round(1e3/j);k.setTransform(1,0,0,1,0,0),k.fillStyle="rgba(255, 0, 0, 0.75)",k.strokeStyle="rgba(255, 0, 0, 0.75)",k.lineWidth=1,k.fillText("1 frame = "+j+" ms = "+ee+" fps",0,20);var U=60;k.strokeRect(0,30,250,20),k.fillRect(0,30,250*Math.min(ee/U,1),20)}t||(v[o.SELECT_BOX]=!1)}if(c&&h!==1){var z=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],oe=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],he=function(ie,ue,ce){ie.setTransform(1,0,0,1,0,0),ce||!g?ie.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(ie,0,0,o.canvasWidth,o.canvasHeight);var ve=h;ie.drawImage(ue,0,0,o.canvasWidth*ve,o.canvasHeight*ve,0,0,o.canvasWidth,o.canvasHeight)};(v[o.NODE]||F[o.NODE])&&(he(z,Y,F[o.NODE]),v[o.NODE]=!1),(v[o.DRAG]||F[o.DRAG])&&(he(X,oe,F[o.DRAG]),v[o.DRAG]=!1)}o.prevViewport=x,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),c&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,v[o.NODE]=!0,v[o.DRAG]=!0,o.redraw()},fp)),e||l.emit("render")};var at={};at.drawPolygonPath=function(r,e,t,a,n,i){var o=a/2,s=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var l=1;l<i.length/2;l++)r.lineTo(e+o*i[l*2],t+s*i[l*2+1]);r.closePath()};at.drawRoundPolygonPath=function(r,e,t,a,n,i,o){o.forEach(function(s){return lu(r,s)}),r.closePath()};at.drawRoundRectanglePath=function(r,e,t,a,n,i){var o=a/2,s=n/2,l=i==="auto"?dt(a,n):Math.min(i,s,o);r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.arcTo(e+o,t-s,e+o,t,l),r.arcTo(e+o,t+s,e,t+s,l),r.arcTo(e-o,t+s,e-o,t,l),r.arcTo(e-o,t-s,e,t-s,l),r.lineTo(e,t-s),r.closePath()};at.drawBottomRoundRectanglePath=function(r,e,t,a,n,i){var o=a/2,s=n/2,l=i==="auto"?dt(a,n):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.lineTo(e+o,t-s),r.lineTo(e+o,t),r.arcTo(e+o,t+s,e,t+s,l),r.arcTo(e-o,t+s,e-o,t,l),r.lineTo(e-o,t-s),r.lineTo(e,t-s),r.closePath()};at.drawCutRectanglePath=function(r,e,t,a,n,i,o){var s=a/2,l=n/2,u=o==="auto"?ci():o;r.beginPath&&r.beginPath(),r.moveTo(e-s+u,t-l),r.lineTo(e+s-u,t-l),r.lineTo(e+s,t-l+u),r.lineTo(e+s,t+l-u),r.lineTo(e+s-u,t+l),r.lineTo(e-s+u,t+l),r.lineTo(e-s,t+l-u),r.lineTo(e-s,t-l+u),r.closePath()};at.drawBarrelPath=function(r,e,t,a,n){var i=a/2,o=n/2,s=e-i,l=e+i,u=t-o,v=t+o,f=Hn(a,n),c=f.widthOffset,h=f.heightOffset,d=f.ctrlPtOffsetPct*c;r.beginPath&&r.beginPath(),r.moveTo(s,u+h),r.lineTo(s,v-h),r.quadraticCurveTo(s+d,v,s+c,v),r.lineTo(l-c,v),r.quadraticCurveTo(l-d,v,l,v-h),r.lineTo(l,u+h),r.quadraticCurveTo(l-d,u,l-c,u),r.lineTo(s+c,u),r.quadraticCurveTo(s+d,u,s,u+h),r.closePath()};var Go=Math.sin(0),Ko=Math.cos(0),ei={},ri={},Eu=Math.PI/40;for(var Tt=0*Math.PI;Tt<2*Math.PI;Tt+=Eu)ei[Tt]=Math.sin(Tt),ri[Tt]=Math.cos(Tt);at.drawEllipsePath=function(r,e,t,a,n){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=Eu)i=e-s*ei[u]*Go+s*ri[u]*Ko,o=t+l*ri[u]*Go+l*ei[u]*Ko,u===0?r.moveTo(i,o):r.lineTo(i,o);r.closePath()};var ka={};ka.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};ka.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),a=t.boundingBox(),n=this.findContainerClientCoords(),i=r.full?Math.ceil(a.w):n[2],o=r.full?Math.ceil(a.h):n[3],s=ne(r.maxWidth)||ne(r.maxHeight),l=this.getPixelRatio(),u=1;if(r.scale!==void 0)i*=r.scale,o*=r.scale,u=r.scale;else if(s){var v=1/0,f=1/0;ne(r.maxWidth)&&(v=u*r.maxWidth/i),ne(r.maxHeight)&&(f=u*r.maxHeight/o),u=Math.min(v,f),i*=u,o*=u}s||(i*=l,o*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=o,c.style.width=i+"px",c.style.height=o+"px";var h=c.getContext("2d");if(i>0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var y=e.pan(),p={x:y.x*u,y:y.y*u};u*=e.zoom(),h.translate(p.x,p.y),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(-p.x,-p.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,o),h.fill())}return c};function cp(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new Blob([a],{type:e})}function Wo(r){var e=r.indexOf(",");return r.substr(e+1)}function Cu(r,e,t){var a=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new Vt(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(o){i(o)}});case"blob":return cp(Wo(a()),t);case"base64":return Wo(a());case"base64uri":default:return a()}}ka.png=function(r){return Cu(r,this.bufferCanvasImage(r),"image/png")};ka.jpg=function(r){return Cu(r,this.bufferCanvasImage(r),"image/jpeg")};var Su={};Su.nodeShapeImpl=function(r,e,t,a,n,i,o,s){switch(r){case"ellipse":return this.drawEllipsePath(e,t,a,n,i);case"polygon":return this.drawPolygonPath(e,t,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,t,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,a,n,i,s);case"barrel":return this.drawBarrelPath(e,t,a,n,i)}};var dp=Tu,De=Tu.prototype;De.CANVAS_LAYERS=3;De.SELECT_BOX=0;De.DRAG=1;De.NODE=2;De.BUFFER_COUNT=3;De.TEXTURE_BUFFER=0;De.MOTIONBLUR_BUFFER_NODE=1;De.MOTIONBLUR_BUFFER_DRAG=2;function Tu(r){var e=this,t=e.cy.window(),a=t.document;e.data={canvases:new Array(De.CANVAS_LAYERS),contexts:new Array(De.CANVAS_LAYERS),canvasNeedsRedraw:new Array(De.CANVAS_LAYERS),bufferCanvases:new Array(De.BUFFER_COUNT),bufferContexts:new Array(De.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=r.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;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"};ju()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<De.CANVAS_LAYERS;u++){var v=e.data.canvases[u]=a.createElement("canvas");e.data.contexts[u]=v.getContext("2d"),Object.keys(l).forEach(function(U){v.style[U]=l[U]}),v.style.position="absolute",v.setAttribute("data-id","layer"+u),v.style.zIndex=String(De.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(v),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[De.NODE].setAttribute("data-id","layer"+De.NODE+"-node"),e.data.canvases[De.SELECT_BOX].setAttribute("data-id","layer"+De.SELECT_BOX+"-selectbox"),e.data.canvases[De.DRAG].setAttribute("data-id","layer"+De.DRAG+"-drag");for(var u=0;u<De.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=a.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var f=hr(),c=function(z){return{x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2}},h=function(z){return{x:-z.w/2,y:-z.h/2}},d=function(z){var Y=z[0]._private,X=Y.oldBackgroundTimestamp===Y.backgroundTimestamp;return!X},y=function(z){return z[0]._private.nodeKey},p=function(z){return z[0]._private.labelStyleKey},g=function(z){return z[0]._private.sourceLabelStyleKey},m=function(z){return z[0]._private.targetLabelStyleKey},b=function(z,Y,X,oe,he){return e.drawElement(z,Y,X,!1,!1,he)},w=function(z,Y,X,oe,he){return e.drawElementText(z,Y,X,oe,"main",he)},S=function(z,Y,X,oe,he){return e.drawElementText(z,Y,X,oe,"source",he)},E=function(z,Y,X,oe,he){return e.drawElementText(z,Y,X,oe,"target",he)},x=function(z){return z.boundingBox(),z[0]._private.bodyBounds},D=function(z){return z.boundingBox(),z[0]._private.labelBounds.main||f},C=function(z){return z.boundingBox(),z[0]._private.labelBounds.source||f},M=function(z){return z.boundingBox(),z[0]._private.labelBounds.target||f},P=function(z,Y){return Y},B=function(z){return c(x(z))},L=function(z,Y,X){var oe=z?z+"-":"";return{x:Y.x+X.pstyle(oe+"text-margin-x").pfValue,y:Y.y+X.pstyle(oe+"text-margin-y").pfValue}},k=function(z,Y,X){var oe=z[0]._private.rscratch;return{x:oe[Y],y:oe[X]}},O=function(z){return L("",k(z,"labelX","labelY"),z)},A=function(z){return L("source",k(z,"sourceLabelX","sourceLabelY"),z)},R=function(z){return L("target",k(z,"targetLabelX","targetLabelY"),z)},I=function(z){return h(x(z))},q=function(z){return h(C(z))},$=function(z){return h(M(z))},F=function(z){var Y=D(z),X=h(D(z));if(z.isNode()){switch(z.pstyle("text-halign").value){case"left":X.x=-Y.w;break;case"right":X.x=0;break}switch(z.pstyle("text-valign").value){case"top":X.y=-Y.h;break;case"bottom":X.y=0;break}}return X},N=e.data.eleTxrCache=new ia(e,{getKey:y,doesEleInvalidateKey:d,drawElement:b,getBoundingBox:x,getRotationPoint:B,getRotationOffset:I,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),W=e.data.lblTxrCache=new ia(e,{getKey:p,drawElement:w,getBoundingBox:D,getRotationPoint:O,getRotationOffset:F,isVisible:P}),Q=e.data.slbTxrCache=new ia(e,{getKey:g,drawElement:S,getBoundingBox:C,getRotationPoint:A,getRotationOffset:q,isVisible:P}),_=e.data.tlbTxrCache=new ia(e,{getKey:m,drawElement:E,getBoundingBox:M,getRotationPoint:R,getRotationOffset:$,isVisible:P}),j=e.data.lyrTxrCache=new mu(e);e.onUpdateEleCalcs(function(z,Y){N.invalidateElements(Y),W.invalidateElements(Y),Q.invalidateElements(Y),_.invalidateElements(Y),j.invalidateElements(Y);for(var X=0;X<Y.length;X++){var oe=Y[X]._private;oe.oldBackgroundTimestamp=oe.backgroundTimestamp}});var ee=function(z){for(var Y=0;Y<z.length;Y++)j.enqueueElementRefinement(z[Y].ele)};N.onDequeue(ee),W.onDequeue(ee),Q.onDequeue(ee),_.onDequeue(ee)}De.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[De.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[De.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[De.SELECT_BOX]=e;break}};var hp=typeof Path2D<"u";De.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};De.usePaths=function(){return hp&&this.pathsEnabled};De.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};De.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};De.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":We(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[bu,Nr,Kr,Di,mt,Yt,pr,at,ka,Su].forEach(function(r){be(De,r)});var gp=[{name:"null",impl:ou},{name:"base",impl:pu},{name:"canvas",impl:dp}],pp=[{type:"layout",extensions:Eg},{type:"renderer",extensions:gp}],Du={},ku={};function Pu(r,e,t){var a=t,n=function(D){Me("Can not register `"+e+"` for `"+r+"` since `"+D+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(ma.prototype[e])return n(e);ma.prototype[e]=t}else if(r==="collection"){if(je.prototype[e])return n(e);je.prototype[e]=t}else if(r==="layout"){for(var i=function(D){this.options=D,t.call(this,D),Se(this._private)||(this._private={}),this._private.cy=D.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var v=t.prototype.stop;o.stop=function(){var x=this.options;if(x&&x.animate){var D=this.animations;if(D)for(var C=0;C<D.length;C++)D[C].stop()}return v?v.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(D){return D._private.cy},c={addEventFields:function(D,C){C.layout=D,C.cy=f(D),C.target=D},bubble:function(){return!0},parent:function(D){return f(D)}};be(o,{createEmitter:function(){return this._private.emitter=new mn(c,this),this},emitter:function(){return this._private.emitter},on:function(D,C){return this.emitter().on(D,C),this},one:function(D,C){return this.emitter().one(D,C),this},once:function(D,C){return this.emitter().one(D,C),this},removeListener:function(D,C){return this.emitter().removeListener(D,C),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(D,C){return this.emitter().emit(D,C),this}}),Be.eventAliasesOn(o),a=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var h=Bu("renderer","base"),d=h.prototype,y=t,p=t.prototype,g=function(){h.apply(this,arguments),y.apply(this,arguments)},m=g.prototype;for(var b in d){var w=d[b],S=p[b]!=null;if(S)return n(b);m[b]=w}for(var E in p)m[E]=p[E];d.clientFunctions.forEach(function(x){m[x]=m[x]||function(){Ve("Renderer does not implement `renderer."+x+"()` on its prototype")}}),a=g}else if(r==="__proto__"||r==="constructor"||r==="prototype")return Ve(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return es({map:Du,keys:[r,e],value:a})}function Bu(r,e){return rs({map:Du,keys:[r,e]})}function yp(r,e,t,a,n){return es({map:ku,keys:[r,e,t,a],value:n})}function mp(r,e,t,a){return rs({map:ku,keys:[r,e,t,a]})}var ti=function(){if(arguments.length===2)return Bu.apply(null,arguments);if(arguments.length===3)return Pu.apply(null,arguments);if(arguments.length===4)return mp.apply(null,arguments);if(arguments.length===5)return yp.apply(null,arguments);Ve("Invalid extension access syntax")};ma.prototype.extension=ti;pp.forEach(function(r){r.extensions.forEach(function(e){Pu(r.type,e.name,e.impl)})});var Mu=function r(){if(!(this instanceof r))return new r;this.length=0},pt=Mu.prototype;pt.instanceString=function(){return"stylesheet"};pt.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};pt.css=function(r,e){var t=this.length-1;if(de(r))this[t].properties.push({name:r,value:e});else if(Se(r))for(var a=r,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var l=ar.properties[o]||ar.properties[un(o)];if(l!=null){var u=l.name,v=s;this[t].properties.push({name:u,value:v})}}}return this};pt.style=pt.css;pt.generateStyle=function(r){var e=new ar(r);return this.appendToStyle(e)};pt.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.selector,n=t.properties;r.selector(a);for(var i=0;i<n.length;i++){var o=n[i];r.css(o.name,o.value)}}return r};var bp="3.30.2",Nt=function(e){if(e===void 0&&(e={}),Se(e))return new ma(e);if(de(e))return ti.apply(ti,arguments)};Nt.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Nt),r.apply(null,e),this};Nt.warnings=function(r){return ls(r)};Nt.version=bp;Nt.stylesheet=Nt.Stylesheet=Mu;export{Nt as c};