livebook/static/assets/mindmap-definition-7f612c4b-3BUWGJC3.js
2024-01-24 15:02:24 +00:00

118 lines
461 KiB
JavaScript

import{a as Qu}from"./chunk-RB5OF3IH.js";import"./chunk-BZUL2CAN.js";import{$a as Da,Fa as Rr,Ha as Ju,I as Mp,L as Wu,M as Ku,N as Zu,b as Op,c as Np,cb as ju,h as sn}from"./chunk-KR7JTV7U.js";import{f as ni,h as nn}from"./chunk-3V74GZ4F.js";var el=ni((Qi,Ji)=>{(function(q,W){typeof Qi=="object"&&typeof Ji!="undefined"?Ji.exports=W():typeof define=="function"&&define.amd?define(W):(q=typeof globalThis!="undefined"?globalThis:q||self,q.cytoscape=W())})(Qi,function(){"use strict";function q(t){"@babel/helpers - typeof";return q=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},q(t)}function W(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function L(t,e,r){return e&&_(t.prototype,e),r&&_(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function E(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function w(t,e){return A(t)||V(t,e)||U(t,e)||J()}function A(t){if(Array.isArray(t))return t}function V(t,e){var r=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a=[],n=!0,i=!1,s,o;try{for(r=r.call(t);!(n=(s=r.next()).done)&&(a.push(s.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,o=l}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw o}}return a}}function U(t,e){if(t){if(typeof t=="string")return R(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(t,e)}}function R(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function J(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var D=typeof window=="undefined"?null:window,$=D?D.navigator:null;D&&D.document;var Y=q(""),j=q({}),te=q(function(){}),le=typeof HTMLElement=="undefined"?"undefined":q(HTMLElement),Q=function(e){return e&&e.instanceString&&ne(e.instanceString)?e.instanceString():null},ee=function(e){return e!=null&&q(e)==Y},ne=function(e){return e!=null&&q(e)===te},me=function(e){return!se(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},C=function(e){return e!=null&&q(e)===j&&!me(e)&&e.constructor===Object},B=function(e){return e!=null&&q(e)===j},N=function(e){return e!=null&&q(e)===q(1)&&!isNaN(e)},Z=function(e){return N(e)&&Math.floor(e)===e},ue=function(e){if(le!=="undefined")return e!=null&&e instanceof HTMLElement},se=function(e){return Le(e)||be(e)},Le=function(e){return Q(e)==="collection"&&e._private.single},be=function(e){return Q(e)==="collection"&&!e._private.single},Ge=function(e){return Q(e)==="core"},et=function(e){return Q(e)==="stylesheet"},ct=function(e){return Q(e)==="event"},Ye=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Fe=function(e){return typeof HTMLElement=="undefined"?!1:e instanceof HTMLElement},ze=function(e){return C(e)&&N(e.x1)&&N(e.x2)&&N(e.y1)&&N(e.y2)},Je=function(e){return B(e)&&ne(e.then)},at=function(){return $&&$.userAgent.match(/msie|trident|edge/i)},ut=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function n(){var i=this,s=arguments,o,l=r.apply(i,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},tt=ut(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Tt=ut(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),mt=ut(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),xt=function(e){return Ye(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ke="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",mr="rgb[a]?\\(("+Ke+"[%]?)\\s*,\\s*("+Ke+"[%]?)\\s*,\\s*("+Ke+"[%]?)(?:\\s*,\\s*("+Ke+"))?\\)",Zt="rgb[a]?\\((?:"+Ke+"[%]?)\\s*,\\s*(?:"+Ke+"[%]?)\\s*,\\s*(?:"+Ke+"[%]?)(?:\\s*,\\s*(?:"+Ke+"))?\\)",br="hsl[a]?\\(("+Ke+")\\s*,\\s*("+Ke+"[%])\\s*,\\s*("+Ke+"[%])(?:\\s*,\\s*("+Ke+"))?\\)",Qt="hsl[a]?\\((?:"+Ke+")\\s*,\\s*(?:"+Ke+"[%])\\s*,\\s*(?:"+Ke+"[%])(?:\\s*,\\s*(?:"+Ke+"))?\\)",hn="\\#[0-9a-fA-F]{3}",Kr="\\#[0-9a-fA-F]{6}",Zr=function(e,r){return e<r?-1:e>r?1:0},Jt=function(e,r){return-1*Zr(e,r)},$e=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];t[s]=a[s]}}return t},fl=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,s=16;return r?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},hl=function(e){var r,a,n,i,s,o,l,u;function f(d,g,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?d+(g-d)*6*y:y<1/2?g:y<2/3?d+(g-d)*(2/3-y)*6:d}var h=new RegExp("^"+br+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,v=2*i-c;o=Math.round(255*f(v,c,a+1/3)),l=Math.round(255*f(v,c,a)),u=Math.round(255*f(v,c,a-1/3))}r=[o,l,u,s]}return r},cl=function(e){var r,a=new RegExp("^"+mr+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},vl=function(e){return gl[e.toLowerCase()]},dl=function(e){return(me(e)?e:null)||vl(e)||fl(e)||cl(e)||hl(e)},gl={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},us=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(C(s))throw Error("Tried to set map with object key");i<a.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},ls=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(C(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r};function pl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var kr=pl,Sa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function yl(t,e){return e={exports:{}},t(e,e.exports),e.exports}var ml=typeof Sa=="object"&&Sa&&Sa.Object===Object&&Sa,bl=ml,El=typeof self=="object"&&self&&self.Object===Object&&self,wl=bl||El||Function("return this")(),cn=wl,xl=function(){return cn.Date.now()},ii=xl,Tl=/\s/;function Cl(t){for(var e=t.length;e--&&Tl.test(t.charAt(e)););return e}var Dl=Cl,Sl=/^\s+/;function Ll(t){return t&&t.slice(0,Dl(t)+1).replace(Sl,"")}var Al=Ll,Ol=cn.Symbol,Qr=Ol,fs=Object.prototype,Nl=fs.hasOwnProperty,Ml=fs.toString,La=Qr?Qr.toStringTag:void 0;function Il(t){var e=Nl.call(t,La),r=t[La];try{t[La]=void 0;var a=!0}catch(i){}var n=Ml.call(t);return a&&(e?t[La]=r:delete t[La]),n}var Rl=Il,kl=Object.prototype,Pl=kl.toString;function Bl(t){return Pl.call(t)}var Fl=Bl,zl="[object Null]",Gl="[object Undefined]",hs=Qr?Qr.toStringTag:void 0;function Vl(t){return t==null?t===void 0?Gl:zl:hs&&hs in Object(t)?Rl(t):Fl(t)}var cs=Vl;function $l(t){return t!=null&&typeof t=="object"}var _l=$l,Ul="[object Symbol]";function Yl(t){return typeof t=="symbol"||_l(t)&&cs(t)==Ul}var Aa=Yl,vs=0/0,Hl=/^[-+]0x[0-9a-f]+$/i,Xl=/^0b[01]+$/i,ql=/^0o[0-7]+$/i,Wl=parseInt;function Kl(t){if(typeof t=="number")return t;if(Aa(t))return vs;if(kr(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=kr(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=Al(t);var r=Xl.test(t);return r||ql.test(t)?Wl(t.slice(2),r?2:8):Hl.test(t)?vs:+t}var ds=Kl,Zl="Expected a function",Ql=Math.max,Jl=Math.min;function jl(t,e,r){var a,n,i,s,o,l,u=0,f=!1,h=!1,c=!0;if(typeof t!="function")throw new TypeError(Zl);e=ds(e)||0,kr(r)&&(f=!!r.leading,h="maxWait"in r,i=h?Ql(ds(r.maxWait)||0,e):i,c="trailing"in r?!!r.trailing:c);function v(O){var T=a,k=n;return a=n=void 0,u=O,s=t.apply(k,T),s}function d(O){return u=O,o=setTimeout(p,e),f?v(O):s}function g(O){var T=O-l,k=O-u,S=e-T;return h?Jl(S,i-k):S}function y(O){var T=O-l,k=O-u;return l===void 0||T>=e||T<0||h&&k>=i}function p(){var O=ii();if(y(O))return m(O);o=setTimeout(p,g(O))}function m(O){return o=void 0,c&&a?v(O):(a=n=void 0,s)}function b(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function x(){return o===void 0?s:m(ii())}function I(){var O=ii(),T=y(O);if(a=arguments,n=this,l=O,T){if(o===void 0)return d(l);if(h)return clearTimeout(o),o=setTimeout(p,e),v(l)}return o===void 0&&(o=setTimeout(p,e)),s}return I.cancel=b,I.flush=x,I}var vn=jl,si=D?D.performance:null,gs=si&&si.now?function(){return si.now()}:function(){return Date.now()},ef=function(){if(D){if(D.requestAnimationFrame)return function(t){D.requestAnimationFrame(t)};if(D.mozRequestAnimationFrame)return function(t){D.mozRequestAnimationFrame(t)};if(D.webkitRequestAnimationFrame)return function(t){D.webkitRequestAnimationFrame(t)};if(D.msRequestAnimationFrame)return function(t){D.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(gs())},1e3/60)}}(),dn=function(e){return ef(e)},cr=gs,Jr=9261,ps=65599,Oa=5381,ys=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr,a=r,n;n=e.next(),!n.done;)a=a*ps+n.value|0;return a},Na=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr;return r*ps+e|0},Ma=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oa;return(r<<5)+r+e|0},tf=function(e,r){return e*2097152+r},Er=function(e){return e[0]*2097152+e[1]},gn=function(e,r){return[Na(e[0],r[0]),Ma(e[1],r[1])]},rf=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return ys(s,r)},Pr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return ys(s,r)},ms=function(){return af(arguments)},af=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=Pr(n):r=Pr(n,r)}return r},bs=!0,nf=console.warn!=null,sf=console.trace!=null,oi=Number.MAX_SAFE_INTEGER||9007199254740991,Es=function(){return!0},pn=function(){return!1},ws=function(){return 0},ui=function(){},bt=function(e){throw new Error(e)},xs=function(e){if(e!==void 0)bs=!!e;else return bs},lt=function(e){xs()&&(nf?console.warn(e):(console.log(e),sf&&console.trace()))},of=function(e){return $e({},e)},sr=function(e){return e==null?e:me(e)?e.slice():C(e)?of(e):e},uf=function(e){return e.slice()},Ts=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},lf={},Cs=function(){return lf},St=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var s=r[i],o=a==null?void 0:a[s];n[s]=o===void 0?e[s]:o}return n}},wr=function(e,r,a){for(var n=e.length-1;n>=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},li=function(e){e.splice(0,e.length)},ff=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},jt=function(e,r,a){return a&&(r=mt(a,r)),e[r]},xr=function(e,r,a,n){a&&(r=mt(a,r)),e[r]=n},hf=function(){function t(){W(this,t),this._obj={}}return L(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}]),t}(),or=typeof Map!="undefined"?Map:hf,cf="undefined",vf=function(){function t(e){if(W(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return L(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}]),t}(),jr=(typeof Set=="undefined"?"undefined":q(Set))!==cf?Set:vf,yn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Ge(e)){bt("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){bt("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:r.data||{},position:r.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:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new jr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];me(r.classes)?u=r.classes:ee(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,h=u.length;f<h;f++){var c=u[f];!c||c===""||i.classes.add(c)}this.createEmitter();var v=r.style||r.css;v&&(lt("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(v)),(a===void 0||a)&&this.restore()},Ds=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;C(a)&&!se(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!ne(n)?n:i,n=ne(n)?n:function(){};for(var o=this._private.cy,l=a=ee(a)?this.filter(a):a,u=[],f=[],h={},c={},v={},d=0,g,y=this.byGroup(),p=y.nodes,m=y.edges,b=0;b<l.length;b++){var x=l[b],I=x.id();x.isNode()&&(u.unshift(x),e.bfs&&(v[I]=!0,f.push(x)),c[I]=0)}for(var O=function(){var H=e.bfs?u.shift():u.pop(),G=H.id();if(e.dfs){if(v[G])return"continue";v[G]=!0,f.push(H)}var re=c[G],X=h[G],K=X!=null?X.source():null,ie=X!=null?X.target():null,fe=X==null?void 0:H.same(K)?ie[0]:K[0],ve=void 0;if(ve=n(H,X,fe,d++,re),ve===!0)return g=H,"break";if(ve===!1)return"break";for(var oe=H.connectedEdges().filter(function(de){return(!i||de.source().same(H))&&m.has(de)}),ce=0;ce<oe.length;ce++){var Ee=oe[ce],xe=Ee.connectedNodes().filter(function(de){return!de.same(H)&&p.has(de)}),ye=xe.id();xe.length!==0&&!v[ye]&&(xe=xe[0],u.push(xe),e.bfs&&(v[ye]=!0,f.push(xe)),h[ye]=Ee,c[ye]=c[G]+1)}};u.length!==0;){var T=O();if(T!=="continue"&&T==="break")break}for(var k=o.collection(),S=0;S<f.length;S++){var F=f[S],z=h[F.id()];z!=null&&k.push(z),k.push(F)}return{path:o.collection(k),found:o.collection(g)}}},Ia={breadthFirstSearch:Ds({bfs:!0}),depthFirstSearch:Ds({dfs:!0})};Ia.bfs=Ia.breadthFirstSearch,Ia.dfs=Ia.depthFirstSearch;var df=yl(function(t,e){(function(){var r,a,n,i,s,o,l,u,f,h,c,v,d,g,y;n=Math.floor,h=Math.min,a=function(p,m){return p<m?-1:p>m?1:0},f=function(p,m,b,x,I){var O;if(b==null&&(b=0),I==null&&(I=a),b<0)throw new Error("lo must be non-negative");for(x==null&&(x=p.length);b<x;)O=n((b+x)/2),I(m,p[O])<0?x=O:b=O+1;return[].splice.apply(p,[b,b-b].concat(m)),m},o=function(p,m,b){return b==null&&(b=a),p.push(m),g(p,0,p.length-1,b)},s=function(p,m){var b,x;return m==null&&(m=a),b=p.pop(),p.length?(x=p[0],p[0]=b,y(p,0,m)):x=b,x},u=function(p,m,b){var x;return b==null&&(b=a),x=p[0],p[0]=m,y(p,0,b),x},l=function(p,m,b){var x;return b==null&&(b=a),p.length&&b(p[0],m)<0&&(x=[p[0],m],m=x[0],p[0]=x[1],y(p,0,b)),m},i=function(p,m){var b,x,I,O,T,k;for(m==null&&(m=a),O=function(){k=[];for(var S=0,F=n(p.length/2);0<=F?S<F:S>F;0<=F?S++:S--)k.push(S);return k}.apply(this).reverse(),T=[],x=0,I=O.length;x<I;x++)b=O[x],T.push(y(p,b,m));return T},d=function(p,m,b){var x;if(b==null&&(b=a),x=p.indexOf(m),x!==-1)return g(p,0,x,b),y(p,x,b)},c=function(p,m,b){var x,I,O,T,k;if(b==null&&(b=a),I=p.slice(0,m),!I.length)return I;for(i(I,b),k=p.slice(m),O=0,T=k.length;O<T;O++)x=k[O],l(I,x,b);return I.sort(b).reverse()},v=function(p,m,b){var x,I,O,T,k,S,F,z,P;if(b==null&&(b=a),m*10<=p.length){if(O=p.slice(0,m).sort(b),!O.length)return O;for(I=O[O.length-1],F=p.slice(m),T=0,S=F.length;T<S;T++)x=F[T],b(x,I)<0&&(f(O,x,0,null,b),O.pop(),I=O[O.length-1]);return O}for(i(p,b),P=[],k=0,z=h(m,p.length);0<=z?k<z:k>z;0<=z?++k:--k)P.push(s(p,b));return P},g=function(p,m,b,x){var I,O,T;for(x==null&&(x=a),I=p[b];b>m;){if(T=b-1>>1,O=p[T],x(I,O)<0){p[b]=O,b=T;continue}break}return p[b]=I},y=function(p,m,b){var x,I,O,T,k;for(b==null&&(b=a),I=p.length,k=m,O=p[m],x=2*m+1;x<I;)T=x+1,T<I&&!(b(p[x],p[T])<0)&&(x=T),p[m]=p[x],m=x,x=2*m+1;return p[m]=O,g(p,k,m,b)},r=function(){p.push=o,p.pop=s,p.replace=u,p.pushpop=l,p.heapify=i,p.updateItem=d,p.nlargest=c,p.nsmallest=v;function p(m){this.cmp=m!=null?m:a,this.nodes=[]}return p.prototype.push=function(m){return o(this.nodes,m,this.cmp)},p.prototype.pop=function(){return s(this.nodes,this.cmp)},p.prototype.peek=function(){return this.nodes[0]},p.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},p.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},p.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(m){return d(this.nodes,m,this.cmp)},p.prototype.clear=function(){return this.nodes=[]},p.prototype.empty=function(){return this.nodes.length===0},p.prototype.size=function(){return this.nodes.length},p.prototype.clone=function(){var m;return m=new p,m.nodes=this.nodes.slice(0),m},p.prototype.toArray=function(){return this.nodes.slice(0)},p.prototype.insert=p.prototype.push,p.prototype.top=p.prototype.peek,p.prototype.front=p.prototype.peek,p.prototype.has=p.prototype.contains,p.prototype.copy=p.prototype.clone,p}(),function(p,m){return t.exports=m()}(this,function(){return r})}).call(Sa)}),Ra=df,gf=St({root:null,weight:function(e){return 1},directed:!1}),pf={dijkstra:function(e){if(!C(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=gf(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ee(n)?this.filter(n)[0]:n[0],f={},h={},c={},v=this.byGroup(),d=v.nodes,g=v.edges;g.unmergeBy(function(re){return re.isLoop()});for(var y=function(X){return f[X.id()]},p=function(X,K){f[X.id()]=K,m.updateItem(X)},m=new Ra(function(re,X){return y(re)-y(X)}),b=0;b<d.length;b++){var x=d[b];f[x.id()]=x.same(u)?0:1/0,m.push(x)}for(var I=function(X,K){for(var ie=(s?X.edgesTo(K):X.edgesWith(K)).intersect(g),fe=1/0,ve,oe=0;oe<ie.length;oe++){var ce=ie[oe],Ee=l(ce);(Ee<fe||!ve)&&(fe=Ee,ve=ce)}return{edge:ve,dist:fe}};m.size()>0;){var O=m.pop(),T=y(O),k=O.id();if(c[k]=T,T!==1/0)for(var S=O.neighborhood().intersect(d),F=0;F<S.length;F++){var z=S[F],P=z.id(),H=I(O,z),G=T+H.dist;G<y(z)&&(p(z,G),h[P]={node:O,edge:H.edge})}}return{distanceTo:function(X){var K=ee(X)?d.filter(X)[0]:X[0];return c[K.id()]},pathTo:function(X){var K=ee(X)?d.filter(X)[0]:X[0],ie=[],fe=K,ve=fe.id();if(K.length>0)for(ie.unshift(K);h[ve];){var oe=h[ve];ie.unshift(oe.edge),ie.unshift(oe.node),fe=oe.node,ve=fe.id()}return o.spawn(ie)}}}},yf={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(x){for(var I=0;I<s.length;I++){var O=s[I];if(O.has(x))return I}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var f=n.sort(function(b,x){return e(b)-e(x)}),h=0;h<f.length;h++){var c=f[h],v=c.source()[0],d=c.target()[0],g=l(v),y=l(d),p=s[g],m=s[y];g!==y&&(o.merge(c),p.merge(m),s.splice(y,1))}return o}},mf=St({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),bf={aStar:function(e){var r=this.cy(),a=mf(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var u=n.id(),f=i.id(),h={},c={},v={},d=new Ra(function(ve,oe){return c[ve.id()]-c[oe.id()]}),g=new jr,y={},p={},m=function(oe,ce){d.push(oe),g.add(ce)},b,x,I=function(){b=d.pop(),x=b.id(),g.delete(x)},O=function(oe){return g.has(oe)};m(n,u),h[u]=0,c[u]=s(n);for(var T=0;d.size()>0;){if(I(),T++,x===f){for(var k=[],S=i,F=f,z=p[F];k.unshift(S),z!=null&&k.unshift(z),S=y[F],S!=null;)F=S.id(),z=p[F];return{found:!0,distance:h[x],path:this.spawn(k),steps:T}}v[x]=!0;for(var P=b._private.edges,H=0;H<P.length;H++){var G=P[H];if(this.hasElementWithId(G.id())&&!(o&&G.data("source")!==x)){var re=G.source(),X=G.target(),K=re.id()!==x?re:X,ie=K.id();if(this.hasElementWithId(ie)&&!v[ie]){var fe=h[x]+l(G);if(!O(ie)){h[ie]=fe,c[ie]=fe+s(K),m(K,ie),y[ie]=b,p[ie]=G;continue}fe<h[ie]&&(h[ie]=fe,c[ie]=fe+s(K),y[ie]=b,p[ie]=G)}}}}return{found:!1,distance:void 0,path:void 0,steps:T}}},Ef=St({weight:function(e){return 1},directed:!1}),wf={floydWarshall:function(e){for(var r=this.cy(),a=Ef(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,f=l.length,h=f*f,c=function(Ee){return l.indexOf(Ee)},v=function(Ee){return l[Ee]},d=new Array(h),g=0;g<h;g++){var y=g%f,p=(g-y)/f;p===y?d[g]=0:d[g]=1/0}for(var m=new Array(h),b=new Array(h),x=0;x<u.length;x++){var I=u[x],O=I.source()[0],T=I.target()[0];if(O!==T){var k=c(O),S=c(T),F=k*f+S,z=s(I);if(d[F]>z&&(d[F]=z,m[F]=S,b[F]=I),!i){var P=S*f+k;!i&&d[P]>z&&(d[P]=z,m[P]=k,b[P]=I)}}}for(var H=0;H<f;H++)for(var G=0;G<f;G++)for(var re=G*f+H,X=0;X<f;X++){var K=G*f+X,ie=H*f+X;d[re]+d[ie]<d[K]&&(d[K]=d[re]+d[ie],m[K]=m[re])}var fe=function(Ee){return(ee(Ee)?r.filter(Ee):Ee)[0]},ve=function(Ee){return c(fe(Ee))},oe={distance:function(Ee,xe){var ye=ve(Ee),de=ve(xe);return d[ye*f+de]},path:function(Ee,xe){var ye=ve(Ee),de=ve(xe),ae=v(ye);if(ye===de)return ae.collection();if(m[ye*f+de]==null)return r.collection();var we=r.collection(),Te=ye,Ae;for(we.merge(ae);ye!==de;)Te=ye,ye=m[ye*f+de],Ae=b[Te*f+ye],we.merge(Ae),we.merge(v(ye));return we}};return oe}},xf=St({weight:function(e){return 1},directed:!1,root:null}),Tf={bellmanFord:function(e){var r=this,a=xf(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),f=this.byGroup(),h=f.edges,c=f.nodes,v=c.length,d=new or,g=!1,y=[];s=u.collection(s)[0],h.unmergeBy(function(ke){return ke.isLoop()});for(var p=h.length,m=function(Ie){var Be=d.get(Ie.id());return Be||(Be={},d.set(Ie.id(),Be)),Be},b=function(Ie){return(ee(Ie)?u.$(Ie):Ie)[0]},x=function(Ie){return m(b(Ie)).dist},I=function(Ie){for(var Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,je=b(Ie),Xe=[],_e=je;;){if(_e==null)return r.spawn();var De=m(_e),M=De.edge,he=De.pred;if(Xe.unshift(_e[0]),_e.same(Be)&&Xe.length>0)break;M!=null&&Xe.unshift(M),_e=he}return l.spawn(Xe)},O=0;O<v;O++){var T=c[O],k=m(T);T.same(s)?k.dist=0:k.dist=1/0,k.pred=null,k.edge=null}for(var S=!1,F=function(Ie,Be,je,Xe,_e,De){var M=Xe.dist+De;M<_e.dist&&!je.same(Xe.edge)&&(_e.dist=M,_e.pred=Ie,_e.edge=je,S=!0)},z=1;z<v;z++){S=!1;for(var P=0;P<p;P++){var H=h[P],G=H.source(),re=H.target(),X=o(H),K=m(G),ie=m(re);F(G,re,H,K,ie,X),i||F(re,G,H,ie,K,X)}if(!S)break}if(S)for(var fe=[],ve=0;ve<p;ve++){var oe=h[ve],ce=oe.source(),Ee=oe.target(),xe=o(oe),ye=m(ce).dist,de=m(Ee).dist;if(ye+xe<de||!i&&de+xe<ye)if(g||(lt("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var ae=[];ye+xe<de&&ae.push(ce),!i&&de+xe<ye&&ae.push(Ee);for(var we=ae.length,Te=0;Te<we;Te++){var Ae=ae[Te],Ne=[Ae];Ne.push(m(Ae).edge);for(var Ue=m(Ae).pred;Ne.indexOf(Ue)===-1;)Ne.push(Ue),Ne.push(m(Ue).edge),Ue=m(Ue).pred;Ne=Ne.slice(Ne.indexOf(Ue));for(var He=Ne[0].id(),Me=0,Oe=2;Oe<Ne.length;Oe+=2)Ne[Oe].id()<He&&(He=Ne[Oe].id(),Me=Oe);Ne=Ne.slice(Me).concat(Ne.slice(0,Me)),Ne.push(Ne[0]);var Ve=Ne.map(function(ke){return ke.id()}).join(",");fe.indexOf(Ve)===-1&&(y.push(l.spawn(Ne)),fe.push(Ve))}}else break}return{distanceTo:x,pathTo:I,hasNegativeWeightCycle:g,negativeWeightCycles:y}}},Cf=Math.sqrt(2),Df=function(e,r,a){a.length===0&&bt("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=r[i],l=r[s],u=a,f=u.length-1;f>=0;f--){var h=u[f],c=h[1],v=h[2];(r[c]===o&&r[v]===l||r[c]===l&&r[v]===o)&&u.splice(f,1)}for(var d=0;d<u.length;d++){var g=u[d];g[1]===l?(u[d]=g.slice(),u[d][1]=o):g[2]===l&&(u[d]=g.slice(),u[d][2]=o)}for(var y=0;y<r.length;y++)r[y]===l&&(r[y]=o);return u},fi=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=Df(i,e,r),a--}return r},Sf={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(ie){return ie.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Cf);if(i<2){bt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f<s;f++){var h=n[f];u.push([f,a.indexOf(h.source()),a.indexOf(h.target())])}for(var c=1/0,v=[],d=new Array(i),g=new Array(i),y=new Array(i),p=function(fe,ve){for(var oe=0;oe<i;oe++)ve[oe]=fe[oe]},m=0;m<=o;m++){for(var b=0;b<i;b++)g[b]=b;var x=fi(g,u.slice(),i,l),I=x.slice();p(g,y);var O=fi(g,x,l,2),T=fi(y,I,l,2);O.length<=T.length&&O.length<c?(c=O.length,v=O,p(g,d)):T.length<=O.length&&T.length<c&&(c=T.length,v=T,p(y,d))}for(var k=this.spawn(v.map(function(ie){return n[ie[0]]})),S=this.spawn(),F=this.spawn(),z=d[0],P=0;P<d.length;P++){var H=d[P],G=a[P];H===z?S.merge(G):F.merge(G)}var re=function(fe){var ve=e.spawn();return fe.forEach(function(oe){ve.merge(oe),oe.connectedEdges().forEach(function(ce){e.contains(ce)&&!k.contains(ce)&&ve.merge(ce)})}),ve},X=[re(S),re(F)],K={cut:k,components:X,partition1:S,partition2:F};return K}},Lf=function(e){return{x:e.x,y:e.y}},mn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},Ss=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},ea=function(e){return{x:e[0],y:e[1]}},Af=function(e){for(var r=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=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},Of=function(e){for(var r=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=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},Nf=function(e){for(var r=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,s=r;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},Mf=function(e){var r=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,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,v){return c-v});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},If=function(e){return Math.PI*e/180},bn=function(e,r){return Math.atan2(r,e)-Math.PI/2},hi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Ls=function(e){return e>0?1:e<0?-1:0},Br=function(e,r){return Math.sqrt(Fr(e,r))},Fr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Rf=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},Dt=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},ta=function(e,r,a,n){return{x:Dt(e.x,r.x,a.x,n),y:Dt(e.y,r.y,a.y,n)}},kf=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},s=Br(e,r),o={x:i.x/s,y:i.y/s};return a=a==null?0:a,n=n!=null?n:a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},ka=function(e,r,a){return Math.max(e,Math.min(a,r))},$t=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}}},Pf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Bf=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Ff=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},zf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),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},En=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ci=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=w(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},As=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},vi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},ra=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Gf=function(e,r){return ra(e,r.x,r.y)},Os=function(e,r){return ra(e,r.x1,r.y1)&&ra(e,r.x2,r.y2)},Ns=function(e,r,a,n,i,s,o){var l=Fa(i,s),u=i/2,f=s/2,h;{var c=a-u+l-o,v=n-f-o,d=a+u-l+o,g=v;if(h=Tr(e,r,a,n,c,v,d,g,!1),h.length>0)return h}{var y=a+u+o,p=n-f+l-o,m=y,b=n+f-l+o;if(h=Tr(e,r,a,n,y,p,m,b,!1),h.length>0)return h}{var x=a-u+l-o,I=n+f+o,O=a+u-l+o,T=I;if(h=Tr(e,r,a,n,x,I,O,T,!1),h.length>0)return h}{var k=a-u-o,S=n-f+l-o,F=k,z=n+f-l+o;if(h=Tr(e,r,a,n,k,S,F,z,!1),h.length>0)return h}var P;{var H=a-u+l,G=n-f+l;if(P=Pa(e,r,a,n,H,G,l+o),P.length>0&&P[0]<=H&&P[1]<=G)return[P[0],P[1]]}{var re=a+u-l,X=n-f+l;if(P=Pa(e,r,a,n,re,X,l+o),P.length>0&&P[0]>=re&&P[1]<=X)return[P[0],P[1]]}{var K=a+u-l,ie=n+f-l;if(P=Pa(e,r,a,n,K,ie,l+o),P.length>0&&P[0]>=K&&P[1]>=ie)return[P[0],P[1]]}{var fe=a-u+l,ve=n+f-l;if(P=Pa(e,r,a,n,fe,ve,l+o),P.length>0&&P[0]<=fe&&P[1]>=ve)return[P[0],P[1]]}return[]},Vf=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=f+l&&h-l<=r&&r<=c+l},$f=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},_f=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},Uf=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,h,c,v,d;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,v=r/3,o>0){h=u+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-v+h+c,v+=(h+c)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-c+h)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),d=2*Math.sqrt(l),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},Yf=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,v=[];Uf(u,f,h,c,v);for(var d=1e-7,g=[],y=0;y<6;y+=2)Math.abs(v[y+1])<d&&v[y]>=0&&v[y]<=1&&g.push(v[y]);g.push(1),g.push(0);for(var p=-1,m,b,x,I=0;I<g.length;I++)m=Math.pow(1-g[I],2)*a+2*(1-g[I])*g[I]*i+g[I]*g[I]*o,b=Math.pow(1-g[I],2)*n+2*(1-g[I])*g[I]*s+g[I]*g[I]*l,x=Math.pow(m-e,2)+Math.pow(b-r,2),p>=0?x<p&&(p=x):p=x;return p},Hf=function(e,r,a,n,i,s){var o=[e-a,r-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],f=o[0]*o[0]+o[1]*o[1],h=o[0]*l[0]+o[1]*l[1],c=h*h/u;return h<0?f:c>u?(e-i)*(e-i)+(r-s)*(r-s):f-c},_t=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},vr=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var c=Math.cos(-h),v=Math.sin(-h),d=0;d<f.length/2;d++)f[d*2]=s/2*(a[d*2]*c-a[d*2+1]*v),f[d*2+1]=o/2*(a[d*2+1]*c+a[d*2]*v),f[d*2]+=n,f[d*2+1]+=i;var g;if(u>0){var y=Is(f,-u);g=Ms(y)}else g=f;return _t(e,r,g)},Xf=function(e,r,a,n,i,s,o){for(var l=new Array(a.length),u=s/2,f=o/2,h=pi(s,o),c=h*h,v=0;v<a.length/4;v++){var d=void 0,g=void 0;v===0?d=a.length-2:d=v*4-2,g=v*4+2;var y=n+u*a[v*4],p=i+f*a[v*4+1],m=-a[d]*a[g]-a[d+1]*a[g+1],b=h/Math.tan(Math.acos(m)/2),x=y-b*a[d],I=p-b*a[d+1],O=y+b*a[g],T=p+b*a[g+1];l[v*4]=x,l[v*4+1]=I,l[v*4+2]=O,l[v*4+3]=T;var k=a[d+1],S=-a[d],F=k*a[g]+S*a[g+1];F<0&&(k*=-1,S*=-1);var z=x+k*h,P=I+S*h,H=Math.pow(z-e,2)+Math.pow(P-r,2);if(H<=c)return!0}return _t(e,r,l)},Ms=function(e){for(var r=new Array(e.length/2),a,n,i,s,o,l,u,f,h=0;h<e.length/4;h++){a=e[h*4],n=e[h*4+1],i=e[h*4+2],s=e[h*4+3],h<e.length/4-1?(o=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],f=e[(h+1)*4+3]):(o=e[0],l=e[1],u=e[2],f=e[3]);var c=Tr(a,n,i,s,o,l,u,f,!0);r[h*2]=c[0],r[h*2+1]=c[1]}return r},Is=function(e,r){for(var a=new Array(e.length*2),n,i,s,o,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,f=-(s-n),h=Math.sqrt(u*u+f*f),c=u/h,v=f/h;a[l*4]=n+c*r,a[l*4+1]=i+v*r,a[l*4+2]=s+c*r,a[l*4+3]=o+v*r}return a},qf=function(e,r,a,n,i,s){var o=a-e,l=n-r;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),f=u-1;if(f<0)return[];var h=f/u;return[(a-e)*h+e,(n-r)*h+r]},zr=function(e,r,a,n,i,s,o){return e-=i,r-=s,e/=a/2+o,r/=n/2+o,e*e+r*r<=1},Pa=function(e,r,a,n,i,s,o){var l=[a-e,n-r],u=[e-i,r-s],f=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-o*o,v=h*h-4*f*c;if(v<0)return[];var d=(-h+Math.sqrt(v))/(2*f),g=(-h-Math.sqrt(v))/(2*f),y=Math.min(d,g),p=Math.max(d,g),m=[];if(y>=0&&y<=1&&m.push(y),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*l[0]+e,x=m[0]*l[1]+r;if(m.length>1){if(m[0]==m[1])return[b,x];var I=m[1]*l[0]+e,O=m[1]*l[1]+r;return[b,x,I,O]}else return[b,x]},di=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Tr=function(e,r,a,n,i,s,o,l,u){var f=e-i,h=a-e,c=o-i,v=r-s,d=n-r,g=l-s,y=c*v-g*f,p=h*v-d*f,m=g*h-c*d;if(m!==0){var b=y/m,x=p/m,I=.001,O=0-I,T=1+I;return O<=b&&b<=T&&O<=x&&x<=T?[e+b*h,r+b*d]:u?[e+b*h,r+b*d]:[]}else return y===0||p===0?di(e,a,o)===o?[o,l]:di(e,a,i)===i?[i,s]:di(i,o,a)===a?[a,n]:[]:[]},Ba=function(e,r,a,n,i,s,o,l){var u=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var v;if(c){for(var d=0;d<h.length/2;d++)h[d*2]=a[d*2]*s+n,h[d*2+1]=a[d*2+1]*o+i;if(l>0){var g=Is(h,-l);v=Ms(g)}else v=h}else v=a;for(var y,p,m,b,x=0;x<v.length/2;x++)y=v[x*2],p=v[x*2+1],x<v.length/2-1?(m=v[(x+1)*2],b=v[(x+1)*2+1]):(m=v[0],b=v[1]),f=Tr(e,r,n,i,y,p,m,b),f.length!==0&&u.push(f[0],f[1]);return u},Wf=function(e,r,a,n,i,s,o,l){for(var u=[],f,h=new Array(a.length),c=s/2,v=o/2,d=pi(s,o),g=0;g<a.length/4;g++){var y=void 0,p=void 0;g===0?y=a.length-2:y=g*4-2,p=g*4+2;var m=n+c*a[g*4],b=i+v*a[g*4+1],x=-a[y]*a[p]-a[y+1]*a[p+1],I=d/Math.tan(Math.acos(x)/2),O=m-I*a[y],T=b-I*a[y+1],k=m+I*a[p],S=b+I*a[p+1];g===0?(h[a.length-2]=O,h[a.length-1]=T):(h[g*4-2]=O,h[g*4-1]=T),h[g*4]=k,h[g*4+1]=S;var F=a[y+1],z=-a[y],P=F*a[p]+z*a[p+1];P<0&&(F*=-1,z*=-1);var H=O+F*d,G=T+z*d;f=Pa(e,r,n,i,H,G,d),f.length!==0&&u.push(f[0],f[1])}for(var re=0;re<h.length/4;re++)f=Tr(e,r,n,i,h[re*4],h[re*4+1],h[re*4+2],h[re*4+3],!1),f.length!==0&&u.push(f[0],f[1]);if(u.length>2){for(var X=[u[0],u[1]],K=Math.pow(X[0]-e,2)+Math.pow(X[1]-r,2),ie=1;ie<u.length/2;ie++){var fe=Math.pow(u[ie*2]-e,2)+Math.pow(u[ie*2+1]-r,2);fe<=K&&(X[0]=u[ie*2],X[1]=u[ie*2+1],K=fe)}return X}return u},wn=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[r[0]+s*n[0],r[1]+s*n[1]]},zt=function(e,r){var a=gi(e,r);return a=Rs(a),a},Rs=function(e){for(var r,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)r=e[2*u],a=e[2*u+1],i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);for(var f=2/(o-i),h=2/(l-s),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*h,i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var v=0;v<n;v++)a=e[2*v+1]=e[2*v+1]+(-1-s);return e},gi=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},Fa=function(e,r){return Math.min(e/4,r/4,8)},pi=function(e,r){return Math.min(e/10,r/10,8)},ks=function(){return 8},Kf=function(e,r,a){return[e-2*r+a,2*(r-e),e]},yi=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Zf=St({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Qf={pageRank:function(e){for(var r=Zf(e),a=r.dampingFactor,n=r.precision,i=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,f=l.edges,h=u.length,c=h*h,v=f.length,d=new Array(c),g=new Array(h),y=(1-a)/h,p=0;p<h;p++){for(var m=0;m<h;m++){var b=p*h+m;d[b]=0}g[p]=0}for(var x=0;x<v;x++){var I=f[x],O=I.data("source"),T=I.data("target");if(O!==T){var k=u.indexOfId(O),S=u.indexOfId(T),F=s(I),z=S*h+k;d[z]+=F,g[k]+=F}}for(var P=1/h+y,H=0;H<h;H++)if(g[H]===0)for(var G=0;G<h;G++){var re=G*h+H;d[re]=P}else for(var X=0;X<h;X++){var K=X*h+H;d[K]=d[K]/g[H]+y}for(var ie=new Array(h),fe=new Array(h),ve,oe=0;oe<h;oe++)ie[oe]=1;for(var ce=0;ce<i;ce++){for(var Ee=0;Ee<h;Ee++)fe[Ee]=0;for(var xe=0;xe<h;xe++)for(var ye=0;ye<h;ye++){var de=xe*h+ye;fe[xe]+=d[de]*ie[ye]}Rf(fe),ve=ie,ie=fe,fe=ve;for(var ae=0,we=0;we<h;we++){var Te=ve[we]-ie[we];ae+=Te*Te}if(ae<n)break}var Ae={rank:function(Ue){return Ue=o.collection(Ue)[0],ie[u.indexOf(Ue)]}};return Ae}},Ps=St({root:null,weight:function(e){return 1},directed:!1,alpha:0}),aa={degreeCentralityNormalized:function(e){e=Ps(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},h={},c=0,v=0,d=0;d<n;d++){var g=a[d],y=g.id();e.root=g;var p=this.degreeCentrality(e);c<p.indegree&&(c=p.indegree),v<p.outdegree&&(v=p.outdegree),f[y]=p.indegree,h[y]=p.outdegree}return{indegree:function(b){return c==0?0:(ee(b)&&(b=r.filter(b)),f[b.id()]/c)},outdegree:function(b){return v===0?0:(ee(b)&&(b=r.filter(b)),h[b.id()]/v)}}}else{for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(b){return s===0?0:(ee(b)&&(b=r.filter(b)),i[b.id()]/s)}}}},degreeCentrality:function(e){e=Ps(e);var r=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=r.collection(i)[0],o){for(var v=i.connectedEdges(),d=v.filter(function(O){return O.target().same(i)&&a.has(O)}),g=v.filter(function(O){return O.source().same(i)&&a.has(O)}),y=d.length,p=g.length,m=0,b=0,x=0;x<d.length;x++)m+=s(d[x]);for(var I=0;I<g.length;I++)b+=s(g[I]);return{indegree:Math.pow(y,1-l)*Math.pow(m,l),outdegree:Math.pow(p,1-l)*Math.pow(b,l)}}else{for(var u=i.connectedEdges().intersection(a),f=u.length,h=0,c=0;c<u.length;c++)h+=s(u[c]);return{degree:Math.pow(f,1-l)*Math.pow(h,l)}}}};aa.dc=aa.degreeCentrality,aa.dcn=aa.degreeCentralityNormalised=aa.degreeCentralityNormalized;var Bs=St({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),na={closenessCentralityNormalized:function(e){for(var r=Bs(e),a=r.harmonic,n=r.weight,i=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),h=0;h<u.length;h++){for(var c=0,v=u[h],d=0;d<u.length;d++)if(h!==d){var g=f.distance(v,u[d]);a?c+=1/g:c+=g}a||(c=1/c),l<c&&(l=c),o[v.id()]=c}return{closeness:function(p){return l==0?0:(ee(p)?p=s.filter(p)[0].id():p=p.id(),o[p]/l)}}},closenessCentrality:function(e){var r=Bs(e),a=r.root,n=r.weight,i=r.directed,s=r.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),f=0;f<u.length;f++){var h=u[f];if(!h.same(a)){var c=o.distanceTo(h);s?l+=1/c:l+=c}}return s?l:1/l}};na.cc=na.closenessCentrality,na.ccn=na.closenessCentralityNormalised=na.closenessCentralityNormalized;var Jf=St({weight:null,directed:!1}),mi={betweennessCentrality:function(e){for(var r=Jf(e),a=r.directed,n=r.weight,i=n!=null,s=this.cy(),o=this.nodes(),l={},u={},f=0,h={set:function(b,x){u[b]=x,x>f&&(f=x)},get:function(b){return u[b]}},c=0;c<o.length;c++){var v=o[c],d=v.id();a?l[d]=v.outgoers().nodes():l[d]=v.openNeighborhood().nodes(),h.set(d,0)}for(var g=function(b){for(var x=o[b].id(),I=[],O={},T={},k={},S=new Ra(function(ye,de){return k[ye]-k[de]}),F=0;F<o.length;F++){var z=o[F].id();O[z]=[],T[z]=0,k[z]=1/0}for(T[x]=1,k[x]=0,S.push(x);!S.empty();){var P=S.pop();if(I.push(P),i)for(var H=0;H<l[P].length;H++){var G=l[P][H],re=s.getElementById(P),X=void 0;re.edgesTo(G).length>0?X=re.edgesTo(G)[0]:X=G.edgesTo(re)[0];var K=n(X);G=G.id(),k[G]>k[P]+K&&(k[G]=k[P]+K,S.nodes.indexOf(G)<0?S.push(G):S.updateItem(G),T[G]=0,O[G]=[]),k[G]==k[P]+K&&(T[G]=T[G]+T[P],O[G].push(P))}else for(var ie=0;ie<l[P].length;ie++){var fe=l[P][ie].id();k[fe]==1/0&&(S.push(fe),k[fe]=k[P]+1),k[fe]==k[P]+1&&(T[fe]=T[fe]+T[P],O[fe].push(P))}}for(var ve={},oe=0;oe<o.length;oe++)ve[o[oe].id()]=0;for(;I.length>0;){for(var ce=I.pop(),Ee=0;Ee<O[ce].length;Ee++){var xe=O[ce][Ee];ve[xe]=ve[xe]+T[xe]/T[ce]*(1+ve[ce])}ce!=o[b].id()&&h.set(ce,h.get(ce)+ve[ce])}},y=0;y<o.length;y++)g(y);var p={betweenness:function(b){var x=s.collection(b).id();return h.get(x)},betweennessNormalized:function(b){if(f==0)return 0;var x=s.collection(b).id();return h.get(x)/f}};return p.betweennessNormalised=p.betweennessNormalized,p}};mi.bc=mi.betweennessCentrality;var jf=St({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),eh=function(e){return jf(e)},th=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},rh=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},Fs=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var s=0;s<r;s++)e[s*r+n]=e[s*r+n]/a}},ah=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*r[o*a+l]}return n},nh=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=ah(e,n,r);return e},ih=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return Fs(n,r),n},sh=function(e,r,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},oh=function(e,r,a,n){for(var i=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},uh=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},lh=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&uh(e[r],e[a])&&e.splice(a,1);return e},zs=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=eh(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,f=new Array(u),h,c=0;c<u;c++)f[c]=0;for(var v=0;v<a.length;v++){var d=a[v],g=s[d.source().id()],y=s[d.target().id()],p=th(d,i.attributes);f[g*l+y]+=p,f[y*l+g]+=p}rh(f,l,i.multFactor),Fs(f,l);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,h=nh(f,l,i.expandFactor),f=ih(h,l,i.inflateFactor),sh(f,h,u,4)||(m=!0),b++;var x=oh(f,l,r,n);return x=lh(x),x},fh={markovClustering:zs,mcl:zs},hh=function(e){return e},Gs=function(e,r){return Math.abs(r-e)},Vs=function(e,r,a){return e+Gs(r,a)},$s=function(e,r,a){return e+Math.pow(a-r,2)},ch=function(e){return Math.sqrt(e)},vh=function(e,r,a){return Math.max(e,Gs(r,a))},za=function(e,r,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:hh,o=n,l,u,f=0;f<e;f++)l=r(f),u=a(f),o=i(o,l,u);return s(o)},ia={euclidean:function(e,r,a){return e>=2?za(e,r,a,0,$s,ch):za(e,r,a,0,Vs)},squaredEuclidean:function(e,r,a){return za(e,r,a,0,$s)},manhattan:function(e,r,a){return za(e,r,a,0,Vs)},max:function(e,r,a){return za(e,r,a,-1/0,vh)}};ia["squared-euclidean"]=ia.squaredEuclidean,ia.squaredeuclidean=ia.squaredEuclidean;function xn(t,e,r,a,n,i){var s;return ne(t)?s=t:s=ia[t]||ia.euclidean,e===0&&ne(t)?s(n,i):s(e,r,a,n,i)}var dh=St({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),bi=function(e){return dh(e)},Tn=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},l=function(c){return n[c](r)},u=a,f=r;return xn(e,n.length,o,l,u,f)},Ei=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var f=0;f<r;f++){l=[];for(var h=0;h<n;h++)l[h]=Math.random()*(s[h]-i[h])+i[h];o[f]=l}return o},_s=function(e,r,a,n,i){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=Tn(a,e,r[l],n,i);u<s&&(s=u,o=l)}return o},Us=function(e,r,a){for(var n=[],i=null,s=0;s<r.length;s++)i=r[s],a[i.id()]===e&&n.push(i);return n},gh=function(e,r,a){return Math.abs(r-e)<=a},ph=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-r[n][i]);if(s>a)return!1}return!0},yh=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Ys=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];yh(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<r;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},Hs=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=Tn("manhattan",r[i],e,a,"kMedoids");return n},mh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=bi(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=Ei(a,i.k,i.attributes)):q(i.testCentroids)==="object"?l=i.testCentroids:l=Ei(a,i.k,i.attributes):l=Ei(a,i.k,i.attributes);for(var u=!0,f=0;u&&f<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],o[n.id()]=_s(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var v=Us(c,a,o);if(v.length!==0){for(var d=i.attributes.length,g=l[c],y=new Array(d),p=new Array(d),m=0;m<d;m++){p[m]=0;for(var b=0;b<v.length;b++)n=v[b],p[m]+=i.attributes[m](n);y[m]=p[m]/v.length,gh(y[m],g[m],i.sensitivityThreshold)||(u=!0)}l[c]=y,s[c]=r.collection(v)}}f++}return s},bh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=bi(e),s=new Array(i.k),o,l={},u,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(q(i.testCentroids)==="object"?o=i.testCentroids:o=Ys(a,i.k)):o=Ys(a,i.k);for(var h=!0,c=0;h&&c<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],l[n.id()]=_s(n,o,i.distance,i.attributes,"kMedoids");h=!1;for(var d=0;d<o.length;d++){var g=Us(d,a,l);if(g.length!==0){f[d]=Hs(o[d],g,i.attributes);for(var y=0;y<g.length;y++)u=Hs(g[y],g,i.attributes),u<f[d]&&(f[d]=u,o[d]=g[y],h=!0);s[d]=r.collection(g)}}c++}return s},Eh=function(e,r,a,n,i){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var f=0;f<e.length;f++)for(var h=0;h<i.attributes.length;h++){s=0,o=0;for(var c=0;c<r.length;c++)s+=n[c][f]*i.attributes[h](r[c]),o+=n[c][f];e[f][h]=s/o}},wh=function(e,r,a,n,i){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,f=2/(i.m-1),h=0;h<a.length;h++)for(var c=0;c<n.length;c++){o=0;for(var v=0;v<a.length;v++)l=Tn(i.distance,n[c],a[h],i.attributes,"cmeans"),u=Tn(i.distance,n[c],a[v],i.attributes,"cmeans"),o+=Math.pow(l/u,f);e[c][h]=1/o}},xh=function(e,r,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var f=0;f<r[0].length;f++)r[u][f]>o&&(o=r[u][f],l=f);i[l].push(e[u])}for(var h=0;h<i.length;h++)i[h]=n.collection(i[h]);return i},Xs=function(e){var r=this.cy(),a=this.nodes(),n=bi(e),i,s,o,l,u;l=new Array(a.length);for(var f=0;f<a.length;f++)l[f]=new Array(n.k);o=new Array(a.length);for(var h=0;h<a.length;h++)o[h]=new Array(n.k);for(var c=0;c<a.length;c++){for(var v=0,d=0;d<n.k;d++)o[c][d]=Math.random(),v+=o[c][d];for(var g=0;g<n.k;g++)o[c][g]=o[c][g]/v}s=new Array(n.k);for(var y=0;y<n.k;y++)s[y]=new Array(n.attributes.length);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,Eh(s,a,o,u,n),wh(o,l,s,a,n),ph(o,l,n.sensitivityThreshold)||(m=!0),b++;return i=xh(a,o,n,r),{clusters:i,degreeOfMembership:o}},Th={kMeans:mh,kMedoids:bh,fuzzyCMeans:Xs,fcm:Xs},Ch=St({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Dh={single:"min",complete:"max"},Sh=function(e){var r=Ch(e),a=Dh[r.linkage];return a!=null&&(r.linkage=a),r},qs=function(e,r,a,n,i){for(var s=0,o=1/0,l,u=i.attributes,f=function(S,F){return xn(i.distance,u.length,function(z){return u[z](S)},function(z){return u[z](F)},S,F)},h=0;h<e.length;h++){var c=e[h].key,v=a[c][n[c]];v<o&&(s=c,o=v)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[s],g=r[n[s]],y;i.mode==="dendrogram"?y={left:d,right:g,key:d.key}:y={value:d.value.concat(g.value),key:d.key},e[d.index]=y,e.splice(g.index,1),r[d.key]=y;for(var p=0;p<e.length;p++){var m=e[p];d.key===m.key?l=1/0:i.linkage==="min"?(l=a[d.key][m.key],a[d.key][m.key]>a[g.key][m.key]&&(l=a[g.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]<a[g.key][m.key]&&(l=a[g.key][m.key])):i.linkage==="mean"?l=(a[d.key][m.key]*d.size+a[g.key][m.key]*g.size)/(d.size+g.size):i.mode==="dendrogram"?l=f(m.value,d.value):l=f(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 x=e[b].key;if(n[x]===d.key||n[x]===g.key){for(var I=x,O=0;O<e.length;O++){var T=e[O].key;a[x][T]<a[x][I]&&(I=T)}n[x]=I}e[b].index=b}return d.key=g.key=d.index=g.index=null,!0},Cn=function t(e,r,a){e&&(e.value?r.push(e.value):(e.left&&t(e.left,r),e.right&&t(e.right,r)))},Lh=function t(e,r){if(!e)return"";if(e.left&&e.right){var a=t(e.left,r),n=t(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},Ah=function t(e,r,a){if(!e)return[];var n=[],i=[],s=[];return r===0?(e.left&&Cn(e.left,n),e.right&&Cn(e.right,i),s=n.concat(i),[a.collection(s)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Cn(e.left,n),e.right&&Cn(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=t(e.left,r-1,a)),e.right&&(i=t(e.right,r-1,a)),n.concat(i))},Ws=function(e){for(var r=this.cy(),a=this.nodes(),n=Sh(e),i=n.attributes,s=function(b,x){return xn(n.distance,i.length,function(I){return i[I](b)},function(I){return i[I](x)},b,x)},o=[],l=[],u=[],f=[],h=0;h<a.length;h++){var c={value:n.mode==="dendrogram"?a[h]:[a[h]],key:h,index:h};o[h]=c,f[h]=c,l[h]=[],u[h]=0}for(var v=0;v<o.length;v++)for(var d=0;d<=v;d++){var g=void 0;n.mode==="dendrogram"?g=v===d?1/0:s(o[v].value,o[d].value):g=v===d?1/0:s(o[v].value[0],o[d].value[0]),l[v][d]=g,l[d][v]=g,g<l[v][u[v]]&&(u[v]=d)}for(var y=qs(o,f,l,u,n);y;)y=qs(o,f,l,u,n);var p;return n.mode==="dendrogram"?(p=Ah(o[0],n.dendrogramDepth,r),n.addDendrogram&&Lh(o[0],r)):(p=new Array(o.length),o.forEach(function(m,b){m.key=m.index=null,p[b]=r.collection(m.value)})),p},Oh={hierarchicalClustering:Ws,hca:Ws},Nh=St({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Mh=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||bt("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||N(a)||bt("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Nh(e)},Ih=function(e,r,a,n){var i=function(o,l){return n[l](o)};return-xn(e,n.length,function(s){return i(r,s)},function(s){return i(a,s)},r,a)},Rh=function(e,r){var a=null;return r==="median"?a=Mf(e):r==="mean"?a=Nf(e):r==="min"?a=Af(e):r==="max"?a=Of(e):a=r,a},kh=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},Ks=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];r[i*e+u]>o&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},Ph=function(e,r,a){for(var n=Ks(e,r,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,f=0;f<s.length;f++){for(var h=0,c=0;c<s.length;c++)h+=r[s[c]*e+s[f]];h>u&&(l=f,u=h)}a[i]=s[l]}return n=Ks(e,r,a),n},Zs=function(e){for(var r=this.cy(),a=this.nodes(),n=Mh(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,f,h,c;o=a.length,l=o*o,u=new Array(l);for(var v=0;v<l;v++)u[v]=-1/0;for(var d=0;d<o;d++)for(var g=0;g<o;g++)d!==g&&(u[d*o+g]=Ih(n.distance,a[d],a[g],n.attributes));f=Rh(u,n.preference);for(var y=0;y<o;y++)u[y*o+y]=f;h=new Array(l);for(var p=0;p<l;p++)h[p]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var b=new Array(o),x=new Array(o),I=new Array(o),O=0;O<o;O++)b[O]=0,x[O]=0,I[O]=0;for(var T=new Array(o*n.minIterations),k=0;k<T.length;k++)T[k]=0;var S;for(S=0;S<n.maxIterations;S++){for(var F=0;F<o;F++){for(var z=-1/0,P=-1/0,H=-1,G=0,re=0;re<o;re++)b[re]=h[F*o+re],G=c[F*o+re]+u[F*o+re],G>=z?(P=z,z=G,H=re):G>P&&(P=G);for(var X=0;X<o;X++)h[F*o+X]=(1-n.damping)*(u[F*o+X]-z)+n.damping*b[X];h[F*o+H]=(1-n.damping)*(u[F*o+H]-P)+n.damping*b[H]}for(var K=0;K<o;K++){for(var ie=0,fe=0;fe<o;fe++)b[fe]=c[fe*o+K],x[fe]=Math.max(0,h[fe*o+K]),ie+=x[fe];ie-=x[K],x[K]=h[K*o+K],ie+=x[K];for(var ve=0;ve<o;ve++)c[ve*o+K]=(1-n.damping)*Math.min(0,ie-x[ve])+n.damping*b[ve];c[K*o+K]=(1-n.damping)*(ie-x[K])+n.damping*b[K]}for(var oe=0,ce=0;ce<o;ce++){var Ee=c[ce*o+ce]+h[ce*o+ce]>0?1:0;T[S%n.minIterations*o+ce]=Ee,oe+=Ee}if(oe>0&&(S>=n.minIterations-1||S==n.maxIterations-1)){for(var xe=0,ye=0;ye<o;ye++){I[ye]=0;for(var de=0;de<n.minIterations;de++)I[ye]+=T[de*o+ye];(I[ye]===0||I[ye]===n.minIterations)&&xe++}if(xe===o)break}}for(var ae=kh(o,h,c),we=Ph(o,u,ae),Te={},Ae=0;Ae<ae.length;Ae++)Te[ae[Ae]]=[];for(var Ne=0;Ne<a.length;Ne++){var Ue=i[a[Ne].id()],He=we[Ue];He!=null&&Te[He].push(a[Ne])}for(var Me=new Array(ae.length),Oe=0;Oe<ae.length;Oe++)Me[Oe]=r.collection(Te[ae[Oe]]);return Me},Bh={affinityPropagation:Zs,ap:Zs},Fh=St({root:void 0,directed:!1}),zh={hierholzer:function(e){if(!C(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=Fh(e),n=a.root,i=a.directed,s=this,o=!1,l,u,f;n&&(f=ee(n)?this.filter(n)[0].id():n[0].id());var h={},c={};i?s.forEach(function(m){var b=m.id();if(m.isNode()){var x=m.indegree(!0),I=m.outdegree(!0),O=x-I,T=I-x;O==1?l?o=!0:l=b:T==1?u?o=!0:u=b:(T>1||O>1)&&(o=!0),h[b]=[],m.outgoers().forEach(function(k){k.isEdge()&&h[b].push(k.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var x=m.degree(!0);x%2&&(l?u?o=!0:u=b:l=b),h[b]=[],m.connectedEdges().forEach(function(I){return h[b].push(I.id())})}else c[b]=[m.source().id(),m.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(f&&u!=f)return v;f=u}else{if(f&&u!=f&&l!=f)return v;f||(f=u)}else f||(f=s[0].id());var d=function(b){for(var x=b,I=[b],O,T,k;h[x].length;)O=h[x].shift(),T=c[O][0],k=c[O][1],x!=k?(h[k]=h[k].filter(function(S){return S!=O}),x=k):!i&&x!=T&&(h[T]=h[T].filter(function(S){return S!=O}),x=T),I.unshift(O),I.unshift(x);return I},g=[],y=[];for(y=d(f);y.length!=1;)h[y[0]].length==0?(g.unshift(s.getElementById(y.shift())),g.unshift(s.getElementById(y.shift()))):y=d(y.shift()).concat(y);g.unshift(s.getElementById(y.shift()));for(var p in h)if(h[p].length)return v;return v.found=!0,v.trail=this.spawn(g,!0),v}},Dn=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(c,v){for(var d=s.length-1,g=[],y=e.spawn();s[d].x!=c||s[d].y!=v;)g.push(s.pop().edge),d--;g.push(s.pop().edge),g.forEach(function(p){var m=p.connectedNodes().intersection(e);y.merge(p),m.forEach(function(b){var x=b.id(),I=b.connectedEdges().intersection(e);y.merge(b),r[x].cutVertex?y.merge(I.filter(function(O){return O.isLoop()})):y.merge(I)})}),i.push(y)},u=function h(c,v,d){c===d&&(n+=1),r[v]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(v).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(v)));else{var y,p,m,b;g.forEach(function(x){y=x.source().id(),p=x.target().id(),m=y===v?p:y,m!==d&&(b=x.id(),o[b]||(o[b]=!0,s.push({x:v,y:m,edge:x})),m in r?r[v].low=Math.min(r[v].low,r[m].id):(h(c,m,v),r[v].low=Math.min(r[v].low,r[m].low),r[v].id<=r[m].low&&(r[v].cutVertex=!0,l(v,m))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,u(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Gh={hopcroftTarjanBiconnected:Dn,htbc:Dn,htb:Dn,hopcroftTarjanBiconnectedComponents:Dn},Sn=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(g){var y=g.target().id();y!==u&&(y in r||l(y),r[y].explored||(r[u].low=Math.min(r[u].low,r[y].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[u].index,r[c].explored=!0,c===u)break}var v=h.edgesWith(h),d=h.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},Vh={tarjanStronglyConnected:Sn,tsc:Sn,tscc:Sn,tarjanStronglyConnectedComponents:Sn},Qs={};[Ia,pf,yf,bf,wf,Tf,Sf,Qf,aa,na,mi,fh,Th,Oh,Bh,zh,Gh,Vh].forEach(function(t){$e(Qs,t)});var Js=0,js=1,eo=2,dr=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=Js,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))};dr.prototype={fulfill:function(e){return to(this,js,"fulfillValue",e)},reject:function(e){return to(this,eo,"rejectReason",e)},then:function(e,r){var a=this,n=new dr;return a.onFulfilled.push(no(e,n,"fulfill")),a.onRejected.push(no(r,n,"reject")),ro(a),n.proxy}};var to=function(e,r,a,n){return e.state===Js&&(e.state=r,e[a]=n,ro(e)),e},ro=function(e){e.state===js?ao(e,"onFulfilled",e.fulfillValue):e.state===eo&&ao(e,"onRejected",e.rejectReason)},ao=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},no=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(s){r.reject(s);return}$h(r,i)}}},$h=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(q(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):t(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};dr.all=function(t){return new dr(function(e,r){for(var a=new Array(t.length),n=0,i=function(l,u){a[l]=u,n++,n===t.length&&e(a)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(h){i(o,h)},function(h){r(h)});else{var f=l;i(o,f)}})(s)})},dr.resolve=function(t){return new dr(function(e,r){e(t)})},dr.reject=function(t){return new dr(function(e,r){r(t)})};var sa=typeof Promise!="undefined"?Promise:dr,wi=function(e,r,a){var n=Ge(e),i=!n,s=this._private=$e({duration:1e3},r,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&ne(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},Gr=wi.prototype;$e(Gr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),se(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 r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(u,f){var h=e[u];h!=null&&(e[u]=e[f],e[f]=h)};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],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new sa(function(n,i){a.push(function(){n()})})}}),Gr.complete=Gr.completed,Gr.run=Gr.play,Gr.running=Gr.playing;var _h={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var f=o.style();r=$e({},r,a);var h=Object.keys(r).length===0;if(h)return new wi(s[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(u&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var c=r.renderedPosition,v=o.pan(),d=o.zoom();r.position=Ss(c,d,v)}if(l&&r.panBy!=null){var g=r.panBy,y=o.pan();r.pan={x:y.x+g.x,y:y.y+g.y}}var p=r.center||r.centre;if(l&&p!=null){var m=o.getCenterPan(p.eles,r.zoom);m!=null&&(r.pan=m)}if(l&&r.fit!=null){var b=r.fit,x=o.getFitViewport(b.eles||b.boundingBox,b.padding);x!=null&&(r.pan=x.pan,r.zoom=x.zoom)}if(l&&C(r.zoom)){var I=o.getZoomedViewport(r.zoom);I!=null?(I.zoomed&&(r.zoom=I.zoom),I.panned&&(r.pan=I.pan)):r.zoom=null}return new wi(s[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(r=$e({},r,a));for(var l=0;l<s.length;l++){var u=s[l],f=u.animated()&&(r.queue===void 0||r.queue),h=u.animation(r,f?{queue:!0}:void 0);h.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],f=u._private,h=f.animation.current,c=0;c<h.length;c++){var v=h[c],d=v._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this}}},Uh=Array.isArray,Ln=Uh,Yh=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hh=/^\w*$/;function Xh(t,e){if(Ln(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Aa(t)?!0:Hh.test(t)||!Yh.test(t)||e!=null&&t in Object(e)}var qh=Xh,Wh="[object AsyncFunction]",Kh="[object Function]",Zh="[object GeneratorFunction]",Qh="[object Proxy]";function Jh(t){if(!kr(t))return!1;var e=cs(t);return e==Kh||e==Zh||e==Wh||e==Qh}var jh=Jh,ec=cn["__core-js_shared__"],xi=ec,io=function(){var t=/[^.]+$/.exec(xi&&xi.keys&&xi.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function tc(t){return!!io&&io in t}var rc=tc,ac=Function.prototype,nc=ac.toString;function ic(t){if(t!=null){try{return nc.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var sc=ic,oc=/[\\^$.*+?()[\]{}|]/g,uc=/^\[object .+?Constructor\]$/,lc=Function.prototype,fc=Object.prototype,hc=lc.toString,cc=fc.hasOwnProperty,vc=RegExp("^"+hc.call(cc).replace(oc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dc(t){if(!kr(t)||rc(t))return!1;var e=jh(t)?vc:uc;return e.test(sc(t))}var gc=dc;function pc(t,e){return t==null?void 0:t[e]}var yc=pc;function mc(t,e){var r=yc(t,e);return gc(r)?r:void 0}var Ti=mc,bc=Ti(Object,"create"),Ga=bc;function Ec(){this.__data__=Ga?Ga(null):{},this.size=0}var wc=Ec;function xc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Tc=xc,Cc="__lodash_hash_undefined__",Dc=Object.prototype,Sc=Dc.hasOwnProperty;function Lc(t){var e=this.__data__;if(Ga){var r=e[t];return r===Cc?void 0:r}return Sc.call(e,t)?e[t]:void 0}var Ac=Lc,Oc=Object.prototype,Nc=Oc.hasOwnProperty;function Mc(t){var e=this.__data__;return Ga?e[t]!==void 0:Nc.call(e,t)}var Ic=Mc,Rc="__lodash_hash_undefined__";function kc(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ga&&e===void 0?Rc:e,this}var Pc=kc;function oa(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}oa.prototype.clear=wc,oa.prototype.delete=Tc,oa.prototype.get=Ac,oa.prototype.has=Ic,oa.prototype.set=Pc;var so=oa;function Bc(){this.__data__=[],this.size=0}var Fc=Bc;function zc(t,e){return t===e||t!==t&&e!==e}var oo=zc;function Gc(t,e){for(var r=t.length;r--;)if(oo(t[r][0],e))return r;return-1}var An=Gc,Vc=Array.prototype,$c=Vc.splice;function _c(t){var e=this.__data__,r=An(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():$c.call(e,r,1),--this.size,!0}var Uc=_c;function Yc(t){var e=this.__data__,r=An(e,t);return r<0?void 0:e[r][1]}var Hc=Yc;function Xc(t){return An(this.__data__,t)>-1}var qc=Xc;function Wc(t,e){var r=this.__data__,a=An(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Kc=Wc;function ua(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}ua.prototype.clear=Fc,ua.prototype.delete=Uc,ua.prototype.get=Hc,ua.prototype.has=qc,ua.prototype.set=Kc;var Zc=ua,Qc=Ti(cn,"Map"),Jc=Qc;function jc(){this.size=0,this.__data__={hash:new so,map:new(Jc||Zc),string:new so}}var ev=jc;function tv(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var rv=tv;function av(t,e){var r=t.__data__;return rv(e)?r[typeof e=="string"?"string":"hash"]:r.map}var On=av;function nv(t){var e=On(this,t).delete(t);return this.size-=e?1:0,e}var iv=nv;function sv(t){return On(this,t).get(t)}var ov=sv;function uv(t){return On(this,t).has(t)}var lv=uv;function fv(t,e){var r=On(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var hv=fv;function la(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}la.prototype.clear=ev,la.prototype.delete=iv,la.prototype.get=ov,la.prototype.has=lv,la.prototype.set=hv;var uo=la,cv="Expected a function";function Ci(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(cv);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],i=r.cache;if(i.has(n))return i.get(n);var s=t.apply(this,a);return r.cache=i.set(n,s)||i,s};return r.cache=new(Ci.Cache||uo),r}Ci.Cache=uo;var vv=Ci,dv=500;function gv(t){var e=vv(t,function(a){return r.size===dv&&r.clear(),a}),r=e.cache;return e}var pv=gv,yv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,mv=/\\(\\)?/g,bv=pv(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(yv,function(r,a,n,i){e.push(n?i.replace(mv,"$1"):a||r)}),e}),lo=bv;function Ev(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}var fo=Ev,wv=1/0,ho=Qr?Qr.prototype:void 0,co=ho?ho.toString:void 0;function vo(t){if(typeof t=="string")return t;if(Ln(t))return fo(t,vo)+"";if(Aa(t))return co?co.call(t):"";var e=t+"";return e=="0"&&1/t==-wv?"-0":e}var xv=vo;function Tv(t){return t==null?"":xv(t)}var go=Tv;function Cv(t,e){return Ln(t)?t:qh(t,e)?[t]:lo(go(t))}var po=Cv,Dv=1/0;function Sv(t){if(typeof t=="string"||Aa(t))return t;var e=t+"";return e=="0"&&1/t==-Dv?"-0":e}var Di=Sv;function Lv(t,e){e=po(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[Di(e[r++])];return r&&r==a?t:void 0}var Av=Lv;function Ov(t,e,r){var a=t==null?void 0:Av(t,e);return a===void 0?r:a}var Nv=Ov,Mv=function(){try{var t=Ti(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),yo=Mv;function Iv(t,e,r){e=="__proto__"&&yo?yo(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var Rv=Iv,kv=Object.prototype,Pv=kv.hasOwnProperty;function Bv(t,e,r){var a=t[e];(!(Pv.call(t,e)&&oo(a,r))||r===void 0&&!(e in t))&&Rv(t,e,r)}var Fv=Bv,zv=9007199254740991,Gv=/^(?:0|[1-9]\d*)$/;function Vv(t,e){var r=typeof t;return e=e==null?zv:e,!!e&&(r=="number"||r!="symbol"&&Gv.test(t))&&t>-1&&t%1==0&&t<e}var $v=Vv;function _v(t,e,r,a){if(!kr(t))return t;e=po(e,t);for(var n=-1,i=e.length,s=i-1,o=t;o!=null&&++n<i;){var l=Di(e[n]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(n!=s){var f=o[l];u=a?a(f,l,o):void 0,u===void 0&&(u=kr(f)?f:$v(e[n+1])?[]:{})}Fv(o,l,u),o=o[l]}return t}var Uv=_v;function Yv(t,e,r){return t==null?t:Uv(t,e,r)}var Hv=Yv;function Xv(t,e){var r=-1,a=t.length;for(e||(e=Array(a));++r<a;)e[r]=t[r];return e}var qv=Xv;function Wv(t){return Ln(t)?fo(t,Di):Aa(t)?[t]:qv(lo(go(t)))}var Kv=Wv,Zv={data:function(e){var r={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=$e({},r,e),function(n,i){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],f=l?o[0]:o;if(ee(n)){var h=n.indexOf(".")!==-1,c=h&&Kv(n);if(s.allowGetting&&i===void 0){var v;return f&&(s.beforeGet(f),c&&f._private[s.field][n]===void 0?v=Nv(f._private[s.field],c):v=f._private[s.field][n]),v}else if(s.allowSetting&&i!==void 0){var d=!s.immutableKeys[n];if(d){var g=E({},n,i);s.beforeSet(o,g);for(var y=0,p=u.length;y<p;y++){var m=u[y];s.canSet(m)&&(c&&f._private[s.field][n]===void 0?Hv(m._private[s.field],c,i):m._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&C(n)){var b=n,x,I,O=Object.keys(b);s.beforeSet(o,b);for(var T=0;T<O.length;T++){x=O[T],I=b[x];var k=!s.immutableKeys[x];if(k)for(var S=0;S<u.length;S++){var F=u[S];s.canSet(F)&&(F._private[s.field][x]=I)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&ne(n)){var z=n;o.on(s.bindingEvent,z)}else if(s.allowGetting&&n===void 0){var P;return f&&(s.beforeGet(f),P=f._private[s.field]),P}return o}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=$e({},r,e),function(n){var i=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ee(n)){for(var u=n.split(/\s+/),f=u.length,h=0;h<f;h++){var c=u[h];if(!Ye(c)){var v=!i.immutableKeys[c];if(v)for(var d=0,g=l.length;d<g;d++)l[d]._private[i.field][c]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var y=0,p=l.length;y<p;y++)for(var m=l[y]._private[i.field],b=Object.keys(m),x=0;x<b.length;x++){var I=b[x],O=!i.immutableKeys[I];O&&(m[I]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},Qv={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new sa(function(o,l){var u=function(v){i.off.apply(i,h),o(v)},f=s.concat([u]),h=f.concat([]);i.on.apply(i,f)})}}},ft={};[_h,Zv,Qv].forEach(function(t){$e(ft,t)});var Jv={animate:ft.animate(),animation:ft.animation(),animated:ft.animated(),clearQueue:ft.clearQueue(),delay:ft.delay(),delayAnimation:ft.delayAnimation(),stop:ft.stop()},Nn={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else me(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new jr(e),s=0;s<r.length;s++){for(var o=r[s],l=o._private,u=l.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c);if(!v){f=!0;break}}f||(f=u.size!==e.length),f&&(l.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){me(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s<o;s++)for(var l=a[s],u=l._private.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c),d=!1;r||n&&!v?(u.add(c),d=!0):(!r||n&&v)&&(u.delete(c),d=!0),!f&&d&&(i.push(l),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Nn.className=Nn.classNames=Nn.classes;var nt={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+"};nt.variable="(?:[\\w-.]|(?:\\\\"+nt.metaChar+"))+",nt.className="(?:[\\w-]|(?:\\\\"+nt.metaChar+"))+",nt.value=nt.string+"|"+nt.number,nt.id=nt.variable,function(){var t,e,r;for(t=nt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],nt.comparatorOp+="|@"+e;for(t=nt.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(nt.comparatorOp+="|\\!"+e)}();var vt=function(){return{checks:[]}},Re={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},Si=[{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(t,e){return Jt(t.selector,e.selector)}),jv=function(){for(var t={},e,r=0;r<Si.length;r++)e=Si[r],t[e.selector]=e.matches;return t}(),ed=function(e,r){return jv[e](r)},td="("+Si.map(function(t){return t.selector}).join("|")+")",fa=function(e){return e.replace(new RegExp("\\\\("+nt.metaChar+")","g"),function(r,a){return a})},Cr=function(e,r,a){e[e.length-1]=a},Li=[{name:"group",query:!0,regex:"("+nt.group+")",populate:function(e,r,a){var n=w(a,1),i=n[0];r.checks.push({type:Re.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:td,populate:function(e,r,a){var n=w(a,1),i=n[0];r.checks.push({type:Re.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+nt.id+")",populate:function(e,r,a){var n=w(a,1),i=n[0];r.checks.push({type:Re.ID,value:fa(i)})}},{name:"className",query:!0,regex:"\\.("+nt.className+")",populate:function(e,r,a){var n=w(a,1),i=n[0];r.checks.push({type:Re.CLASS,value:fa(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+nt.variable+")\\s*\\]",populate:function(e,r,a){var n=w(a,1),i=n[0];r.checks.push({type:Re.DATA_EXIST,field:fa(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+nt.variable+")\\s*("+nt.comparatorOp+")\\s*("+nt.value+")\\s*\\]",populate:function(e,r,a){var n=w(a,3),i=n[0],s=n[1],o=n[2],l=new RegExp("^"+nt.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),r.checks.push({type:Re.DATA_COMPARE,field:fa(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+nt.boolOp+")\\s*("+nt.variable+")\\s*\\]",populate:function(e,r,a){var n=w(a,2),i=n[0],s=n[1];r.checks.push({type:Re.DATA_BOOL,field:fa(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+nt.meta+")\\s*("+nt.comparatorOp+")\\s*("+nt.number+")\\s*\\]\\]",populate:function(e,r,a){var n=w(a,3),i=n[0],s=n[1],o=n[2];r.checks.push({type:Re.META_COMPARE,field:fa(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:nt.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=vt();return o}},{name:"directedEdge",separator:!0,regex:nt.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=vt(),n=r,i=vt();return a.checks.push({type:Re.DIRECTED_EDGE,source:n,target:i}),Cr(e,r,a),e.edgeCount++,i}else{var s=vt(),o=r,l=vt();return s.checks.push({type:Re.NODE_SOURCE,source:o,target:l}),Cr(e,r,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:nt.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=vt(),n=r,i=vt();return a.checks.push({type:Re.UNDIRECTED_EDGE,nodes:[n,i]}),Cr(e,r,a),e.edgeCount++,i}else{var s=vt(),o=r,l=vt();return s.checks.push({type:Re.NODE_NEIGHBOR,node:o,neighbor:l}),Cr(e,r,s),l}}},{name:"child",separator:!0,regex:nt.child,populate:function(e,r){if(e.currentSubject==null){var a=vt(),n=vt(),i=e[e.length-1];return a.checks.push({type:Re.CHILD,parent:i,child:n}),Cr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=vt(),o=e[e.length-1],l=vt(),u=vt(),f=vt(),h=vt();return s.checks.push({type:Re.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:Re.TRUE}],h.checks.push({type:Re.TRUE}),l.checks.push({type:Re.PARENT,parent:h,child:f}),Cr(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=vt(),v=vt(),d=[{type:Re.PARENT,parent:c,child:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:nt.descendant,populate:function(e,r){if(e.currentSubject==null){var a=vt(),n=vt(),i=e[e.length-1];return a.checks.push({type:Re.DESCENDANT,ancestor:i,descendant:n}),Cr(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=vt(),o=e[e.length-1],l=vt(),u=vt(),f=vt(),h=vt();return s.checks.push({type:Re.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:Re.TRUE}],h.checks.push({type:Re.TRUE}),l.checks.push({type:Re.ANCESTOR,ancestor:h,descendant:f}),Cr(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=vt(),v=vt(),d=[{type:Re.ANCESTOR,ancestor:c,descendant:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:nt.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return lt("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===Re.DIRECTED_EDGE?n.type=Re.NODE_TARGET:i===Re.UNDIRECTED_EDGE&&(n.type=Re.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Li.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var rd=function(e){for(var r,a,n,i=0;i<Li.length;i++){var s=Li[i],o=s.name,l=e.match(s.regexObj);if(l!=null){a=l,r=s,n=o;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:a,name:n,remaining:e}},ad=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},nd=function(e){var r=this,a=r.inputText=e,n=r[0]=vt();for(r.length=1,a=ad(a);;){var i=rd(a);if(i.expr==null)return lt("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(r,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var f=r[u];if(f.compoundCount>0&&f.edgeCount>0)return lt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return lt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&lt("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},id=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f==null?"":f},r=function(f){return ee(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,v=f.value;switch(c){case Re.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case Re.DATA_COMPARE:{var g=f.field,y=f.operator;return"["+g+a(e(y))+r(v)+"]"}case Re.DATA_BOOL:{var p=f.operator,m=f.field;return"["+e(p)+m+"]"}case Re.DATA_EXIST:{var b=f.field;return"["+b+"]"}case Re.META_COMPARE:{var x=f.operator,I=f.field;return"[["+I+a(e(x))+r(v)+"]]"}case Re.STATE:return v;case Re.ID:return"#"+v;case Re.CLASS:return"."+v;case Re.PARENT:case Re.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case Re.ANCESTOR:case Re.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case Re.COMPOUND_SPLIT:{var O=i(f.left,h),T=i(f.subject,h),k=i(f.right,h);return O+(O.length>0?" ":"")+T+k}case Re.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,v,d){return c+(h===f&&d===0?"$":"")+n(v,h)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},sd={parse:nd,toString:id},mo=function(e,r,a){var n,i=ee(e),s=N(e),o=ee(a),l,u,f=!1,h=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){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 h&&(e!=null||!c)&&(n=!n),n},od=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},ud=function(e){return e!==void 0},Ai=function(e,r){return e.data(r)},ld=function(e,r){return e[r]()},Et=[],yt=function(e,r){return e.checks.every(function(a){return Et[a.type](a,r)})};Et[Re.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()},Et[Re.STATE]=function(t,e){var r=t.value;return ed(r,e)},Et[Re.ID]=function(t,e){var r=t.value;return e.id()===r},Et[Re.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)},Et[Re.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return mo(ld(e,r),a,n)},Et[Re.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return mo(Ai(e,r),a,n)},Et[Re.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return od(Ai(e,r),a)},Et[Re.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,ud(Ai(e,r))},Et[Re.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return yt(r,n)&&yt(a,i)||yt(a,n)&&yt(r,i)},Et[Re.NODE_NEIGHBOR]=function(t,e){return yt(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&yt(t.neighbor,r)})},Et[Re.DIRECTED_EDGE]=function(t,e){return yt(t.source,e.source())&&yt(t.target,e.target())},Et[Re.NODE_SOURCE]=function(t,e){return yt(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&yt(t.target,r)})},Et[Re.NODE_TARGET]=function(t,e){return yt(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&yt(t.source,r)})},Et[Re.CHILD]=function(t,e){return yt(t.child,e)&&yt(t.parent,e.parent())},Et[Re.PARENT]=function(t,e){return yt(t.parent,e)&&e.children().some(function(r){return yt(t.child,r)})},Et[Re.DESCENDANT]=function(t,e){return yt(t.descendant,e)&&e.ancestors().some(function(r){return yt(t.ancestor,r)})},Et[Re.ANCESTOR]=function(t,e){return yt(t.ancestor,e)&&e.descendants().some(function(r){return yt(t.descendant,r)})},Et[Re.COMPOUND_SPLIT]=function(t,e){return yt(t.subject,e)&&yt(t.left,e)&&yt(t.right,e)},Et[Re.TRUE]=function(){return!0},Et[Re.COLLECTION]=function(t,e){var r=t.value;return r.has(e)},Et[Re.FILTER]=function(t,e){var r=t.value;return r(e)};var fd=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===Re.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var s=0;s<r.length;s++){var o=r[s];if(yt(o,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},hd=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(yt(n,e))return!0}return!1},cd={matches:hd,filter:fd},Dr=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ee(e)&&e.match(/^\s*$/)||(se(e)?this.addQuery({checks:[{type:Re.COLLECTION,value:e.collection()}]}):ne(e)?this.addQuery({checks:[{type:Re.FILTER,value:e}]}):ee(e)?this.parse(e)||(this.invalid=!0):bt("A selector must be created from a string; found "))},Sr=Dr.prototype;[sd,cd].forEach(function(t){return $e(Sr,t)}),Sr.text=function(){return this.inputText},Sr.size=function(){return this.length},Sr.eq=function(t){return this[t]},Sr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()},Sr.addQuery=function(t){this[this.length++]=t},Sr.selector=Sr.toString;var Lr={allAre:function(e){var r=new Dr(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new Dr(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[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 r=this.length,a=e.length;return r!==a?!1:r===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(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};Lr.allAreNeighbours=Lr.allAreNeighbors,Lr.has=Lr.contains,Lr.equal=Lr.equals=Lr.same;var Xt=function(e,r){return function(n,i,s,o){var l=n,u=this,f;if(l==null?f="":se(l)&&l.length===1&&(f=l.id()),u.length===1&&f){var h=u[0]._private,c=h.traversalCache=h.traversalCache||{},v=c[r]=c[r]||[],d=Pr(f),g=v[d];return g||(v[d]=e.call(u,n,i,s,o))}else return e.call(u,n,i,s,o)}},ha={parent:function(e){var r=[];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],s=i._private.parent;s&&r.push(s)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:Xt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"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 r=[];function a(n){for(var i=0;i<n.length;i++){var s=n[i];r.push(s),s.children().nonempty()&&a(s.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function Oi(t,e,r,a){for(var n=[],i=new jr,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function bo(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}ha.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,bo)};function Eo(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ha.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,Eo)};function vd(t,e,r){Eo(t,e,r),bo(t,e,r)}ha.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,vd)},ha.ancestors=ha.parents;var Va,wo;Va=wo={data:ft.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:ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ft.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ft.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Va.attr=Va.data,Va.removeAttr=Va.removeData;var dd=wo,Mn={};function Ni(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=t(n,o))}return a}else return}}$e(Mn,{degree:Ni(function(t,e){return e.source().same(e.target())?2:1}),indegree:Ni(function(t,e){return e.target().same(t)?1:0}),outdegree:Ni(function(t,e){return e.source().same(t)?1:0})});function ca(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[t](r);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}$e(Mn,{minDegree:ca("degree",function(t,e){return t<e}),maxDegree:ca("degree",function(t,e){return t>e}),minIndegree:ca("indegree",function(t,e){return t<e}),maxIndegree:ca("indegree",function(t,e){return t>e}),minOutdegree:ca("outdegree",function(t,e){return t<e}),maxOutdegree:ca("outdegree",function(t,e){return t>e})}),$e(Mn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var er,xo,To=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},Co={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){To(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};er=xo={position:ft.data(Co),silentPosition:ft.data($e({},Co,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){To(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(C(e))r?this.silentPosition(e):this.position(e);else if(ne(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(r?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(C(e)?(n={x:N(e.x)?e.x:0,y:N(e.y)?e.y:0},a=r):ee(e)&&N(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+n.x,y:l.y+n.y};a?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,r){return C(e)?this.shift(e,!0):ee(e)&&N(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=C(e)?e:void 0,l=o!==void 0||r!==void 0&&ee(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var f=this[u];r!==void 0?f.position(e,(r-s[e])/i):o!==void 0&&f.position(Ss(o,i,s))}else{var h=a.position();return o=mn(h,i,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=C(e)?e:void 0,s=i!==void 0||r!==void 0&&ee(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],f=o?u.parent():null,h=f&&f.length>0,c=h;h&&(f=f[0]);var v=c?f.position():{x:0,y:0};r!==void 0?u.position(e,r+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),g=o?a.parent():null,y=g&&g.length>0,p=y;y&&(g=g[0]);var m=p?g.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(!s)return;return this}},er.modelPosition=er.point=er.position,er.modelPositions=er.points=er.positions,er.renderedPoint=er.renderedPosition,er.relativePoint=er.relativePosition;var gd=xo,va,Ar;va=Ar={},Ar.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}},Ar.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)},Ar.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function v(S,F,z){var P=0,H=0,G=F+z;return S>0&&G>0&&(P=F/G*S,H=z/G*S),{biasDiff:P,biasComplementDiff:H}}function d(S,F,z,P){if(z.units==="%")switch(P){case"width":return S>0?z.pfValue*S:0;case"height":return F>0?z.pfValue*F:0;case"average":return S>0&&F>0?z.pfValue*(S+F)/2:0;case"min":return S>0&&F>0?S>F?z.pfValue*F:z.pfValue*S:0;case"max":return S>0&&F>0?S>F?z.pfValue*S:z.pfValue*F:0;default:return 0}else return z.units==="px"?z.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var y=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var p=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(p=p*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var b=v(f.width.val-h.w,g,y),x=b.biasDiff,I=b.biasComplementDiff,O=v(f.height.val-h.h,p,m),T=O.biasDiff,k=O.biasComplementDiff;o.autoPadding=d(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-x+h.x1+h.x2+I)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-T+h.y1+h.y2+k)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var qt=function(e){return e===1/0||e===-1/0?0:e},tr=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r: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)},Vr=function(e,r){return r==null?e:tr(e,r.x1,r.y1,r.x2,r.y2)},$a=function(e,r,a){return jt(e,r,a)},In=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=l-s,h.y1=u-s,h.x2=l+s,h.y2=u+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,En(h,1),tr(e,h.x1,h.y1,h.x2,h.y2)}}},Mi=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),f=$a(s,"labelWidth",a),h=$a(s,"labelHeight",a),c=$a(s,"labelX",a),v=$a(s,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,g=r.pstyle(n+"text-margin-y").pfValue,y=r.isEdge(),p=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,x=b/2,I=r.pstyle("text-background-padding").pfValue,O=2,T=h,k=f,S=k/2,F=T/2,z,P,H,G;if(y)z=c-S,P=c+S,H=v-F,G=v+F;else{switch(l.value){case"left":z=c-k,P=c;break;case"center":z=c-S,P=c+S;break;case"right":z=c,P=c+k;break}switch(u.value){case"top":H=v-T,G=v;break;case"center":H=v-F,G=v+F;break;case"bottom":H=v,G=v+T;break}}z+=d-Math.max(m,x)-I-O,P+=d+Math.max(m,x)+I+O,H+=g-Math.max(m,x)-I-O,G+=g+Math.max(m,x)+I+O;var re=a||"main",X=i.labelBounds,K=X[re]=X[re]||{};K.x1=z,K.y1=H,K.x2=P,K.y2=G,K.w=P-z,K.h=G-H;var ie=y&&p.strValue==="autorotate",fe=p.pfValue!=null&&p.pfValue!==0;if(ie||fe){var ve=ie?$a(i.rstyle,"labelAngle",a):p.pfValue,oe=Math.cos(ve),ce=Math.sin(ve),Ee=(z+P)/2,xe=(H+G)/2;if(!y){switch(l.value){case"left":Ee=P;break;case"right":Ee=z;break}switch(u.value){case"top":xe=G;break;case"bottom":xe=H;break}}var ye=function(He,Me){return He=He-Ee,Me=Me-xe,{x:He*oe-Me*ce+Ee,y:He*ce+Me*oe+xe}},de=ye(z,H),ae=ye(z,G),we=ye(P,H),Te=ye(P,G);z=Math.min(de.x,ae.x,we.x,Te.x),P=Math.max(de.x,ae.x,we.x,Te.x),H=Math.min(de.y,ae.y,we.y,Te.y),G=Math.max(de.y,ae.y,we.y,Te.y)}var Ae=re+"Rot",Ne=X[Ae]=X[Ae]||{};Ne.x1=z,Ne.y1=H,Ne.x2=P,Ne.y2=G,Ne.w=P-z,Ne.h=G-H,tr(e,z,H,P,G),tr(i.labelBounds.all,z,H,P,G)}return e}},pd=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=$t(),o=e._private,l=e.isNode(),u=e.isEdge(),f,h,c,v,d,g,y=o.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ve){return Ve.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var x=0,I=0;n&&r.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(I=e.pstyle("overlay-padding").value));var O=0,T=0;n&&r.includeUnderlays&&(O=e.pstyle("underlay-opacity").value,O!==0&&(T=e.pstyle("underlay-padding").value));var k=Math.max(I,T),S=0,F=0;if(n&&(S=e.pstyle("width").pfValue,F=S/2),l&&r.includeNodes){var z=e.position();d=z.x,g=z.y;var P=e.outerWidth(),H=P/2,G=e.outerHeight(),re=G/2;f=d-H,h=d+H,c=g-re,v=g+re,tr(s,f,c,h,v)}else if(u&&r.includeEdges)if(n&&!i){var X=e.pstyle("curve-style").strValue;if(f=Math.min(y.srcX,y.midX,y.tgtX),h=Math.max(y.srcX,y.midX,y.tgtX),c=Math.min(y.srcY,y.midY,y.tgtY),v=Math.max(y.srcY,y.midY,y.tgtY),f-=F,h+=F,c-=F,v+=F,tr(s,f,c,h,v),X==="haystack"){var K=y.haystackPts;if(K&&K.length===2){if(f=K[0].x,c=K[0].y,h=K[1].x,v=K[1].y,f>h){var ie=f;f=h,h=ie}if(c>v){var fe=c;c=v,v=fe}tr(s,f-F,c-F,h+F,v+F)}}else if(X==="bezier"||X==="unbundled-bezier"||X==="segments"||X==="taxi"){var ve;switch(X){case"bezier":case"unbundled-bezier":ve=y.bezierPts;break;case"segments":case"taxi":ve=y.linePts;break}if(ve!=null)for(var oe=0;oe<ve.length;oe++){var ce=ve[oe];f=ce.x-F,h=ce.x+F,c=ce.y-F,v=ce.y+F,tr(s,f,c,h,v)}}}else{var Ee=e.source(),xe=Ee.position(),ye=e.target(),de=ye.position();if(f=xe.x,h=de.x,c=xe.y,v=de.y,f>h){var ae=f;f=h,h=ae}if(c>v){var we=c;c=v,v=we}f-=F,h+=F,c-=F,v+=F,tr(s,f,c,h,v)}if(n&&r.includeEdges&&u&&(In(s,e,"mid-source"),In(s,e,"mid-target"),In(s,e,"source"),In(s,e,"target")),n){var Te=e.pstyle("ghost").value==="yes";if(Te){var Ae=e.pstyle("ghost-offset-x").pfValue,Ne=e.pstyle("ghost-offset-y").pfValue;tr(s,s.x1+Ae,s.y1+Ne,s.x2+Ae,s.y2+Ne)}}var Ue=o.bodyBounds=o.bodyBounds||{};As(Ue,s),ci(Ue,p),En(Ue,1),n&&(f=s.x1,h=s.x2,c=s.y1,v=s.y2,tr(s,f-k,c-k,h+k,v+k));var He=o.overlayBounds=o.overlayBounds||{};As(He,s),ci(He,p),En(He,1);var Me=o.labelBounds=o.labelBounds||{};Me.all!=null?Bf(Me.all):Me.all=$t(),n&&r.includeLabels&&(r.includeMainLabels&&Mi(s,e,null),u&&(r.includeSourceLabels&&Mi(s,e,"source"),r.includeTargetLabels&&Mi(s,e,"target")))}return s.x1=qt(s.x1),s.y1=qt(s.y1),s.x2=qt(s.x2),s.y2=qt(s.y2),s.w=qt(s.x2-s.x1),s.h=qt(s.y2-s.y1),s.w>0&&s.h>0&&b&&(ci(s,p),En(s,1)),s},Do=function(e){var r=0,a=function(s){return(s?1:0)<<r++},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},So=function(e){if(e.isEdge()){var r=e.source().position(),a=e.target().position(),n=function(s){return Math.round(s)};return rf([n(r.x),n(r.y),n(a.x),n(a.y)])}else return 0},Lo=function(e,r){var a=e._private,n,i=e.isEdge(),s=r==null?Ao:Do(r),o=s===Ao,l=So(e),u=a.bbCachePosKey===l,f=r.useCache&&u,h=function(g){return g._private.bbCache==null||g._private.styleDirty},c=!f||h(e)||i&&h(e.source())||h(e.target());if(c?(u||e.recalculateRenderedStyle(f),n=pd(e,_a),a.bbCache=n,a.bbCachePosKey=l):n=a.bbCache,!o){var v=e.isNode();n=$t(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?Vr(n,a.overlayBounds):Vr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?Vr(n,a.labelBounds.all):(r.includeMainLabels&&Vr(n,a.labelBounds.mainRot),r.includeSourceLabels&&Vr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&Vr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},_a={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,useCache:!0},Ao=Do(_a),Oo=St(_a);Ar.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=_a:t=Oo(t),e=Lo(this[0],t);else{e=$t(),t=t||_a;var r=Oo(t),a=this,n=a.cy(),i=n.styleEnabled();if(i)for(var s=0;s<a.length;s++){var o=a[s],l=o._private,u=So(o),f=l.bbCachePosKey===u,h=r.useCache&&f&&!l.styleDirty;o.recalculateRenderedStyle(h)}this.updateCompoundBounds(!t.useCache);for(var c=0;c<a.length;c++){var v=a[c];Vr(e,Lo(v,r))}}return e.x1=qt(e.x1),e.y1=qt(e.y1),e.x2=qt(e.x2),e.y2=qt(e.y2),e.w=qt(e.x2-e.x1),e.h=qt(e.y2-e.y1),e},Ar.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._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},Ar.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),C(t)){var i=t;t=function(){return i}}var s=function(f,h){return f._private.bbAtOldPos=t(f,h)},o=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=Pf(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),l},va.boundingbox=va.bb=va.boundingBox,va.renderedBoundingbox=va.renderedBoundingBox;var yd=Ar,Ua,Ya;Ua=Ya={};var No=function(e){e.uppercaseName=xt(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=xt(e.outerName),Ua[e.name]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},Ua["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return o+l+u}else return 1},Ua["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},Ua["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};No({name:"width"}),No({name:"height"}),Ya.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue},Ya.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()},Ya.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var md=Ya,bd=function(e,r){if(e.isEdge())return r(e)},Ed=function(e,r){if(e.isEdge()){var a=e.cy();return mn(r(e),a.zoom(),a.pan())}},wd=function(e,r){if(e.isEdge()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(s){return mn(s,i,n)})}},xd=function(e){return e.renderer().getControlPoints(e)},Td=function(e){return e.renderer().getSegmentPoints(e)},Cd=function(e){return e.renderer().getSourceEndpoint(e)},Dd=function(e){return e.renderer().getTargetEndpoint(e)},Sd=function(e){return e.renderer().getEdgeMidpoint(e)},Mo={controlPoints:{get:xd,mult:!0},segmentPoints:{get:Td,mult:!0},sourceEndpoint:{get:Cd},targetEndpoint:{get:Dd},midpoint:{get:Sd}},Ld=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Ad=Object.keys(Mo).reduce(function(t,e){var r=Mo[e],a=Ld(e);return t[e]=function(){return bd(this,r.get)},r.mult?t[a]=function(){return wd(this,r.get)}:t[a]=function(){return Ed(this,r.get)},t},{}),Od=$e({},gd,yd,md,Ad);var Io=function(e,r){this.recycle(e,r)};function Ha(){return!1}function Rn(){return!0}Io.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Ha,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Rn:Ha):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.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=Rn;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Rn;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Rn,this.stopPropagation()},isDefaultPrevented:Ha,isPropagationStopped:Ha,isImmediatePropagationStopped:Ha};var Ro=/^([^.]+)(\.(?:[^.]+))?$/,Nd=".*",ko={qualifierCompare:function(e,r){return e===r},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},Po=Object.keys(ko),Md={};function kn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Md,e=arguments.length>1?arguments[1]:void 0,r=0;r<Po.length;r++){var a=Po[r];this[a]=t[a]||ko[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Or=kn.prototype,Bo=function(e,r,a,n,i,s,o){ne(n)&&(i=n,n=null),o&&(s==null?s=o:s=$e({},s,o));for(var l=me(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var f=l[u];if(!Ye(f)){var h=f.match(Ro);if(h){var c=h[1],v=h[2]?h[2]:null,d=r(e,f,c,v,n,i,s);if(d===!1)break}}}},Fo=function(e,r){return e.addEventFields(e.context,r),new Io(r.type,r)},Id=function(e,r,a){if(ct(a)){r(e,a);return}else if(C(a)){r(e,Fo(e,a));return}for(var n=me(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!Ye(s)){var o=s.match(Ro);if(o){var l=o[1],u=o[2]?o[2]:null,f=Fo(e,{type:l,namespace:u,target:e.context});r(e,f)}}}};Or.on=Or.addListener=function(t,e,r,a,n){return Bo(this,function(i,s,o,l,u,f,h){ne(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:l,qualifier:u,conf:h})},t,e,r,a,n),this},Or.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})},Or.removeListener=Or.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=uf(this.listeners));for(var i=this.listeners,s=function(u){var f=i[u];Bo(n,function(h,c,v,d,g,y){if((f.type===v||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!g||h.qualifierCompare(f.qualifier,g))&&(!y||f.callback===y))return i.splice(u,1),!1},t,e,r,a)},o=i.length-1;o>=0;o--)s(o);return this},Or.removeAllListeners=function(){return this.removeListener("*")},Or.emit=Or.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,me(e)||(e=[e]),Id(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===Nd)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&ff(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==h}));var v=i.callbackContext(i.context,h,s),d=h.callback.apply(v,c);i.afterEmit(i.context,h,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<n;l++)o(l);i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},t),this.emitting--,this};var Rd={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Le(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Pn=function(e){return ee(e)?new Dr(e):e},zo={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new kn(Rd,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=Pn(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};ft.eventAliasesOn(zo);var Go={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(ee(e)||se(e))return new Dr(e).filter(this);if(ne(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ee(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ee(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,l=s?i:n,u=0;u<o.length;u++){var f=o[u];l.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;ee(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,s=function(l,u){for(var f=0;f<l.length;f++){var h=l[f],c=h._private.data.id,v=u.hasElementWithId(c);v||a.push(h)}};return s(n,i),s(i,n),a},diff:function(e){var r=this._private.cy;ee(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,l=function(f,h,c){for(var v=0;v<f.length;v++){var d=f[v],g=d._private.data.id,y=h.hasElementWithId(g);y?i.merge(d):c.push(d)}};return l(s,o,a),l(o,s,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(ee(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&ee(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!i.has(l);if(u){var f=this.length++;this[f]=o,i.set(l,{ele:o,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ee(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);a.push(o)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l>a&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l<a&&(a=l,n=o)}return{value:a,ele:n}}},it=Go;it.u=it["|"]=it["+"]=it.union=it.or=it.add,it["\\"]=it["!"]=it["-"]=it.difference=it.relativeComplement=it.subtract=it.not,it.n=it["&"]=it["."]=it.and=it.intersection=it.intersect,it["^"]=it["(+)"]=it["(-)"]=it.symmetricDifference=it.symdiff=it.xor,it.fnFilter=it.filterFn=it.stdFilter=it.filter,it.complement=it.abscomp=it.absoluteComplement;var kd={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}},Vo=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var h=f.pstyle("z-compound-depth");return h.value==="auto"?n?f.zDepth():0:h.value==="bottom"?-1:h.value==="top"?oi:0}var s=i(e)-i(r);if(s!==0)return s;function o(f){var h=f.pstyle("z-index-compare");return h.value==="auto"&&f.isNode()?1:0}var l=o(e)-o(r);if(l!==0)return l;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},Bn={forEach:function(e,r){if(ne(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=r?e.apply(r,[i,n,this]):e(i,n,this);if(s===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&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(!ne(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Vo)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:oi-1}else{var i=r.source,s=r.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};Bn.each=Bn.forEach;var Pd=function(){var e="undefined",r=(typeof Symbol=="undefined"?"undefined":q(Symbol))!=e&&q(Symbol.iterator)!=e;r&&(Bn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return E({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Pd();var Bd=St({nodeDimensionsIncludeLabels:!1}),Fn={layoutDimensions:function(e){e=Bd(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(I){return!I.isParent()}),i=this.cy(),s=r.eles,o=function(O){return O.id()},l=ut(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(O,T,k){var S={x:T.x1+T.w/2,y:T.y1+T.h/2},F={x:(k.x-S.x)*O,y:(k.y-S.y)*O};return{x:S.x+F.x,y:S.y+F.y}},f=r.spacingFactor&&r.spacingFactor!==1,h=function(){if(!f)return null;for(var O=$t(),T=0;T<n.length;T++){var k=n[T],S=l(k,T);zf(O,S.x,S.y)}return O},c=h(),v=ut(function(I,O){var T=l(I,O);if(f){var k=Math.abs(r.spacingFactor);T=u(k,c,T)}return r.transform!=null&&(T=r.transform(I,T)),T},o);if(r.animate){for(var d=0;d<n.length;d++){var g=n[d],y=v(g,d),p=r.animateFilter==null||r.animateFilter(g,d);if(p){var m=g.animation({position:y,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else g.position(y)}if(r.fit){var b=i.animation({fit:{boundingBox:s.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else if(r.zoom!==void 0&&r.pan!==void 0){var x=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(x)}e.animations.forEach(function(I){return I.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),sa.all(e.animations.map(function(I){return I.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(v),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout($e({},e,{eles:this}))}};Fn.createLayout=Fn.makeLayout=Fn.layout;function $o(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function zn(t,e){return t=Pr(t),function(a){return $o(t,e,a)}}function Gn(t,e){t=Pr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return $o(t,r,n)}}var Lt={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=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(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=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!=null?i:r?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(C(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ee(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,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 r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,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 r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function Ii(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Ri(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||Ii(i,a);var l=o.source,u=o.target;return r(l)&&(!s||Ii(l,r))&&(l===u||r(u)&&(!s||Ii(u,r)))}}}var da=zn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Lt.takesUpSpace=Gn("takesUpSpace",Ri({ok:da}));var Fd=zn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&da(t)}),zd=zn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&da(t)});Lt.interactive=Gn("interactive",Ri({ok:Fd,parentOk:zd,edgeOkViaNode:da})),Lt.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var Gd=zn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&da(t)}),Vd=da;Lt.visible=Gn("visible",Ri({ok:Gd,edgeOkViaNode:Vd})),Lt.hidden=function(){var t=this[0];if(t)return!t.visible()},Lt.isBundledBezier=Gn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Lt.bypass=Lt.css=Lt.style,Lt.renderedCss=Lt.renderedStyle,Lt.removeBypass=Lt.removeCss=Lt.removeStyle,Lt.pstyle=Lt.parsedStyle;var Nr={};function _o(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&ne(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&me(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],f=l._private[t.field]!=t.value;if(t.overrideAble){var h=t.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[t.field]=t.value,f&&r.push(l))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),s&&c.emit(s)}return this}}function ga(t){Nr[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},Nr[t.on]=_o({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),Nr[t.off]=_o({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}ga({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),ga({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),ga({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),ga({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),Nr.deselect=Nr.unselect,Nr.grabbed=function(){var t=this[0];if(t)return t._private.grabbed},ga({field:"active",on:"activate",off:"unactivate"}),ga({field:"pannable",on:"panify",off:"unpanify"}),Nr.inactive=function(){var t=this[0];if(t)return!t._private.active};var Rt={},Uo=function(e){return function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),f=0;f<u.length;f++){var h=u[f],c=h.source(),v=h.target();if(e.noIncomingEdges&&v===o&&c!==o||e.noOutgoingEdges&&c===o&&v!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(a)}},Yo=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],f=u.source(),h=u.target();e.outgoing&&f===s?(n.push(u),n.push(h)):e.incoming&&h===s&&(n.push(u),n.push(f))}}return this.spawn(n,!0).filter(r)}},Ho=function(e){return function(r){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],f=u.id();i[f]||(i[f]=!0,n.push(u),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(r)}};Rt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null},$e(Rt,{roots:Uo({noIncomingEdges:!0}),leaves:Uo({noOutgoingEdges:!0}),outgoers:Xt(Yo({outgoing:!0}),"outgoers"),successors:Ho({outgoing:!0}),incomers:Xt(Yo({incoming:!0}),"incomers"),predecessors:Ho({incoming:!0})}),$e(Rt,{neighborhood:Xt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),f=n===l?u:l;f.length>0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Rt.neighbourhood=Rt.neighborhood,Rt.closedNeighbourhood=Rt.closedNeighborhood,Rt.openNeighbourhood=Rt.openNeighborhood,$e(Rt,{source:Xt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Xt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Xo({attr:"source"}),targets:Xo({attr:"target"})});function Xo(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[t.attr];s&&a.push(s)}return this.spawn(a,!0).filter(r)}}$e(Rt,{edgesWith:Xt(qo(),"edgesWith"),edgesTo:Xt(qo({thisIsSrc:!0}),"edgesTo")});function qo(t){return function(r){var a=[],n=this._private.cy,i=t||{};ee(r)&&(r=n.$(r));for(var s=0;s<r.length;s++)for(var o=r[s]._private.edges,l=0;l<o.length;l++){var u=o[l],f=u._private.data,h=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),v=h||c;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!h||i.thisIsTgt&&!c)||a.push(u))}return this.spawn(a,!0)}}$e(Rt,{connectedEdges:Xt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:Xt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:Xt(Wo(),"parallelEdges"),codirectedEdges:Xt(Wo({codirected:!0}),"codirectedEdges")});function Wo(t){var e={codirected:!1};return t=$e({},e,t),function(a){for(var n=[],i=this.edges(),s=t,o=0;o<i.length;o++)for(var l=i[o],u=l._private,f=u.source,h=f._private.data.id,c=u.data.target,v=f._private.edges,d=0;d<v.length;d++){var g=v[d],y=g._private.data,p=y.target,m=y.source,b=p===c&&m===h,x=h===p&&c===m;(s.codirected&&b||!s.codirected&&(b||x))&&n.push(g)}return this.spawn(n,!0).filter(a)}}$e(Rt,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(f,h){n.merge(f),i.unmerge(f),h.merge(f)};if(i.empty())return r.spawn();var l=function(){var f=a.collection();s.push(f);var h=i[0];o(h,f),r.bfs({directed:!1,roots:h,visit:function(v){return o(v,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(v){r.has(v)&&f.has(v.source())&&f.has(v.target())&&f.merge(v)})})};do l();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Rt.componentsOf=Rt.components;var At=function(e,r){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){bt("A collection must have a reference to the core");return}var i=new or,s=!1;if(!r)r=[];else if(r.length>0&&C(r[0])&&!Le(r[0])){s=!0;for(var o=[],l=new jr,u=0,f=r.length;u<f;u++){var h=r[u];h.data==null&&(h.data={});var c=h.data;if(c.id==null)c.id=Ts();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var v=new yn(e,h,!1);o.push(v),l.add(c.id)}r=o}this.length=0;for(var d=0,g=r.length;d<g;d++){var y=r[d][0];if(y!=null){var p=y._private.data.id;(!a||!i.has(p))&&(a&&i.set(p,{index:this.length,ele:y}),this[this.length]=y,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,x=this.eles,I=0;I<x.length;I++){var O=x[I];b.set(O.id(),{index:I,ele:O})}}},a&&(this._private.map=i),s&&!n&&this.restore()},gt=yn.prototype=At.prototype=Object.create(Array.prototype);gt.instanceString=function(){return"collection"},gt.spawn=function(t,e){return new At(this.cy(),t,e)},gt.spawnSelf=function(){return this.spawn(this)},gt.cy=function(){return this._private.cy},gt.renderer=function(){return this._private.cy.renderer()},gt.element=function(){return this[0]},gt.collection=function(){return be(this)?this:new At(this._private.cy,[this])},gt.unique=function(){return new At(this._private.cy,this,!0)},gt.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)},gt.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new At(e)},gt.$id=gt.getElementById,gt.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index},gt.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index},gt.indexOfId=function(t){return t=""+t,this._private.map.get(t).index},gt.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(C(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),l!=null&&l!=n.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in t.data,f=t.data.parent;u&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var h=function(g,y,p){var m=t[g];m!=null&&m!==a[g]&&(m?e[y]():e[p]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:sr(a.data),position:sr(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 v=0;return a.classes.forEach(function(d){return c.classes+=v++===0?d:" "+d}),c}}},gt.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t},gt.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new yn(t,n,!1);e.push(i)}return new At(t,e)},gt.copy=gt.clone,gt.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],s=[],o,l=0,u=r.length;l<u;l++){var f=r[l];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var h,c=function(){o.splice(h,1),h--};for(h=0;h<o.length;h++){var v=o[h],d=v._private,g=d.data;if(v.clearTraversalCache(),!(!e&&!d.removed)){if(g.id===void 0)g.id=Ts();else if(N(g.id))g.id=""+g.id;else if(Ye(g.id)||!ee(g.id)){bt("Can not create element with invalid string ID `"+g.id+"`"),c();continue}else if(a.hasElementWithId(g.id)){bt("Can not create second element with ID `"+g.id+"`"),c();continue}}var y=g.id;if(v.isNode()){var p=d.position;p.x==null&&(p.x=0),p.y==null&&(p.y=0)}if(v.isEdge()){for(var m=v,b=["source","target"],x=b.length,I=!1,O=0;O<x;O++){var T=b[O],k=g[T];N(k)&&(k=g[T]=""+g[T]),k==null||k===""?(bt("Can not create edge `"+y+"` with unspecified "+T),I=!0):a.hasElementWithId(k)||(bt("Can not create edge `"+y+"` with nonexistant "+T+" `"+k+"`"),I=!0)}if(I){c();continue}var S=a.getElementById(g.source),F=a.getElementById(g.target);S.same(F)?S._private.edges.push(m):(S._private.edges.push(m),F._private.edges.push(m)),m._private.source=S,m._private.target=F}d.map=new or,d.map.set(y,{ele:v,index:0}),d.removed=!1,e&&a.addToPool(v)}for(var z=0;z<i.length;z++){var P=i[z],H=P._private.data;N(H.parent)&&(H.parent=""+H.parent);var G=H.parent,re=G!=null;if(re||P._private.parent){var X=P._private.parent?a.collection().merge(P._private.parent):a.getElementById(G);if(X.empty())H.parent=void 0;else if(X[0].removed())lt("Node added with missing parent, reference to parent removed"),H.parent=void 0,P._private.parent=null;else{for(var K=!1,ie=X;!ie.empty();){if(P.same(ie)){K=!0,H.parent=void 0;break}ie=ie.parent()}K||(X[0]._private.children.push(P),P._private.parent=X[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var fe=o.length===r.length?r:new At(a,o),ve=0;ve<fe.length;ve++){var oe=fe[ve];oe.isNode()||(oe.parallelEdges().clearTraversalCache(),oe.source().clearTraversalCache(),oe.target().clearTraversalCache())}var ce;n.hasCompoundNodes?ce=a.collection().merge(fe).merge(fe.connectedNodes()).merge(fe.parent()):ce=fe,ce.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?fe.emitAndNotify("add"):e&&fe.emit("add")}return r},gt.removed=function(){var t=this[0];return t&&t._private.removed},gt.inside=function(){var t=this[0];return t&&!t._private.removed},gt.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function s(G){for(var re=G._private.edges,X=0;X<re.length;X++)l(re[X])}function o(G){for(var re=G._private.children,X=0;X<re.length;X++)l(re[X])}function l(G){var re=n[G.id()];e&&G.removed()||re||(n[G.id()]=!0,G.isNode()?(a.push(G),s(G),o(G)):a.unshift(G))}for(var u=0,f=r.length;u<f;u++){var h=r[u];l(h)}function c(G,re){var X=G._private.edges;wr(X,re),G.clearTraversalCache()}function v(G){G.clearTraversalCache()}var d=[];d.ids={};function g(G,re){re=re[0],G=G[0];var X=G._private.children,K=G.id();wr(X,re),re._private.parent=null,d.ids[K]||(d.ids[K]=!0,d.push(G))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var y=0;y<a.length;y++){var p=a[y];if(p.isEdge()){var m=p.source()[0],b=p.target()[0];c(m,p),c(b,p);for(var x=p.parallelEdges(),I=0;I<x.length;I++){var O=x[I];v(O),O.isBundledBezier()&&O.dirtyBoundingBoxCache()}}else{var T=p.parent();T.length!==0&&g(T,p)}e&&(p._private.removed=!0)}var k=i._private.elements;i._private.hasCompoundNodes=!1;for(var S=0;S<k.length;S++){var F=k[S];if(F.isParent()){i._private.hasCompoundNodes=!0;break}}var z=new At(this.cy(),a);z.size()>0&&(t?z.emitAndNotify("remove"):e&&z.emit("remove"));for(var P=0;P<d.length;P++){var H=d[P];(!e||!H.removed())&&H.updateStyle()}return z},gt.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var s=i(t.source),o=i(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var d=r[v],g=d._private.data;d.isEdge()&&(l&&(g.source=s),u&&(g.target=o))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),h=f===null||e.hasElementWithId(f);if(h){var c=f===null?void 0:f;e.batch(function(){var v=r.remove(a,n);v.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var g=r[d],y=g._private.data;g.isNode()&&(y.parent=c)}v.restore(a,n)}),r.emitAndNotify("move")}}return this},[Qs,Jv,Nn,Lr,ha,dd,Mn,Od,zo,Go,kd,Bn,Fn,Lt,Nr,Rt].forEach(function(t){$e(gt,t)});var $d={add:function(e){var r,a=this;if(se(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}r=new At(a,i)}}else if(me(e)){var l=e;r=new At(a,l)}else if(C(e)&&(me(e.nodes)||me(e.edges))){for(var u=e,f=[],h=["nodes","edges"],c=0,v=h.length;c<v;c++){var d=h[c],g=u[d];if(me(g))for(var y=0,p=g.length;y<p;y++){var m=$e({group:d},g[y]);f.push(m)}}r=new At(a,f)}else{var b=e;r=new yn(a,b).collection()}return r},remove:function(e){if(!se(e)){if(ee(e)){var r=e;e=this.$(r)}}return e.remove()}};function _d(t,e,r,a){var n=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),f=typeof Float32Array!="undefined";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(l):new Array(l);function v(F,z){return 1-3*z+3*F}function d(F,z){return 3*z-6*F}function g(F){return 3*F}function y(F,z,P){return((v(z,P)*F+d(z,P))*F+g(z))*F}function p(F,z,P){return 3*v(z,P)*F*F+2*d(z,P)*F+g(z)}function m(F,z){for(var P=0;P<n;++P){var H=p(z,t,r);if(H===0)return z;var G=y(z,t,r)-F;z-=G/H}return z}function b(){for(var F=0;F<l;++F)c[F]=y(F*u,t,r)}function x(F,z,P){var H,G,re=0;do G=z+(P-z)/2,H=y(G,t,r)-F,H>0?P=G:z=G;while(Math.abs(H)>s&&++re<o);return G}function I(F){for(var z=0,P=1,H=l-1;P!==H&&c[P]<=F;++P)z+=u;--P;var G=(F-c[P])/(c[P+1]-c[P]),re=z+G*u,X=p(re,t,r);return X>=i?m(F,re):X===0?re:x(F,z,z+u)}var O=!1;function T(){O=!0,(t!==e||r!==a)&&b()}var k=function(z){return O||T(),t===e&&r===a?z:z===0?0:z===1?1:y(I(z),e,a)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var S="generateBezier("+[t,e,r,a]+")";return k.toString=function(){return S},k}var Ud=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,h=16/1e3,c,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(u=a(n,i),v=u/s*h):v=h;d=r(d||o,v),l.push(1+d.x),u+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(g){return l[g*(l.length-1)|0]}:u}}(),pt=function(e,r,a,n){var i=_d(e,r,a,n);return function(s,o,l){return s+(o-s)*i(l)}},Vn={linear:function(e,r,a){return e+(r-e)*a},ease:pt(.25,.1,.25,1),"ease-in":pt(.42,0,1,1),"ease-out":pt(0,0,.58,1),"ease-in-out":pt(.42,0,.58,1),"ease-in-sine":pt(.47,0,.745,.715),"ease-out-sine":pt(.39,.575,.565,1),"ease-in-out-sine":pt(.445,.05,.55,.95),"ease-in-quad":pt(.55,.085,.68,.53),"ease-out-quad":pt(.25,.46,.45,.94),"ease-in-out-quad":pt(.455,.03,.515,.955),"ease-in-cubic":pt(.55,.055,.675,.19),"ease-out-cubic":pt(.215,.61,.355,1),"ease-in-out-cubic":pt(.645,.045,.355,1),"ease-in-quart":pt(.895,.03,.685,.22),"ease-out-quart":pt(.165,.84,.44,1),"ease-in-out-quart":pt(.77,0,.175,1),"ease-in-quint":pt(.755,.05,.855,.06),"ease-out-quint":pt(.23,1,.32,1),"ease-in-out-quint":pt(.86,0,.07,1),"ease-in-expo":pt(.95,.05,.795,.035),"ease-out-expo":pt(.19,1,.22,1),"ease-in-out-expo":pt(1,0,0,1),"ease-in-circ":pt(.6,.04,.98,.335),"ease-out-circ":pt(.075,.82,.165,1),"ease-in-out-circ":pt(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Vn.linear;var n=Ud(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":pt};function Ko(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Zo(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function pa(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=Zo(t,n),o=Zo(e,n);if(N(s)&&N(o))return Ko(i,s,o,r,a);if(me(s)&&me(o)){for(var l=[],u=0;u<o.length;u++){var f=s[u],h=o[u];if(f!=null&&h!=null){var c=Ko(i,f,h,r,a);l.push(c)}else l.push(h)}return l}}function Yd(t,e,r,a){var n=!a,i=t._private,s=e._private,o=s.easing,l=s.startTime,u=a?t:t.cy(),f=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=Vn.linear;else{var h;if(ee(o)){var c=f.parse("transition-timing-function",o);h=c.value}else h=o;var v,d;ee(h)?(v=h,d=[]):(v=h[1],d=h.slice(2).map(function(fe){return+fe})),d.length>0?(v==="spring"&&d.push(s.duration),s.easingImpl=Vn[v].apply(null,d)):s.easingImpl=Vn[v]}var g=s.easingImpl,y;if(s.duration===0?y=1:y=(r-l)/s.duration,s.applying&&(y=s.progress),y<0?y=0:y>1&&(y=1),s.delay==null){var p=s.startPosition,m=s.position;if(m&&n&&!t.locked()){var b={};Xa(p.x,m.x)&&(b.x=pa(p.x,m.x,y,g)),Xa(p.y,m.y)&&(b.y=pa(p.y,m.y,y,g)),t.position(b)}var x=s.startPan,I=s.pan,O=i.pan,T=I!=null&&a;T&&(Xa(x.x,I.x)&&(O.x=pa(x.x,I.x,y,g)),Xa(x.y,I.y)&&(O.y=pa(x.y,I.y,y,g)),t.emit("pan"));var k=s.startZoom,S=s.zoom,F=S!=null&&a;F&&(Xa(k,S)&&(i.zoom=ka(i.minZoom,pa(k,S,y,g),i.maxZoom)),t.emit("zoom")),(T||F)&&t.emit("viewport");var z=s.style;if(z&&z.length>0&&n){for(var P=0;P<z.length;P++){var H=z[P],G=H.name,re=H,X=s.startStyle[G],K=f.properties[X.name],ie=pa(X,re,y,g,K);f.overrideBypass(t,G,ie)}t.emit("style")}}return s.progress=y,y}function Xa(t,e){return t==null||e==null?!1:N(t)&&N(e)?!0:!!(t&&e)}function Hd(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Qo(t,e){var r=e._private.aniEles,a=[];function n(f,h){var c=f._private,v=c.animation.current,d=c.animation.queue,g=!1;if(v.length===0){var y=d.shift();y&&v.push(y)}for(var p=function(O){for(var T=O.length-1;T>=0;T--){var k=O[T];k()}O.splice(0,O.length)},m=v.length-1;m>=0;m--){var b=v[m],x=b._private;if(x.stopped){v.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.frames);continue}!x.playing&&!x.applying||(x.playing&&x.applying&&(x.applying=!1),x.started||Hd(f,b,t),Yd(f,b,t,h),x.applying&&(x.applying=!1),p(x.frames),x.step!=null&&x.step(t),b.completed()&&(v.splice(m,1),x.hooked=!1,x.playing=!1,x.started=!1,p(x.completes)),g=!0)}return!h&&v.length===0&&d.length===0&&a.push(f),g}for(var i=!1,s=0;s<r.length;s++){var o=r[s],l=n(o);i=i||l}var u=n(e,!0);(i||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Xd={animate:ft.animate(),animation:ft.animation(),animated:ft.animated(),clearQueue:ft.clearQueue(),delay:ft.delay(),delayAnimation:ft.delayAnimation(),stop:ft.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&dn(function(i){Qo(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Qo(s,e)},a.beforeRenderPriorities.animations):r()}},qd={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Le(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},$n=function(e){return ee(e)?new Dr(e):e},Jo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new kn(qd,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,$n(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,$n(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,$n(r),a),this},once:function(e,r,a){return this.emitter().one(e,$n(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};ft.eventAliasesOn(Jo);var ki={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};ki.jpeg=ki.jpg;var _n={layout:function(e){var r=this;if(e==null){bt("Layout options must be specified to make a layout");return}if(e.name==null){bt("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){bt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ee(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n($e({},e,{cy:r,eles:i}));return s}};_n.createLayout=_n.makeLayout=_n.layout;var Wd={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.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 r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i],o=r.getElementById(i);o.data(s)}})}},Kd=St({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),Pi={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,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 r=this,a=r.extension("renderer",e.name);if(a==null){bt("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&&lt("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=Kd(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.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)}};Pi.invalidateDimensions=Pi.resize;var Un={collection:function(e,r){return ee(e)?this.$(e):se(e)?e.collection():me(e)?(r||(r={}),new At(this,e,r.unique,r.removed)):new At(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Un.elements=Un.filter=Un.$;var kt={},qa="t",Zd="f";kt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var s=t[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n},kt.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},l=0;l<r.length;l++){var u=r[l],f=t[l]===qa,h=e[l]===qa,c=f!==h,v=u.mappedProperties.length>0;if(c||h&&v){var d=void 0;c&&v||c?d=u.properties:v&&(d=u.mappedProperties);for(var g=0;g<d.length;g++){for(var y=d[g],p=y.name,m=!1,b=l+1;b<r.length;b++){var x=r[b],I=e[b]===qa;if(I&&(m=x.properties[y.name]!=null,m))break}!o[p]&&!m&&(o[p]=!0,s.push(p))}}}return a[n]=s,s},kt.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(t);o?r+=qa:r+=Zd}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}},kt.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var s=r[i],o=e[i]===qa;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];n[u.name]=u}}return a[e]=n,n},kt.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var l=n[o],u=e[l],f=r.pstyle(l);if(!u)if(f)f.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(f!==u){if(u.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===u.value){var h=f.mapping,c=h.fnValue=u.value(r);if(c===h.prevFnValue)continue}var v=i[l]={prev:f};a.applyParsedProperty(r,u),v.next=r.pstyle(l),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}},kt.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(Ae,Ne,Ue){return r.getPropertiesHash(Ae,Ne,Ue)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var f=n[u];e.styleKeys[f]=[Jr,Oa]}for(var h=function(Ae,Ne){return e.styleKeys[Ne][0]=Na(Ae,e.styleKeys[Ne][0])},c=function(Ae,Ne){return e.styleKeys[Ne][1]=Ma(Ae,e.styleKeys[Ne][1])},v=function(Ae,Ne){h(Ae,Ne),c(Ae,Ne)},d=function(Ae,Ne){for(var Ue=0;Ue<Ae.length;Ue++){var He=Ae.charCodeAt(Ue);h(He,Ne),c(He,Ne)}},g=2e9,y=function(Ae){return-128<Ae&&Ae<128&&Math.floor(Ae)!==Ae?g-(Ae*1024|0):Ae},p=0;p<a.length;p++){var m=a[p],b=l[m];if(b!=null){var x=this.properties[m],I=x.type,O=x.groupKey,T=void 0;x.hashOverride!=null?T=x.hashOverride(t,b):b.pfValue!=null&&(T=b.pfValue);var k=x.enums==null?b.value:null,S=T!=null,F=k!=null,z=S||F,P=b.units;if(I.number&&z&&!I.multiple){var H=S?T:k;v(y(H),O),!S&&P!=null&&d(P,O)}else d(b.strValue,O)}}for(var G=[Jr,Oa],re=0;re<n.length;re++){var X=n[re],K=e.styleKeys[X];G[0]=Na(K[0],G[0]),G[1]=Ma(K[1],G[1])}e.styleKey=tf(G[0],G[1]);var ie=e.styleKeys;e.labelDimsKey=Er(ie.labelDimensions);var fe=i(t,["label"],ie.labelDimensions);if(e.labelKey=Er(fe),e.labelStyleKey=Er(gn(ie.commonLabel,fe)),!o){var ve=i(t,["source-label"],ie.labelDimensions);e.sourceLabelKey=Er(ve),e.sourceLabelStyleKey=Er(gn(ie.commonLabel,ve));var oe=i(t,["target-label"],ie.labelDimensions);e.targetLabelKey=Er(oe),e.targetLabelStyleKey=Er(gn(ie.commonLabel,oe))}if(o){var ce=e.styleKeys,Ee=ce.nodeBody,xe=ce.nodeBorder,ye=ce.backgroundImage,de=ce.compound,ae=ce.pie,we=[Ee,xe,ye,de,ae].filter(function(Te){return Te!=null}).reduce(gn,[Jr,Oa]);e.nodeKey=Er(we),e.hasPie=ae!=null&&ae[0]!==Jr&&ae[1]!==Oa}return s!==e.styleKey},kt.clearStyleHints=function(t){var e=t._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},kt.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,s=r.types,o=r.properties[a.name].type,l=a.bypass,u=n[a.name],f=u&&u.bypass,h=t._private,c="mapping",v=function(Ee){return Ee==null?null:Ee.pfValue!=null?Ee.pfValue:Ee.value},d=function(){var Ee=v(u),xe=v(a);r.checkTriggers(t,a.name,Ee,xe)};if(a&&a.name.substr(0,3)==="pie"&&lt("The pie style properties are deprecated. Create charts using background images instead."),e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.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 g=function(){lt("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.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 s.mapData:{for(var y=a.field.split("."),p=h.data,m=0;m<y.length&&p;m++){var b=y[m];p=p[b]}if(p==null)return g(),!1;var x;if(N(p)){var I=a.fieldMax-a.fieldMin;I===0?x=0:x=(p-a.fieldMin)/I}else return lt("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+p+"` for `"+t.id()+"` is non-numeric)"),!1;if(x<0?x=0:x>1&&(x=1),o.color){var O=a.valueMin[0],T=a.valueMax[0],k=a.valueMin[1],S=a.valueMax[1],F=a.valueMin[2],z=a.valueMax[2],P=a.valueMin[3]==null?1:a.valueMin[3],H=a.valueMax[3]==null?1:a.valueMax[3],G=[Math.round(O+(T-O)*x),Math.round(k+(S-k)*x),Math.round(F+(z-F)*x),Math.round(P+(H-P)*x)];i={bypass:a.bypass,name:a.name,value:G,strValue:"rgb("+G[0]+", "+G[1]+", "+G[2]+")"}}else if(o.number){var re=a.valueMin+(a.valueMax-a.valueMin)*x;i=this.parse(a.name,re,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case s.data:{for(var X=a.field.split("."),K=h.data,ie=0;ie<X.length&&K;ie++){var fe=X[ie];K=K[fe]}if(K!=null&&(i=this.parse(a.name,K,a.bypass,c)),!i)return g(),!1;i.mapping=a,a=i;break}case s.fn:{var ve=a.value,oe=a.fnValue!=null?a.fnValue:ve(t);if(a.prevFnValue=oe,oe==null)return lt("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,oe,a.bypass,c),!i)return lt("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=sr(a),a=i;break}case void 0:break;default:return!1}return l?(f?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):f?u.bypassed=a:n[a.name]=a,d(),!0},kt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],l=n[o];l!=null&&(l.bypass?l.bypassed=null:n[o]=null)}}},kt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()},kt.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},l=!1,u=0;u<n.length;u++){var f=n[u],h=t.pstyle(f),c=e[f];if(c){var v=c.prev,d=v,g=c.next!=null?c.next:h,y=!1,p=void 0,m=1e-6;d&&(N(d.pfValue)&&N(g.pfValue)?(y=g.pfValue-d.pfValue,p=d.pfValue+m*y):N(d.value)&&N(g.value)?(y=g.value-d.value,p=d.value+m*y):me(d.value)&&me(g.value)&&(y=d.value[0]!==g.value[0]||d.value[1]!==g.value[1]||d.value[2]!==g.value[2],p=d.strValue),y&&(o[f]=g.strValue,this.applyBypass(t,f,p),l=!0))}}if(!l)return;a.transitioning=!0,new sa(function(b){s>0?t.delayAnimation(s).play().promise().then(b):b()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)},kt.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)},kt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})},kt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&(e==="curve-style"&&(r==="bezier"||a==="bezier")||e==="display"&&(r==="none"||a==="none"))&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()})})},kt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Wa={};Wa.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;o<n.properties.length;o++){var l=n.properties[o],u=l.name,f=this.parse(u,r,!0);f&&i.push(f)}}else if(ee(e)){var h=this.parse(e,r,!0);h&&i.push(h)}else if(C(e)){var c=e;a=r;for(var v=Object.keys(c),d=0;d<v.length;d++){var g=v[d],y=c[g];if(y===void 0&&(y=c[Tt(g)]),y!==void 0){var p=this.parse(g,y,!0);p&&i.push(p)}}}else return!1;if(i.length===0)return!1;for(var m=!1,b=0;b<t.length;b++){for(var x=t[b],I={},O=void 0,T=0;T<i.length;T++){var k=i[T];if(a){var S=x.pstyle(k.name);O=I[k.name]={prev:S}}m=this.applyParsedProperty(x,sr(k))||m,a&&(O.next=x.pstyle(k.name))}m&&this.updateStyleHints(x),a&&this.updateTransitions(x,I,s)}return m},Wa.overrideBypass=function(t,e,r){e=tt(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),o?i.strValue="rgb("+r.join(",")+")":l?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,u,r)}},Wa.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)},Wa.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],f=i.pstyle(u.name);if(!(!f||!f.bypass)){var h="",c=this.parse(l,h,!0),v=s[u.name]={prev:f};this.applyParsedProperty(i,c),v.next=i.pstyle(u.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,s,a)}};var Bi={};Bi.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1},Bi.containerCss=function(t){var e=this._private.cy,r=e.container();if(D&&r&&D.getComputedStyle)return D.getComputedStyle(r).getPropertyValue(t)};var ur={};ur.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)},ur.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],s=r.getStylePropertyValue(t,i.name,e);s!=null&&(a[i.name]=s,a[Tt(i.name)]=s)}return a}},ur.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n!=null?n:t.cy().style().getDefaultProperty(e)[r][0]},ur.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=t.pstyle(n.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(r&&i.number&&o!=null&&N(o)){var f=t.cy().zoom(),h=function(y){return y*f},c=function(y,p){return h(y)+p},v=me(o),d=v?l.every(function(g){return g!=null}):l!=null;return d?v?o.map(function(g,y){return c(g,l[y])}).join(" "):c(o,l):v?o.map(function(g){return ee(g)?g:""+h(g)}).join(" "):""+h(o)}else if(u!=null)return u}return null}},ur.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=t.pstyle(i);s!==void 0&&(C(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(r[i]=s)}return r},ur.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o],u=n[o]||n[tt(o)],f=this.parse(u.name,l);f&&r.push(f)}return r},ur.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,s,o,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=Na(o,a[0]),a[1]=Ma(o,a[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),a[0]=Na(o,a[0]),a[1]=Ma(o,a[1]);return a},ur.getPropertiesHash=ur.getNonDefaultPropertiesHash;var Yn={};Yn.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e},Yn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e},Yn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var Fi={};Fi.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){lt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new Dr(h);if(c.invalid){lt("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var v=f[2],d=!1;i=v;for(var g=[];;){var y=i.match(/^\s*$/);if(y)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){lt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=p[0];var m=p[1],b=p[2],x=e.properties[m];if(!x){lt("Skipping property: Invalid property name in: "+s),l();continue}var I=r.parse(m,b);if(!I){lt("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:m,val:b}),l()}if(d){o();break}r.selector(h);for(var O=0;O<g.length;O++){var T=g[O];r.css(T.name,T.val)}o()}return r},Fi.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Ot={};(function(){var t=Ke,e=Zt,r=Qt,a=hn,n=Kr,i=function(we){return"^"+we+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(we){var Te=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+we+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+Te+")\\s*\\,\\s*("+Te+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ot.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},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"],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"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},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","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},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"]},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:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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"]},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(we,Te){switch(we.length){case 2:return Te[0]!=="deg"&&Te[0]!=="rad"&&Te[1]!=="deg"&&Te[1]!=="rad";case 1:return ee(we[0])||Te[0]==="deg"||Te[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\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(we){var Te=we.length;return Te===1||Te===2||Te===4}}};var l={zeroNonZero:function(we,Te){return(we==null||Te==null)&&we!==Te||we==0&&Te!=0?!0:we!=0&&Te==0},any:function(we,Te){return we!=Te},emptyNonEmpty:function(we,Te){var Ae=Ye(we),Ne=Ye(Te);return Ae&&!Ne||!Ae&&Ne}},u=Ot.types,f=[{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}],h=[{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}],v=[{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}],g=[{name:"events",type:u.bool},{name:"text-events",type:u.bool}],y=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!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.nonNegativeInt,triggersZOrder:l.any}],p=[{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}],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}],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}],x=function(we,Te){return Te.value==="label"?-we.poolIndex():Te.pfValue},I=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:x},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{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}],O=[{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}],T=[{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}],k=[{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}],S=[{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-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:"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:"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}],F=[{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}],z=[{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}],P=[];Ot.pieBackgroundN=16,P.push({name:"pie-size",type:u.sizeMaybePercent});for(var H=1;H<=Ot.pieBackgroundN;H++)P.push({name:"pie-"+H+"-background-color",type:u.color}),P.push({name:"pie-"+H+"-background-size",type:u.percent}),P.push({name:"pie-"+H+"-background-opacity",type:u.zeroOneNumber});var G=[],re=Ot.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}].forEach(function(ae){re.forEach(function(we){var Te=we+"-"+ae.name,Ae=ae.type,Ne=ae.triggersBounds;G.push({name:Te,type:Ae,triggersBounds:Ne})})},{});var X=Ot.properties=[].concat(g,b,y,p,m,F,d,v,f,h,c,I,O,T,P,k,S,G,z),K=Ot.propertyGroups={behavior:g,transition:b,visibility:y,overlay:p,underlay:m,ghost:F,commonLabel:d,labelDimensions:v,mainLabel:f,sourceLabel:h,targetLabel:c,nodeBody:I,nodeBorder:O,backgroundImage:T,pie:P,compound:k,edgeLine:S,edgeArrow:G,core:z},ie=Ot.propertyGroupNames={},fe=Ot.propertyGroupKeys=Object.keys(K);fe.forEach(function(ae){ie[ae]=K[ae].map(function(we){return we.name}),K[ae].forEach(function(we){return we.groupKey=ae})});var ve=Ot.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{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"}];Ot.propertyNames=X.map(function(ae){return ae.name});for(var oe=0;oe<X.length;oe++){var ce=X[oe];X[ce.name]=ce}for(var Ee=0;Ee<ve.length;Ee++){var xe=ve[Ee],ye=X[xe.pointsTo],de={name:xe.name,alias:!0,pointsTo:ye};X.push(de),X[xe.name]=de}})(),Ot.getDefaultProperty=function(t){return this.getDefaultProperties()[t]},Ot.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=$e({"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","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","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",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","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 f=1;f<=Ot.pieBackgroundN;f++){var h=u.name.replace("{{i}}",f),c=u.value;l[h]=c}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"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,"taxi-turn":"50%","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"}].reduce(function(l,u){return Ot.arrowPrefixes.forEach(function(f){var h=f+"-"+u.name,c=u.value;l[h]=c}),l},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);r[i]=o}}return t.defaultProperties=r,t.defaultProperties},Ot.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 Hn={};Hn.parse=function(t,e,r,a){var n=this;if(ne(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=r?"t":"f",o=""+e,l=ms(t,o,s,i),u=n.propCache=n.propCache||[],f;return(f=u[l])||(f=u[l]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=sr(f),f&&(f.value=sr(f.value))),f},Hn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&lt("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&lt("The style value of `label` is deprecated for `"+n.name+"`"),n},Hn.parseImpl=function(t,e,r,a){var n=this;t=tt(t);var i=n.properties[t],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var l=ee(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(ne(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:r};var f,h;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var c=o.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(t,h[4]);if(!d||d.mapped)return!1;var g=this.parse(t,h[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return lt("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(u.color){var y=d.value,p=g.value,m=y[0]===p[0]&&y[1]===p[1]&&y[2]===p[2]&&(y[3]===p[3]||(y[3]==null||y[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:t,value:h,strValue:""+e,mapped:v,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:d.value,valueMax:g.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):me(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var x=[],I=[],O=[],T="",k=!1,S=0;S<b.length;S++){var F=n.parse(t,b[S],r,"multiple");k=k||ee(F.value),x.push(F.value),O.push(F.pfValue!=null?F.pfValue:F.value),I.push(F.units),T+=(S>0?" ":"")+F.strValue}return u.validate&&!u.validate(x,I)?null:u.singleEnum&&k?x.length===1&&ee(x[0])?{name:t,value:x[0],strValue:x[0],bypass:r}:null:{name:t,value:x,pfValue:O,strValue:T,bypass:r,units:I}}var z=function(){for(var Te=0;Te<u.enums.length;Te++){var Ae=u.enums[Te];if(Ae===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var P,H="px";if(u.units&&(P=u.units),u.implicitUnits&&(H=u.implicitUnits),!u.unitless)if(l){var G="px|em"+(u.allowPercent?"|\\%":"");P&&(G=P);var re=e.match("^("+Ke+")("+G+")?$");re&&(e=re[1],P=re[2]||H)}else(!P||u.implicitUnits)&&(P=H);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,z();if(u.integer&&!Z(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 X={name:t,value:e,strValue:""+e+(P||""),units:P,bypass:r};return u.unitless||P!=="px"&&P!=="em"?X.pfValue=e:X.pfValue=P==="px"||!P?e:this.getEmSizeInPixels()*e,(P==="ms"||P==="s")&&(X.pfValue=P==="ms"?e:1e3*e),(P==="deg"||P==="rad")&&(X.pfValue=P==="rad"?e:If(e)),P==="%"&&(X.pfValue=e/100),X}else if(u.propList){var K=[],ie=""+e;if(ie!=="none"){for(var fe=ie.split(/\s*,\s*|\s+/),ve=0;ve<fe.length;ve++){var oe=fe[ve].trim();n.properties[oe]?K.push(oe):lt("`"+oe+"` is not a valid property name")}if(K.length===0)return null}return{name:t,value:K,strValue:K.length===0?"none":K.join(" "),bypass:r}}else if(u.color){var ce=dl(e);return ce?{name:t,value:ce,pfValue:ce,strValue:"rgb("+ce[0]+","+ce[1]+","+ce[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var Ee=z();if(Ee)return Ee}for(var xe=u.regexes?u.regexes:[u.regex],ye=0;ye<xe.length;ye++){var de=new RegExp(xe[ye]),ae=de.exec(e);if(ae)return{name:t,value:u.singleRegexMatchValue?ae[1]:ae,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?z():null};var Pt=function t(e){if(!(this instanceof t))return new t(e);if(!Ge(e)){bt("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},Bt=Pt.prototype;Bt.instanceString=function(){return"style"},Bt.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this},Bt.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Bt.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)},Bt.selector=function(t){var e=t==="core"?null:new Dr(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this},Bt.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[Tt(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this},Bt.style=Bt.css,Bt.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this},Bt.append=function(t){return et(t)?t.appendToStyle(this):me(t)?this.appendFromJson(t):ee(t)&&this.appendFromString(t),this},Pt.fromJson=function(t,e){var r=new Pt(t);return r.fromJson(e),r},Pt.fromString=function(t,e){return new Pt(t).fromString(e)},[kt,Wa,Bi,ur,Yn,Fi,Ot,Hn].forEach(function(t){$e(Bt,t)}),Pt.types=Bt.types,Pt.properties=Bt.properties,Pt.propertyGroups=Bt.propertyGroups,Pt.propertyGroupNames=Bt.propertyGroupNames,Pt.propertyGroupKeys=Bt.propertyGroupKeys;var Qd={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return et(e)?r.style=e.generateStyle(this):me(e)?r.style=Pt.fromJson(this,e):ee(e)?r.style=Pt.fromString(this,e):r.style=Pt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Jd="single",$r={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 r=this._private;if(r.selectionType==null&&(r.selectionType=Jd),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.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,r=this._private.pan,a,n,i,s,o;switch(e.length){case 0:return r;case 1:if(ee(e[0]))return a=e[0],r[a];if(C(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,N(s)&&(r.x=s),N(o)&&(r.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&N(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,s,o,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:C(e)&&(o=a[0],l=o.x,u=o.y,N(l)&&(n.x+=l),N(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,s=r,(i==="x"||i==="y")&&N(s)&&(n[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,r){var a=this.getFitViewport(e,r);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,r){if(N(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(ee(e)){var n=e;e=this.$(n)}else if(ze(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 se(e)||(e=this.mutableElements());if(!(se(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),l;if(r=N(r)?r:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*r)/a.w,(o-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(s-l*(a.x1+a.x2))/2,y:(o-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return N(e)&&N(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):N(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:N(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),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 r=this._private,a=r.pan,n=r.zoom,i,s,o=!1;if(r.zoomingEnabled||(o=!0),N(e)?s=e:C(e)&&(s=e.level,e.position!=null?i=mn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,o||!N(s)||s===n||i!=null&&(!N(i.x)||!N(i.y)))return null;if(i!=null){var l=a,u=n,f=s,h={x:-f/u*(i.x-l.x)+i.x,y:-f/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:h}}else return{zoomed:!0,panned:!1,zoom:s,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(N(e.zoom)||(a=!1),C(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;N(u.x)&&(r.pan.x=u.x,o=!1),N(u.y)&&(r.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ee(e)){var a=e;e=this.mutableElements().filter(a)}else se(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container;return e.sizeCache=e.sizeCache||(r?function(){var a=D.getComputedStyle(r),n=function(s){return parseFloat(a.getPropertyValue(s))};return{width:r.clientWidth-n("padding-left")-n("padding-right"),height:r.clientHeight-n("padding-top")-n("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};$r.centre=$r.center,$r.autolockNodes=$r.autolock,$r.autoungrabifyNodes=$r.autoungrabify;var Ka={data:ft.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ft.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ft.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ft.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Ka.attr=Ka.data,Ka.removeAttr=Ka.removeData;var Za=function(e){var r=this;e=$e({},e);var a=e.container;a&&!ue(a)&&ue(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=r;var s=D!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=$e({name:s?"grid":"null"},o.layout),o.renderer=$e({name:s?"canvas":"null"},o.renderer);var l=function(d,g,y){return g!==void 0?g:y!==void 0?y:d},u=this._private={container:a,ready:!1,options:o,elements:new At(this),listeners:[],aniEles:new At(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:N(o.zoom)?o.zoom:1,pan:{x:C(o.pan)&&N(o.pan.x)?o.pan.x:0,y:C(o.pan)&&N(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,g){var y=d.some(Je);if(y)return sa.all(d).then(g);g(d)};u.styleEnabled&&r.setStyle([]);var h=$e({},o,o.renderer);r.initRenderer(h);var c=function(d,g,y){r.notifications(!1);var p=r.mutableElements();p.length>0&&p.remove(),d!=null&&(C(d)||me(d))&&r.add(d),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",y),r.emit("done")});var m=$e({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([o.style,o.elements],function(v){var d=v[0],g=v[1];u.styleEnabled&&r.style().append(d),c(g,function(){r.startAnimationLoop(),u.ready=!0,ne(o.ready)&&r.on("ready",o.ready);for(var y=0;y<i.length;y++){var p=i[y];r.on("ready",p)}n&&(n.readies=[]),r.emit("ready")},o.done)})},Xn=Za.prototype;$e(Xn,{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},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!ue(e)&&ue(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer($e({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return sr(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(x){return r.getElementById(x.id())};if(C(e)){if(r.startBatch(),e.elements){var s={},o=function(x,I){for(var O=[],T=[],k=0;k<x.length;k++){var S=x[k];if(!S.data.id){lt("cy.json() cannot handle elements without an ID attribute");continue}var F=""+S.data.id,z=r.getElementById(F);s[F]=!0,z.length!==0?T.push({ele:z,json:S}):(I&&(S.group=I),O.push(S))}r.add(O);for(var P=0;P<T.length;P++){var H=T[P],G=H.ele,re=H.json;G.json(re)}};if(me(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var f=l[u],h=e.elements[f];me(h)&&o(h,f)}var c=r.collection();n.filter(function(b){return!s[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&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<v.length;d++){var g=v[d];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var y=!!e,p={};y?p.elements=this.elements().map(function(b){return b.json()}):(p.elements={},n.forEach(function(b){var x=b.group();p.elements[x]||(p.elements[x]=[]),p.elements[x].push(b.json())})),this._private.styleEnabled&&(p.style=r.style().json()),p.data=sr(r.data());var m=a.options;return p.zoomingEnabled=a.zoomingEnabled,p.userZoomingEnabled=a.userZoomingEnabled,p.zoom=a.zoom,p.minZoom=a.minZoom,p.maxZoom=a.maxZoom,p.panningEnabled=a.panningEnabled,p.userPanningEnabled=a.userPanningEnabled,p.pan=sr(a.pan),p.boxSelectionEnabled=a.boxSelectionEnabled,p.renderer=sr(m.renderer),p.hideEdgesOnViewport=m.hideEdgesOnViewport,p.textureOnViewport=m.textureOnViewport,p.wheelSensitivity=m.wheelSensitivity,p.motionBlur=m.motionBlur,p.multiClickDebounceTime=m.multiClickDebounceTime,p}}}),Xn.$id=Xn.getElementById,[$d,Xd,Jo,ki,_n,Wd,Pi,Un,Qd,$r,Ka].forEach(function(t){$e(Xn,t)});var jd={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,maximal:!1,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},ya=function(e){return e.scratch("breadthfirst")},jo=function(e,r){return e.scratch("breadthfirst",r)};function eu(t){this.options=$e({},jd,t)}eu.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().filter(function(Me){return!Me.isParent()}),i=a,s=e.directed,o=e.maximal||e.maximalAdjustments>0,l=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(se(e.roots))u=e.roots;else if(me(e.roots)){for(var f=[],h=0;h<e.roots.length;h++){var c=e.roots[h],v=r.getElementById(c);f.push(v)}u=r.collection(f)}else if(ee(e.roots))u=r.$(e.roots);else if(s)u=n.roots();else{var d=a.components();u=r.collection();for(var g=function(Oe){var Ve=d[Oe],ke=Ve.maxDegree(!1),Ie=Ve.filter(function(Be){return Be.degree(!1)===ke});u=u.add(Ie)},y=0;y<d.length;y++)g(y)}var p=[],m={},b=function(Oe,Ve){p[Ve]==null&&(p[Ve]=[]);var ke=p[Ve].length;p[Ve].push(Oe),jo(Oe,{index:ke,depth:Ve})},x=function(Oe,Ve){var ke=ya(Oe),Ie=ke.depth,Be=ke.index;p[Ie][Be]=null,b(Oe,Ve)};i.bfs({roots:u,directed:e.directed,visit:function(Oe,Ve,ke,Ie,Be){var je=Oe[0],Xe=je.id();b(je,Be),m[Xe]=!0}});for(var I=[],O=0;O<n.length;O++){var T=n[O];m[T.id()]||I.push(T)}var k=function(Oe){for(var Ve=p[Oe],ke=0;ke<Ve.length;ke++){var Ie=Ve[ke];if(Ie==null){Ve.splice(ke,1),ke--;continue}jo(Ie,{depth:Oe,index:ke})}},S=function(){for(var Oe=0;Oe<p.length;Oe++)k(Oe)},F=function(Oe,Ve){for(var ke=ya(Oe),Ie=Oe.incomers().filter(function(M){return M.isNode()&&a.has(M)}),Be=-1,je=Oe.id(),Xe=0;Xe<Ie.length;Xe++){var _e=Ie[Xe],De=ya(_e);Be=Math.max(Be,De.depth)}return ke.depth<=Be?Ve[je]?null:(x(Oe,Be+1),Ve[je]=!0,!0):!1};if(s&&o){var z=[],P={},H=function(Oe){return z.push(Oe)},G=function(){return z.shift()};for(n.forEach(function(Me){return z.push(Me)});z.length>0;){var re=G(),X=F(re,P);if(X)re.outgoers().filter(function(Me){return Me.isNode()&&a.has(Me)}).forEach(H);else if(X===null){lt("Detected double maximal shift for node `"+re.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}S();var K=0;if(e.avoidOverlap)for(var ie=0;ie<n.length;ie++){var fe=n[ie],ve=fe.layoutDimensions(e),oe=ve.w,ce=ve.h;K=Math.max(K,oe,ce)}var Ee={},xe=function(Oe){if(Ee[Oe.id()])return Ee[Oe.id()];for(var Ve=ya(Oe).depth,ke=Oe.neighborhood(),Ie=0,Be=0,je=0;je<ke.length;je++){var Xe=ke[je];if(!(Xe.isEdge()||Xe.isParent()||!n.has(Xe))){var _e=ya(Xe);if(_e!=null){var De=_e.index,M=_e.depth;if(!(De==null||M==null)){var he=p[M].length;M<Ve&&(Ie+=De/he,Be++)}}}}return Be=Math.max(1,Be),Ie=Ie/Be,Be===0&&(Ie=0),Ee[Oe.id()]=Ie,Ie},ye=function(Oe,Ve){var ke=xe(Oe),Ie=xe(Ve),Be=ke-Ie;return Be===0?Zr(Oe.id(),Ve.id()):Be};e.depthSort!==void 0&&(ye=e.depthSort);for(var de=0;de<p.length;de++)p[de].sort(ye),k(de);for(var ae=[],we=0;we<I.length;we++)ae.push(I[we]);p.unshift(ae),S();for(var Te=0,Ae=0;Ae<p.length;Ae++)Te=Math.max(p[Ae].length,Te);var Ne={x:l.x1+l.w/2,y:l.x1+l.h/2},Ue=p.reduce(function(Me,Oe){return Math.max(Me,Oe.length)},0),He=function(Oe){var Ve=ya(Oe),ke=Ve.depth,Ie=Ve.index,Be=p[ke].length,je=Math.max(l.w/((e.grid?Ue:Be)+1),K),Xe=Math.max(l.h/(p.length+1),K),_e=Math.min(l.w/2/p.length,l.h/2/p.length);if(_e=Math.max(_e,K),e.circle){var M=_e*ke+_e-(p.length>0&&p[0].length<=3?_e/2:0),he=2*Math.PI/p[ke].length*Ie;return ke===0&&p[0].length===1&&(M=1),{x:Ne.x+M*Math.cos(he),y:Ne.y+M*Math.sin(he)}}else{var De={x:Ne.x+(Ie+1-(Be+1)/2)*je,y:(ke+1)*Xe};return De}};return a.nodes().layoutPositions(this,e,He),this};var eg={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function tu(t){this.options=$e({},eg,t)}tu.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,h=0,c=0;c<i.length;c++){var v=i[c],d=v.layoutDimensions(e),g=d.w,y=d.h;h=Math.max(h,g,y)}if(N(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-h,i.length>1&&e.avoidOverlap){h*=1.75;var p=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(h*h/(p*p+m*m));f=Math.max(b,f)}var x=function(O,T){var k=e.startAngle+T*u*(n?1:-1),S=f*Math.cos(k),F=f*Math.sin(k),z={x:o.x+S,y:o.y+F};return z};return a.nodes().layoutPositions(this,e,x),this};var tg={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function ru(t){this.options=$e({},tg,t)}ru.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),s=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f<i.length;f++){var h=i[f],c=void 0;c=e.concentric(h),l.push({value:c,node:h}),h._private.scratch.concentric=c}i.updateStyle();for(var v=0;v<i.length;v++){var d=i[v],g=d.layoutDimensions(e);u=Math.max(u,g.w,g.h)}l.sort(function(Me,Oe){return Oe.value-Me.value});for(var y=e.levelWidth(i),p=[[]],m=p[0],b=0;b<l.length;b++){var x=l[b];if(m.length>0){var I=Math.abs(m[0].value-x.value);I>=y&&(m=[],p.push(m))}m.push(x)}var O=u+e.minNodeSpacing;if(!e.avoidOverlap){var T=p.length>0&&p[0].length>1,k=Math.min(s.w,s.h)/2-O,S=k/(p.length+T?1:0);O=Math.min(O,S)}for(var F=0,z=0;z<p.length;z++){var P=p[z],H=e.sweep===void 0?2*Math.PI-2*Math.PI/P.length:e.sweep,G=P.dTheta=H/Math.max(1,P.length-1);if(P.length>1&&e.avoidOverlap){var re=Math.cos(G)-Math.cos(0),X=Math.sin(G)-Math.sin(0),K=Math.sqrt(O*O/(re*re+X*X));F=Math.max(K,F)}P.r=F,F+=O}if(e.equidistant){for(var ie=0,fe=0,ve=0;ve<p.length;ve++){var oe=p[ve],ce=oe.r-fe;ie=Math.max(ie,ce)}fe=0;for(var Ee=0;Ee<p.length;Ee++){var xe=p[Ee];Ee===0&&(fe=xe.r),xe.r=fe,fe+=ie}}for(var ye={},de=0;de<p.length;de++)for(var ae=p[de],we=ae.dTheta,Te=ae.r,Ae=0;Ae<ae.length;Ae++){var Ne=ae[Ae],Ue=e.startAngle+(r?1:-1)*we*Ae,He={x:o.x+Te*Math.cos(Ue),y:o.y+Te*Math.sin(Ue)};ye[Ne.node.id()]=He}return n.nodes().layoutPositions(this,e,function(Me){var Oe=Me.id();return ye[Oe]}),this};var zi,rg={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){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 qn(t){this.options=$e({},rg,t),this.options.layout=this}qn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?zi=!0:zi=!1;var a=ag(e,r,t);zi&&sg(a),t.randomize&&og(a);var n=cr(),i=function(){ug(a,e,t),t.fit===!0&&e.fit(t.padding)},s=function(c){return!(r.stopped||c>=t.numIter||(lg(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),v=au(a,t,c);c.layoutPositions(r,t,v)}},l=0,u=!0;if(t.animate===!0){var f=function h(){for(var c=0;u&&c<t.refresh;)u=s(l),l++,c++;if(!u)iu(a,t),o();else{var v=cr();v-n>=t.animationThreshold&&i(),dn(h)}};f()}else{for(;u;)u=s(l),l++;iu(a,t),o()}return this},qn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},qn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ag=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:$t(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=a.eles.components(),l={},u=0;u<o.length;u++)for(var f=o[u],h=0;h<f.length;h++){var c=f[h];l[c.id()]=u}for(var u=0;u<s.nodeSize;u++){var v=i[u],d=v.layoutDimensions(a),g={};g.isLocked=v.locked(),g.id=v.data("id"),g.parentId=v.data("parent"),g.cmptId=l[v.id()],g.children=[],g.positionX=v.position("x"),g.positionY=v.position("y"),g.offsetX=0,g.offsetY=0,g.height=d.w,g.width=d.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(v.style("padding")),g.padRight=parseFloat(v.style("padding")),g.padTop=parseFloat(v.style("padding")),g.padBottom=parseFloat(v.style("padding")),g.nodeRepulsion=ne(a.nodeRepulsion)?a.nodeRepulsion(v):a.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=u}for(var y=[],p=0,m=-1,b=[],u=0;u<s.nodeSize;u++){var v=s.layoutNodes[u],x=v.parentId;x!=null?s.layoutNodes[s.idToIndex[x]].children.push(v.id):(y[++m]=v.id,b.push(v.id))}for(s.graphSet.push(b);p<=m;){var I=y[p++],O=s.idToIndex[I],c=s.layoutNodes[O],T=c.children;if(T.length>0){s.graphSet.push(T);for(var u=0;u<T.length;u++)y[++m]=T[u]}}for(var u=0;u<s.graphSet.length;u++)for(var k=s.graphSet[u],h=0;h<k.length;h++){var S=s.idToIndex[k[h]];s.indexToGraph[S]=u}for(var u=0;u<s.edgeSize;u++){var F=n[u],z={};z.id=F.data("id"),z.sourceId=F.data("source"),z.targetId=F.data("target");var P=ne(a.idealEdgeLength)?a.idealEdgeLength(F):a.idealEdgeLength,H=ne(a.edgeElasticity)?a.edgeElasticity(F):a.edgeElasticity,G=s.idToIndex[z.sourceId],re=s.idToIndex[z.targetId],X=s.indexToGraph[G],K=s.indexToGraph[re];if(X!=K){for(var ie=ng(z.sourceId,z.targetId,s),fe=s.graphSet[ie],ve=0,g=s.layoutNodes[G];fe.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],ve++;for(g=s.layoutNodes[re];fe.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],ve++;P*=ve*a.nestingFactor}z.idealLength=P,z.elasticity=H,s.layoutEdges.push(z)}return s},ng=function(e,r,a){var n=ig(e,r,0,a);return 2>n.count?0:n.graph},ig=function t(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var l=i[o],u=n.idToIndex[l],f=n.layoutNodes[u].children;if(f.length!==0){var h=n.indexToGraph[n.idToIndex[f[0]]],c=t(e,r,h,n);if(c.count!==0)if(c.count===1){if(s++,s===2)break}else return c}}return{count:s,graph:a}},sg,og=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},au=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var u=(l.positionX-i.x1)/i.w,f=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+f*n.h}}else return{x:l.positionX,y:l.positionY}}},ug=function(e,r,a){var n=a.layout,i=a.eles.nodes(),s=au(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},lg=function(e,r,a){fg(e,r),vg(e),dg(e,r),gg(e),pg(e)},fg=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];hg(o,u,e,r)}},nu=function(e){return-e+2*e*Math.random()},hg=function(e,r,a,n){var i=e.cmptId,s=r.cmptId;if(!(i!==s&&!a.isCompound)){var o=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;o===0&&l===0&&(o=nu(u),l=nu(u));var f=cg(e,r,o,l);if(f>0)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+l*l),v=h*o/c,d=h*l/c;else var g=Wn(e,o,l),y=Wn(r,-1*o,-1*l),p=y.x-g.x,m=y.y-g.y,b=p*p+m*m,c=Math.sqrt(b),h=(e.nodeRepulsion+r.nodeRepulsion)/b,v=h*p/c,d=h*m/c;e.isLocked||(e.offsetX-=v,e.offsetY-=d),r.isLocked||(r.offsetX+=v,r.offsetY+=d)}},cg=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Wn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/r,u=s/o,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+s/2,f):0<r&&-1*u<=l&&l<=u?(f.x=n+o/2,f.y=i+o*a/2/r,f):0>r&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/r,f):0<a&&(l<=-1*u||l>=u)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},vg=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,f=l.positionY-s.positionY;if(!(u===0&&f===0)){var h=Wn(s,u,f),c=Wn(l,-1*u,-1*f),v=c.x-h.x,d=c.y-h.y,g=Math.sqrt(v*v+d*d),y=Math.pow(n.idealLength-g,2)/n.elasticity;if(g!==0)var p=y*v/g,m=y*d/g;else var p=0,m=0;s.isLocked||(s.offsetX+=p,s.offsetY+=m),l.isLocked||(l.offsetX-=p,l.offsetY-=m)}}},dg=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[u.parentId]],o=f.positionX,l=f.positionY;for(var h=0;h<s;h++){var c=e.layoutNodes[e.idToIndex[i[h]]];if(!c.isLocked){var v=o-c.positionX,d=l-c.positionY,g=Math.sqrt(v*v+d*d);if(g>a){var y=r.gravity*v/g,p=r.gravity*d/g;c.offsetX+=y,c.offsetY+=p}}}}},gg=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var f=l.offsetX,h=l.offsetY,c=0;c<u.length;c++){var v=e.layoutNodes[e.idToIndex[u[c]]];v.offsetX+=f,v.offsetY+=h,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},pg=function(e,r){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=yg(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,mg(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)}},yg=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},mg=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.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 t(n,r)}},iu=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,l=n[o]=n[o]||[];l.push(s)}for(var u=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var h=0;h<f.length;h++){var c=f[h];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,u+=f.w*f.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var v=0,d=0,g=0,y=0,p=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var h=0;h<f.length;h++){var c=f[h];c.isLocked||(c.positionX+=v-f.x1,c.positionY+=d-f.y1)}v+=f.w+r.componentSpacing,g+=f.w+r.componentSpacing,y=Math.max(y,f.h),g>p&&(d+=y+r.componentSpacing,v=0,g=0,y=0)}}},bg={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function su(t){this.options=$e({},bg,t)}su.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=$t(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(Ee){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),f=function(xe){if(xe==null)return Math.min(l,u);var ye=Math.min(l,u);ye==l?l=xe:u=xe},h=function(xe){if(xe==null)return Math.max(l,u);var ye=Math.max(l,u);ye==l?l=xe:u=xe},c=e.rows,v=e.cols!=null?e.cols:e.columns;if(c!=null&&v!=null)l=c,u=v;else if(c!=null&&v==null)l=c,u=Math.ceil(s/l);else if(c==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var d=f(),g=h();(d-1)*g>=s?f(d-1):(g-1)*d>=s&&h(g-1)}else for(;u*l<s;){var y=f(),p=h();(p+1)*y>=s?h(p+1):f(y+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var x=0;x<n.length;x++){var I=n[x],O=I._private.position;(O.x==null||O.y==null)&&(O.x=0,O.y=0);var T=I.layoutDimensions(e),k=e.avoidOverlapPadding,S=T.w+k,F=T.h+k;m=Math.max(m,S),b=Math.max(b,F)}for(var z={},P=function(xe,ye){return!!z["c-"+xe+"-"+ye]},H=function(xe,ye){z["c-"+xe+"-"+ye]=!0},G=0,re=0,X=function(){re++,re>=u&&(re=0,G++)},K={},ie=0;ie<n.length;ie++){var fe=n[ie],ve=e.position(fe);if(ve&&(ve.row!==void 0||ve.col!==void 0)){var oe={row:ve.row,col:ve.col};if(oe.col===void 0)for(oe.col=0;P(oe.row,oe.col);)oe.col++;else if(oe.row===void 0)for(oe.row=0;P(oe.row,oe.col);)oe.row++;K[fe.id()]=oe,H(oe.row,oe.col)}}var ce=function(xe,ye){var de,ae;if(xe.locked()||xe.isParent())return!1;var we=K[xe.id()];if(we)de=we.col*m+m/2+i.x1,ae=we.row*b+b/2+i.y1;else{for(;P(G,re);)X();de=re*m+m/2+i.x1,ae=G*b+b/2+i.y1,H(G,re),X()}return{x:de,y:ae}};n.layoutPositions(this,e,ce)}return this};var Eg={ready:function(){},stop:function(){}};function Gi(t){this.options=$e({},Eg,t)}Gi.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this},Gi.prototype.stop=function(){return this};var wg={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function ou(t){this.options=$e({},wg,t)}ou.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=ne(t.positions);function n(i){if(t.positions==null)return Lf(i.position());if(a)return t.positions(i);var s=t.positions[i._private.data.id];return s==null?null:s}return r.layoutPositions(this,t,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var xg={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function uu(t){this.options=$e({},xg,t)}uu.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=$t(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var Tg=[{name:"breadthfirst",impl:eu},{name:"circle",impl:tu},{name:"concentric",impl:ru},{name:"cose",impl:qn},{name:"grid",impl:su},{name:"null",impl:Gi},{name:"preset",impl:ou},{name:"random",impl:uu}];function lu(t){this.options=t,this.notifications=0}var fu=function(){},hu=function(){throw new Error("A headless instance can not render images")};lu.prototype={recalculateRenderedStyle:fu,notify:function(){this.notifications++},init:fu,isHeadless:function(){return!0},png:hu,jpg:hu};var Vi={};Vi.arrowShapeWidth=.3,Vi.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,f,h,c,v,d,g){var y=v.x-h/2-g,p=v.x+h/2+g,m=v.y-h/2-g,b=v.y+h/2+g,x=y<=u&&u<=p&&m<=f&&f<=b;return x},a=function(u,f,h,c,v){var d=u*Math.cos(c)-f*Math.sin(c),g=u*Math.sin(c)+f*Math.cos(c),y=d*h,p=g*h,m=y+v.x,b=p+v.y;return{x:m,y:b}},n=function(u,f,h,c){for(var v=[],d=0;d<u.length;d+=2){var g=u[d],y=u[d+1];v.push(a(g,y,f,h,c))}return v},i=function(u){for(var f=[],h=0;h<u.length;h++){var c=u[h];f.push(c.x,c.y)}return f},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,f){ee(f)&&(f=t[f]),t[u]=$e({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,v,d,g,y,p){var m=i(n(this.points,d+2*p,g,y)),b=_t(c,v,m);return b},roughCollide:r,draw:function(c,v,d,g){var y=n(this.points,v,d,g);e.arrowShapeImpl("polygon")(c,y)},spacing:function(c){return 0},gap:s},f)};o("none",{collide:pn,roughCollide:pn,draw:ui,spacing:ws,gap:ws}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=this.controlPoint,y=a(g[0],g[1],f,h,c);e.arrowShapeImpl(this.name)(u,d,y)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,f,h,c,v,d,g){var y=i(n(this.points,h+2*g,c,v)),p=i(n(this.pointsTee,h+2*g,c,v)),m=_t(u,f,y)||_t(u,f,p);return m},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=n(this.pointsTee,f,h,c);e.arrowShapeImpl(this.name)(u,d,g)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,f,h,c,v,d,g){var y=v,p=Math.pow(y.x-u,2)+Math.pow(y.y-f,2)<=Math.pow((h+2*g)*this.radius,2),m=i(n(this.points,h+2*g,c,v));return _t(u,f,m)||p},draw:function(u,f,h,c,v){var d=n(this.pointsTr,f,h,c);e.arrowShapeImpl(this.name)(u,d,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,f){var h=this.baseCrossLinePts.slice(),c=f/u,v=3,d=5;return h[v]=h[v]-c,h[d]=h[d]-c,h},collide:function(u,f,h,c,v,d,g){var y=i(n(this.points,h+2*g,c,v)),p=i(n(this.crossLinePts(h,d),h+2*g,c,v)),m=_t(u,f,y)||_t(u,f,p);return m},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=n(this.crossLinePts(f,v),f,h,c);e.arrowShapeImpl(this.name)(u,d,g)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,f,h,c,v,d,g){var y=v,p=Math.pow(y.x-u,2)+Math.pow(y.y-f,2)<=Math.pow((h+2*g)*this.radius,2);return p},draw:function(u,f,h,c,v){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("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 _r={};_r.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=r.pan(),l=r.zoom(),u=((t-n)/s-o.x)/l,f=((e-i)/s-o.y)/l;return[u,f]},_r.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=D.getComputedStyle(t),a=function(p){return parseFloat(r.getPropertyValue(p))},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")},s=t.clientWidth,o=t.clientHeight,l=n.left+n.right,u=n.top+n.bottom,f=i.left+i.right,h=e.width/(s+f),c=s-l,v=o-u,d=e.left+n.left+i.left,g=e.top+n.top+i.top;return this.containerBB=[d,g,c,v,h]},_r.invalidateContainerClientCoordsCache=function(){this.containerBB=null},_r.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]},_r.findNearestElements=function(t,e,r,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),f=(a?24:8)/l,h=(a?8:2)/l,c=(a?8:2)/l,v=1/0,d,g;r&&(s=s.interactive);function y(T,k){if(T.isNode()){if(g)return;g=T,o.push(T)}if(T.isEdge()&&(k==null||k<v))if(d){if(d.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===T.pstyle("z-compound-depth").value){for(var S=0;S<o.length;S++)if(o[S].isEdge()){o[S]=T,d=T,v=k!=null?k:v;break}}}else o.push(T),d=T,v=k!=null?k:v}function p(T){var k=T.outerWidth()+2*h,S=T.outerHeight()+2*h,F=k/2,z=S/2,P=T.position();if(P.x-F<=t&&t<=P.x+F&&P.y-z<=e&&e<=P.y+z){var H=i.nodeShapes[n.getNodeShape(T)];if(H.checkPoint(t,e,0,k,S,P.x,P.y))return y(T,0),!0}}function m(T){var k=T._private,S=k.rscratch,F=T.pstyle("width").pfValue,z=T.pstyle("arrow-scale").value,P=F/2+f,H=P*P,G=P*2,ie=k.source,fe=k.target,re;if(S.edgeType==="segments"||S.edgeType==="straight"||S.edgeType==="haystack"){for(var X=S.allpts,K=0;K+3<X.length;K+=2)if(Vf(t,e,X[K],X[K+1],X[K+2],X[K+3],G)&&H>(re=Hf(t,e,X[K],X[K+1],X[K+2],X[K+3])))return y(T,re),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var X=S.allpts,K=0;K+5<S.allpts.length;K+=4)if($f(t,e,X[K],X[K+1],X[K+2],X[K+3],X[K+4],X[K+5],G)&&H>(re=Yf(t,e,X[K],X[K+1],X[K+2],X[K+3],X[K+4],X[K+5])))return y(T,re),!0}for(var ie=ie||k.source,fe=fe||k.target,ve=n.getArrowWidth(F,z),oe=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],K=0;K<oe.length;K++){var ce=oe[K],Ee=i.arrowShapes[T.pstyle(ce.name+"-arrow-shape").value],xe=T.pstyle("width").pfValue;if(Ee.roughCollide(t,e,ve,ce.angle,{x:ce.x,y:ce.y},xe,f)&&Ee.collide(t,e,ve,ce.angle,{x:ce.x,y:ce.y},xe,f))return y(T),!0}u&&o.length>0&&(p(ie),p(fe))}function b(T,k,S){return jt(T,k,S)}function x(T,k){var S=T._private,F=c,z;k?z=k+"-":z="",T.boundingBox();var P=S.labelBounds[k||"main"],H=T.pstyle(z+"label").value,G=T.pstyle("text-events").strValue==="yes";if(!(!G||!H)){var re=b(S.rscratch,"labelX",k),X=b(S.rscratch,"labelY",k),K=b(S.rscratch,"labelAngle",k),ie=T.pstyle(z+"text-margin-x").pfValue,fe=T.pstyle(z+"text-margin-y").pfValue,ve=P.x1-F-ie,oe=P.x2+F-ie,ce=P.y1-F-fe,Ee=P.y2+F-fe;if(K){var xe=Math.cos(K),ye=Math.sin(K),de=function(He,Me){return He=He-re,Me=Me-X,{x:He*xe-Me*ye+re,y:He*ye+Me*xe+X}},ae=de(ve,ce),we=de(ve,Ee),Te=de(oe,ce),Ae=de(oe,Ee),Ne=[ae.x+ie,ae.y+fe,Te.x+ie,Te.y+fe,Ae.x+ie,Ae.y+fe,we.x+ie,we.y+fe];if(_t(t,e,Ne))return y(T),!0}else if(ra(P,t,e))return y(T),!0}}for(var I=s.length-1;I>=0;I--){var O=s[I];O.isNode()?p(O)||x(O):m(O)||x(O)||x(O,"source")||x(O,"target")}return o},_r.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=s,r=o,e=l,a=u;for(var f=$t({x1:t,y1:e,x2:r,y2:a}),h=0;h<n.length;h++){var c=n[h];if(c.isNode()){var v=c,d=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});vi(f,d)&&!Os(d,f)&&i.push(v)}else{var g=c,y=g._private,p=y.rscratch;if(p.startX!=null&&p.startY!=null&&!ra(f,p.startX,p.startY)||p.endX!=null&&p.endY!=null&&!ra(f,p.endX,p.endY))continue;if(p.edgeType==="bezier"||p.edgeType==="multibezier"||p.edgeType==="self"||p.edgeType==="compound"||p.edgeType==="segments"||p.edgeType==="haystack"){for(var m=y.rstyle.bezierPts||y.rstyle.linePts||y.rstyle.haystackPts,b=!0,x=0;x<m.length;x++)if(!Gf(f,m[x])){b=!1;break}b&&i.push(g)}else(p.edgeType==="haystack"||p.edgeType==="straight")&&i.push(g)}}return i};var Kn={};Kn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,f,h,c,v,p,m;if(r?(f=e.haystackPts[0],h=e.haystackPts[1],c=e.haystackPts[2],v=e.haystackPts[3]):(f=e.arrowStartX,h=e.arrowStartY,c=e.arrowEndX,v=e.arrowEndY),p=e.midX,m=e.midY,i)l=f-e.segpts[0],u=h-e.segpts[1];else if(n||s||o||a){var d=e.allpts,g=Dt(d[0],d[2],d[4],.1),y=Dt(d[1],d[3],d[5],.1);l=f-g,u=h-y}else l=f-p,u=h-m;e.srcArrowAngle=bn(l,u);var p=e.midX,m=e.midY;if(r&&(p=(f+c)/2,m=(h+v)/2),l=c-f,u=v-h,i){var d=e.allpts;if(d.length/2%2===0){var b=d.length/2,x=b-2;l=d[b]-d[x],u=d[b+1]-d[x+1]}else{var b=d.length/2-1,x=b-2,I=b+2;l=d[b]-d[x],u=d[b+1]-d[x+1]}}else if(n||s||o){var d=e.allpts,O=e.ctrlpts,T,k,S,F;if(O.length/2%2===0){var z=d.length/2-1,P=z+2,H=P+2;T=Dt(d[z],d[P],d[H],0),k=Dt(d[z+1],d[P+1],d[H+1],0),S=Dt(d[z],d[P],d[H],1e-4),F=Dt(d[z+1],d[P+1],d[H+1],1e-4)}else{var P=d.length/2-1,z=P-2,H=P+2;T=Dt(d[z],d[P],d[H],.4999),k=Dt(d[z+1],d[P+1],d[H+1],.4999),S=Dt(d[z],d[P],d[H],.5),F=Dt(d[z+1],d[P+1],d[H+1],.5)}l=S-T,u=F-k}if(e.midtgtArrowAngle=bn(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var d=e.allpts;if(d.length/2%2!==0){var b=d.length/2-1,I=b+2;l=-(d[I]-d[b]),u=-(d[I+1]-d[b+1])}}if(e.midsrcArrowAngle=bn(l,u),i)l=c-e.segpts[e.segpts.length-2],u=v-e.segpts[e.segpts.length-1];else if(n||s||o||a){var d=e.allpts,G=d.length,g=Dt(d[G-6],d[G-4],d[G-2],.9),y=Dt(d[G-5],d[G-3],d[G-1],.9);l=c-g,u=v-y}else l=c-p,u=v-m;e.tgtArrowAngle=bn(l,u)},Kn.getArrowWidth=Kn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var Gt={};Gt.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._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 s=a.source,o=a.target,l=s.position(),u=o.position(),f=s.width(),h=o.width(),c=s.height(),v=o.height(),d=r.pstyle("haystack-radius").value,g=d/2;n.haystackPts=n.allpts=[n.source.x*f*g+l.x,n.source.y*c*g+l.y,n.target.x*h*g+u.x,n.target.y*v*g+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(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}},Gt.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=e.posPts,n=e.intersectionPts,i=e.vectorNormInverse,s=t.pstyle("edge-distances").value,o=t.pstyle("segment-weights"),l=t.pstyle("segment-distances"),u=Math.min(o.pfValue.length,l.pfValue.length);r.edgeType="segments",r.segpts=[];for(var f=0;f<u;f++){var h=o.pfValue[f],c=l.pfValue[f],v=1-h,d=h,g=s==="node-position"?a:n,y={x:g.x1*v+g.x2*d,y:g.y1*v+g.y2*d};r.segpts.push(y.x+i.x*c,y.y+i.y*c)}},Gt.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,h=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,v=h;a&&(c=0,v=l);var d=u-Math.PI/2,g=d-f/2,y=d+f/2,p=u+"_"+f;c=i[p]===void 0?i[p]=0:++i[p],n.ctrlpts=[s.x+Math.cos(g)*1.4*v*(c/3+1),s.y+Math.sin(g)*1.4*v*(c/3+1),s.x+Math.cos(y)*1.4*v*(c/3+1),s.y+Math.sin(y)*1.4*v*(c/3+1)]},Gt.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,f=e.tgtH,h=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),v=c?c.pfValue[0]:void 0,d=r,g=h;a&&(d=0,g=v);var y=50,p={x:i.x-o/2,y:i.y-l/2},m={x:s.x-u/2,y:s.y-f/2},b={x:Math.min(p.x,m.x),y:Math.min(p.y,m.y)},x=.5,I=Math.max(x,Math.log(o*.01)),O=Math.max(x,Math.log(u*.01));n.ctrlpts=[b.x,b.y-(1+Math.pow(y,1.12)/100)*g*(d/3+1)*I,b.x-(1+Math.pow(y,1.12)/100)*g*(d/3+1)*O,b.y]},Gt.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"},Gt.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,s=e.vectorNormInverse,o=e.posPts,l=e.intersectionPts,u=t.pstyle("edge-distances").value,f=t.pstyle("control-point-step-size").pfValue,h=t.pstyle("control-point-distances"),c=t.pstyle("control-point-weights"),v=h&&c?Math.min(h.value.length,c.value.length):1,d=h?h.pfValue[0]:void 0,g=c.value[0],y=a;i.edgeType=y?"multibezier":"bezier",i.ctrlpts=[];for(var p=0;p<v;p++){var m=(.5-e.eles.length/2+r)*f*(n?-1:1),b=void 0,x=Ls(m);y&&(d=h?h.pfValue[p]:f,g=c.value[p]),a?b=d:b=d!==void 0?x*d:void 0;var I=b!==void 0?b:m,O=1-g,T=g,k=u==="node-position"?o:l,S={x:k.x1*O+k.x2*T,y:k.y1*O+k.y2*T};i.ctrlpts.push(S.x+s.x*I,S.y+s.y*I)}},Gt.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",l="upward",u="auto",f=e.posPts,h=e.srcW,c=e.srcH,v=e.tgtW,d=e.tgtH,g=t.pstyle("edge-distances").value,y=g!=="node-position",p=t.pstyle("taxi-direction").value,m=p,b=t.pstyle("taxi-turn"),x=b.units==="%",I=b.pfValue,O=I<0,T=t.pstyle("taxi-turn-min-distance").pfValue,k=y?(h+v)/2:0,S=y?(c+d)/2:0,F=f.x2-f.x1,z=f.y2-f.y1,P=function(Pe,rt){return Pe>0?Math.max(Pe-rt,0):Math.min(Pe+rt,0)},H=P(F,k),G=P(z,S),re=!1;m===u?p=Math.abs(H)>Math.abs(G)?n:a:m===l||m===o?(p=a,re=!0):(m===i||m===s)&&(p=n,re=!0);var X=p===a,K=X?G:H,ie=X?z:F,fe=Ls(ie),ve=!1;!(re&&(x||O))&&(m===o&&ie<0||m===l&&ie>0||m===i&&ie>0||m===s&&ie<0)&&(fe*=-1,K=fe*Math.abs(K),ve=!0);var oe;if(x){var ce=I<0?1+I:I;oe=ce*K}else{var Ee=I<0?K:0;oe=Ee+I*fe}var xe=function(Pe){return Math.abs(Pe)<T||Math.abs(Pe)>=Math.abs(K)},ye=xe(oe),de=xe(Math.abs(K)-Math.abs(oe)),ae=ye||de;if(ae&&!ve)if(X){var we=Math.abs(ie)<=c/2,Te=Math.abs(F)<=v/2;if(we){var Ae=(f.x1+f.x2)/2,Ne=f.y1,Ue=f.y2;r.segpts=[Ae,Ne,Ae,Ue]}else if(Te){var He=(f.y1+f.y2)/2,Me=f.x1,Oe=f.x2;r.segpts=[Me,He,Oe,He]}else r.segpts=[f.x1,f.y2]}else{var Ve=Math.abs(ie)<=h/2,ke=Math.abs(z)<=d/2;if(Ve){var Ie=(f.y1+f.y2)/2,Be=f.x1,je=f.x2;r.segpts=[Be,Ie,je,Ie]}else if(ke){var Xe=(f.x1+f.x2)/2,_e=f.y1,De=f.y2;r.segpts=[Xe,_e,Xe,De]}else r.segpts=[f.x2,f.y1]}else if(X){var M=f.y1+oe+(y?c/2*fe:0),he=f.x1,Ce=f.x2;r.segpts=[he,M,Ce,M]}else{var ge=f.x1+oe+(y?h/2*fe:0),pe=f.y1,qe=f.y2;r.segpts=[ge,pe,ge,qe]}},Gt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,f=e.tgtShape,h=!N(r.startX)||!N(r.startY),c=!N(r.arrowStartX)||!N(r.arrowStartY),v=!N(r.endX)||!N(r.endY),d=!N(r.arrowEndX)||!N(r.arrowEndY),g=3,y=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,p=g*y,m=Br({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),b=m<p,x=Br({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),I=x<p,O=!1;if(h||c||b){O=!0;var T={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},k=Math.sqrt(T.x*T.x+T.y*T.y),S={x:T.x/k,y:T.y/k},F=Math.max(i,s),z={x:r.ctrlpts[0]+S.x*2*F,y:r.ctrlpts[1]+S.y*2*F},P=u.intersectLine(a.x,a.y,i,s,z.x,z.y,0);b?(r.ctrlpts[0]=r.ctrlpts[0]+S.x*(p-m),r.ctrlpts[1]=r.ctrlpts[1]+S.y*(p-m)):(r.ctrlpts[0]=P[0]+S.x*p,r.ctrlpts[1]=P[1]+S.y*p)}if(v||d||I){O=!0;var H={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},G=Math.sqrt(H.x*H.x+H.y*H.y),re={x:H.x/G,y:H.y/G},X=Math.max(i,s),K={x:r.ctrlpts[0]+re.x*2*X,y:r.ctrlpts[1]+re.y*2*X},ie=f.intersectLine(n.x,n.y,o,l,K.x,K.y,0);I?(r.ctrlpts[0]=r.ctrlpts[0]+re.x*(p-x),r.ctrlpts[1]=r.ctrlpts[1]+re.y*(p-x)):(r.ctrlpts[0]=ie[0]+re.x*p,r.ctrlpts[1]=ie[1]+re.y*p)}O&&this.findEndpoints(t)}},Gt.storeAllpts=function(t){var e=t._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 r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+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=Dt(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Dt(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.segpts.length%4===0){var i=e.segpts.length/2,s=i-2;e.midX=(e.segpts[s]+e.segpts[i])/2,e.midY=(e.segpts[s+1]+e.segpts[i+1])/2}else{var o=e.segpts.length/2-1;e.midX=e.segpts[o],e.midY=e.segpts[o+1]}},Gt.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||N(e.startX)&&N(e.startY)&&N(e.endX)&&N(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,lt("Edge `"+t.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."))},Gt.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i={map:new or,get:function(T){var k=this.map.get(T[0]);return k!=null?k.get(T[1]):null},set:function(T,k){var S=this.map.get(T[0]);S==null&&(S=new or,this.map.set(T[0],S)),S.set(T[1],k)}},s=[],o=[],l=0;l<t.length;l++){var u=t[l],f=u._private,h=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(h==="haystack"){o.push(u);continue}var c=h==="unbundled-bezier"||h==="segments"||h==="straight"||h==="straight-triangle"||h==="taxi",v=h==="unbundled-bezier"||h==="bezier",d=f.source,g=f.target,y=d.poolIndex(),p=g.poolIndex(),m=[y,p].sort(),b=i.get(m);b==null&&(b={eles:[]},i.set(m,b),s.push(m)),b.eles.push(u),c&&(b.hasUnbundled=!0),v&&(b.hasBezier=!0)}}for(var x=function(T){var k=s[T],S=i.get(k),F=void 0;if(!S.hasUnbundled){var z=S.eles[0].parallelEdges().filter(function(De){return De.isBundledBezier()});li(S.eles),z.forEach(function(De){return S.eles.push(De)}),S.eles.sort(function(De,M){return De.poolIndex()-M.poolIndex()})}var P=S.eles[0],H=P.source(),G=P.target();if(H.poolIndex()>G.poolIndex()){var re=H;H=G,G=re}var X=S.srcPos=H.position(),K=S.tgtPos=G.position(),ie=S.srcW=H.outerWidth(),fe=S.srcH=H.outerHeight(),ve=S.tgtW=G.outerWidth(),oe=S.tgtH=G.outerHeight(),ce=S.srcShape=r.nodeShapes[e.getNodeShape(H)],Ee=S.tgtShape=r.nodeShapes[e.getNodeShape(G)];S.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var xe=0;xe<S.eles.length;xe++){var ye=S.eles[xe],de=ye[0]._private.rscratch,ae=ye.pstyle("curve-style").value,we=ae==="unbundled-bezier"||ae==="segments"||ae==="taxi",Te=!H.same(ye.source());if(!S.calculatedIntersection&&H!==G&&(S.hasBezier||S.hasUnbundled)){S.calculatedIntersection=!0;var Ae=ce.intersectLine(X.x,X.y,ie,fe,K.x,K.y,0),Ne=S.srcIntn=Ae,Ue=Ee.intersectLine(K.x,K.y,ve,oe,X.x,X.y,0),He=S.tgtIntn=Ue,Me=S.intersectionPts={x1:Ae[0],x2:Ue[0],y1:Ae[1],y2:Ue[1]},Oe=S.posPts={x1:X.x,x2:K.x,y1:X.y,y2:K.y},Ve=Ue[1]-Ae[1],ke=Ue[0]-Ae[0],Ie=Math.sqrt(ke*ke+Ve*Ve),Be=S.vector={x:ke,y:Ve},je=S.vectorNorm={x:Be.x/Ie,y:Be.y/Ie},Xe={x:-je.y,y:je.x};S.nodesOverlap=!N(Ie)||Ee.checkPoint(Ae[0],Ae[1],0,ve,oe,K.x,K.y)||ce.checkPoint(Ue[0],Ue[1],0,ie,fe,X.x,X.y),S.vectorNormInverse=Xe,F={nodesOverlap:S.nodesOverlap,dirCounts:S.dirCounts,calculatedIntersection:!0,hasBezier:S.hasBezier,hasUnbundled:S.hasUnbundled,eles:S.eles,srcPos:K,tgtPos:X,srcW:ve,srcH:oe,tgtW:ie,tgtH:fe,srcIntn:He,tgtIntn:Ne,srcShape:Ee,tgtShape:ce,posPts:{x1:Oe.x2,y1:Oe.y2,x2:Oe.x1,y2:Oe.y1},intersectionPts:{x1:Me.x2,y1:Me.y2,x2:Me.x1,y2:Me.y1},vector:{x:-Be.x,y:-Be.y},vectorNorm:{x:-je.x,y:-je.y},vectorNormInverse:{x:-Xe.x,y:-Xe.y}}}var _e=Te?F:S;de.nodesOverlap=_e.nodesOverlap,de.srcIntn=_e.srcIntn,de.tgtIntn=_e.tgtIntn,n&&(H.isParent()||H.isChild()||G.isParent()||G.isChild())&&(H.parents().anySame(G)||G.parents().anySame(H)||H.same(G)&&H.isParent())?e.findCompoundLoopPoints(ye,_e,xe,we):H===G?e.findLoopPoints(ye,_e,xe,we):ae==="segments"?e.findSegmentsPoints(ye,_e):ae==="taxi"?e.findTaxiPoints(ye,_e):ae==="straight"||!we&&S.eles.length%2===1&&xe===Math.floor(S.eles.length/2)?e.findStraightEdgePoints(ye):e.findBezierPoints(ye,_e,xe,we,Te),e.findEndpoints(ye),e.tryToCorrectInvalidPoints(ye,_e),e.checkForInvalidEdgeWarning(ye),e.storeAllpts(ye),e.storeEdgeProjections(ye),e.calculateArrowAngles(ye),e.recalculateEdgeLabelProjections(ye),e.calculateLabelAngles(ye)}},I=0;I<s.length;I++)x(I);this.findHaystackPoints(o)}};function cu(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}Gt.getSegmentPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="segments")return this.recalculateRenderedStyle(t),cu(e.segpts)},Gt.getControlPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return this.recalculateRenderedStyle(t),cu(e.ctrlpts)},Gt.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Qa={};Qa.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight();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 o=e.pfValue[0];o=-Math.PI/2+o;var l=2*Math.max(n,i),u=[a.x+Math.cos(o)*l,a.y+Math.sin(o)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,u[0],u[1],0)}},Qa.findEndpoints=function(t){var e=this,r,a=t.source()[0],n=t.target()[0],i=a.position(),s=n.position(),o=t.pstyle("target-arrow-shape").value,l=t.pstyle("source-arrow-shape").value,u=t.pstyle("target-distance-from-node").pfValue,f=t.pstyle("source-distance-from-node").pfValue,h=t.pstyle("curve-style").value,c=t._private.rscratch,v=c.edgeType,d=h==="taxi",g=v==="self"||v==="compound",y=v==="bezier"||v==="multibezier"||g,p=v!=="bezier",m=v==="straight"||v==="segments",b=v==="segments",x=y||p||m,I=g||d,O=t.pstyle("source-endpoint"),T=I?"outside-to-node":O.value,k=t.pstyle("target-endpoint"),S=I?"outside-to-node":k.value;c.srcManEndpt=O,c.tgtManEndpt=k;var F,z,P,H;if(y){var G=[c.ctrlpts[0],c.ctrlpts[1]],re=p?[c.ctrlpts[c.ctrlpts.length-2],c.ctrlpts[c.ctrlpts.length-1]]:G;F=re,z=G}else if(m){var X=b?c.segpts.slice(0,2):[s.x,s.y],K=b?c.segpts.slice(c.segpts.length-2):[i.x,i.y];F=K,z=X}if(S==="inside-to-node")r=[s.x,s.y];else if(k.units)r=this.manualEndptToPx(n,k);else if(S==="outside-to-line")r=c.tgtIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?P=F:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(P=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),P[0],P[1],0),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var ie=n._private.rscratch,fe=ie.labelWidth,ve=ie.labelHeight,oe=ie.labelX,ce=ie.labelY,Ee=fe/2,xe=ve/2,ye=n.pstyle("text-valign").value;ye==="top"?ce-=xe:ye==="bottom"&&(ce+=xe);var de=n.pstyle("text-halign").value;de==="left"?oe-=Ee:de==="right"&&(oe+=Ee);var ae=Ba(P[0],P[1],[oe-Ee,ce-xe,oe+Ee,ce-xe,oe+Ee,ce+xe,oe-Ee,ce+xe],s.x,s.y);if(ae.length>0){var we=i,Te=Fr(we,ea(r)),Ae=Fr(we,ea(ae)),Ne=Te;if(Ae<Te&&(r=ae,Ne=Ae),ae.length>2){var Ue=Fr(we,{x:ae[2],y:ae[3]});Ue<Ne&&(r=[ae[2],ae[3]])}}}var He=wn(r,F,e.arrowShapes[o].spacing(t)+u),Me=wn(r,F,e.arrowShapes[o].gap(t)+u);if(c.endX=Me[0],c.endY=Me[1],c.arrowEndX=He[0],c.arrowEndY=He[1],T==="inside-to-node")r=[i.x,i.y];else if(O.units)r=this.manualEndptToPx(a,O);else if(T==="outside-to-line")r=c.srcIntn;else if(T==="outside-to-node"||T==="outside-to-node-or-label"?H=z:(T==="outside-to-line"||T==="outside-to-line-or-label")&&(H=[s.x,s.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),H[0],H[1],0),T==="outside-to-node-or-label"||T==="outside-to-line-or-label"){var Oe=a._private.rscratch,Ve=Oe.labelWidth,ke=Oe.labelHeight,Ie=Oe.labelX,Be=Oe.labelY,je=Ve/2,Xe=ke/2,_e=a.pstyle("text-valign").value;_e==="top"?Be-=Xe:_e==="bottom"&&(Be+=Xe);var De=a.pstyle("text-halign").value;De==="left"?Ie-=je:De==="right"&&(Ie+=je);var M=Ba(H[0],H[1],[Ie-je,Be-Xe,Ie+je,Be-Xe,Ie+je,Be+Xe,Ie-je,Be+Xe],i.x,i.y);if(M.length>0){var he=s,Ce=Fr(he,ea(r)),ge=Fr(he,ea(M)),pe=Ce;if(ge<Ce&&(r=[M[0],M[1]],pe=ge),M.length>2){var qe=Fr(he,{x:M[2],y:M[3]});qe<pe&&(r=[M[2],M[3]])}}}var Se=wn(r,z,e.arrowShapes[l].spacing(t)+f),Pe=wn(r,z,e.arrowShapes[l].gap(t)+f);c.startX=Pe[0],c.startY=Pe[1],c.arrowStartX=Se[0],c.arrowStartY=Se[1],x&&(!N(c.startX)||!N(c.startY)||!N(c.endX)||!N(c.endY)?c.badLine=!0:c.badLine=!1)},Qa.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}},Qa.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var $i={};function Cg(t,e,r){for(var a=function(u,f,h,c){return Dt(u,f,h,c)},n=e._private,i=n.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];i.push({x:a(r[0],r[2],r[4],o),y:a(r[1],r[3],r[5],o)})}}$i.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.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<r.allpts.length;n+=4)Cg(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth},$i.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var lr={};lr.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!Ye(e)){var r,a,n=t._private,i=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,h=n.rscratch,c=n.rstyle;switch(u){case"left":r=l.x-i/2-o;break;case"right":r=l.x+i/2+o;break;default:r=l.x}switch(f){case"top":a=l.y-s/2-o;break;case"bottom":a=l.y+s/2+o;break;default:a=l.y}h.labelX=r,h.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var vu=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},du=function(e,r){var a=r.x-e.x,n=r.y-e.y;return vu(a,n)},Dg=function(e,r,a,n){var i=ka(0,n-.001,1),s=ka(0,n+.001,1),o=ta(e,r,a,i),l=ta(e,r,a,s);return du(o,l)};lr.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=function(h,c,v){xr(r.rscratch,h,c,v),xr(r.rstyle,h,c,v)};s("labelX",null,e.x),s("labelY",null,e.y);var o=vu(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var l=function f(){if(f.cache)return f.cache;for(var h=[],c=0;c+5<a.allpts.length;c+=4){var v={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},g={x:a.allpts[c+4],y:a.allpts[c+5]};h.push({p0:v,p1:d,p2:g,startDist:0,length:0,segments:[]})}var y=r.rstyle.bezierPts,p=n.bezierProjPcts.length;function m(T,k,S,F,z){var P=Br(k,S),H=T.segments[T.segments.length-1],G={p0:k,p1:S,t0:F,t1:z,startDist:H?H.startDist+H.length:0,length:P};T.segments.push(G),T.length+=P}for(var b=0;b<h.length;b++){var x=h[b],I=h[b-1];I&&(x.startDist=I.startDist+I.length),m(x,x.p0,y[b*p],0,n.bezierProjPcts[0]);for(var O=0;O<p-1;O++)m(x,y[b*p+O],y[b*p+O+1],n.bezierProjPcts[O],n.bezierProjPcts[O+1]);m(x,y[b*p+p-1],x.p2,n.bezierProjPcts[p-1],1)}return f.cache=h},u=function(h){var c,v=h==="source";if(i[h]){var d=t.pstyle(h+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=l(),y,p=0,m=0,b=0;b<g.length;b++){for(var x=g[v?b:g.length-1-b],I=0;I<x.segments.length;I++){var O=x.segments[v?I:x.segments.length-1-I],T=b===g.length-1&&I===x.segments.length-1;if(p=m,m+=O.length,m>=d||T){y={cp:x,segment:O};break}}if(y)break}var k=y.cp,S=y.segment,F=(d-p)/S.length,z=S.t1-S.t0,P=v?S.t0+z*F:S.t1-z*F;P=ka(0,P,1),e=ta(k.p0,k.p1,k.p2,P),c=Dg(k.p0,k.p1,k.p2,P);break}case"straight":case"segments":case"haystack":{for(var H=0,G,re,X,K,ie=a.allpts.length,fe=0;fe+3<ie&&(v?(X={x:a.allpts[fe],y:a.allpts[fe+1]},K={x:a.allpts[fe+2],y:a.allpts[fe+3]}):(X={x:a.allpts[ie-2-fe],y:a.allpts[ie-1-fe]},K={x:a.allpts[ie-4-fe],y:a.allpts[ie-3-fe]}),G=Br(X,K),re=H,H+=G,!(H>=d));fe+=2);var ve=d-re,oe=ve/G;oe=ka(0,oe,1),e=kf(X,K,oe),c=du(X,K);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};u("source"),u("target"),this.applyLabelDimensions(t)}},lr.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},lr.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=jt(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,h=n.width,c=n.height+(l-1)*(i-1)*u;xr(r.rstyle,"labelWidth",e,h),xr(r.rscratch,"labelWidth",e,h),xr(r.rstyle,"labelHeight",e,c),xr(r.rscratch,"labelHeight",e,c),xr(r.rscratch,"labelLineHeight",e,f)},lr.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(ve,oe){return oe?(xr(r.rscratch,ve,e,oe),oe):jt(r.rscratch,ve,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",f=n.split(`
`),h=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,v=c==="anywhere",d=[],g=/[\s\u200b]+/,y=v?"":" ",p=0;p<f.length;p++){var m=f[p],b=this.calculateLabelDimensions(t,m),x=b.width;if(v){var I=m.split("").join(u);m=I}if(x>h){for(var O=m.split(g),T="",k=0;k<O.length;k++){var S=O[k],F=T.length===0?S:T+y+S,z=this.calculateLabelDimensions(t,F),P=z.width;P<=h?T+=S+y:(T&&d.push(T),T=S+y)}T.match(/^[\s\u200b]+$/)||d.push(T)}else d.push(m)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var H=t.pstyle("text-max-width").pfValue,G="",re="\u2026",X=!1;if(this.calculateLabelDimensions(t,n).width<H)return n;for(var K=0;K<n.length;K++){var ie=this.calculateLabelDimensions(t,G+n[K]+re).width;if(ie>H)break;G+=n[K],K===n.length-1&&(X=!0)}return X||(G+=re),G}return n},lr.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e},lr.calculateLabelDimensions=function(t,e){var r=this,a=Pr(e,t._private.labelDimsKey),n=r.labelDimCache||(r.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=t.pstyle("font-style").strValue,l=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var v=h.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(l,"px ").concat(u);for(var d=0,g=0,y=e.split(`
`),p=0;p<y.length;p++){var m=y[p],b=c.measureText(m),x=Math.ceil(b.width),I=l;d=Math.max(x,d),g+=I}return d+=s,g+=s,n[a]={width:d,height:g}},lr.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue},lr.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var gu={},pu=28,yu=!1;gu.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<pu||t.height()<pu))return yu||(lt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),yu=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Zn={};Zn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],f=u._private,h=f.rstyle;h.clean=!1,h.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],f=u._private.rstyle;u.isNode()&&!f.cleanConnected&&(a(u.connectedEdges()),f.cleanConnected=!0)}if(o)for(var h=0;h<o.length;h++){var c=o[h];c(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)},Zn.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)},Zn.recalculateRenderedStyle=function(t,e){var r=function(x){return x._private.rstyle.cleanConnected},a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var s=t[i],o=s._private,l=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),l.clean=!0)}for(var u=0;u<n.length;u++){var f=n[u],h=f._private,c=h.rstyle,v=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=v.x,c.nodeY=v.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var g=a[d],y=g._private,p=y.rstyle,m=y.rscratch;p.srcX=m.arrowStartX,p.srcY=m.arrowStartY,p.tgtX=m.arrowEndX,p.tgtY=m.arrowEndY,p.midX=m.midX,p.midY=m.midY,p.labelAngle=m.labelAngle,p.sourceLabelAngle=m.sourceLabelAngle,p.targetLabelAngle=m.targetLabelAngle}}};var Qn={};Qn.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}},Qn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Qn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Vo),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var mu={};[_r,Kn,Gt,Qa,$i,lr,gu,Zn,Qn].forEach(function(t){$e(mu,t)});var bu={};bu.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var s=i.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(s.crossOrigin=e),s.src=t,s};var ma={};ma.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]),i=this.binder(t);return i.on.apply(i,n)},ma.binder=function(t){var e=this,r=t===window||t===document||t===document.body||Fe(t);if(e.supportsPassiveEvents==null){var a=!1;try{var n=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});window.addEventListener("test",null,n)}catch(s){}e.supportsPassiveEvents=a}var i=function(o,l,u){var f=Array.prototype.slice.call(arguments);return r&&e.supportsPassiveEvents&&(f[2]={capture:u!=null?u:!1,passive:!1,once:!1}),e.bindings.push({target:t,args:f}),(t.addEventListener||t.on).apply(t,f),this};return{on:i,addEventListener:i,addListener:i,bind:i}},ma.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()},ma.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()},ma.load=function(){var t=this,e=function(M){return M.selected()},r=function(M,he,Ce,ge){M==null&&(M=t.cy);for(var pe=0;pe<he.length;pe++){var qe=he[pe];M.emit({originalEvent:Ce,type:qe,position:ge})}},a=function(M){return M.shiftKey||M.metaKey||M.ctrlKey},n=function(M,he){var Ce=!0;if(t.cy.hasCompoundNodes()&&M&&M.pannable())for(var ge=0;he&&ge<he.length;ge++){var M=he[ge];if(M.isNode()&&M.isParent()&&!M.pannable()){Ce=!1;break}}else Ce=!0;return Ce},i=function(M){M[0]._private.grabbed=!0},s=function(M){M[0]._private.grabbed=!1},o=function(M){M[0]._private.rscratch.inDragLayer=!0},l=function(M){M[0]._private.rscratch.inDragLayer=!1},u=function(M){M[0]._private.rscratch.isGrabTarget=!0},f=function(M){M[0]._private.rscratch.isGrabTarget=!1},h=function(M,he){var Ce=he.addToList,ge=Ce.has(M);!ge&&M.grabbable()&&!M.locked()&&(Ce.merge(M),i(M))},c=function(M,he){if(M.cy().hasCompoundNodes()&&!(he.inDragLayer==null&&he.addToList==null)){var Ce=M.descendants();he.inDragLayer&&(Ce.forEach(o),Ce.connectedEdges().forEach(o)),he.addToList&&h(Ce,he)}},v=function(M,he){he=he||{};var Ce=M.cy().hasCompoundNodes();he.inDragLayer&&(M.forEach(o),M.neighborhood().stdFilter(function(ge){return!Ce||ge.isEdge()}).forEach(o)),he.addToList&&M.forEach(function(ge){h(ge,he)}),c(M,he),y(M,{inDragLayer:he.inDragLayer}),t.updateCachedGrabbedEles()},d=v,g=function(M){M&&(t.getCachedZSortedEles().forEach(function(he){s(he),l(he),f(he)}),t.updateCachedGrabbedEles())},y=function(M,he){if(!(he.inDragLayer==null&&he.addToList==null)&&M.cy().hasCompoundNodes()){var Ce=M.ancestors().orphans();if(!Ce.same(M)){var ge=Ce.descendants().spawnSelf().merge(Ce).unmerge(M).unmerge(M.descendants()),pe=ge.connectedEdges();he.inDragLayer&&(pe.forEach(o),ge.forEach(o)),he.addToList&&ge.forEach(function(qe){h(qe,he)})}}},p=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},m=typeof MutationObserver!="undefined",b=typeof ResizeObserver!="undefined";m?(t.removeObserver=new MutationObserver(function(De){for(var M=0;M<De.length;M++){var he=De[M],Ce=he.removedNodes;if(Ce)for(var ge=0;ge<Ce.length;ge++){var pe=Ce[ge];if(pe===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(De){t.destroy()});var x=vn(function(){t.cy.resize()},100);m&&(t.styleObserver=new MutationObserver(x),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(window,"resize",x),b&&(t.resizeObserver=new ResizeObserver(x),t.resizeObserver.observe(t.container));var I=function(M,he){for(;M!=null;)he(M),M=M.parentNode},O=function(){t.invalidateContainerClientCoordsCache()};I(t.container,function(De){t.registerBinding(De,"transitionend",O),t.registerBinding(De,"animationend",O),t.registerBinding(De,"scroll",O)}),t.registerBinding(t.container,"contextmenu",function(De){De.preventDefault()});var T=function(){return t.selection[4]!==0},k=function(M){for(var he=t.findContainerClientCoords(),Ce=he[0],ge=he[1],pe=he[2],qe=he[3],Se=M.touches?M.touches:[M],Pe=!1,rt=0;rt<Se.length;rt++){var ht=Se[rt];if(Ce<=ht.clientX&&ht.clientX<=Ce+pe&&ge<=ht.clientY&&ht.clientY<=ge+qe){Pe=!0;break}}if(!Pe)return!1;for(var Ze=t.container,ot=M.target,We=ot.parentNode,Qe=!1;We;){if(We===Ze){Qe=!0;break}We=We.parentNode}return!!Qe};t.registerBinding(t.container,"mousedown",function(M){if(k(M)){M.preventDefault(),p(),t.hoverData.capture=!0,t.hoverData.which=M.which;var he=t.cy,Ce=[M.clientX,M.clientY],ge=t.projectIntoViewport(Ce[0],Ce[1]),pe=t.selection,qe=t.findNearestElements(ge[0],ge[1],!0,!1),Se=qe[0],Pe=t.dragData.possibleDragElements;t.hoverData.mdownPos=ge,t.hoverData.mdownGPos=Ce;var rt=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var wt=t.hoverData.down;wt?wt.emit({originalEvent:M,type:"taphold",position:{x:ge[0],y:ge[1]}}):he.emit({originalEvent:M,type:"taphold",position:{x:ge[0],y:ge[1]}})}},t.tapholdDuration)};if(M.which==3){t.hoverData.cxtStarted=!0;var ht={originalEvent:M,type:"cxttapstart",position:{x:ge[0],y:ge[1]}};Se?(Se.activate(),Se.emit(ht),t.hoverData.down=Se):he.emit(ht),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(M.which==1){Se&&Se.activate();{if(Se!=null&&t.nodeIsGrabbable(Se)){var Ze=function(wt){return{originalEvent:M,type:wt,position:{x:ge[0],y:ge[1]}}},ot=function(wt){wt.emit(Ze("grab"))};if(u(Se),!Se.selected())Pe=t.dragData.possibleDragElements=he.collection(),d(Se,{addToList:Pe}),Se.emit(Ze("grabon")).emit(Ze("grab"));else{Pe=t.dragData.possibleDragElements=he.collection();var We=he.$(function(Qe){return Qe.isNode()&&Qe.selected()&&t.nodeIsGrabbable(Qe)});v(We,{addToList:Pe}),Se.emit(Ze("grabon")),We.forEach(ot)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=Se,t.hoverData.downs=qe,t.hoverData.downTime=new Date().getTime()}r(Se,["mousedown","tapstart","vmousedown"],M,{x:ge[0],y:ge[1]}),Se==null?(pe[4]=1,t.data.bgActivePosistion={x:ge[0],y:ge[1]},t.redrawHint("select",!0),t.redraw()):Se.pannable()&&(pe[4]=1),rt()}pe[0]=pe[2]=ge[0],pe[1]=pe[3]=ge[1]}},!1),t.registerBinding(window,"mousemove",function(M){var he=t.hoverData.capture;if(!(!he&&!k(M))){var Ce=!1,ge=t.cy,pe=ge.zoom(),qe=[M.clientX,M.clientY],Se=t.projectIntoViewport(qe[0],qe[1]),Pe=t.hoverData.mdownPos,rt=t.hoverData.mdownGPos,ht=t.selection,Ze=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(Ze=t.findNearestElement(Se[0],Se[1],!0,!1));var ot=t.hoverData.last,We=t.hoverData.down,Qe=[Se[0]-ht[2],Se[1]-ht[3]],wt=t.dragData.possibleDragElements,Mt;if(rt){var rr=qe[0]-rt[0],ar=rr*rr,It=qe[1]-rt[1],Wt=It*It,Vt=ar+Wt;t.hoverData.isOverThresholdDrag=Mt=Vt>=t.desktopTapThreshold2}var yr=a(M);Mt&&(t.hoverData.tapholdCancelled=!0);var Ir=function(){var hr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];hr.length===0?(hr.push(Qe[0]),hr.push(Qe[1])):(hr[0]+=Qe[0],hr[1]+=Qe[1])};Ce=!0,r(Ze,["mousemove","vmousemove","tapdrag"],M,{x:Se[0],y:Se[1]});var Ta=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ge.emit({originalEvent:M,type:"boxstart",position:{x:Se[0],y:Se[1]}}),ht[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Mt){var Xr={originalEvent:M,type:"cxtdrag",position:{x:Se[0],y:Se[1]}};We?We.emit(Xr):ge.emit(Xr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||Ze!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:Se[0],y:Se[1]}}),t.hoverData.cxtOver=Ze,Ze&&Ze.emit({originalEvent:M,type:"cxtdragover",position:{x:Se[0],y:Se[1]}}))}}else if(t.hoverData.dragging){if(Ce=!0,ge.panningEnabled()&&ge.userPanningEnabled()){var Ca;if(t.hoverData.justStartedPan){var ti=t.hoverData.mdownPos;Ca={x:(Se[0]-ti[0])*pe,y:(Se[1]-ti[1])*pe},t.hoverData.justStartedPan=!1}else Ca={x:Qe[0]*pe,y:Qe[1]*pe};ge.panBy(Ca),ge.emit("dragpan"),t.hoverData.dragged=!0}Se=t.projectIntoViewport(M.clientX,M.clientY)}else if(ht[4]==1&&(We==null||We.pannable())){if(Mt){if(!t.hoverData.dragging&&ge.boxSelectionEnabled()&&(yr||!ge.panningEnabled()||!ge.userPanningEnabled()))Ta();else if(!t.hoverData.selecting&&ge.panningEnabled()&&ge.userPanningEnabled()){var qr=n(We,t.hoverData.downs);qr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ht[4]=0,t.data.bgActivePosistion=ea(Pe),t.redrawHint("select",!0),t.redraw())}We&&We.pannable()&&We.active()&&We.unactivate()}}else{if(We&&We.pannable()&&We.active()&&We.unactivate(),(!We||!We.grabbed())&&Ze!=ot&&(ot&&r(ot,["mouseout","tapdragout"],M,{x:Se[0],y:Se[1]}),Ze&&r(Ze,["mouseover","tapdragover"],M,{x:Se[0],y:Se[1]}),t.hoverData.last=Ze),We)if(Mt){if(ge.boxSelectionEnabled()&&yr)We&&We.grabbed()&&(g(wt),We.emit("freeon"),wt.emit("free"),t.dragData.didDrag&&(We.emit("dragfreeon"),wt.emit("dragfree"))),Ta();else if(We&&We.grabbed()&&t.nodeIsDraggable(We)){var Ut=!t.dragData.didDrag;Ut&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||v(wt,{inDragLayer:!0});var Ft={x:0,y:0};if(N(Qe[0])&&N(Qe[1])&&(Ft.x+=Qe[0],Ft.y+=Qe[1],Ut)){var Yt=t.hoverData.dragDelta;Yt&&N(Yt[0])&&N(Yt[1])&&(Ft.x+=Yt[0],Ft.y+=Yt[1])}t.hoverData.draggingEles=!0,wt.silentShift(Ft).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Ir();Ce=!0}if(ht[2]=Se[0],ht[3]=Se[1],Ce)return M.stopPropagation&&M.stopPropagation(),M.preventDefault&&M.preventDefault(),!1}},!1);var S,F,z;t.registerBinding(window,"mouseup",function(M){var he=t.hoverData.capture;if(he){t.hoverData.capture=!1;var Ce=t.cy,ge=t.projectIntoViewport(M.clientX,M.clientY),pe=t.selection,qe=t.findNearestElement(ge[0],ge[1],!0,!1),Se=t.dragData.possibleDragElements,Pe=t.hoverData.down,rt=a(M);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Pe&&Pe.unactivate(),t.hoverData.which===3){var ht={originalEvent:M,type:"cxttapend",position:{x:ge[0],y:ge[1]}};if(Pe?Pe.emit(ht):Ce.emit(ht),!t.hoverData.cxtDragged){var Ze={originalEvent:M,type:"cxttap",position:{x:ge[0],y:ge[1]}};Pe?Pe.emit(Ze):Ce.emit(Ze)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(r(qe,["mouseup","tapend","vmouseup"],M,{x:ge[0],y:ge[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(r(Pe,["click","tap","vclick"],M,{x:ge[0],y:ge[1]}),F=!1,M.timeStamp-z<=Ce.multiClickDebounceTime()?(S&&clearTimeout(S),F=!0,z=null,r(Pe,["dblclick","dbltap","vdblclick"],M,{x:ge[0],y:ge[1]})):(S=setTimeout(function(){F||r(Pe,["oneclick","onetap","voneclick"],M,{x:ge[0],y:ge[1]})},Ce.multiClickDebounceTime()),z=M.timeStamp)),Pe==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!a(M)&&(Ce.$(e).unselect(["tapunselect"]),Se.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Se=Ce.collection()),qe==Pe&&!t.dragData.didDrag&&!t.hoverData.selecting&&qe!=null&&qe._private.selectable&&(t.hoverData.dragging||(Ce.selectionType()==="additive"||rt?qe.selected()?qe.unselect(["tapunselect"]):qe.select(["tapselect"]):rt||(Ce.$(e).unmerge(qe).unselect(["tapunselect"]),qe.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ot=Ce.collection(t.getAllInBox(pe[0],pe[1],pe[2],pe[3]));t.redrawHint("select",!0),ot.length>0&&t.redrawHint("eles",!0),Ce.emit({type:"boxend",originalEvent:M,position:{x:ge[0],y:ge[1]}});var We=function(Mt){return Mt.selectable()&&!Mt.selected()};Ce.selectionType()==="additive"||rt||Ce.$(e).unmerge(ot).unselect(),ot.emit("box").stdFilter(We).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!pe[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Qe=Pe&&Pe.grabbed();g(Se),Qe&&(Pe.emit("freeon"),Se.emit("free"),t.dragData.didDrag&&(Pe.emit("dragfreeon"),Se.emit("dragfree")))}}pe[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var P=function(M){if(!t.scrollingPage){var he=t.cy,Ce=he.zoom(),ge=he.pan(),pe=t.projectIntoViewport(M.clientX,M.clientY),qe=[pe[0]*Ce+ge.x,pe[1]*Ce+ge.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){M.preventDefault();return}if(he.panningEnabled()&&he.userPanningEnabled()&&he.zoomingEnabled()&&he.userZoomingEnabled()){M.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var Se;M.deltaY!=null?Se=M.deltaY/-250:M.wheelDeltaY!=null?Se=M.wheelDeltaY/1e3:Se=M.wheelDelta/1e3,Se=Se*t.wheelSensitivity;var Pe=M.deltaMode===1;Pe&&(Se*=33);var rt=he.zoom()*Math.pow(10,Se);M.type==="gesturechange"&&(rt=t.gestureStartZoom*M.scale),he.zoom({level:rt,renderedPosition:{x:qe[0],y:qe[1]}}),he.emit(M.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",P,!0),t.registerBinding(window,"scroll",function(M){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(M){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||M.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(De){t.hasTouchStarted||P(De)},!0),t.registerBinding(t.container,"mouseout",function(M){var he=t.projectIntoViewport(M.clientX,M.clientY);t.cy.emit({originalEvent:M,type:"mouseout",position:{x:he[0],y:he[1]}})},!1),t.registerBinding(t.container,"mouseover",function(M){var he=t.projectIntoViewport(M.clientX,M.clientY);t.cy.emit({originalEvent:M,type:"mouseover",position:{x:he[0],y:he[1]}})},!1);var H,G,re,X,K,ie,fe,ve,oe,ce,Ee,xe,ye,de=function(M,he,Ce,ge){return Math.sqrt((Ce-M)*(Ce-M)+(ge-he)*(ge-he))},ae=function(M,he,Ce,ge){return(Ce-M)*(Ce-M)+(ge-he)*(ge-he)},we;t.registerBinding(t.container,"touchstart",we=function(M){if(t.hasTouchStarted=!0,!!k(M)){p(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var he=t.cy,Ce=t.touchData.now,ge=t.touchData.earlier;if(M.touches[0]){var pe=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Ce[0]=pe[0],Ce[1]=pe[1]}if(M.touches[1]){var pe=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Ce[2]=pe[0],Ce[3]=pe[1]}if(M.touches[2]){var pe=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Ce[4]=pe[0],Ce[5]=pe[1]}if(M.touches[1]){t.touchData.singleTouchMoved=!0,g(t.dragData.touchDragEles);var qe=t.findContainerClientCoords();oe=qe[0],ce=qe[1],Ee=qe[2],xe=qe[3],H=M.touches[0].clientX-oe,G=M.touches[0].clientY-ce,re=M.touches[1].clientX-oe,X=M.touches[1].clientY-ce,ye=0<=H&&H<=Ee&&0<=re&&re<=Ee&&0<=G&&G<=xe&&0<=X&&X<=xe;var Se=he.pan(),Pe=he.zoom();K=de(H,G,re,X),ie=ae(H,G,re,X),fe=[(H+re)/2,(G+X)/2],ve=[(fe[0]-Se.x)/Pe,(fe[1]-Se.y)/Pe];var rt=200,ht=rt*rt;if(ie<ht&&!M.touches[2]){var Ze=t.findNearestElement(Ce[0],Ce[1],!0,!0),ot=t.findNearestElement(Ce[2],Ce[3],!0,!0);Ze&&Ze.isNode()?(Ze.activate().emit({originalEvent:M,type:"cxttapstart",position:{x:Ce[0],y:Ce[1]}}),t.touchData.start=Ze):ot&&ot.isNode()?(ot.activate().emit({originalEvent:M,type:"cxttapstart",position:{x:Ce[0],y:Ce[1]}}),t.touchData.start=ot):he.emit({originalEvent:M,type:"cxttapstart",position:{x:Ce[0],y:Ce[1]}}),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(M.touches[2])he.boxSelectionEnabled()&&M.preventDefault();else if(!M.touches[1]){if(M.touches[0]){var We=t.findNearestElements(Ce[0],Ce[1],!0,!0),Qe=We[0];if(Qe!=null&&(Qe.activate(),t.touchData.start=Qe,t.touchData.starts=We,t.nodeIsGrabbable(Qe))){var wt=t.dragData.touchDragEles=he.collection(),Mt=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Qe.selected()?(Mt=he.$(function(Vt){return Vt.selected()&&t.nodeIsGrabbable(Vt)}),v(Mt,{addToList:wt})):d(Qe,{addToList:wt}),u(Qe);var rr=function(yr){return{originalEvent:M,type:yr,position:{x:Ce[0],y:Ce[1]}}};Qe.emit(rr("grabon")),Mt?Mt.forEach(function(Vt){Vt.emit(rr("grab"))}):Qe.emit(rr("grab"))}r(Qe,["touchstart","tapstart","vmousedown"],M,{x:Ce[0],y:Ce[1]}),Qe==null&&(t.data.bgActivePosistion={x:pe[0],y:pe[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&r(t.touchData.start,["taphold"],M,{x:Ce[0],y:Ce[1]})},t.tapholdDuration)}}if(M.touches.length>=1){for(var ar=t.touchData.startPosition=[],It=0;It<Ce.length;It++)ar[It]=ge[It]=Ce[It];var Wt=M.touches[0];t.touchData.startGPosition=[Wt.clientX,Wt.clientY]}}},!1);var Te;t.registerBinding(window,"touchmove",Te=function(M){var he=t.touchData.capture;if(!(!he&&!k(M))){var Ce=t.selection,ge=t.cy,pe=t.touchData.now,qe=t.touchData.earlier,Se=ge.zoom();if(M.touches[0]){var Pe=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);pe[0]=Pe[0],pe[1]=Pe[1]}if(M.touches[1]){var Pe=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);pe[2]=Pe[0],pe[3]=Pe[1]}if(M.touches[2]){var Pe=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);pe[4]=Pe[0],pe[5]=Pe[1]}var rt=t.touchData.startGPosition,ht;if(he&&M.touches[0]&&rt){for(var Ze=[],ot=0;ot<pe.length;ot++)Ze[ot]=pe[ot]-qe[ot];var We=M.touches[0].clientX-rt[0],Qe=We*We,wt=M.touches[0].clientY-rt[1],Mt=wt*wt,rr=Qe+Mt;ht=rr>=t.touchTapThreshold2}if(he&&t.touchData.cxt){M.preventDefault();var ar=M.touches[0].clientX-oe,It=M.touches[0].clientY-ce,Wt=M.touches[1].clientX-oe,Vt=M.touches[1].clientY-ce,yr=ae(ar,It,Wt,Vt),Ir=yr/ie,Ta=150,Xr=Ta*Ta,Ca=1.5,ti=Ca*Ca;if(Ir>=ti||yr>=Xr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var qr={originalEvent:M,type:"cxttapend",position:{x:pe[0],y:pe[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(qr),t.touchData.start=null):ge.emit(qr)}}if(he&&t.touchData.cxt){var qr={originalEvent:M,type:"cxtdrag",position:{x:pe[0],y:pe[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(qr):ge.emit(qr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Ut=t.findNearestElement(pe[0],pe[1],!0,!0);(!t.touchData.cxtOver||Ut!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:M,type:"cxtdragout",position:{x:pe[0],y:pe[1]}}),t.touchData.cxtOver=Ut,Ut&&Ut.emit({originalEvent:M,type:"cxtdragover",position:{x:pe[0],y:pe[1]}}))}else if(he&&M.touches[2]&&ge.boxSelectionEnabled())M.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ge.emit({originalEvent:M,type:"boxstart",position:{x:pe[0],y:pe[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Ce[4]=1,!Ce||Ce.length===0||Ce[0]===void 0?(Ce[0]=(pe[0]+pe[2]+pe[4])/3,Ce[1]=(pe[1]+pe[3]+pe[5])/3,Ce[2]=(pe[0]+pe[2]+pe[4])/3+1,Ce[3]=(pe[1]+pe[3]+pe[5])/3+1):(Ce[2]=(pe[0]+pe[2]+pe[4])/3,Ce[3]=(pe[1]+pe[3]+pe[5])/3),t.redrawHint("select",!0),t.redraw();else if(he&&M.touches[1]&&!t.touchData.didSelect&&ge.zoomingEnabled()&&ge.panningEnabled()&&ge.userZoomingEnabled()&&ge.userPanningEnabled()){M.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ft=t.dragData.touchDragEles;if(Ft){t.redrawHint("drag",!0);for(var Yt=0;Yt<Ft.length;Yt++){var ri=Ft[Yt]._private;ri.grabbed=!1,ri.rscratch.inDragLayer=!1}}var hr=t.touchData.start,ar=M.touches[0].clientX-oe,It=M.touches[0].clientY-ce,Wt=M.touches[1].clientX-oe,Vt=M.touches[1].clientY-ce,Yu=de(ar,It,Wt,Vt),Ep=Yu/K;if(ye){var wp=ar-H,xp=It-G,Tp=Wt-re,Cp=Vt-X,Dp=(wp+Tp)/2,Sp=(xp+Cp)/2,rn=ge.zoom(),Ki=rn*Ep,ai=ge.pan(),Hu=ve[0]*rn+ai.x,Xu=ve[1]*rn+ai.y,Lp={x:-Ki/rn*(Hu-ai.x-Dp)+Hu,y:-Ki/rn*(Xu-ai.y-Sp)+Xu};if(hr&&hr.active()){var Ft=t.dragData.touchDragEles;g(Ft),t.redrawHint("drag",!0),t.redrawHint("eles",!0),hr.unactivate().emit("freeon"),Ft.emit("free"),t.dragData.didDrag&&(hr.emit("dragfreeon"),Ft.emit("dragfree"))}ge.viewport({zoom:Ki,pan:Lp,cancelOnFailedZoom:!0}),ge.emit("pinchzoom"),K=Yu,H=ar,G=It,re=Wt,X=Vt,t.pinching=!0}if(M.touches[0]){var Pe=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);pe[0]=Pe[0],pe[1]=Pe[1]}if(M.touches[1]){var Pe=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);pe[2]=Pe[0],pe[3]=Pe[1]}if(M.touches[2]){var Pe=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);pe[4]=Pe[0],pe[5]=Pe[1]}}else if(M.touches[0]&&!t.touchData.didSelect){var nr=t.touchData.start,Zi=t.touchData.last,Ut;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Ut=t.findNearestElement(pe[0],pe[1],!0,!0)),he&&nr!=null&&M.preventDefault(),he&&nr!=null&&t.nodeIsDraggable(nr))if(ht){var Ft=t.dragData.touchDragEles,qu=!t.dragData.didDrag;qu&&v(Ft,{inDragLayer:!0}),t.dragData.didDrag=!0;var an={x:0,y:0};if(N(Ze[0])&&N(Ze[1])&&(an.x+=Ze[0],an.y+=Ze[1],qu)){t.redrawHint("eles",!0);var ir=t.touchData.dragDelta;ir&&N(ir[0])&&N(ir[1])&&(an.x+=ir[0],an.y+=ir[1])}t.hoverData.draggingEles=!0,Ft.silentShift(an).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==qe[0]&&t.touchData.startPosition[1]==qe[1]&&t.redrawHint("eles",!0),t.redraw()}else{var ir=t.touchData.dragDelta=t.touchData.dragDelta||[];ir.length===0?(ir.push(Ze[0]),ir.push(Ze[1])):(ir[0]+=Ze[0],ir[1]+=Ze[1])}if(r(nr||Ut,["touchmove","tapdrag","vmousemove"],M,{x:pe[0],y:pe[1]}),(!nr||!nr.grabbed())&&Ut!=Zi&&(Zi&&Zi.emit({originalEvent:M,type:"tapdragout",position:{x:pe[0],y:pe[1]}}),Ut&&Ut.emit({originalEvent:M,type:"tapdragover",position:{x:pe[0],y:pe[1]}})),t.touchData.last=Ut,he)for(var Yt=0;Yt<pe.length;Yt++)pe[Yt]&&t.touchData.startPosition[Yt]&&ht&&(t.touchData.singleTouchMoved=!0);if(he&&(nr==null||nr.pannable())&&ge.panningEnabled()&&ge.userPanningEnabled()){var Ap=n(nr,t.touchData.starts);Ap&&(M.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=ea(t.touchData.startPosition)),t.swipePanning?(ge.panBy({x:Ze[0]*Se,y:Ze[1]*Se}),ge.emit("dragpan")):ht&&(t.swipePanning=!0,ge.panBy({x:We*Se,y:wt*Se}),ge.emit("dragpan"),nr&&(nr.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var Pe=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);pe[0]=Pe[0],pe[1]=Pe[1]}}for(var ot=0;ot<pe.length;ot++)qe[ot]=pe[ot];he&&M.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Ae;t.registerBinding(window,"touchcancel",Ae=function(M){var he=t.touchData.start;t.touchData.capture=!1,he&&he.unactivate()});var Ne,Ue,He,Me;if(t.registerBinding(window,"touchend",Ne=function(M){var he=t.touchData.start,Ce=t.touchData.capture;if(Ce)M.touches.length===0&&(t.touchData.capture=!1),M.preventDefault();else return;var ge=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var pe=t.cy,qe=pe.zoom(),Se=t.touchData.now,Pe=t.touchData.earlier;if(M.touches[0]){var rt=t.projectIntoViewport(M.touches[0].clientX,M.touches[0].clientY);Se[0]=rt[0],Se[1]=rt[1]}if(M.touches[1]){var rt=t.projectIntoViewport(M.touches[1].clientX,M.touches[1].clientY);Se[2]=rt[0],Se[3]=rt[1]}if(M.touches[2]){var rt=t.projectIntoViewport(M.touches[2].clientX,M.touches[2].clientY);Se[4]=rt[0],Se[5]=rt[1]}he&&he.unactivate();var ht;if(t.touchData.cxt){if(ht={originalEvent:M,type:"cxttapend",position:{x:Se[0],y:Se[1]}},he?he.emit(ht):pe.emit(ht),!t.touchData.cxtDragged){var Ze={originalEvent:M,type:"cxttap",position:{x:Se[0],y:Se[1]}};he?he.emit(Ze):pe.emit(Ze)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!M.touches[2]&&pe.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ot=pe.collection(t.getAllInBox(ge[0],ge[1],ge[2],ge[3]));ge[0]=void 0,ge[1]=void 0,ge[2]=void 0,ge[3]=void 0,ge[4]=0,t.redrawHint("select",!0),pe.emit({type:"boxend",originalEvent:M,position:{x:Se[0],y:Se[1]}});var We=function(Xr){return Xr.selectable()&&!Xr.selected()};ot.emit("box").stdFilter(We).select().emit("boxselect"),ot.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(he!=null&&he.unactivate(),M.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!M.touches[1]){if(!M.touches[0]){if(!M.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Qe=t.dragData.touchDragEles;if(he!=null){var wt=he._private.grabbed;g(Qe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),wt&&(he.emit("freeon"),Qe.emit("free"),t.dragData.didDrag&&(he.emit("dragfreeon"),Qe.emit("dragfree"))),r(he,["touchend","tapend","vmouseup","tapdragout"],M,{x:Se[0],y:Se[1]}),he.unactivate(),t.touchData.start=null}else{var Mt=t.findNearestElement(Se[0],Se[1],!0,!0);r(Mt,["touchend","tapend","vmouseup","tapdragout"],M,{x:Se[0],y:Se[1]})}var rr=t.touchData.startPosition[0]-Se[0],ar=rr*rr,It=t.touchData.startPosition[1]-Se[1],Wt=It*It,Vt=ar+Wt,yr=Vt*qe*qe;t.touchData.singleTouchMoved||(he||pe.$(":selected").unselect(["tapunselect"]),r(he,["tap","vclick"],M,{x:Se[0],y:Se[1]}),Ue=!1,M.timeStamp-Me<=pe.multiClickDebounceTime()?(He&&clearTimeout(He),Ue=!0,Me=null,r(he,["dbltap","vdblclick"],M,{x:Se[0],y:Se[1]})):(He=setTimeout(function(){Ue||r(he,["onetap","voneclick"],M,{x:Se[0],y:Se[1]})},pe.multiClickDebounceTime()),Me=M.timeStamp)),he!=null&&!t.dragData.didDrag&&he._private.selectable&&yr<t.touchTapThreshold2&&!t.pinching&&(pe.selectionType()==="single"?(pe.$(e).unmerge(he).unselect(["tapunselect"]),he.select(["tapselect"])):he.selected()?he.unselect(["tapunselect"]):he.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Ir=0;Ir<Se.length;Ir++)Pe[Ir]=Se[Ir];t.dragData.didDrag=!1,M.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=null,t.touchData.startGPosition=null,t.touchData.didSelect=!1),M.touches.length<2&&(M.touches.length===1&&(t.touchData.startGPosition=[M.touches[0].clientX,M.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent=="undefined"){var Oe=[],Ve=function(M){return{clientX:M.clientX,clientY:M.clientY,force:1,identifier:M.pointerId,pageX:M.pageX,pageY:M.pageY,radiusX:M.width/2,radiusY:M.height/2,screenX:M.screenX,screenY:M.screenY,target:M.target}},ke=function(M){return{event:M,touch:Ve(M)}},Ie=function(M){Oe.push(ke(M))},Be=function(M){for(var he=0;he<Oe.length;he++){var Ce=Oe[he];if(Ce.event.pointerId===M.pointerId){Oe.splice(he,1);return}}},je=function(M){var he=Oe.filter(function(Ce){return Ce.event.pointerId===M.pointerId})[0];he.event=M,he.touch=Ve(M)},Xe=function(M){M.touches=Oe.map(function(he){return he.touch})},_e=function(M){return M.pointerType==="mouse"||M.pointerType===4};t.registerBinding(t.container,"pointerdown",function(De){_e(De)||(De.preventDefault(),Ie(De),Xe(De),we(De))}),t.registerBinding(t.container,"pointerup",function(De){_e(De)||(Be(De),Xe(De),Ne(De))}),t.registerBinding(t.container,"pointercancel",function(De){_e(De)||(Be(De),Xe(De),Ae(De))}),t.registerBinding(t.container,"pointermove",function(De){_e(De)||(De.preventDefault(),je(De),Xe(De),Te(De))})}};var gr={};gr.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,s,o){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,l,u){return Ba(o,l,this.points,a,n,i/2,s/2,u)},checkPoint:function(a,n,i,s,o,l,u){return vr(a,n,this.points,l,u,s,o,[0,-1],i)}}},gr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){return qf(i,s,e,r,a/2+o,n/2+o)},checkPoint:function(e,r,a,n,i,s,o){return zr(e,r,n,i,s,o,a)}}},gr.generateRoundPolygon=function(t,e){for(var r=new Array(e.length*2),a=0;a<e.length/2;a++){var n=a*2,i=void 0;a<e.length/2-1?i=(a+1)*2:i=0,r[a*4]=e[n],r[a*4+1]=e[n+1];var s=e[i]-e[n],o=e[i+1]-e[n+1],l=Math.sqrt(s*s+o*o);r[a*4+2]=s/l,r[a*4+3]=o/l}return this.nodeShapes[t]={renderer:this,name:t,points:r,draw:function(f,h,c,v,d){this.renderer.nodeShapeImpl("round-polygon",f,h,c,v,d,this.points)},intersectLine:function(f,h,c,v,d,g,y){return Wf(d,g,this.points,f,h,c,v)},checkPoint:function(f,h,c,v,d,g,y){return Xf(f,h,this.points,g,y,v,d)}}},gr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:zt(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){return Ns(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var l=Fa(n,i),u=l*2;return!!(vr(e,r,this.points,s,o,n,i-u,[0,-1],a)||vr(e,r,this.points,s,o,n-u,i,[0,-1],a)||zr(e,r,u,u,s-n/2+l,o-i/2+l,a)||zr(e,r,u,u,s+n/2-l,o-i/2+l,a)||zr(e,r,u,u,s+n/2-l,o+i/2-l,a)||zr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}},gr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:ks(),points:zt(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},generateCutTrianglePts:function(e,r,a,n){var i=this.cornerLength,s=r/2,o=e/2,l=a-o,u=a+o,f=n-s,h=n+s;return{topLeft:[l,f+i,l+i,f,l+i,f+i],topRight:[u-i,f,u,f+i,u-i,f+i],bottomRight:[u,h-i,u-i,h,u-i,h-i],bottomLeft:[l+i,h,l,h-i,l+i,h-i]}},intersectLine:function(e,r,a,n,i,s,o){var l=this.generateCutTrianglePts(a+2*o,n+2*o,e,r),u=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return Ba(i,s,u,e,r)},checkPoint:function(e,r,a,n,i,s,o){if(vr(e,r,this.points,s,o,n,i-2*this.cornerLength,[0,-1],a)||vr(e,r,this.points,s,o,n-2*this.cornerLength,i,[0,-1],a))return!0;var l=this.generateCutTrianglePts(n,i,s,o);return _t(e,r,l.topLeft)||_t(e,r,l.topRight)||_t(e,r,l.bottomRight)||_t(e,r,l.bottomLeft)}}},gr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:zt(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){var l=.15,u=.5,f=.85,h=this.generateBarrelBezierPts(a+2*o,n+2*o,e,r),c=function(g){var y=ta({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),p=ta({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},u),m=ta({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f);return[g[0],g[1],y.x,y.y,p.x,p.y,m.x,m.y,g[4],g[5]]},v=[].concat(c(h.topLeft),c(h.topRight),c(h.bottomRight),c(h.bottomLeft));return Ba(i,s,v,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,s=e/2,o=a-s,l=a+s,u=n-i,f=n+i,h=yi(e,r),c=h.heightOffset,v=h.widthOffset,d=h.ctrlPtOffsetPct*e,g={topLeft:[o,u+c,o+d,u,o+v,u],topRight:[l-v,u,l-d,u,l,u+c],bottomRight:[l,f-c,l-d,f,l-v,f],bottomLeft:[o+v,f,o+d,f,o,f-c]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,a,n,i,s,o){var l=yi(n,i),u=l.heightOffset,f=l.widthOffset;if(vr(e,r,this.points,s,o,n,i-2*u,[0,-1],a)||vr(e,r,this.points,s,o,n-2*f,i,[0,-1],a))return!0;for(var h=this.generateBarrelBezierPts(n,i,s,o),c=function(T,k,S){var F=S[4],z=S[2],P=S[0],H=S[5],G=S[1],re=Math.min(F,P),X=Math.max(F,P),K=Math.min(H,G),ie=Math.max(H,G);if(re<=T&&T<=X&&K<=k&&k<=ie){var fe=Kf(F,z,P),ve=_f(fe[0],fe[1],fe[2],T),oe=ve.filter(function(ce){return 0<=ce&&ce<=1});if(oe.length>0)return oe[0]}return null},v=Object.keys(h),d=0;d<v.length;d++){var g=v[d],y=h[g],p=c(e,r,y);if(p!=null){var m=y[5],b=y[3],x=y[1],I=Dt(m,b,x,p);if(y.isTop&&I<=r||y.isBottom&&r<=I)return!0}}return!1}}},gr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:zt(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){var l=e-(a/2+o),u=r-(n/2+o),f=u,h=e+(a/2+o),c=Tr(i,s,e,r,l,u,h,f,!1);return c.length>0?c:Ns(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var l=Fa(n,i),u=2*l;if(vr(e,r,this.points,s,o,n,i-u,[0,-1],a)||vr(e,r,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(_t(e,r,c)||zr(e,r,u,u,s+n/2-l,o+i/2-l,a)||zr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}},gr.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",zt(3,0)),this.generateRoundPolygon("round-triangle",zt(3,0)),this.generatePolygon("rectangle",zt(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",zt(5,0)),this.generateRoundPolygon("round-pentagon",zt(5,0)),this.generatePolygon("hexagon",zt(6,0)),this.generateRoundPolygon("round-hexagon",zt(6,0)),this.generatePolygon("heptagon",zt(7,0)),this.generateRoundPolygon("round-heptagon",zt(7,0)),this.generatePolygon("octagon",zt(8,0)),this.generateRoundPolygon("round-octagon",zt(8,0));var a=new Array(20);{var n=gi(5,0),i=gi(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=Rs(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.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)}t.makePolygon=function(u){var f=u.join("$"),h="polygon-"+f,c;return(c=this[h])?c:e.generatePolygon(h,u)}};var Ja={};Ja.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},Ja.redraw=function(t){t=t||Cs();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=t},Ja.beforeRender=function(t,e){if(!this.destroyed){e==null&&bt("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var Eu=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Ja.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function a(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){Eu(t,!0,n);var i=cr();t.render(t.renderOptions);var s=t.lastDrawTime=cr();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-i;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else Eu(t,!1,n);t.skipFrame=!1,dn(a)}};dn(r)}};var Sg=function(e){this.init(e)},wu=Sg,ba=wu.prototype;ba.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],ba.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container();if(D){var a=D.document,n=a.head,i="__________cytoscape_stylesheet",s="__________cytoscape_container",o=a.getElementById(i)!=null;if(r.className.indexOf(s)<0&&(r.className=(r.className||"")+" "+s),!o){var l=a.createElement("style");l.id=i,l.innerHTML="."+s+" { position: relative; }",n.insertBefore(l,n.children[0])}var u=D.getComputedStyle(r),f=u.getPropertyValue("position");f==="static"&&lt("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=t.showFps,e.debug=t.debug,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=N(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.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()},ba.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},ba.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch(i){}},ba.isHeadless=function(){return!1},[Vi,mu,bu,ma,gr,Ja].forEach(function(t){$e(ba,t)});var _i=1e3/60,xu={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),s=function(u,f){var h=cr(),c=n.averageRedrawTime,v=n.lastRedrawTime,d=[],g=n.cy.extent(),y=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var p=cr(),m=p-h,b=p-f;if(v<_i){var x=_i-(u?c:0);if(b>=e.deqFastCost*x)break}else if(u){if(m>=e.deqCost*v||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*_i)break;var I=e.deq(a,y,g);if(I.length>0)for(var O=0;O<I.length;O++)d.push(I[O]);else break}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,y,g)&&i())},o=e.priority||ui;n.beforeRender(s,o(a))}}}},Lg=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:pn;W(this,t),this.idsByKey=new or,this.keyForId=new or,this.cachesByLvl=new or,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return L(t,[{key:"getIdsFor",value:function(r){r==null&&bt("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new jr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new or,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),t}(),Tu=25,Jn=50,jn=-4,Ui=3,Ag=7.99,Og=8,Ng=1024,Mg=1024,Ig=1024,Rg=.2,kg=.8,Pg=10,Bg=.15,Fg=.1,zg=.9,Gg=.9,Vg=100,$g=1,Ea={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},_g=St({getKey:null,doesEleInvalidateKey:pn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Es,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ja=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=_g(r);$e(a,n),a.lookup=new Lg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ct=ja.prototype;Ct.reasons=Ea,Ct.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},Ct.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a},Ct.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Ra(function(r,a){return a.reqs-r.reqs});return e},Ct.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},Ct.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(hi(o*r))),a<jn)a=jn;else if(o>=Ag||a>Ui)return null;var u=Math.pow(2,a),f=e.h*u,h=e.w*u,c=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,c))return null;var v=l.get(t,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=Tu?d=Tu:f<=Jn?d=Jn:d=Math.ceil(f/Jn)*Jn,f>Ig||h>Mg)return null;var g=i.getTextureQueue(d),y=g[g.length-2],p=function(){return i.recycleTexture(d,h)||i.addTexture(d,h)};y||(y=g[g.length-1]),y||(y=p()),y.width-y.usedWidth<h&&(y=p());for(var m=function(X){return X&&X.scaledLabelShown===c},b=n&&n===Ea.dequeue,x=n&&n===Ea.highQuality,I=n&&n===Ea.downscale,O,T=a+1;T<=Ui;T++){var k=l.get(t,T);if(k){O=k;break}}var S=O&&O.level===a+1?O:null,F=function(){y.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,y.usedWidth,0,h,f)};if(y.context.setTransform(1,0,0,1,0,0),y.context.clearRect(y.usedWidth,0,h,d),m(S))F();else if(m(O))if(x){for(var z=O.level;z>a;z--)S=i.getElement(t,e,r,z,Ea.downscale);F()}else return i.queueElement(t,O.level-1),O;else{var P;if(!b&&!x&&!I)for(var H=a-1;H>=jn;H--){var G=l.get(t,H);if(G){P=G;break}}if(m(P))return i.queueElement(t,a),P;y.context.translate(y.usedWidth,0),y.context.scale(u,u),this.drawElement(y.context,t,e,c,!1),y.context.scale(1/u,1/u),y.context.translate(-y.usedWidth,0)}return v={x:y.usedWidth,texture:y,level:a,scale:u,width:h,height:f,scaledLabelShown:c},y.usedWidth+=Math.ceil(h+Og),y.eleCaches.push(v),l.set(t,a,v),i.checkTextureFullness(y),v},Ct.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])},Ct.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=jn;i<=Ui;i++){var s=r.getForCachedKey(t,i);s&&a.push(s)}var o=r.invalidate(t);if(o)for(var l=0;l<a.length;l++){var u=a[l],f=u.texture;f.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}},Ct.checkTextureUtility=function(t){t.invalidatedWidth>=Rg*t.width&&this.retireTexture(t)},Ct.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>kg&&t.fullnessChecks>=Pg?wr(r,t):t.fullnessChecks++},Ct.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;wr(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}li(i);var l=e.getRetiredTextureQueue(r);l.push(t)},Ct.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(Ng,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},Ct.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,li(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),wr(n,s),a.push(s),s}},Ct.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}},Ct.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<$g&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var h=e.getBoundingBox(u);e.getElement(u,h,t,o.level,Ea.dequeue)}return n},Ct.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=oi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))},Ct.onDequeue=function(t){this.onDequeues.push(t)},Ct.offDequeue=function(t){wr(this.onDequeues,t)},Ct.setupDequeueing=xu.setupDequeueing({deqRedrawThreshold:Vg,deqCost:Bg,deqAvgCost:Fg,deqNoDrawCost:zg,deqFastCost:Gg,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var s=r[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(vi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Ug=1,en=-4,ei=2,Yg=3.99,Hg=50,Xg=50,qg=.15,Wg=.1,Kg=.9,Zg=.9,Qg=1,Cu=250,Jg=4e3*4e3,jg=!0,Du=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=cr()-2*Cu,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=vn(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Xg),a.beforeRender(function(s,o){o-r.lastInvalidationTime<=Cu?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(o,l){return l.reqs-o.reqs};r.layersQueue=new Ra(i),r.setupDequeueing()},Nt=Du.prototype,Su=0,ep=Math.pow(2,53)-1;Nt.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),s={id:Su=++Su%ep,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(r,r),o.translate(l,u),s},Nt.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(hi(s*e)),r<en)r=en;else if(s>=Yg||r>ei)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),f=l[r]=l[r]||[],h,c=a.levelIsComplete(r,t),v,d=function(){var F=function(re){if(a.validateLayersElesOrdering(re,t),a.levelIsComplete(re,t))return v=l[re],!0},z=function(re){if(!v)for(var X=r+re;en<=X&&X<=ei&&!F(X);X+=re);};z(1),z(-1);for(var P=f.length-1;P>=0;P--){var H=f[P];H.invalid&&wr(f,H)}};if(!c)d();else return f;var g=function(){if(!h){h=$t();for(var F=0;F<t.length;F++)Ff(h,t[F].boundingBox())}return h},y=function(F){F=F||{};var z=F.after;g();var P=h.w*u*(h.h*u);if(P>Jg)return null;var H=a.makeLayer(h,r);if(z!=null){var G=f.indexOf(z)+1;f.splice(G,0,H)}else(F.insert===void 0||F.insert)&&f.unshift(H);return H};if(a.skipping&&!o)return null;for(var p=null,m=t.length/Ug,b=!o,x=0;x<t.length;x++){var I=t[x],O=I._private.rscratch,T=O.imgLayerCaches=O.imgLayerCaches||{},k=T[r];if(k){p=k;continue}if((!p||p.eles.length>=m||!Os(p.bb,I.boundingBox()))&&(p=y({insert:!0,after:p}),!p))return null;v||b?a.queueLayer(p,I):a.drawEleInLayer(p,I,r,e),p.eles.push(I),T[r]=p}return v||(b?null:f)},Nt.getEleLevelForLayerLevel=function(t,e){return t},Nt.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,jg),i.setImgSmoothing(s,!0))},Nt.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length},Nt.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}},Nt.updateElementsInLayers=function(t,e){for(var r=this,a=Le(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],s=a?t[n]:t[n].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=en;u<=ei;u++){var f=l[u];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}},Nt.haveLayers=function(){for(var t=this,e=!1,r=en;r<=ei;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e},Nt.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=cr(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))},Nt.invalidateLayer=function(t){if(this.lastInvalidationTime=cr(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];wr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}},Nt.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})},Nt.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()},Nt.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}},Nt.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Qg&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a},Nt.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var s=t.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}},Nt.requestRedraw=vn(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100),Nt.setupDequeueing=xu.setupDequeueing({deqRedrawThreshold:Hg,deqCost:qg,deqAvgCost:Wg,deqNoDrawCost:Kg,deqFastCost:Zg,deq:function(e,r){return e.dequeue(r)},onDeqd:ui,shouldRedraw:Es,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Lu={},Au;function tp(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function rp(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function Ou(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var s=r,o=r[0];t.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function ap(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,s=i[0];t.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function np(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}Lu.arrowShapeImpl=function(t){return(Au||(Au={polygon:tp,"triangle-backcurve":rp,"triangle-tee":Ou,"circle-triangle":ap,"triangle-cross":Ou,circle:np}))[t]};var fr={};fr.drawElement=function(t,e,r,a,n,i){var s=this;e.isNode()?s.drawNode(t,e,r,a,n,i):s.drawEdge(t,e,r,a,n,i)},fr.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)},fr.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)},fr.drawCachedElementPortion=function(t,e,r,a,n,i,s,o){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var f=r.getElement(e,u,a,n,i);if(f!=null){var h=o(l,e);if(h===0)return;var c=s(l,e),v=u.x1,d=u.y1,g=u.w,y=u.h,p,m,b,x,I;if(c!==0){var O=r.getRotationPoint(e);b=O.x,x=O.y,t.translate(b,x),t.rotate(c),I=l.getImgSmoothing(t),I||l.setImgSmoothing(t,!0);var T=r.getRotationOffset(e);p=T.x,m=T.y}else p=v,m=d;var k;h!==1&&(k=t.globalAlpha,t.globalAlpha=k*h),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,p,m,g,y),h!==1&&(t.globalAlpha=k),c!==0&&(t.rotate(-c),t.translate(-b,-x),I||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var ip=function(){return 0},sp=function(e,r){return e.getTextAngle(r,null)},op=function(e,r){return e.getTextAngle(r,"source")},up=function(e,r){return e.getTextAngle(r,"target")},lp=function(e,r){return r.effectiveOpacity()},Yi=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};fr.drawCachedElement=function(t,e,r,a,n,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,f=o.slbTxrCache,h=o.tlbTxrCache,c=e.boundingBox(),v=i===!0?l.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||vi(c,a))){var d=e.isEdge(),g=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,r,n,v,ip,lp),(!d||!g)&&s.drawCachedElementPortion(t,e,u,r,n,v,sp,Yi),d&&!g&&(s.drawCachedElementPortion(t,e,f,r,n,v,op,Yi),s.drawCachedElementPortion(t,e,h,r,n,v,up,Yi)),s.drawElementOverlay(t,e)}},fr.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}},fr.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(t,s,r,a)}},fr.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(t,s,r,a)}},fr.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(t,e,r,a)};var pr={};pr.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=u*f,y=u*f,p=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;h==="straight-triangle"?(s.eleStrokeStyle(t,e,P),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=d,s.eleStrokeStyle(t,e,P),s.drawEdgePath(e,t,o.allpts,c),t.lineCap="butt")},m=function(){n&&s.drawEdgeOverlay(t,e)},b=function(){n&&s.drawEdgeUnderlay(t,e)},x=function(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;s.drawArrowheads(t,e,P)},I=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var O=e.pstyle("ghost").value==="yes";if(O){var T=e.pstyle("ghost-offset-x").pfValue,k=e.pstyle("ghost-offset-y").pfValue,S=e.pstyle("ghost-opacity").value,F=g*S;t.translate(T,k),p(F),x(F),t.translate(-T,-k)}b(),p(),x(),m(),I(),r&&t.translate(l.x1,l.y1)}};var Nu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};pr.drawEdgeOverlay=Nu("overlay"),pr.drawEdgeUnderlay=Nu("underlay"),pr.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+3]);break;case"straight":case"segments":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])},pr.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(r[n]-l[0],r[n+1]-l[1]),e.lineTo(r[n]+l[0],r[n+1]+l[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}},pr.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)},pr.drawArrowhead=function(t,e,r,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,h=e.pstyle("width").pfValue,c=e.pstyle("opacity").value;s===void 0&&(s=c);var v=t.globalCompositeOperation;(s!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,h,l,a,n,i),t.globalCompositeOperation=v);var d=e.pstyle(r+"-arrow-color").value;o.colorFillStyle(t,d[0],d[1],d[2],s),o.colorStrokeStyle(t,d[0],d[1],d[2],s),o.drawArrowShape(e,t,f,h,l,a,n,i)}}},pr.drawArrowShape=function(t,e,r,a,n,i,s,o){var l=this,u=this.usePaths()&&n!=="triangle-cross",f=!1,h,c=e,v={x:i,y:s},d=t.pstyle("arrow-scale").value,g=this.getArrowWidth(a,d),y=l.arrowShapes[n];if(u){var p=l.arrowPathCache=l.arrowPathCache||[],m=Pr(n),b=p[m];b!=null?(h=e=b,f=!0):(h=e=new Path2D,p[m]=h)}f||(e.beginPath&&e.beginPath(),u?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,g,o,v,a),e.closePath&&e.closePath()),e=c,u&&(e.translate(i,s),e.rotate(o),e.scale(g,g)),(r==="filled"||r==="both")&&(u?e.fill(h):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=(y.matchEdgeWidth?a:1)/(u?g:1),e.lineJoin="miter",u?e.stroke(h):e.stroke()),u&&(e.scale(1/g,1/g),e.rotate(-o),e.translate(-i,-s))};var Hi={};Hi.safeDrawImage=function(t,e,r,a,n,i,s,o,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{t.drawImage(e,r,a,n,i,s,o,l,u)}catch(f){lt(f)}},Hi.drawInscribedImage=function(t,e,r,a,n){var i=this,s=r.position(),o=s.x,l=s.y,u=r.cy().style(),f=u.getIndexedStyle.bind(u),h=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),v=r.width(),d=r.height(),g=r.padding()*2,y=v+(f(r,"background-width-relative-to","value",a)==="inner"?0:g),p=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:g),m=r._private.rscratch,b=f(r,"background-clip","value",a),x=b==="node",I=f(r,"background-image-opacity","value",a)*n,O=f(r,"background-image-smoothing","value",a),T=e.width||e.cachedW,k=e.height||e.cachedH;(T==null||k==null)&&(document.body.appendChild(e),T=e.cachedW=e.width||e.offsetWidth,k=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var S=T,F=k;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?S=f(r,"background-width","pfValue",a)*y:S=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?F=f(r,"background-height","pfValue",a)*p:F=f(r,"background-height","pfValue",a)),!(S===0||F===0)){if(h==="contain"){var z=Math.min(y/S,p/F);S*=z,F*=z}else if(h==="cover"){var z=Math.max(y/S,p/F);S*=z,F*=z}var P=o-y/2,H=f(r,"background-position-x","units",a),G=f(r,"background-position-x","pfValue",a);H==="%"?P+=(y-S)*G:P+=G;var re=f(r,"background-offset-x","units",a),X=f(r,"background-offset-x","pfValue",a);re==="%"?P+=(y-S)*X:P+=X;var K=l-p/2,ie=f(r,"background-position-y","units",a),fe=f(r,"background-position-y","pfValue",a);ie==="%"?K+=(p-F)*fe:K+=fe;var ve=f(r,"background-offset-y","units",a),oe=f(r,"background-offset-y","pfValue",a);ve==="%"?K+=(p-F)*oe:K+=oe,m.pathCache&&(P-=o,K-=l,o=0,l=0);var ce=t.globalAlpha;t.globalAlpha=I;var Ee=i.getImgSmoothing(t),xe=!1;if(O==="no"&&Ee?(i.setImgSmoothing(t,!1),xe=!0):O==="yes"&&!Ee&&(i.setImgSmoothing(t,!0),xe=!0),c==="no-repeat")x&&(t.save(),m.pathCache?t.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,y,p),t.clip())),i.safeDrawImage(t,e,0,0,T,k,P,K,S,F),x&&t.restore();else{var ye=t.createPattern(e,c);t.fillStyle=ye,i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,y,p),t.translate(P,K),t.fill(),t.translate(-P,-K)}t.globalAlpha=ce,xe&&i.setImgSmoothing(t,Ee)}};var Ur={};Ur.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(hi(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(i<s)},Ur.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(s.drawText(t,e,null,v,i),e.isEdge()&&(s.drawText(t,e,"source",v,i),s.drawText(t,e,"target",v,i))):s.drawText(t,e,n,v,i),r&&t.translate(d.x1,d.y1)},Ur.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e},Ur.setupTextStyle=function(t,e){var r=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,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],l)};function fp(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),t.fill()}Ur.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=jt(n,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r},Ur.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=jt(s,"labelX",r),u=jt(s,"labelY",r),f,h,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var v=r?r+"-":"",d=jt(s,"labelWidth",r),g=jt(s,"labelHeight",r),y=e.pstyle(v+"text-margin-x").pfValue,p=e.pstyle(v+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,x=e.pstyle("text-valign").value;m&&(b="center",x="center"),l+=y,u+=p;var I;switch(a?I=this.getTextAngle(e,r):I=0,I!==0&&(f=l,h=u,t.translate(f,h),t.rotate(I),l=0,u=0),x){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var O=e.pstyle("text-background-opacity").value,T=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,S=e.pstyle("text-background-padding").pfValue;if(O>0||k>0&&T>0){var F=l-S;switch(b){case"left":F-=d;break;case"center":F-=d/2;break}var z=u-g-S,P=d+2*S,H=g+2*S;if(O>0){var G=t.fillStyle,re=e.pstyle("text-background-color").value;t.fillStyle="rgba("+re[0]+","+re[1]+","+re[2]+","+O*o+")";var X=e.pstyle("text-background-shape").strValue;X.indexOf("round")===0?fp(t,F,z,P,H,2):t.fillRect(F,z,P,H),t.fillStyle=G}if(k>0&&T>0){var K=t.strokeStyle,ie=t.lineWidth,fe=e.pstyle("text-border-color").value,ve=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+fe[0]+","+fe[1]+","+fe[2]+","+T*o+")",t.lineWidth=k,t.setLineDash)switch(ve){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=k/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(t.strokeRect(F,z,P,H),ve==="double"){var oe=k/2;t.strokeRect(F+oe,z+oe,P-oe*2,H-oe*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=ie,t.strokeStyle=K}}var ce=2*e.pstyle("text-outline-width").pfValue;if(ce>0&&(t.lineWidth=ce),e.pstyle("text-wrap").value==="wrap"){var Ee=jt(s,"labelWrapCachedLines",r),xe=jt(s,"labelLineHeight",r),ye=d/2,de=this.getLabelJustification(e);switch(de==="auto"||(b==="left"?de==="left"?l+=-d:de==="center"&&(l+=-ye):b==="center"?de==="left"?l+=-ye:de==="right"&&(l+=ye):b==="right"&&(de==="center"?l+=ye:de==="right"&&(l+=d))),x){case"top":u-=(Ee.length-1)*xe;break;case"center":case"bottom":u-=(Ee.length-1)*xe;break}for(var ae=0;ae<Ee.length;ae++)ce>0&&t.strokeText(Ee[ae],l,u),t.fillText(Ee[ae],l,u),u+=xe}else ce>0&&t.strokeText(c,l,u),t.fillText(c,l,u);I!==0&&(t.rotate(-I),t.translate(-f,-h))}}};var wa={};wa.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,f=u.rscratch,h=e.position();if(!(!N(h.x)||!N(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,v=s.usePaths(),d,g=!1,y=e.padding();o=e.width()+2*y,l=e.height()+2*y;var p;r&&(p=r,t.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,x=new Array(b.length),I=new Array(b.length),O=0,T=0;T<b.length;T++){var k=b[T],S=x[T]=k!=null&&k!=="none";if(S){var F=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",T);O++,I[T]=s.getCachedImage(k,F,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var z=e.pstyle("background-blacken").value,P=e.pstyle("border-width").pfValue,H=e.pstyle("background-opacity").value*c,G=e.pstyle("border-color").value,re=e.pstyle("border-style").value,X=e.pstyle("border-opacity").value*c;t.lineJoin="miter";var K=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:H;s.eleFillStyle(t,e,Ie)},ie=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;s.colorStrokeStyle(t,G[0],G[1],G[2],Ie)},fe=e.pstyle("shape").strValue,ve=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(h.x,h.y);var oe=s.nodePathCache=s.nodePathCache||[],ce=ms(fe==="polygon"?fe+","+ve.join(","):fe,""+l,""+o),Ee=oe[ce];Ee!=null?(d=Ee,g=!0,f.pathCache=d):(d=new Path2D,oe[ce]=f.pathCache=d)}var xe=function(){if(!g){var Ie=h;v&&(Ie={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||t,Ie.x,Ie.y,o,l)}v?t.fill(d):t.fill()},ye=function(){for(var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,je=u.backgrounding,Xe=0,_e=0;_e<I.length;_e++){var De=e.cy().style().getIndexedStyle(e,"background-image-containment","value",_e);if(Be&&De==="over"||!Be&&De==="inside"){Xe++;continue}x[_e]&&I[_e].complete&&!I[_e].error&&(Xe++,s.drawInscribedImage(t,I[_e],e,_e,Ie))}u.backgrounding=Xe!==O,je!==u.backgrounding&&e.updateStyle(!1)},de=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,Be=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(t,e,Be),Ie&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,h.x,h.y,o,l)))},ae=function(){var Ie=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,Be=(z>0?z:-z)*Ie,je=z>0?0:255;z!==0&&(s.colorFillStyle(t,je,je,je,Be),v?t.fill(d):t.fill())},we=function(){if(P>0){if(t.lineWidth=P,t.lineCap="butt",t.setLineDash)switch(re){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}if(v?t.stroke(d):t.stroke(),re==="double"){t.lineWidth=P/3;var Ie=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(d):t.stroke(),t.globalCompositeOperation=Ie}t.setLineDash&&t.setLineDash([])}},Te=function(){n&&s.drawNodeOverlay(t,e,h,o,l)},Ae=function(){n&&s.drawNodeUnderlay(t,e,h,o,l)},Ne=function(){s.drawElementText(t,e,null,a)},Ue=e.pstyle("ghost").value==="yes";if(Ue){var He=e.pstyle("ghost-offset-x").pfValue,Me=e.pstyle("ghost-offset-y").pfValue,Oe=e.pstyle("ghost-opacity").value,Ve=Oe*c;t.translate(He,Me),K(Oe*H),xe(),ye(Ve,!0),ie(Oe*X),we(),de(z!==0||P!==0),ye(Ve,!1),ae(Ve),t.translate(-He,-Me)}v&&t.translate(-h.x,-h.y),Ae(),v&&t.translate(h.x,h.y),K(),xe(),ye(c,!0),ie(),we(),de(z!==0||P!==0),ye(c,!1),ae(),v&&t.translate(-h.x,-h.y),Ne(),Te(),r&&t.translate(p.x1,p.y1)}};var Mu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value;if(u>0){if(n=n||a.position(),i==null||s==null){var c=a.padding();i=a.width()+2*c,s=a.height()+2*c}o.colorFillStyle(r,f[0],f[1],f[2],u),o.nodeShapes[h].draw(r,n.x,n.y,i+l*2,s+l*2),r.fill()}}}};wa.drawNodeOverlay=Mu("overlay"),wa.drawNodeUnderlay=Mu("underlay"),wa.hasPie=function(t){return t=t[0],t._private.hasPie},wa.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,y=e.pstyle("pie-"+v+"-background-opacity").value*r,p=d/100;p+h>1&&(p=1-h);var m=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*p,x=m+b;d===0||h>=1||h+p>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,m,x),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],y),t.fill(),h+=p)}};var Ht={},hp=100;Ht.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},Ht.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a},Ht.createGradientStyleFor=function(t,e,r,a,n){var i,s=this.usePaths(),o=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),f=r.targetEndpoint(),h=r.midpoint(),c=Br(u,h),v=Br(f,h);i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(c,v))}else{var d=s?{x:0,y:0}:r.position(),g=r.paddedWidth(),y=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(g,y))}else if(r.isEdge()){var p=r.sourceEndpoint(),m=r.targetEndpoint();i=t.createLinearGradient(p.x,p.y,m.x,m.y)}else{var b=s?{x:0,y:0}:r.position(),x=r.paddedWidth(),I=r.paddedHeight(),O=x/2,T=I/2,k=r.pstyle("background-gradient-direction").value;switch(k){case"to-bottom":i=t.createLinearGradient(b.x,b.y-T,b.x,b.y+T);break;case"to-top":i=t.createLinearGradient(b.x,b.y+T,b.x,b.y-T);break;case"to-left":i=t.createLinearGradient(b.x+O,b.y,b.x-O,b.y);break;case"to-right":i=t.createLinearGradient(b.x-O,b.y,b.x+O,b.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(b.x-O,b.y-T,b.x+O,b.y+T);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(b.x-O,b.y+T,b.x+O,b.y-T);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(b.x+O,b.y-T,b.x-O,b.y+T);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(b.x+O,b.y+T,b.x-O,b.y-T);break}}if(!i)return null;for(var S=l.length===o.length,F=o.length,z=0;z<F;z++)i.addColorStop(S?l[z]:z/(F-1),"rgba("+o[z][0]+","+o[z][1]+","+o[z][2]+","+n+")");return i},Ht.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n},Ht.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"},Ht.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}},Ht.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n},Ht.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"},Ht.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}},Ht.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=n*s,u=i*s,f;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var h=r.canvasContainer;h.style.width=n+"px",h.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=l*e.textureMult,f.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u}},Ht.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})},Ht.render=function(t){t=t||Cs();var e=t.forcedContext,r=t.drawAllLayers,a=t.drawOnlyNodeLayer,n=t.forcedZoom,i=t.forcedPan,s=this,o=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=s.cy,u=s.data,f=u.canvasNeedsRedraw,h=s.textureOnViewport&&!e&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:s.motionBlur,v=s.motionBlurPxRatio,d=l.hasCompoundNodes(),g=s.hoverData.draggingEles,y=!!(s.hoverData.selecting||s.touchData.selecting);c=c&&!e&&s.motionBlurEnabled&&!y;var p=c;e||(s.prevPxRatio!==o&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=o),!e&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),c&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(p=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=n!==void 0?n:b,I=l.pan(),O={x:I.x,y:I.y},T={zoom:b,pan:{x:I.x,y:I.y}},k=s.prevViewport,S=k===void 0||T.zoom!==k.zoom||T.pan.x!==k.pan.x||T.pan.y!==k.pan.y;!S&&!(g&&!d)&&(s.motionBlurPxRatio=1),i&&(O=i),x*=o,O.x*=o,O.y*=o;var F=s.getCachedZSortedEles();function z(Me,Oe,Ve,ke,Ie){var Be=Me.globalCompositeOperation;Me.globalCompositeOperation="destination-out",s.colorFillStyle(Me,255,255,255,s.motionBlurTransparency),Me.fillRect(Oe,Ve,ke,Ie),Me.globalCompositeOperation=Be}function P(Me,Oe){var Ve,ke,Ie,Be;!s.clearingMotionBlur&&(Me===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||Me===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(Ve={x:I.x*v,y:I.y*v},ke=b*v,Ie=s.canvasWidth*v,Be=s.canvasHeight*v):(Ve=O,ke=x,Ie=s.canvasWidth,Be=s.canvasHeight),Me.setTransform(1,0,0,1,0,0),Oe==="motionBlur"?z(Me,0,0,Ie,Be):!e&&(Oe===void 0||Oe)&&Me.clearRect(0,0,Ie,Be),r||(Me.translate(Ve.x,Ve.y),Me.scale(ke,ke)),i&&Me.translate(i.x,i.y),n&&Me.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var H=s.data.bufferContexts[s.TEXTURE_BUFFER];H.setTransform(1,0,0,1,0,0),H.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:H,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var T=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var G=u.contexts[s.NODE],re=s.textureCache.texture,T=s.textureCache.viewport;G.setTransform(1,0,0,1,0,0),c?z(G,0,0,T.width,T.height):G.clearRect(0,0,T.width,T.height);var X=m.core("outside-texture-bg-color").value,K=m.core("outside-texture-bg-opacity").value;s.colorFillStyle(G,X[0],X[1],X[2],K),G.fillRect(0,0,T.width,T.height);var b=l.zoom();P(G,!1),G.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/o,T.height/T.zoom/o),G.drawImage(re,T.mpan.x,T.mpan.y,T.width/T.zoom/o,T.height/T.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var ie=l.extent(),fe=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),ve=s.hideEdgesOnViewport&&fe,oe=[];if(oe[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,oe[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),oe[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,oe[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||a||oe[s.NODE]){var ce=c&&!oe[s.NODE]&&v!==1,G=e||(ce?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),Ee=c&&!ce?"motionBlur":void 0;P(G,Ee),ve?s.drawCachedNodes(G,F.nondrag,o,ie):s.drawLayeredElements(G,F.nondrag,o,ie),s.debug&&s.drawDebugPoints(G,F.nondrag),!r&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||r||oe[s.DRAG])){var ce=c&&!oe[s.DRAG]&&v!==1,G=e||(ce?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);P(G,c&&!ce?"motionBlur":void 0),ve?s.drawCachedNodes(G,F.drag,o,ie):s.drawCachedElements(G,F.drag,o,ie),s.debug&&s.drawDebugPoints(G,F.drag),!r&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!r){var G=e||u.contexts[s.SELECT_BOX];if(P(G),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var b=s.cy.zoom(),xe=m.core("selection-box-border-width").value/b;G.lineWidth=xe,G.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+")",G.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),xe>0&&(G.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+")",G.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var b=s.cy.zoom(),ye=u.bgActivePosistion;G.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+")",G.beginPath(),G.arc(ye.x,ye.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),G.fill()}var de=s.lastRedrawTime;if(s.showFps&&de){de=Math.round(de);var ae=Math.round(1e3/de);G.setTransform(1,0,0,1,0,0),G.fillStyle="rgba(255, 0, 0, 0.75)",G.strokeStyle="rgba(255, 0, 0, 0.75)",G.lineWidth=1,G.fillText("1 frame = "+de+" ms = "+ae+" fps",0,20);var we=60;G.strokeRect(0,30,250,20),G.fillRect(0,30,250*Math.min(ae/we,1),20)}r||(f[s.SELECT_BOX]=!1)}if(c&&v!==1){var Te=u.contexts[s.NODE],Ae=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Ne=u.contexts[s.DRAG],Ue=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],He=function(Oe,Ve,ke){Oe.setTransform(1,0,0,1,0,0),ke||!p?Oe.clearRect(0,0,s.canvasWidth,s.canvasHeight):z(Oe,0,0,s.canvasWidth,s.canvasHeight);var Ie=v;Oe.drawImage(Ve,0,0,s.canvasWidth*Ie,s.canvasHeight*Ie,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||oe[s.NODE])&&(He(Te,Ae,oe[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||oe[s.DRAG])&&(He(Ne,Ue,oe[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=T,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},hp)),e||l.emit("render")};var Mr={};Mr.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var l=1;l<i.length/2;l++)t.lineTo(e+s*i[l*2],r+o*i[l*2+1]);t.closePath()},Mr.drawRoundPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=pi(a,n);t.beginPath&&t.beginPath();for(var u=0;u<i.length/4;u++){var f=void 0,h=void 0;u===0?f=i.length-2:f=u*4-2,h=u*4+2;var c=e+s*i[u*4],v=r+o*i[u*4+1],d=-i[f]*i[h]-i[f+1]*i[h+1],g=l/Math.tan(Math.acos(d)/2),y=c-g*i[f],p=v-g*i[f+1],m=c+g*i[h],b=v+g*i[h+1];u===0?t.moveTo(y,p):t.lineTo(y,p),t.arcTo(c,v,m,b,l)}t.closePath()},Mr.drawRoundRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=Fa(a,n);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+i,r-s,e+i,r,o),t.arcTo(e+i,r+s,e,r+s,o),t.arcTo(e-i,r+s,e-i,r,o),t.arcTo(e-i,r-s,e,r-s,o),t.lineTo(e,r-s),t.closePath()},Mr.drawBottomRoundRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=Fa(a,n);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+i,r-s),t.lineTo(e+i,r),t.arcTo(e+i,r+s,e,r+s,o),t.arcTo(e-i,r+s,e-i,r,o),t.lineTo(e-i,r-s),t.lineTo(e,r-s),t.closePath()},Mr.drawCutRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=ks();t.beginPath&&t.beginPath(),t.moveTo(e-i+o,r-s),t.lineTo(e+i-o,r-s),t.lineTo(e+i,r-s+o),t.lineTo(e+i,r+s-o),t.lineTo(e+i-o,r+s),t.lineTo(e-i+o,r+s),t.lineTo(e-i,r+s-o),t.lineTo(e-i,r-s+o),t.closePath()},Mr.drawBarrelPath=function(t,e,r,a,n){var i=a/2,s=n/2,o=e-i,l=e+i,u=r-s,f=r+s,h=yi(a,n),c=h.widthOffset,v=h.heightOffset,d=h.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(o,u+v),t.lineTo(o,f-v),t.quadraticCurveTo(o+d,f,o+c,f),t.lineTo(l-c,f),t.quadraticCurveTo(l-d,f,l,f-v),t.lineTo(l,u+v),t.quadraticCurveTo(l-d,u,l-c,u),t.lineTo(o+c,u),t.quadraticCurveTo(o+d,u,o,u+v),t.closePath()};for(var Iu=Math.sin(0),Ru=Math.cos(0),Xi={},qi={},ku=Math.PI/40,xa=0*Math.PI;xa<2*Math.PI;xa+=ku)Xi[xa]=Math.sin(xa),qi[xa]=Math.cos(xa);Mr.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=ku)i=e-o*Xi[u]*Iu+o*qi[u]*Ru,s=r+l*qi[u]*Iu+l*Xi[u]*Ru,u===0?t.moveTo(i,s):t.lineTo(i,s);t.closePath()};var tn={};tn.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]},tn.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],s=t.full?Math.ceil(a.h):n[3],o=N(t.maxWidth)||N(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)i*=t.scale,s*=t.scale,u=t.scale;else if(o){var f=1/0,h=1/0;N(t.maxWidth)&&(f=u*t.maxWidth/i),N(t.maxHeight)&&(h=u*t.maxHeight/s),u=Math.min(f,h),i*=u,s*=u}o||(i*=l,s*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=s,c.style.width=i+"px",c.style.height=s+"px";var v=c.getContext("2d");if(i>0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)v.translate(-a.x1*u,-a.y1*u),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(a.x1*u,a.y1*u);else{var g=e.pan(),y={x:g.x*u,y:g.y*u};u*=e.zoom(),v.translate(y.x,y.y),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(-y.x,-y.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return c};function cp(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function Pu(t){var e=t.indexOf(",");return t.substr(e+1)}function Bu(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new sa(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){i(s)}});case"blob":return cp(Pu(a()),r);case"base64":return Pu(a());case"base64uri":default:return a()}}tn.png=function(t){return Bu(t,this.bufferCanvasImage(t),"image/png")},tn.jpg=function(t){return Bu(t,this.bufferCanvasImage(t),"image/jpeg")};var Fu={};Fu.nodeShapeImpl=function(t,e,r,a,n,i,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var vp=zu,st=zu.prototype;st.CANVAS_LAYERS=3,st.SELECT_BOX=0,st.DRAG=1,st.NODE=2,st.BUFFER_COUNT=3,st.TEXTURE_BUFFER=0,st.MOTIONBLUR_BUFFER_NODE=1,st.MOTIONBLUR_BUFFER_DRAG=2;function zu(t){var e=this;e.data={canvases:new Array(st.CANVAS_LAYERS),contexts:new Array(st.CANVAS_LAYERS),canvasNeedsRedraw:new Array(st.CANVAS_LAYERS),bufferCanvases:new Array(st.BUFFER_COUNT),bufferContexts:new Array(st.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";e.data.canvasContainer=document.createElement("div");var n=e.data.canvasContainer.style;e.data.canvasContainer.style[r]=a,n.position="relative",n.zIndex="0",n.overflow="hidden";var i=t.cy.container();i.appendChild(e.data.canvasContainer),i.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};at()&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var o=0;o<st.CANVAS_LAYERS;o++){var l=e.data.canvases[o]=document.createElement("canvas");e.data.contexts[o]=l.getContext("2d"),Object.keys(s).forEach(function(de){l.style[de]=s[de]}),l.style.position="absolute",l.setAttribute("data-id","layer"+o),l.style.zIndex=String(st.CANVAS_LAYERS-o),e.data.canvasContainer.appendChild(l),e.data.canvasNeedsRedraw[o]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[st.NODE].setAttribute("data-id","layer"+st.NODE+"-node"),e.data.canvases[st.SELECT_BOX].setAttribute("data-id","layer"+st.SELECT_BOX+"-selectbox"),e.data.canvases[st.DRAG].setAttribute("data-id","layer"+st.DRAG+"-drag");for(var o=0;o<st.BUFFER_COUNT;o++)e.data.bufferCanvases[o]=document.createElement("canvas"),e.data.bufferContexts[o]=e.data.bufferCanvases[o].getContext("2d"),e.data.bufferCanvases[o].style.position="absolute",e.data.bufferCanvases[o].setAttribute("data-id","buffer"+o),e.data.bufferCanvases[o].style.zIndex=String(-o-1),e.data.bufferCanvases[o].style.visibility="hidden";e.pathsEnabled=!0;var u=$t(),f=function(ae){return{x:(ae.x1+ae.x2)/2,y:(ae.y1+ae.y2)/2}},h=function(ae){return{x:-ae.w/2,y:-ae.h/2}},c=function(ae){var we=ae[0]._private,Te=we.oldBackgroundTimestamp===we.backgroundTimestamp;return!Te},v=function(ae){return ae[0]._private.nodeKey},d=function(ae){return ae[0]._private.labelStyleKey},g=function(ae){return ae[0]._private.sourceLabelStyleKey},y=function(ae){return ae[0]._private.targetLabelStyleKey},p=function(ae,we,Te,Ae,Ne){return e.drawElement(ae,we,Te,!1,!1,Ne)},m=function(ae,we,Te,Ae,Ne){return e.drawElementText(ae,we,Te,Ae,"main",Ne)},b=function(ae,we,Te,Ae,Ne){return e.drawElementText(ae,we,Te,Ae,"source",Ne)},x=function(ae,we,Te,Ae,Ne){return e.drawElementText(ae,we,Te,Ae,"target",Ne)},I=function(ae){return ae.boundingBox(),ae[0]._private.bodyBounds},O=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.main||u},T=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.source||u},k=function(ae){return ae.boundingBox(),ae[0]._private.labelBounds.target||u},S=function(ae,we){return we},F=function(ae){return f(I(ae))},z=function(ae,we,Te){var Ae=ae?ae+"-":"";return{x:we.x+Te.pstyle(Ae+"text-margin-x").pfValue,y:we.y+Te.pstyle(Ae+"text-margin-y").pfValue}},P=function(ae,we,Te){var Ae=ae[0]._private.rscratch;return{x:Ae[we],y:Ae[Te]}},H=function(ae){return z("",P(ae,"labelX","labelY"),ae)},G=function(ae){return z("source",P(ae,"sourceLabelX","sourceLabelY"),ae)},re=function(ae){return z("target",P(ae,"targetLabelX","targetLabelY"),ae)},X=function(ae){return h(I(ae))},K=function(ae){return h(T(ae))},ie=function(ae){return h(k(ae))},fe=function(ae){var we=O(ae),Te=h(O(ae));if(ae.isNode()){switch(ae.pstyle("text-halign").value){case"left":Te.x=-we.w;break;case"right":Te.x=0;break}switch(ae.pstyle("text-valign").value){case"top":Te.y=-we.h;break;case"bottom":Te.y=0;break}}return Te},ve=e.data.eleTxrCache=new ja(e,{getKey:v,doesEleInvalidateKey:c,drawElement:p,getBoundingBox:I,getRotationPoint:F,getRotationOffset:X,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),oe=e.data.lblTxrCache=new ja(e,{getKey:d,drawElement:m,getBoundingBox:O,getRotationPoint:H,getRotationOffset:fe,isVisible:S}),ce=e.data.slbTxrCache=new ja(e,{getKey:g,drawElement:b,getBoundingBox:T,getRotationPoint:G,getRotationOffset:K,isVisible:S}),Ee=e.data.tlbTxrCache=new ja(e,{getKey:y,drawElement:x,getBoundingBox:k,getRotationPoint:re,getRotationOffset:ie,isVisible:S}),xe=e.data.lyrTxrCache=new Du(e);e.onUpdateEleCalcs(function(ae,we){ve.invalidateElements(we),oe.invalidateElements(we),ce.invalidateElements(we),Ee.invalidateElements(we),xe.invalidateElements(we);for(var Te=0;Te<we.length;Te++){var Ae=we[Te]._private;Ae.oldBackgroundTimestamp=Ae.backgroundTimestamp}});var ye=function(ae){for(var we=0;we<ae.length;we++)xe.enqueueElementRefinement(ae[we].ele)};ve.onDequeue(ye),oe.onDequeue(ye),ce.onDequeue(ye),Ee.onDequeue(ye)}st.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[st.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[st.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[st.SELECT_BOX]=e;break}};var dp=typeof Path2D!="undefined";st.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t},st.usePaths=function(){return dp&&this.pathsEnabled},st.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)},st.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled},st.makeOffscreenCanvas=function(t,e){var r;return(typeof OffscreenCanvas=="undefined"?"undefined":q(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=document.createElement("canvas"),r.width=t,r.height=e),r},[Lu,fr,pr,Hi,Ur,wa,Ht,Mr,tn,Fu].forEach(function(t){$e(st,t)});var gp=[{name:"null",impl:lu},{name:"base",impl:wu},{name:"canvas",impl:vp}],pp=[{type:"layout",extensions:Tg},{type:"renderer",extensions:gp}],Gu={},Vu={};function $u(t,e,r){var a=r,n=function(k){lt("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Za.prototype[e])return n(e);Za.prototype[e]=r}else if(t==="collection"){if(At.prototype[e])return n(e);At.prototype[e]=r}else if(t==="layout"){for(var i=function(k){this.options=k,r.call(this,k),C(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(r.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=r.prototype.stop;s.stop=function(){var T=this.options;if(T&&T.animate){var k=this.animations;if(k)for(var S=0;S<k.length;S++)k[S].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var h=function(k){return k._private.cy},c={addEventFields:function(k,S){S.layout=k,S.cy=h(k),S.target=k},bubble:function(){return!0},parent:function(k){return h(k)}};$e(s,{createEmitter:function(){return this._private.emitter=new kn(c,this),this},emitter:function(){return this._private.emitter},on:function(k,S){return this.emitter().on(k,S),this},one:function(k,S){return this.emitter().one(k,S),this},once:function(k,S){return this.emitter().one(k,S),this},removeListener:function(k,S){return this.emitter().removeListener(k,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(k,S){return this.emitter().emit(k,S),this}}),ft.eventAliasesOn(s),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=_u("renderer","base"),d=v.prototype,g=r,y=r.prototype,p=function(){v.apply(this,arguments),g.apply(this,arguments)},m=p.prototype;for(var b in d){var x=d[b],I=y[b]!=null;if(I)return n(b);m[b]=x}for(var O in y)m[O]=y[O];d.clientFunctions.forEach(function(T){m[T]=m[T]||function(){bt("Renderer does not implement `renderer."+T+"()` on its prototype")}}),a=p}else if(t==="__proto__"||t==="constructor"||t==="prototype")return bt(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return us({map:Gu,keys:[t,e],value:a})}function _u(t,e){return ls({map:Gu,keys:[t,e]})}function yp(t,e,r,a,n){return us({map:Vu,keys:[t,e,r,a],value:n})}function mp(t,e,r,a){return ls({map:Vu,keys:[t,e,r,a]})}var Wi=function(){if(arguments.length===2)return _u.apply(null,arguments);if(arguments.length===3)return $u.apply(null,arguments);if(arguments.length===4)return mp.apply(null,arguments);if(arguments.length===5)return yp.apply(null,arguments);bt("Invalid extension access syntax")};Za.prototype.extension=Wi,pp.forEach(function(t){t.extensions.forEach(function(e){$u(t.type,e.name,e.impl)})});var Uu=function t(){if(!(this instanceof t))return new t;this.length=0},Yr=Uu.prototype;Yr.instanceString=function(){return"stylesheet"},Yr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this},Yr.css=function(t,e){var r=this.length-1;if(ee(t))this[r].properties.push({name:t,value:e});else if(C(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var l=Pt.properties[s]||Pt.properties[Tt(s)];if(l!=null){var u=l.name,f=o;this[r].properties.push({name:u,value:f})}}}return this},Yr.style=Yr.css,Yr.generateStyle=function(t){var e=new Pt(t);return this.appendToStyle(e)},Yr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var s=n[i];t.css(s.name,s.value)}}return t};var bp="3.23.0",Hr=function(e){if(e===void 0&&(e={}),C(e))return new Za(e);if(ee(e))return Wi.apply(Wi,arguments)};return Hr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Hr),t.apply(null,e),this},Hr.warnings=function(t){return xs(t)},Hr.version=bp,Hr.stylesheet=Hr.Stylesheet=Uu,Hr})});var es=ni((on,ji)=>{(function(W,_){typeof on=="object"&&typeof ji=="object"?ji.exports=_():typeof define=="function"&&define.amd?define([],_):typeof on=="object"?on.layoutBase=_():W.layoutBase=_()})(on,function(){return function(q){var W={};function _(L){if(W[L])return W[L].exports;var E=W[L]={i:L,l:!1,exports:{}};return q[L].call(E.exports,E,E.exports,_),E.l=!0,E.exports}return _.m=q,_.c=W,_.i=function(L){return L},_.d=function(L,E,w){_.o(L,E)||Object.defineProperty(L,E,{configurable:!1,enumerable:!0,get:w})},_.n=function(L){var E=L&&L.__esModule?function(){return L.default}:function(){return L};return _.d(E,"a",E),E},_.o=function(L,E){return Object.prototype.hasOwnProperty.call(L,E)},_.p="",_(_.s=26)}([function(q,W,_){"use strict";function L(){}L.QUALITY=1,L.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,L.DEFAULT_INCREMENTAL=!1,L.DEFAULT_ANIMATION_ON_LAYOUT=!0,L.DEFAULT_ANIMATION_DURING_LAYOUT=!1,L.DEFAULT_ANIMATION_PERIOD=50,L.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,L.DEFAULT_GRAPH_MARGIN=15,L.NODE_DIMENSIONS_INCLUDE_LABELS=!1,L.SIMPLE_NODE_SIZE=40,L.SIMPLE_NODE_HALF_SIZE=L.SIMPLE_NODE_SIZE/2,L.EMPTY_COMPOUND_NODE_SIZE=40,L.MIN_EDGE_LENGTH=1,L.WORLD_BOUNDARY=1e6,L.INITIAL_WORLD_BOUNDARY=L.WORLD_BOUNDARY/1e3,L.WORLD_CENTER_X=1200,L.WORLD_CENTER_Y=900,q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(8),w=_(9);function A(U,R,J){L.call(this,J),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=J,this.bendpoints=[],this.source=U,this.target=R}A.prototype=Object.create(L.prototype);for(var V in L)A[V]=L[V];A.prototype.getSource=function(){return this.source},A.prototype.getTarget=function(){return this.target},A.prototype.isInterGraph=function(){return this.isInterGraph},A.prototype.getLength=function(){return this.length},A.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},A.prototype.getBendpoints=function(){return this.bendpoints},A.prototype.getLca=function(){return this.lca},A.prototype.getSourceInLca=function(){return this.sourceInLca},A.prototype.getTargetInLca=function(){return this.targetInLca},A.prototype.getOtherEnd=function(U){if(this.source===U)return this.target;if(this.target===U)return this.source;throw"Node is not incident with this edge"},A.prototype.getOtherEndInGraph=function(U,R){for(var J=this.getOtherEnd(U),D=R.getGraphManager().getRoot();;){if(J.getOwner()==R)return J;if(J.getOwner()==D)break;J=J.getOwner().getParent()}return null},A.prototype.updateLength=function(){var U=new Array(4);this.isOverlapingSourceAndTarget=E.getIntersection(this.target.getRect(),this.source.getRect(),U),this.isOverlapingSourceAndTarget||(this.lengthX=U[0]-U[2],this.lengthY=U[1]-U[3],Math.abs(this.lengthX)<1&&(this.lengthX=w.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=w.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},A.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=w.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=w.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},q.exports=A},function(q,W,_){"use strict";function L(E){this.vGraphObject=E}q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(10),w=_(13),A=_(0),V=_(16),U=_(4);function R(D,$,Y,j){Y==null&&j==null&&(j=$),L.call(this,j),D.graphManager!=null&&(D=D.graphManager),this.estimatedSize=E.MIN_VALUE,this.inclusionTreeDepth=E.MAX_VALUE,this.vGraphObject=j,this.edges=[],this.graphManager=D,Y!=null&&$!=null?this.rect=new w($.x,$.y,Y.width,Y.height):this.rect=new w}R.prototype=Object.create(L.prototype);for(var J in L)R[J]=L[J];R.prototype.getEdges=function(){return this.edges},R.prototype.getChild=function(){return this.child},R.prototype.getOwner=function(){return this.owner},R.prototype.getWidth=function(){return this.rect.width},R.prototype.setWidth=function(D){this.rect.width=D},R.prototype.getHeight=function(){return this.rect.height},R.prototype.setHeight=function(D){this.rect.height=D},R.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},R.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},R.prototype.getCenter=function(){return new U(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},R.prototype.getLocation=function(){return new U(this.rect.x,this.rect.y)},R.prototype.getRect=function(){return this.rect},R.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},R.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},R.prototype.setRect=function(D,$){this.rect.x=D.x,this.rect.y=D.y,this.rect.width=$.width,this.rect.height=$.height},R.prototype.setCenter=function(D,$){this.rect.x=D-this.rect.width/2,this.rect.y=$-this.rect.height/2},R.prototype.setLocation=function(D,$){this.rect.x=D,this.rect.y=$},R.prototype.moveBy=function(D,$){this.rect.x+=D,this.rect.y+=$},R.prototype.getEdgeListToNode=function(D){var $=[],Y,j=this;return j.edges.forEach(function(te){if(te.target==D){if(te.source!=j)throw"Incorrect edge source!";$.push(te)}}),$},R.prototype.getEdgesBetween=function(D){var $=[],Y,j=this;return j.edges.forEach(function(te){if(!(te.source==j||te.target==j))throw"Incorrect edge source and/or target";(te.target==D||te.source==D)&&$.push(te)}),$},R.prototype.getNeighborsList=function(){var D=new Set,$=this;return $.edges.forEach(function(Y){if(Y.source==$)D.add(Y.target);else{if(Y.target!=$)throw"Incorrect incidency!";D.add(Y.source)}}),D},R.prototype.withChildren=function(){var D=new Set,$,Y;if(D.add(this),this.child!=null)for(var j=this.child.getNodes(),te=0;te<j.length;te++)$=j[te],Y=$.withChildren(),Y.forEach(function(le){D.add(le)});return D},R.prototype.getNoOfChildren=function(){var D=0,$;if(this.child==null)D=1;else for(var Y=this.child.getNodes(),j=0;j<Y.length;j++)$=Y[j],D+=$.getNoOfChildren();return D==0&&(D=1),D},R.prototype.getEstimatedSize=function(){if(this.estimatedSize==E.MIN_VALUE)throw"assert failed";return this.estimatedSize},R.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},R.prototype.scatter=function(){var D,$,Y=-A.INITIAL_WORLD_BOUNDARY,j=A.INITIAL_WORLD_BOUNDARY;D=A.WORLD_CENTER_X+V.nextDouble()*(j-Y)+Y;var te=-A.INITIAL_WORLD_BOUNDARY,le=A.INITIAL_WORLD_BOUNDARY;$=A.WORLD_CENTER_Y+V.nextDouble()*(le-te)+te,this.rect.x=D,this.rect.y=$},R.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var D=this.getChild();if(D.updateBounds(!0),this.rect.x=D.getLeft(),this.rect.y=D.getTop(),this.setWidth(D.getRight()-D.getLeft()),this.setHeight(D.getBottom()-D.getTop()),A.NODE_DIMENSIONS_INCLUDE_LABELS){var $=D.getRight()-D.getLeft(),Y=D.getBottom()-D.getTop();this.labelWidth>$&&(this.rect.x-=(this.labelWidth-$)/2,this.setWidth(this.labelWidth)),this.labelHeight>Y&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-Y)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-Y),this.setHeight(this.labelHeight))}}},R.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==E.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},R.prototype.transform=function(D){var $=this.rect.x;$>A.WORLD_BOUNDARY?$=A.WORLD_BOUNDARY:$<-A.WORLD_BOUNDARY&&($=-A.WORLD_BOUNDARY);var Y=this.rect.y;Y>A.WORLD_BOUNDARY?Y=A.WORLD_BOUNDARY:Y<-A.WORLD_BOUNDARY&&(Y=-A.WORLD_BOUNDARY);var j=new U($,Y),te=D.inverseTransformPoint(j);this.setLocation(te.x,te.y)},R.prototype.getLeft=function(){return this.rect.x},R.prototype.getRight=function(){return this.rect.x+this.rect.width},R.prototype.getTop=function(){return this.rect.y},R.prototype.getBottom=function(){return this.rect.y+this.rect.height},R.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},q.exports=R},function(q,W,_){"use strict";function L(E,w){E==null&&w==null?(this.x=0,this.y=0):(this.x=E,this.y=w)}L.prototype.getX=function(){return this.x},L.prototype.getY=function(){return this.y},L.prototype.setX=function(E){this.x=E},L.prototype.setY=function(E){this.y=E},L.prototype.getDifference=function(E){return new DimensionD(this.x-E.x,this.y-E.y)},L.prototype.getCopy=function(){return new L(this.x,this.y)},L.prototype.translate=function(E){return this.x+=E.width,this.y+=E.height,this},q.exports=L},function(q,W,_){"use strict";var L=_(2),E=_(10),w=_(0),A=_(6),V=_(3),U=_(1),R=_(13),J=_(12),D=_(11);function $(j,te,le){L.call(this,le),this.estimatedSize=E.MIN_VALUE,this.margin=w.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=j,te!=null&&te instanceof A?this.graphManager=te:te!=null&&te instanceof Layout&&(this.graphManager=te.graphManager)}$.prototype=Object.create(L.prototype);for(var Y in L)$[Y]=L[Y];$.prototype.getNodes=function(){return this.nodes},$.prototype.getEdges=function(){return this.edges},$.prototype.getGraphManager=function(){return this.graphManager},$.prototype.getParent=function(){return this.parent},$.prototype.getLeft=function(){return this.left},$.prototype.getRight=function(){return this.right},$.prototype.getTop=function(){return this.top},$.prototype.getBottom=function(){return this.bottom},$.prototype.isConnected=function(){return this.isConnected},$.prototype.add=function(j,te,le){if(te==null&&le==null){var Q=j;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(Q)>-1)throw"Node already in graph!";return Q.owner=this,this.getNodes().push(Q),Q}else{var ee=j;if(!(this.getNodes().indexOf(te)>-1&&this.getNodes().indexOf(le)>-1))throw"Source or target not in graph!";if(!(te.owner==le.owner&&te.owner==this))throw"Both owners must be this graph!";return te.owner!=le.owner?null:(ee.source=te,ee.target=le,ee.isInterGraph=!1,this.getEdges().push(ee),te.edges.push(ee),le!=te&&le.edges.push(ee),ee)}},$.prototype.remove=function(j){var te=j;if(j instanceof V){if(te==null)throw"Node is null!";if(!(te.owner!=null&&te.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var le=te.edges.slice(),Q,ee=le.length,ne=0;ne<ee;ne++)Q=le[ne],Q.isInterGraph?this.graphManager.remove(Q):Q.source.owner.remove(Q);var me=this.nodes.indexOf(te);if(me==-1)throw"Node not in owner node list!";this.nodes.splice(me,1)}else if(j instanceof U){var Q=j;if(Q==null)throw"Edge is null!";if(!(Q.source!=null&&Q.target!=null))throw"Source and/or target is null!";if(!(Q.source.owner!=null&&Q.target.owner!=null&&Q.source.owner==this&&Q.target.owner==this))throw"Source and/or target owner is invalid!";var C=Q.source.edges.indexOf(Q),B=Q.target.edges.indexOf(Q);if(!(C>-1&&B>-1))throw"Source and/or target doesn't know this edge!";Q.source.edges.splice(C,1),Q.target!=Q.source&&Q.target.edges.splice(B,1);var me=Q.source.owner.getEdges().indexOf(Q);if(me==-1)throw"Not in owner's edge list!";Q.source.owner.getEdges().splice(me,1)}},$.prototype.updateLeftTop=function(){for(var j=E.MAX_VALUE,te=E.MAX_VALUE,le,Q,ee,ne=this.getNodes(),me=ne.length,C=0;C<me;C++){var B=ne[C];le=B.getTop(),Q=B.getLeft(),j>le&&(j=le),te>Q&&(te=Q)}return j==E.MAX_VALUE?null:(ne[0].getParent().paddingLeft!=null?ee=ne[0].getParent().paddingLeft:ee=this.margin,this.left=te-ee,this.top=j-ee,new J(this.left,this.top))},$.prototype.updateBounds=function(j){for(var te=E.MAX_VALUE,le=-E.MAX_VALUE,Q=E.MAX_VALUE,ee=-E.MAX_VALUE,ne,me,C,B,N,Z=this.nodes,ue=Z.length,se=0;se<ue;se++){var Le=Z[se];j&&Le.child!=null&&Le.updateBounds(),ne=Le.getLeft(),me=Le.getRight(),C=Le.getTop(),B=Le.getBottom(),te>ne&&(te=ne),le<me&&(le=me),Q>C&&(Q=C),ee<B&&(ee=B)}var be=new R(te,Q,le-te,ee-Q);te==E.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),Z[0].getParent().paddingLeft!=null?N=Z[0].getParent().paddingLeft:N=this.margin,this.left=be.x-N,this.right=be.x+be.width+N,this.top=be.y-N,this.bottom=be.y+be.height+N},$.calculateBounds=function(j){for(var te=E.MAX_VALUE,le=-E.MAX_VALUE,Q=E.MAX_VALUE,ee=-E.MAX_VALUE,ne,me,C,B,N=j.length,Z=0;Z<N;Z++){var ue=j[Z];ne=ue.getLeft(),me=ue.getRight(),C=ue.getTop(),B=ue.getBottom(),te>ne&&(te=ne),le<me&&(le=me),Q>C&&(Q=C),ee<B&&(ee=B)}var se=new R(te,Q,le-te,ee-Q);return se},$.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},$.prototype.getEstimatedSize=function(){if(this.estimatedSize==E.MIN_VALUE)throw"assert failed";return this.estimatedSize},$.prototype.calcEstimatedSize=function(){for(var j=0,te=this.nodes,le=te.length,Q=0;Q<le;Q++){var ee=te[Q];j+=ee.calcEstimatedSize()}return j==0?this.estimatedSize=w.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=j/Math.sqrt(this.nodes.length),this.estimatedSize},$.prototype.updateConnected=function(){var j=this;if(this.nodes.length==0){this.isConnected=!0;return}var te=new D,le=new Set,Q=this.nodes[0],ee,ne,me=Q.withChildren();for(me.forEach(function(se){te.push(se),le.add(se)});te.length!==0;){Q=te.shift(),ee=Q.getEdges();for(var C=ee.length,B=0;B<C;B++){var N=ee[B];if(ne=N.getOtherEndInGraph(Q,this),ne!=null&&!le.has(ne)){var Z=ne.withChildren();Z.forEach(function(se){te.push(se),le.add(se)})}}}if(this.isConnected=!1,le.size>=this.nodes.length){var ue=0;le.forEach(function(se){se.owner==j&&ue++}),ue==this.nodes.length&&(this.isConnected=!0)}},q.exports=$},function(q,W,_){"use strict";var L,E=_(1);function w(A){L=_(5),this.layout=A,this.graphs=[],this.edges=[]}w.prototype.addRoot=function(){var A=this.layout.newGraph(),V=this.layout.newNode(null),U=this.add(A,V);return this.setRootGraph(U),this.rootGraph},w.prototype.add=function(A,V,U,R,J){if(U==null&&R==null&&J==null){if(A==null)throw"Graph is null!";if(V==null)throw"Parent node is null!";if(this.graphs.indexOf(A)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(A),A.parent!=null)throw"Already has a parent!";if(V.child!=null)throw"Already has a child!";return A.parent=V,V.child=A,A}else{J=U,R=V,U=A;var D=R.getOwner(),$=J.getOwner();if(!(D!=null&&D.getGraphManager()==this))throw"Source not in this graph mgr!";if(!($!=null&&$.getGraphManager()==this))throw"Target not in this graph mgr!";if(D==$)return U.isInterGraph=!1,D.add(U,R,J);if(U.isInterGraph=!0,U.source=R,U.target=J,this.edges.indexOf(U)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(U),!(U.source!=null&&U.target!=null))throw"Edge source and/or target is null!";if(!(U.source.edges.indexOf(U)==-1&&U.target.edges.indexOf(U)==-1))throw"Edge already in source and/or target incidency list!";return U.source.edges.push(U),U.target.edges.push(U),U}},w.prototype.remove=function(A){if(A instanceof L){var V=A;if(V.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(V==this.rootGraph||V.parent!=null&&V.parent.graphManager==this))throw"Invalid parent node!";var U=[];U=U.concat(V.getEdges());for(var R,J=U.length,D=0;D<J;D++)R=U[D],V.remove(R);var $=[];$=$.concat(V.getNodes());var Y;J=$.length;for(var D=0;D<J;D++)Y=$[D],V.remove(Y);V==this.rootGraph&&this.setRootGraph(null);var j=this.graphs.indexOf(V);this.graphs.splice(j,1),V.parent=null}else if(A instanceof E){if(R=A,R==null)throw"Edge is null!";if(!R.isInterGraph)throw"Not an inter-graph edge!";if(!(R.source!=null&&R.target!=null))throw"Source and/or target is null!";if(!(R.source.edges.indexOf(R)!=-1&&R.target.edges.indexOf(R)!=-1))throw"Source and/or target doesn't know this edge!";var j=R.source.edges.indexOf(R);if(R.source.edges.splice(j,1),j=R.target.edges.indexOf(R),R.target.edges.splice(j,1),!(R.source.owner!=null&&R.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(R.source.owner.getGraphManager().edges.indexOf(R)==-1)throw"Not in owner graph manager's edge list!";var j=R.source.owner.getGraphManager().edges.indexOf(R);R.source.owner.getGraphManager().edges.splice(j,1)}},w.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},w.prototype.getGraphs=function(){return this.graphs},w.prototype.getAllNodes=function(){if(this.allNodes==null){for(var A=[],V=this.getGraphs(),U=V.length,R=0;R<U;R++)A=A.concat(V[R].getNodes());this.allNodes=A}return this.allNodes},w.prototype.resetAllNodes=function(){this.allNodes=null},w.prototype.resetAllEdges=function(){this.allEdges=null},w.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},w.prototype.getAllEdges=function(){if(this.allEdges==null){for(var A=[],V=this.getGraphs(),U=V.length,R=0;R<V.length;R++)A=A.concat(V[R].getEdges());A=A.concat(this.edges),this.allEdges=A}return this.allEdges},w.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},w.prototype.setAllNodesToApplyGravitation=function(A){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=A},w.prototype.getRoot=function(){return this.rootGraph},w.prototype.setRootGraph=function(A){if(A.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=A,A.parent==null&&(A.parent=this.layout.newNode("Root node"))},w.prototype.getLayout=function(){return this.layout},w.prototype.isOneAncestorOfOther=function(A,V){if(!(A!=null&&V!=null))throw"assert failed";if(A==V)return!0;var U=A.getOwner(),R;do{if(R=U.getParent(),R==null)break;if(R==V)return!0;if(U=R.getOwner(),U==null)break}while(!0);U=V.getOwner();do{if(R=U.getParent(),R==null)break;if(R==A)return!0;if(U=R.getOwner(),U==null)break}while(!0);return!1},w.prototype.calcLowestCommonAncestors=function(){for(var A,V,U,R,J,D=this.getAllEdges(),$=D.length,Y=0;Y<$;Y++){if(A=D[Y],V=A.source,U=A.target,A.lca=null,A.sourceInLca=V,A.targetInLca=U,V==U){A.lca=V.getOwner();continue}for(R=V.getOwner();A.lca==null;){for(A.targetInLca=U,J=U.getOwner();A.lca==null;){if(J==R){A.lca=J;break}if(J==this.rootGraph)break;if(A.lca!=null)throw"assert failed";A.targetInLca=J.getParent(),J=A.targetInLca.getOwner()}if(R==this.rootGraph)break;A.lca==null&&(A.sourceInLca=R.getParent(),R=A.sourceInLca.getOwner())}if(A.lca==null)throw"assert failed"}},w.prototype.calcLowestCommonAncestor=function(A,V){if(A==V)return A.getOwner();var U=A.getOwner();do{if(U==null)break;var R=V.getOwner();do{if(R==null)break;if(R==U)return R;R=R.getParent().getOwner()}while(!0);U=U.getParent().getOwner()}while(!0);return U},w.prototype.calcInclusionTreeDepths=function(A,V){A==null&&V==null&&(A=this.rootGraph,V=1);for(var U,R=A.getNodes(),J=R.length,D=0;D<J;D++)U=R[D],U.inclusionTreeDepth=V,U.child!=null&&this.calcInclusionTreeDepths(U.child,V+1)},w.prototype.includesInvalidEdge=function(){for(var A,V=this.edges.length,U=0;U<V;U++)if(A=this.edges[U],this.isOneAncestorOfOther(A.source,A.target))return!0;return!1},q.exports=w},function(q,W,_){"use strict";var L=_(0);function E(){}for(var w in L)E[w]=L[w];E.MAX_ITERATIONS=2500,E.DEFAULT_EDGE_LENGTH=50,E.DEFAULT_SPRING_STRENGTH=.45,E.DEFAULT_REPULSION_STRENGTH=4500,E.DEFAULT_GRAVITY_STRENGTH=.4,E.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,E.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,E.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,E.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,E.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,E.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,E.COOLING_ADAPTATION_FACTOR=.33,E.ADAPTATION_LOWER_NODE_LIMIT=1e3,E.ADAPTATION_UPPER_NODE_LIMIT=5e3,E.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,E.MAX_NODE_DISPLACEMENT=E.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,E.MIN_REPULSION_DIST=E.DEFAULT_EDGE_LENGTH/10,E.CONVERGENCE_CHECK_PERIOD=100,E.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,E.MIN_EDGE_LENGTH=1,E.GRID_CALCULATION_CHECK_PERIOD=10,q.exports=E},function(q,W,_){"use strict";var L=_(12);function E(){}E.calcSeparationAmount=function(w,A,V,U){if(!w.intersects(A))throw"assert failed";var R=new Array(2);this.decideDirectionsForOverlappingNodes(w,A,R),V[0]=Math.min(w.getRight(),A.getRight())-Math.max(w.x,A.x),V[1]=Math.min(w.getBottom(),A.getBottom())-Math.max(w.y,A.y),w.getX()<=A.getX()&&w.getRight()>=A.getRight()?V[0]+=Math.min(A.getX()-w.getX(),w.getRight()-A.getRight()):A.getX()<=w.getX()&&A.getRight()>=w.getRight()&&(V[0]+=Math.min(w.getX()-A.getX(),A.getRight()-w.getRight())),w.getY()<=A.getY()&&w.getBottom()>=A.getBottom()?V[1]+=Math.min(A.getY()-w.getY(),w.getBottom()-A.getBottom()):A.getY()<=w.getY()&&A.getBottom()>=w.getBottom()&&(V[1]+=Math.min(w.getY()-A.getY(),A.getBottom()-w.getBottom()));var J=Math.abs((A.getCenterY()-w.getCenterY())/(A.getCenterX()-w.getCenterX()));A.getCenterY()===w.getCenterY()&&A.getCenterX()===w.getCenterX()&&(J=1);var D=J*V[0],$=V[1]/J;V[0]<$?$=V[0]:D=V[1],V[0]=-1*R[0]*($/2+U),V[1]=-1*R[1]*(D/2+U)},E.decideDirectionsForOverlappingNodes=function(w,A,V){w.getCenterX()<A.getCenterX()?V[0]=-1:V[0]=1,w.getCenterY()<A.getCenterY()?V[1]=-1:V[1]=1},E.getIntersection2=function(w,A,V){var U=w.getCenterX(),R=w.getCenterY(),J=A.getCenterX(),D=A.getCenterY();if(w.intersects(A))return V[0]=U,V[1]=R,V[2]=J,V[3]=D,!0;var $=w.getX(),Y=w.getY(),j=w.getRight(),te=w.getX(),le=w.getBottom(),Q=w.getRight(),ee=w.getWidthHalf(),ne=w.getHeightHalf(),me=A.getX(),C=A.getY(),B=A.getRight(),N=A.getX(),Z=A.getBottom(),ue=A.getRight(),se=A.getWidthHalf(),Le=A.getHeightHalf(),be=!1,Ge=!1;if(U===J){if(R>D)return V[0]=U,V[1]=Y,V[2]=J,V[3]=Z,!1;if(R<D)return V[0]=U,V[1]=le,V[2]=J,V[3]=C,!1}else if(R===D){if(U>J)return V[0]=$,V[1]=R,V[2]=B,V[3]=D,!1;if(U<J)return V[0]=j,V[1]=R,V[2]=me,V[3]=D,!1}else{var et=w.height/w.width,ct=A.height/A.width,Ye=(D-R)/(J-U),Fe=void 0,ze=void 0,Je=void 0,at=void 0,ut=void 0,tt=void 0;if(-et===Ye?U>J?(V[0]=te,V[1]=le,be=!0):(V[0]=j,V[1]=Y,be=!0):et===Ye&&(U>J?(V[0]=$,V[1]=Y,be=!0):(V[0]=Q,V[1]=le,be=!0)),-ct===Ye?J>U?(V[2]=N,V[3]=Z,Ge=!0):(V[2]=B,V[3]=C,Ge=!0):ct===Ye&&(J>U?(V[2]=me,V[3]=C,Ge=!0):(V[2]=ue,V[3]=Z,Ge=!0)),be&&Ge)return!1;if(U>J?R>D?(Fe=this.getCardinalDirection(et,Ye,4),ze=this.getCardinalDirection(ct,Ye,2)):(Fe=this.getCardinalDirection(-et,Ye,3),ze=this.getCardinalDirection(-ct,Ye,1)):R>D?(Fe=this.getCardinalDirection(-et,Ye,1),ze=this.getCardinalDirection(-ct,Ye,3)):(Fe=this.getCardinalDirection(et,Ye,2),ze=this.getCardinalDirection(ct,Ye,4)),!be)switch(Fe){case 1:at=Y,Je=U+-ne/Ye,V[0]=Je,V[1]=at;break;case 2:Je=Q,at=R+ee*Ye,V[0]=Je,V[1]=at;break;case 3:at=le,Je=U+ne/Ye,V[0]=Je,V[1]=at;break;case 4:Je=te,at=R+-ee*Ye,V[0]=Je,V[1]=at;break}if(!Ge)switch(ze){case 1:tt=C,ut=J+-Le/Ye,V[2]=ut,V[3]=tt;break;case 2:ut=ue,tt=D+se*Ye,V[2]=ut,V[3]=tt;break;case 3:tt=Z,ut=J+Le/Ye,V[2]=ut,V[3]=tt;break;case 4:ut=N,tt=D+-se*Ye,V[2]=ut,V[3]=tt;break}}return!1},E.getCardinalDirection=function(w,A,V){return w>A?V:1+V%4},E.getIntersection=function(w,A,V,U){if(U==null)return this.getIntersection2(w,A,V);var R=w.x,J=w.y,D=A.x,$=A.y,Y=V.x,j=V.y,te=U.x,le=U.y,Q=void 0,ee=void 0,ne=void 0,me=void 0,C=void 0,B=void 0,N=void 0,Z=void 0,ue=void 0;return ne=$-J,C=R-D,N=D*J-R*$,me=le-j,B=Y-te,Z=te*j-Y*le,ue=ne*B-me*C,ue===0?null:(Q=(C*Z-B*N)/ue,ee=(me*N-ne*Z)/ue,new L(Q,ee))},E.angleOfVector=function(w,A,V,U){var R=void 0;return w!==V?(R=Math.atan((U-A)/(V-w)),V<w?R+=Math.PI:U<A&&(R+=this.TWO_PI)):U<A?R=this.ONE_AND_HALF_PI:R=this.HALF_PI,R},E.doIntersect=function(w,A,V,U){var R=w.x,J=w.y,D=A.x,$=A.y,Y=V.x,j=V.y,te=U.x,le=U.y,Q=(D-R)*(le-j)-(te-Y)*($-J);if(Q===0)return!1;var ee=((le-j)*(te-R)+(Y-te)*(le-J))/Q,ne=((J-$)*(te-R)+(D-R)*(le-J))/Q;return 0<ee&&ee<1&&0<ne&&ne<1},E.HALF_PI=.5*Math.PI,E.ONE_AND_HALF_PI=1.5*Math.PI,E.TWO_PI=2*Math.PI,E.THREE_PI=3*Math.PI,q.exports=E},function(q,W,_){"use strict";function L(){}L.sign=function(E){return E>0?1:E<0?-1:0},L.floor=function(E){return E<0?Math.ceil(E):Math.floor(E)},L.ceil=function(E){return E<0?Math.floor(E):Math.ceil(E)},q.exports=L},function(q,W,_){"use strict";function L(){}L.MAX_VALUE=2147483647,L.MIN_VALUE=-2147483648,q.exports=L},function(q,W,_){"use strict";var L=function(){function R(J,D){for(var $=0;$<D.length;$++){var Y=D[$];Y.enumerable=Y.enumerable||!1,Y.configurable=!0,"value"in Y&&(Y.writable=!0),Object.defineProperty(J,Y.key,Y)}}return function(J,D,$){return D&&R(J.prototype,D),$&&R(J,$),J}}();function E(R,J){if(!(R instanceof J))throw new TypeError("Cannot call a class as a function")}var w=function(J){return{value:J,next:null,prev:null}},A=function(J,D,$,Y){return J!==null?J.next=D:Y.head=D,$!==null?$.prev=D:Y.tail=D,D.prev=J,D.next=$,Y.length++,D},V=function(J,D){var $=J.prev,Y=J.next;return $!==null?$.next=Y:D.head=Y,Y!==null?Y.prev=$:D.tail=$,J.prev=J.next=null,D.length--,J},U=function(){function R(J){var D=this;E(this,R),this.length=0,this.head=null,this.tail=null,J!=null&&J.forEach(function($){return D.push($)})}return L(R,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(D,$){return A($.prev,w(D),$,this)}},{key:"insertAfter",value:function(D,$){return A($,w(D),$.next,this)}},{key:"insertNodeBefore",value:function(D,$){return A($.prev,D,$,this)}},{key:"insertNodeAfter",value:function(D,$){return A($,D,$.next,this)}},{key:"push",value:function(D){return A(this.tail,w(D),null,this)}},{key:"unshift",value:function(D){return A(null,w(D),this.head,this)}},{key:"remove",value:function(D){return V(D,this)}},{key:"pop",value:function(){return V(this.tail,this).value}},{key:"popNode",value:function(){return V(this.tail,this)}},{key:"shift",value:function(){return V(this.head,this).value}},{key:"shiftNode",value:function(){return V(this.head,this)}},{key:"get_object_at",value:function(D){if(D<=this.length()){for(var $=1,Y=this.head;$<D;)Y=Y.next,$++;return Y.value}}},{key:"set_object_at",value:function(D,$){if(D<=this.length()){for(var Y=1,j=this.head;Y<D;)j=j.next,Y++;j.value=$}}}]),R}();q.exports=U},function(q,W,_){"use strict";function L(E,w,A){this.x=null,this.y=null,E==null&&w==null&&A==null?(this.x=0,this.y=0):typeof E=="number"&&typeof w=="number"&&A==null?(this.x=E,this.y=w):E.constructor.name=="Point"&&w==null&&A==null&&(A=E,this.x=A.x,this.y=A.y)}L.prototype.getX=function(){return this.x},L.prototype.getY=function(){return this.y},L.prototype.getLocation=function(){return new L(this.x,this.y)},L.prototype.setLocation=function(E,w,A){E.constructor.name=="Point"&&w==null&&A==null?(A=E,this.setLocation(A.x,A.y)):typeof E=="number"&&typeof w=="number"&&A==null&&(parseInt(E)==E&&parseInt(w)==w?this.move(E,w):(this.x=Math.floor(E+.5),this.y=Math.floor(w+.5)))},L.prototype.move=function(E,w){this.x=E,this.y=w},L.prototype.translate=function(E,w){this.x+=E,this.y+=w},L.prototype.equals=function(E){if(E.constructor.name=="Point"){var w=E;return this.x==w.x&&this.y==w.y}return this==E},L.prototype.toString=function(){return new L().constructor.name+"[x="+this.x+",y="+this.y+"]"},q.exports=L},function(q,W,_){"use strict";function L(E,w,A,V){this.x=0,this.y=0,this.width=0,this.height=0,E!=null&&w!=null&&A!=null&&V!=null&&(this.x=E,this.y=w,this.width=A,this.height=V)}L.prototype.getX=function(){return this.x},L.prototype.setX=function(E){this.x=E},L.prototype.getY=function(){return this.y},L.prototype.setY=function(E){this.y=E},L.prototype.getWidth=function(){return this.width},L.prototype.setWidth=function(E){this.width=E},L.prototype.getHeight=function(){return this.height},L.prototype.setHeight=function(E){this.height=E},L.prototype.getRight=function(){return this.x+this.width},L.prototype.getBottom=function(){return this.y+this.height},L.prototype.intersects=function(E){return!(this.getRight()<E.x||this.getBottom()<E.y||E.getRight()<this.x||E.getBottom()<this.y)},L.prototype.getCenterX=function(){return this.x+this.width/2},L.prototype.getMinX=function(){return this.getX()},L.prototype.getMaxX=function(){return this.getX()+this.width},L.prototype.getCenterY=function(){return this.y+this.height/2},L.prototype.getMinY=function(){return this.getY()},L.prototype.getMaxY=function(){return this.getY()+this.height},L.prototype.getWidthHalf=function(){return this.width/2},L.prototype.getHeightHalf=function(){return this.height/2},q.exports=L},function(q,W,_){"use strict";var L=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(w){return typeof w}:function(w){return w&&typeof Symbol=="function"&&w.constructor===Symbol&&w!==Symbol.prototype?"symbol":typeof w};function E(){}E.lastID=0,E.createID=function(w){return E.isPrimitive(w)?w:(w.uniqueID!=null||(w.uniqueID=E.getString(),E.lastID++),w.uniqueID)},E.getString=function(w){return w==null&&(w=E.lastID),"Object#"+w},E.isPrimitive=function(w){var A=typeof w=="undefined"?"undefined":L(w);return w==null||A!="object"&&A!="function"},q.exports=E},function(q,W,_){"use strict";function L(Y){if(Array.isArray(Y)){for(var j=0,te=Array(Y.length);j<Y.length;j++)te[j]=Y[j];return te}else return Array.from(Y)}var E=_(0),w=_(6),A=_(3),V=_(1),U=_(5),R=_(4),J=_(17),D=_(27);function $(Y){D.call(this),this.layoutQuality=E.QUALITY,this.createBendsAsNeeded=E.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=E.DEFAULT_INCREMENTAL,this.animationOnLayout=E.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=E.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=E.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=E.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new w(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,Y!=null&&(this.isRemoteUse=Y)}$.RANDOM_SEED=1,$.prototype=Object.create(D.prototype),$.prototype.getGraphManager=function(){return this.graphManager},$.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},$.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},$.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},$.prototype.newGraphManager=function(){var Y=new w(this);return this.graphManager=Y,Y},$.prototype.newGraph=function(Y){return new U(null,this.graphManager,Y)},$.prototype.newNode=function(Y){return new A(this.graphManager,Y)},$.prototype.newEdge=function(Y){return new V(null,null,Y)},$.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},$.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var Y;return this.checkLayoutSuccess()?Y=!1:Y=this.layout(),E.ANIMATE==="during"?!1:(Y&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,Y)},$.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},$.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var Y,j=this.graphManager.getAllEdges(),te=0;te<j.length;te++)Y=j[te];for(var le,Q=this.graphManager.getRoot().getNodes(),te=0;te<Q.length;te++)le=Q[te];this.update(this.graphManager.getRoot())}},$.prototype.update=function(Y){if(Y==null)this.update2();else if(Y instanceof A){var j=Y;if(j.getChild()!=null)for(var te=j.getChild().getNodes(),le=0;le<te.length;le++)update(te[le]);if(j.vGraphObject!=null){var Q=j.vGraphObject;Q.update(j)}}else if(Y instanceof V){var ee=Y;if(ee.vGraphObject!=null){var ne=ee.vGraphObject;ne.update(ee)}}else if(Y instanceof U){var me=Y;if(me.vGraphObject!=null){var C=me.vGraphObject;C.update(me)}}},$.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=E.QUALITY,this.animationDuringLayout=E.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=E.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=E.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=E.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=E.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=E.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},$.prototype.transform=function(Y){if(Y==null)this.transform(new R(0,0));else{var j=new J,te=this.graphManager.getRoot().updateLeftTop();if(te!=null){j.setWorldOrgX(Y.x),j.setWorldOrgY(Y.y),j.setDeviceOrgX(te.x),j.setDeviceOrgY(te.y);for(var le=this.getAllNodes(),Q,ee=0;ee<le.length;ee++)Q=le[ee],Q.transform(j)}}},$.prototype.positionNodesRandomly=function(Y){if(Y==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var j,te,le=Y.getNodes(),Q=0;Q<le.length;Q++)j=le[Q],te=j.getChild(),te==null||te.getNodes().length==0?j.scatter():(this.positionNodesRandomly(te),j.updateBounds())},$.prototype.getFlatForest=function(){for(var Y=[],j=!0,te=this.graphManager.getRoot().getNodes(),le=!0,Q=0;Q<te.length;Q++)te[Q].getChild()!=null&&(le=!1);if(!le)return Y;var ee=new Set,ne=[],me=new Map,C=[];for(C=C.concat(te);C.length>0&&j;){for(ne.push(C[0]);ne.length>0&&j;){var B=ne[0];ne.splice(0,1),ee.add(B);for(var N=B.getEdges(),Q=0;Q<N.length;Q++){var Z=N[Q].getOtherEnd(B);if(me.get(B)!=Z)if(!ee.has(Z))ne.push(Z),me.set(Z,B);else{j=!1;break}}}if(!j)Y=[];else{var ue=[].concat(L(ee));Y.push(ue);for(var Q=0;Q<ue.length;Q++){var se=ue[Q],Le=C.indexOf(se);Le>-1&&C.splice(Le,1)}ee=new Set,me=new Map}}return Y},$.prototype.createDummyNodesForBendpoints=function(Y){for(var j=[],te=Y.source,le=this.graphManager.calcLowestCommonAncestor(Y.source,Y.target),Q=0;Q<Y.bendpoints.length;Q++){var ee=this.newNode(null);ee.setRect(new Point(0,0),new Dimension(1,1)),le.add(ee);var ne=this.newEdge(null);this.graphManager.add(ne,te,ee),j.add(ee),te=ee}var ne=this.newEdge(null);return this.graphManager.add(ne,te,Y.target),this.edgeToDummyNodes.set(Y,j),Y.isInterGraph()?this.graphManager.remove(Y):le.remove(Y),j},$.prototype.createBendpointsFromDummyNodes=function(){var Y=[];Y=Y.concat(this.graphManager.getAllEdges()),Y=[].concat(L(this.edgeToDummyNodes.keys())).concat(Y);for(var j=0;j<Y.length;j++){var te=Y[j];if(te.bendpoints.length>0){for(var le=this.edgeToDummyNodes.get(te),Q=0;Q<le.length;Q++){var ee=le[Q],ne=new R(ee.getCenterX(),ee.getCenterY()),me=te.bendpoints.get(Q);me.x=ne.x,me.y=ne.y,ee.getOwner().remove(ee)}this.graphManager.add(te,te.source,te.target)}}},$.transform=function(Y,j,te,le){if(te!=null&&le!=null){var Q=j;if(Y<=50){var ee=j/te;Q-=(j-ee)/50*(50-Y)}else{var ne=j*le;Q+=(ne-j)/50*(Y-50)}return Q}else{var me,C;return Y<=50?(me=9*j/500,C=j/10):(me=9*j/50,C=-8*j),me*Y+C}},$.findCenterOfTree=function(Y){var j=[];j=j.concat(Y);var te=[],le=new Map,Q=!1,ee=null;(j.length==1||j.length==2)&&(Q=!0,ee=j[0]);for(var ne=0;ne<j.length;ne++){var me=j[ne],C=me.getNeighborsList().size;le.set(me,me.getNeighborsList().size),C==1&&te.push(me)}var B=[];for(B=B.concat(te);!Q;){var N=[];N=N.concat(B),B=[];for(var ne=0;ne<j.length;ne++){var me=j[ne],Z=j.indexOf(me);Z>=0&&j.splice(Z,1);var ue=me.getNeighborsList();ue.forEach(function(be){if(te.indexOf(be)<0){var Ge=le.get(be),et=Ge-1;et==1&&B.push(be),le.set(be,et)}})}te=te.concat(B),(j.length==1||j.length==2)&&(Q=!0,ee=j[0])}return ee},$.prototype.setGraphManager=function(Y){this.graphManager=Y},q.exports=$},function(q,W,_){"use strict";function L(){}L.seed=1,L.x=0,L.nextDouble=function(){return L.x=Math.sin(L.seed++)*1e4,L.x-Math.floor(L.x)},q.exports=L},function(q,W,_){"use strict";var L=_(4);function E(w,A){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}E.prototype.getWorldOrgX=function(){return this.lworldOrgX},E.prototype.setWorldOrgX=function(w){this.lworldOrgX=w},E.prototype.getWorldOrgY=function(){return this.lworldOrgY},E.prototype.setWorldOrgY=function(w){this.lworldOrgY=w},E.prototype.getWorldExtX=function(){return this.lworldExtX},E.prototype.setWorldExtX=function(w){this.lworldExtX=w},E.prototype.getWorldExtY=function(){return this.lworldExtY},E.prototype.setWorldExtY=function(w){this.lworldExtY=w},E.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},E.prototype.setDeviceOrgX=function(w){this.ldeviceOrgX=w},E.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},E.prototype.setDeviceOrgY=function(w){this.ldeviceOrgY=w},E.prototype.getDeviceExtX=function(){return this.ldeviceExtX},E.prototype.setDeviceExtX=function(w){this.ldeviceExtX=w},E.prototype.getDeviceExtY=function(){return this.ldeviceExtY},E.prototype.setDeviceExtY=function(w){this.ldeviceExtY=w},E.prototype.transformX=function(w){var A=0,V=this.lworldExtX;return V!=0&&(A=this.ldeviceOrgX+(w-this.lworldOrgX)*this.ldeviceExtX/V),A},E.prototype.transformY=function(w){var A=0,V=this.lworldExtY;return V!=0&&(A=this.ldeviceOrgY+(w-this.lworldOrgY)*this.ldeviceExtY/V),A},E.prototype.inverseTransformX=function(w){var A=0,V=this.ldeviceExtX;return V!=0&&(A=this.lworldOrgX+(w-this.ldeviceOrgX)*this.lworldExtX/V),A},E.prototype.inverseTransformY=function(w){var A=0,V=this.ldeviceExtY;return V!=0&&(A=this.lworldOrgY+(w-this.ldeviceOrgY)*this.lworldExtY/V),A},E.prototype.inverseTransformPoint=function(w){var A=new L(this.inverseTransformX(w.x),this.inverseTransformY(w.y));return A},q.exports=E},function(q,W,_){"use strict";function L(D){if(Array.isArray(D)){for(var $=0,Y=Array(D.length);$<D.length;$++)Y[$]=D[$];return Y}else return Array.from(D)}var E=_(15),w=_(7),A=_(0),V=_(8),U=_(9);function R(){E.call(this),this.useSmartIdealEdgeLengthCalculation=w.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=w.DEFAULT_EDGE_LENGTH,this.springConstant=w.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=w.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=w.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=w.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=w.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=w.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*w.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=w.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=w.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=w.MAX_ITERATIONS}R.prototype=Object.create(E.prototype);for(var J in E)R[J]=E[J];R.prototype.initParameters=function(){E.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=w.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},R.prototype.calcIdealEdgeLengths=function(){for(var D,$,Y,j,te,le,Q=this.getGraphManager().getAllEdges(),ee=0;ee<Q.length;ee++)D=Q[ee],D.idealLength=this.idealEdgeLength,D.isInterGraph&&(Y=D.getSource(),j=D.getTarget(),te=D.getSourceInLca().getEstimatedSize(),le=D.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(D.idealLength+=te+le-2*A.SIMPLE_NODE_SIZE),$=D.getLca().getInclusionTreeDepth(),D.idealLength+=w.DEFAULT_EDGE_LENGTH*w.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(Y.getInclusionTreeDepth()+j.getInclusionTreeDepth()-2*$))},R.prototype.initSpringEmbedder=function(){var D=this.getAllNodes().length;this.incremental?(D>w.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*w.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-w.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT_INCREMENTAL):(D>w.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(w.COOLING_ADAPTATION_FACTOR,1-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*(1-w.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},R.prototype.calcSpringForces=function(){for(var D=this.getAllEdges(),$,Y=0;Y<D.length;Y++)$=D[Y],this.calcSpringForce($,$.idealLength)},R.prototype.calcRepulsionForces=function(){var D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,Y,j,te,le,Q=this.getAllNodes(),ee;if(this.useFRGridVariant)for(this.totalIterations%w.GRID_CALCULATION_CHECK_PERIOD==1&&D&&this.updateGrid(),ee=new Set,Y=0;Y<Q.length;Y++)te=Q[Y],this.calculateRepulsionForceOfANode(te,ee,D,$),ee.add(te);else for(Y=0;Y<Q.length;Y++)for(te=Q[Y],j=Y+1;j<Q.length;j++)le=Q[j],te.getOwner()==le.getOwner()&&this.calcRepulsionForce(te,le)},R.prototype.calcGravitationalForces=function(){for(var D,$=this.getAllNodesToApplyGravitation(),Y=0;Y<$.length;Y++)D=$[Y],this.calcGravitationalForce(D)},R.prototype.moveNodes=function(){for(var D=this.getAllNodes(),$,Y=0;Y<D.length;Y++)$=D[Y],$.move()},R.prototype.calcSpringForce=function(D,$){var Y=D.getSource(),j=D.getTarget(),te,le,Q,ee;if(this.uniformLeafNodeSizes&&Y.getChild()==null&&j.getChild()==null)D.updateLengthSimple();else if(D.updateLength(),D.isOverlapingSourceAndTarget)return;te=D.getLength(),te!=0&&(le=this.springConstant*(te-$),Q=le*(D.lengthX/te),ee=le*(D.lengthY/te),Y.springForceX+=Q,Y.springForceY+=ee,j.springForceX-=Q,j.springForceY-=ee)},R.prototype.calcRepulsionForce=function(D,$){var Y=D.getRect(),j=$.getRect(),te=new Array(2),le=new Array(4),Q,ee,ne,me,C,B,N;if(Y.intersects(j)){V.calcSeparationAmount(Y,j,te,w.DEFAULT_EDGE_LENGTH/2),B=2*te[0],N=2*te[1];var Z=D.noOfChildren*$.noOfChildren/(D.noOfChildren+$.noOfChildren);D.repulsionForceX-=Z*B,D.repulsionForceY-=Z*N,$.repulsionForceX+=Z*B,$.repulsionForceY+=Z*N}else this.uniformLeafNodeSizes&&D.getChild()==null&&$.getChild()==null?(Q=j.getCenterX()-Y.getCenterX(),ee=j.getCenterY()-Y.getCenterY()):(V.getIntersection(Y,j,le),Q=le[2]-le[0],ee=le[3]-le[1]),Math.abs(Q)<w.MIN_REPULSION_DIST&&(Q=U.sign(Q)*w.MIN_REPULSION_DIST),Math.abs(ee)<w.MIN_REPULSION_DIST&&(ee=U.sign(ee)*w.MIN_REPULSION_DIST),ne=Q*Q+ee*ee,me=Math.sqrt(ne),C=this.repulsionConstant*D.noOfChildren*$.noOfChildren/ne,B=C*Q/me,N=C*ee/me,D.repulsionForceX-=B,D.repulsionForceY-=N,$.repulsionForceX+=B,$.repulsionForceY+=N},R.prototype.calcGravitationalForce=function(D){var $,Y,j,te,le,Q,ee,ne;$=D.getOwner(),Y=($.getRight()+$.getLeft())/2,j=($.getTop()+$.getBottom())/2,te=D.getCenterX()-Y,le=D.getCenterY()-j,Q=Math.abs(te)+D.getWidth()/2,ee=Math.abs(le)+D.getHeight()/2,D.getOwner()==this.graphManager.getRoot()?(ne=$.getEstimatedSize()*this.gravityRangeFactor,(Q>ne||ee>ne)&&(D.gravitationForceX=-this.gravityConstant*te,D.gravitationForceY=-this.gravityConstant*le)):(ne=$.getEstimatedSize()*this.compoundGravityRangeFactor,(Q>ne||ee>ne)&&(D.gravitationForceX=-this.gravityConstant*te*this.compoundGravityConstant,D.gravitationForceY=-this.gravityConstant*le*this.compoundGravityConstant))},R.prototype.isConverged=function(){var D,$=!1;return this.totalIterations>this.maxIterations/3&&($=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),D=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,D||$},R.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},R.prototype.calcNoOfChildrenForAllNodes=function(){for(var D,$=this.graphManager.getAllNodes(),Y=0;Y<$.length;Y++)D=$[Y],D.noOfChildren=D.getNoOfChildren()},R.prototype.calcGrid=function(D){var $=0,Y=0;$=parseInt(Math.ceil((D.getRight()-D.getLeft())/this.repulsionRange)),Y=parseInt(Math.ceil((D.getBottom()-D.getTop())/this.repulsionRange));for(var j=new Array($),te=0;te<$;te++)j[te]=new Array(Y);for(var te=0;te<$;te++)for(var le=0;le<Y;le++)j[te][le]=new Array;return j},R.prototype.addNodeToGrid=function(D,$,Y){var j=0,te=0,le=0,Q=0;j=parseInt(Math.floor((D.getRect().x-$)/this.repulsionRange)),te=parseInt(Math.floor((D.getRect().width+D.getRect().x-$)/this.repulsionRange)),le=parseInt(Math.floor((D.getRect().y-Y)/this.repulsionRange)),Q=parseInt(Math.floor((D.getRect().height+D.getRect().y-Y)/this.repulsionRange));for(var ee=j;ee<=te;ee++)for(var ne=le;ne<=Q;ne++)this.grid[ee][ne].push(D),D.setGridCoordinates(j,te,le,Q)},R.prototype.updateGrid=function(){var D,$,Y=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),D=0;D<Y.length;D++)$=Y[D],this.addNodeToGrid($,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},R.prototype.calculateRepulsionForceOfANode=function(D,$,Y,j){if(this.totalIterations%w.GRID_CALCULATION_CHECK_PERIOD==1&&Y||j){var te=new Set;D.surrounding=new Array;for(var le,Q=this.grid,ee=D.startX-1;ee<D.finishX+2;ee++)for(var ne=D.startY-1;ne<D.finishY+2;ne++)if(!(ee<0||ne<0||ee>=Q.length||ne>=Q[0].length)){for(var me=0;me<Q[ee][ne].length;me++)if(le=Q[ee][ne][me],!(D.getOwner()!=le.getOwner()||D==le)&&!$.has(le)&&!te.has(le)){var C=Math.abs(D.getCenterX()-le.getCenterX())-(D.getWidth()/2+le.getWidth()/2),B=Math.abs(D.getCenterY()-le.getCenterY())-(D.getHeight()/2+le.getHeight()/2);C<=this.repulsionRange&&B<=this.repulsionRange&&te.add(le)}}D.surrounding=[].concat(L(te))}for(ee=0;ee<D.surrounding.length;ee++)this.calcRepulsionForce(D,D.surrounding[ee])},R.prototype.calcRepulsionRange=function(){return 0},q.exports=R},function(q,W,_){"use strict";var L=_(1),E=_(7);function w(V,U,R){L.call(this,V,U,R),this.idealLength=E.DEFAULT_EDGE_LENGTH}w.prototype=Object.create(L.prototype);for(var A in L)w[A]=L[A];q.exports=w},function(q,W,_){"use strict";var L=_(3);function E(A,V,U,R){L.call(this,A,V,U,R),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}E.prototype=Object.create(L.prototype);for(var w in L)E[w]=L[w];E.prototype.setGridCoordinates=function(A,V,U,R){this.startX=A,this.finishX=V,this.startY=U,this.finishY=R},q.exports=E},function(q,W,_){"use strict";function L(E,w){this.width=0,this.height=0,E!==null&&w!==null&&(this.height=w,this.width=E)}L.prototype.getWidth=function(){return this.width},L.prototype.setWidth=function(E){this.width=E},L.prototype.getHeight=function(){return this.height},L.prototype.setHeight=function(E){this.height=E},q.exports=L},function(q,W,_){"use strict";var L=_(14);function E(){this.map={},this.keys=[]}E.prototype.put=function(w,A){var V=L.createID(w);this.contains(V)||(this.map[V]=A,this.keys.push(w))},E.prototype.contains=function(w){var A=L.createID(w);return this.map[w]!=null},E.prototype.get=function(w){var A=L.createID(w);return this.map[A]},E.prototype.keySet=function(){return this.keys},q.exports=E},function(q,W,_){"use strict";var L=_(14);function E(){this.set={}}E.prototype.add=function(w){var A=L.createID(w);this.contains(A)||(this.set[A]=w)},E.prototype.remove=function(w){delete this.set[L.createID(w)]},E.prototype.clear=function(){this.set={}},E.prototype.contains=function(w){return this.set[L.createID(w)]==w},E.prototype.isEmpty=function(){return this.size()===0},E.prototype.size=function(){return Object.keys(this.set).length},E.prototype.addAllTo=function(w){for(var A=Object.keys(this.set),V=A.length,U=0;U<V;U++)w.push(this.set[A[U]])},E.prototype.size=function(){return Object.keys(this.set).length},E.prototype.addAll=function(w){for(var A=w.length,V=0;V<A;V++){var U=w[V];this.add(U)}},q.exports=E},function(q,W,_){"use strict";var L=function(){function V(U,R){for(var J=0;J<R.length;J++){var D=R[J];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(U,D.key,D)}}return function(U,R,J){return R&&V(U.prototype,R),J&&V(U,J),U}}();function E(V,U){if(!(V instanceof U))throw new TypeError("Cannot call a class as a function")}var w=_(11),A=function(){function V(U,R){E(this,V),(R!==null||R!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var J=void 0;U instanceof w?J=U.size():J=U.length,this._quicksort(U,0,J-1)}return L(V,[{key:"_quicksort",value:function(R,J,D){if(J<D){var $=this._partition(R,J,D);this._quicksort(R,J,$),this._quicksort(R,$+1,D)}}},{key:"_partition",value:function(R,J,D){for(var $=this._get(R,J),Y=J,j=D;;){for(;this.compareFunction($,this._get(R,j));)j--;for(;this.compareFunction(this._get(R,Y),$);)Y++;if(Y<j)this._swap(R,Y,j),Y++,j--;else return j}}},{key:"_get",value:function(R,J){return R instanceof w?R.get_object_at(J):R[J]}},{key:"_set",value:function(R,J,D){R instanceof w?R.set_object_at(J,D):R[J]=D}},{key:"_swap",value:function(R,J,D){var $=this._get(R,J);this._set(R,J,this._get(R,D)),this._set(R,D,$)}},{key:"_defaultCompareFunction",value:function(R,J){return J>R}}]),V}();q.exports=A},function(q,W,_){"use strict";var L=function(){function A(V,U){for(var R=0;R<U.length;R++){var J=U[R];J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J&&(J.writable=!0),Object.defineProperty(V,J.key,J)}}return function(V,U,R){return U&&A(V.prototype,U),R&&A(V,R),V}}();function E(A,V){if(!(A instanceof V))throw new TypeError("Cannot call a class as a function")}var w=function(){function A(V,U){var R=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,J=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,D=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;E(this,A),this.sequence1=V,this.sequence2=U,this.match_score=R,this.mismatch_penalty=J,this.gap_penalty=D,this.iMax=V.length+1,this.jMax=U.length+1,this.grid=new Array(this.iMax);for(var $=0;$<this.iMax;$++){this.grid[$]=new Array(this.jMax);for(var Y=0;Y<this.jMax;Y++)this.grid[$][Y]=0}this.tracebackGrid=new Array(this.iMax);for(var j=0;j<this.iMax;j++){this.tracebackGrid[j]=new Array(this.jMax);for(var te=0;te<this.jMax;te++)this.tracebackGrid[j][te]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return L(A,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var U=1;U<this.jMax;U++)this.grid[0][U]=this.grid[0][U-1]+this.gap_penalty,this.tracebackGrid[0][U]=[!1,!1,!0];for(var R=1;R<this.iMax;R++)this.grid[R][0]=this.grid[R-1][0]+this.gap_penalty,this.tracebackGrid[R][0]=[!1,!0,!1];for(var J=1;J<this.iMax;J++)for(var D=1;D<this.jMax;D++){var $=void 0;this.sequence1[J-1]===this.sequence2[D-1]?$=this.grid[J-1][D-1]+this.match_score:$=this.grid[J-1][D-1]+this.mismatch_penalty;var Y=this.grid[J-1][D]+this.gap_penalty,j=this.grid[J][D-1]+this.gap_penalty,te=[$,Y,j],le=this.arrayAllMaxIndexes(te);this.grid[J][D]=te[le[0]],this.tracebackGrid[J][D]=[le.includes(0),le.includes(1),le.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var U=[];for(U.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});U[0];){var R=U[0],J=this.tracebackGrid[R.pos[0]][R.pos[1]];J[0]&&U.push({pos:[R.pos[0]-1,R.pos[1]-1],seq1:this.sequence1[R.pos[0]-1]+R.seq1,seq2:this.sequence2[R.pos[1]-1]+R.seq2}),J[1]&&U.push({pos:[R.pos[0]-1,R.pos[1]],seq1:this.sequence1[R.pos[0]-1]+R.seq1,seq2:"-"+R.seq2}),J[2]&&U.push({pos:[R.pos[0],R.pos[1]-1],seq1:"-"+R.seq1,seq2:this.sequence2[R.pos[1]-1]+R.seq2}),R.pos[0]===0&&R.pos[1]===0&&this.alignments.push({sequence1:R.seq1,sequence2:R.seq2}),U.shift()}return this.alignments}},{key:"getAllIndexes",value:function(U,R){for(var J=[],D=-1;(D=U.indexOf(R,D+1))!==-1;)J.push(D);return J}},{key:"arrayAllMaxIndexes",value:function(U){return this.getAllIndexes(U,Math.max.apply(null,U))}}]),A}();q.exports=w},function(q,W,_){"use strict";var L=function(){};L.FDLayout=_(18),L.FDLayoutConstants=_(7),L.FDLayoutEdge=_(19),L.FDLayoutNode=_(20),L.DimensionD=_(21),L.HashMap=_(22),L.HashSet=_(23),L.IGeometry=_(8),L.IMath=_(9),L.Integer=_(10),L.Point=_(12),L.PointD=_(4),L.RandomSeed=_(16),L.RectangleD=_(13),L.Transform=_(17),L.UniqueIDGeneretor=_(14),L.Quicksort=_(24),L.LinkedList=_(11),L.LGraphObject=_(2),L.LGraph=_(5),L.LEdge=_(1),L.LGraphManager=_(6),L.LNode=_(3),L.Layout=_(15),L.LayoutConstants=_(0),L.NeedlemanWunsch=_(25),q.exports=L},function(q,W,_){"use strict";function L(){this.listeners=[]}var E=L.prototype;E.addListener=function(w,A){this.listeners.push({event:w,callback:A})},E.removeListener=function(w,A){for(var V=this.listeners.length;V>=0;V--){var U=this.listeners[V];U.event===w&&U.callback===A&&this.listeners.splice(V,1)}},E.emit=function(w,A){for(var V=0;V<this.listeners.length;V++){var U=this.listeners[V];w===U.event&&U.callback(A)}},q.exports=L}])})});var rs=ni((un,ts)=>{(function(W,_){typeof un=="object"&&typeof ts=="object"?ts.exports=_(es()):typeof define=="function"&&define.amd?define(["layout-base"],_):typeof un=="object"?un.coseBase=_(es()):W.coseBase=_(W.layoutBase)})(un,function(q){return function(W){var _={};function L(E){if(_[E])return _[E].exports;var w=_[E]={i:E,l:!1,exports:{}};return W[E].call(w.exports,w,w.exports,L),w.l=!0,w.exports}return L.m=W,L.c=_,L.i=function(E){return E},L.d=function(E,w,A){L.o(E,w)||Object.defineProperty(E,w,{configurable:!1,enumerable:!0,get:A})},L.n=function(E){var w=E&&E.__esModule?function(){return E.default}:function(){return E};return L.d(w,"a",w),w},L.o=function(E,w){return Object.prototype.hasOwnProperty.call(E,w)},L.p="",L(L.s=7)}([function(W,_){W.exports=q},function(W,_,L){"use strict";var E=L(0).FDLayoutConstants;function w(){}for(var A in E)w[A]=E[A];w.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,w.DEFAULT_RADIAL_SEPARATION=E.DEFAULT_EDGE_LENGTH,w.DEFAULT_COMPONENT_SEPERATION=60,w.TILE=!0,w.TILING_PADDING_VERTICAL=10,w.TILING_PADDING_HORIZONTAL=10,w.TREE_REDUCTION_ON_INCREMENTAL=!1,W.exports=w},function(W,_,L){"use strict";var E=L(0).FDLayoutEdge;function w(V,U,R){E.call(this,V,U,R)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).LGraph;function w(V,U,R){E.call(this,V,U,R)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).LGraphManager;function w(V){E.call(this,V)}w.prototype=Object.create(E.prototype);for(var A in E)w[A]=E[A];W.exports=w},function(W,_,L){"use strict";var E=L(0).FDLayoutNode,w=L(0).IMath;function A(U,R,J,D){E.call(this,U,R,J,D)}A.prototype=Object.create(E.prototype);for(var V in E)A[V]=E[V];A.prototype.move=function(){var U=this.graphManager.getLayout();this.displacementX=U.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=U.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>U.coolingFactor*U.maxNodeDisplacement&&(this.displacementX=U.coolingFactor*U.maxNodeDisplacement*w.sign(this.displacementX)),Math.abs(this.displacementY)>U.coolingFactor*U.maxNodeDisplacement&&(this.displacementY=U.coolingFactor*U.maxNodeDisplacement*w.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),U.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},A.prototype.propogateDisplacementToChildren=function(U,R){for(var J=this.getChild().getNodes(),D,$=0;$<J.length;$++)D=J[$],D.getChild()==null?(D.moveBy(U,R),D.displacementX+=U,D.displacementY+=R):D.propogateDisplacementToChildren(U,R)},A.prototype.setPred1=function(U){this.pred1=U},A.prototype.getPred1=function(){return pred1},A.prototype.getPred2=function(){return pred2},A.prototype.setNext=function(U){this.next=U},A.prototype.getNext=function(){return next},A.prototype.setProcessed=function(U){this.processed=U},A.prototype.isProcessed=function(){return processed},W.exports=A},function(W,_,L){"use strict";var E=L(0).FDLayout,w=L(4),A=L(3),V=L(5),U=L(2),R=L(1),J=L(0).FDLayoutConstants,D=L(0).LayoutConstants,$=L(0).Point,Y=L(0).PointD,j=L(0).Layout,te=L(0).Integer,le=L(0).IGeometry,Q=L(0).LGraph,ee=L(0).Transform;function ne(){E.call(this),this.toBeTiled={}}ne.prototype=Object.create(E.prototype);for(var me in E)ne[me]=E[me];ne.prototype.newGraphManager=function(){var C=new w(this);return this.graphManager=C,C},ne.prototype.newGraph=function(C){return new A(null,this.graphManager,C)},ne.prototype.newNode=function(C){return new V(this.graphManager,C)},ne.prototype.newEdge=function(C){return new U(null,null,C)},ne.prototype.initParameters=function(){E.prototype.initParameters.call(this,arguments),this.isSubLayout||(R.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=R.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=R.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=J.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=J.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=J.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=J.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=J.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=J.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/J.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=J.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},ne.prototype.layout=function(){var C=D.DEFAULT_CREATE_BENDS_AS_NEEDED;return C&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},ne.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(R.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var B=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(se){return B.has(se)});this.graphManager.setAllNodesToApplyGravitation(N)}}else{var C=this.getFlatForest();if(C.length>0)this.positionNodesRadially(C);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var B=new Set(this.getAllNodes()),N=this.nodesWithGravity.filter(function(Z){return B.has(Z)});this.graphManager.setAllNodesToApplyGravitation(N),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},ne.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%J.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var C=new Set(this.getAllNodes()),B=this.nodesWithGravity.filter(function(ue){return C.has(ue)});this.graphManager.setAllNodesToApplyGravitation(B),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=J.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=J.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var N=!this.isTreeGrowing&&!this.isGrowthFinished,Z=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(N,Z),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},ne.prototype.getPositionsData=function(){for(var C=this.graphManager.getAllNodes(),B={},N=0;N<C.length;N++){var Z=C[N].rect,ue=C[N].id;B[ue]={id:ue,x:Z.getCenterX(),y:Z.getCenterY(),w:Z.width,h:Z.height}}return B},ne.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var C=!1;if(J.ANIMATE==="during")this.emit("layoutstarted");else{for(;!C;)C=this.tick();this.graphManager.updateBounds()}},ne.prototype.calculateNodesToApplyGravitationTo=function(){var C=[],B,N=this.graphManager.getGraphs(),Z=N.length,ue;for(ue=0;ue<Z;ue++)B=N[ue],B.updateConnected(),B.isConnected||(C=C.concat(B.getNodes()));return C},ne.prototype.createBendpoints=function(){var C=[];C=C.concat(this.graphManager.getAllEdges());var B=new Set,N;for(N=0;N<C.length;N++){var Z=C[N];if(!B.has(Z)){var ue=Z.getSource(),se=Z.getTarget();if(ue==se)Z.getBendpoints().push(new Y),Z.getBendpoints().push(new Y),this.createDummyNodesForBendpoints(Z),B.add(Z);else{var Le=[];if(Le=Le.concat(ue.getEdgeListToNode(se)),Le=Le.concat(se.getEdgeListToNode(ue)),!B.has(Le[0])){if(Le.length>1){var be;for(be=0;be<Le.length;be++){var Ge=Le[be];Ge.getBendpoints().push(new Y),this.createDummyNodesForBendpoints(Ge)}}Le.forEach(function(et){B.add(et)})}}}if(B.size==C.length)break}},ne.prototype.positionNodesRadially=function(C){for(var B=new $(0,0),N=Math.ceil(Math.sqrt(C.length)),Z=0,ue=0,se=0,Le=new Y(0,0),be=0;be<C.length;be++){be%N==0&&(se=0,ue=Z,be!=0&&(ue+=R.DEFAULT_COMPONENT_SEPERATION),Z=0);var Ge=C[be],et=j.findCenterOfTree(Ge);B.x=se,B.y=ue,Le=ne.radialLayout(Ge,et,B),Le.y>Z&&(Z=Math.floor(Le.y)),se=Math.floor(Le.x+R.DEFAULT_COMPONENT_SEPERATION)}this.transform(new Y(D.WORLD_CENTER_X-Le.x/2,D.WORLD_CENTER_Y-Le.y/2))},ne.radialLayout=function(C,B,N){var Z=Math.max(this.maxDiagonalInTree(C),R.DEFAULT_RADIAL_SEPARATION);ne.branchRadialLayout(B,null,0,359,0,Z);var ue=Q.calculateBounds(C),se=new ee;se.setDeviceOrgX(ue.getMinX()),se.setDeviceOrgY(ue.getMinY()),se.setWorldOrgX(N.x),se.setWorldOrgY(N.y);for(var Le=0;Le<C.length;Le++){var be=C[Le];be.transform(se)}var Ge=new Y(ue.getMaxX(),ue.getMaxY());return se.inverseTransformPoint(Ge)},ne.branchRadialLayout=function(C,B,N,Z,ue,se){var Le=(Z-N+1)/2;Le<0&&(Le+=180);var be=(Le+N)%360,Ge=be*le.TWO_PI/360,et=Math.cos(Ge),ct=ue*Math.cos(Ge),Ye=ue*Math.sin(Ge);C.setCenter(ct,Ye);var Fe=[];Fe=Fe.concat(C.getEdges());var ze=Fe.length;B!=null&&ze--;for(var Je=0,at=Fe.length,ut,tt=C.getEdgesBetween(B);tt.length>1;){var Tt=tt[0];tt.splice(0,1);var mt=Fe.indexOf(Tt);mt>=0&&Fe.splice(mt,1),at--,ze--}B!=null?ut=(Fe.indexOf(tt[0])+1)%at:ut=0;for(var xt=Math.abs(Z-N)/ze,Ke=ut;Je!=ze;Ke=++Ke%at){var mr=Fe[Ke].getOtherEnd(C);if(mr!=B){var Zt=(N+Je*xt)%360,br=(Zt+xt)%360;ne.branchRadialLayout(mr,C,Zt,br,ue+se,se),Je++}}},ne.maxDiagonalInTree=function(C){for(var B=te.MIN_VALUE,N=0;N<C.length;N++){var Z=C[N],ue=Z.getDiagonal();ue>B&&(B=ue)}return B},ne.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},ne.prototype.groupZeroDegreeMembers=function(){var C=this,B={};this.memberGroups={},this.idToDummyNode={};for(var N=[],Z=this.graphManager.getAllNodes(),ue=0;ue<Z.length;ue++){var se=Z[ue],Le=se.getParent();this.getNodeDegreeWithChildren(se)===0&&(Le.id==null||!this.getToBeTiled(Le))&&N.push(se)}for(var ue=0;ue<N.length;ue++){var se=N[ue],be=se.getParent().id;typeof B[be]=="undefined"&&(B[be]=[]),B[be]=B[be].concat(se)}Object.keys(B).forEach(function(Ge){if(B[Ge].length>1){var et="DummyCompound_"+Ge;C.memberGroups[et]=B[Ge];var ct=B[Ge][0].getParent(),Ye=new V(C.graphManager);Ye.id=et,Ye.paddingLeft=ct.paddingLeft||0,Ye.paddingRight=ct.paddingRight||0,Ye.paddingBottom=ct.paddingBottom||0,Ye.paddingTop=ct.paddingTop||0,C.idToDummyNode[et]=Ye;var Fe=C.getGraphManager().add(C.newGraph(),Ye),ze=ct.getChild();ze.add(Ye);for(var Je=0;Je<B[Ge].length;Je++){var at=B[Ge][Je];ze.remove(at),Fe.add(at)}}})},ne.prototype.clearCompounds=function(){var C={},B={};this.performDFSOnCompounds();for(var N=0;N<this.compoundOrder.length;N++)B[this.compoundOrder[N].id]=this.compoundOrder[N],C[this.compoundOrder[N].id]=[].concat(this.compoundOrder[N].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[N].getChild()),this.compoundOrder[N].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(C,B)},ne.prototype.clearZeroDegreeMembers=function(){var C=this,B=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(N){var Z=C.idToDummyNode[N];B[N]=C.tileNodes(C.memberGroups[N],Z.paddingLeft+Z.paddingRight),Z.rect.width=B[N].width,Z.rect.height=B[N].height})},ne.prototype.repopulateCompounds=function(){for(var C=this.compoundOrder.length-1;C>=0;C--){var B=this.compoundOrder[C],N=B.id,Z=B.paddingLeft,ue=B.paddingTop;this.adjustLocations(this.tiledMemberPack[N],B.rect.x,B.rect.y,Z,ue)}},ne.prototype.repopulateZeroDegreeMembers=function(){var C=this,B=this.tiledZeroDegreePack;Object.keys(B).forEach(function(N){var Z=C.idToDummyNode[N],ue=Z.paddingLeft,se=Z.paddingTop;C.adjustLocations(B[N],Z.rect.x,Z.rect.y,ue,se)})},ne.prototype.getToBeTiled=function(C){var B=C.id;if(this.toBeTiled[B]!=null)return this.toBeTiled[B];var N=C.getChild();if(N==null)return this.toBeTiled[B]=!1,!1;for(var Z=N.getNodes(),ue=0;ue<Z.length;ue++){var se=Z[ue];if(this.getNodeDegree(se)>0)return this.toBeTiled[B]=!1,!1;if(se.getChild()==null){this.toBeTiled[se.id]=!1;continue}if(!this.getToBeTiled(se))return this.toBeTiled[B]=!1,!1}return this.toBeTiled[B]=!0,!0},ne.prototype.getNodeDegree=function(C){for(var B=C.id,N=C.getEdges(),Z=0,ue=0;ue<N.length;ue++){var se=N[ue];se.getSource().id!==se.getTarget().id&&(Z=Z+1)}return Z},ne.prototype.getNodeDegreeWithChildren=function(C){var B=this.getNodeDegree(C);if(C.getChild()==null)return B;for(var N=C.getChild().getNodes(),Z=0;Z<N.length;Z++){var ue=N[Z];B+=this.getNodeDegreeWithChildren(ue)}return B},ne.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},ne.prototype.fillCompexOrderByDFS=function(C){for(var B=0;B<C.length;B++){var N=C[B];N.getChild()!=null&&this.fillCompexOrderByDFS(N.getChild().getNodes()),this.getToBeTiled(N)&&this.compoundOrder.push(N)}},ne.prototype.adjustLocations=function(C,B,N,Z,ue){B+=Z,N+=ue;for(var se=B,Le=0;Le<C.rows.length;Le++){var be=C.rows[Le];B=se;for(var Ge=0,et=0;et<be.length;et++){var ct=be[et];ct.rect.x=B,ct.rect.y=N,B+=ct.rect.width+C.horizontalPadding,ct.rect.height>Ge&&(Ge=ct.rect.height)}N+=Ge+C.verticalPadding}},ne.prototype.tileCompoundMembers=function(C,B){var N=this;this.tiledMemberPack=[],Object.keys(C).forEach(function(Z){var ue=B[Z];N.tiledMemberPack[Z]=N.tileNodes(C[Z],ue.paddingLeft+ue.paddingRight),ue.rect.width=N.tiledMemberPack[Z].width,ue.rect.height=N.tiledMemberPack[Z].height})},ne.prototype.tileNodes=function(C,B){var N=R.TILING_PADDING_VERTICAL,Z=R.TILING_PADDING_HORIZONTAL,ue={rows:[],rowWidth:[],rowHeight:[],width:0,height:B,verticalPadding:N,horizontalPadding:Z};C.sort(function(be,Ge){return be.rect.width*be.rect.height>Ge.rect.width*Ge.rect.height?-1:be.rect.width*be.rect.height<Ge.rect.width*Ge.rect.height?1:0});for(var se=0;se<C.length;se++){var Le=C[se];ue.rows.length==0?this.insertNodeToRow(ue,Le,0,B):this.canAddHorizontal(ue,Le.rect.width,Le.rect.height)?this.insertNodeToRow(ue,Le,this.getShortestRowIndex(ue),B):this.insertNodeToRow(ue,Le,ue.rows.length,B),this.shiftToLastRow(ue)}return ue},ne.prototype.insertNodeToRow=function(C,B,N,Z){var ue=Z;if(N==C.rows.length){var se=[];C.rows.push(se),C.rowWidth.push(ue),C.rowHeight.push(0)}var Le=C.rowWidth[N]+B.rect.width;C.rows[N].length>0&&(Le+=C.horizontalPadding),C.rowWidth[N]=Le,C.width<Le&&(C.width=Le);var be=B.rect.height;N>0&&(be+=C.verticalPadding);var Ge=0;be>C.rowHeight[N]&&(Ge=C.rowHeight[N],C.rowHeight[N]=be,Ge=C.rowHeight[N]-Ge),C.height+=Ge,C.rows[N].push(B)},ne.prototype.getShortestRowIndex=function(C){for(var B=-1,N=Number.MAX_VALUE,Z=0;Z<C.rows.length;Z++)C.rowWidth[Z]<N&&(B=Z,N=C.rowWidth[Z]);return B},ne.prototype.getLongestRowIndex=function(C){for(var B=-1,N=Number.MIN_VALUE,Z=0;Z<C.rows.length;Z++)C.rowWidth[Z]>N&&(B=Z,N=C.rowWidth[Z]);return B},ne.prototype.canAddHorizontal=function(C,B,N){var Z=this.getShortestRowIndex(C);if(Z<0)return!0;var ue=C.rowWidth[Z];if(ue+C.horizontalPadding+B<=C.width)return!0;var se=0;C.rowHeight[Z]<N&&Z>0&&(se=N+C.verticalPadding-C.rowHeight[Z]);var Le;C.width-ue>=B+C.horizontalPadding?Le=(C.height+se)/(ue+B+C.horizontalPadding):Le=(C.height+se)/C.width,se=N+C.verticalPadding;var be;return C.width<B?be=(C.height+se)/B:be=(C.height+se)/C.width,be<1&&(be=1/be),Le<1&&(Le=1/Le),Le<be},ne.prototype.shiftToLastRow=function(C){var B=this.getLongestRowIndex(C),N=C.rowWidth.length-1,Z=C.rows[B],ue=Z[Z.length-1],se=ue.width+C.horizontalPadding;if(C.width-C.rowWidth[N]>se&&B!=N){Z.splice(-1,1),C.rows[N].push(ue),C.rowWidth[B]=C.rowWidth[B]-se,C.rowWidth[N]=C.rowWidth[N]+se,C.width=C.rowWidth[instance.getLongestRowIndex(C)];for(var Le=Number.MIN_VALUE,be=0;be<Z.length;be++)Z[be].height>Le&&(Le=Z[be].height);B>0&&(Le+=C.verticalPadding);var Ge=C.rowHeight[B]+C.rowHeight[N];C.rowHeight[B]=Le,C.rowHeight[N]<ue.height+C.verticalPadding&&(C.rowHeight[N]=ue.height+C.verticalPadding);var et=C.rowHeight[B]+C.rowHeight[N];C.height+=et-Ge,this.shiftToLastRow(C)}},ne.prototype.tilingPreLayout=function(){R.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},ne.prototype.tilingPostLayout=function(){R.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},ne.prototype.reduceTrees=function(){for(var C=[],B=!0,N;B;){var Z=this.graphManager.getAllNodes(),ue=[];B=!1;for(var se=0;se<Z.length;se++)N=Z[se],N.getEdges().length==1&&!N.getEdges()[0].isInterGraph&&N.getChild()==null&&(ue.push([N,N.getEdges()[0],N.getOwner()]),B=!0);if(B==!0){for(var Le=[],be=0;be<ue.length;be++)ue[be][0].getEdges().length==1&&(Le.push(ue[be]),ue[be][0].getOwner().remove(ue[be][0]));C.push(Le),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=C},ne.prototype.growTree=function(C){for(var B=C.length,N=C[B-1],Z,ue=0;ue<N.length;ue++)Z=N[ue],this.findPlaceforPrunedNode(Z),Z[2].add(Z[0]),Z[2].add(Z[1],Z[1].source,Z[1].target);C.splice(C.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},ne.prototype.findPlaceforPrunedNode=function(C){var B,N,Z=C[0];Z==C[1].source?N=C[1].target:N=C[1].source;var ue=N.startX,se=N.finishX,Le=N.startY,be=N.finishY,Ge=0,et=0,ct=0,Ye=0,Fe=[Ge,ct,et,Ye];if(Le>0)for(var ze=ue;ze<=se;ze++)Fe[0]+=this.grid[ze][Le-1].length+this.grid[ze][Le].length-1;if(se<this.grid.length-1)for(var ze=Le;ze<=be;ze++)Fe[1]+=this.grid[se+1][ze].length+this.grid[se][ze].length-1;if(be<this.grid[0].length-1)for(var ze=ue;ze<=se;ze++)Fe[2]+=this.grid[ze][be+1].length+this.grid[ze][be].length-1;if(ue>0)for(var ze=Le;ze<=be;ze++)Fe[3]+=this.grid[ue-1][ze].length+this.grid[ue][ze].length-1;for(var Je=te.MAX_VALUE,at,ut,tt=0;tt<Fe.length;tt++)Fe[tt]<Je?(Je=Fe[tt],at=1,ut=tt):Fe[tt]==Je&&at++;if(at==3&&Je==0)Fe[0]==0&&Fe[1]==0&&Fe[2]==0?B=1:Fe[0]==0&&Fe[1]==0&&Fe[3]==0?B=0:Fe[0]==0&&Fe[2]==0&&Fe[3]==0?B=3:Fe[1]==0&&Fe[2]==0&&Fe[3]==0&&(B=2);else if(at==2&&Je==0){var Tt=Math.floor(Math.random()*2);Fe[0]==0&&Fe[1]==0?Tt==0?B=0:B=1:Fe[0]==0&&Fe[2]==0?Tt==0?B=0:B=2:Fe[0]==0&&Fe[3]==0?Tt==0?B=0:B=3:Fe[1]==0&&Fe[2]==0?Tt==0?B=1:B=2:Fe[1]==0&&Fe[3]==0?Tt==0?B=1:B=3:Tt==0?B=2:B=3}else if(at==4&&Je==0){var Tt=Math.floor(Math.random()*4);B=Tt}else B=ut;B==0?Z.setCenter(N.getCenterX(),N.getCenterY()-N.getHeight()/2-J.DEFAULT_EDGE_LENGTH-Z.getHeight()/2):B==1?Z.setCenter(N.getCenterX()+N.getWidth()/2+J.DEFAULT_EDGE_LENGTH+Z.getWidth()/2,N.getCenterY()):B==2?Z.setCenter(N.getCenterX(),N.getCenterY()+N.getHeight()/2+J.DEFAULT_EDGE_LENGTH+Z.getHeight()/2):Z.setCenter(N.getCenterX()-N.getWidth()/2-J.DEFAULT_EDGE_LENGTH-Z.getWidth()/2,N.getCenterY())},W.exports=ne},function(W,_,L){"use strict";var E={};E.layoutBase=L(0),E.CoSEConstants=L(1),E.CoSEEdge=L(2),E.CoSEGraph=L(3),E.CoSEGraphManager=L(4),E.CoSELayout=L(6),E.CoSENode=L(5),W.exports=E}])})});var tl=ni((ln,as)=>{(function(W,_){typeof ln=="object"&&typeof as=="object"?as.exports=_(rs()):typeof define=="function"&&define.amd?define(["cose-base"],_):typeof ln=="object"?ln.cytoscapeCoseBilkent=_(rs()):W.cytoscapeCoseBilkent=_(W.coseBase)})(ln,function(q){return function(W){var _={};function L(E){if(_[E])return _[E].exports;var w=_[E]={i:E,l:!1,exports:{}};return W[E].call(w.exports,w,w.exports,L),w.l=!0,w.exports}return L.m=W,L.c=_,L.i=function(E){return E},L.d=function(E,w,A){L.o(E,w)||Object.defineProperty(E,w,{configurable:!1,enumerable:!0,get:A})},L.n=function(E){var w=E&&E.__esModule?function(){return E.default}:function(){return E};return L.d(w,"a",w),w},L.o=function(E,w){return Object.prototype.hasOwnProperty.call(E,w)},L.p="",L(L.s=1)}([function(W,_){W.exports=q},function(W,_,L){"use strict";var E=L(0).layoutBase.LayoutConstants,w=L(0).layoutBase.FDLayoutConstants,A=L(0).CoSEConstants,V=L(0).CoSELayout,U=L(0).CoSENode,R=L(0).layoutBase.PointD,J=L(0).layoutBase.DimensionD,D={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function $(le,Q){var ee={};for(var ne in le)ee[ne]=le[ne];for(var ne in Q)ee[ne]=Q[ne];return ee}function Y(le){this.options=$(D,le),j(this.options)}var j=function(Q){Q.nodeRepulsion!=null&&(A.DEFAULT_REPULSION_STRENGTH=w.DEFAULT_REPULSION_STRENGTH=Q.nodeRepulsion),Q.idealEdgeLength!=null&&(A.DEFAULT_EDGE_LENGTH=w.DEFAULT_EDGE_LENGTH=Q.idealEdgeLength),Q.edgeElasticity!=null&&(A.DEFAULT_SPRING_STRENGTH=w.DEFAULT_SPRING_STRENGTH=Q.edgeElasticity),Q.nestingFactor!=null&&(A.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=w.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=Q.nestingFactor),Q.gravity!=null&&(A.DEFAULT_GRAVITY_STRENGTH=w.DEFAULT_GRAVITY_STRENGTH=Q.gravity),Q.numIter!=null&&(A.MAX_ITERATIONS=w.MAX_ITERATIONS=Q.numIter),Q.gravityRange!=null&&(A.DEFAULT_GRAVITY_RANGE_FACTOR=w.DEFAULT_GRAVITY_RANGE_FACTOR=Q.gravityRange),Q.gravityCompound!=null&&(A.DEFAULT_COMPOUND_GRAVITY_STRENGTH=w.DEFAULT_COMPOUND_GRAVITY_STRENGTH=Q.gravityCompound),Q.gravityRangeCompound!=null&&(A.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=w.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=Q.gravityRangeCompound),Q.initialEnergyOnIncremental!=null&&(A.DEFAULT_COOLING_FACTOR_INCREMENTAL=w.DEFAULT_COOLING_FACTOR_INCREMENTAL=Q.initialEnergyOnIncremental),Q.quality=="draft"?E.QUALITY=0:Q.quality=="proof"?E.QUALITY=2:E.QUALITY=1,A.NODE_DIMENSIONS_INCLUDE_LABELS=w.NODE_DIMENSIONS_INCLUDE_LABELS=E.NODE_DIMENSIONS_INCLUDE_LABELS=Q.nodeDimensionsIncludeLabels,A.DEFAULT_INCREMENTAL=w.DEFAULT_INCREMENTAL=E.DEFAULT_INCREMENTAL=!Q.randomize,A.ANIMATE=w.ANIMATE=E.ANIMATE=Q.animate,A.TILE=Q.tile,A.TILING_PADDING_VERTICAL=typeof Q.tilingPaddingVertical=="function"?Q.tilingPaddingVertical.call():Q.tilingPaddingVertical,A.TILING_PADDING_HORIZONTAL=typeof Q.tilingPaddingHorizontal=="function"?Q.tilingPaddingHorizontal.call():Q.tilingPaddingHorizontal};Y.prototype.run=function(){var le,Q,ee=this.options,ne=this.idToLNode={},me=this.layout=new V,C=this;C.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var B=me.newGraphManager();this.gm=B;var N=this.options.eles.nodes(),Z=this.options.eles.edges();this.root=B.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(N),me);for(var ue=0;ue<Z.length;ue++){var se=Z[ue],Le=this.idToLNode[se.data("source")],be=this.idToLNode[se.data("target")];if(Le!==be&&Le.getEdgesBetween(be).length==0){var Ge=B.add(me.newEdge(),Le,be);Ge.id=se.id()}}var et=function(Fe,ze){typeof Fe=="number"&&(Fe=ze);var Je=Fe.data("id"),at=C.idToLNode[Je];return{x:at.getRect().getCenterX(),y:at.getRect().getCenterY()}},ct=function Ye(){for(var Fe=function(){ee.fit&&ee.cy.fit(ee.eles,ee.padding),le||(le=!0,C.cy.one("layoutready",ee.ready),C.cy.trigger({type:"layoutready",layout:C}))},ze=C.options.refresh,Je,at=0;at<ze&&!Je;at++)Je=C.stopped||C.layout.tick();if(Je){me.checkLayoutSuccess()&&!me.isSubLayout&&me.doPostLayout(),me.tilingPostLayout&&me.tilingPostLayout(),me.isLayoutFinished=!0,C.options.eles.nodes().positions(et),Fe(),C.cy.one("layoutstop",C.options.stop),C.cy.trigger({type:"layoutstop",layout:C}),Q&&cancelAnimationFrame(Q),le=!1;return}var ut=C.layout.getPositionsData();ee.eles.nodes().positions(function(tt,Tt){if(typeof tt=="number"&&(tt=Tt),!tt.isParent()){for(var mt=tt.id(),xt=ut[mt],Ke=tt;xt==null&&(xt=ut[Ke.data("parent")]||ut["DummyCompound_"+Ke.data("parent")],ut[mt]=xt,Ke=Ke.parent()[0],Ke!=null););return xt!=null?{x:xt.x,y:xt.y}:{x:tt.position("x"),y:tt.position("y")}}}),Fe(),Q=requestAnimationFrame(Ye)};return me.addListener("layoutstarted",function(){C.options.animate==="during"&&(Q=requestAnimationFrame(ct))}),me.runLayout(),this.options.animate!=="during"&&(C.options.eles.nodes().not(":parent").layoutPositions(C,C.options,et),le=!1),this},Y.prototype.getTopMostNodes=function(le){for(var Q={},ee=0;ee<le.length;ee++)Q[le[ee].id()]=!0;var ne=le.filter(function(me,C){typeof me=="number"&&(me=C);for(var B=me.parent()[0];B!=null;){if(Q[B.id()])return!1;B=B.parent()[0]}return!0});return ne},Y.prototype.processChildrenList=function(le,Q,ee){for(var ne=Q.length,me=0;me<ne;me++){var C=Q[me],B=C.children(),N,Z=C.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(C.outerWidth()!=null&&C.outerHeight()!=null?N=le.add(new U(ee.graphManager,new R(C.position("x")-Z.w/2,C.position("y")-Z.h/2),new J(parseFloat(Z.w),parseFloat(Z.h)))):N=le.add(new U(this.graphManager)),N.id=C.data("id"),N.paddingLeft=parseInt(C.css("padding")),N.paddingTop=parseInt(C.css("padding")),N.paddingRight=parseInt(C.css("padding")),N.paddingBottom=parseInt(C.css("padding")),this.options.nodeDimensionsIncludeLabels&&C.isParent()){var ue=C.boundingBox({includeLabels:!0,includeNodes:!1}).w,se=C.boundingBox({includeLabels:!0,includeNodes:!1}).h,Le=C.css("text-halign");N.labelWidth=ue,N.labelHeight=se,N.labelPos=Le}if(this.idToLNode[C.data("id")]=N,isNaN(N.rect.x)&&(N.rect.x=0),isNaN(N.rect.y)&&(N.rect.y=0),B!=null&&B.length>0){var be;be=ee.getGraphManager().add(ee.newGraph(),N),this.processChildrenList(be,B,ee)}}},Y.prototype.stop=function(){return this.stopped=!0,this};var te=function(Q){Q("layout","cose-bilkent",Y)};typeof cytoscape!="undefined"&&te(cytoscape),W.exports=te}])})});var is=nn(el(),1),rl=nn(tl(),1);var vy=nn(Op(),1),dy=nn(Np(),1),gy=nn(Mp(),1);var ns=function(){var q=function(me,C,B,N){for(B=B||{},N=me.length;N--;B[me[N]]=C);return B},W=[1,4],_=[1,13],L=[1,12],E=[1,15],w=[1,16],A=[1,20],V=[1,19],U=[6,7,8],R=[1,26],J=[1,24],D=[1,25],$=[6,7,11],Y=[1,6,13,15,16,19,22],j=[1,33],te=[1,34],le=[1,6,7,11,13,15,16,19,22],Q={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(C,B,N,Z,ue,se,Le){var be=se.length-1;switch(ue){case 6:case 7:return Z;case 8:Z.getLogger().trace("Stop NL ");break;case 9:Z.getLogger().trace("Stop EOF ");break;case 11:Z.getLogger().trace("Stop NL2 ");break;case 12:Z.getLogger().trace("Stop EOF2 ");break;case 15:Z.getLogger().info("Node: ",se[be].id),Z.addNode(se[be-1].length,se[be].id,se[be].descr,se[be].type);break;case 16:Z.getLogger().trace("Icon: ",se[be]),Z.decorateNode({icon:se[be]});break;case 17:case 21:Z.decorateNode({class:se[be]});break;case 18:Z.getLogger().trace("SPACELIST");break;case 19:Z.getLogger().trace("Node: ",se[be].id),Z.addNode(0,se[be].id,se[be].descr,se[be].type);break;case 20:Z.decorateNode({icon:se[be]});break;case 25:Z.getLogger().trace("node found ..",se[be-2]),this.$={id:se[be-1],descr:se[be-1],type:Z.getType(se[be-2],se[be])};break;case 26:this.$={id:se[be],descr:se[be],type:Z.nodeType.DEFAULT};break;case 27:Z.getLogger().trace("node found ..",se[be-3]),this.$={id:se[be-3],descr:se[be-1],type:Z.getType(se[be-2],se[be])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:W},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:W},{6:_,7:[1,10],9:9,12:11,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},q(U,[2,3]),{1:[2,2]},q(U,[2,4]),q(U,[2,5]),{1:[2,6],6:_,12:21,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},{6:_,9:22,12:11,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},{6:R,7:J,10:23,11:D},q($,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:A,22:V}),q($,[2,18]),q($,[2,19]),q($,[2,20]),q($,[2,21]),q($,[2,23]),q($,[2,24]),q($,[2,26],{19:[1,30]}),{20:[1,31]},{6:R,7:J,10:32,11:D},{1:[2,7],6:_,12:21,13:L,14:14,15:E,16:w,17:17,18:18,19:A,22:V},q(Y,[2,14],{7:j,11:te}),q(le,[2,8]),q(le,[2,9]),q(le,[2,10]),q($,[2,15]),q($,[2,16]),q($,[2,17]),{20:[1,35]},{21:[1,36]},q(Y,[2,13],{7:j,11:te}),q(le,[2,11]),q(le,[2,12]),{21:[1,37]},q($,[2,25]),q($,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(C,B){if(B.recoverable)this.trace(C);else{var N=new Error(C);throw N.hash=B,N}},parse:function(C){var B=this,N=[0],Z=[],ue=[null],se=[],Le=this.table,be="",Ge=0,et=0,ct=2,Ye=1,Fe=se.slice.call(arguments,1),ze=Object.create(this.lexer),Je={yy:{}};for(var at in this.yy)Object.prototype.hasOwnProperty.call(this.yy,at)&&(Je.yy[at]=this.yy[at]);ze.setInput(C,Je.yy),Je.yy.lexer=ze,Je.yy.parser=this,typeof ze.yylloc=="undefined"&&(ze.yylloc={});var ut=ze.yylloc;se.push(ut);var tt=ze.options&&ze.options.ranges;typeof Je.yy.parseError=="function"?this.parseError=Je.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Tt(){var Jt;return Jt=Z.pop()||ze.lex()||Ye,typeof Jt!="number"&&(Jt instanceof Array&&(Z=Jt,Jt=Z.pop()),Jt=B.symbols_[Jt]||Jt),Jt}for(var mt,xt,Ke,mr,Zt={},br,Qt,hn,Kr;;){if(xt=N[N.length-1],this.defaultActions[xt]?Ke=this.defaultActions[xt]:((mt===null||typeof mt=="undefined")&&(mt=Tt()),Ke=Le[xt]&&Le[xt][mt]),typeof Ke=="undefined"||!Ke.length||!Ke[0]){var Zr="";Kr=[];for(br in Le[xt])this.terminals_[br]&&br>ct&&Kr.push("'"+this.terminals_[br]+"'");ze.showPosition?Zr="Parse error on line "+(Ge+1)+`:
`+ze.showPosition()+`
Expecting `+Kr.join(", ")+", got '"+(this.terminals_[mt]||mt)+"'":Zr="Parse error on line "+(Ge+1)+": Unexpected "+(mt==Ye?"end of input":"'"+(this.terminals_[mt]||mt)+"'"),this.parseError(Zr,{text:ze.match,token:this.terminals_[mt]||mt,line:ze.yylineno,loc:ut,expected:Kr})}if(Ke[0]instanceof Array&&Ke.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+mt);switch(Ke[0]){case 1:N.push(mt),ue.push(ze.yytext),se.push(ze.yylloc),N.push(Ke[1]),mt=null,et=ze.yyleng,be=ze.yytext,Ge=ze.yylineno,ut=ze.yylloc;break;case 2:if(Qt=this.productions_[Ke[1]][1],Zt.$=ue[ue.length-Qt],Zt._$={first_line:se[se.length-(Qt||1)].first_line,last_line:se[se.length-1].last_line,first_column:se[se.length-(Qt||1)].first_column,last_column:se[se.length-1].last_column},tt&&(Zt._$.range=[se[se.length-(Qt||1)].range[0],se[se.length-1].range[1]]),mr=this.performAction.apply(Zt,[be,et,Ge,Je.yy,Ke[1],ue,se].concat(Fe)),typeof mr!="undefined")return mr;Qt&&(N=N.slice(0,-1*Qt*2),ue=ue.slice(0,-1*Qt),se=se.slice(0,-1*Qt)),N.push(this.productions_[Ke[1]][0]),ue.push(Zt.$),se.push(Zt._$),hn=Le[N[N.length-2]][N[N.length-1]],N.push(hn);break;case 3:return!0}}return!0}},ee=function(){var me={EOF:1,parseError:function(B,N){if(this.yy.parser)this.yy.parser.parseError(B,N);else throw new Error(B)},setInput:function(C,B){return this.yy=B||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var B=C.match(/(?:\r\n?|\n).*/g);return B?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},unput:function(C){var B=C.length,N=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-B),this.offset-=B;var Z=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),N.length-1&&(this.yylineno-=N.length-1);var ue=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:N?(N.length===Z.length?this.yylloc.first_column:0)+Z[Z.length-N.length].length-N[0].length:this.yylloc.first_column-B},this.options.ranges&&(this.yylloc.range=[ue[0],ue[0]+this.yyleng-B]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(C){this.unput(this.match.slice(C))},pastInput:function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var C=this.pastInput(),B=new Array(C.length+1).join("-");return C+this.upcomingInput()+`
`+B+"^"},test_match:function(C,B){var N,Z,ue;if(this.options.backtrack_lexer&&(ue={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(ue.yylloc.range=this.yylloc.range.slice(0))),Z=C[0].match(/(?:\r\n?|\n).*/g),Z&&(this.yylineno+=Z.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:Z?Z[Z.length-1].length-Z[Z.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],N=this.performAction.call(this,this.yy,this,B,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),N)return N;if(this._backtrack){for(var se in ue)this[se]=ue[se];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,B,N,Z;this._more||(this.yytext="",this.match="");for(var ue=this._currentRules(),se=0;se<ue.length;se++)if(N=this._input.match(this.rules[ue[se]]),N&&(!B||N[0].length>B[0].length)){if(B=N,Z=se,this.options.backtrack_lexer){if(C=this.test_match(N,ue[se]),C!==!1)return C;if(this._backtrack){B=!1;continue}else return!1}else if(!this.options.flex)break}return B?(C=this.test_match(B,ue[Z]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var B=this.next();return B||this.lex()},begin:function(B){this.conditionStack.push(B)},popState:function(){var B=this.conditionStack.length-1;return B>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(B){return B=this.conditionStack.length-1-Math.abs(B||0),B>=0?this.conditionStack[B]:"INITIAL"},pushState:function(B){this.begin(B)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(B,N,Z,ue){switch(Z){case 0:return B.getLogger().trace("Found comment",N.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:B.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return B.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:B.getLogger().trace("end icon"),this.popState();break;case 10:return B.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return B.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return B.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return B.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:B.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return B.getLogger().trace("description:",N.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),B.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),B.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),B.getLogger().trace("node end ...",N.yytext),"NODE_DEND";case 30:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),B.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),B.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),B.getLogger().trace("node end (("),"NODE_DEND";case 35:return B.getLogger().trace("Long description:",N.yytext),20;case 36:return B.getLogger().trace("Long description:",N.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return me}();Q.lexer=ee;function ne(){this.yy={}}return ne.prototype=Q,Q.Parser=ne,new ne}();ns.parser=ns;var Ip=ns,fn=q=>Ju(q,Da()),Kt=[],al=0,ss={},Rp=()=>{Kt=[],al=0,ss={}},kp=function(q){for(let W=Kt.length-1;W>=0;W--)if(Kt[W].level<q)return Kt[W];return null},Pp=()=>Kt.length>0?Kt[0]:null,Bp=(q,W,_,L)=>{Rr.info("addNode",q,W,_,L);let E=Da(),w={id:al++,nodeId:fn(W),level:q,descr:fn(_),type:L,children:[],width:Da().mindmap.maxNodeWidth};switch(w.type){case dt.ROUNDED_RECT:w.padding=2*E.mindmap.padding;break;case dt.RECT:w.padding=2*E.mindmap.padding;break;case dt.HEXAGON:w.padding=2*E.mindmap.padding;break;default:w.padding=E.mindmap.padding}let A=kp(q);if(A)A.children.push(w),Kt.push(w);else if(Kt.length===0)Kt.push(w);else{let V=new Error('There can be only one root. No parent could be found for ("'+w.descr+'")');throw V.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},V}},dt={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Fp=(q,W)=>{switch(Rr.debug("In get type",q,W),q){case"[":return dt.RECT;case"(":return W===")"?dt.ROUNDED_RECT:dt.CLOUD;case"((":return dt.CIRCLE;case")":return dt.CLOUD;case"))":return dt.BANG;case"{{":return dt.HEXAGON;default:return dt.DEFAULT}},nl=(q,W)=>{ss[q]=W},zp=q=>{let W=Kt[Kt.length-1];q&&q.icon&&(W.icon=fn(q.icon)),q&&q.class&&(W.class=fn(q.class))},Wr=q=>{switch(q){case dt.DEFAULT:return"no-border";case dt.RECT:return"rect";case dt.ROUNDED_RECT:return"rounded-rect";case dt.CIRCLE:return"circle";case dt.CLOUD:return"cloud";case dt.BANG:return"bang";case dt.HEXAGON:return"hexgon";default:return"no-border"}},il,Gp=q=>{il=q},Vp=()=>Rr,$p=q=>Kt[q],os=q=>ss[q],_p=Object.freeze(Object.defineProperty({__proto__:null,addNode:Bp,clear:Rp,decorateNode:zp,getElementById:os,getLogger:Vp,getMindmap:Pp,getNodeById:$p,getType:Fp,nodeType:dt,get parseError(){return il},sanitizeText:fn,setElementForId:nl,setErrorHandler:Gp,type2Str:Wr},Symbol.toStringTag,{value:"Module"})),sl=12,Up=function(q,W,_){q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 ${W.height-5} v${-W.height+2*5} q0,-5 5,-5 h${W.width-2*5} q5,0 5,5 v${W.height-5} H0 Z`),q.append("line").attr("class","node-line-"+_).attr("x1",0).attr("y1",W.height).attr("x2",W.width).attr("y2",W.height)},Yp=function(q,W){q.append("rect").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("height",W.height).attr("width",W.width)},Hp=function(q,W){let _=W.width,L=W.height,E=.15*_,w=.25*_,A=.35*_,V=.2*_;q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 0 a${E},${E} 0 0,1 ${_*.25},${-1*_*.1}
a${A},${A} 1 0,1 ${_*.4},${-1*_*.1}
a${w},${w} 1 0,1 ${_*.35},${1*_*.2}
a${E},${E} 1 0,1 ${_*.15},${1*L*.35}
a${V},${V} 1 0,1 ${-1*_*.15},${1*L*.65}
a${w},${E} 1 0,1 ${-1*_*.25},${_*.15}
a${A},${A} 1 0,1 ${-1*_*.5},0
a${E},${E} 1 0,1 ${-1*_*.25},${-1*_*.15}
a${E},${E} 1 0,1 ${-1*_*.1},${-1*L*.35}
a${V},${V} 1 0,1 ${_*.1},${-1*L*.65}
H0 V0 Z`)},Xp=function(q,W){let _=W.width,L=W.height,E=.15*_;q.append("path").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("d",`M0 0 a${E},${E} 1 0,0 ${_*.25},${-1*L*.1}
a${E},${E} 1 0,0 ${_*.25},0
a${E},${E} 1 0,0 ${_*.25},0
a${E},${E} 1 0,0 ${_*.25},${1*L*.1}
a${E},${E} 1 0,0 ${_*.15},${1*L*.33}
a${E*.8},${E*.8} 1 0,0 0,${1*L*.34}
a${E},${E} 1 0,0 ${-1*_*.15},${1*L*.33}
a${E},${E} 1 0,0 ${-1*_*.25},${L*.15}
a${E},${E} 1 0,0 ${-1*_*.25},0
a${E},${E} 1 0,0 ${-1*_*.25},0
a${E},${E} 1 0,0 ${-1*_*.25},${-1*L*.15}
a${E},${E} 1 0,0 ${-1*_*.1},${-1*L*.33}
a${E*.8},${E*.8} 1 0,0 0,${-1*L*.34}
a${E},${E} 1 0,0 ${_*.1},${-1*L*.33}
H0 V0 Z`)},qp=function(q,W){q.append("circle").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("r",W.width/2)};function Wp(q,W,_,L,E){return q.insert("polygon",":first-child").attr("points",L.map(function(w){return w.x+","+w.y}).join(" ")).attr("transform","translate("+(E.width-W)/2+", "+_+")")}var Kp=function(q,W){let _=W.height,E=_/4,w=W.width-W.padding+2*E,A=[{x:E,y:0},{x:w-E,y:0},{x:w,y:-_/2},{x:w-E,y:-_},{x:E,y:-_},{x:0,y:-_/2}];Wp(q,w,_,A,W)},Zp=function(q,W){q.append("rect").attr("id","node-"+W.id).attr("class","node-bkg node-"+Wr(W.type)).attr("height",W.height).attr("rx",W.padding).attr("ry",W.padding).attr("width",W.width)},Qp=function(q,W,_,L){let E=L.htmlLabels,w=_%(sl-1),A=q.append("g");W.section=w;let V="section-"+w;w<0&&(V+=" section-root"),A.attr("class",(W.class?W.class+" ":"")+"mindmap-node "+V);let U=A.append("g"),R=A.append("g"),J=W.descr.replace(/(<br\/*>)/g,`
`);Qu(R,J,{useHtmlLabels:E,width:W.width,classes:"mindmap-node-label"}),E||R.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let D=R.node().getBBox(),$=L.fontSize.replace?L.fontSize.replace("px",""):L.fontSize;if(W.height=D.height+$*1.1*.5+W.padding,W.width=D.width+2*W.padding,W.icon)if(W.type===dt.CIRCLE)W.height+=50,W.width+=50,A.append("foreignObject").attr("height","50px").attr("width",W.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+w+" "+W.icon),R.attr("transform","translate("+W.width/2+", "+(W.height/2-1.5*W.padding)+")");else{W.width+=50;let Y=W.height;W.height=Math.max(Y,60);let j=Math.abs(W.height-Y);A.append("foreignObject").attr("width","60px").attr("height",W.height).attr("style","text-align: center;margin-top:"+j/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+w+" "+W.icon),R.attr("transform","translate("+(25+W.width/2)+", "+(j/2+W.padding/2)+")")}else if(E){let Y=(W.width-D.width)/2,j=(W.height-D.height)/2;R.attr("transform","translate("+Y+", "+j+")")}else{let Y=W.width/2,j=W.padding/2;R.attr("transform","translate("+Y+", "+j+")")}switch(W.type){case dt.DEFAULT:Up(U,W,w);break;case dt.ROUNDED_RECT:Zp(U,W);break;case dt.RECT:Yp(U,W);break;case dt.CIRCLE:U.attr("transform","translate("+W.width/2+", "+ +W.height/2+")"),qp(U,W);break;case dt.CLOUD:Hp(U,W);break;case dt.BANG:Xp(U,W);break;case dt.HEXAGON:Kp(U,W);break}return nl(W.id,A),W.height},Jp=function(W,_,L,E,w){let A=w%(sl-1),V=L.x+L.width/2,U=L.y+L.height/2,R=_.x+_.width/2,J=_.y+_.height/2,D=R>V?V+Math.abs(V-R)/2:V-Math.abs(V-R)/2,$=J>U?U+Math.abs(U-J)/2:U-Math.abs(U-J)/2,Y=R>V?Math.abs(V-D)/2+V:-Math.abs(V-D)/2+V,j=J>U?Math.abs(U-$)/2+U:-Math.abs(U-$)/2+U;W.append("path").attr("d",L.direction==="TB"||L.direction==="BT"?`M${V},${U} Q${V},${j} ${D},${$} T${R},${J}`:`M${V},${U} Q${Y},${U} ${D},${$} T${R},${J}`).attr("class","edge section-edge-"+A+" edge-depth-"+E)},jp=function(q){let W=os(q.id),_=q.x||0,L=q.y||0;W.attr("transform","translate("+_+","+L+")")},ol={drawNode:Qp,positionNode:jp,drawEdge:Jp};is.default.use(rl.default);function ul(q,W,_,L){ol.drawNode(q,W,_,L),W.children&&W.children.forEach((E,w)=>{ul(q,E,_<0?w:_,L)})}function ey(q,W){W.edges().map((_,L)=>{let E=_.data();if(_[0]._private.bodyBounds){let w=_[0]._private.rscratch;Rr.trace("Edge: ",L,E),q.insert("path").attr("d",`M ${w.startX},${w.startY} L ${w.midX},${w.midY} L${w.endX},${w.endY} `).attr("class","edge section-edge-"+E.section+" edge-depth-"+E.depth)}})}function ll(q,W,_,L){W.add({group:"nodes",data:{id:q.id,labelText:q.descr,height:q.height,width:q.width,level:L,nodeId:q.id,padding:q.padding,type:q.type},position:{x:q.x,y:q.y}}),q.children&&q.children.forEach(E=>{ll(E,W,_,L+1),W.add({group:"edges",data:{id:`${q.id}_${E.id}`,source:q.id,target:E.id,depth:L,section:E.section}})})}function ty(q,W){return new Promise(_=>{let L=sn("body").append("div").attr("id","cy").attr("style","display:none"),E=(0,is.default)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});L.remove(),ll(q,E,W,0),E.nodes().forEach(function(w){w.layoutDimensions=()=>{let A=w.data();return{w:A.width,h:A.height}}}),E.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),E.ready(w=>{Rr.info("Ready",w),_(E)})})}function ry(q){q.nodes().map((W,_)=>{let L=W.data();L.x=W.position().x,L.y=W.position().y,ol.positionNode(L);let E=os(L.nodeId);Rr.info("Id:",_,"Position: (",W.position().x,", ",W.position().y,")",L),E.attr("transform",`translate(${W.position().x-L.width/2}, ${W.position().y-L.height/2})`),E.attr("attr",`apa-${_})`)})}var ay=async(q,W,_,L)=>{let E=Da();E.htmlLabels=!1,Rr.debug(`Rendering mindmap diagram
`+q,L.parser);let w=Da().securityLevel,A;w==="sandbox"&&(A=sn("#i"+W));let U=(w==="sandbox"?sn(A.nodes()[0].contentDocument.body):sn("body")).select("#"+W);U.append("g");let R=L.db.getMindmap(),J=U.append("g");J.attr("class","mindmap-edges");let D=U.append("g");D.attr("class","mindmap-nodes"),ul(D,R,-1,E);let $=await ty(R,E);ey(J,$),ry($),ju(void 0,U,E.mindmap.padding,E.mindmap.useMaxWidth)},ny={draw:ay},iy=q=>{let W="";for(let _=0;_<q.THEME_COLOR_LIMIT;_++)q["lineColor"+_]=q["lineColor"+_]||q["cScaleInv"+_],Wu(q["lineColor"+_])?q["lineColor"+_]=Ku(q["lineColor"+_],20):q["lineColor"+_]=Zu(q["lineColor"+_],20);for(let _=0;_<q.THEME_COLOR_LIMIT;_++){let L=""+(17-3*_);W+=`
.section-${_-1} rect, .section-${_-1} path, .section-${_-1} circle, .section-${_-1} polygon, .section-${_-1} path {
fill: ${q["cScale"+_]};
}
.section-${_-1} text {
fill: ${q["cScaleLabel"+_]};
}
.node-icon-${_-1} {
font-size: 40px;
color: ${q["cScaleLabel"+_]};
}
.section-edge-${_-1}{
stroke: ${q["cScale"+_]};
}
.edge-depth-${_-1}{
stroke-width: ${L};
}
.section-${_-1} line {
stroke: ${q["cScaleInv"+_]} ;
stroke-width: 3;
}
.disabled, .disabled circle, .disabled text {
fill: lightgray;
}
.disabled text {
fill: #efefef;
}
`}return W},sy=q=>`
.edge {
stroke-width: 3;
}
${iy(q)}
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
fill: ${q.git0};
}
.section-root text {
fill: ${q.gitBranchLabel0};
}
.icon-container {
height:100%;
display: flex;
justify-content: center;
align-items: center;
}
.edge {
fill: none;
}
.mindmap-node-label {
dy: 1em;
alignment-baseline: middle;
text-anchor: middle;
dominant-baseline: middle;
text-align: center;
}
`,oy=sy,py={db:_p,renderer:ny,parser:Ip,styles:oy};export{py as diagram};
/*! Bundled license information:
cytoscape/dist/cytoscape.umd.js:
(*!
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)
*)
(*!
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
*)
(*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
(*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
*/