165-06872da1.chunk.min.js 361 KB

12
  1. /*! For license information please see 165-06872da1.chunk.min.js.LICENSE.txt */
  2. "use strict";(self.webpackChunkgeekdoc=self.webpackChunkgeekdoc||[]).push([[165],{165:(e,t,n)=>{function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,i=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);o=!0);}catch(e){s=!0,a=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw a}}return i}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=u(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}n.d(t,{A:()=>ju});var h="undefined"==typeof window?null:window,p=h?h.navigator:null;h&&h.document;var f=r(""),g=r({}),v=r((function(){})),y="undefined"==typeof HTMLElement?"undefined":r(HTMLElement),m=function(e){return e&&e.instanceString&&x(e.instanceString)?e.instanceString():null},b=function(e){return null!=e&&r(e)==f},x=function(e){return null!=e&&r(e)===v},w=function(e){return!S(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},E=function(e){return null!=e&&r(e)===g&&!w(e)&&e.constructor===Object},k=function(e){return null!=e&&r(e)===r(1)&&!isNaN(e)},C=function(e){return"undefined"===y?void 0:null!=e&&e instanceof HTMLElement},S=function(e){return P(e)||D(e)},P=function(e){return"collection"===m(e)&&e._private.single},D=function(e){return"collection"===m(e)&&!e._private.single},T=function(e){return"core"===m(e)},_=function(e){return"stylesheet"===m(e)},M=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},B=function(e){return function(e){return null!=e&&r(e)===g}(e)&&x(e.then)},N=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,a=arguments,i=t.apply(this,a),o=n.cache;return(r=o[i])||(r=o[i]=e.apply(this,a)),r};return n.cache={},n},I=N((function(e){return e.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()}))})),z=N((function(e){return e.replace(/(-\w)/g,(function(e){return e[1].toUpperCase()}))})),A=N((function(e,t){return e+t[0].toUpperCase()+t.substring(1)}),(function(e,t){return e+"$"+t})),L=function(e){return M(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},O="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",R="rgb[a]?\\(("+O+"[%]?)\\s*,\\s*("+O+"[%]?)\\s*,\\s*("+O+"[%]?)(?:\\s*,\\s*("+O+"))?\\)",V="rgb[a]?\\((?:"+O+"[%]?)\\s*,\\s*(?:"+O+"[%]?)\\s*,\\s*(?:"+O+"[%]?)(?:\\s*,\\s*(?:"+O+"))?\\)",F="hsl[a]?\\(("+O+")\\s*,\\s*("+O+"[%])\\s*,\\s*("+O+"[%])(?:\\s*,\\s*("+O+"))?\\)",j="hsl[a]?\\((?:"+O+")\\s*,\\s*(?:"+O+"[%])\\s*,\\s*(?:"+O+"[%])(?:\\s*,\\s*(?:"+O+"))?\\)",q=function(e,t){return e<t?-1:e>t?1:0},Y=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(null!=r)for(var a=Object.keys(r),i=0;i<a.length;i++){var o=a[i];e[o]=r[o]}}return e},X={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]},W=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(E(i))throw Error("Tried to set map with object key");a<n.length-1?(null==t[i]&&(t[i]={}),t=t[i]):t[i]=e.value}},H=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a<r;a++){var i=n[a];if(E(i))throw Error("Tried to get map with object key");if(null==(t=t[i]))return t}return t},K=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)},G="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},U="object"==typeof G&&G&&G.Object===Object&&G,Z="object"==typeof self&&self&&self.Object===Object&&self,$=U||Z||Function("return this")(),Q=function(){return $.Date.now()},J=/\s/,ee=/^\s+/,te=function(e){return e?e.slice(0,function(e){for(var t=e.length;t--&&J.test(e.charAt(t)););return t}(e)+1).replace(ee,""):e},ne=$.Symbol,re=Object.prototype,ae=re.hasOwnProperty,ie=re.toString,oe=ne?ne.toStringTag:void 0,se=Object.prototype.toString,le=ne?ne.toStringTag:void 0,ue=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":le&&le in Object(e)?function(e){var t=ae.call(e,oe),n=e[oe];try{e[oe]=void 0;var r=!0}catch(e){}var a=ie.call(e);return r&&(t?e[oe]=n:delete e[oe]),a}(e):function(e){return se.call(e)}(e)},ce=function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==ue(e)},de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,pe=/^0o[0-7]+$/i,fe=parseInt,ge=function(e){if("number"==typeof e)return e;if(ce(e))return NaN;if(K(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=K(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=te(e);var n=he.test(e);return n||pe.test(e)?fe(e.slice(2),n?2:8):de.test(e)?NaN:+e},ve=Math.max,ye=Math.min,me=function(e,t,n){var r,a,i,o,s,l,u=0,c=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function p(t){var n=r,i=a;return r=a=void 0,u=t,o=e.apply(i,n)}function f(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-u>=i}function g(){var e=Q();if(f(e))return v(e);s=setTimeout(g,function(e){var n=t-(e-l);return d?ye(n,i-(e-u)):n}(e))}function v(e){return s=void 0,h&&r?p(e):(r=a=void 0,o)}function y(){var e=Q(),n=f(e);if(r=arguments,a=this,l=e,n){if(void 0===s)return function(e){return u=e,s=setTimeout(g,t),c?p(e):o}(l);if(d)return clearTimeout(s),s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),o}return t=ge(t)||0,K(n)&&(c=!!n.leading,i=(d="maxWait"in n)?ve(ge(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=a=s=void 0},y.flush=function(){return void 0===s?o:v(Q())},y},be=h?h.performance:null,xe=be&&be.now?function(){return be.now()}:function(){return Date.now()},we=function(){if(h){if(h.requestAnimationFrame)return function(e){h.requestAnimationFrame(e)};if(h.mozRequestAnimationFrame)return function(e){h.mozRequestAnimationFrame(e)};if(h.webkitRequestAnimationFrame)return function(e){h.webkitRequestAnimationFrame(e)};if(h.msRequestAnimationFrame)return function(e){h.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(xe())}),1e3/60)}}(),Ee=function(e){return we(e)},ke=xe,Ce=9261,Se=5381,Pe=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ce;!(t=e.next()).done;)n=65599*n+t.value|0;return n},De=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ce)+e|0},Te=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Se;return(t<<5)+t+e|0},_e=function(e){return 2097152*e[0]+e[1]},Me=function(e,t){return[De(e[0],t[0]),Te(e[1],t[1])]},Be=function(e,t){var n={value:0,done:!1},r=0,a=e.length;return Pe({next:function(){return r<a?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},Ne=function(){return Ie(arguments)},Ie=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?Be(r):Be(r,t)}return t},ze=!0,Ae=null!=console.warn,Le=null!=console.trace,Oe=Number.MAX_SAFE_INTEGER||9007199254740991,Re=function(){return!0},Ve=function(){return!1},Fe=function(){return 0},je=function(){},qe=function(e){throw new Error(e)},Ye=function(e){if(void 0===e)return ze;ze=!!e},Xe=function(e){Ye()&&(Ae?console.warn(e):(console.log(e),Le&&console.trace()))},We=function(e){return null==e?e:w(e)?e.slice():E(e)?function(e){return Y({},e)}(e):e},He=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Ke={},Ge=function(){return Ke},Ue=function(e){var t=Object.keys(e);return function(n){for(var r={},a=0;a<t.length;a++){var i=t[a],o=null==n?void 0:n[i];r[i]=void 0===o?e[i]:o}return r}},Ze=function(e,t,n){for(var r=e.length-1;r>=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},$e=function(e){e.splice(0,e.length)},Qe=function(e,t,n){return n&&(t=A(n,t)),e[t]},Je=function(e,t,n,r){n&&(t=A(n,t)),e[t]=r},et="undefined"!=typeof Map?Map:function(){function e(){a(this,e),this._obj={}}return o(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),tt=function(){function e(t){if(a(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r<n.length;r++)this.add(n[r])}}return o(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter((function(t){return e.has(t)}))}},{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),e}(),nt="undefined"!==("undefined"==typeof Set?"undefined":r(Set))?Set:tt,rt=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&T(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new nt,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var i=t.renderedPosition,o=e.pan(),s=e.zoom();a.position={x:(i.x-o.x)/s,y:(i.y-o.y)/s}}var l=[];w(t.classes)?l=t.classes:b(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var d=l[u];d&&""!==d&&a.classes.add(d)}this.createEmitter();var h=t.style||t.css;h&&(Xe("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(h)),(void 0===n||n)&&this.restore()}else qe("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else qe("An element must have a core reference and parameters set")},at=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var a;E(t)&&!S(t)&&(t=(a=t).roots||a.root,n=a.visit,r=a.directed),r=2!==arguments.length||x(n)?r:n,n=x(n)?n:function(){};for(var i,o=this._private.cy,s=t=b(t)?this.filter(t):t,l=[],u=[],c={},d={},h={},p=0,f=this.byGroup(),g=f.nodes,v=f.edges,y=0;y<s.length;y++){var m=s[y],w=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(h[w]=!0,u.push(m)),d[w]=0)}for(var k=function(){var t=e.bfs?l.shift():l.pop(),a=t.id();if(e.dfs){if(h[a])return"continue";h[a]=!0,u.push(t)}var o,s=d[a],f=c[a],y=null!=f?f.source():null,m=null!=f?f.target():null,b=null==f?void 0:t.same(y)?m[0]:y[0];if(!0===(o=n(t,f,b,p++,s)))return i=t,"break";if(!1===o)return"break";for(var x=t.connectedEdges().filter((function(e){return(!r||e.source().same(t))&&v.has(e)})),w=0;w<x.length;w++){var E=x[w],k=E.connectedNodes().filter((function(e){return!e.same(t)&&g.has(e)})),C=k.id();0===k.length||h[C]||(k=k[0],l.push(k),e.bfs&&(h[C]=!0,u.push(k)),c[C]=E,d[C]=d[a]+1)}};0!==l.length;){var C=k();if("continue"!==C&&"break"===C)break}for(var P=o.collection(),D=0;D<u.length;D++){var T=u[D],_=c[T.id()];null!=_&&P.push(_),P.push(T)}return{path:o.collection(P),found:o.collection(i)}}},it={breadthFirstSearch:at({bfs:!0}),depthFirstSearch:at({dfs:!0})};it.bfs=it.breadthFirstSearch,it.dfs=it.depthFirstSearch;var ot,st=(function(e){(function(){var t,n,r,a,i,o,s,l,u,c,d,h,p,f,g;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,a,i,o){var s;if(null==a&&(a=0),null==o&&(o=n),a<0)throw new Error("lo must be non-negative");for(null==i&&(i=e.length);a<i;)o(t,e[s=r((a+i)/2)])<0?i=s:a=s+1;return[].splice.apply(e,[a,a-a].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),f(e,0,e.length-1,r)},i=function(e,t){var r,a;return null==t&&(t=n),r=e.pop(),e.length?(a=e[0],e[0]=r,g(e,0,t)):a=r,a},l=function(e,t,r){var a;return null==r&&(r=n),a=e[0],e[0]=t,g(e,0,r),a},s=function(e,t,r){var a;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(t=(a=[e[0],t])[0],e[0]=a[1],g(e,0,r)),t},a=function(e,t){var a,i,o,s,l,u;for(null==t&&(t=n),l=[],i=0,o=(s=function(){u=[];for(var t=0,n=r(e.length/2);0<=n?t<n:t>n;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;i<o;i++)a=s[i],l.push(g(e,a,t));return l},p=function(e,t,r){var a;if(null==r&&(r=n),-1!==(a=e.indexOf(t)))return f(e,0,a,r),g(e,a,r)},d=function(e,t,r){var i,o,l,u,c;if(null==r&&(r=n),!(o=e.slice(0,t)).length)return o;for(a(o,r),l=0,u=(c=e.slice(t)).length;l<u;l++)i=c[l],s(o,i,r);return o.sort(r).reverse()},h=function(e,t,r){var o,s,l,d,h,p,f,g,v;if(null==r&&(r=n),10*t<=e.length){if(!(l=e.slice(0,t).sort(r)).length)return l;for(s=l[l.length-1],d=0,p=(f=e.slice(t)).length;d<p;d++)r(o=f[d],s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(a(e,r),v=[],h=0,g=c(t,e.length);0<=g?h<g:h>g;0<=g?++h:--h)v.push(i(e,r));return v},f=function(e,t,r,a){var i,o,s;for(null==a&&(a=n),i=e[r];r>t&&a(i,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=i},g=function(e,t,r){var a,i,o,s,l;for(null==r&&(r=n),i=e.length,l=t,o=e[t],a=2*t+1;a<i;)(s=a+1)<i&&!(r(e[a],e[s])<0)&&(a=s),e[t]=e[a],a=2*(t=a)+1;return e[t]=o,f(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=i,e.replace=l,e.pushpop=s,e.heapify=a,e.updateItem=p,e.nlargest=d,e.nsmallest=h,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return i(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return-1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return a(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),e.exports=t}).call(G)}(ot={exports:{}}),ot.exports),lt=st,ut=Ue({root:null,weight:function(e){return 1},directed:!1}),ct={dijkstra:function(e){if(!E(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=ut(e),r=n.root,a=n.weight,i=n.directed,o=this,s=a,l=b(r)?this.filter(r)[0]:r[0],u={},c={},d={},h=this.byGroup(),p=h.nodes,f=h.edges;f.unmergeBy((function(e){return e.isLoop()}));for(var g=function(e){return u[e.id()]},v=function(e,t){u[e.id()]=t,y.updateItem(e)},y=new lt((function(e,t){return g(e)-g(t)})),m=0;m<p.length;m++){var x=p[m];u[x.id()]=x.same(l)?0:1/0,y.push(x)}for(var w=function(e,t){for(var n,r=(i?e.edgesTo(t):e.edgesWith(t)).intersect(f),a=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<a||!n)&&(a=u,n=l)}return{edge:n,dist:a}};y.size()>0;){var k=y.pop(),C=g(k),S=k.id();if(d[S]=C,C!==1/0)for(var P=k.neighborhood().intersect(p),D=0;D<P.length;D++){var T=P[D],_=T.id(),M=w(k,T),B=C+M.dist;B<g(T)&&(v(T,B),c[_]={node:k,edge:M.edge})}}return{distanceTo:function(e){var t=b(e)?p.filter(e)[0]:e[0];return d[t.id()]},pathTo:function(e){var t=b(e)?p.filter(e)[0]:e[0],n=[],r=t,a=r.id();if(t.length>0)for(n.unshift(t);c[a];){var i=c[a];n.unshift(i.edge),n.unshift(i.node),a=(r=i.node).id()}return o.spawn(n)}}}},dt={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,i=new Array(a),o=n,s=function(e){for(var t=0;t<i.length;t++)if(i[t].has(e))return t},l=0;l<a;l++)i[l]=this.spawn(n[l]);for(var u=r.sort((function(t,n){return e(t)-e(n)})),c=0;c<u.length;c++){var d=u[c],h=d.source()[0],p=d.target()[0],f=s(h),g=s(p),v=i[f],y=i[g];f!==g&&(o.merge(d),v.merge(y),i.splice(g,1))}return o}},ht=Ue({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),pt={aStar:function(e){var t=this.cy(),n=ht(e),r=n.root,a=n.goal,i=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],a=t.collection(a)[0];var l,u,c=r.id(),d=a.id(),h={},p={},f={},g=new lt((function(e,t){return p[e.id()]-p[t.id()]})),v=new nt,y={},m={},b=function(e,t){g.push(e),v.add(t)};b(r,c),h[c]=0,p[c]=i(r);for(var x,w=0;g.size()>0;){if(u=(l=g.pop()).id(),v.delete(u),w++,u===d){for(var E=[],k=a,C=d,S=m[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=m[C=k.id()];return{found:!0,distance:h[u],path:this.spawn(E),steps:w}}f[u]=!0;for(var P=l._private.edges,D=0;D<P.length;D++){var T=P[D];if(this.hasElementWithId(T.id())&&(!o||T.data("source")===u)){var _=T.source(),M=T.target(),B=_.id()!==u?_:M,N=B.id();if(this.hasElementWithId(N)&&!f[N]){var I=h[u]+s(T);x=N,v.has(x)?I<h[N]&&(h[N]=I,p[N]=I+i(B),y[N]=l,m[N]=T):(h[N]=I,p[N]=I+i(B),b(B,N),y[N]=l,m[N]=T)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},ft=Ue({weight:function(e){return 1},directed:!1}),gt={floydWarshall:function(e){for(var t=this.cy(),n=ft(e),r=n.weight,a=n.directed,i=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,d=function(e){return s.indexOf(e)},h=function(e){return s[e]},p=new Array(c),f=0;f<c;f++){var g=f%u,v=(f-g)/u;p[f]=v===g?0:1/0}for(var y=new Array(c),m=new Array(c),x=0;x<l.length;x++){var w=l[x],E=w.source()[0],k=w.target()[0];if(E!==k){var C=d(E),S=d(k),P=C*u+S,D=i(w);if(p[P]>D&&(p[P]=D,y[P]=S,m[P]=w),!a){var T=S*u+C;!a&&p[T]>D&&(p[T]=D,y[T]=C,m[T]=w)}}}for(var _=0;_<u;_++)for(var M=0;M<u;M++)for(var B=M*u+_,N=0;N<u;N++){var I=M*u+N,z=_*u+N;p[B]+p[z]<p[I]&&(p[I]=p[B]+p[z],y[I]=y[B])}var A=function(e){return d(function(e){return(b(e)?t.filter(e):e)[0]}(e))},L={distance:function(e,t){var n=A(e),r=A(t);return p[n*u+r]},path:function(e,n){var r=A(e),a=A(n),i=h(r);if(r===a)return i.collection();if(null==y[r*u+a])return t.collection();var o,s=t.collection(),l=r;for(s.merge(i);r!==a;)l=r,r=y[r*u+a],o=m[l*u+r],s.merge(o),s.merge(h(r));return s}};return L}},vt=Ue({weight:function(e){return 1},directed:!1,root:null}),yt={bellmanFord:function(e){var t=this,n=vt(e),r=n.weight,a=n.directed,i=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,d=u.nodes,h=d.length,p=new et,f=!1,g=[];i=l.collection(i)[0],c.unmergeBy((function(e){return e.isLoop()}));for(var v=c.length,y=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},m=function(e){return(b(e)?l.$(e):e)[0]},x=0;x<h;x++){var w=d[x],E=y(w);w.same(i)?E.dist=0:E.dist=1/0,E.pred=null,E.edge=null}for(var k=!1,C=function(e,t,n,r,a,i){var o=r.dist+i;o<a.dist&&!n.same(r.edge)&&(a.dist=o,a.pred=e,a.edge=n,k=!0)},S=1;S<h;S++){k=!1;for(var P=0;P<v;P++){var D=c[P],T=D.source(),_=D.target(),M=o(D),B=y(T),N=y(_);C(T,0,D,B,N,M),a||C(_,0,D,N,B,M)}if(!k)break}if(k)for(var I=[],z=0;z<v;z++){var A=c[z],L=A.source(),O=A.target(),R=o(A),V=y(L).dist,F=y(O).dist;if(V+R<F||!a&&F+R<V){if(f||(Xe("Graph contains a negative weight cycle for Bellman-Ford"),f=!0),!1===e.findNegativeWeightCycles)break;var j=[];V+R<F&&j.push(L),!a&&F+R<V&&j.push(O);for(var q=j.length,Y=0;Y<q;Y++){var X=j[Y],W=[X];W.push(y(X).edge);for(var H=y(X).pred;-1===W.indexOf(H);)W.push(H),W.push(y(H).edge),H=y(H).pred;for(var K=(W=W.slice(W.indexOf(H)))[0].id(),G=0,U=2;U<W.length;U+=2)W[U].id()<K&&(K=W[U].id(),G=U);(W=W.slice(G).concat(W.slice(0,G))).push(W[0]);var Z=W.map((function(e){return e.id()})).join(",");-1===I.indexOf(Z)&&(g.push(s.spawn(W)),I.push(Z))}}}return{distanceTo:function(e){return y(m(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i,r=[],a=m(e);;){if(null==a)return t.spawn();var o=y(a),l=o.edge,u=o.pred;if(r.unshift(a[0]),a.same(n)&&r.length>0)break;null!=l&&r.unshift(l),a=u}return s.spawn(r)},hasNegativeWeightCycle:f,negativeWeightCycles:g}}},mt=Math.sqrt(2),bt=function(e,t,n){0===n.length&&qe("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],a=r[1],i=r[2],o=t[a],s=t[i],l=n,u=l.length-1;u>=0;u--){var c=l[u],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&l.splice(u,1)}for(var p=0;p<l.length;p++){var f=l[p];f[1]===s?(l[p]=f.slice(),l[p][1]=o):f[2]===s&&(l[p]=f.slice(),l[p][2]=o)}for(var g=0;g<t.length;g++)t[g]===s&&(t[g]=o);return l},xt=function(e,t,n,r){for(;n>r;){var a=Math.floor(Math.random()*t.length);t=bt(a,e,t),n--}return t},wt={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var a=n.length,i=r.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),s=Math.floor(a/mt);if(!(a<2)){for(var l=[],u=0;u<i;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var d=1/0,h=[],p=new Array(a),f=new Array(a),g=new Array(a),v=function(e,t){for(var n=0;n<a;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<a;m++)f[m]=m;var b=xt(f,l.slice(),a,s),x=b.slice();v(f,g);var w=xt(f,b,s,2),E=xt(g,x,s,2);w.length<=E.length&&w.length<d?(d=w.length,h=w,v(f,p)):E.length<=w.length&&E.length<d&&(d=E.length,h=E,v(g,p))}for(var k=this.spawn(h.map((function(e){return r[e[0]]}))),C=this.spawn(),S=this.spawn(),P=p[0],D=0;D<p.length;D++){var T=p[D],_=n[D];T===P?C.merge(_):S.merge(_)}var M=function(t){var n=e.spawn();return t.forEach((function(t){n.merge(t),t.connectedEdges().forEach((function(t){e.contains(t)&&!k.contains(t)&&n.merge(t)}))})),n},B=[M(C),M(S)];return{cut:k,components:B,partition1:C,partition2:S}}qe("At least 2 nodes are required for Karger-Stein algorithm")}},Et=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},kt=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Ct=function(e){return{x:e[0],y:e[1]}},St=function(e,t){return Math.atan2(t,e)-Math.PI/2},Pt=Math.log2||function(e){return Math.log(e)/Math.log(2)},Dt=function(e){return e>0?1:e<0?-1:0},Tt=function(e,t){return Math.sqrt(_t(e,t))},_t=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Mt=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},Bt=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Nt=function(e,t,n,r){return{x:Bt(e.x,t.x,n.x,r),y:Bt(e.y,t.y,n.y,r)}},It=function(e,t,n){return Math.max(e,Math.min(n,t))},zt=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&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(null!=e.w&&null!=e.h&&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}}},At=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Lt=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Ot=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Rt=function(e){var t,n,r,a,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===i.length)t=n=r=a=i[0];else if(2===i.length)t=r=i[0],a=n=i[1];else if(4===i.length){var o=l(i,4);t=o[0],n=o[1],r=o[2],a=o[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Vt=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},Ft=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},jt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},qt=function(e,t){return jt(e,t.x1,t.y1)&&jt(e,t.x2,t.y2)},Yt=function(e,t,n,r,a,i,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?ln(a,i):u,d=a/2,h=i/2,p=(c=Math.min(c,d,h))!==d,f=c!==h;if(p){var g=r-h-o;if((s=tn(e,t,n,r,n-d+c-o,g,n+d-c+o,g,!1)).length>0)return s}if(f){var v=n+d+o;if((s=tn(e,t,n,r,v,r-h+c-o,v,r+h-c+o,!1)).length>0)return s}if(p){var y=r+h+o;if((s=tn(e,t,n,r,n-d+c-o,y,n+d-c+o,y,!1)).length>0)return s}if(f){var m=n-d-o;if((s=tn(e,t,n,r,m,r-h+c-o,m,r+h-c+o,!1)).length>0)return s}var b=n-d+c,x=r-h+c;if((l=Jt(e,t,n,r,b,x,c+o)).length>0&&l[0]<=b&&l[1]<=x)return[l[0],l[1]];var w=n+d-c,E=r-h+c;if((l=Jt(e,t,n,r,w,E,c+o)).length>0&&l[0]>=w&&l[1]<=E)return[l[0],l[1]];var k=n+d-c,C=r+h-c;if((l=Jt(e,t,n,r,k,C,c+o)).length>0&&l[0]>=k&&l[1]>=C)return[l[0],l[1]];var S=n-d+c,P=r+h-c;return(l=Jt(e,t,n,r,S,P,c+o)).length>0&&l[0]<=S&&l[1]>=P?[l[0],l[1]]:[]},Xt=function(e,t,n,r,a,i,o){var s=o,l=Math.min(n,a),u=Math.max(n,a),c=Math.min(r,i),d=Math.max(r,i);return l-s<=e&&e<=u+s&&c-s<=t&&t<=d+s},Wt=function(e,t,n,r,a,i,o,s,l){var u=Math.min(n,o,a)-l,c=Math.max(n,o,a)+l,d=Math.min(r,s,i)-l,h=Math.max(r,s,i)+l;return!(e<u||e>c||t<d||t>h)},Ht=function(e,t,n,r,a,i,o,s){var l,u,c,d,h,p,f,g,v,y,m,b,x,w=[];u=9*n*a-3*n*n-3*n*o-6*a*a+3*a*o+9*r*i-3*r*r-3*r*s-6*i*i+3*i*s,c=3*n*n-6*n*a+n*o-n*e+2*a*a+2*a*e-o*e+3*r*r-6*r*i+r*s-r*t+2*i*i+2*i*t-s*t,d=1*n*a-n*n+n*e-a*e+r*i-r*r+r*t-i*t,0===(l=1*n*n-4*n*a+2*n*o+4*a*a-4*a*o+o*o+r*r-4*r*i+2*r*s+4*i*i-4*i*s+s*s)&&(l=1e-5),g=-27*(d/=l)+(u/=l)*(9*(c/=l)-u*u*2),p=(f=(3*c-u*u)/9)*f*f+(g/=54)*g,(h=w)[1]=0,b=u/3,p>0?(y=(y=g+Math.sqrt(p))<0?-Math.pow(-y,1/3):Math.pow(y,1/3),m=(m=g-Math.sqrt(p))<0?-Math.pow(-m,1/3):Math.pow(m,1/3),h[0]=-b+y+m,b+=(y+m)/2,h[4]=h[2]=-b,b=Math.sqrt(3)*(-m+y)/2,h[3]=b,h[5]=-b):(h[5]=h[3]=0,0===p?(x=g<0?-Math.pow(-g,1/3):Math.pow(g,1/3),h[0]=2*x-b,h[4]=h[2]=-(x+b)):(v=(f=-f)*f*f,v=Math.acos(g/Math.sqrt(v)),x=2*Math.sqrt(f),h[0]=-b+x*Math.cos(v/3),h[2]=-b+x*Math.cos((v+2*Math.PI)/3),h[4]=-b+x*Math.cos((v+4*Math.PI)/3)));for(var E=[],k=0;k<6;k+=2)Math.abs(w[k+1])<1e-7&&w[k]>=0&&w[k]<=1&&E.push(w[k]);E.push(1),E.push(0);for(var C,S,P,D=-1,T=0;T<E.length;T++)C=Math.pow(1-E[T],2)*n+2*(1-E[T])*E[T]*a+E[T]*E[T]*o,S=Math.pow(1-E[T],2)*r+2*(1-E[T])*E[T]*i+E[T]*E[T]*s,P=Math.pow(C-e,2)+Math.pow(S-t,2),D>=0?P<D&&(D=P):D=P;return D},Kt=function(e,t,n,r,a,i){var o=[e-n,t-r],s=[a-n,i-r],l=s[0]*s[0]+s[1]*s[1],u=o[0]*o[0]+o[1]*o[1],c=o[0]*s[0]+o[1]*s[1],d=c*c/l;return c<0?u:d>l?(e-a)*(e-a)+(t-i)*(t-i):u-d},Gt=function(e,t,n){for(var r,a,i,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],a=n[2*l+1],l+1<n.length/2?(i=n[2*(l+1)],o=n[2*(l+1)+1]):(i=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&i==e);else{if(!(r>=e&&e>=i||r<=e&&e<=i))continue;(e-r)/(i-r)*(o-a)+a>t&&s++}return s%2!=0},Ut=function(e,t,n,r,a,i,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d,h=Math.cos(-u),p=Math.sin(-u),f=0;f<c.length/2;f++)c[2*f]=i/2*(n[2*f]*h-n[2*f+1]*p),c[2*f+1]=o/2*(n[2*f+1]*h+n[2*f]*p),c[2*f]+=r,c[2*f+1]+=a;if(l>0){var g=$t(c,-l);d=Zt(g)}else d=c;return Gt(e,t,d)},Zt=function(e){for(var t,n,r,a,i,o,s,l,u=new Array(e.length/2),c=0;c<e.length/4;c++){t=e[4*c],n=e[4*c+1],r=e[4*c+2],a=e[4*c+3],c<e.length/4-1?(i=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(i=e[0],o=e[1],s=e[2],l=e[3]);var d=tn(t,n,r,a,i,o,s,l,!0);u[2*c]=d[0],u[2*c+1]=d[1]}return u},$t=function(e,t){for(var n,r,a,i,o=new Array(2*e.length),s=0;s<e.length/2;s++){n=e[2*s],r=e[2*s+1],s<e.length/2-1?(a=e[2*(s+1)],i=e[2*(s+1)+1]):(a=e[0],i=e[1]);var l=i-r,u=-(a-n),c=Math.sqrt(l*l+u*u),d=l/c,h=u/c;o[4*s]=n+d*t,o[4*s+1]=r+h*t,o[4*s+2]=a+d*t,o[4*s+3]=i+h*t}return o},Qt=function(e,t,n,r,a,i,o){return e-=a,t-=i,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},Jt=function(e,t,n,r,a,i,o){var s=[n-e,r-t],l=[e-a,t-i],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),d=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(d<0)return[];var h=(-c+Math.sqrt(d))/(2*u),p=(-c-Math.sqrt(d))/(2*u),f=Math.min(h,p),g=Math.max(h,p),v=[];if(f>=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},en=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},tn=function(e,t,n,r,a,i,o,s,l){var u=e-a,c=n-e,d=o-a,h=t-i,p=r-t,f=s-i,g=d*h-f*u,v=c*h-p*u,y=f*c-d*p;if(0!==y){var m=g/y,b=v/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||l?[e+m*c,t+m*p]:[]}return 0===g||0===v?en(e,n,o)===o?[o,s]:en(e,n,a)===a?[a,i]:en(a,o,n)===n?[n,r]:[]:[]},nn=function(e,t,n,r,a,i,o,s){var l,u,c,d,h,p,f=[],g=new Array(n.length),v=!0;if(null==i&&(v=!1),v){for(var y=0;y<g.length/2;y++)g[2*y]=n[2*y]*i+r,g[2*y+1]=n[2*y+1]*o+a;if(s>0){var m=$t(g,-s);u=Zt(m)}else u=g}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],d=u[2*b+1],b<u.length/2-1?(h=u[2*(b+1)],p=u[2*(b+1)+1]):(h=u[0],p=u[1]),0!==(l=tn(e,t,r,a,c,d,h,p)).length&&f.push(l[0],l[1]);return f},rn=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(r[0]*r[0]+r[1]*r[1]),i=(a-n)/a;return i<0&&(i=1e-5),[t[0]+i*r[0],t[1]+i*r[1]]},an=function(e,t){var n=sn(e,t);return on(n)},on=function(e){for(var t,n,r=e.length/2,a=1/0,i=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);for(var u=2/(o-a),c=2/(s-i),d=0;d<r;d++)t=e[2*d]=e[2*d]*u,n=e[2*d+1]=e[2*d+1]*c,a=Math.min(a,t),o=Math.max(o,t),i=Math.min(i,n),s=Math.max(s,n);if(i<-1)for(var h=0;h<r;h++)n=e[2*h+1]=e[2*h+1]+(-1-i);return e},sn=function(e,t){var n=1/e*2*Math.PI,r=e%2==0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var a,i=new Array(2*e),o=0;o<e;o++)a=o*n+r,i[2*o]=Math.cos(a),i[2*o+1]=Math.sin(-a);return i},ln=function(e,t){return Math.min(e/4,t/4,8)},un=function(e,t){return Math.min(e/10,t/10,8)},cn=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},dn=Ue({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),hn={pageRank:function(e){for(var t=dn(e),n=t.dampingFactor,r=t.precision,a=t.iterations,i=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,d=c*c,h=u.length,p=new Array(d),f=new Array(c),g=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++)p[v*c+y]=0;f[v]=0}for(var m=0;m<h;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),k=l.indexOfId(w),C=i(b);p[k*c+E]+=C,f[E]+=C}}for(var S=1/c+g,P=0;P<c;P++)if(0===f[P])for(var D=0;D<c;D++)p[D*c+P]=S;else for(var T=0;T<c;T++){var _=T*c+P;p[_]=p[_]/f[P]+g}for(var M,B=new Array(c),N=new Array(c),I=0;I<c;I++)B[I]=1;for(var z=0;z<a;z++){for(var A=0;A<c;A++)N[A]=0;for(var L=0;L<c;L++)for(var O=0;O<c;O++){var R=L*c+O;N[L]+=p[R]*B[O]}Mt(N),M=B,B=N,N=M;for(var V=0,F=0;F<c;F++){var j=M[F]-B[F];V+=j*j}if(V<r)break}return{rank:function(e){return e=o.collection(e)[0],B[l.indexOf(e)]}}}},pn=Ue({root:null,weight:function(e){return 1},directed:!1,alpha:0}),fn={degreeCentralityNormalized:function(e){e=pn(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var a={},i={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var d=this.degreeCentrality(e);o<d.indegree&&(o=d.indegree),s<d.outdegree&&(s=d.outdegree),a[c]=d.indegree,i[c]=d.outdegree}return{indegree:function(e){return 0==o?0:(b(e)&&(e=t.filter(e)),a[e.id()]/o)},outdegree:function(e){return 0===s?0:(b(e)&&(e=t.filter(e)),i[e.id()]/s)}}}for(var h={},p=0,f=0;f<r;f++){var g=n[f];e.root=g;var v=this.degreeCentrality(e);p<v.degree&&(p=v.degree),h[g.id()]=v.degree}return{degree:function(e){return 0===p?0:(b(e)&&(e=t.filter(e)),h[e.id()]/p)}}},degreeCentrality:function(e){e=pn(e);var t=this.cy(),n=this,r=e,a=r.root,i=r.weight,o=r.directed,s=r.alpha;if(a=t.collection(a)[0],o){for(var l=a.connectedEdges(),u=l.filter((function(e){return e.target().same(a)&&n.has(e)})),c=l.filter((function(e){return e.source().same(a)&&n.has(e)})),d=u.length,h=c.length,p=0,f=0,g=0;g<u.length;g++)p+=i(u[g]);for(var v=0;v<c.length;v++)f+=i(c[v]);return{indegree:Math.pow(d,1-s)*Math.pow(p,s),outdegree:Math.pow(h,1-s)*Math.pow(f,s)}}for(var y=a.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=i(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};fn.dc=fn.degreeCentrality,fn.dcn=fn.degreeCentralityNormalised=fn.degreeCentralityNormalized;var gn=Ue({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),vn={closenessCentralityNormalized:function(e){for(var t=gn(e),n=t.harmonic,r=t.weight,a=t.directed,i=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:a}),c=0;c<l.length;c++){for(var d=0,h=l[c],p=0;p<l.length;p++)if(c!==p){var f=u.distance(h,l[p]);d+=n?1/f:f}n||(d=1/d),s<d&&(s=d),o[h.id()]=d}return{closeness:function(e){return 0==s?0:(e=b(e)?i.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=gn(e),n=t.root,r=t.weight,a=t.directed,i=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:a}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var d=o.distanceTo(c);s+=i?1/d:d}}return i?s:1/s}};vn.cc=vn.closenessCentrality,vn.ccn=vn.closenessCentralityNormalised=vn.closenessCentralityNormalized;var yn=Ue({weight:null,directed:!1}),mn={betweennessCentrality:function(e){for(var t=yn(e),n=t.directed,r=t.weight,a=null!=r,i=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},d=function(e){return l[e]},h=0;h<o.length;h++){var p=o[h],f=p.id();s[f]=n?p.outgoers().nodes():p.openNeighborhood().nodes(),c(f,0)}for(var g=function(e){for(var t=o[e].id(),n=[],l={},u={},h={},p=new lt((function(e,t){return h[e]-h[t]})),f=0;f<o.length;f++){var g=o[f].id();l[g]=[],u[g]=0,h[g]=1/0}for(u[t]=1,h[t]=0,p.push(t);!p.empty();){var v=p.pop();if(n.push(v),a)for(var y=0;y<s[v].length;y++){var m,b=s[v][y],x=i.getElementById(v);m=x.edgesTo(b).length>0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var w=r(m);b=b.id(),h[b]>h[v]+w&&(h[b]=h[v]+w,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),u[b]=0,l[b]=[]),h[b]==h[v]+w&&(u[b]=u[b]+u[v],l[b].push(v))}else for(var E=0;E<s[v].length;E++){var k=s[v][E].id();h[k]==1/0&&(p.push(k),h[k]=h[v]+1),h[k]==h[v]+1&&(u[k]=u[k]+u[v],l[k].push(v))}}for(var C={},S=0;S<o.length;S++)C[o[S].id()]=0;for(;n.length>0;){for(var P=n.pop(),D=0;D<l[P].length;D++){var T=l[P][D];C[T]=C[T]+u[T]/u[P]*(1+C[P])}P!=o[e].id()&&c(P,d(P)+C[P])}},v=0;v<o.length;v++)g(v);var y={betweenness:function(e){var t=i.collection(e).id();return d(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=i.collection(e).id();return d(t)/u}};return y.betweennessNormalised=y.betweennessNormalized,y}};mn.bc=mn.betweennessCentrality;var bn=Ue({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),xn=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},wn=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var a=0;a<t;a++)n+=e[a*t+r];for(var i=0;i<t;i++)e[i*t+r]=e[i*t+r]/n}},En=function(e,t,n){for(var r=new Array(n*n),a=0;a<n;a++){for(var i=0;i<n;i++)r[a*n+i]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[a*n+s]+=e[a*n+o]*t[o*n+s]}return r},kn=function(e,t,n){for(var r=e.slice(0),a=1;a<n;a++)e=En(e,r,t);return e},Cn=function(e,t,n){for(var r=new Array(t*t),a=0;a<t*t;a++)r[a]=Math.pow(e[a],n);return wn(r,t),r},Sn=function(e,t,n,r){for(var a=0;a<n;a++)if(Math.round(e[a]*Math.pow(10,r))/Math.pow(10,r)!=Math.round(t[a]*Math.pow(10,r))/Math.pow(10,r))return!1;return!0},Pn=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Dn=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),a=function(e){return bn(e)}(e),i={},o=0;o<t.length;o++)i[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),d=0;d<u;d++)c[d]=0;for(var h=0;h<n.length;h++){var p=n[h],f=i[p.source().id()],g=i[p.target().id()],v=xn(p,a.attributes);c[f*l+g]+=v,c[g*l+f]+=v}!function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n}(c,l,a.multFactor),wn(c,l);for(var y=!0,m=0;y&&m<a.maxIterations;)y=!1,s=kn(c,l,a.expandFactor),c=Cn(s,l,a.inflateFactor),Sn(c,s,u,4)||(y=!0),m++;var b=function(e,t,n,r){for(var a=[],i=0;i<t;i++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[i*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&a.push(r.collection(o))}return a}(c,l,t,r);return b=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&Pn(e[t],e[n])&&e.splice(n,1);return e}(b),b},Tn={markovClustering:Dn,mcl:Dn},_n=function(e){return e},Mn=function(e,t){return Math.abs(t-e)},Bn=function(e,t,n){return e+Mn(t,n)},Nn=function(e,t,n){return e+Math.pow(n-t,2)},In=function(e){return Math.sqrt(e)},zn=function(e,t,n){return Math.max(e,Mn(t,n))},An=function(e,t,n,r,a){for(var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:_n,o=r,s=0;s<e;s++)o=a(o,t(s),n(s));return i(o)},Ln={euclidean:function(e,t,n){return e>=2?An(e,t,n,0,Nn,In):An(e,t,n,0,Bn)},squaredEuclidean:function(e,t,n){return An(e,t,n,0,Nn)},manhattan:function(e,t,n){return An(e,t,n,0,Bn)},max:function(e,t,n){return An(e,t,n,-1/0,zn)}};function On(e,t,n,r,a,i){var o;return o=x(e)?e:Ln[e]||Ln.euclidean,0===t&&x(e)?o(a,i):o(t,n,r,a,i)}Ln["squared-euclidean"]=Ln.squaredEuclidean,Ln.squaredeuclidean=Ln.squaredEuclidean;var Rn=Ue({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Vn=function(e){return Rn(e)},Fn=function(e,t,n,r,a){var i="kMedoids"!==a?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return On(e,r.length,i,(function(e){return r[e](t)}),o,s)},jn=function(e,t,n){for(var r=n.length,a=new Array(r),i=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)a[l]=e.min(n[l]).value,i[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(i[c]-a[c])+a[c];o[u]=s}return o},qn=function(e,t,n,r,a){for(var i=1/0,o=0,s=0;s<t.length;s++){var l=Fn(n,e,t[s],r,a);l<i&&(i=l,o=s)}return o},Yn=function(e,t,n){for(var r=[],a=null,i=0;i<t.length;i++)n[(a=t[i]).id()]===e&&r.push(a);return r},Xn=function(e,t,n){return Math.abs(t-e)<=n},Wn=function(e,t,n){for(var r=0;r<e.length;r++)for(var a=0;a<e[r].length;a++)if(Math.abs(e[r][a]-t[r][a])>n)return!1;return!0},Hn=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Kn=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var a=e[Math.floor(Math.random()*e.length)];Hn(a,n,r);)a=e[Math.floor(Math.random()*e.length)];n[r]=a}else for(var i=0;i<t;i++)n[i]=e[Math.floor(Math.random()*e.length)];return n},Gn=function(e,t,n){for(var r=0,a=0;a<t.length;a++)r+=Fn("manhattan",t[a],e,n,"kMedoids");return r},Un=function(e,t,n,r,a){for(var i,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],a.m);for(var u=0;u<e.length;u++)for(var c=0;c<a.attributes.length;c++){i=0,o=0;for(var d=0;d<t.length;d++)i+=r[d][u]*a.attributes[c](t[d]),o+=r[d][u];e[u][c]=i/o}},Zn=function(e,t,n,r,a){for(var i=0;i<e.length;i++)t[i]=e[i].slice();for(var o,s,l,u=2/(a.m-1),c=0;c<n.length;c++)for(var d=0;d<r.length;d++){o=0;for(var h=0;h<n.length;h++)s=Fn(a.distance,r[d],n[c],a.attributes,"cmeans"),l=Fn(a.distance,r[d],n[h],a.attributes,"cmeans"),o+=Math.pow(s/l,u);e[d][c]=1/o}},$n=function(e){var t,n,r,a,i,o=this.cy(),s=this.nodes(),l=Vn(e);a=new Array(s.length);for(var u=0;u<s.length;u++)a[u]=new Array(l.k);r=new Array(s.length);for(var c=0;c<s.length;c++)r[c]=new Array(l.k);for(var d=0;d<s.length;d++){for(var h=0,p=0;p<l.k;p++)r[d][p]=Math.random(),h+=r[d][p];for(var f=0;f<l.k;f++)r[d][f]=r[d][f]/h}n=new Array(l.k);for(var g=0;g<l.k;g++)n[g]=new Array(l.attributes.length);i=new Array(s.length);for(var v=0;v<s.length;v++)i[v]=new Array(l.k);for(var y=!0,m=0;y&&m<l.maxIterations;)y=!1,Un(n,s,r,i,l),Zn(r,a,n,s,l),Wn(r,a,l.sensitivityThreshold)||(y=!0),m++;return t=function(e,t,n,r){for(var a,i,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){a=-1/0,i=-1;for(var u=0;u<t[0].length;u++)t[l][u]>a&&(a=t[l][u],i=u);o[i].push(e[l])}for(var c=0;c<o.length;c++)o[c]=r.collection(o[c]);return o}(s,r,l,o),{clusters:t,degreeOfMembership:r}},Qn={kMeans:function(e){var t,n=this.cy(),a=this.nodes(),i=null,o=Vn(e),s=new Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,t=jn(a,o.k,o.attributes)):t="object"===r(o.testCentroids)?o.testCentroids:jn(a,o.k,o.attributes):t=jn(a,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var d=0;d<a.length;d++)l[(i=a[d]).id()]=qn(i,t,o.distance,o.attributes,"kMeans");u=!1;for(var h=0;h<o.k;h++){var p=Yn(h,a,l);if(0!==p.length){for(var f=o.attributes.length,g=t[h],v=new Array(f),y=new Array(f),m=0;m<f;m++){y[m]=0;for(var b=0;b<p.length;b++)i=p[b],y[m]+=o.attributes[m](i);v[m]=y[m]/p.length,Xn(v[m],g[m],o.sensitivityThreshold)||(u=!0)}t[h]=v,s[h]=n.collection(p)}}c++}return s},kMedoids:function(e){var t,n,a=this.cy(),i=this.nodes(),o=null,s=Vn(e),l=new Array(s.k),u={},c=new Array(s.k);s.testMode?"number"==typeof s.testCentroids||(t="object"===r(s.testCentroids)?s.testCentroids:Kn(i,s.k)):t=Kn(i,s.k);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var p=0;p<i.length;p++)u[(o=i[p]).id()]=qn(o,t,s.distance,s.attributes,"kMedoids");d=!1;for(var f=0;f<t.length;f++){var g=Yn(f,i,u);if(0!==g.length){c[f]=Gn(t[f],g,s.attributes);for(var v=0;v<g.length;v++)(n=Gn(g[v],g,s.attributes))<c[f]&&(c[f]=n,t[f]=g[v],d=!0);l[f]=a.collection(g)}}h++}return l},fuzzyCMeans:$n,fcm:$n},Jn=Ue({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),er={single:"min",complete:"max"},tr=function(e,t,n,r,a){for(var i,o=0,s=1/0,l=a.attributes,u=function(e,t){return On(a.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c<e.length;c++){var d=e[c].key,h=n[d][r[d]];h<s&&(o=d,s=h)}if("threshold"===a.mode&&s>=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var p,f=t[o],g=t[r[o]];p="dendrogram"===a.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=p,e.splice(g.index,1),t[f.key]=p;for(var v=0;v<e.length;v++){var y=e[v];f.key===y.key?i=1/0:"min"===a.linkage?(i=n[f.key][y.key],n[f.key][y.key]>n[g.key][y.key]&&(i=n[g.key][y.key])):"max"===a.linkage?(i=n[f.key][y.key],n[f.key][y.key]<n[g.key][y.key]&&(i=n[g.key][y.key])):i="mean"===a.linkage?(n[f.key][y.key]*f.size+n[g.key][y.key]*g.size)/(f.size+g.size):"dendrogram"===a.mode?u(y.value,f.value):u(y.value[0],f.value[0]),n[f.key][y.key]=n[y.key][f.key]=i}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===f.key||r[b]===g.key){for(var x=b,w=0;w<e.length;w++){var E=e[w].key;n[b][E]<n[b][x]&&(x=E)}r[b]=x}e[m].index=m}return f.key=g.key=f.index=g.index=null,!0},nr=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},rr=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),a=e(t.right,n),i=n.add({group:"nodes",data:{id:r+","+a}});return n.add({group:"edges",data:{source:r,target:i.id()}}),n.add({group:"edges",data:{source:a,target:i.id()}}),i.id()}return t.value?t.value.id():void 0},ar=function e(t,n,r){if(!t)return[];var a=[],i=[],o=[];return 0===n?(t.left&&nr(t.left,a),t.right&&nr(t.right,i),o=a.concat(i),[r.collection(o)]):1===n?t.value?[r.collection(t.value)]:(t.left&&nr(t.left,a),t.right&&nr(t.right,i),[r.collection(a),r.collection(i)]):t.value?[r.collection(t.value)]:(t.left&&(a=e(t.left,n-1,r)),t.right&&(i=e(t.right,n-1,r)),a.concat(i))},ir=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=Jn(e),n=er[t.linkage];return null!=n&&(t.linkage=n),t}(e),a=r.attributes,i=function(e,t){return On(r.distance,a.length,(function(t){return a[t](e)}),(function(e){return a[e](t)}),e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var d={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=d,u[c]=d,s[c]=[],l[c]=0}for(var h=0;h<o.length;h++)for(var p=0;p<=h;p++){var f;f="dendrogram"===r.mode?h===p?1/0:i(o[h].value,o[p].value):h===p?1/0:i(o[h].value[0],o[p].value[0]),s[h][p]=f,s[p][h]=f,f<s[h][l[h]]&&(l[h]=p)}for(var g,v=tr(o,u,s,l,r);v;)v=tr(o,u,s,l,r);return"dendrogram"===r.mode?(g=ar(o[0],r.dendrogramDepth,t),r.addDendrogram&&rr(o[0],t)):(g=new Array(o.length),o.forEach((function(e,n){e.key=e.index=null,g[n]=t.collection(e.value)}))),g},or={hierarchicalClustering:ir,hca:ir},sr=Ue({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),lr=function(e,t,n,r){var a=function(e,t){return r[t](e)};return-On(e,r.length,(function(e){return a(t,e)}),(function(e){return a(n,e)}),t,n)},ur=function(e,t,n){for(var r=[],a=0;a<e;a++){for(var i=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[a*e+l]>o&&(i=l,o=t[a*e+l])}i>0&&r.push(i)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},cr=function(e){for(var t,n,r,a,i,o,s=this.cy(),l=this.nodes(),u=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||qe("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some((function(e){return e===n}))||k(n)||qe("Preference must be one of [".concat(r.map((function(e){return"'".concat(e,"'")})).join(", "),"] or a number. Got: ").concat(n)),sr(e)}(e),c={},d=0;d<l.length;d++)c[l[d].id()]=d;n=(t=l.length)*t,r=new Array(n);for(var h=0;h<n;h++)r[h]=-1/0;for(var p=0;p<t;p++)for(var f=0;f<t;f++)p!==f&&(r[p*t+f]=lr(u.distance,l[p],l[f],u.attributes));a=function(e,t){var n;return n="median"===t?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t)):e=e.slice(t,n);for(var i=0,o=e.length-1;o>=0;o--){var s=e[o];a?isFinite(s)||(e[o]=-1/0,i++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+i]:(e[u-1+i]+e[u+i])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,a=0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(r+=o,a++)}return r/a}(e):"min"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.min(i,r))}return r}(e):"max"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,a=t;a<n;a++){var i=e[a];isFinite(i)&&(r=Math.max(i,r))}return r}(e):t,n}(r,u.preference);for(var g=0;g<t;g++)r[g*t+g]=a;i=new Array(n);for(var v=0;v<n;v++)i[v]=0;o=new Array(n);for(var y=0;y<n;y++)o[y]=0;for(var m=new Array(t),b=new Array(t),x=new Array(t),w=0;w<t;w++)m[w]=0,b[w]=0,x[w]=0;for(var E,C=new Array(t*u.minIterations),S=0;S<C.length;S++)C[S]=0;for(E=0;E<u.maxIterations;E++){for(var P=0;P<t;P++){for(var D=-1/0,T=-1/0,_=-1,M=0,B=0;B<t;B++)m[B]=i[P*t+B],(M=o[P*t+B]+r[P*t+B])>=D?(T=D,D=M,_=B):M>T&&(T=M);for(var N=0;N<t;N++)i[P*t+N]=(1-u.damping)*(r[P*t+N]-D)+u.damping*m[N];i[P*t+_]=(1-u.damping)*(r[P*t+_]-T)+u.damping*m[_]}for(var I=0;I<t;I++){for(var z=0,A=0;A<t;A++)m[A]=o[A*t+I],b[A]=Math.max(0,i[A*t+I]),z+=b[A];z-=b[I],b[I]=i[I*t+I],z+=b[I];for(var L=0;L<t;L++)o[L*t+I]=(1-u.damping)*Math.min(0,z-b[L])+u.damping*m[L];o[I*t+I]=(1-u.damping)*(z-b[I])+u.damping*m[I]}for(var O=0,R=0;R<t;R++){var V=o[R*t+R]+i[R*t+R]>0?1:0;C[E%u.minIterations*t+R]=V,O+=V}if(O>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var F=0,j=0;j<t;j++){x[j]=0;for(var q=0;q<u.minIterations;q++)x[j]+=C[q*t+j];0!==x[j]&&x[j]!==u.minIterations||F++}if(F===t)break}}for(var Y=function(e,t,n){for(var r=[],a=0;a<e;a++)t[a*e+a]+n[a*e+a]>0&&r.push(a);return r}(t,i,o),X=function(e,t,n){for(var r=ur(e,t,n),a=0;a<n.length;a++){for(var i=[],o=0;o<r.length;o++)r[o]===n[a]&&i.push(o);for(var s=-1,l=-1/0,u=0;u<i.length;u++){for(var c=0,d=0;d<i.length;d++)c+=t[i[d]*e+i[u]];c>l&&(s=u,l=c)}n[a]=i[s]}return ur(e,t,n)}(t,r,Y),W={},H=0;H<Y.length;H++)W[Y[H]]=[];for(var K=0;K<l.length;K++){var G=X[c[l[K].id()]];null!=G&&W[G].push(l[K])}for(var U=new Array(Y.length),Z=0;Z<Y.length;Z++)U[Z]=s.collection(W[Y[Z]]);return U},dr={affinityPropagation:cr,ap:cr},hr=Ue({root:void 0,directed:!1}),pr=function(){var e=this,t={},n=0,r=0,a=[],i=[],o={},s=function s(l,u,c){l===c&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var d,h,p,f,g=e.getElementById(u).connectedEdges().intersection(e);0===g.size()?a.push(e.spawn(e.getElementById(u))):g.forEach((function(n){d=n.source().id(),h=n.target().id(),(p=d===u?h:d)!==c&&(f=n.id(),o[f]||(o[f]=!0,i.push({x:u,y:p,edge:n})),p in t?t[u].low=Math.min(t[u].low,t[p].id):(s(l,p,u),t[u].low=Math.min(t[u].low,t[p].low),t[u].id<=t[p].low&&(t[u].cutVertex=!0,function(n,r){for(var o=i.length-1,s=[],l=e.spawn();i[o].x!=n||i[o].y!=r;)s.push(i.pop().edge),o--;s.push(i.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),a=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(a.filter((function(e){return e.isLoop()}))):l.merge(a)}))})),a.push(l)}(u,p))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,s(n,n),t[n].cutVertex=r>1)}}));var l=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(l),components:a}},fr=function(){var e=this,t={},n=0,r=[],a=[],i=e.spawn(e),o=function o(s){if(a.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);r.push(d),i=i.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:i,components:r}},gr={};[it,ct,dt,pt,gt,yt,wt,hn,fn,vn,mn,Tn,Qn,or,dr,{hierholzer:function(e){if(!E(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,a,i=hr(e),o=i.root,s=i.directed,l=this,u=!1;o&&(a=b(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?l.forEach((function(e){var t=e.id();if(e.isNode()){var a=e.indegree(!0),i=e.outdegree(!0),o=a-i,s=i-a;1==o?n?u=!0:n=t:1==s?r?u=!0:r=t:(s>1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(u)return h;if(r&&n)if(s){if(a&&r!=a)return h;a=r}else{if(a&&r!=a&&n!=a)return h;a||(a=r)}else a||(a=l[0].id());var p=function(e){for(var t,n,r,a=e,i=[e];c[a].length;)t=c[a].shift(),n=d[t][0],a!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),a=r):s||a==n||(c[n]=c[n].filter((function(e){return e!=t})),a=n),i.unshift(t),i.unshift(a);return i},f=[],g=[];for(g=p(a);1!=g.length;)0==c[g[0]].length?(f.unshift(l.getElementById(g.shift())),f.unshift(l.getElementById(g.shift()))):g=p(g.shift()).concat(g);for(var v in f.unshift(l.getElementById(g.shift())),c)if(c[v].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},{hopcroftTarjanBiconnected:pr,htbc:pr,htb:pr,hopcroftTarjanBiconnectedComponents:pr},{tarjanStronglyConnected:fr,tsc:fr,tscc:fr,tarjanStronglyConnectedComponents:fr}].forEach((function(e){Y(gr,e)}));var vr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};vr.prototype={fulfill:function(e){return yr(this,1,"fulfillValue",e)},reject:function(e){return yr(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new vr;return n.onFulfilled.push(xr(e,r,"fulfill")),n.onRejected.push(xr(t,r,"reject")),mr(n),r.proxy}};var yr=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,mr(e)),e},mr=function(e){1===e.state?br(e,"onFulfilled",e.fulfillValue):2===e.state&&br(e,"onRejected",e.rejectReason)},br=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var a=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(a):setTimeout(a,0)}},xr=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var a;try{a=e(r)}catch(e){return void t.reject(e)}wr(t,a)}}},wr=function e(t,n){if(t!==n&&t.proxy!==n){var a;if("object"===r(n)&&null!==n||"function"==typeof n)try{a=n.then}catch(e){return void t.reject(e)}if("function"!=typeof a)t.fulfill(n);else{var i=!1;try{a.call(n,(function(r){i||(i=!0,r===n?t.reject(new TypeError("circular thenable chain")):e(t,r))}),(function(e){i||(i=!0,t.reject(e))}))}catch(e){i||t.reject(e)}}}else t.reject(new TypeError("cannot resolve promise with itself"))};vr.all=function(e){return new vr((function(t,n){for(var r=new Array(e.length),a=0,i=function(n,i){r[n]=i,++a===e.length&&t(r)},o=0;o<e.length;o++)!function(t){var r=e[t];null!=r&&null!=r.then?r.then((function(e){i(t,e)}),(function(e){n(e)})):i(t,r)}(o)}))},vr.resolve=function(e){return new vr((function(t,n){t(e)}))},vr.reject=function(e){return new vr((function(t,n){n(e)}))};var Er="undefined"!=typeof Promise?Promise:vr,kr=function(e,t,n){var r=T(e),a=!r,i=this._private=Y({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&x(i.complete)&&i.completes.push(i.complete),a){var o=e.position();i.startPosition=i.startPosition||{x:o.x,y:o.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var s=e.pan();i.startPan={x:s.x,y:s.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},Cr=kr.prototype;Y(Cr,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),S(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(t,n){var r=e[t];null!=r&&(e[t]=e[n],e[n]=r)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var a=e.style[r],i=a.name,o=e.startStyle[i];e.startStyle[i]=a,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new Er((function(e,n){t.push((function(){e()}))}))}}),Cr.complete=Cr.completed,Cr.run=Cr.play,Cr.running=Cr.playing;var Sr,Pr={animated:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return!1;var n=t[0];return n?n._private.animation.current.length>0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n<t.length;n++)t[n]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=void 0!==n.length,a=r?n:[n],i=this._private.cy||this,o=!r,s=!o;if(!i.styleEnabled())return this;var l=i.style();if(e=Y({},e,t),0===Object.keys(e).length)return new kr(a[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&null!=e.renderedPosition){var u=e.renderedPosition,c=i.pan(),d=i.zoom();e.position=kt(u,d,c)}if(o&&null!=e.panBy){var h=e.panBy,p=i.pan();e.pan={x:p.x+h.x,y:p.y+h.y}}var f=e.center||e.centre;if(o&&null!=f){var g=i.getCenterPan(f.eles,e.zoom);null!=g&&(e.pan=g)}if(o&&null!=e.fit){var v=e.fit,y=i.getFitViewport(v.eles||v.boundingBox,v.padding);null!=y&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&E(e.zoom)){var m=i.getZoomedViewport(e.zoom);null!=m?(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan)):e.zoom=null}return new kr(a[0],e)}},animate:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=Y({},e,t));for(var a=0;a<r.length;a++){var i=r[a],o=i.animated()&&(void 0===e.queue||e.queue);i.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=this,r=void 0!==n.length?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var i=0;i<r.length;i++){for(var o=r[i]._private,s=o.animation.current,l=0;l<s.length;l++){var u=s[l]._private;t&&(u.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return a.notify("draw"),this}}},Dr=Array.isArray,Tr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_r=/^\w*$/,Mr=$["__core-js_shared__"],Br=(Sr=/[^.]+$/.exec(Mr&&Mr.keys&&Mr.keys.IE_PROTO||""))?"Symbol(src)_1."+Sr:"",Nr=Function.prototype.toString,Ir=/^\[object .+?Constructor\]$/,zr=Function.prototype,Ar=Object.prototype,Lr=zr.toString,Or=Ar.hasOwnProperty,Rr=RegExp("^"+Lr.call(Or).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vr=function(e){return!(!K(e)||(t=e,Br&&Br in t))&&(function(e){if(!K(e))return!1;var t=ue(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}(e)?Rr:Ir).test(function(e){if(null!=e){try{return Nr.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t},Fr=function(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Vr(n)?n:void 0},jr=Fr(Object,"create"),qr=Object.prototype.hasOwnProperty,Yr=Object.prototype.hasOwnProperty;function Xr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Xr.prototype.clear=function(){this.__data__=jr?jr(null):{},this.size=0},Xr.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Xr.prototype.get=function(e){var t=this.__data__;if(jr){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return qr.call(t,e)?t[e]:void 0},Xr.prototype.has=function(e){var t=this.__data__;return jr?void 0!==t[e]:Yr.call(t,e)},Xr.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=jr&&void 0===t?"__lodash_hash_undefined__":t,this};var Wr=Xr,Hr=function(e,t){return e===t||e!=e&&t!=t},Kr=function(e,t){for(var n=e.length;n--;)if(Hr(e[n][0],t))return n;return-1},Gr=Array.prototype.splice;function Ur(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Ur.prototype.clear=function(){this.__data__=[],this.size=0},Ur.prototype.delete=function(e){var t=this.__data__,n=Kr(t,e);return!(n<0||(n==t.length-1?t.pop():Gr.call(t,n,1),--this.size,0))},Ur.prototype.get=function(e){var t=this.__data__,n=Kr(t,e);return n<0?void 0:t[n][1]},Ur.prototype.has=function(e){return Kr(this.__data__,e)>-1},Ur.prototype.set=function(e,t){var n=this.__data__,r=Kr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Zr=Ur,$r=Fr($,"Map"),Qr=function(e,t){var n,r,a=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?a["string"==typeof t?"string":"hash"]:a.map};function Jr(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Jr.prototype.clear=function(){this.size=0,this.__data__={hash:new Wr,map:new($r||Zr),string:new Wr}},Jr.prototype.delete=function(e){var t=Qr(this,e).delete(e);return this.size-=t?1:0,t},Jr.prototype.get=function(e){return Qr(this,e).get(e)},Jr.prototype.has=function(e){return Qr(this,e).has(e)},Jr.prototype.set=function(e,t){var n=Qr(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var ea=Jr;function ta(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var r=arguments,a=t?t.apply(this,r):r[0],i=n.cache;if(i.has(a))return i.get(a);var o=e.apply(this,r);return n.cache=i.set(a,o)||i,o};return n.cache=new(ta.Cache||ea),n}ta.Cache=ea;var na=ta,ra=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,aa=/\\(\\)?/g,ia=function(e){var t=na(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ra,(function(e,n,r,a){t.push(r?a.replace(aa,"$1"):n||e)})),t})),oa=ia,sa=function(e,t){for(var n=-1,r=null==e?0:e.length,a=Array(r);++n<r;)a[n]=t(e[n],n,e);return a},la=ne?ne.prototype:void 0,ua=la?la.toString:void 0,ca=function e(t){if("string"==typeof t)return t;if(Dr(t))return sa(t,e)+"";if(ce(t))return ua?ua.call(t):"";var n=t+"";return"0"==n&&1/t==-1/0?"-0":n},da=function(e){return null==e?"":ca(e)},ha=function(e,t){return Dr(e)?e:function(e,t){if(Dr(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ce(e))||_r.test(e)||!Tr.test(e)||null!=t&&e in Object(t)}(e,t)?[e]:oa(da(e))},pa=function(e){if("string"==typeof e||ce(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t},fa=function(e,t,n){var r=null==e?void 0:function(e,t){for(var n=0,r=(t=ha(t,e)).length;null!=e&&n<r;)e=e[pa(t[n++])];return n&&n==r?e:void 0}(e,t);return void 0===r?n:r},ga=function(){try{var e=Fr(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),va=Object.prototype.hasOwnProperty,ya=function(e,t,n){var r=e[t];va.call(e,t)&&Hr(r,n)&&(void 0!==n||t in e)||function(e,t,n){"__proto__"==t&&ga?ga(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}(e,t,n)},ma=/^(?:0|[1-9]\d*)$/,ba=function(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&ma.test(e))&&e>-1&&e%1==0&&e<t},xa=function(e,t,n){return null==e?e:function(e,t,n,r){if(!K(e))return e;for(var a=-1,i=(t=ha(t,e)).length,o=i-1,s=e;null!=s&&++a<i;){var l=pa(t[a]),u=n;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(a!=o){var c=s[l];void 0===(u=r?r(c,l,s):void 0)&&(u=K(c)?c:ba(t[a+1])?[]:{})}ya(s,l,u),s=s[l]}return e}(e,t,n)},wa=function(e){return Dr(e)?sa(e,pa):ce(e)?[e]:function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(oa(da(e)))},Ea={data:function(e){return e=Y({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,a=this,i=void 0!==a.length,o=i?a:[a],l=i?a[0]:a;if(b(t)){var u,c=-1!==t.indexOf(".")&&wa(t);if(r.allowGetting&&void 0===n)return l&&(r.beforeGet(l),u=c&&void 0===l._private[r.field][t]?fa(l._private[r.field],c):l._private[r.field][t]),u;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var d=s({},t,n);r.beforeSet(a,d);for(var h=0,p=o.length;h<p;h++){var f=o[h];r.canSet(f)&&(c&&void 0===l._private[r.field][t]?xa(f._private[r.field],c,n):f._private[r.field][t]=n)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&E(t)){var g,v,y=t,m=Object.keys(y);r.beforeSet(a,y);for(var w=0;w<m.length;w++)if(v=y[g=m[w]],!r.immutableKeys[g])for(var k=0;k<o.length;k++){var C=o[k];r.canSet(C)&&(C._private[r.field][g]=v)}r.updateStyle&&a.updateStyle(),r.onSet(a),r.settingTriggersEvent&&a[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&x(t)){var S=t;a.on(r.bindingEvent,S)}else if(r.allowGetting&&void 0===t){var P;return l&&(r.beforeGet(l),P=l._private[r.field]),P}return a}},removeData:function(e){return e=Y({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,a=void 0!==r.length?r:[r];if(b(t)){for(var i=t.split(/\s+/),o=i.length,s=0;s<o;s++){var l=i[s];if(!M(l)&&!n.immutableKeys[l])for(var u=0,c=a.length;u<c;u++)a[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var d=0,h=a.length;d<h;d++)for(var p=a[d]._private[n.field],f=Object.keys(p),g=0;g<f.length;g++){var v=f[g];!n.immutableKeys[v]&&(p[v]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},ka={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(e,t){var n=this,r=Array.prototype.slice.call(arguments,0);return new Er((function(e,t){var a=r.concat([function(t){n.off.apply(n,i),e(t)}]),i=a.concat([]);n.on.apply(n,a)}))}}},Ca={};[Pr,Ea,ka].forEach((function(e){Y(Ca,e)}));var Sa={animate:Ca.animate(),animation:Ca.animation(),animated:Ca.animated(),clearQueue:Ca.clearQueue(),delay:Ca.delay(),delayAnimation:Ca.delayAnimation(),stop:Ca.stop()},Pa={classes:function(e){var t=this;if(void 0===e){var n=[];return t[0]._private.classes.forEach((function(e){return n.push(e)})),n}w(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],a=new nt(e),i=0;i<t.length;i++){for(var o=t[i],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var d=e[c];if(!l.has(d)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=a,r.push(o))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){w(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,a=[],i=0,o=n.length;i<o;i++)for(var s=n[i],l=s._private.classes,u=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),p=!1;t||r&&!h?(l.add(d),p=!0):(!t||r&&h)&&(l.delete(d),p=!0),!u&&p&&(a.push(s),u=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Pa.className=Pa.classNames=Pa.classes;var Da={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:O,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Da.variable="(?:[\\w-.]|(?:\\\\"+Da.metaChar+"))+",Da.className="(?:[\\w-]|(?:\\\\"+Da.metaChar+"))+",Da.value=Da.string+"|"+Da.number,Da.id=Da.variable,function(){var e,t,n;for(e=Da.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Da.comparatorOp+="|@"+t;for(e=Da.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(Da.comparatorOp+="|\\!"+t)}();var Ta=20,_a=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*q(e,t)}(e.selector,t.selector)})),Ma=function(){for(var e,t={},n=0;n<_a.length;n++)t[(e=_a[n]).selector]=e.matches;return t}(),Ba="("+_a.map((function(e){return e.selector})).join("|")+")",Na=function(e){return e.replace(new RegExp("\\\\("+Da.metaChar+")","g"),(function(e,t){return t}))},Ia=function(e,t,n){e[e.length-1]=n},za=[{name:"group",query:!0,regex:"("+Da.group+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:0,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:Ba,populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:7,value:r})}},{name:"id",query:!0,regex:"\\#("+Da.id+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:8,value:Na(r)})}},{name:"className",query:!0,regex:"\\.("+Da.className+")",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:9,value:Na(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Da.variable+")\\s*\\]",populate:function(e,t,n){var r=l(n,1)[0];t.checks.push({type:4,field:Na(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Da.variable+")\\s*("+Da.comparatorOp+")\\s*("+Da.value+")\\s*\\]",populate:function(e,t,n){var r=l(n,3),a=r[0],i=r[1],o=r[2];o=null!=new RegExp("^"+Da.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:3,field:Na(a),operator:i,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Da.boolOp+")\\s*("+Da.variable+")\\s*\\]",populate:function(e,t,n){var r=l(n,2),a=r[0],i=r[1];t.checks.push({type:5,field:Na(i),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Da.meta+")\\s*("+Da.comparatorOp+")\\s*("+Da.number+")\\s*\\]\\]",populate:function(e,t,n){var r=l(n,3),a=r[0],i=r[1],o=r[2];t.checks.push({type:6,field:Na(a),operator:i,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Da.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,a=e.compoundCount,i=e[e.length-1];return null!=n&&(i.subject=n,e.currentSubject=null),i.edgeCount=r,i.compoundCount=a,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:Da.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,a={checks:[]};return n.checks.push({type:11,source:r,target:a}),Ia(e,0,n),e.edgeCount++,a}var i={checks:[]},o=t,s={checks:[]};return i.checks.push({type:12,source:o,target:s}),Ia(e,0,i),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:Da.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,a={checks:[]};return n.checks.push({type:10,nodes:[r,a]}),Ia(e,0,n),e.edgeCount++,a}var i={checks:[]},o=t,s={checks:[]};return i.checks.push({type:14,node:o,neighbor:s}),Ia(e,0,i),s}},{name:"child",separator:!0,regex:Da.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},a=e[e.length-1];return n.checks.push({type:15,parent:a,child:r}),Ia(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var i={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return i.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Ta}],c.checks.push({type:Ta}),s.checks.push({type:17,parent:c,child:u}),Ia(e,0,i),e.currentSubject=l,e.compoundCount++,u}var d={checks:[]},h={checks:[]},p=[{type:17,parent:d,child:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"descendant",separator:!0,regex:Da.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},a=e[e.length-1];return n.checks.push({type:16,ancestor:a,descendant:r}),Ia(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var i={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return i.checks.push({type:19,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Ta}],c.checks.push({type:Ta}),s.checks.push({type:18,ancestor:c,descendant:u}),Ia(e,0,i),e.currentSubject=l,e.compoundCount++,u}var d={checks:[]},h={checks:[]},p=[{type:18,ancestor:d,descendant:h}];return d.checks=t.checks,t.checks=p,e.compoundCount++,h}},{name:"subject",modifier:!0,regex:Da.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Xe("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],r=null==n?null:n.type;11===r?n.type=13:10===r&&(n.type=14,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];za.forEach((function(e){return e.regexObj=new RegExp("^"+e.regex)}));var Aa=function(e){for(var t,n,r,a=0;a<za.length;a++){var i=za[a],o=i.name,s=e.match(i.regexObj);if(null!=s){n=s,t=i,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},La={parse:function(e){var t=this,n=t.inputText=e,r=t[0]={checks:[]};for(t.length=1,n=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e}(n);;){var a=Aa(n);if(null==a.expr)return Xe("The selector `"+e+"`is invalid"),!1;var i=a.match.slice(1),o=a.expr.populate(t,r,i);if(!1===o)return!1;if(null!=o&&(r=o),(n=a.remaining).match(/^\s*$/))break}var s=t[t.length-1];null!=t.currentSubject&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return Xe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Xe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Xe("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},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(a,i){return a.checks.reduce((function(o,s,l){return o+(i===a&&0===l?"$":"")+function(a,i){var o=a.type,s=a.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:var u=a.field,c=a.operator;return"["+u+n(e(c))+t(s)+"]";case 5:var d=a.operator,h=a.field;return"["+e(d)+h+"]";case 4:return"["+a.field+"]";case 6:var p=a.operator;return"[["+a.field+n(e(p))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return r(a.parent,i)+n(">")+r(a.child,i);case 18:case 16:return r(a.ancestor,i)+" "+r(a.descendant,i);case 19:var f=r(a.left,i),g=r(a.subject,i),v=r(a.right,i);return f+(f.length>0?" ":"")+g+v;case Ta:return""}}(s,i)}),"")},a="",i=0;i<this.length;i++){var o=this[i];a+=r(o,o.subject),this.length>1&&i<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},Oa=function(e,t,n){var r,a,i,o=b(e),s=k(e),l=b(n),u=!1,c=!1,d=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(a=o||s?""+e:"",i=""+n),u&&(e=a=a.toLowerCase(),n=i=i.toLowerCase()),t){case"*=":r=a.indexOf(i)>=0;break;case"$=":r=a.indexOf(i,a.length-i.length)>=0;break;case"^=":r=0===a.indexOf(i);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e<n;break;case"<=":d=!0,r=e<=n;break;default:r=!1}return!c||null==e&&d||(r=!r),r},Ra=function(e,t){return e.data(t)},Va=[],Fa=function(e,t){return e.checks.every((function(e){return Va[e.type](e,t)}))};Va[0]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Va[7]=function(e,t){return function(e,t){return Ma[e](t)}(e.value,t)},Va[8]=function(e,t){var n=e.value;return t.id()===n},Va[9]=function(e,t){var n=e.value;return t.hasClass(n)},Va[6]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Oa(function(e,t){return e[t]()}(t,n),r,a)},Va[3]=function(e,t){var n=e.field,r=e.operator,a=e.value;return Oa(Ra(t,n),r,a)},Va[5]=function(e,t){var n=e.field,r=e.operator;return function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}}(Ra(t,n),r)},Va[4]=function(e,t){var n=e.field;return e.operator,void 0!==Ra(t,n)},Va[10]=function(e,t){var n=e.nodes[0],r=e.nodes[1],a=t.source(),i=t.target();return Fa(n,a)&&Fa(r,i)||Fa(r,a)&&Fa(n,i)},Va[14]=function(e,t){return Fa(e.node,t)&&t.neighborhood().some((function(t){return t.isNode()&&Fa(e.neighbor,t)}))},Va[11]=function(e,t){return Fa(e.source,t.source())&&Fa(e.target,t.target())},Va[12]=function(e,t){return Fa(e.source,t)&&t.outgoers().some((function(t){return t.isNode()&&Fa(e.target,t)}))},Va[13]=function(e,t){return Fa(e.target,t)&&t.incomers().some((function(t){return t.isNode()&&Fa(e.source,t)}))},Va[15]=function(e,t){return Fa(e.child,t)&&Fa(e.parent,t.parent())},Va[17]=function(e,t){return Fa(e.parent,t)&&t.children().some((function(t){return Fa(e.child,t)}))},Va[16]=function(e,t){return Fa(e.descendant,t)&&t.ancestors().some((function(t){return Fa(e.ancestor,t)}))},Va[18]=function(e,t){return Fa(e.ancestor,t)&&t.descendants().some((function(t){return Fa(e.descendant,t)}))},Va[19]=function(e,t){return Fa(e.subject,t)&&Fa(e.left,t)&&Fa(e.right,t)},Va[20]=function(){return!0},Va[1]=function(e,t){return e.value.has(t)},Va[2]=function(e,t){return(0,e.value)(t)};var ja={matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(Fa(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&8===t[0].checks[0].type)return e.getElementById(t[0].checks[0].value).collection();var n=function(e){for(var n=0;n<t.length;n++){var r=t[n];if(Fa(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}},qa=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||b(e)&&e.match(/^\s*$/)||(S(e)?this.addQuery({checks:[{type:1,value:e.collection()}]}):x(e)?this.addQuery({checks:[{type:2,value:e}]}):b(e)?this.parse(e)||(this.invalid=!0):qe("A selector must be created from a string; found "))},Ya=qa.prototype;[La,ja].forEach((function(e){return Y(Ya,e)})),Ya.text=function(){return this.inputText},Ya.size=function(){return this.length},Ya.eq=function(e){return this[e]},Ya.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Ya.addQuery=function(e){this[this.length++]=e},Ya.selector=Ya.toString;var Xa={allAre:function(e){var t=new qa(e);return this.every((function(e){return t.matches(e)}))},is:function(e){var t=new qa(e);return this.some((function(e){return t.matches(e)}))},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every((function(t){return e.hasElementWithId(t.id())})))},anySame:function(e){return e=this.cy().collection(e),this.some((function(t){return e.hasElementWithId(t.id())}))},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every((function(e){return t.hasElementWithId(e.id())}))},contains:function(e){e=this.cy().collection(e);var t=this;return e.every((function(e){return t.hasElementWithId(e.id())}))}};Xa.allAreNeighbours=Xa.allAreNeighbors,Xa.has=Xa.contains,Xa.equal=Xa.equals=Xa.same;var Wa,Ha,Ka=function(e,t){return function(n,r,a,i){var o,s=n,l=this;if(null==s?o="":S(s)&&1===s.length&&(o=s.id()),1===l.length&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},d=c[t]=c[t]||[],h=Be(o);return d[h]||(d[h]=e.call(l,n,r,a,i))}return e.call(l,n,r,a,i)}},Ga={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var a=this[r]._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var a=n[r];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n].parents();t=(t=t||r).intersect(r)}return t.filter(e)},orphans:function(e){return this.stdFilter((function(e){return e.isOrphan()})).filter(e)},nonorphans:function(e){return this.stdFilter((function(e){return e.isChild()})).filter(e)},children:Ka((function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,a=0;a<r.length;a++)t.push(r[a]);return this.spawn(t,!0).filter(e)}),"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return function e(n){for(var r=0;r<n.length;r++){var a=n[r];t.push(a),a.children().nonempty()&&e(a.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function Ua(e,t,n,r){for(var a=[],i=new nt,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?a.push(l):o&&r(a,i,l)}for(;a.length>0;){var u=a.shift();t(u),i.add(u.id()),o&&r(a,i,u)}return e}function Za(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a<r.length;a++){var i=r[a];t.has(i.id())||e.push(i)}}function $a(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function Qa(e,t,n){$a(e,t,n),Za(e,t,n)}Ga.forEachDown=function(e){return Ua(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Za)},Ga.forEachUp=function(e){return Ua(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],$a)},Ga.forEachUpAndDown=function(e){return Ua(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Qa)},Ga.ancestors=Ga.parents,(Wa=Ha={data:Ca.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:Ca.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ca.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ca.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ca.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ca.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Wa.data,Wa.removeAttr=Wa.removeData;var Ja,ei,ti=Ha,ni={};function ri(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,a=n[0],i=a._private.edges,o=0;o<i.length;o++){var s=i[o];!t&&s.isLoop()||(r+=e(a,s))}return r}}}function ai(e,t){return function(n){for(var r,a=this.nodes(),i=0;i<a.length;i++){var o=a[i][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}Y(ni,{degree:ri((function(e,t){return t.source().same(t.target())?2:1})),indegree:ri((function(e,t){return t.target().same(e)?1:0})),outdegree:ri((function(e,t){return t.source().same(e)?1:0}))}),Y(ni,{minDegree:ai("degree",(function(e,t){return e<t})),maxDegree:ai("degree",(function(e,t){return e>t})),minIndegree:ai("indegree",(function(e,t){return e<t})),maxIndegree:ai("indegree",(function(e,t){return e>t})),minOutdegree:ai("outdegree",(function(e,t){return e<t})),maxOutdegree:ai("outdegree",(function(e,t){return e>t}))}),Y(ni,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var ii=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r];if(!a.locked()){var i=a._private.position,o={x:null!=t.x?t.x-i.x:0,y:null!=t.y?t.y-i.y:0};!a.isParent()||0===o.x&&0===o.y||a.children().shift(o,n),a.dirtyBoundingBoxCache()}}},oi={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){ii(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ja=ei={position:Ca.data(oi),silentPosition:Ca.data(Y({},oi,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){ii(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(E(e))t?this.silentPosition(e):this.position(e);else if(x(e)){var n=e,r=this.cy();r.startBatch();for(var a=0;a<this.length;a++){var i,o=this[a];(i=n(o,a))&&(t?o.silentPosition(i):o.position(i))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(E(e)?(r={x:k(e.x)?e.x:0,y:k(e.y)?e.y:0},n=t):b(e)&&k(t)&&((r={x:0,y:0})[e]=t),null!=r){var a=this.cy();a.startBatch();for(var i=0;i<this.length;i++){var o=this[i];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var s=o.position(),l={x:s.x+r.x,y:s.y+r.y};n?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(e,t){return E(e)?this.shift(e,!0):b(e)&&k(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),a=r.zoom(),i=r.pan(),o=E(e)?e:void 0,s=void 0!==o||void 0!==t&&b(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=Et(l,a,i),void 0===e?o:o[e]}for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-i[e])/a):void 0!==o&&c.position(kt(o,a,i))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),a=E(e)?e:void 0,i=void 0!==a||void 0!==t&&b(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!i){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var d=c?l.position():{x:0,y:0};return a={x:s.x-d.x,y:s.y-d.y},void 0===e?a:a[e]}for(var h=0;h<this.length;h++){var p=this[h],f=o?p.parent():null,g=f&&f.length>0,v=g;g&&(f=f[0]);var y=v?f.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==a&&p.position({x:a.x+y.x,y:a.y+y.y})}}else if(!i)return;return this}},Ja.modelPosition=Ja.point=Ja.position,Ja.modelPositions=Ja.points=Ja.positions,Ja.renderedPoint=Ja.renderedPosition,Ja.relativePoint=Ja.relativePosition;var si,li,ui=ei;si=li={},li.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),i=t.x1*r+a.x,o=t.x2*r+a.x,s=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}},li.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},li.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},i=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==i.w&&0!==i.h||((i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-i.w/2,i.x2=o.x+i.w/2,i.y1=o.y-i.h/2,i.y2=o.y+i.h/2);var s=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(s=100*s/a.width.val);var l=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(l=100*l/a.width.val);var u=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(u=100*u/a.height.val);var c=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(c=100*c/a.height.val);var d=y(a.width.val-i.w,s,l),h=d.biasDiff,p=d.biasComplementDiff,f=y(a.height.val-i.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(i.w,a.width.val),o.x=(-h+i.x1+i.x2+p)/2,t.autoHeight=Math.max(i.h,a.height.val),o.y=(-g+i.y1+i.y2+v)/2}function y(e,t,n){var r=0,a=0,i=t+n;return e>0&&i>0&&(r=t/i*e,a=n/i*e),{biasDiff:r,biasComplementDiff:a}}}for(var r=0;r<this.length;r++){var a=this[r],i=a._private;i.compoundBoundsClean&&!e||(n(a),t.batching()||(i.compoundBoundsClean=!0))}return this};var ci=function(e){return e===1/0||e===-1/0?0:e},di=function(e,t,n,r,a){r-t!=0&&a-n!=0&&null!=t&&null!=n&&null!=r&&null!=a&&(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},hi=function(e,t){return null==t?e:di(e,t.x1,t.y1,t.x2,t.y2)},pi=function(e,t,n){return Qe(e,t,n)},fi=function(e,t,n){if(!t.cy().headless()){var r,a,i=t._private,o=i.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,a=o.srcY):"target"===n?(r=o.tgtX,a=o.tgtY):(r=o.midX,a=o.midY);var l=i.arrowBounds=i.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=a-s,u.x2=r+s,u.y2=a+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Ot(u,1),di(e,u.x1,u.y1,u.x2,u.y2)}}},gi=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var a=t._private,i=a.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=pi(i,"labelWidth",n),p=pi(i,"labelHeight",n),f=pi(i,"labelX",n),g=pi(i,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=p,C=h,S=C/2,P=k/2;if(m)o=f-S,s=f+S,l=g-P,u=g+P;else{switch(c.value){case"left":o=f-C,s=f;break;case"center":o=f-S,s=f+S;break;case"right":o=f,s=f+C}switch(d.value){case"top":l=g-k,u=g;break;case"center":l=g-P,u=g+P;break;case"bottom":l=g,u=g+k}}var D=v-Math.max(x,w)-E-2,T=v+Math.max(x,w)+E+2,_=y-Math.max(x,w)-E-2,M=y+Math.max(x,w)+E+2;o+=D,s+=T,l+=_,u+=M;var B=n||"main",N=a.labelBounds,I=N[B]=N[B]||{};I.x1=o,I.y1=l,I.x2=s,I.y2=u,I.w=s-o,I.h=u-l,I.leftPad=D,I.rightPad=T,I.topPad=_,I.botPad=M;var z=m&&"autorotate"===b.strValue,A=null!=b.pfValue&&0!==b.pfValue;if(z||A){var L=z?pi(a.rstyle,"labelAngle",n):b.pfValue,O=Math.cos(L),R=Math.sin(L),V=(o+s)/2,F=(l+u)/2;if(!m){switch(c.value){case"left":V=s;break;case"right":V=o}switch(d.value){case"top":F=u;break;case"bottom":F=l}}var j=function(e,t){return{x:(e-=V)*O-(t-=F)*R+V,y:e*R+t*O+F}},q=j(o,l),Y=j(o,u),X=j(s,l),W=j(s,u);o=Math.min(q.x,Y.x,X.x,W.x),s=Math.max(q.x,Y.x,X.x,W.x),l=Math.min(q.y,Y.y,X.y,W.y),u=Math.max(q.y,Y.y,X.y,W.y)}var H=B+"Rot",K=N[H]=N[H]||{};K.x1=o,K.y1=l,K.x2=s,K.y2=u,K.w=s-o,K.h=u-l,di(e,o,l,s,u),di(a.labelBounds.all,o,l,s,u)}return e}},vi=function(e){var t=0,n=function(e){return(e?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),(r+=n(e.includeOverlays))+n(e.includeOutlines)},yi=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return function(e){var t={value:0,done:!1},n=0,r=e.length;return Pe({next:function(){return n<r?t.value=e[n++]:t.done=!0,t}},void 0)}([r(t.x),r(t.y),r(n.x),r(n.y)])}return 0},mi=function(e,t){var n,r=e._private,a=e.isEdge(),i=(null==t?xi:vi(t))===xi,o=yi(e),s=r.bbCachePosKey===o,l=t.useCache&&s,u=function(e){return null==e._private.bbCache||e._private.styleDirty};if(!l||u(e)||a&&(u(e.source())||u(e.target()))?(s||e.recalculateRenderedStyle(l),n=function(e,t){var n,r,a,i,o,s,l,u=e._private.cy,c=u.styleEnabled(),d=u.headless(),h=zt(),p=e._private,f=e.isNode(),g=e.isEdge(),v=p.rstyle,y=f&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!g||m(e.source())&&m(e.target()));if(b){var x=0;c&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(x=e.pstyle("overlay-padding").value);var w=0;c&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(w=e.pstyle("underlay-padding").value);var E=Math.max(x,w),k=0;if(c&&(k=e.pstyle("width").pfValue/2),f&&t.includeNodes){var C=e.position();o=C.x,s=C.y;var S=e.outerWidth()/2,P=e.outerHeight()/2;di(h,n=o-S,a=s-P,r=o+S,i=s+P),c&&t.includeOutlines&&function(e,t){if(!t.cy().headless()){var n,r,a=t.pstyle("outline-opacity").value,i=t.pstyle("outline-width").value;if(a>0&&i>0){var o=t.pstyle("outline-offset").value,s=t.pstyle("shape").value,l=i+o,u=(e.w+2*l)/e.w,c=(e.h+2*l)/e.h,d=0;["diamond","pentagon","round-triangle"].includes(s)?(u=(e.w+2.4*l)/e.w,d=-l/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?u=(e.w+2.4*l)/e.w:"star"===s?(u=(e.w+2.8*l)/e.w,c=(e.h+2.6*l)/e.h,d=-l/3.8):"triangle"===s?(u=(e.w+2.8*l)/e.w,c=(e.h+2.4*l)/e.h,d=-l/1.4):"vee"===s&&(u=(e.w+4.4*l)/e.w,c=(e.h+3.8*l)/e.h,d=.5*-l);var h=e.h*c-e.h,p=e.w*u-e.w;if(Rt(e,[Math.ceil(h/2),Math.ceil(p/2)]),0!==d){var f=(r=d,{x1:(n=e).x1+0,x2:n.x2+0,y1:n.y1+r,y2:n.y2+r,w:n.w,h:n.h});At(e,f)}}}}(h,e)}else if(g&&t.includeEdges)if(c&&!d){var D=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),a=Math.min(v.srcY,v.midY,v.tgtY),i=Math.max(v.srcY,v.midY,v.tgtY),di(h,n-=k,a-=k,r+=k,i+=k),"haystack"===D){var T=v.haystackPts;if(T&&2===T.length){if(n=T[0].x,a=T[0].y,n>(r=T[1].x)){var _=n;n=r,r=_}if(a>(i=T[1].y)){var M=a;a=i,i=M}di(h,n-k,a-k,r+k,i+k)}}else if("bezier"===D||"unbundled-bezier"===D||D.endsWith("segments")||D.endsWith("taxi")){var B;switch(D){case"bezier":case"unbundled-bezier":B=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":B=v.linePts}if(null!=B)for(var N=0;N<B.length;N++){var I=B[N];n=I.x-k,r=I.x+k,a=I.y-k,i=I.y+k,di(h,n,a,r,i)}}}else{var z=e.source().position(),A=e.target().position();if((n=z.x)>(r=A.x)){var L=n;n=r,r=L}if((a=z.y)>(i=A.y)){var O=a;a=i,i=O}di(h,n-=k,a-=k,r+=k,i+=k)}if(c&&t.includeEdges&&g&&(fi(h,e,"mid-source"),fi(h,e,"mid-target"),fi(h,e,"source"),fi(h,e,"target")),c&&"yes"===e.pstyle("ghost").value){var R=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;di(h,h.x1+R,h.y1+V,h.x2+R,h.y2+V)}var F=p.bodyBounds=p.bodyBounds||{};Vt(F,h),Rt(F,y),Ot(F,1),c&&(n=h.x1,r=h.x2,a=h.y1,i=h.y2,di(h,n-E,a-E,r+E,i+E));var j=p.overlayBounds=p.overlayBounds||{};Vt(j,h),Rt(j,y),Ot(j,1);var q=p.labelBounds=p.labelBounds||{};null!=q.all?((l=q.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):q.all=zt(),c&&t.includeLabels&&(t.includeMainLabels&&gi(h,e,null),g&&(t.includeSourceLabels&&gi(h,e,"source"),t.includeTargetLabels&&gi(h,e,"target")))}return h.x1=ci(h.x1),h.y1=ci(h.y1),h.x2=ci(h.x2),h.y2=ci(h.y2),h.w=ci(h.x2-h.x1),h.h=ci(h.y2-h.y1),h.w>0&&h.h>0&&b&&(Rt(h,y),Ot(h,1)),h}(e,bi),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!i){var c=e.isNode();n=zt(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?hi(n,r.overlayBounds):hi(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?hi(n,r.labelBounds.all):(t.includeMainLabels&&hi(n,r.labelBounds.mainRot),t.includeSourceLabels&&hi(n,r.labelBounds.sourceRot),t.includeTargetLabels&&hi(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},bi={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},xi=vi(bi),wi=Ue(bi);li.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=zt();var n=wi(e=e||bi),r=this;if(r.cy().styleEnabled())for(var a=0;a<r.length;a++){var i=r[a],o=i._private,s=yi(i),l=o.bbCachePosKey===s,u=n.useCache&&l&&!o.styleDirty;i.recalculateRenderedStyle(u)}this.updateCompoundBounds(!e.useCache);for(var c=0;c<r.length;c++){var d=r[c];hi(t,mi(d,n))}}else e=void 0===e?bi:wi(e),t=mi(this[0],e);return t.x1=ci(t.x1),t.y1=ci(t.y1),t.x2=ci(t.x2),t.y2=ci(t.y2),t.w=ci(t.x2-t.x1),t.h=ci(t.y2-t.y1),t},li.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},li.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),a=n.collection();if(r&&(a=t.filter((function(e){return e.isParent()})),t=t.not(a)),E(e)){var i=e;e=function(){return i}}n.startBatch(),t.forEach((function(t,n){return t._private.bbAtOldPos=e(t,n)})).silentPositions(e),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0));var o=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}}(this.boundingBox({useCache:!1}));return t.silentPositions((function(e){return e._private.bbAtOldPos})),r&&(a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),a.updateCompoundBounds(!0)),n.endBatch(),o},si.boundingbox=si.bb=si.boundingBox,si.renderedBoundingbox=si.renderedBoundingBox;var Ei,ki,Ci=li;Ei=ki={};var Si=function(e){e.uppercaseName=L(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=L(e.outerName),Ei[e.name]=function(){var t=this[0],n=t._private,r=n.cy._private.styleEnabled;if(t){if(r){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var a=t.pstyle(e.name);return"label"===a.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):a.pfValue}return 1}},Ei["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},Ei["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},Ei["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Si({name:"width"}),Si({name:"height"}),ki.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),void 0!==t.autoPadding?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},ki.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ki.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Pi=ki,Di={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},Ti=Object.keys(Di).reduce((function(e,t){var n=Di[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),a=n.zoom();return t(e).map((function(e){return Et(e,a,r)}))}}(this,n.get)}:e[r]=function(){return function(e,t){if(e.isEdge()){var n=e.cy();return Et(t(e),n.zoom(),n.pan())}}(this,n.get)},e}),{}),_i=Y({},ui,Ci,Pi,Ti),Mi=function(e,t){this.recycle(e,t)};function Bi(){return!1}function Ni(){return!0}Mi.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Bi,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ni:Bi):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,r=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*r+a.x,y:n.y*r+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ni;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ni;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ni,this.stopPropagation()},isDefaultPrevented:Bi,isPropagationStopped:Bi,isImmediatePropagationStopped:Bi};var Ii=/^([^.]+)(\.(?:[^.]+))?$/,zi={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},Ai=Object.keys(zi),Li={};function Oi(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Li,t=arguments.length>1?arguments[1]:void 0,n=0;n<Ai.length;n++){var r=Ai[n];this[r]=e[r]||zi[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Ri=Oi.prototype,Vi=function(e,t,n,r,a,i,o){x(r)&&(a=r,r=null),o&&(i=null==i?o:Y({},i,o));for(var s=w(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!M(u)){var c=u.match(Ii);if(c&&!1===t(e,u,c[1],c[2]?c[2]:null,r,a,i))break}}},Fi=function(e,t){return e.addEventFields(e.context,t),new Mi(t.type,t)};Ri.on=Ri.addListener=function(e,t,n,r,a){return Vi(this,(function(e,t,n,r,a,i,o){x(i)&&e.listeners.push({event:t,callback:i,type:n,namespace:r,qualifier:a,conf:o})}),e,t,n,r,a),this},Ri.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Ri.removeListener=Ri.off=function(e,t,n,r){var a=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var i=this.listeners,o=function(o){var s=i[o];Vi(a,(function(t,n,r,a,l,u){if((s.type===r||"*"===e)&&(!a&&".*"!==s.namespace||s.namespace===a)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return i.splice(o,1),!1}),e,t,n,r)},s=i.length-1;s>=0;s--)o(s);return this},Ri.removeAllListeners=function(){return this.removeListener("*")},Ri.emit=Ri.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,w(t)||(t=[t]),function(e,t,n){if("event"!==m(n))if(E(n))t(e,Fi(e,n));else for(var r=w(n)?n:n.split(/\s+/),a=0;a<r.length;a++){var i=r[a];if(!M(i)){var o=i.match(Ii);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Fi(e,{type:s,namespace:l,target:e.context}))}}}else t(e,n)}(this,(function(e,i){null!=n&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var o=function(n){var a=r[n];if(a.type===i.type&&(!a.namespace||a.namespace===i.namespace||".*"===a.namespace)&&e.eventMatches(e.context,a,i)){var o=[i];null!=t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}}(o,t),e.beforeEmit(e.context,a,i),a.conf&&a.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==a})));var s=e.callbackContext(e.context,a,i),l=a.callback.apply(s,o);e.afterEmit(e.context,a,i),!1===l&&(i.stopPropagation(),i.preventDefault())}},s=0;s<a;s++)o(s);e.bubble(e.context)&&!i.isPropagationStopped()&&e.parent(e.context).emit(i,t)}),e),this.emitting--,this};var ji={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&P(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},qi=function(e){return b(e)?new qa(e):e},Yi={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Oi(ji,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=qi(t),a=0;a<this.length;a++)this[a].emitter().on(e,r,n);return this},removeListener:function(e,t,n){for(var r=qi(t),a=0;a<this.length;a++)this[a].emitter().removeListener(e,r,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var r=qi(t),a=0;a<this.length;a++)this[a].emitter().one(e,r,n);return this},once:function(e,t,n){for(var r=qi(t),a=0;a<this.length;a++)this[a].emitter().on(e,r,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};Ca.eventAliasesOn(Yi);var Xi={nodes:function(e){return this.filter((function(e){return e.isNode()})).filter(e)},edges:function(e){return this.filter((function(e){return e.isEdge()})).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(b(e)||S(e))return new qa(e).filter(this);if(x(e)){for(var n=this.spawn(),r=this,a=0;a<r.length;a++){var i=r[a];(t?e.apply(t,[i,a,r]):e(i,a,r))&&n.push(i)}return n}return this.spawn()},not:function(e){if(e){b(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n];e.has(r)||t.push(r)}return t}return this},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(b(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=e,a=this.length<e.length,i=a?this:r,o=a?r:this,s=0;s<i.length;s++){var l=i[s];o.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=e,a=function(e,t){for(var r=0;r<e.length;r++){var a=e[r],i=a._private.data.id;t.hasElementWithId(i)||n.push(a)}};return a(this,r),a(r,this),n},diff:function(e){var t=this._private.cy;b(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),a=this.spawn(),i=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r],o=i._private.data.id;t.hasElementWithId(o)?a.merge(i):n.push(i)}};return o(this,i,n),o(i,this,r),{left:n,right:r,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),a=0;a<e.length;a++){var i=e[a];!this.has(i)&&r.push(i)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&b(e)){var r=e;e=n.mutableElements().filter(r)}for(var a=t.map,i=0;i<e.length;i++){var o=e[i],s=o._private.data.id;if(!a.has(s)){var l=this.length++;this[l]=o,a.set(s,{ele:o,index:l})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var r=e===this.length-1;if(this.length>1&&!r){var a=this.length-1,i=this[a],o=i._private.data.id;this[a]=void 0,this[e]=i,n.set(o,{ele:i,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var a=r.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,a=0;a<r.length;a++){var i=r[a],o=t?e.apply(t,[i,a,r]):e(i,a,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,a=0;a<r.length;a++)n=e(n,r[a],a,r);return n},max:function(e,t){for(var n,r=-1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,a=this,i=0;i<a.length;i++){var o=a[i],s=t?e.apply(t,[o,i,a]):e(o,i,a);s<r&&(r=s,n=o)}return{value:r,ele:n}}},Wi=Xi;Wi.u=Wi["|"]=Wi["+"]=Wi.union=Wi.or=Wi.add,Wi["\\"]=Wi["!"]=Wi["-"]=Wi.difference=Wi.relativeComplement=Wi.subtract=Wi.not,Wi.n=Wi["&"]=Wi["."]=Wi.and=Wi.intersection=Wi.intersect,Wi["^"]=Wi["(+)"]=Wi["(-)"]=Wi.symmetricDifference=Wi.symdiff=Wi.xor,Wi.fnFilter=Wi.filterFn=Wi.stdFilter=Wi.filter,Wi.complement=Wi.abscomp=Wi.absoluteComplement;var Hi,Ki=function(e,t){var n=e.cy().hasCompoundNodes();function r(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?Oe:0}var a=r(e)-r(t);if(0!==a)return a;function i(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=i(e)-i(t);if(0!==o)return o;var s=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==s?s:e.poolIndex()-t.poolIndex()},Gi={forEach:function(e,t){if(x(e))for(var n=this.length,r=0;r<n;r++){var a=this[r];if(!1===(t?e.apply(t,[a,r,this]):e(a,r,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;null==t&&(t=r),null==e&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var a=e;a>=0&&a<t&&a<r;a++)n.push(this[a]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!x(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Ki)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:Oe-1}var r=t.source,a=t.target,i=r.zDepth(),o=a.zDepth();return Math.max(i,o,0)}}};Gi.each=Gi.forEach,Hi="undefined",("undefined"==typeof Symbol?"undefined":r(Symbol))!=Hi&&r(Symbol.iterator)!=Hi&&(Gi[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return s({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,(function(){return this}))});var Ui=Ue({nodeDimensionsIncludeLabels:!1}),Zi={layoutDimensions:function(e){var t;if(e=Ui(e),this.takesUpSpace())if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};else t={w:0,h:0};return 0!==t.w&&0!==t.h||(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter((function(e){return!e.isParent()})),a=this.cy(),i=t.eles,o=function(e){return e.id()},s=N(n,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!l)return null;for(var e=zt(),t=0;t<r.length;t++){var n=r[t],a=s(n,t);Lt(e,a.x,a.y)}return e}(),c=N((function(e,n){var r,a,i,o,c,d=s(e,n);return l&&(r=Math.abs(t.spacingFactor),i=d,o=(a=u).x1+a.w/2,c=a.y1+a.h/2,d={x:o+(i.x-o)*r,y:c+(i.y-c)*r}),null!=t.transform&&(d=t.transform(e,d)),d}),o);if(t.animate){for(var d=0;d<r.length;d++){var h=r[d],p=c(h,d);if(null==t.animateFilter||t.animateFilter(h,d)){var f=h.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(f)}else h.position(p)}if(t.fit){var g=a.animation({fit:{boundingBox:i.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else if(void 0!==t.zoom&&void 0!==t.pan){var v=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}e.animations.forEach((function(e){return e.play()})),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Er.all(e.animations.map((function(e){return e.promise()}))).then((function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})}))}else r.positions(c),t.fit&&a.fit(t.eles,t.padding),null!=t.zoom&&a.zoom(t.zoom),t.pan&&a.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(Y({},e,{eles:this}))}};function $i(e,t,n){var r,a=n._private,i=a.styleCache=a.styleCache||[];return null!=(r=i[e])?r:r=i[e]=t(n)}function Qi(e,t){return e=Be(e),function(n){return $i(e,t,n)}}function Ji(e,t){e=Be(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return $i(e,n,t)}}Zi.createLayout=Zi.makeLayout=Zi.layout;var eo={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),n=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(n)):this.forEach((function(e){n(e),e.connectedEdges().forEach(n)})),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=this;e=!(!e&&void 0!==e),t.hasCompoundNodes()&&(n=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var r=n;return e?r.emitAndNotify("style"):r.emit("style"),n.forEach((function(e){return e._private.styleDirty=!0})),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return null!=a?a:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(E(e)){var i=e;a.applyBypass(this,i,r),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var o=this[0];return o?a.getStylePropertyValue(o,e):void 0}a.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?a.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(void 0===e)for(var i=0;i<a.length;i++){var o=a[i];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<a.length;s++){var l=a[s];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,a=n.pstyle("opacity").value;if(!t)return a;var i=r.data.parent?n.parents():null;if(i)for(var o=0;o<i.length;o++)a*=i[o].pstyle("opacity").value;return a}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();return e?t?0===e.effectiveOpacity():0===e.pstyle("opacity").value:void 0},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function to(e,t){var n=e._private.data.parent?e.parents():null;if(n)for(var r=0;r<n.length;r++)if(!t(n[r]))return!1;return!0}function no(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var a=this[0],i=e.hasCompoundNodes();if(a){var o=a._private;if(!t(a))return!1;if(a.isNode())return!i||to(a,r);var s=o.source,l=o.target;return n(s)&&(!i||to(s,n))&&(s===l||n(l)&&(!i||to(l,n)))}}}var ro=Qi("eleTakesUpSpace",(function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())}));eo.takesUpSpace=Ji("takesUpSpace",no({ok:ro}));var ao=Qi("eleInteractive",(function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&ro(e)})),io=Qi("parentInteractive",(function(e){return"visible"===e.pstyle("visibility").value&&ro(e)}));eo.interactive=Ji("interactive",no({ok:ao,parentOk:io,edgeOkViaNode:ro})),eo.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var oo=Qi("eleVisible",(function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&ro(e)})),so=ro;eo.visible=Ji("visible",no({ok:oo,edgeOkViaNode:so})),eo.hidden=function(){var e=this[0];if(e)return!e.visible()},eo.isBundledBezier=Ji("isBundledBezier",(function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()})),eo.bypass=eo.css=eo.style,eo.renderedCss=eo.renderedStyle,eo.removeBypass=eo.removeCss=eo.removeStyle,eo.pstyle=eo.parsedStyle;var lo={};function uo(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],a=t[1];this.on(e.event,r,a)}else if(1===t.length&&x(t[0])){var i=t[0];this.on(e.event,i)}else if(0===t.length||1===t.length&&w(t[0])){for(var o=1===t.length?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var d=e.overrideAble(l);if(void 0!==d&&(u=d,!d))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var h=this.spawn(n);h.updateStyle(),h.emit(e.event),o&&h.emit(o)}return this}}function co(e){lo[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},lo[e.on]=uo({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),lo[e.off]=uo({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}co({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),co({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),co({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),co({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),lo.deselect=lo.unselect,lo.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},co({field:"active",on:"activate",off:"unactivate"}),co({field:"pannable",on:"panify",off:"unpanify"}),lo.inactive=function(){var e=this[0];if(e)return!e._private.active};var ho={},po=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r];if(a.isNode()){for(var i=!1,o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===a&&u!==a||e.noOutgoingEdges&&u===a&&c!==a){i=!0;break}}i||n.push(a)}}return this.spawn(n,!0).filter(t)}},fo=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r];if(a.isNode())for(var i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target();e.outgoing&&l===a?(n.push(s),n.push(u)):e.incoming&&u===a&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},go=function(e){return function(t){for(var n=this,r=[],a={};;){var i=e.outgoing?n.outgoers():n.incomers();if(0===i.length)break;for(var o=!1,s=0;s<i.length;s++){var l=i[s],u=l.id();a[u]||(a[u]=!0,r.push(l),o=!0)}if(!o)break;n=i}return this.spawn(r,!0).filter(t)}};function vo(e){return function(t){for(var n=[],r=0;r<this.length;r++){var a=this[r]._private[e.attr];a&&n.push(a)}return this.spawn(n,!0).filter(t)}}function yo(e){return function(t){var n=[],r=this._private.cy,a=e||{};b(t)&&(t=r.$(t));for(var i=0;i<t.length;i++)for(var o=t[i]._private.edges,s=0;s<o.length;s++){var l=o[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),d=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||d){if(a.thisIsSrc||a.thisIsTgt){if(a.thisIsSrc&&!c)continue;if(a.thisIsTgt&&!d)continue}n.push(l)}}return this.spawn(n,!0)}}function mo(e){return e=Y({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),a=e,i=0;i<r.length;i++)for(var o=r[i]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,d=0;d<c.length;d++){var h=c[d],p=h._private.data,f=p.target,g=p.source,v=f===u&&g===l,y=l===f&&u===g;(a.codirected&&v||!a.codirected&&(v||y))&&n.push(h)}return this.spawn(n,!0).filter(t)}}ho.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},Y(ho,{roots:po({noIncomingEdges:!0}),leaves:po({noOutgoingEdges:!0}),outgoers:Ka(fo({outgoing:!0}),"outgoers"),successors:go({outgoing:!0}),incomers:Ka(fo({incoming:!0}),"incomers"),predecessors:go({incoming:!0})}),Y(ho,{neighborhood:Ka((function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var a=n[r],i=a.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target(),c=a===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),ho.neighbourhood=ho.neighborhood,ho.closedNeighbourhood=ho.closedNeighborhood,ho.openNeighbourhood=ho.openNeighborhood,Y(ho,{source:Ka((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Ka((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:vo({attr:"source"}),targets:vo({attr:"target"})}),Y(ho,{edgesWith:Ka(yo(),"edgesWith"),edgesTo:Ka(yo({thisIsSrc:!0}),"edgesTo")}),Y(ho,{connectedEdges:Ka((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var a=r._private.edges,i=0;i<a.length;i++){var o=a[i];t.push(o)}}return this.spawn(t,!0).filter(e)}),"connectedEdges"),connectedNodes:Ka((function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];r.isEdge()&&(t.push(r.source()[0]),t.push(r.target()[0]))}return this.spawn(t,!0).filter(e)}),"connectedNodes"),parallelEdges:Ka(mo(),"parallelEdges"),codirectedEdges:Ka(mo({codirected:!0}),"codirectedEdges")}),Y(ho,{components:function(e){var t=this,n=t.cy(),r=n.collection(),a=null==e?t.nodes():e.nodes(),i=[];null!=e&&a.empty()&&(a=e.sources());var o=function(e,t){r.merge(e),a.unmerge(e),t.merge(e)};if(a.empty())return t.spawn();var s=function(){var e=n.collection();i.push(e);var r=a[0];o(r,e),t.bfs({directed:!1,roots:r,visit:function(t){return o(t,e)}}),e.forEach((function(n){n.connectedEdges().forEach((function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)}))}))};do{s()}while(a.length>0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),ho.componentsOf=ho.components;var bo=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var a=new et,i=!1;if(t){if(t.length>0&&E(t[0])&&!P(t[0])){i=!0;for(var o=[],s=new nt,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var d=c.data;if(null==d.id)d.id=He();else if(e.hasElementWithId(d.id)||s.has(d.id))continue;var h=new rt(e,c,!1);o.push(h),s.add(d.id)}t=o}}else t=[];this.length=0;for(var p=0,f=t.length;p<f;p++){var g=t[p][0];if(null!=g){var v=g._private.data.id;n&&a.has(v)||(n&&a.set(v,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(e){this.lazyMap=e},rebuildMap:function(){for(var e=this.lazyMap=new et,t=this.eles,n=0;n<t.length;n++){var r=t[n];e.set(r.id(),{index:n,ele:r})}}},n&&(this._private.map=a),i&&!r&&this.restore()}else qe("A collection must have a reference to the core")},xo=rt.prototype=bo.prototype=Object.create(Array.prototype);xo.instanceString=function(){return"collection"},xo.spawn=function(e,t){return new bo(this.cy(),e,t)},xo.spawnSelf=function(){return this.spawn(this)},xo.cy=function(){return this._private.cy},xo.renderer=function(){return this._private.cy.renderer()},xo.element=function(){return this[0]},xo.collection=function(){return D(this)?this:new bo(this._private.cy,[this])},xo.unique=function(){return new bo(this._private.cy,this,!0)},xo.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},xo.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new bo(t)},xo.$id=xo.getElementById,xo.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},xo.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},xo.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},xo.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(E(e)){if(n.startBatch(),e.data){t.data(e.data);var a=r.data;if(t.isEdge()){var i=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=a.source&&(o.source=""+s,i=!0),null!=l&&l!=a.target&&(o.target=""+l,i=!0),i&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||null==c&&null==a.parent||c==a.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var d=function(n,a,i){var o=e[n];null!=o&&o!==r[n]&&(o?t[a]():t[i]())};return d("removed","remove","restore"),d("selected","select","unselect"),d("selectable","selectify","unselectify"),d("locked","lock","unlock"),d("grabbable","grabify","ungrabify"),d("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:We(r.data),position:We(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:""},p=0;return r.classes.forEach((function(e){return h.classes+=0==p++?e:" "+e})),h}}},xo.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},xo.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),a=new rt(e,r,!1);t.push(a)}return new bo(e,t)},xo.copy=xo.clone,xo.restore=function(){for(var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this,i=a.cy(),o=i._private,s=[],l=[],u=0,c=a.length;u<c;u++){var d=a[u];r&&!d.removed()||(d.isNode()?s.push(d):l.push(d))}e=s.concat(l);var h=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var p=e[t],f=p._private,g=f.data;if(p.clearTraversalCache(),r||f.removed)if(void 0===g.id)g.id=He();else if(k(g.id))g.id=""+g.id;else{if(M(g.id)||!b(g.id)){qe("Can not create element with invalid string ID `"+g.id+"`"),h();continue}if(i.hasElementWithId(g.id)){qe("Can not create second element with ID `"+g.id+"`"),h();continue}}var v=g.id;if(p.isNode()){var y=f.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(p.isEdge()){for(var m=p,x=["source","target"],w=x.length,E=!1,C=0;C<w;C++){var S=x[C],P=g[S];k(P)&&(P=g[S]=""+g[S]),null==P||""===P?(qe("Can not create edge `"+v+"` with unspecified "+S),E=!0):i.hasElementWithId(P)||(qe("Can not create edge `"+v+"` with nonexistant "+S+" `"+P+"`"),E=!0)}if(E){h();continue}var D=i.getElementById(g.source),T=i.getElementById(g.target);D.same(T)?D._private.edges.push(m):(D._private.edges.push(m),T._private.edges.push(m)),m._private.source=D,m._private.target=T}f.map=new et,f.map.set(v,{ele:p,index:0}),f.removed=!1,r&&i.addToPool(p)}for(var _=0;_<s.length;_++){var B=s[_],N=B._private.data;k(N.parent)&&(N.parent=""+N.parent);var I=N.parent;if(null!=I||B._private.parent){var z=B._private.parent?i.collection().merge(B._private.parent):i.getElementById(I);if(z.empty())N.parent=void 0;else if(z[0].removed())Xe("Node added with missing parent, reference to parent removed"),N.parent=void 0,B._private.parent=null;else{for(var A=!1,L=z;!L.empty();){if(B.same(L)){A=!0,N.parent=void 0;break}L=L.parent()}A||(z[0]._private.children.push(B),B._private.parent=z[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var O=e.length===a.length?a:new bo(i,e),R=0;R<O.length;R++){var V=O[R];V.isNode()||(V.parallelEdges().clearTraversalCache(),V.source().clearTraversalCache(),V.target().clearTraversalCache())}(o.hasCompoundNodes?i.collection().merge(O).merge(O.connectedNodes()).merge(O.parent()):O).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?O.emitAndNotify("add"):r&&O.emit("add")}return a},xo.removed=function(){var e=this[0];return e&&e._private.removed},xo.inside=function(){var e=this[0];return e&&!e._private.removed},xo.remove=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],a={},i=n._private.cy;function o(e){var n=a[e.id()];t&&e.removed()||n||(a[e.id()]=!0,e.isNode()?(r.push(e),function(e){for(var t=e._private.edges,n=0;n<t.length;n++)o(t[n])}(e),function(e){for(var t=e._private.children,n=0;n<t.length;n++)o(t[n])}(e)):r.unshift(e))}for(var s=0,l=n.length;s<l;s++)o(n[s]);function u(e,t){var n=e._private.edges;Ze(n,t),e.clearTraversalCache()}function c(e){e.clearTraversalCache()}var d=[];function h(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();Ze(n,t),t._private.parent=null,d.ids[r]||(d.ids[r]=!0,d.push(e))}d.ids={},n.dirtyCompoundBoundsCache(),t&&i.removeFromPool(r);for(var p=0;p<r.length;p++){var f=r[p];if(f.isEdge()){var g=f.source()[0],v=f.target()[0];u(g,f),u(v,f);for(var y=f.parallelEdges(),m=0;m<y.length;m++){var b=y[m];c(b),b.isBundledBezier()&&b.dirtyBoundingBoxCache()}}else{var x=f.parent();0!==x.length&&h(x,f)}t&&(f._private.removed=!0)}var w=i._private.elements;i._private.hasCompoundNodes=!1;for(var E=0;E<w.length;E++)if(w[E].isParent()){i._private.hasCompoundNodes=!0;break}var k=new bo(this.cy(),r);k.size()>0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var C=0;C<d.length;C++){var S=d[C];t&&S.removed()||S.updateStyle()}return k},xo.move=function(e){var t=this._private.cy,n=this,r=!1,a=!1,i=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var o=i(e.source),s=i(e.target),l=null!=o&&t.hasElementWithId(o),u=null!=s&&t.hasElementWithId(s);(l||u)&&(t.batch((function(){n.remove(r,a),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],i=t._private.data;t.isEdge()&&(l&&(i.source=o),u&&(i.target=s))}n.restore(r,a)})),n.emitAndNotify("move"))}else if(void 0!==e.parent){var c=i(e.parent);if(null===c||t.hasElementWithId(c)){var d=null===c?void 0:c;t.batch((function(){var e=n.remove(r,a);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var i=n[t],o=i._private.data;i.isNode()&&(o.parent=d)}e.restore(r,a)})),n.emitAndNotify("move")}}return this},[gr,Sa,Pa,Xa,Ga,ti,ni,_i,Yi,Xi,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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}},Gi,Zi,eo,lo,ho].forEach((function(e){Y(xo,e)}));var wo={add:function(e){var t,n=this;if(S(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var a=[],i=0;i<r.length;i++){var o=r[i];a.push(o.json())}t=new bo(n,a)}}else if(w(e))t=new bo(n,e);else if(E(e)&&(w(e.nodes)||w(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,d=u.length;c<d;c++){var h=u[c],p=s[h];if(w(p))for(var f=0,g=p.length;f<g;f++){var v=Y({group:h},p[f]);l.push(v)}}t=new bo(n,l)}else t=new rt(n,e).collection();return t},remove:function(e){if(S(e));else if(b(e)){var t=e;e=this.$(t)}return e.remove()}};function Eo(e,t,n,r){var a=.1,i="undefined"!=typeof Float32Array;if(4!==arguments.length)return!1;for(var o=0;o<4;++o)if("number"!=typeof arguments[o]||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var s=i?new Float32Array(11):new Array(11);function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function c(e){return 3*e}function d(e,t,n){return((l(t,n)*e+u(t,n))*e+c(t))*e}function h(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+c(t)}var p=!1;var f=function(i){return p||(p=!0,e===t&&n===r||function(){for(var t=0;t<11;++t)s[t]=d(t*a,e,n)}()),e===t&&n===r?i:0===i?0:1===i?1:d(function(t){for(var r=0,i=1;10!==i&&s[i]<=t;++i)r+=a;--i;var o=r+(t-s[i])/(s[i+1]-s[i])*a,l=h(o,e,n);return l>=.001?function(t,r){for(var a=0;a<4;++a){var i=h(r,e,n);if(0===i)return r;r-=(d(r,e,n)-t)/i}return r}(t,o):0===l?o:function(t,r,a){var i,o,s=0;do{(i=d(o=r+(a-r)/2,e,n)-t)>0?a=o:r=o}while(Math.abs(i)>1e-7&&++s<10);return o}(t,r,r+a)}(i),t,r)};f.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var g="generateBezier("+[e,t,n,r]+")";return f.toString=function(){return g},f}var ko=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var a={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function n(n,r){var a={dx:n.v,dv:e(n)},i=t(n,.5*r,a),o=t(n,.5*r,i),s=t(n,r,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,a){var i,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,d=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,a=a||null,l.tension=t,l.friction=r,o=(i=null!==a)?(c=e(t,r))/a*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>d&&Math.abs(s.v)>d;);return i?function(e){return u[e*(u.length-1)|0]}:c}}(),Co=function(e,t,n,r){var a=Eo(e,t,n,r);return function(e,t,n){return e+(t-e)*a(n)}},So={linear:function(e,t,n){return e+(t-e)*n},ease:Co(.25,.1,.25,1),"ease-in":Co(.42,0,1,1),"ease-out":Co(0,0,.58,1),"ease-in-out":Co(.42,0,.58,1),"ease-in-sine":Co(.47,0,.745,.715),"ease-out-sine":Co(.39,.575,.565,1),"ease-in-out-sine":Co(.445,.05,.55,.95),"ease-in-quad":Co(.55,.085,.68,.53),"ease-out-quad":Co(.25,.46,.45,.94),"ease-in-out-quad":Co(.455,.03,.515,.955),"ease-in-cubic":Co(.55,.055,.675,.19),"ease-out-cubic":Co(.215,.61,.355,1),"ease-in-out-cubic":Co(.645,.045,.355,1),"ease-in-quart":Co(.895,.03,.685,.22),"ease-out-quart":Co(.165,.84,.44,1),"ease-in-out-quart":Co(.77,0,.175,1),"ease-in-quint":Co(.755,.05,.855,.06),"ease-out-quint":Co(.23,1,.32,1),"ease-in-out-quint":Co(.86,0,.07,1),"ease-in-expo":Co(.95,.05,.795,.035),"ease-out-expo":Co(.19,1,.22,1),"ease-in-out-expo":Co(1,0,0,1),"ease-in-circ":Co(.6,.04,.98,.335),"ease-out-circ":Co(.075,.82,.165,1),"ease-in-out-circ":Co(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return So.linear;var r=ko(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Co};function Po(e,t,n,r,a){if(1===r)return n;if(t===n)return n;var i=a(t,n,r);return null==e||((e.roundValue||e.color)&&(i=Math.round(i)),void 0!==e.min&&(i=Math.max(i,e.min)),void 0!==e.max&&(i=Math.min(i,e.max))),i}function Do(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function To(e,t,n,r,a){var i=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var o=Do(e,a),s=Do(t,a);if(k(o)&&k(s))return Po(i,o,s,n,r);if(w(o)&&w(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],d=s[u];if(null!=c&&null!=d){var h=Po(i,c,d,n,r);l.push(h)}else l.push(d)}return l}}function _o(e,t,n,r){var a=!r,i=e._private,o=t._private,s=o.easing,l=o.startTime,u=(r?e:e.cy()).style();if(!o.easingImpl)if(null==s)o.easingImpl=So.linear;else{var c,d,h;c=b(s)?u.parse("transition-timing-function",s).value:s,b(c)?(d=c,h=[]):(d=c[1],h=c.slice(2).map((function(e){return+e}))),h.length>0?("spring"===d&&h.push(o.duration),o.easingImpl=So[d].apply(null,h)):o.easingImpl=So[d]}var p,f=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var g=o.startPosition,v=o.position;if(v&&a&&!e.locked()){var y={};Mo(g.x,v.x)&&(y.x=To(g.x,v.x,p,f)),Mo(g.y,v.y)&&(y.y=To(g.y,v.y,p,f)),e.position(y)}var m=o.startPan,x=o.pan,w=i.pan,E=null!=x&&r;E&&(Mo(m.x,x.x)&&(w.x=To(m.x,x.x,p,f)),Mo(m.y,x.y)&&(w.y=To(m.y,x.y,p,f)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(Mo(k,C)&&(i.zoom=It(i.minZoom,To(k,C,p,f),i.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var P=o.style;if(P&&P.length>0&&a){for(var D=0;D<P.length;D++){var T=P[D],_=T.name,M=T,B=o.startStyle[_],N=To(B,M,p,f,u.properties[B.name]);u.overrideBypass(e,_,N)}e.emit("style")}}return o.progress=p,p}function Mo(e,t){return!!(null!=e&&null!=t&&(k(e)&&k(t)||e&&t))}function Bo(e,t,n,r){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}function No(e,t){var n=t._private.aniEles,r=[];function a(t,n){var a=t._private,i=a.animation.current,o=a.animation.queue,s=!1;if(0===i.length){var l=o.shift();l&&i.push(l)}for(var u=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=i.length-1;c>=0;c--){var d=i[c],h=d._private;h.stopped?(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||Bo(0,d,e),_o(t,d,e,n),h.applying&&(h.applying=!1),u(h.frames),null!=h.step&&h.step(e),d.completed()&&(i.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.completes)),s=!0)}return n||0!==i.length||0!==o.length||r.push(t),s}for(var i=!1,o=0;o<n.length;o++){var s=a(n[o]);i=i||s}var l=a(t,!0);(i||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Io={animate:Ca.animate(),animation:Ca.animation(),animated:Ca.animated(),clearQueue:Ca.clearQueue(),delay:Ca.delay(),delayAnimation:Ca.delayAnimation(),stop:Ca.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){No(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&Ee((function(n){No(n,e),t()}))}()}}},zo={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&P(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Ao=function(e){return b(e)?new qa(e):e},Lo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Oi(zo,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ao(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ao(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ao(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ao(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Ca.eventAliasesOn(Lo);var Oo={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};Oo.jpeg=Oo.jpg;var Ro={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n,r=e.name,a=t.extension("layout",r);if(null!=a)return n=b(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new a(Y({},e,{cy:t,eles:n}));qe("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?")}else qe("A `name` must be specified to make a layout");else qe("Layout options must be specified to make a layout")}};Ro.createLayout=Ro.makeLayout=Ro.layout;var Vo={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var a=n[r],i=e[a];t.getElementById(a).data(i)}}))}},Fo=Ue({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),jo={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(null!=n){void 0!==e.wheelSensitivity&&Xe("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Fo(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else qe("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"))},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};jo.invalidateDimensions=jo.resize;var qo={collection:function(e,t){return b(e)?this.$(e):S(e)?e.collection():w(e)?(t||(t={}),new bo(this,e,t.unique,t.removed)):new bo(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};qo.elements=qo.filter=qo.$;var Yo={},Xo="t";Yo.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var a=e[r],i=t.getContextMeta(a);if(!i.empty){var o=t.getContextStyle(i),s=t.applyContextStyle(i,o,a);a._private.appliedInitStyle?t.updateTransitions(a,s.diffProps):a._private.appliedInitStyle=!0,t.updateStyleHints(a)&&n.push(a)}}return n},Yo.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},a=e+"-"+t,i=r[a];if(i)return i;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Xo,d=t[l]===Xo,h=c!==d,p=u.mappedProperties.length>0;if(h||d&&p){var f=void 0;h&&p||h?f=u.properties:p&&(f=u.mappedProperties);for(var g=0;g<f.length;g++){for(var v=f[g],y=v.name,m=!1,b=l+1;b<n.length;b++){var x=n[b];if(t[b]===Xo&&(m=null!=x.properties[v.name]))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[a]=o,o},Yo.getContextMeta=function(e){for(var t,n=this,r="",a=e._private.styleCxtKey||"",i=0;i<n.length;i++){var o=n[i];r+=o.selector&&o.selector.matches(e)?Xo:"f"}return t=n.getPropertiesDiff(a,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},Yo.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var r={_private:{key:t}},a=0;a<this.length;a++){var i=this[a];if(t[a]===Xo)for(var o=0;o<i.properties.length;o++){var s=i.properties[o];r[s.name]=s}}return n[t]=r,r},Yo.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,a={},i=this.types,o=0;o<r.length;o++){var s=r[o],l=t[s],u=n.pstyle(s);if(!l){if(!u)continue;l=u.bypass?{name:s,deleteBypassed:!0}:{name:s,delete:!0}}if(u!==l){if(l.mapped===i.fn&&null!=u&&null!=u.mapping&&u.mapping.value===l.value){var c=u.mapping;if((c.fnValue=l.value(n))===c.prevFnValue)continue}var d=a[s]={prev:u};this.applyParsedProperty(n,l),d.next=n.pstyle(s),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:a}},Yo.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,a=n.propertyGroupKeys,i=function(e,t,r){return n.getPropertiesHash(e,t,r)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;r=Object.keys(l);for(var u=0;u<a.length;u++){var c=a[u];t.styleKeys[c]=[Ce,Se]}for(var d,h=function(e,n){return t.styleKeys[n][0]=De(e,t.styleKeys[n][0])},p=function(e,n){return t.styleKeys[n][1]=Te(e,t.styleKeys[n][1])},f=function(e,t){h(e,t),p(e,t)},g=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),p(r,t)}},v=0;v<r.length;v++){var y=r[v],m=l[y];if(null!=m){var b=this.properties[y],x=b.type,w=b.groupKey,E=void 0;null!=b.hashOverride?E=b.hashOverride(e,m):null!=m.pfValue&&(E=m.pfValue);var k=null==b.enums?m.value:null,C=null!=E,S=C||null!=k,P=m.units;x.number&&S&&!x.multiple?(f(-128<(d=C?E:k)&&d<128&&Math.floor(d)!==d?2e9-(1024*d|0):d,w),C||null==P||g(P,w)):g(m.strValue,w)}}for(var D=[Ce,Se],T=0;T<a.length;T++){var _=a[T],M=t.styleKeys[_];D[0]=De(M[0],D[0]),D[1]=Te(M[1],D[1])}t.styleKey=2097152*D[0]+D[1];var B=t.styleKeys;t.labelDimsKey=_e(B.labelDimensions);var N=i(e,["label"],B.labelDimensions);if(t.labelKey=_e(N),t.labelStyleKey=_e(Me(B.commonLabel,N)),!s){var I=i(e,["source-label"],B.labelDimensions);t.sourceLabelKey=_e(I),t.sourceLabelStyleKey=_e(Me(B.commonLabel,I));var z=i(e,["target-label"],B.labelDimensions);t.targetLabelKey=_e(z),t.targetLabelStyleKey=_e(Me(B.commonLabel,z))}if(s){var A=t.styleKeys,L=A.nodeBody,O=A.nodeBorder,R=A.nodeOutline,V=A.backgroundImage,F=A.compound,j=A.pie,q=[L,O,R,V,F,j].filter((function(e){return null!=e})).reduce(Me,[Ce,Se]);t.nodeKey=_e(q),t.hasPie=null!=j&&j[0]!==Ce&&j[1]!==Se}return o!==t.styleKey},Yo.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},Yo.applyParsedProperty=function(e,t){var n,r=this,a=t,i=e._private.style,o=r.types,s=r.properties[a.name].type,l=a.bypass,u=i[a.name],c=u&&u.bypass,d=e._private,h="mapping",p=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},f=function(){var t=p(u),n=p(a);r.checkTriggers(e,a.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(a=t=this.parse(t.name,"bezier",l)),a.delete)return i[a.name]=void 0,f(),!0;if(a.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,f(),!0):(f(),!0);if(a.deleteBypass)return u?!!u.bypass&&(i[a.name]=u.bypassed,f(),!0):(f(),!0);var g=function(){Xe("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:for(var v,y=a.field.split("."),m=d.data,b=0;b<y.length&&m;b++)m=m[y[b]];if(null==m)return g(),!1;if(!k(m))return Xe("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var x=a.fieldMax-a.fieldMin;if((v=0===x?0:(m-a.fieldMin)/x)<0?v=0:v>1&&(v=1),s.color){var w=a.valueMin[0],E=a.valueMax[0],C=a.valueMin[1],S=a.valueMax[1],P=a.valueMin[2],D=a.valueMax[2],T=null==a.valueMin[3]?1:a.valueMin[3],_=null==a.valueMax[3]?1:a.valueMax[3],M=[Math.round(w+(E-w)*v),Math.round(C+(S-C)*v),Math.round(P+(D-P)*v),Math.round(T+(_-T)*v)];n={bypass:a.bypass,name:a.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var B=a.valueMin+(a.valueMax-a.valueMin)*v;n=this.parse(a.name,B,a.bypass,h)}if(!n)return g(),!1;n.mapping=a,a=n;break;case o.data:for(var N=a.field.split("."),I=d.data,z=0;z<N.length&&I;z++)I=I[N[z]];if(null!=I&&(n=this.parse(a.name,I,a.bypass,h)),!n)return g(),!1;n.mapping=a,a=n;break;case o.fn:var A=a.value,L=null!=a.fnValue?a.fnValue:A(e);if(a.prevFnValue=L,null==L)return Xe("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(a.name,L,a.bypass,h)))return Xe("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=We(a),a=n;break;case void 0:break;default:return!1}return l?(a.bypassed=c?u.bypassed:u,i[a.name]=a):c?u.bypassed=a:i[a.name]=a,f(),!0},Yo.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),t)for(var a=r._private.style,i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],l=a[s];null!=l&&(l.bypass?l.bypassed=null:a[s]=null)}else r._private.style={}}},Yo.update=function(){this._private.cy.mutableElements().updateStyle()},Yo.updateTransitions=function(e,t){var n=this,r=e._private,a=e.pstyle("transition-property").value,i=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(a.length>0&&i>0){for(var s={},l=!1,u=0;u<a.length;u++){var c=a[u],d=e.pstyle(c),h=t[c];if(h){var p=h.prev,f=null!=h.next?h.next:d,g=!1,v=void 0,y=1e-6;p&&(k(p.pfValue)&&k(f.pfValue)?(g=f.pfValue-p.pfValue,v=p.pfValue+y*g):k(p.value)&&k(f.value)?(g=f.value-p.value,v=p.value+y*g):w(p.value)&&w(f.value)&&(g=p.value[0]!==f.value[0]||p.value[1]!==f.value[1]||p.value[2]!==f.value[2],v=p.strValue),g&&(s[c]=f.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new Er((function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},Yo.checkTrigger=function(e,t,n,r,a,i){var o=this.properties[t],s=a(o);null!=s&&s(n,r)&&i(o)},Yo.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){a._private.cy.notify("zorder",e)}))},Yo.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),!a.triggersBoundsOfParallelBeziers||"curve-style"!==t||"bezier"!==n&&"bezier"!==r||e.parallelEdges().forEach((function(e){e.dirtyBoundingBoxCache()})),!a.triggersBoundsOfConnectedEdges||"display"!==t||"none"!==n&&"none"!==r||e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Yo.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Wo={applyBypass:function(e,t,n,r){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var i=0;i<this.properties.length;i++){var o=this.properties[i].name,s=this.parse(o,n,!0);s&&a.push(s)}}else if(b(t)){var l=this.parse(t,n,!0);l&&a.push(l)}else{if(!E(t))return!1;var u=t;r=n;for(var c=Object.keys(u),d=0;d<c.length;d++){var h=c[d],p=u[h];if(void 0===p&&(p=u[z(h)]),void 0!==p){var f=this.parse(h,p,!0);f&&a.push(f)}}}if(0===a.length)return!1;for(var g=!1,v=0;v<e.length;v++){for(var y=e[v],m={},x=void 0,w=0;w<a.length;w++){var k=a[w];if(r){var C=y.pstyle(k.name);x=m[k.name]={prev:C}}g=this.applyParsedProperty(y,We(k))||g,r&&(x.next=y.pstyle(k.name))}g&&this.updateStyleHints(y),r&&this.updateTransitions(y,m,!0)}return g},overrideBypass:function(e,t,n){t=I(t);for(var r=0;r<e.length;r++){var a=e[r],i=a._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=i?null!=i.pfValue?i.pfValue:i.value:null;i&&i.bypass?(i.value=n,null!=i.pfValue&&(i.pfValue=n),i.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(a)):this.applyBypass(a,t,n),this.checkTriggers(a,t,u,n)}},removeAllBypasses:function(e,t){return this.removeBypasses(e,this.propertyNames,t)},removeBypasses:function(e,t,n){for(var r=0;r<e.length;r++){for(var a=e[r],i={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=a.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),d=i[l.name]={prev:u};this.applyParsedProperty(a,c),d.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,i,!0)}}},Ho={getEmSizeInPixels:function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},containerCss:function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)}},Ko={getRenderedStyle:function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},getRawStyle:function(e,t){var n=this;if(e=e[0]){for(var r={},a=0;a<n.properties.length;a++){var i=n.properties[a],o=n.getStylePropertyValue(e,i.name,t);null!=o&&(r[i.name]=o,r[z(i.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var a=e.pstyle(t)[n][r];return null!=a?a:e.cy().style().getDefaultProperty(t)[n][0]},getStylePropertyValue:function(e,t,n){if(e=e[0]){var r=this.properties[t];r.alias&&(r=r.pointsTo);var a=r.type,i=e.pstyle(r.name);if(i){var o=i.value,s=i.units,l=i.strValue;if(n&&a.number&&null!=o&&k(o)){var u=e.cy().zoom(),c=function(e){return e*u},d=function(e,t){return c(e)+t},h=w(o);return(h?s.every((function(e){return null!=e})):null!=s)?h?o.map((function(e,t){return d(e,s[t])})).join(" "):d(o,s):h?o.map((function(e){return b(e)?e:""+c(e)})).join(" "):""+c(o)}if(null!=l)return l}return null}},getAnimationStartStyle:function(e,t){for(var n={},r=0;r<t.length;r++){var a=t[r].name,i=e.pstyle(a);void 0!==i&&(i=E(i)?this.parse(a,i.strValue):this.parse(a,i)),i&&(n[a]=i)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var a=Object.keys(n),i=0;i<a.length;i++){var o=a[i],s=n[o],l=r[o]||r[I(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,a,i,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(a=e.pstyle(r,!1)))if(null!=a.pfValue)u[0]=De(o,u[0]),u[1]=Te(o,u[1]);else for(i=a.strValue,l=0;l<i.length;l++)o=i.charCodeAt(l),u[0]=De(o,u[0]),u[1]=Te(o,u[1]);return u}};Ko.getPropertiesHash=Ko.getNonDefaultPropertiesHash;var Go={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],a=r.selector,i=r.style||r.css,o=Object.keys(i);t.selector(a);for(var s=0;s<o.length;s++){var l=o[s],u=i[l];t.css(l,u)}}return t},fromJson:function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},json:function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,a=n.properties,i={},o=0;o<a.length;o++){var s=a[o];i[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:i})}return e}},Uo={appendFromString:function(e){var t,n,r,a=this,i=""+e;function o(){i=i.length>t.length?i.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var l=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){Xe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=l[0];var u=l[1];if("core"!==u&&new qa(u).invalid)Xe("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();else{var c=l[2],d=!1;n=c;for(var h=[];!n.match(/^\s*$/);){var p=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Xe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=p[0];var f=p[1],g=p[2];this.properties[f]?a.parse(f,g)?(h.push({name:f,val:g}),s()):(Xe("Skipping property: Invalid property definition in: "+r),s()):(Xe("Skipping property: Invalid property name in: "+r),s())}if(d){o();break}a.selector(u);for(var v=0;v<h.length;v++){var y=h[v];a.css(y.name,y.val)}o()}}return a},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},Zo={};!function(){var e=O,t=V,n=j,r=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},a=function(r){var a=e+"|\\w+|"+t+"|"+n+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+r+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+a+")\\s*\\,\\s*("+a+")\\)$"},i=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Zo.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:r("data")},layoutData:{mapping:!0,regex:r("layoutData")},scratch:{mapping:!0,regex:r("scratch")},mapData:{mapping:!0,regex:a("mapData")},mapLayoutData:{mapping:!0,regex:a("mapLayoutData")},mapScratch:{mapping:!0,regex:a("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:i,singleRegexMatchValue:!0},urls:{regexes:i,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return b(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(e){var t=e.length;return 1===t||2===t||4===t}}};var o={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=M(e),r=M(t);return n&&!r||!n&&r}},s=Zo.types,l=[{name:"label",type:s.text,triggersBounds:o.any,triggersZOrder:o.emptyNonEmpty},{name:"text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any}],u=[{name:"source-label",type:s.text,triggersBounds:o.any},{name:"source-text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"source-text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"source-text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"source-text-offset",type:s.size,triggersBounds:o.any}],c=[{name:"target-label",type:s.text,triggersBounds:o.any},{name:"target-text-rotation",type:s.textRotation,triggersBounds:o.any},{name:"target-text-margin-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"target-text-margin-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"target-text-offset",type:s.size,triggersBounds:o.any}],d=[{name:"font-family",type:s.fontFamily,triggersBounds:o.any},{name:"font-style",type:s.fontStyle,triggersBounds:o.any},{name:"font-weight",type:s.fontWeight,triggersBounds:o.any},{name:"font-size",type:s.size,triggersBounds:o.any},{name:"text-transform",type:s.textTransform,triggersBounds:o.any},{name:"text-wrap",type:s.textWrap,triggersBounds:o.any},{name:"text-overflow-wrap",type:s.textOverflowWrap,triggersBounds:o.any},{name:"text-max-width",type:s.size,triggersBounds:o.any},{name:"text-outline-width",type:s.size,triggersBounds:o.any},{name:"line-height",type:s.positiveNumber,triggersBounds:o.any}],h=[{name:"text-valign",type:s.valign,triggersBounds:o.any},{name:"text-halign",type:s.halign,triggersBounds:o.any},{name:"color",type:s.color},{name:"text-outline-color",type:s.color},{name:"text-outline-opacity",type:s.zeroOneNumber},{name:"text-background-color",type:s.color},{name:"text-background-opacity",type:s.zeroOneNumber},{name:"text-background-padding",type:s.size,triggersBounds:o.any},{name:"text-border-opacity",type:s.zeroOneNumber},{name:"text-border-color",type:s.color},{name:"text-border-width",type:s.size,triggersBounds:o.any},{name:"text-border-style",type:s.borderStyle,triggersBounds:o.any},{name:"text-background-shape",type:s.textBackgroundShape,triggersBounds:o.any},{name:"text-justification",type:s.justification}],p=[{name:"events",type:s.bool,triggersZOrder:o.any},{name:"text-events",type:s.bool,triggersZOrder:o.any}],f=[{name:"display",type:s.display,triggersZOrder:o.any,triggersBounds:o.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:s.visibility,triggersZOrder:o.any},{name:"opacity",type:s.zeroOneNumber,triggersZOrder:o.zeroNonZero},{name:"text-opacity",type:s.zeroOneNumber},{name:"min-zoomed-font-size",type:s.size},{name:"z-compound-depth",type:s.zCompoundDepth,triggersZOrder:o.any},{name:"z-index-compare",type:s.zIndexCompare,triggersZOrder:o.any},{name:"z-index",type:s.number,triggersZOrder:o.any}],g=[{name:"overlay-padding",type:s.size,triggersBounds:o.any},{name:"overlay-color",type:s.color},{name:"overlay-opacity",type:s.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"overlay-shape",type:s.overlayShape,triggersBounds:o.any},{name:"overlay-corner-radius",type:s.cornerRadius}],v=[{name:"underlay-padding",type:s.size,triggersBounds:o.any},{name:"underlay-color",type:s.color},{name:"underlay-opacity",type:s.zeroOneNumber,triggersBounds:o.zeroNonZero},{name:"underlay-shape",type:s.overlayShape,triggersBounds:o.any},{name:"underlay-corner-radius",type:s.cornerRadius}],y=[{name:"transition-property",type:s.propList},{name:"transition-duration",type:s.time},{name:"transition-delay",type:s.time},{name:"transition-timing-function",type:s.easing}],m=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},x=[{name:"height",type:s.nodeSize,triggersBounds:o.any,hashOverride:m},{name:"width",type:s.nodeSize,triggersBounds:o.any,hashOverride:m},{name:"shape",type:s.nodeShape,triggersBounds:o.any},{name:"shape-polygon-points",type:s.polygonPointList,triggersBounds:o.any},{name:"corner-radius",type:s.cornerRadius},{name:"background-color",type:s.color},{name:"background-fill",type:s.fill},{name:"background-opacity",type:s.zeroOneNumber},{name:"background-blacken",type:s.nOneOneNumber},{name:"background-gradient-stop-colors",type:s.colors},{name:"background-gradient-stop-positions",type:s.percentages},{name:"background-gradient-direction",type:s.gradientDirection},{name:"padding",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"padding-relative-to",type:s.paddingRelativeTo,triggersBounds:o.any},{name:"bounds-expansion",type:s.boundsExpansion,triggersBounds:o.any}],w=[{name:"border-color",type:s.color},{name:"border-opacity",type:s.zeroOneNumber},{name:"border-width",type:s.size,triggersBounds:o.any},{name:"border-style",type:s.borderStyle},{name:"border-cap",type:s.lineCap},{name:"border-join",type:s.lineJoin},{name:"border-dash-pattern",type:s.numbers},{name:"border-dash-offset",type:s.number},{name:"border-position",type:s.linePosition}],E=[{name:"outline-color",type:s.color},{name:"outline-opacity",type:s.zeroOneNumber},{name:"outline-width",type:s.size,triggersBounds:o.any},{name:"outline-style",type:s.borderStyle},{name:"outline-offset",type:s.size,triggersBounds:o.any}],k=[{name:"background-image",type:s.urls},{name:"background-image-crossorigin",type:s.bgCrossOrigin},{name:"background-image-opacity",type:s.zeroOneNumbers},{name:"background-image-containment",type:s.bgContainment},{name:"background-image-smoothing",type:s.bools},{name:"background-position-x",type:s.bgPos},{name:"background-position-y",type:s.bgPos},{name:"background-width-relative-to",type:s.bgRelativeTo},{name:"background-height-relative-to",type:s.bgRelativeTo},{name:"background-repeat",type:s.bgRepeat},{name:"background-fit",type:s.bgFit},{name:"background-clip",type:s.bgClip},{name:"background-width",type:s.bgWH},{name:"background-height",type:s.bgWH},{name:"background-offset-x",type:s.bgPos},{name:"background-offset-y",type:s.bgPos}],C=[{name:"position",type:s.position,triggersBounds:o.any},{name:"compound-sizing-wrt-labels",type:s.compoundIncludeLabels,triggersBounds:o.any},{name:"min-width",type:s.size,triggersBounds:o.any},{name:"min-width-bias-left",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-width-bias-right",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-height",type:s.size,triggersBounds:o.any},{name:"min-height-bias-top",type:s.sizeMaybePercent,triggersBounds:o.any},{name:"min-height-bias-bottom",type:s.sizeMaybePercent,triggersBounds:o.any}],S=[{name:"line-style",type:s.lineStyle},{name:"line-color",type:s.color},{name:"line-fill",type:s.fill},{name:"line-cap",type:s.lineCap},{name:"line-opacity",type:s.zeroOneNumber},{name:"line-dash-pattern",type:s.numbers},{name:"line-dash-offset",type:s.number},{name:"line-outline-width",type:s.size},{name:"line-outline-color",type:s.color},{name:"line-gradient-stop-colors",type:s.colors},{name:"line-gradient-stop-positions",type:s.percentages},{name:"curve-style",type:s.curveStyle,triggersBounds:o.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:s.zeroOneNumber,triggersBounds:o.any},{name:"source-endpoint",type:s.edgeEndpoint,triggersBounds:o.any},{name:"target-endpoint",type:s.edgeEndpoint,triggersBounds:o.any},{name:"control-point-step-size",type:s.size,triggersBounds:o.any},{name:"control-point-distances",type:s.bidirectionalSizes,triggersBounds:o.any},{name:"control-point-weights",type:s.numbers,triggersBounds:o.any},{name:"segment-distances",type:s.bidirectionalSizes,triggersBounds:o.any},{name:"segment-weights",type:s.numbers,triggersBounds:o.any},{name:"segment-radii",type:s.numbers,triggersBounds:o.any},{name:"radius-type",type:s.radiusType,triggersBounds:o.any},{name:"taxi-turn",type:s.bidirectionalSizeMaybePercent,triggersBounds:o.any},{name:"taxi-turn-min-distance",type:s.size,triggersBounds:o.any},{name:"taxi-direction",type:s.axisDirection,triggersBounds:o.any},{name:"taxi-radius",type:s.number,triggersBounds:o.any},{name:"edge-distances",type:s.edgeDistances,triggersBounds:o.any},{name:"arrow-scale",type:s.positiveNumber,triggersBounds:o.any},{name:"loop-direction",type:s.angle,triggersBounds:o.any},{name:"loop-sweep",type:s.angle,triggersBounds:o.any},{name:"source-distance-from-node",type:s.size,triggersBounds:o.any},{name:"target-distance-from-node",type:s.size,triggersBounds:o.any}],P=[{name:"ghost",type:s.bool,triggersBounds:o.any},{name:"ghost-offset-x",type:s.bidirectionalSize,triggersBounds:o.any},{name:"ghost-offset-y",type:s.bidirectionalSize,triggersBounds:o.any},{name:"ghost-opacity",type:s.zeroOneNumber}],D=[{name:"selection-box-color",type:s.color},{name:"selection-box-opacity",type:s.zeroOneNumber},{name:"selection-box-border-color",type:s.color},{name:"selection-box-border-width",type:s.size},{name:"active-bg-color",type:s.color},{name:"active-bg-opacity",type:s.zeroOneNumber},{name:"active-bg-size",type:s.size},{name:"outside-texture-bg-color",type:s.color},{name:"outside-texture-bg-opacity",type:s.zeroOneNumber}],T=[];Zo.pieBackgroundN=16,T.push({name:"pie-size",type:s.sizeMaybePercent});for(var _=1;_<=Zo.pieBackgroundN;_++)T.push({name:"pie-"+_+"-background-color",type:s.color}),T.push({name:"pie-"+_+"-background-size",type:s.percent}),T.push({name:"pie-"+_+"-background-opacity",type:s.zeroOneNumber});var B=[],N=Zo.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:s.arrowShape,triggersBounds:o.any},{name:"arrow-color",type:s.color},{name:"arrow-fill",type:s.arrowFill},{name:"arrow-width",type:s.arrowWidth}].forEach((function(e){N.forEach((function(t){var n=t+"-"+e.name,r=e.type,a=e.triggersBounds;B.push({name:n,type:r,triggersBounds:a})}))}),{});var I=Zo.properties=[].concat(p,y,f,g,v,P,h,d,l,u,c,x,w,E,k,T,C,S,B,D),z=Zo.propertyGroups={behavior:p,transition:y,visibility:f,overlay:g,underlay:v,ghost:P,commonLabel:h,labelDimensions:d,mainLabel:l,sourceLabel:u,targetLabel:c,nodeBody:x,nodeBorder:w,nodeOutline:E,backgroundImage:k,pie:T,compound:C,edgeLine:S,edgeArrow:B,core:D},A=Zo.propertyGroupNames={};(Zo.propertyGroupKeys=Object.keys(z)).forEach((function(e){A[e]=z[e].map((function(e){return e.name})),z[e].forEach((function(t){return t.groupKey=e}))}));var L=Zo.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Zo.propertyNames=I.map((function(e){return e.name}));for(var R=0;R<I.length;R++){var F=I[R];I[F.name]=F}for(var q=0;q<L.length;q++){var Y=L[q],X=I[Y.pointsTo],W={name:Y.name,alias:!0,pointsTo:X};I.push(W),I[Y.name]=W}}(),Zo.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Zo.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=Y({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce((function(e,t){for(var n=1;n<=Zo.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),a=t.value;e[r]=a}return e}),{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce((function(e,t){return Zo.arrowPrefixes.forEach((function(n){var r=n+"-"+t.name,a=t.value;e[r]=a})),e}),{})),n={},r=0;r<this.properties.length;r++){var a=this.properties[r];if(!a.pointsTo){var i=a.name,o=t[i],s=this.parse(i,o);n[i]=s}}return e.defaultProperties=n,e.defaultProperties},Zo.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 $o={parse:function(e,t,n,r){var a=this;if(x(t))return a.parseImplWarn(e,t,n,r);var i,o=Ne(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),s=a.propCache=a.propCache||[];return(i=s[o])||(i=s[o]=a.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(i=We(i))&&(i.value=We(i.value)),i},parseImplWarn:function(e,t,n,r){var a=this.parseImpl(e,t,n,r);return a||null==t||Xe("The style property `".concat(e,": ").concat(t,"` is invalid")),!a||"width"!==a.name&&"height"!==a.name||"label"!==t||Xe("The style value of `label` is deprecated for `"+a.name+"`"),a}};$o.parseImpl=function(e,t,n,r){var a=this;e=I(e);var i=a.properties[e],o=t,s=a.types;if(!i)return null;if(void 0===t)return null;i.alias&&(i=i.pointsTo,e=i.name);var l=b(t);l&&(t=t.trim());var u,c,d=i.type;if(!d)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(x(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!l||r||t.length<7||"a"!==t[1]);else{if(t.length>=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:u,strValue:""+t,mapped:h,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var p=s.mapData;if(!d.color&&!d.number)return!1;var f=this.parse(e,c[4]);if(!f||f.mapped)return!1;var g=this.parse(e,c[5]);if(!g||g.mapped)return!1;if(f.pfValue===g.pfValue||f.strValue===g.strValue)return Xe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(d.color){var v=f.value,y=g.value;if(!(v[0]!==y[0]||v[1]!==y[1]||v[2]!==y[2]||v[3]!==y[3]&&(null!=v[3]&&1!==v[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:f.value,valueMax:g.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):w(t)?t:[t],d.evenMultiple&&m.length%2!=0)return null;for(var E=[],C=[],S=[],P="",D=!1,T=0;T<m.length;T++){var _=a.parse(e,m[T],n,"multiple");D=D||b(_.value),E.push(_.value),S.push(null!=_.pfValue?_.pfValue:_.value),C.push(_.units),P+=(T>0?" ":"")+_.strValue}return d.validate&&!d.validate(E,C)?null:d.singleEnum&&D?1===E.length&&b(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:S,strValue:P,bypass:n,units:C}}var M,B,N,z=function(){for(var r=0;r<d.enums.length;r++)if(d.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(d.number){var A,L="px";if(d.units&&(A=d.units),d.implicitUnits&&(L=d.implicitUnits),!d.unitless)if(l){var V="px|em"+(d.allowPercent?"|\\%":"");A&&(V=A);var j=t.match("^("+O+")("+V+")?$");j&&(t=j[1],A=j[2]||L)}else A&&!d.implicitUnits||(A=L);if(t=parseFloat(t),isNaN(t)&&void 0===d.enums)return null;if(isNaN(t)&&void 0!==d.enums)return t=o,z();if(d.integer&&(!k(B=t)||Math.floor(B)!==B))return null;if(void 0!==d.min&&(t<d.min||d.strictMin&&t===d.min)||void 0!==d.max&&(t>d.max||d.strictMax&&t===d.max))return null;var q={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return d.unitless||"px"!==A&&"em"!==A?q.pfValue=t:q.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,"ms"!==A&&"s"!==A||(q.pfValue="ms"===A?t:1e3*t),"deg"!==A&&"rad"!==A||(q.pfValue="rad"===A?t:(M=t,Math.PI*M/180)),"%"===A&&(q.pfValue=t/100),q}if(d.propList){var Y=[],W=""+t;if("none"===W);else{for(var H=W.split(/\s*,\s*|\s+/),K=0;K<H.length;K++){var G=H[K].trim();a.properties[G]?Y.push(G):Xe("`"+G+"` is not a valid property name")}if(0===Y.length)return null}return{name:e,value:Y,strValue:0===Y.length?"none":Y.join(" "),bypass:n}}if(d.color){var U=(w(N=t)?N:null)||function(e){return X[e.toLowerCase()]}(N)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r,a=16;return 4===e.length?(t=parseInt(e[1]+e[1],a),n=parseInt(e[2]+e[2],a),r=parseInt(e[3]+e[3],a)):(t=parseInt(e[1]+e[2],a),n=parseInt(e[3]+e[4],a),r=parseInt(e[5]+e[6],a)),[t,n,r]}}(N)||function(e){var t,n=new RegExp("^"+R+"$").exec(e);if(n){t=[];for(var r=[],a=1;a<=3;a++){var i=n[a];if("%"===i[i.length-1]&&(r[a]=!0),i=parseFloat(i),r[a]&&(i=i/100*255),i<0||i>255)return;t.push(Math.floor(i))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t}(N)||function(e){var t,n,r,a,i,o,s,l;function u(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+F+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(a=parseFloat(c[3]))<0||a>100)return;if(a/=100,void 0!==(i=c[4])&&((i=parseFloat(i))<0||i>1))return;if(0===r)o=s=l=Math.round(255*a);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;o=Math.round(255*u(h,d,n+1/3)),s=Math.round(255*u(h,d,n)),l=Math.round(255*u(h,d,n-1/3))}t=[o,s,l,i]}return t}(N);return U?{name:e,value:U,pfValue:U,strValue:"rgb("+U[0]+","+U[1]+","+U[2]+")",bypass:n}:null}if(d.regex||d.regexes){if(d.enums){var Z=z();if(Z)return Z}for(var $=d.regexes?d.regexes:[d.regex],Q=0;Q<$.length;Q++){var J=new RegExp($[Q]).exec(t);if(J)return{name:e,value:d.singleRegexMatchValue?J[1]:J,strValue:""+t,bypass:n}}return null}return d.string?{name:e,value:""+t,strValue:""+t,bypass:n}:d.enums?z():null};var Qo=function e(t){if(!(this instanceof e))return new e(t);T(t)?(this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()):qe("A style must have a core reference")},Jo=Qo.prototype;Jo.instanceString=function(){return"style"},Jo.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach((function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1})),this},Jo.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Jo.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Jo.selector=function(e){var t="core"===e?null:new qa(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Jo.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var r=this.properties[n],a=t[r.name];void 0===a&&(a=t[z(r.name)]),void 0!==a&&this.cssRule(r.name,a)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},Jo.style=Jo.css,Jo.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},Jo.append=function(e){return _(e)?e.appendToStyle(this):w(e)?this.appendFromJson(e):b(e)&&this.appendFromString(e),this},Qo.fromJson=function(e,t){var n=new Qo(e);return n.fromJson(t),n},Qo.fromString=function(e,t){return new Qo(e).fromString(t)},[Yo,Wo,Ho,Ko,Go,Uo,Zo,$o].forEach((function(e){Y(Jo,e)})),Qo.types=Jo.types,Qo.properties=Jo.properties,Qo.propertyGroups=Jo.propertyGroups,Qo.propertyGroupNames=Jo.propertyGroupNames,Qo.propertyGroupKeys=Jo.propertyGroupKeys;var es={style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return _(e)?t.style=e.generateStyle(this):w(e)?t.style=Qo.fromJson(this,e):b(e)?t.style=Qo.fromString(this,e):t.style=Qo(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},ts={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return null==t.selectionType&&(t.selectionType="single"),void 0===e?t.selectionType:("additive"!==e&&"single"!==e||(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,r,a,i=arguments,o=this._private.pan;switch(i.length){case 0:return o;case 1:if(b(i[0]))return o[e=i[0]];if(E(i[0])){if(!this._private.panningEnabled)return this;r=(n=i[0]).x,a=n.y,k(r)&&(o.x=r),k(a)&&(o.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;t=i[1],"x"!==(e=i[0])&&"y"!==e||!k(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,a,i,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:E(e)&&(i=(a=s[0]).x,o=a.y,k(i)&&(l.x+=i),k(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!k(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(k(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(b(e)){var a=e;e=this.$(a)}else if(E(r=e)&&k(r.x1)&&k(r.x2)&&k(r.y1)&&k(r.y2)){var i=e;(n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else S(e)||(e=this.mutableElements());if(!S(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),l=this.height();if(t=k(t)?t:0,!isNaN(s)&&!isNaN(l)&&s>0&&l>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(l-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)<this._private.minZoom?this._private.minZoom:o,pan:{x:(s-o*(n.x1+n.x2))/2,y:(l-o*(n.y1+n.y2))/2}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var r=e;e=r.min,t=r.max}return k(e)&&k(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):k(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:k(t)&&void 0===e&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,a=r.pan,i=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),k(e)?n=e:E(e)&&(n=e.level,null!=e.position?t=Et(e.position,i,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)<r.minZoom?r.minZoom:n,o||!k(n)||n===i||null!=t&&(!k(t.x)||!k(t.y)))return null;if(null!=t){var s=a,l=i,u=n;return{zoomed:!0,panned:!0,zoom:u,pan:{x:-u/l*(t.x-s.x)+t.x,y:-u/l*(t.y-s.y)+t.y}}}return{zoomed:!0,panned:!1,zoom:n,pan:a}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed?(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this):this},viewport:function(e){var t=this._private,n=!0,r=!0,a=[],i=!1,o=!1;if(!e)return this;if(k(e.zoom)||(n=!1),E(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?i=!0:(t.zoom=s,a.push("zoom"))}if(r&&(!i||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;k(l.x)&&(t.pan.x=l.x,o=!1),k(l.y)&&(t.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(b(e)){var n=e;e=this.mutableElements().filter(n)}else S(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),a=this.width(),i=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(i-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};ts.centre=ts.center,ts.autolockNodes=ts.autolock,ts.autoungrabifyNodes=ts.autoungrabify;var ns={data:Ca.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ca.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ca.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ca.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ns.attr=ns.data,ns.removeAttr=ns.removeData;var rs=function(e){var t=this,n=(e=Y({},e)).container;n&&!C(n)&&C(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var i=void 0!==h&&void 0!==n&&!e.headless,o=e;o.layout=Y({name:i?"grid":"null"},o.layout),o.renderer=Y({name:i?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new bo(this),listeners:[],aniEles:new bo(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?i:o.styleEnabled,zoom:k(o.zoom)?o.zoom:1,pan:{x:E(o.pan)&&k(o.pan.x)?o.pan.x:0,y:E(o.pan)&&k(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=Y({},o,o.renderer);t.initRenderer(u),function(e,t){if(e.some(B))return Er.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],i=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(E(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var i=Y({},t._private.options.layout);i.eles=t.elements(),t.layout(i).run()}(i,(function(){t.startAnimationLoop(),l.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e<a.length;e++){var n=a[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")}),o.done)}))},as=rs.prototype;Y(as,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){if(null==this._private.container)return h;var e=this._private.container.ownerDocument;return void 0===e||null==e?h:e.defaultView||h},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!C(e)&&C(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(Y({},r,r.renderer,{name:"null"===r.renderer.name?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return We(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(E(e)){if(t.startBatch(),e.elements){var a={},i=function(e,n){for(var r=[],i=[],o=0;o<e.length;o++){var s=e[o];if(s.data.id){var l=""+s.data.id,u=t.getElementById(l);a[l]=!0,0!==u.length?i.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}else Xe("cy.json() cannot handle elements without an ID attribute")}t.add(r);for(var c=0;c<i.length;c++){var d=i[c],h=d.ele,p=d.json;h.json(p)}};if(w(e.elements))i(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];w(u)&&i(u,l)}var c=t.collection();r.filter((function(e){return!a[e.id()]})).forEach((function(e){e.isParent()?c.merge(e):e.remove()})),c.forEach((function(e){return e.children().move({parent:null})})),c.forEach((function(e){return function(e){return t.getElementById(e.id())}(e).remove()}))}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x===n.pan.x&&e.pan.y===n.pan.y||t.pan(e.pan)),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var p=d[h];null!=e[p]&&t[p](e[p])}return t.endBatch(),this}var f={};e?f.elements=this.elements().map((function(e){return e.json()})):(f.elements={},r.forEach((function(e){var t=e.group();f.elements[t]||(f.elements[t]=[]),f.elements[t].push(e.json())}))),this._private.styleEnabled&&(f.style=t.style().json()),f.data=We(t.data());var g=n.options;return f.zoomingEnabled=n.zoomingEnabled,f.userZoomingEnabled=n.userZoomingEnabled,f.zoom=n.zoom,f.minZoom=n.minZoom,f.maxZoom=n.maxZoom,f.panningEnabled=n.panningEnabled,f.userPanningEnabled=n.userPanningEnabled,f.pan=We(n.pan),f.boxSelectionEnabled=n.boxSelectionEnabled,f.renderer=We(g.renderer),f.hideEdgesOnViewport=g.hideEdgesOnViewport,f.textureOnViewport=g.textureOnViewport,f.wheelSensitivity=g.wheelSensitivity,f.motionBlur=g.motionBlur,f.multiClickDebounceTime=g.multiClickDebounceTime,f}}),as.$id=as.getElementById,[wo,Io,Lo,Oo,Ro,Vo,jo,qo,es,ts,ns].forEach((function(e){Y(as,e)}));var is={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},os={maximal:!1,acyclic:!1},ss=function(e){return e.scratch("breadthfirst")},ls=function(e,t){return e.scratch("breadthfirst",t)};function us(e){this.options=Y({},is,os,e)}us.prototype.run=function(){var e,t=this.options,n=t,r=t.cy,a=n.eles,i=a.nodes().filter((function(e){return!e.isParent()})),o=a,s=n.directed,l=n.acyclic||n.maximal||n.maximalAdjustments>0,u=zt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(S(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],d=0;d<n.roots.length;d++){var h=n.roots[d],p=r.getElementById(h);c.push(p)}e=r.collection(c)}else if(b(n.roots))e=r.$(n.roots);else if(s)e=i.roots();else{var f=a.components();e=r.collection();for(var g=function(t){var n=f[t],r=n.maxDegree(!1),a=n.filter((function(e){return e.degree(!1)===r}));e=e.add(a)},v=0;v<f.length;v++)g(v)}var y=[],m={},x=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),ls(e,{index:n,depth:t})};o.bfs({roots:e,directed:n.directed,visit:function(e,t,n,r,a){var i=e[0],o=i.id();x(i,a),m[o]=!0}});for(var E=[],k=0;k<i.length;k++){var C=i[k];m[C.id()]||E.push(C)}var P=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?ls(r,{depth:e,index:n}):(t.splice(n,1),n--)}},D=function(){for(var e=0;e<y.length;e++)P(e)},T=function(e,t){for(var r=ss(e),i=e.incomers().filter((function(e){return e.isNode()&&a.has(e)})),o=-1,s=e.id(),l=0;l<i.length;l++){var u=i[l],c=ss(u);o=Math.max(o,c.depth)}if(r.depth<=o){if(!n.acyclic&&t[s])return null;var d=o+1;return function(e,t){var n=ss(e),r=n.depth,a=n.index;y[r][a]=null,x(e,t)}(e,d),t[s]=d,!0}return!1};if(s&&l){var _=[],M={},B=function(e){return _.push(e)};for(i.forEach((function(e){return _.push(e)}));_.length>0;){var N=_.shift(),I=T(N,M);if(I)N.outgoers().filter((function(e){return e.isNode()&&a.has(e)})).forEach(B);else if(null===I){Xe("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}D();var z=0;if(n.avoidOverlap)for(var A=0;A<i.length;A++){var L=i[A].layoutDimensions(n),O=L.w,R=L.h;z=Math.max(z,O,R)}var V={},F=function(e){if(V[e.id()])return V[e.id()];for(var t=ss(e).depth,n=e.neighborhood(),r=0,a=0,o=0;o<n.length;o++){var s=n[o];if(!s.isEdge()&&!s.isParent()&&i.has(s)){var l=ss(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var d=y[c].length;c<t&&(r+=u/d,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),V[e.id()]=r,r},j=function(e,t){var n=F(e)-F(t);return 0===n?q(e.id(),t.id()):n};void 0!==n.depthSort&&(j=n.depthSort);for(var Y=0;Y<y.length;Y++)y[Y].sort(j),P(Y);for(var X=[],W=0;W<E.length;W++)X.push(E[W]);y.unshift(X),D();for(var H=0,K=0;K<y.length;K++)H=Math.max(y[K].length,H);var G=u.x1+u.w/2,U=u.x1+u.h/2,Z=y.reduce((function(e,t){return Math.max(e,t.length)}),0);return a.nodes().layoutPositions(this,n,(function(e){var t=ss(e),r=t.depth,a=t.index,i=y[r].length,o=Math.max(u.w/((n.grid?Z:i)+1),z),s=Math.max(u.h/(y.length+1),z),l=Math.min(u.w/2/y.length,u.h/2/y.length);if(l=Math.max(l,z),n.circle){var c=l*r+l-(y.length>0&&y[0].length<=3?l/2:0),d=2*Math.PI/y[r].length*a;return 0===r&&1===y[0].length&&(c=1),{x:G+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:G+(a+1-(i+1)/2)*o,y:(r+1)*s}})),this};var cs={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ds(e){this.options=Y({},cs,e)}ds.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));for(var o,s=zt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l=s.x1+s.w/2,u=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/i.length:t.sweep)/Math.max(1,i.length-1),d=0,h=0;h<i.length;h++){var p=i[h].layoutDimensions(t),f=p.w,g=p.h;d=Math.max(d,f,g)}if(o=k(t.radius)?t.radius:i.length<=1?0:Math.min(s.h,s.w)/2-d,i.length>1&&t.avoidOverlap){d*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(a?1:-1),i=o*Math.cos(r),s=o*Math.sin(r);return{x:l+i,y:u+s}})),this};var hs,ps={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function fs(e){this.options=Y({},ps,e)}fs.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,i=a.nodes().not(":parent"),o=zt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,l=o.y1+o.h/2,u=[],c=0,d=0;d<i.length;d++){var h,p=i[d];h=t.concentric(p),u.push({value:h,node:p}),p._private.scratch.concentric=h}i.updateStyle();for(var f=0;f<i.length;f++){var g=i[f].layoutDimensions(t);c=Math.max(c,g.w,g.h)}u.sort((function(e,t){return t.value-e.value}));for(var v=t.levelWidth(i),y=[[]],m=y[0],b=0;b<u.length;b++){var x=u[b];m.length>0&&Math.abs(m[0].value-x.value)>=v&&(m=[],y.push(m)),m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S<y.length;S++){var P=y[S],D=void 0===t.sweep?2*Math.PI-2*Math.PI/P.length:t.sweep,T=P.dTheta=D/Math.max(1,P.length-1);if(P.length>1&&t.avoidOverlap){var _=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(_*_+M*M));C=Math.max(B,C)}P.r=C,C+=w}if(t.equidistant){for(var N=0,I=0,z=0;z<y.length;z++){var A=y[z].r-I;N=Math.max(N,A)}I=0;for(var L=0;L<y.length;L++){var O=y[L];0===L&&(I=O.r),O.r=I,I+=N}}for(var R={},V=0;V<y.length;V++)for(var F=y[V],j=F.dTheta,q=F.r,Y=0;Y<F.length;Y++){var X=F[Y],W=t.startAngle+(n?1:-1)*j*Y,H={x:s+q*Math.cos(W),y:l+q*Math.sin(W)};R[X.node.id()]=H}return a.nodes().layoutPositions(this,t,(function(e){var t=e.id();return R[t]})),this};var gs={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function vs(e){this.options=Y({},gs,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter((function(e){var n=e.source().data("id"),r=e.target().data("id"),a=t.some((function(e){return e.data("id")===n})),i=t.some((function(e){return e.data("id")===r}));return!a||!i}));this.options.eles=this.options.eles.not(n)}vs.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,!0!==e.animate&&!1!==e.animate||n.emit({type:"layoutstart",layout:n}),hs=!0===e.debug;var r=ys(t,n,e);hs&&(void 0)(r),e.randomize&&xs(r);var a=ke(),i=function(){Es(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter||(ks(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)i(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),a=ws(r,e,t);t.layoutPositions(n,e,a)}},l=0,u=!0;if(!0===e.animate)!function t(){for(var n=0;u&&n<e.refresh;)u=o(l),l++,n++;u?(ke()-a>=e.animationThreshold&&i(),Ee(t)):(As(r,e),s())}();else{for(;u;)u=o(l),l++;As(r,e),s()}return this},vs.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},vs.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ys=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),i=zt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],d=0;d<c.length;d++)l[c[d].id()]=u;for(u=0;u<o.nodeSize;u++){var h=(y=a[u]).layoutDimensions(n);(z={}).isLocked=y.locked(),z.id=y.data("id"),z.parentId=y.data("parent"),z.cmptId=l[y.id()],z.children=[],z.positionX=y.position("x"),z.positionY=y.position("y"),z.offsetX=0,z.offsetY=0,z.height=h.w,z.width=h.h,z.maxX=z.positionX+z.width/2,z.minX=z.positionX-z.width/2,z.maxY=z.positionY+z.height/2,z.minY=z.positionY-z.height/2,z.padLeft=parseFloat(y.style("padding")),z.padRight=parseFloat(y.style("padding")),z.padTop=parseFloat(y.style("padding")),z.padBottom=parseFloat(y.style("padding")),z.nodeRepulsion=x(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(z),o.idToIndex[z.id]=u}var p=[],f=0,g=-1,v=[];for(u=0;u<o.nodeSize;u++){var y,m=(y=o.layoutNodes[u]).parentId;null!=m?o.layoutNodes[o.idToIndex[m]].children.push(y.id):(p[++g]=y.id,v.push(y.id))}for(o.graphSet.push(v);f<=g;){var b=p[f++],w=o.idToIndex[b],E=o.layoutNodes[w].children;if(E.length>0)for(o.graphSet.push(E),u=0;u<E.length;u++)p[++g]=E[u]}for(u=0;u<o.graphSet.length;u++){var k=o.graphSet[u];for(d=0;d<k.length;d++){var C=o.idToIndex[k[d]];o.indexToGraph[C]=u}}for(u=0;u<o.edgeSize;u++){var S=r[u],P={};P.id=S.data("id"),P.sourceId=S.data("source"),P.targetId=S.data("target");var D=x(n.idealEdgeLength)?n.idealEdgeLength(S):n.idealEdgeLength,T=x(n.edgeElasticity)?n.edgeElasticity(S):n.edgeElasticity,_=o.idToIndex[P.sourceId],M=o.idToIndex[P.targetId];if(o.indexToGraph[_]!=o.indexToGraph[M]){for(var B=ms(P.sourceId,P.targetId,o),N=o.graphSet[B],I=0,z=o.layoutNodes[_];-1===N.indexOf(z.id);)z=o.layoutNodes[o.idToIndex[z.parentId]],I++;for(z=o.layoutNodes[M];-1===N.indexOf(z.id);)z=o.layoutNodes[o.idToIndex[z.parentId]],I++;D*=I*n.nestingFactor}P.idealLength=D,P.elasticity=T,o.layoutEdges.push(P)}return o},ms=function(e,t,n){var r=bs(e,t,0,n);return 2>r.count?0:r.graph},bs=function e(t,n,r,a){var i=a.graphSet[r];if(-1<i.indexOf(t)&&-1<i.indexOf(n))return{count:2,graph:r};for(var o=0,s=0;s<i.length;s++){var l=i[s],u=a.idToIndex[l],c=a.layoutNodes[u].children;if(0!==c.length){var d=e(t,n,a.indexToGraph[a.idToIndex[c[0]]],a);if(0!==d.count){if(1!==d.count)return d;if(2==++o)break}}}return{count:o,graph:r}},xs=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,a=0;a<e.nodeSize;a++){var i=e.layoutNodes[a];0!==i.children.length||i.isLocked||(i.positionX=Math.random()*n,i.positionY=Math.random()*r)}},ws=function(e,t,n){var r=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach((function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];a.x1=Math.min(a.x1,n.positionX),a.x2=Math.max(a.x2,n.positionX),a.y1=Math.min(a.y1,n.positionY),a.y2=Math.max(a.y2,n.positionY)})),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(n,i){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=(o.positionX-a.x1)/a.w,l=(o.positionY-a.y1)/a.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},Es=function(e,t,n){var r=n.layout,a=n.eles.nodes(),i=ws(e,n,a);a.positions(i),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ks=function(e,t,n){Cs(e,t),_s(e),Ms(e,t),Bs(e),Ns(e)},Cs=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],a=r.length,i=0;i<a;i++)for(var o=e.layoutNodes[e.idToIndex[r[i]]],s=i+1;s<a;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Ps(o,l,e,t)}},Ss=function(e){return-e+2*e*Math.random()},Ps=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var a=t.positionX-e.positionX,i=t.positionY-e.positionY;0===a&&0===i&&(a=Ss(1),i=Ss(1));var o=Ds(e,t,a,i);if(o>0)var s=(u=r.nodeOverlap*o)*a/(g=Math.sqrt(a*a+i*i)),l=u*i/g;else{var u,c=Ts(e,a,i),d=Ts(t,-1*a,-1*i),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,g=Math.sqrt(f);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/f)*h/g,l=u*p/g}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Ds=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else a=t.maxX-e.minX;if(r>0)var i=e.maxY-t.minY;else i=t.maxY-e.minY;return a>=0&&i>=0?Math.sqrt(a*a+i*i):0},Ts=function(e,t,n){var r=e.positionX,a=e.positionY,i=e.height||1,o=e.width||1,s=n/t,l=i/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=a+i/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=a+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=a-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+i*t/2/n,u.y=a+i/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-i*t/2/n,u.y=a-i/2,u):u},_s=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],a=e.idToIndex[r.sourceId],i=e.layoutNodes[a],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-i.positionX,u=s.positionY-i.positionY;if(0!==l||0!==u){var c=Ts(i,l,u),d=Ts(s,-1*l,-1*u),h=d.x-c.x,p=d.y-c.y,f=Math.sqrt(h*h+p*p),g=Math.pow(r.idealLength-f,2)/r.elasticity;if(0!==f)var v=g*h/f,y=g*p/f;else v=0,y=0;i.isLocked||(i.offsetX+=v,i.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},Ms=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],a=r.length;if(0===n)var i=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]];i=l.positionX,o=l.positionY}for(var u=0;u<a;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var d=i-c.positionX,h=o-c.positionY,p=Math.sqrt(d*d+h*h);if(p>1){var f=t.gravity*d/p,g=t.gravity*h/p;c.offsetX+=f,c.offsetY+=g}}}}},Bs=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var i=n[r++],o=e.idToIndex[i],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,d=0;d<l.length;d++){var h=e.layoutNodes[e.idToIndex[l[d]]];h.offsetX+=u,h.offsetY+=c,n[++a]=l[d]}s.offsetX=0,s.offsetY=0}}},Ns=function(e,t){for(var n=0;n<e.nodeSize;n++)0<(a=e.layoutNodes[n]).children.length&&(a.maxX=void 0,a.minX=void 0,a.maxY=void 0,a.minY=void 0);for(n=0;n<e.nodeSize;n++)if(!(0<(a=e.layoutNodes[n]).children.length||a.isLocked)){var r=Is(a.offsetX,a.offsetY,e.temperature);a.positionX+=r.x,a.positionY+=r.y,a.offsetX=0,a.offsetY=0,a.minX=a.positionX-a.width,a.maxX=a.positionX+a.width,a.minY=a.positionY-a.height,a.maxY=a.positionY+a.height,zs(a,e)}for(n=0;n<e.nodeSize;n++){var a;0<(a=e.layoutNodes[n]).children.length&&!a.isLocked&&(a.positionX=(a.maxX+a.minX)/2,a.positionY=(a.maxY+a.minY)/2,a.width=a.maxX-a.minX,a.height=a.maxY-a.minY)}},Is=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var a={x:n*e/r,y:n*t/r};else a={x:e,y:t};return a},zs=function e(t,n){var r=t.parentId;if(null!=r){var a=n.layoutNodes[n.idToIndex[r]],i=!1;return(null==a.maxX||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,i=!0),(null==a.minX||t.minX-a.padLeft<a.minX)&&(a.minX=t.minX-a.padLeft,i=!0),(null==a.maxY||t.maxY+a.padBottom>a.maxY)&&(a.maxY=t.maxY+a.padBottom,i=!0),(null==a.minY||t.minY-a.padTop<a.minY)&&(a.minY=t.minY-a.padTop,i=!0),i?e(a,n):void 0}},As=function(e,t){for(var n=e.layoutNodes,r=[],a=0;a<n.length;a++){var i=n[a],o=i.cmptId;(r[o]=r[o]||[]).push(i)}var s=0;for(a=0;a<r.length;a++)if(g=r[a]){g.x1=1/0,g.x2=-1/0,g.y1=1/0,g.y2=-1/0;for(var l=0;l<g.length;l++){var u=g[l];g.x1=Math.min(g.x1,u.positionX-u.width/2),g.x2=Math.max(g.x2,u.positionX+u.width/2),g.y1=Math.min(g.y1,u.positionY-u.height/2),g.y2=Math.max(g.y2,u.positionY+u.height/2)}g.w=g.x2-g.x1,g.h=g.y2-g.y1,s+=g.w*g.h}r.sort((function(e,t){return t.w*t.h-e.w*e.h}));var c=0,d=0,h=0,p=0,f=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(a=0;a<r.length;a++){var g;if(g=r[a]){for(l=0;l<g.length;l++)(u=g[l]).isLocked||(u.positionX+=c-g.x1,u.positionY+=d-g.y1);c+=g.w+t.componentSpacing,h+=g.w+t.componentSpacing,p=Math.max(p,g.h),h>f&&(d+=p+t.componentSpacing,c=0,h=0,p=0)}}},Ls={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Os(e){this.options=Y({},Ls,e)}Os.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var i=zt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===i.h||0===i.w)r.nodes().layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}));else{var o=a.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},d=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},h=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=p)l=h,u=p;else if(null!=h&&null==p)l=h,u=Math.ceil(o/l);else if(null==h&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var f=c(),g=d();(f-1)*g>=o?c(f-1):(g-1)*f>=o&&d(g-1)}else for(;u*l<o;){var v=c(),y=d();(y+1)*v>=o?d(y+1):c(v+1)}var m=i.w/u,b=i.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x<a.length;x++){var w=a[x],E=w._private.position;null!=E.x&&null!=E.y||(E.x=0,E.y=0);var k=w.layoutDimensions(t),C=t.avoidOverlapPadding,S=k.w+C,P=k.h+C;m=Math.max(m,S),b=Math.max(b,P)}for(var D={},T=function(e,t){return!!D["c-"+e+"-"+t]},_=function(e,t){D["c-"+e+"-"+t]=!0},M=0,B=0,N=function(){++B>=u&&(B=0,M++)},I={},z=0;z<a.length;z++){var A=a[z],L=t.position(A);if(L&&(void 0!==L.row||void 0!==L.col)){var O={row:L.row,col:L.col};if(void 0===O.col)for(O.col=0;T(O.row,O.col);)O.col++;else if(void 0===O.row)for(O.row=0;T(O.row,O.col);)O.row++;I[A.id()]=O,_(O.row,O.col)}}a.layoutPositions(this,t,(function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var a=I[e.id()];if(a)n=a.col*m+m/2+i.x1,r=a.row*b+b/2+i.y1;else{for(;T(M,B);)N();n=B*m+m/2+i.x1,r=M*b+b/2+i.y1,_(M,B),N()}return{x:n,y:r}}))}return this};var Rs={ready:function(){},stop:function(){}};function Vs(e){this.options=Y({},Rs,e)}Vs.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions((function(){return{x:0,y:0}})),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},Vs.prototype.stop=function(){return this};var Fs={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function js(e){this.options=Y({},Fs,e)}js.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=x(e.positions);return t.layoutPositions(this,e,(function(t,r){var a=function(t){if(null==e.positions)return function(e){return{x:e.x,y:e.y}}(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}(t);return!t.locked()&&null!=a&&a})),this};var qs={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ys(e){this.options=Y({},qs,e)}Ys.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=zt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,(function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}})),this};var Xs=[{name:"breadthfirst",impl:us},{name:"circle",impl:ds},{name:"concentric",impl:fs},{name:"cose",impl:vs},{name:"grid",impl:Os},{name:"null",impl:Vs},{name:"preset",impl:js},{name:"random",impl:Ys}];function Ws(e){this.options=e,this.notifications=0}var Hs=function(){},Ks=function(){throw new Error("A headless instance can not render images")};Ws.prototype={recalculateRenderedStyle:Hs,notify:function(){this.notifications++},init:Hs,isHeadless:function(){return!0},png:Ks,jpg:Ks};var Gs={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,a,i,o){var s=a.x-n/2-o,l=a.x+n/2+o,u=a.y-n/2-o,c=a.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,a){var i=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:i*n+a.x,y:o+a.y}},a=function(e,t,n,a){for(var i=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];i.push(r(s,l,t,n,a))}return i},i=function(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];t.push(r.x,r.y)}return t},o=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},s=function(r,s){b(s)&&(s=e[s]),e[r]=Y({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=i(a(this.points,n+2*s,r,o));return Gt(e,t,l)},roughCollide:n,draw:function(e,n,r,i){var o=a(this.points,n,r,i);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:Ve,roughCollide:Ve,draw:je,spacing:Fe,gap:Fe}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(e,n,i,o,s){var l=a(this.points,n,i,o),u=this.controlPoint,c=r(u[0],u[1],n,i,o);t.arrowShapeImpl(this.name)(e,l,c)},gap:function(e){return.8*o(e)}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,r,o,s,l){var u=i(a(this.points,n+2*l,r,o)),c=i(a(this.pointsTee,n+2*l,r,o));return Gt(e,t,u)||Gt(e,t,c)},draw:function(e,n,r,i,o){var s=a(this.points,n,r,i),l=a(this.pointsTee,n,r,i);t.arrowShapeImpl(this.name)(e,s,l)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,r,o,s,l){var u=o,c=Math.pow(u.x-e,2)+Math.pow(u.y-t,2)<=Math.pow((n+2*l)*this.radius,2),d=i(a(this.points,n+2*l,r,o));return Gt(e,t,d)||c},draw:function(e,n,r,i,o){var s=a(this.pointsTr,n,r,i);t.arrowShapeImpl(this.name)(e,s,i.x,i.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),r=t/e;return n[3]=n[3]-r,n[5]=n[5]-r,n},collide:function(e,t,n,r,o,s,l){var u=i(a(this.points,n+2*l,r,o)),c=i(a(this.crossLinePts(n,s),n+2*l,r,o));return Gt(e,t,u)||Gt(e,t,c)},draw:function(e,n,r,i,o){var s=a(this.points,n,r,i),l=a(this.crossLinePts(n,o),n,r,i);t.arrowShapeImpl(this.name)(e,s,l)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return.525*o(e)}}),s("circle",{radius:.15,collide:function(e,t,n,r,a,i,o){var s=a;return Math.pow(s.x-e,2)+Math.pow(s.y-t,2)<=Math.pow((n+2*o)*this.radius,2)},draw:function(e,n,r,a,i){t.arrowShapeImpl(this.name)(e,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return.95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})}},Us={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),a=r[0],i=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-a)/o-s.x)/l,((t-i)/o-s.y)/l]},findContainerClientCoords:function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(e){return parseFloat(n.getPropertyValue(e))},a=r("padding-left"),i=r("padding-right"),o=r("padding-top"),s=r("padding-bottom"),l=r("border-left-width"),u=r("border-right-width"),c=r("border-top-width"),d=(r("border-bottom-width"),e.clientWidth),h=e.clientHeight,p=a+i,f=o+s,g=l+u,v=t.width/(d+g),y=d-p,m=h-f,b=t.left+a+l,x=t.top+o+c;return this.containerBB=[b,x,y,m,v]},invalidateContainerClientCoordsCache:function(){this.containerBB=null},findNearestElement:function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},findNearestElements:function(e,t,n,r){var a,i,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),d=s.cy.hasCompoundNodes(),h=(r?24:8)/c,p=(r?8:2)/c,f=(r?8:2)/c,g=1/0;function v(e,t){if(e.isNode()){if(i)return;i=e,u.push(e)}if(e.isEdge()&&(null==t||t<g))if(a){if(a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value)for(var n=0;n<u.length;n++)if(u[n].isEdge()){u[n]=e,a=e,g=null!=t?t:g;break}}else u.push(e),a=e,g=null!=t?t:g}function y(n){var r=n.outerWidth()+2*p,a=n.outerHeight()+2*p,i=r/2,l=a/2,u=n.position(),c="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,d=n._private.rscratch;if(u.x-i<=e&&e<=u.x+i&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,a,u.x,u.y,c,d))return v(n,0),!0}function m(n){var r,a=n._private,i=a.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+h,f=p*p,g=2*p,m=a.source,b=a.target;if("segments"===i.edgeType||"straight"===i.edgeType||"haystack"===i.edgeType){for(var x=i.allpts,w=0;w+3<x.length;w+=2)if(Xt(e,t,x[w],x[w+1],x[w+2],x[w+3],g)&&f>(r=Kt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===i.edgeType||"multibezier"===i.edgeType||"self"===i.edgeType||"compound"===i.edgeType)for(x=i.allpts,w=0;w+5<i.allpts.length;w+=4)if(Wt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],g)&&f>(r=Ht(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||a.source,b=b||a.target;var E=o.getArrowWidth(l,c),k=[{name:"source",x:i.arrowStartX,y:i.arrowStartY,angle:i.srcArrowAngle},{name:"target",x:i.arrowEndX,y:i.arrowEndY,angle:i.tgtArrowAngle},{name:"mid-source",x:i.midX,y:i.midY,angle:i.midsrcArrowAngle},{name:"mid-target",x:i.midX,y:i.midY,angle:i.midtgtArrowAngle}];for(w=0;w<k.length;w++){var C=k[w],S=s.arrowShapes[n.pstyle(C.name+"-arrow-shape").value],P=n.pstyle("width").pfValue;if(S.roughCollide(e,t,E,C.angle,{x:C.x,y:C.y},P,h)&&S.collide(e,t,E,C.angle,{x:C.x,y:C.y},P,h))return v(n),!0}d&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Qe(e,t,n)}function x(n,r){var a,i=n._private,o=f;a=r?r+"-":"",n.boundingBox();var s=i.labelBounds[r||"main"],l=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(i.rscratch,"labelX",r),c=b(i.rscratch,"labelY",r),d=b(i.rscratch,"labelAngle",r),h=n.pstyle(a+"text-margin-x").pfValue,p=n.pstyle(a+"text-margin-y").pfValue,g=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-p,x=s.y2+o-p;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=k(g,m),S=k(g,x),P=k(y,m),D=k(y,x),T=[C.x+h,C.y+p,P.x+h,P.y+p,D.x+h,D.y+p,S.x+h,S.y+p];if(Gt(e,t,T))return v(n),!0}else if(jt(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var a,i,o=this.getCachedZSortedEles().interactive,s=[],l=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=zt({x1:e=l,y1:t=c,x2:n=u,y2:r=d}),p=0;p<o.length;p++){var f=o[p];if(f.isNode()){var g=f,v=g.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Ft(h,v)&&!qt(v,h)&&s.push(g)}else{var y=f,m=y._private,b=m.rscratch;if(null!=b.startX&&null!=b.startY&&!jt(h,b.startX,b.startY))continue;if(null!=b.endX&&null!=b.endY&&!jt(h,b.endX,b.endY))continue;if("bezier"===b.edgeType||"multibezier"===b.edgeType||"self"===b.edgeType||"compound"===b.edgeType||"segments"===b.edgeType||"haystack"===b.edgeType){for(var x=m.rstyle.bezierPts||m.rstyle.linePts||m.rstyle.haystackPts,w=!0,E=0;E<x.length;E++)if(a=h,i=x[E],!jt(a,i.x,i.y)){w=!1;break}w&&s.push(y)}else"haystack"!==b.edgeType&&"straight"!==b.edgeType||s.push(y)}}return s}},Zs={calculateArrowAngles:function(e){var t,n,r,a,i,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,d="segments"===s.edgeType,h="compound"===s.edgeType,p="self"===s.edgeType;if(l?(r=s.haystackPts[0],a=s.haystackPts[1],i=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,a=s.arrowStartY,i=s.arrowEndX,o=s.arrowEndY),g=s.midX,v=s.midY,d)t=r-s.segpts[0],n=a-s.segpts[1];else if(c||h||p||u){var f=s.allpts;t=r-Bt(f[0],f[2],f[4],.1),n=a-Bt(f[1],f[3],f[5],.1)}else t=r-g,n=a-v;s.srcArrowAngle=St(t,n);var g=s.midX,v=s.midY;if(l&&(g=(r+i)/2,v=(a+o)/2),t=i-r,n=o-a,d)if((f=s.allpts).length/2%2==0){var y=(S=f.length/2)-2;t=f[S]-f[y],n=f[S+1]-f[y+1]}else s.isRound?(t=s.midVector[1],n=-s.midVector[0]):(y=(S=f.length/2-1)-2,t=f[S]-f[y],n=f[S+1]-f[y+1]);else if(c||h||p){var m,b,x,w;f=s.allpts;if(s.ctrlpts.length/2%2==0){var E=2+(k=2+(C=f.length/2-1));m=Bt(f[C],f[k],f[E],0),b=Bt(f[C+1],f[k+1],f[E+1],0),x=Bt(f[C],f[k],f[E],1e-4),w=Bt(f[C+1],f[k+1],f[E+1],1e-4)}else{var k,C;E=2+(k=f.length/2-1),m=Bt(f[C=k-2],f[k],f[E],.4999),b=Bt(f[C+1],f[k+1],f[E+1],.4999),x=Bt(f[C],f[k],f[E],.5),w=Bt(f[C+1],f[k+1],f[E+1],.5)}t=x-m,n=w-b}if(s.midtgtArrowAngle=St(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,d)if((f=s.allpts).length/2%2==0);else if(!s.isRound){var S,P=2+(S=f.length/2-1);t=-(f[P]-f[S]),n=-(f[P+1]-f[S+1])}if(s.midsrcArrowAngle=St(t,n),d)t=i-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||h||p||u){var D=(f=s.allpts).length;t=i-Bt(f[D-6],f[D-4],f[D-2],.9),n=o-Bt(f[D-5],f[D-3],f[D-1],.9)}else t=i-g,n=o-v;s.tgtArrowAngle=St(t,n)}};Zs.getArrowWidth=Zs.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r,r)};var $s,Qs,Js,el,tl,nl,rl,al,il,ol,sl,ll,ul,cl,dl,hl,pl,fl={},gl={},vl=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)};function yl(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function ml(e,t,n,r){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(function(e,t,n,r,a){var i,o;if(e!==pl?vl(t,e,fl):((o=fl).x=-1*(i=gl).x,o.y=-1*i.y,o.nx=-1*i.nx,o.ny=-1*i.ny,o.ang=i.ang>0?-(Math.PI-i.ang):Math.PI+i.ang),vl(t,n,gl),Js=fl.nx*gl.ny-fl.ny*gl.nx,el=fl.nx*gl.nx-fl.ny*-gl.ny,rl=Math.asin(Math.max(-1,Math.min(1,Js))),Math.abs(rl)<1e-6)return $s=t.x,Qs=t.y,void(il=sl=0);tl=1,nl=!1,el<0?rl<0?rl=Math.PI+rl:(rl=Math.PI-rl,tl=-1,nl=!0):rl>0&&(tl=-1,nl=!0),sl=void 0!==t.radius?t.radius:r,al=rl/2,ll=Math.min(fl.len/2,gl.len/2),a?(ol=Math.abs(Math.cos(al)*sl/Math.sin(al)))>ll?(ol=ll,il=Math.abs(ol*Math.sin(al)/Math.cos(al))):il=sl:(ol=Math.min(ll,sl),il=Math.abs(ol*Math.sin(al)/Math.cos(al))),dl=t.x+gl.nx*ol,hl=t.y+gl.ny*ol,$s=dl-gl.ny*il*tl,Qs=hl+gl.nx*il*tl,ul=t.x+fl.nx*ol,cl=t.y+fl.ny*ol,pl=t}(e,t,n,r,a),{cx:$s,cy:Qs,radius:il,startX:ul,startY:cl,stopX:dl,stopY:hl,startAngle:fl.ang+Math.PI/2*tl,endAngle:gl.ang-Math.PI/2*tl,counterClockwise:nl})}var bl={};function xl(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],a=e[n+1];t.push({x:r,y:a})}return t}}bl.findMidptPtsEtc=function(e,t){var n,r=t.posPts,a=t.intersectionPts,i=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),u=null!=o.units&&null!=s.units;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=a;break;case"endpoints":if(u){var c=l(this.manualEndptToPx(e.source()[0],o),2),d=c[0],h=c[1],p=l(this.manualEndptToPx(e.target()[0],s),2),f=p[0],g=p[1],v={x1:d,y1:h,x2:f,y2:g};i=function(e,t,n,r){var a=r-t,i=n-e,o=Math.sqrt(i*i+a*a);return{x:-a/o,y:i/o}}(d,h,f,g),n=v}else Xe("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),n=a}return{midptPts:n,vectorNormInverse:i}},bl.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,a=r.rscratch;if(!a.haystack){var i=2*Math.random()*Math.PI;a.source={x:Math.cos(i),y:Math.sin(i)},i=2*Math.random()*Math.PI,a.target={x:Math.cos(i),y:Math.sin(i)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),d=s.width(),h=o.height(),p=s.height(),f=n.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*c*f+l.x,a.source.y*h*f+l.y,a.target.x*d*f+u.x,a.target.y*p*f+u.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},bl.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),i=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,a.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<s;c++){var d=r.pfValue[c],h=a.pfValue[c],p=1-d,f=d,g=this.findMidptPtsEtc(e,t),v=g.midptPts,y=g.vectorNormInverse,m={x:v.x1*p+v.x2*f,y:v.y1*p+v.y2*f};n.segpts.push(m.x+y.x*h,m.y+y.y*h),n.radii.push(void 0!==i.pfValue[c]?i.pfValue[c]:l),n.isArcRadius.push("arc-radius"===(void 0!==o.pfValue[c]?o.pfValue[c]:u))}},bl.findLoopPoints=function(e,t,n,r){var a=e._private.rscratch,i=t.dirCounts,o=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,d=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var h=n,p=d;r&&(h=0,p=l);var f=u-Math.PI/2,g=f-c/2,v=f+c/2,y=String(u+"_"+c);h=void 0===i[y]?i[y]=0:++i[y],a.ctrlpts=[o.x+1.4*Math.cos(g)*p*(h/3+1),o.y+1.4*Math.sin(g)*p*(h/3+1),o.x+1.4*Math.cos(v)*p*(h/3+1),o.y+1.4*Math.sin(v)*p*(h/3+1)]},bl.findCompoundLoopPoints=function(e,t,n,r){var a=e._private.rscratch;a.edgeType="compound";var i=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,d=e.pstyle("control-point-step-size").pfValue,h=e.pstyle("control-point-distances"),p=h?h.pfValue[0]:void 0,f=n,g=d;r&&(f=0,g=p);var v={x:i.x-s/2,y:i.y-l/2},y={x:o.x-u/2,y:o.y-c/2},m={x:Math.min(v.x,y.x),y:Math.min(v.y,y.y)},b=Math.max(.5,Math.log(.01*s)),x=Math.max(.5,Math.log(.01*u));a.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*g*(f/3+1)*x,m.y]},bl.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},bl.findBezierPoints=function(e,t,n,r,a){var i=e._private.rscratch,o=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,d=l.value[0],h=r;i.edgeType=h?"multibezier":"bezier",i.ctrlpts=[];for(var p=0;p<u;p++){var f,g=(.5-t.eles.length/2+n)*o*(a?-1:1),v=Dt(g);h&&(c=s?s.pfValue[p]:o,d=l.value[p]);var y=void 0!==(f=r?c:void 0!==c?v*c:void 0)?f:g,m=1-d,b=d,x=this.findMidptPtsEtc(e,t),w=x.midptPts,E=x.vectorNormInverse,k={x:w.x1*m+w.x2*b,y:w.y1*m+w.y2*b};i.ctrlpts.push(k.x+E.x*y,k.y+E.y*y)}},bl.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",a="horizontal",i="leftward",o="rightward",s="downward",l="upward",u=t.posPts,c=t.srcW,d=t.srcH,h=t.tgtW,p=t.tgtH,f="node-position"!==e.pstyle("edge-distances").value,g=e.pstyle("taxi-direction").value,v=g,y=e.pstyle("taxi-turn"),m="%"===y.units,b=y.pfValue,x=b<0,w=e.pstyle("taxi-turn-min-distance").pfValue,E=f?(c+h)/2:0,k=f?(d+p)/2:0,C=u.x2-u.x1,S=u.y2-u.y1,P=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},D=P(C,E),T=P(S,k),_=!1;"auto"===v?g=Math.abs(D)>Math.abs(T)?a:r:v===l||v===s?(g=r,_=!0):v!==i&&v!==o||(g=a,_=!0);var M,B=g===r,N=B?T:D,I=B?S:C,z=Dt(I),A=!1;_&&(m||x)||!(v===s&&I<0||v===l&&I>0||v===i&&I>0||v===o&&I<0)||(N=(z*=-1)*Math.abs(N),A=!0);var L=function(e){return Math.abs(e)<w||Math.abs(e)>=Math.abs(N)},O=L(M=m?(b<0?1+b:b)*N:(b<0?N:0)+b*z),R=L(Math.abs(N)-Math.abs(M));if(!O&&!R||A)if(B){var V=u.y1+M+(f?d/2*z:0),F=u.x1,j=u.x2;n.segpts=[F,V,j,V]}else{var q=u.x1+M+(f?c/2*z:0),Y=u.y1,X=u.y2;n.segpts=[q,Y,q,X]}else if(B){var W=Math.abs(I)<=d/2,H=Math.abs(C)<=h/2;if(W){var K=(u.x1+u.x2)/2,G=u.y1,U=u.y2;n.segpts=[K,G,K,U]}else if(H){var Z=(u.y1+u.y2)/2,$=u.x1,Q=u.x2;n.segpts=[$,Z,Q,Z]}else n.segpts=[u.x1,u.y2]}else{var J=Math.abs(I)<=c/2,ee=Math.abs(S)<=p/2;if(J){var te=(u.y1+u.y2)/2,ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else if(ee){var ae=(u.x1+u.x2)/2,ie=u.y1,oe=u.y2;n.segpts=[ae,ie,ae,oe]}else n.segpts=[u.x2,u.y1]}if(n.isRound){var se=e.pstyle("taxi-radius").value,le="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(se),n.isArcRadius=new Array(n.segpts.length/2).fill(le)}},bl.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!k(n.startX)||!k(n.startY),v=!k(n.arrowStartX)||!k(n.arrowStartY),y=!k(n.endX)||!k(n.endY),m=!k(n.arrowEndX)||!k(n.arrowEndY),b=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,x=Tt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=x<b,E=Tt({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),C=E<b,S=!1;if(g||v||w){S=!0;var P={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},D=Math.sqrt(P.x*P.x+P.y*P.y),T={x:P.x/D,y:P.y/D},_=Math.max(i,o),M={x:n.ctrlpts[0]+2*T.x*_,y:n.ctrlpts[1]+2*T.y*_},B=u.intersectLine(r.x,r.y,i,o,M.x,M.y,0,d,p);w?(n.ctrlpts[0]=n.ctrlpts[0]+T.x*(b-x),n.ctrlpts[1]=n.ctrlpts[1]+T.y*(b-x)):(n.ctrlpts[0]=B[0]+T.x*b,n.ctrlpts[1]=B[1]+T.y*b)}if(y||m||C){S=!0;var N={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},I=Math.sqrt(N.x*N.x+N.y*N.y),z={x:N.x/I,y:N.y/I},A=Math.max(i,o),L={x:n.ctrlpts[0]+2*z.x*A,y:n.ctrlpts[1]+2*z.y*A},O=c.intersectLine(a.x,a.y,s,l,L.x,L.y,0,h,f);C?(n.ctrlpts[0]=n.ctrlpts[0]+z.x*(b-E),n.ctrlpts[1]=n.ctrlpts[1]+z.y*(b-E)):(n.ctrlpts[0]=O[0]+z.x*b,n.ctrlpts[1]=O[1]+z.y*b)}S&&this.findEndpoints(e)}},bl.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);var r;t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,t.midX=Bt(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=Bt(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var i=t.radii[a/2-1],o=t.isArcRadius[a/2-1];t.roundCorners.push(ml({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:i},{x:t.allpts[a+2],y:t.allpts[a+3]},i,o))}}if(t.segpts.length%4==0){var s=t.segpts.length/2,l=s-2;t.midX=(t.segpts[l]+t.segpts[s])/2,t.midY=(t.segpts[l+1]+t.segpts[s+1])/2}else{var u=t.segpts.length/2-1;if(t.isRound){var c={x:t.segpts[u],y:t.segpts[u+1]},d=t.roundCorners[u/2],h=[c.x-d.cx,c.y-d.cy],p=d.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map((function(e){return e*p})),t.midX=d.cx+h[0],t.midY=d.cy+h[1],t.midVector=h}else t.midX=t.segpts[u],t.midY=t.segpts[u+1]}}},bl.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||k(t.startX)&&k(t.startY)&&k(t.endX)&&k(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Xe("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))},bl.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),a={map:new et,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new et,this.map.set(e[0],n)),n.set(e[1],t)}},i=[],o=[],s=0;s<e.length;s++){var l=e[s],u=l._private,c=l.pstyle("curve-style").value;if(!l.removed()&&l.takesUpSpace())if("haystack"!==c){var d="unbundled-bezier"===c||c.endsWith("segments")||"straight"===c||"straight-triangle"===c||c.endsWith("taxi"),h="unbundled-bezier"===c||"bezier"===c,p=u.source,f=u.target,g=[p.poolIndex(),f.poolIndex()].sort(),v=a.get(g);null==v&&(v={eles:[]},a.set(g,v),i.push(g)),v.eles.push(l),d&&(v.hasUnbundled=!0),h&&(v.hasBezier=!0)}else o.push(l)}for(var y=function(e){var o=i[e],s=a.get(o),l=void 0;if(!s.hasUnbundled){var u=s.eles[0].parallelEdges().filter((function(e){return e.isBundledBezier()}));$e(s.eles),u.forEach((function(e){return s.eles.push(e)})),s.eles.sort((function(e,t){return e.poolIndex()-t.poolIndex()}))}var c=s.eles[0],d=c.source(),h=c.target();if(d.poolIndex()>h.poolIndex()){var p=d;d=h,h=p}var f=s.srcPos=d.position(),g=s.tgtPos=h.position(),v=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(h)],E=s.srcCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,S=s.tgtRs=h._private.rscratch,P=s.srcRs=d._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D<s.eles.length;D++){var T=s.eles[D],_=T[0]._private.rscratch,M=T.pstyle("curve-style").value,B="unbundled-bezier"===M||M.endsWith("segments")||M.endsWith("taxi"),N=!d.same(T.source());if(!s.calculatedIntersection&&d!==h&&(s.hasBezier||s.hasUnbundled)){s.calculatedIntersection=!0;var I=x.intersectLine(f.x,f.y,v,y,g.x,g.y,0,E,P),z=s.srcIntn=I,A=w.intersectLine(g.x,g.y,m,b,f.x,f.y,0,C,S),L=s.tgtIntn=A,O=s.intersectionPts={x1:I[0],x2:A[0],y1:I[1],y2:A[1]},R=s.posPts={x1:f.x,x2:g.x,y1:f.y,y2:g.y},V=A[1]-I[1],F=A[0]-I[0],j=Math.sqrt(F*F+V*V),q=s.vector={x:F,y:V},Y=s.vectorNorm={x:q.x/j,y:q.y/j},X={x:-Y.y,y:Y.x};s.nodesOverlap=!k(j)||w.checkPoint(I[0],I[1],0,m,b,g.x,g.y,C,S)||x.checkPoint(A[0],A[1],0,v,y,f.x,f.y,E,P),s.vectorNormInverse=X,l={nodesOverlap:s.nodesOverlap,dirCounts:s.dirCounts,calculatedIntersection:!0,hasBezier:s.hasBezier,hasUnbundled:s.hasUnbundled,eles:s.eles,srcPos:g,srcRs:S,tgtPos:f,tgtRs:P,srcW:m,srcH:b,tgtW:v,tgtH:y,srcIntn:L,tgtIntn:z,srcShape:w,tgtShape:x,posPts:{x1:R.x2,y1:R.y2,x2:R.x1,y2:R.y1},intersectionPts:{x1:O.x2,y1:O.y2,x2:O.x1,y2:O.y1},vector:{x:-q.x,y:-q.y},vectorNorm:{x:-Y.x,y:-Y.y},vectorNormInverse:{x:-X.x,y:-X.y}}}var W=N?l:s;_.nodesOverlap=W.nodesOverlap,_.srcIntn=W.srcIntn,_.tgtIntn=W.tgtIntn,_.isRound=M.startsWith("round"),r&&(d.isParent()||d.isChild()||h.isParent()||h.isChild())&&(d.parents().anySame(h)||h.parents().anySame(d)||d.same(h)&&d.isParent())?t.findCompoundLoopPoints(T,W,D,B):d===h?t.findLoopPoints(T,W,D,B):M.endsWith("segments")?t.findSegmentsPoints(T,W):M.endsWith("taxi")?t.findTaxiPoints(T,W):"straight"===M||!B&&s.eles.length%2==1&&D===Math.floor(s.eles.length/2)?t.findStraightEdgePoints(T):t.findBezierPoints(T,W,D,B,N),t.findEndpoints(T),t.tryToCorrectInvalidPoints(T,W),t.checkForInvalidEdgeWarning(T),t.storeAllpts(T),t.storeEdgeProjections(T),t.calculateArrowAngles(T),t.recalculateEdgeLabelProjections(T),t.calculateLabelAngles(T)}},m=0;m<i.length;m++)y(m);this.findHaystackPoints(o)}},bl.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return xl(t.segpts)},bl.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return xl(t.ctrlpts)},bl.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var wl={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),a=e.outerHeight(),i=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*r),"%"===t.units[1]&&(o[1]=o[1]*a),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,a),u=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,a,u[0],u[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,i)},findEndpoints:function(e){var t,n,r,a,i,o=this,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),d=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,f=e.pstyle("source-distance-from-node").pfValue,g=s._private.rscratch,v=l._private.rscratch,y=e.pstyle("curve-style").value,m=e._private.rscratch,b=m.edgeType,x="self"===b||"compound"===b,w="bezier"===b||"multibezier"===b||x,E="bezier"!==b,C="straight"===b||"segments"===b,S="segments"===b,P=w||E||C,D=x||"taxi"===y,T=e.pstyle("source-endpoint"),_=D?"outside-to-node":T.value,M="auto"===s.pstyle("corner-radius").value?"auto":s.pstyle("corner-radius").pfValue,B=e.pstyle("target-endpoint"),N=D?"outside-to-node":B.value,I="auto"===l.pstyle("corner-radius").value?"auto":l.pstyle("corner-radius").pfValue;if(m.srcManEndpt=T,m.tgtManEndpt=B,w){var z=[m.ctrlpts[0],m.ctrlpts[1]];n=E?[m.ctrlpts[m.ctrlpts.length-2],m.ctrlpts[m.ctrlpts.length-1]]:z,r=z}else if(C){var A=S?m.segpts.slice(0,2):[c.x,c.y];n=S?m.segpts.slice(m.segpts.length-2):[u.x,u.y],r=A}if("inside-to-node"===N)t=[c.x,c.y];else if(B.units)t=this.manualEndptToPx(l,B);else if("outside-to-line"===N)t=m.tgtIntn;else if("outside-to-node"===N||"outside-to-node-or-label"===N?a=n:"outside-to-line"!==N&&"outside-to-line-or-label"!==N||(a=[u.x,u.y]),t=o.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),a[0],a[1],0,I,v),"outside-to-node-or-label"===N||"outside-to-line-or-label"===N){var L=l._private.rscratch,O=L.labelWidth,R=L.labelHeight,V=L.labelX,F=L.labelY,j=O/2,q=R/2,Y=l.pstyle("text-valign").value;"top"===Y?F-=q:"bottom"===Y&&(F+=q);var X=l.pstyle("text-halign").value;"left"===X?V-=j:"right"===X&&(V+=j);var W=nn(a[0],a[1],[V-j,F-q,V+j,F-q,V+j,F+q,V-j,F+q],c.x,c.y);if(W.length>0){var H=u,K=_t(H,Ct(t)),G=_t(H,Ct(W)),U=K;G<K&&(t=W,U=G),W.length>2&&_t(H,{x:W[2],y:W[3]})<U&&(t=[W[2],W[3]])}}var Z=rn(t,n,o.arrowShapes[d].spacing(e)+p),$=rn(t,n,o.arrowShapes[d].gap(e)+p);if(m.endX=$[0],m.endY=$[1],m.arrowEndX=Z[0],m.arrowEndY=Z[1],"inside-to-node"===_)t=[u.x,u.y];else if(T.units)t=this.manualEndptToPx(s,T);else if("outside-to-line"===_)t=m.srcIntn;else if("outside-to-node"===_||"outside-to-node-or-label"===_?i=r:"outside-to-line"!==_&&"outside-to-line-or-label"!==_||(i=[c.x,c.y]),t=o.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),i[0],i[1],0,M,g),"outside-to-node-or-label"===_||"outside-to-line-or-label"===_){var Q=s._private.rscratch,J=Q.labelWidth,ee=Q.labelHeight,te=Q.labelX,ne=Q.labelY,re=J/2,ae=ee/2,ie=s.pstyle("text-valign").value;"top"===ie?ne-=ae:"bottom"===ie&&(ne+=ae);var oe=s.pstyle("text-halign").value;"left"===oe?te-=re:"right"===oe&&(te+=re);var se=nn(i[0],i[1],[te-re,ne-ae,te+re,ne-ae,te+re,ne+ae,te-re,ne+ae],u.x,u.y);if(se.length>0){var le=c,ue=_t(le,Ct(t)),ce=_t(le,Ct(se)),de=ue;ce<ue&&(t=[se[0],se[1]],de=ce),se.length>2&&_t(le,{x:se[2],y:se[3]})<de&&(t=[se[2],se[3]])}}var he=rn(t,r,o.arrowShapes[h].spacing(e)+f),pe=rn(t,r,o.arrowShapes[h].gap(e)+f);m.startX=pe[0],m.startY=pe[1],m.arrowStartX=he[0],m.arrowStartY=he[1],P&&(k(m.startX)&&k(m.startY)&&k(m.endX)&&k(m.endY)?m.badLine=!1:m.badLine=!0)},getSourceEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"===t.edgeType?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},getTargetEndpoint:function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),"haystack"===t.edgeType?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}}},El={};function kl(e,t,n){for(var r=function(e,t,n,r){return Bt(e,t,n,r)},a=t._private.rstyle.bezierPts,i=0;i<e.bezierProjPcts.length;i++){var o=e.bezierProjPcts[i];a.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}El.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===r||"bezier"===r||"self"===r||"compound"===r){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)kl(this,e,n.allpts.slice(a,a+6))}else if("segments"===r){var i=t.rstyle.linePts=[];for(a=0;a+1<n.allpts.length;a+=2)i.push({x:n.allpts[a],y:n.allpts[a+1]})}else if("haystack"===r){var o=n.haystackPts;t.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},El.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Cl={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!M(t)){var n,r,a=e._private,i=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=a.rscratch,h=a.rstyle;switch(u){case"left":n=l.x-i/2-s;break;case"right":n=l.x+i/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"bottom":r=l.y+o/2+s;break;default:r=l.y}d.labelX=n,d.labelY=r,h.labelX=n,h.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},Sl=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},Pl=function(e,t){var n=t.x-e.x,r=t.y-e.y;return Sl(n,r)};Cl.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,a=this,i={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(i.mid||i.source||i.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){Je(n.rscratch,e,t,r),Je(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=Sl(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function e(){if(e.cache)return e.cache;for(var t=[],i=0;i+5<r.allpts.length;i+=4){var o={x:r.allpts[i],y:r.allpts[i+1]},s={x:r.allpts[i+2],y:r.allpts[i+3]},l={x:r.allpts[i+4],y:r.allpts[i+5]};t.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=a.bezierProjPcts.length;function d(e,t,n,r,a){var i=Tt(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:a,startDist:o?o.startDist+o.length:0,length:i};e.segments.push(s),e.length+=i}for(var h=0;h<t.length;h++){var p=t[h],f=t[h-1];f&&(p.startDist=f.startDist+f.length),d(p,p.p0,u[h*c],0,a.bezierProjPcts[0]);for(var g=0;g<c-1;g++)d(p,u[h*c+g],u[h*c+g+1],a.bezierProjPcts[g],a.bezierProjPcts[g+1]);d(p,u[h*c+c-1],p.p2,a.bezierProjPcts[c-1],1)}return e.cache=t},u=function(n){var a,s="source"===n;if(i[n]){var u=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,d=l(),h=0,p=0,f=0;f<d.length;f++){for(var g=d[s?f:d.length-1-f],v=0;v<g.segments.length;v++){var y=g.segments[s?v:g.segments.length-1-v],m=f===d.length-1&&v===g.segments.length-1;if(h=p,(p+=y.length)>=u||m){c={cp:g,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=It(0,k,1),t=Nt(b.p0,b.p1,b.p2,k),a=function(e,t,n,r){var a=It(0,r-.001,1),i=It(0,r+.001,1),o=Nt(e,t,n,a),s=Nt(e,t,n,i);return Pl(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,S,P,D,T=0,_=r.allpts.length,M=0;M+3<_&&(s?(P={x:r.allpts[M],y:r.allpts[M+1]},D={x:r.allpts[M+2],y:r.allpts[M+3]}):(P={x:r.allpts[_-2-M],y:r.allpts[_-1-M]},D={x:r.allpts[_-4-M],y:r.allpts[_-3-M]}),S=T,!((T+=C=Tt(P,D))>=u));M+=2);var B=(u-S)/C;B=It(0,B,1),t=function(e,t,n,r){var a=t.x-e.x,i=t.y-e.y,o=Tt(e,t),s=a/o,l=i/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(P,D,B),a=Pl(P,D)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,a)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Cl.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Cl.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),i=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Qe(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=a.height/l,c=u*i,d=a.width,h=a.height+(l-1)*(i-1)*u;Je(n.rstyle,"labelWidth",t,d),Je(n.rscratch,"labelWidth",t,d),Je(n.rstyle,"labelHeight",t,h),Je(n.rscratch,"labelHeight",t,h),Je(n.rscratch,"labelLineHeight",t,c)},Cl.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,i=e.pstyle("text-transform").value,o=function(e,r){return r?(Je(n.rscratch,e,t,r),r):Qe(n.rscratch,e,t)};if(!a)return"";"none"==i||("uppercase"==i?a=a.toUpperCase():"lowercase"==i&&(a=a.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=a.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;g<u.length;g++){var v=u[g],y=this.calculateLabelDimensions(e,v).width;if(h){var m=v.split("").join("​");v=m}if(y>c){var b,x="",w=0,E=d(v.matchAll(f));try{for(E.s();!(b=E.n()).done;){var k=b.value,C=k[0],S=v.substring(w,k.index);w=k.index+C.length;var P=0===x.length?S:x+S+C;this.calculateLabelDimensions(e,P).width<=c?x+=S+C:(x&&p.push(x),x=S+C)}}catch(e){E.e(e)}finally{E.f()}x.match(/^[\s\u200b]+$/)||p.push(x)}else p.push(v)}o("labelWrapCachedLines",p),a=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var D=e.pstyle("text-max-width").pfValue,T="",_=!1;if(this.calculateLabelDimensions(e,a).width<D)return a;for(var M=0;M<a.length&&!(this.calculateLabelDimensions(e,T+a[M]+"…").width>D);M++)T+=a[M],M===a.length-1&&(_=!0);return _||(T+="…"),T}return a},Cl.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},Cl.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,a=Be(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),o=i[a];if(null!=o)return o;var s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),h=this.labelCalcCanvasContext=d.getContext("2d");var p=d.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}h.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var f=0,g=0,v=t.split("\n"),y=0;y<v.length;y++){var m=v[y],b=h.measureText(m),x=Math.ceil(b.width),w=l;f=Math.max(x,f),g+=w}return f+=0,g+=0,i[a]={width:f,height:g}},Cl.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),a=t?t+"-":"",i=e.pstyle(a+"text-rotation"),o=i.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:i.pfValue},Cl.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private.rscratch;r.labelAngle=t.calculateLabelAngle(e),n&&(r.sourceLabelAngle=t.calculateLabelAngle(e,"source"),r.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var Dl={},Tl=!1;Dl.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(e.width()<28||e.height()<28))return Tl||(Xe("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Tl=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var _l={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(a=e[n])._private.rscratch;a.grabbed()&&!a.isParent()?t.push(a):r.inDragLayer?e.drag.push(a):e.nondrag.push(a)}for(n=0;n<t.length;n++){var a=t[n];e.drag.push(a)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Ki),t.interactive=t.filter((function(e){return e.interactive()})),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},Ml={};[Us,Zs,bl,wl,El,Cl,Dl,{registerCalculationListeners:function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r<e.length;r++){var a=e[r]._private.rstyle;a.clean=!1,a.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",(function(e){var t=e.target;r(t)})).on("style.* background.*",(function(e){var t=e.target;r(t,!1)}));var a=function(a){if(a){var i=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(r(s.connectedEdges()),l.cleanConnected=!0)}if(i)for(var u=0;u<i.length;u++)(0,i[u])(a,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){a(!0)},n.beforeRender(a,n.beforeRenderPriorities.eleCalcs)},onUpdateEleCalcs:function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},recalculateRenderedStyle:function(e,t){var n=function(e){return e._private.rstyle.cleanConnected},r=[],a=[];if(!this.destroyed){void 0===t&&(t=!0);for(var i=0;i<e.length;i++){var o=e[i],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?a.push(o):r.push(o),l.clean=!0)}for(var u=0;u<a.length;u++){var c=a[u],d=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var p=0;p<r.length;p++){var f=r[p]._private,g=f.rstyle,v=f.rscratch;g.srcX=v.arrowStartX,g.srcY=v.arrowStartY,g.tgtX=v.arrowEndX,g.tgtY=v.arrowEndY,g.midX=v.midX,g.midY=v.midY,g.labelAngle=v.labelAngle,g.sourceLabelAngle=v.sourceLabelAngle,g.targetLabelAngle=v.targetLabelAngle}}}},_l].forEach((function(e){Y(Ml,e)}));var Bl={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},a=r[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;var i=(a=r[e]=r[e]||{}).image=new Image;i.addEventListener("load",n),i.addEventListener("error",(function(){i.error=!0}));return"data:"===e.substring(0,5).toLowerCase()||(t="null"===t?null:t,i.crossOrigin=t),i.src=e,i}},Nl={registerBinding:function(e,t,n,r){var a=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var i=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);i.push(l.on.apply(l,a))}}return i}return(l=this.binder(e)).on.apply(l,a)},binder:function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var a=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,i)}catch(e){}t.supportsPassiveEvents=a}var o=function(n,a,i){var o=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(o[2]={capture:null!=i&&i,passive:!1,once:!1}),t.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:o,addEventListener:o,addListener:o,bind:o}},nodeIsDraggable:function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},nodeIsGrabbable:function(e){return this.nodeIsDraggable(e)&&e.interactive()}};Nl.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(t,n,r,a){null==t&&(t=e.cy);for(var i=0;i<n.length;i++){var o=n[i];t.emit({originalEvent:r,type:o,position:a})}},a=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},i=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable()){for(var a=0;n&&a<n.length;a++)if((t=n[a]).isNode()&&t.isParent()&&!t.pannable()){r=!1;break}}else r=!0;return r},o=function(e){e[0]._private.rscratch.inDragLayer=!0},s=function(e){e[0]._private.rscratch.isGrabTarget=!0},l=function(e,t){var n=t.addToList;n.has(e)||!e.grabbable()||e.locked()||(n.merge(e),function(e){e[0]._private.grabbed=!0}(e))},u=function(t,n){n=n||{};var r=t.cy().hasCompoundNodes();n.inDragLayer&&(t.forEach(o),t.neighborhood().stdFilter((function(e){return!r||e.isEdge()})).forEach(o)),n.addToList&&t.forEach((function(e){l(e,n)})),function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(o),n.connectedEdges().forEach(o)),t.addToList&&l(n,t)}}(t,n),h(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},c=u,d=function(t){t&&(e.getCachedZSortedEles().forEach((function(e){!function(e){e[0]._private.grabbed=!1}(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)})),e.updateCachedGrabbedEles())},h=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var r=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),a=r.connectedEdges();t.inDragLayer&&(a.forEach(o),r.forEach(o)),t.addToList&&r.forEach((function(e){l(e,t)}))}}},p=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},f="undefined"!=typeof MutationObserver,g="undefined"!=typeof ResizeObserver;f?(e.removeObserver=new MutationObserver((function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var a=0;a<r.length;a++)if(r[a]===e.container){e.destroy();break}}})),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",(function(t){e.destroy()}));var v=me((function(){e.cy.resize()}),100);f&&(e.styleObserver=new MutationObserver(v),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",v),g&&(e.resizeObserver=new ResizeObserver(v),e.resizeObserver.observe(e.container));var y=function(){e.invalidateContainerClientCoordsCache()};!function(e,t){for(;null!=e;)t(e),e=e.parentNode}(e.container,(function(t){e.registerBinding(t,"transitionend",y),e.registerBinding(t,"animationend",y),e.registerBinding(t,"scroll",y)})),e.registerBinding(e.container,"contextmenu",(function(e){e.preventDefault()}));var m=function(t){for(var n=e.findContainerClientCoords(),r=n[0],a=n[1],i=n[2],o=n[3],s=t.touches?t.touches:[t],l=!1,u=0;u<s.length;u++){var c=s[u];if(r<=c.clientX&&c.clientX<=r+i&&a<=c.clientY&&c.clientY<=a+o){l=!0;break}}if(!l)return!1;for(var d=e.container,h=t.target.parentNode,p=!1;h;){if(h===d){p=!0;break}h=h.parentNode}return!!p};e.registerBinding(e.container,"mousedown",(function(t){if(m(t)&&(1!==e.hoverData.which||1===t.which)){t.preventDefault(),p(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,a=[t.clientX,t.clientY],i=e.projectIntoViewport(a[0],a[1]),o=e.selection,l=e.findNearestElements(i[0],i[1],!0,!1),d=l[0],h=e.dragData.possibleDragElements;if(e.hoverData.mdownPos=i,e.hoverData.mdownGPos=a,3==t.which){e.hoverData.cxtStarted=!0;var f={originalEvent:t,type:"cxttapstart",position:{x:i[0],y:i[1]}};d?(d.activate(),d.emit(f),e.hoverData.down=d):n.emit(f),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(d&&d.activate(),null!=d&&e.nodeIsGrabbable(d)){var g=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};if(s(d),d.selected()){h=e.dragData.possibleDragElements=n.collection();var v=n.$((function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)}));u(v,{addToList:h}),d.emit(g("grabon")),v.forEach((function(e){e.emit(g("grab"))}))}else h=e.dragData.possibleDragElements=n.collection(),c(d,{addToList:h}),d.emit(g("grabon")).emit(g("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=d,e.hoverData.downs=l,e.hoverData.downTime=(new Date).getTime(),r(d,["mousedown","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==d?(o[4]=1,e.data.bgActivePosistion={x:i[0],y:i[1]},e.redrawHint("select",!0),e.redraw()):d.pannable()&&(o[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout((function(){if(!e.hoverData.tapholdCancelled){var r=e.hoverData.down;r?r.emit({originalEvent:t,type:"taphold",position:{x:i[0],y:i[1]}}):n.emit({originalEvent:t,type:"taphold",position:{x:i[0],y:i[1]}})}}),e.tapholdDuration)}o[0]=o[2]=i[0],o[1]=o[3]=i[1]}}),!1);var b,x,w,E=function(e){var t=e.getRootNode();if(t&&11===t.nodeType&&void 0!==t.host)return t}(e.container);e.registerBinding([t,E],"mousemove",(function(t){if(e.hoverData.capture||m(t)){var n=!1,o=e.cy,s=o.zoom(),l=[t.clientX,t.clientY],c=e.projectIntoViewport(l[0],l[1]),h=e.hoverData.mdownPos,p=e.hoverData.mdownGPos,f=e.selection,g=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(g=e.findNearestElement(c[0],c[1],!0,!1));var v,y=e.hoverData.last,b=e.hoverData.down,x=[c[0]-f[2],c[1]-f[3]],w=e.dragData.possibleDragElements;if(p){var E=l[0]-p[0],C=E*E,S=l[1]-p[1],P=C+S*S;e.hoverData.isOverThresholdDrag=v=P>=e.desktopTapThreshold2}var D=a(t);v&&(e.hoverData.tapholdCancelled=!0),n=!0,r(g,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var T=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:c[0],y:c[1]}}),f[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var _={originalEvent:t,type:"cxtdrag",position:{x:c[0],y:c[1]}};b?b.emit(_):o.emit(_),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&g===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:c[0],y:c[1]}}),e.hoverData.cxtOver=g,g&&g.emit({originalEvent:t,type:"cxtdragover",position:{x:c[0],y:c[1]}}))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var B=e.hoverData.mdownPos;M={x:(c[0]-B[0])*s,y:(c[1]-B[1])*s},e.hoverData.justStartedPan=!1}else M={x:x[0]*s,y:x[1]*s};o.panBy(M),o.emit("dragpan"),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=f[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||g==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),g&&r(g,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=g),b)if(v){if(o.boxSelectionEnabled()&&D)b&&b.grabbed()&&(d(w),b.emit("freeon"),w.emit("free"),e.dragData.didDrag&&(b.emit("dragfreeon"),w.emit("dragfree"))),T();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var N=!e.dragData.didDrag;N&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var I={x:0,y:0};if(k(x[0])&&k(x[1])&&(I.x+=x[0],I.y+=x[1],N)){var z=e.hoverData.dragDelta;z&&k(z[0])&&k(z[1])&&(I.x+=z[0],I.y+=z[1])}e.hoverData.draggingEles=!0,w.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else!function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(x[0]),t.push(x[1])):(t[0]+=x[0],t[1]+=x[1])}();n=!0}else v&&(e.hoverData.dragging||!o.boxSelectionEnabled()||!D&&o.panningEnabled()&&o.userPanningEnabled()?!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()&&i(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,f[4]=0,e.data.bgActivePosistion=Ct(h),e.redrawHint("select",!0),e.redraw()):T(),b&&b.pannable()&&b.active()&&b.unactivate());return f[2]=c[0],f[3]=c[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var i=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var p={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(p):i.emit(p),!e.hoverData.cxtDragged){var f={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(f):i.emit(f)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(r(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(r(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),x=!1,t.timeStamp-w<=i.multiClickDebounceTime()?(b&&clearTimeout(b),x=!0,w=null,r(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(b=setTimeout((function(){x||r(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),i.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(i.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=i.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===i.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(i.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=i.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});"additive"===i.selectionType()||h||i.$(n).unmerge(g).unselect(),g.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=c&&c.grabbed();d(u),v&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var C,S,P,D,T,_,M,B,N,I,z,A,L,O=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),a=n.pan(),i=e.projectIntoViewport(t.clientX,t.clientY),o=[i[0]*r+a.x,i[1]*r+a.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",O,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||O(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var R,V,F,j,q,Y,X,W=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},H=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",R=function(t){if(e.hasTouchStarted=!0,m(t)){p(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,a=e.touchData.now,i=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);a[0]=o[0],a[1]=o[1]}if(t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),a[2]=o[0],a[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),a[4]=o[0],a[5]=o[1]),t.touches[1]){e.touchData.singleTouchMoved=!0,d(e.dragData.touchDragEles);var l=e.findContainerClientCoords();N=l[0],I=l[1],z=l[2],A=l[3],C=t.touches[0].clientX-N,S=t.touches[0].clientY-I,P=t.touches[1].clientX-N,D=t.touches[1].clientY-I,L=0<=C&&C<=z&&0<=P&&P<=z&&0<=S&&S<=A&&0<=D&&D<=A;var h=n.pan(),f=n.zoom();if(T=W(C,S,P,D),_=H(C,S,P,D),B=[((M=[(C+P)/2,(S+D)/2])[0]-h.x)/f,(M[1]-h.y)/f],_<4e4&&!t.touches[2]){var g=e.findNearestElement(a[0],a[1],!0,!0),v=e.findNearestElement(a[2],a[3],!0,!0);return g&&g.isNode()?(g.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=g):v&&v.isNode()?(v.activate().emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start=v):n.emit({originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,void e.redraw()}}if(t.touches[2])n.boxSelectionEnabled()&&t.preventDefault();else if(t.touches[1]);else if(t.touches[0]){var y=e.findNearestElements(a[0],a[1],!0,!0),b=y[0];if(null!=b&&(b.activate(),e.touchData.start=b,e.touchData.starts=y,e.nodeIsGrabbable(b))){var x=e.dragData.touchDragEles=n.collection(),w=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),b.selected()?(w=n.$((function(t){return t.selected()&&e.nodeIsGrabbable(t)})),u(w,{addToList:x})):c(b,{addToList:x}),s(b);var E=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};b.emit(E("grabon")),w?w.forEach((function(e){e.emit(E("grab"))})):b.emit(E("grab"))}r(b,["touchstart","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==b&&(e.data.bgActivePosistion={x:o[0],y:o[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout((function(){!1!==e.touchData.singleTouchMoved||e.pinching||e.touchData.selecting||r(e.touchData.start,["taphold"],t,{x:a[0],y:a[1]})}),e.tapholdDuration)}if(t.touches.length>=1){for(var k=e.touchData.startPosition=[null,null,null,null,null,null],O=0;O<a.length;O++)k[O]=i[O]=a[O];var R=t.touches[0];e.touchData.startGPosition=[R.clientX,R.clientY]}}},!1),e.registerBinding(t,"touchmove",V=function(t){var n=e.touchData.capture;if(n||m(t)){var a=e.selection,o=e.cy,s=e.touchData.now,l=e.touchData.earlier,c=o.zoom();if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=h[0],s[1]=h[1]}t.touches[1]&&(h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=h[0],s[3]=h[1]),t.touches[2]&&(h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=h[0],s[5]=h[1]);var p,f=e.touchData.startGPosition;if(n&&t.touches[0]&&f){for(var g=[],v=0;v<s.length;v++)g[v]=s[v]-l[v];var y=t.touches[0].clientX-f[0],b=y*y,x=t.touches[0].clientY-f[1];p=b+x*x>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var w=t.touches[0].clientX-N,E=t.touches[0].clientY-I,M=t.touches[1].clientX-N,z=t.touches[1].clientY-I,A=H(w,E,M,z);if(A/_>=2.25||A>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var O={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(O),e.touchData.start=null):o.emit(O)}}if(n&&e.touchData.cxt){O={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(O):o.emit(O),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var R=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&R===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=R,R&&R.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,a[4]=1,a&&0!==a.length&&void 0!==a[0]?(a[2]=(s[0]+s[2]+s[4])/3,a[3]=(s[1]+s[3]+s[5])/3):(a[0]=(s[0]+s[2]+s[4])/3,a[1]=(s[1]+s[3]+s[5])/3,a[2]=(s[0]+s[2]+s[4])/3+1,a[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&o.zoomingEnabled()&&o.panningEnabled()&&o.userZoomingEnabled()&&o.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),ee=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var V=0;V<ee.length;V++){var F=ee[V]._private;F.grabbed=!1,F.rscratch.inDragLayer=!1}}var j=e.touchData.start,q=(w=t.touches[0].clientX-N,E=t.touches[0].clientY-I,M=t.touches[1].clientX-N,z=t.touches[1].clientY-I,W(w,E,M,z)),Y=q/T;if(L){var X=(w-C+(M-P))/2,K=(E-S+(z-D))/2,G=o.zoom(),U=G*Y,Z=o.pan(),$=B[0]*G+Z.x,Q=B[1]*G+Z.y,J={x:-U/G*($-Z.x-X)+$,y:-U/G*(Q-Z.y-K)+Q};if(j&&j.active()){var ee=e.dragData.touchDragEles;d(ee),e.redrawHint("drag",!0),e.redrawHint("eles",!0),j.unactivate().emit("freeon"),ee.emit("free"),e.dragData.didDrag&&(j.emit("dragfreeon"),ee.emit("dragfree"))}o.viewport({zoom:U,pan:J,cancelOnFailedZoom:!0}),o.emit("pinchzoom"),T=q,C=w,S=E,P=M,D=z,e.pinching=!0}t.touches[0]&&(h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=h[0],s[1]=h[1]),t.touches[1]&&(h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),s[2]=h[0],s[3]=h[1]),t.touches[2]&&(h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),s[4]=h[0],s[5]=h[1])}else if(t.touches[0]&&!e.touchData.didSelect){var te=e.touchData.start,ne=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(R=e.findNearestElement(s[0],s[1],!0,!0)),n&&null!=te&&t.preventDefault(),n&&null!=te&&e.nodeIsDraggable(te))if(p){ee=e.dragData.touchDragEles;var re=!e.dragData.didDrag;re&&u(ee,{inDragLayer:!0}),e.dragData.didDrag=!0;var ae={x:0,y:0};k(g[0])&&k(g[1])&&(ae.x+=g[0],ae.y+=g[1],re&&(e.redrawHint("eles",!0),(ie=e.touchData.dragDelta)&&k(ie[0])&&k(ie[1])&&(ae.x+=ie[0],ae.y+=ie[1]))),e.hoverData.draggingEles=!0,ee.silentShift(ae).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==l[0]&&e.touchData.startPosition[1]==l[1]&&e.redrawHint("eles",!0),e.redraw()}else{var ie;0===(ie=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(ie.push(g[0]),ie.push(g[1])):(ie[0]+=g[0],ie[1]+=g[1])}if(r(te||R,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),te&&te.grabbed()||R==ne||(ne&&ne.emit({originalEvent:t,type:"tapdragout",position:{x:s[0],y:s[1]}}),R&&R.emit({originalEvent:t,type:"tapdragover",position:{x:s[0],y:s[1]}})),e.touchData.last=R,n)for(V=0;V<s.length;V++)s[V]&&e.touchData.startPosition[V]&&p&&(e.touchData.singleTouchMoved=!0);n&&(null==te||te.pannable())&&o.panningEnabled()&&o.userPanningEnabled()&&(i(te,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Ct(e.touchData.startPosition)),e.swipePanning?(o.panBy({x:g[0]*c,y:g[1]*c}),o.emit("dragpan")):p&&(e.swipePanning=!0,o.panBy({x:y*c,y:x*c}),o.emit("dragpan"),te&&(te.unactivate(),e.redrawHint("select",!0),e.touchData.start=null))),h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY),s[0]=h[0],s[1]=h[1])}for(v=0;v<s.length;v++)l[v]=s[v];n&&t.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",F=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",j=function(t){var a=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var i=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]&&(h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),u[2]=h[0],u[3]=h[1]),t.touches[2]&&(h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),u[4]=h[0],u[5]=h[1]),a&&a.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},a?a.emit(o):s.emit(o),!e.touchData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};a?a.emit(p):s.emit(p)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var f=s.collection(e.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}}),f.emit("box").stdFilter((function(e){return e.selectable()&&!e.selected()})).select().emit("boxselect"),f.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=a&&a.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var g=e.dragData.touchDragEles;if(null!=a){var v=a._private.grabbed;d(g),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(a.emit("freeon"),g.emit("free"),e.dragData.didDrag&&(a.emit("dragfreeon"),g.emit("dragfree"))),r(a,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),a.unactivate(),e.touchData.start=null}else{var y=e.findNearestElement(u[0],u[1],!0,!0);r(y,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var m=e.touchData.startPosition[0]-u[0],b=m*m,x=e.touchData.startPosition[1]-u[1],w=(b+x*x)*l*l;e.touchData.singleTouchMoved||(a||s.$(":selected").unselect(["tapunselect"]),r(a,["tap","vclick"],t,{x:u[0],y:u[1]}),q=!1,t.timeStamp-X<=s.multiClickDebounceTime()?(Y&&clearTimeout(Y),q=!0,X=null,r(a,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):(Y=setTimeout((function(){q||r(a,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),X=t.timeStamp)),null!=a&&!e.dragData.didDrag&&a._private.selectable&&w<e.touchTapThreshold2&&!e.pinching&&("single"===s.selectionType()?(s.$(n).unmerge(a).unselect(["tapunselect"]),a.select(["tapselect"])):a.selected()?a.unselect(["tapunselect"]):a.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var E=0;E<u.length;E++)c[E]=u[E];e.dragData.didDrag=!1,0===t.touches.length&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),t.touches.length<2&&(1===t.touches.length&&(e.touchData.startGPosition=[t.touches[0].clientX,t.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())}},!1),"undefined"==typeof TouchEvent){var K=[],G=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},U=function(e){for(var t=0;t<K.length;t++)if(K[t].event.pointerId===e.pointerId)return void K.splice(t,1)},Z=function(e){e.touches=K.map((function(e){return e.touch}))},$=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",(function(e){$(e)||(e.preventDefault(),function(e){K.push(function(e){return{event:e,touch:G(e)}}(e))}(e),Z(e),R(e))})),e.registerBinding(e.container,"pointerup",(function(e){$(e)||(U(e),Z(e),j(e))})),e.registerBinding(e.container,"pointercancel",(function(e){$(e)||(U(e),Z(e),F())})),e.registerBinding(e.container,"pointermove",(function(e){$(e)||(e.preventDefault(),function(e){var t=K.filter((function(t){return t.event.pointerId===e.pointerId}))[0];t.event=e,t.touch=G(e)}(e),Z(e),V(e))}))}};var Il={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl("polygon",e,t,n,r,a,this.points)},intersectLine:function(e,t,n,r,a,i,o,s){return nn(a,i,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,a,i,o,s){return Ut(e,t,this.points,i,o,r,a,[0,-1],n)}}},generateEllipse:function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,s){return function(e,t,n,r,a,i){var o=n-e,s=r-t;o/=a,s/=i;var l=Math.sqrt(o*o+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]}(a,i,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,a,i,o,s){return Qt(e,t,r,a,i,o,n)}}},generateRoundPolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,a,i,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=new Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,u=a/2;i="auto"===i?un(r,a):i;for(var c=new Array(t.length/2),d=0;d<t.length/2;d++)c[d]={x:e+l*t[2*d],y:n+u*t[2*d+1]};var h,p,f,g,v=c.length;for(p=c[v-1],h=0;h<v;h++)f=c[h%v],g=c[(h+1)%v],o[s][h]=ml(p,f,g,i),p=f,f=g;return o[s]},draw:function(e,t,n,r,a,i,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,a,this.points,this.getOrCreateCorners(t,n,r,a,i,o,"drawCorners"))},intersectLine:function(e,t,n,r,a,i,o,s,l){return function(e,t,n,r,a,i,o,s,l){var u,c=[],d=new Array(2*n.length);l.forEach((function(n,i){0===i?(d[d.length-2]=n.startX,d[d.length-1]=n.startY):(d[4*i-2]=n.startX,d[4*i-1]=n.startY),d[4*i]=n.stopX,d[4*i+1]=n.stopY,0!==(u=Jt(e,t,r,a,n.cx,n.cy,n.radius)).length&&c.push(u[0],u[1])}));for(var h=0;h<d.length/4;h++)0!==(u=tn(e,t,r,a,d[4*h],d[4*h+1],d[4*h+2],d[4*h+3],!1)).length&&c.push(u[0],u[1]);if(c.length>2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;g<c.length/2;g++){var v=Math.pow(c[2*g]-e,2)+Math.pow(c[2*g+1]-t,2);v<=f&&(p[0]=c[2*g],p[1]=c[2*g+1],f=v)}return p}return c}(a,i,this.points,e,t,0,0,0,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,a,i,o,s,l){return function(e,t,n,r,a,i,o,s){for(var l=new Array(2*n.length),u=0;u<s.length;u++){var c=s[u];if(l[4*u+0]=c.startX,l[4*u+1]=c.startY,l[4*u+2]=c.stopX,l[4*u+3]=c.stopY,Math.pow(c.cx-e,2)+Math.pow(c.cy-t,2)<=Math.pow(c.radius,2))return!0}return Gt(e,t,l)}(e,t,this.points,0,0,0,0,this.getOrCreateCorners(i,o,r,a,s,l,"corners"))}}},generateRoundRectangle:function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:an(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,s){return Yt(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=r/2,u=a/2;s="auto"===s?ln(r,a):s;var c=2*(s=Math.min(l,u,s));return!!(Ut(e,t,this.points,i,o,r,a-c,[0,-1],n)||Ut(e,t,this.points,i,o,r-c,a,[0,-1],n)||Qt(e,t,c,c,i-l+s,o-u+s,n)||Qt(e,t,c,c,i+l-s,o-u+s,n)||Qt(e,t,c,c,i+l-s,o+u-s,n)||Qt(e,t,c,c,i-l+s,o+u-s,n))}}},generateCutRectangle:function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:an(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,null,i)},generateCutTrianglePts:function(e,t,n,r,a){var i="auto"===a?this.cornerLength:a,o=t/2,s=e/2,l=n-s,u=n+s,c=r-o,d=r+o;return{topLeft:[l,c+i,l+i,c,l+i,c+i],topRight:[u-i,c,u,c+i,u-i,c+i],bottomRight:[u,d-i,u-i,d,u-i,d-i],bottomLeft:[l+i,d,l,d-i,l+i,d-i]}},intersectLine:function(e,t,n,r,a,i,o,s){var l=this.generateCutTrianglePts(n+2*o,r+2*o,e,t,s),u=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return nn(a,i,u,e,t)},checkPoint:function(e,t,n,r,a,i,o,s){var l="auto"===s?this.cornerLength:s;if(Ut(e,t,this.points,i,o,r,a-2*l,[0,-1],n))return!0;if(Ut(e,t,this.points,i,o,r-2*l,a,[0,-1],n))return!0;var u=this.generateCutTrianglePts(r,a,i,o);return Gt(e,t,u.topLeft)||Gt(e,t,u.topRight)||Gt(e,t,u.bottomRight)||Gt(e,t,u.bottomLeft)}}},generateBarrel:function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:an(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a)},intersectLine:function(e,t,n,r,a,i,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),u=function(e){var t=Nt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=Nt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=Nt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,r.x,r.y,e[4],e[5]]},c=[].concat(u(l.topLeft),u(l.topRight),u(l.bottomRight),u(l.bottomLeft));return nn(a,i,c,e,t)},generateBarrelBezierPts:function(e,t,n,r){var a=t/2,i=e/2,o=n-i,s=n+i,l=r-a,u=r+a,c=cn(e,t),d=c.heightOffset,h=c.widthOffset,p=c.ctrlPtOffsetPct*e,f={topLeft:[o,l+d,o+p,l,o+h,l],topRight:[s-h,l,s-p,l,s,l+d],bottomRight:[s,u-d,s-p,u,s-h,u],bottomLeft:[o+h,u,o+p,u,o,u-d]};return f.topLeft.isTop=!0,f.topRight.isTop=!0,f.bottomLeft.isBottom=!0,f.bottomRight.isBottom=!0,f},checkPoint:function(e,t,n,r,a,i,o,s){var l=cn(r,a),u=l.heightOffset,c=l.widthOffset;if(Ut(e,t,this.points,i,o,r,a-2*u,[0,-1],n))return!0;if(Ut(e,t,this.points,i,o,r-2*c,a,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(r,a,i,o),h=function(e,t,n){var r,a,i=n[4],o=n[2],s=n[0],l=n[5],u=n[1],c=Math.min(i,s),d=Math.max(i,s),h=Math.min(l,u),p=Math.max(l,u);if(c<=e&&e<=d&&h<=t&&t<=p){var f=[(r=i)-2*(a=o)+s,2*(a-r),r],g=function(e,t,n,r){var a=t*t-4*e*(n-=r);if(a<0)return[];var i=Math.sqrt(a),o=2*e;return[(-t+i)/o,(-t-i)/o]}(f[0],f[1],f[2],e).filter((function(e){return 0<=e&&e<=1}));if(g.length>0)return g[0]}return null},p=Object.keys(d),f=0;f<p.length;f++){var g=d[p[f]],v=h(e,t,g);if(null!=v){var y=g[5],m=g[3],b=g[1],x=Bt(y,m,b,v);if(g.isTop&&x<=t)return!0;if(g.isBottom&&t<=x)return!0}}return!1}}},generateBottomRoundrectangle:function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:an(4,0),draw:function(e,t,n,r,a,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,a,this.points,i)},intersectLine:function(e,t,n,r,a,i,o,s){var l=t-(r/2+o),u=tn(a,i,e,t,e-(n/2+o),l,e+(n/2+o),l,!1);return u.length>0?u:Yt(a,i,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,a,i,o,s){var l=2*(s="auto"===s?ln(r,a):s);if(Ut(e,t,this.points,i,o,r,a-l,[0,-1],n))return!0;if(Ut(e,t,this.points,i,o,r-l,a,[0,-1],n))return!0;var u=r/2+2*n,c=a/2+2*n;return!!Gt(e,t,[i-u,o-c,i-u,o,i+u,o,i+u,o-c])||!!Qt(e,t,l,l,i+r/2-s,o+a/2-s,n)||!!Qt(e,t,l,l,i-r/2+s,o+a/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",an(3,0)),this.generateRoundPolygon("round-triangle",an(3,0)),this.generatePolygon("rectangle",an(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",an(5,0)),this.generateRoundPolygon("round-pentagon",an(5,0)),this.generatePolygon("hexagon",an(6,0)),this.generateRoundPolygon("round-hexagon",an(6,0)),this.generatePolygon("heptagon",an(7,0)),this.generateRoundPolygon("round-heptagon",an(7,0)),this.generatePolygon("octagon",an(8,0)),this.generateRoundPolygon("round-octagon",an(8,0));var r=new Array(20),a=sn(5,0),i=sn(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[2*s]*=o,i[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=a[2*s],r[4*s+1]=a[2*s+1],r[4*s+2]=i[2*s],r[4*s+3]=i[2*s+1];r=on(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l),e.makePolygon=function(e){var n,r="polygon-"+e.join("$");return(n=this[r])?n:t.generatePolygon(r,e)}}},zl={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||Ge();var t=this;void 0===t.averageRedrawTime&&(t.averageRedrawTime=0),void 0===t.lastRedrawTime&&(t.lastRedrawTime=0),void 0===t.lastDrawTime&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},beforeRender:function(e,t){if(!this.destroyed){null==t&&qe("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort((function(e,t){return t.priority-e.priority}))}}},Al=function(e,t,n){for(var r=e.beforeRenderCallbacks,a=0;a<r.length;a++)r[a].fn(t,n)};zl.startRenderLoop=function(){var e=this,t=e.cy;e.renderLoopStarted||(e.renderLoopStarted=!0,Ee((function n(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){Al(e,!0,r);var a=ke();e.render(e.renderOptions);var i=e.lastDrawTime=ke();void 0===e.averageRedrawTime&&(e.averageRedrawTime=i-a),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=i-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Al(e,!1,r);e.skipFrame=!1,Ee(n)}})))};var Ll=function(e){this.init(e)},Ol=Ll.prototype;Ol.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Ol.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var a=r.document,i=a.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=null!=a.getElementById(o);if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=a.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",i.insertBefore(u,i.children[0])}"static"===r.getComputedStyle(n).getPropertyValue("position")&&Xe("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=k(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},Ol.notify=function(e,t){var n=this,r=n.cy;this.destroyed||("init"!==e?"destroy"!==e?(("add"===e||"remove"===e||"move"===e&&r.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&n.invalidateCachedZSortedEles(),"viewport"===e&&n.redrawHint("select",!0),"load"!==e&&"resize"!==e&&"mount"!==e||(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()):n.destroy():n.load())},Ol.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n.target;(r.off||r.removeEventListener).apply(r,n.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch(e){}},Ol.isHeadless=function(){return!1},[Gs,Ml,Bl,Nl,Il,zl].forEach((function(e){Y(Ol,e)}));var Rl=1e3/60,Vl=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=me((function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()}),e.deqRedrawThreshold),a=e.priority||je;n.beforeRender((function(a,i){var o=ke(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),d=n.getPixelRatio();for(a||n.flushRenderedStyleQueue();;){var h=ke(),p=h-o,f=h-i;if(l<Rl){var g=Rl-(a?s:0);if(f>=e.deqFastCost*g)break}else if(a){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*Rl)break;var v=e.deq(t,d,c);if(!(v.length>0))break;for(var y=0;y<v.length;y++)u.push(v[y])}u.length>0&&(e.onDeqd(t,u),!a&&e.shouldRedraw(t,u,d,c)&&r())}),a(t))}}},Fl=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ve;a(this,e),this.idsByKey=new et,this.keyForId=new et,this.cachesByLvl=new et,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return o(e,[{key:"getIdsFor",value:function(e){null==e&&qe("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new nt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new et,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),jl={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ql=Ue({getKey:null,doesEleInvalidateKey:Ve,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Re,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),Yl=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=ql(t);Y(n,r),n.lookup=new Fl(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Xl=Yl.prototype;Xl.reasons=jl,Xl.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Xl.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Xl.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new lt((function(e,t){return t.reqs-e.reqs}))},Xl.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Xl.getElement=function(e,t,n,r,a){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Pt(s*n))),r<-4)r=-4;else if(s>=7.99||r>3)return null;var u=Math.pow(2,r),c=t.h*u,d=t.w*u,h=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,h))return null;var p,f=l.get(e,r);if(f&&f.invalidated&&(f.invalidated=!1,f.texture.invalidatedWidth-=f.width),f)return f;if(p=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||d>1024)return null;var g=i.getTextureQueue(p),v=g[g.length-2],y=function(){return i.recycleTexture(p,d)||i.addTexture(p,d)};v||(v=g[g.length-1]),v||(v=y()),v.width-v.usedWidth<d&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===h},x=a&&a===jl.dequeue,w=a&&a===jl.highQuality,E=a&&a===jl.downscale,k=r+1;k<=3;k++){var C=l.get(e,k);if(C){m=C;break}}var S=m&&m.level===r+1?m:null,P=function(){v.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,v.usedWidth,0,d,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,d,p),b(S))P();else if(b(m)){if(!w)return i.queueElement(e,m.level-1),m;for(var D=m.level;D>r;D--)S=i.getElement(e,t,n,D,jl.downscale);P()}else{var T;if(!x&&!w&&!E)for(var _=r-1;_>=-4;_--){var M=l.get(e,_);if(M){T=M;break}}if(b(T))return i.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,h,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return f={x:v.usedWidth,texture:v,level:r,scale:u,width:d,height:c,scaledLabelShown:h},v.usedWidth+=Math.ceil(d+8),v.eleCaches.push(f),l.set(e,r,f),i.checkTextureFullness(v),f},Xl.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Xl.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var a=-4;a<=3;a++){var i=n.getForCachedKey(e,a);i&&r.push(i)}if(n.invalidate(e))for(var o=0;o<r.length;o++){var s=r[o],l=s.texture;l.invalidatedWidth+=s.width,s.invalidated=!0,t.checkTextureUtility(l)}t.removeFromQueue(e)}},Xl.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},Xl.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ze(t,e):e.fullnessChecks++},Xl.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ze(n,e),e.retired=!0;for(var a=e.eleCaches,i=0;i<a.length;i++){var o=a[i];r.deleteCache(o.key,o.level)}$e(a),this.getRetiredTextureQueue(t).push(e)},Xl.addTexture=function(e,t){var n={};return this.getTextureQueue(e).push(n),n.eleCaches=[],n.height=e,n.width=Math.max(1024,t),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=this.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n},Xl.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),a=0;a<r.length;a++){var i=r[a];if(i.width>=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,$e(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),Ze(r,i),n.push(i),i}},Xl.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),a=this.getKey(e),i=r[a];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,n.updateItem(i);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(o),r[a]=o}},Xl.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],i=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=i.hasCache(u,s.level);if(r[l]=null,!c){a.push(s);var d=t.getBoundingBox(u);t.getElement(u,d,e,s.level,jl.dequeue)}}return a},Xl.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),a=n[r];null!=a&&(1===a.eles.length?(a.reqs=Oe,t.updateItem(a),t.pop(),n[r]=null):a.eles.unmerge(e))},Xl.onDequeue=function(e){this.onDequeues.push(e)},Xl.offDequeue=function(e){Ze(this.onDequeues,e)},Xl.setupDequeueing=Vl({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,r){for(var a=0;a<t.length;a++)for(var i=t[a].eles,o=0;o<i.length;o++){var s=i[o].boundingBox();if(Ft(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Wl=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=ke()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=me((function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)}),50),n.beforeRender((function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1}),n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new lt((function(e,t){return t.reqs-e.reqs})),t.setupDequeueing()},Hl=Wl.prototype,Kl=0,Gl=Math.pow(2,53)-1;Hl.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),a=Math.ceil(e.h*n),i=this.renderer.makeOffscreenCanvas(r,a),o={id:Kl=++Kl%Gl,bb:e,level:t,width:r,height:a,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(n,n),s.translate(l,u),o},Hl.getLayers=function(e,t,n){var r=this,a=r.renderer.cy.zoom(),i=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(Pt(a*t)))<-4)n=-4;else if(a>=3.99||n>2)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},a=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};a(1),a(-1);for(var i=c.length-1;i>=0;i--){var o=c[i];o.invalid&&Ze(c,o)}}();var d=function(t){var a=(t=t||{}).after;!function(){if(!o){o=zt();for(var t=0;t<e.length;t++)At(o,e[t].boundingBox())}}();var i=Math.ceil(o.w*u),s=Math.ceil(o.h*u);if(i>32767||s>32767)return null;if(i*s>16e6)return null;var l=r.makeLayer(o,n);if(null!=a){var d=c.indexOf(a)+1;c.splice(d,0,l)}else(void 0===t.insert||t.insert)&&c.unshift(l);return l};if(r.skipping&&!i)return null;for(var h=null,p=e.length/1,f=!i,g=0;g<e.length;g++){var v=e[g],y=v._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)h=b;else{if((!h||h.eles.length>=p||!qt(h.bb,v.boundingBox()))&&!(h=d({insert:!0,after:h})))return null;s||f?r.queueLayer(h,v):r.drawEleInLayer(h,v,n,t),h.eles.push(v),m[n]=h}}return s||(f?null:c)},Hl.getEleLevelForLayerLevel=function(e,t){return e},Hl.drawEleInLayer=function(e,t,n,r){var a=this.renderer,i=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(i,!1),a.drawCachedElement(i,t,null,null,n,!0),a.setImgSmoothing(i,!0))},Hl.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,a=0;a<n.length;a++){var i=n[a];if(i.reqs>0)return!1;if(i.invalid)return!1;r+=i.eles.length}return r===t.length},Hl.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var a=n[r],i=-1,o=0;o<t.length;o++)if(a.eles[0]===t[o]){i=o;break}if(i<0)this.invalidateLayer(a);else{var s=i;for(o=0;o<a.eles.length;o++)if(a.eles[o]!==t[s+o]){this.invalidateLayer(a);break}}}},Hl.updateElementsInLayers=function(e,t){for(var n=P(e[0]),r=0;r<e.length;r++)for(var a=n?null:e[r],i=n?e[r]:e[r].ele,o=i._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(a&&this.getEleLevelForLayerLevel(u.level)!==a.level||t(u,i,a))}},Hl.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},Hl.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=ke(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},Hl.invalidateLayer=function(e){if(this.lastInvalidationTime=ke(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ze(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a<n.length;a++){var i=n[a]._private.rscratch.imgLayerCaches;i&&(i[t]=null)}}},Hl.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,(function(e,n,r){var a=e.replacement;if(a||((a=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,a.eles=e.eles),!a.reqs)for(var i=0;i<a.eles.length;i++)t.queueLayer(a,a.eles[i])}))},Hl.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Hl.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,a=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;r.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},Hl.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],a=0;a<1&&0!==n.size();){var i=n.peek();if(i.replacement)n.pop();else if(i.replaces&&i!==i.replaces.replacement)n.pop();else if(i.invalid)n.pop();else{var o=i.elesQueue.shift();o&&(t.drawEleInLayer(i,o,i.level,e),a++),0===r.length&&r.push(!0),0===i.elesQueue.length&&(n.pop(),i.reqs=0,i.replaces&&t.applyLayerReplacement(i),t.requestRedraw())}}return r},Hl.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,r=t.indexOf(n);if(!(r<0||n.invalid)){t[r]=e;for(var a=0;a<e.eles.length;a++){var i=e.eles[a]._private,o=i.imgLayerCaches=i.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},Hl.requestRedraw=me((function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()}),100),Hl.setupDequeueing=Vl({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:je,shouldRedraw:Re,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var Ul,Zl={};function $l(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function Ql(e,t,n){for(var r,a=0;a<t.length;a++){var i=t[a];0===a&&(r=i),e.lineTo(i.x,i.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Jl(e,t,n){e.beginPath&&e.beginPath();for(var r=t,a=0;a<r.length;a++){var i=r[a];e.lineTo(i.x,i.y)}var o=n,s=n[0];for(e.moveTo(s.x,s.y),a=1;a<o.length;a++)i=o[a],e.lineTo(i.x,i.y);e.closePath&&e.closePath()}function eu(e,t,n,r,a){e.beginPath&&e.beginPath(),e.arc(n,r,a,0,2*Math.PI,!1);var i=t,o=i[0];e.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var l=i[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function tu(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}Zl.arrowShapeImpl=function(e){return(Ul||(Ul={polygon:$l,"triangle-backcurve":Ql,"triangle-tee":Jl,"circle-triangle":eu,"triangle-cross":Jl,circle:tu}))[e]};var nu={drawElement:function(e,t,n,r,a,i){t.isNode()?this.drawNode(e,t,n,r,a,i):this.drawEdge(e,t,n,r,a,i)},drawElementOverlay:function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},drawElementUnderlay:function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},drawCachedElementPortion:function(e,t,n,r,a,i,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,a,i);if(null!=c){var d=s(l,t);if(0===d)return;var h,p,f,g,v,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var k=n.getRotationPoint(t);f=k.x,g=k.y,e.translate(f,g),e.rotate(m),(v=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var C=n.getRotationOffset(t);h=C.x,p=C.y}else h=b,p=x;1!==d&&(y=e.globalAlpha,e.globalAlpha=y*d),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,h,p,w,E),1!==d&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-f,-g),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},ru=function(){return 0},au=function(e,t){return e.getTextAngle(t,null)},iu=function(e,t){return e.getTextAngle(t,"source")},ou=function(e,t){return e.getTextAngle(t,"target")},su=function(e,t){return t.effectiveOpacity()},lu=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};nu.drawCachedElement=function(e,t,n,r,a,i){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,d=s.tlbTxrCache,h=t.boundingBox(),p=!0===i?l.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!r||Ft(h,r))){var f=t.isEdge(),g=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,a,p,ru,su),f&&g||o.drawCachedElementPortion(e,t,u,n,a,p,au,lu),f&&!g&&(o.drawCachedElementPortion(e,t,c,n,a,p,iu,lu),o.drawCachedElementPortion(e,t,d,n,a,p,ou,lu)),o.drawElementOverlay(e,t)}},nu.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},nu.drawCachedElements=function(e,t,n,r){for(var a=0;a<t.length;a++){var i=t[a];this.drawCachedElement(e,i,n,r)}},nu.drawCachedNodes=function(e,t,n,r){for(var a=0;a<t.length;a++){var i=t[a];i.isNode()&&this.drawCachedElement(e,i,n,r)}},nu.drawLayeredElements=function(e,t,n,r){var a=this.data.lyrTxrCache.getLayers(t,n);if(a)for(var i=0;i<a.length;i++){var o=a[i],s=o.bb;0!==s.w&&0!==s.h&&e.drawImage(o.canvas,s.x1,s.y1,s.w,s.h)}else this.drawCachedElements(e,t,n,r)};var uu={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!i||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=i?t.pstyle("opacity").value:1,c=i?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===d?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=f,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var w=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,k=t.pstyle("ghost-opacity").value,C=y*k;e.translate(w,E),b(C),x(C),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+g,e.lineCap=f,g>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===d?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,h),e.lineCap="butt")):e.lineCap="butt"}();a&&o.drawEdgeUnderlay(e,t),b(),x(),a&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},cu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var a=this,i=a.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||i?t.lineCap="round":t.lineCap="butt",a.colorStrokeStyle(t,l[0],l[1],l[2],r),a.drawEdgePath(n,t,o.allpts,"solid")}}}};uu.drawEdgeOverlay=cu("overlay"),uu.drawEdgeUnderlay=cu("underlay"),uu.drawEdgePath=function(e,t,n,r){var a,i=e._private.rscratch,o=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$");i.pathCacheKey&&i.pathCacheKey===h?(a=t=i.pathCache,s=!0):(a=t=new Path2D,i.pathCacheKey=h,i.pathCache=a)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([])}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+3<n.length;p+=4)t.quadraticCurveTo(n[p],n[p+1],n[p+2],n[p+3]);break;case"straight":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1]);break;case"segments":if(i.isRound){var g,v=d(i.roundCorners);try{for(v.s();!(g=v.n()).done;)yl(t,g.value)}catch(e){v.e(e)}finally{v.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var y=2;y+1<n.length;y+=2)t.lineTo(n[y],n[y+1])}t=o,l?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},uu.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var i=[n[a+2]-n[a],n[a+3]-n[a+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[a]-l[0],n[a+1]-l[1]),t.lineTo(n[a]+l[0],n[a+1]+l[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},uu.drawArrowheads=function(e,t,n){var r=t._private.rscratch,a="haystack"===r.edgeType;a||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},uu.drawArrowhead=function(e,t,n,r,a,i,o){if(!(isNaN(r)||null==r||isNaN(a)||null==a||isNaN(i)||null==i)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),p="match-line"===h.value?d:h.pfValue;"%"===h.units&&(p*=d);var f=t.pstyle("opacity").value;void 0===o&&(o=f);var g=e.globalCompositeOperation;1===o&&"hollow"!==c||(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,d,l,p,r,a,i),e.globalCompositeOperation=g);var v=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,v[0],v[1],v[2],o),s.colorStrokeStyle(e,v[0],v[1],v[2],o),s.drawArrowShape(t,e,c,d,l,p,r,a,i)}}},uu.drawArrowShape=function(e,t,n,r,a,i,o,s,l){var u,c=this,d=this.usePaths()&&"triangle-cross"!==a,h=!1,p=t,f={x:o,y:s},g=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,g),y=c.arrowShapes[a];if(d){var m=c.arrowPathCache=c.arrowPathCache||[],b=Be(a),x=m[b];null!=x?(u=t=x,h=!0):(u=t=new Path2D,m[b]=u)}h||(t.beginPath&&t.beginPath(),d?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,l,f,r),t.closePath&&t.closePath()),t=p,d&&(t.translate(o,s),t.rotate(l),t.scale(v,v)),"filled"!==n&&"both"!==n||(d?t.fill(u):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=i/(d?v:1),t.lineJoin="miter",d?t.stroke(u):t.stroke()),d&&(t.scale(1/v,1/v),t.rotate(-l),t.translate(-o,-s))};var du={safeDrawImage:function(e,t,n,r,a,i,o,s,l,u){if(!(a<=0||i<=0||l<=0||u<=0))try{e.drawImage(t,n,r,a,i,o,s,l,u)}catch(e){Xe(e)}},drawInscribedImage:function(e,t,n,r,a){var i=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),d=c(n,"background-fit","value",r),h=c(n,"background-repeat","value",r),p=n.width(),f=n.height(),g=2*n.padding(),v=p+("inner"===c(n,"background-width-relative-to","value",r)?0:g),y=f+("inner"===c(n,"background-height-relative-to","value",r)?0:g),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*a,w=c(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;"auto"!==E&&(E=n.pstyle("corner-radius").pfValue);var k=t.width||t.cachedW,C=t.height||t.cachedH;null!=k&&null!=C||(document.body.appendChild(t),k=t.cachedW=t.width||t.offsetWidth,C=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var S=k,P=C;if("auto"!==c(n,"background-width","value",r)&&(S="%"===c(n,"background-width","units",r)?c(n,"background-width","pfValue",r)*v:c(n,"background-width","pfValue",r)),"auto"!==c(n,"background-height","value",r)&&(P="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==S&&0!==P){if("contain"===d)S*=D=Math.min(v/S,y/P),P*=D;else if("cover"===d){var D;S*=D=Math.max(v/S,y/P),P*=D}var T=s-v/2,_=c(n,"background-position-x","units",r),M=c(n,"background-position-x","pfValue",r);T+="%"===_?(v-S)*M:M;var B=c(n,"background-offset-x","units",r),N=c(n,"background-offset-x","pfValue",r);T+="%"===B?(v-S)*N:N;var I=l-y/2,z=c(n,"background-position-y","units",r),A=c(n,"background-position-y","pfValue",r);I+="%"===z?(y-P)*A:A;var L=c(n,"background-offset-y","units",r),O=c(n,"background-offset-y","pfValue",r);I+="%"===L?(y-P)*O:O,m.pathCache&&(T-=s,I-=l,s=0,l=0);var R=e.globalAlpha;e.globalAlpha=x;var V=i.getImgSmoothing(e),F=!1;if("no"===w&&V?(i.setImgSmoothing(e,!1),F=!0):"yes"!==w||V||(i.setImgSmoothing(e,!0),F=!0),"no-repeat"===h)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.clip())),i.safeDrawImage(e,t,0,0,k,C,T,I,S,P),b&&e.restore();else{var j=e.createPattern(t,h);e.fillStyle=j,i.nodeShapes[i.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.translate(T,I),e.fill(),e.translate(-T,-I)}e.globalAlpha=R,F&&i.setImgSmoothing(e,V)}}},hu={};function pu(e,t,n,r,a){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+i,n),e.lineTo(t+r-i,n),e.quadraticCurveTo(t+r,n,t+r,n+i),e.lineTo(t+r,n+a-i),e.quadraticCurveTo(t+r,n+a,t+r-i,n+a),e.lineTo(t+i,n+a),e.quadraticCurveTo(t,n+a,t,n+a-i),e.lineTo(t,n+i),e.quadraticCurveTo(t,n,t+i,n),e.closePath(),o?e.stroke():e.fill()}hu.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),a=Math.ceil(Pt(n*r));t=Math.pow(2,a)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},hu.drawElementText=function(e,t,n,r,a){var i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(i&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(u||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,f=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==a?(o.drawText(e,t,null,f,i),t.isEdge()&&(o.drawText(e,t,"source",f,i),o.drawText(e,t,"target",f,i))):o.drawText(e,t,a,f,i),n&&e.translate(p.x1,p.y1)},hu.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},hu.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",i=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+a+" "+i,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},hu.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",a=e.pstyle(r+"text-rotation"),i=Qe(n,"labelAngle",t);return"autorotate"===a.strValue?e.isEdge()?i:0:"none"===a.strValue?0:a.pfValue},hu.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=t._private.rscratch,o=a?t.effectiveOpacity():1;if(!a||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Qe(i,"labelX",n),c=Qe(i,"labelY",n),d=this.getLabelText(t,n);if(null!=d&&""!==d&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,a);var h,p=n?n+"-":"",f=Qe(i,"labelWidth",n),g=Qe(i,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(h=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(h),u=0,c=0),x){case"top":break;case"center":c+=g/2;break;case"bottom":c+=g}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,C=t.pstyle("text-background-padding").pfValue,S=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(w>0||k>0&&E>0){var P=u-C;switch(b){case"left":P-=f;break;case"center":P-=f/2}var D=c-g-C,T=f+2*C,_=g+2*C;if(w>0){var M=e.fillStyle,B=t.pstyle("text-background-color").value;e.fillStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+w*o+")",S?pu(e,P,D,T,_,2):e.fillRect(P,D,T,_),e.fillStyle=M}if(k>0&&E>0){var N=e.strokeStyle,I=e.lineWidth,z=t.pstyle("text-border-color").value,A=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+E*o+")",e.lineWidth=k,e.setLineDash)switch(A){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(S?pu(e,P,D,T,_,2,"stroke"):e.strokeRect(P,D,T,_),"double"===A){var L=k/2;S?pu(e,P+L,D+L,T-2*L,_-2*L,2,"stroke"):e.strokeRect(P+L,D+L,T-2*L,_-2*L)}e.setLineDash&&e.setLineDash([]),e.lineWidth=I,e.strokeStyle=N}}var O=2*t.pstyle("text-outline-width").pfValue;if(O>0&&(e.lineWidth=O),"wrap"===t.pstyle("text-wrap").value){var R=Qe(i,"labelWrapCachedLines",n),V=Qe(i,"labelLineHeight",n),F=f/2,j=this.getLabelJustification(t);switch("auto"===j||("left"===b?"left"===j?u+=-f:"center"===j&&(u+=-F):"center"===b?"left"===j?u+=-F:"right"===j&&(u+=F):"right"===b&&("center"===j?u+=F:"right"===j&&(u+=f))),x){case"top":case"center":case"bottom":c-=(R.length-1)*V}for(var q=0;q<R.length;q++)O>0&&e.strokeText(R[q],u,c),e.fillText(R[q],u,c),c+=V}else O>0&&e.strokeText(d,u,c),e.fillText(d,u,c);0!==h&&(e.rotate(-h),e.translate(-s,-l))}}};var fu={drawNode:function(e,t,n){var r,a,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],s=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],l=this,u=t._private,c=u.rscratch,d=t.position();if(k(d.x)&&k(d.y)&&(!s||t.visible())){var h,p,f=s?t.effectiveOpacity():1,g=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,a=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E<m.length;E++){var C=m[E];if(b[E]=null!=C&&"none"!==C){var S=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);w++,x[E]=l.getCachedImage(C,S,(function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")}))}}var P=t.pstyle("background-blacken").value,D=t.pstyle("border-width").pfValue,T=t.pstyle("background-opacity").value*f,_=t.pstyle("border-color").value,M=t.pstyle("border-style").value,B=t.pstyle("border-join").value,N=t.pstyle("border-cap").value,I=t.pstyle("border-position").value,z=t.pstyle("border-dash-pattern").pfValue,A=t.pstyle("border-dash-offset").pfValue,L=t.pstyle("border-opacity").value*f,O=t.pstyle("outline-width").pfValue,R=t.pstyle("outline-color").value,V=t.pstyle("outline-style").value,F=t.pstyle("outline-opacity").value*f,j=t.pstyle("outline-offset").value,q=t.pstyle("corner-radius").value;"auto"!==q&&(q=t.pstyle("corner-radius").pfValue);var Y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:T;l.eleFillStyle(e,t,n)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:L;l.colorStrokeStyle(e,_[0],_[1],_[2],t)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F;l.colorStrokeStyle(e,R[0],R[1],R[2],t)},H=function(e,t,n,r){var a,i=l.nodePathCache=l.nodePathCache||[],o=Ne("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+q),s=i[o],u=!1;return null!=s?(a=s,u=!0,c.pathCache=a):(a=new Path2D,i[o]=c.pathCache=a),{path:a,cacheHit:u}},K=t.pstyle("shape").strValue,G=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(d.x,d.y);var U=H(r,a,K,G);h=U.path,v=U.cacheHit}var Z=function(){if(!v){var n=d;g&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(h||e,n.x,n.y,r,a,q,c)}g?e.fill(h):e.fill()},$=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=u.backgrounding,i=0,o=0;o<x.length;o++){var s=t.cy().style().getIndexedStyle(t,"background-image-containment","value",o);r&&"over"===s||!r&&"inside"===s?i++:b[o]&&x[o].complete&&!x[o].error&&(i++,l.drawInscribedImage(e,x[o],t,o,n))}u.backgrounding=!(i===w),a!==u.backgrounding&&t.updateStyle(!1)},Q=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;l.hasPie(t)&&(l.drawPie(e,t,i),n&&(g||l.nodeShapes[l.getNodeShape(t)].draw(e,d.x,d.y,r,a,q,c)))},J=function(){var t=(P>0?P:-P)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:f),n=P>0?0:255;0!==P&&(l.colorFillStyle(e,n,n,n,t),g?e.fill(h):e.fill())},ee=function(){if(D>0){if(e.lineWidth=D,e.lineCap=N,e.lineJoin=B,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(z),e.lineDashOffset=A;break;case"solid":case"double":e.setLineDash([])}if("center"!==I){if(e.save(),e.lineWidth*=2,"inside"===I)g?e.clip(h):e.clip();else{var t=new Path2D;t.rect(-r/2-D,-a/2-D,r+2*D,a+2*D),t.addPath(h),e.clip(t,"evenodd")}g?e.stroke(h):e.stroke(),e.restore()}else g?e.stroke(h):e.stroke();if("double"===M){e.lineWidth=D/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(h):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},te=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=d;g&&(n={x:0,y:0});var i=l.getNodeShape(t),o=D;"inside"===I&&(o=0),"outside"===I&&(o*=2);var s,u=(r+o+(O+j))/r,c=(a+o+(O+j))/a,h=r*u,p=a*c,f=l.nodeShapes[i].points;if(g&&(s=H(h,p,i,f).path),"ellipse"===i)l.drawEllipsePath(s||e,n.x,n.y,h,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(i)){var v=0,y=0,m=0;"round-diamond"===i?v=1.4*(o+j+O):"round-heptagon"===i?(v=1.075*(o+j+O),m=-(o/2+j+O)/35):"round-hexagon"===i?v=1.12*(o+j+O):"round-pentagon"===i?(v=1.13*(o+j+O),m=-(o/2+j+O)/15):"round-tag"===i?(v=1.12*(o+j+O),y=.07*(o/2+O+j)):"round-triangle"===i&&(v=(o+j+O)*(Math.PI/2),m=-(o+j/2+O)/Math.PI),0!==v&&(h=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(i)||(p=a*(c=(a+v)/a)));for(var b=h/2,x=p/2,w=(q="auto"===q?un(h,p):q)+(o+O+j)/2,E=new Array(f.length/2),k=new Array(f.length/2),C=0;C<f.length/2;C++)E[C]={x:n.x+y+b*f[2*C],y:n.y+m+x*f[2*C+1]};var S,P,T,_,M=E.length;for(P=E[M-1],S=0;S<M;S++)T=E[S%M],_=E[(S+1)%M],k[S]=ml(P,T,_,w),P=T,T=_;l.drawRoundPolygonPath(s||e,n.x+y,n.y+m,r*u,a*c,f,k)}else["roundrectangle","round-rectangle"].includes(i)?(q="auto"===q?ln(h,p):q,l.drawRoundRectanglePath(s||e,n.x,n.y,h,p,q+(o+O+j)/2)):["cutrectangle","cut-rectangle"].includes(i)?(q="auto"===q?8:q,l.drawCutRectanglePath(s||e,n.x,n.y,h,p,null,q+(o+O+j)/4)):["bottomroundrectangle","bottom-round-rectangle"].includes(i)?(q="auto"===q?ln(h,p):q,l.drawBottomRoundRectanglePath(s||e,n.x,n.y,h,p,q+(o+O+j)/2)):"barrel"===i?l.drawBarrelPath(s||e,n.x,n.y,h,p):i.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(i)?(f=Zt($t(f,(o+O+j)/r)),l.drawPolygonPath(s||e,n.x,n.y,r,a,f)):(f=Zt($t(f,-(o+O+j)/r)),l.drawPolygonPath(s||e,n.x,n.y,r,a,f));if(g?e.stroke(s):e.stroke(),"double"===V){e.lineWidth=o/3;var B=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(s):e.stroke(),e.globalCompositeOperation=B}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var ne=t.pstyle("ghost-offset-x").pfValue,re=t.pstyle("ghost-offset-y").pfValue,ae=t.pstyle("ghost-opacity").value,ie=ae*f;e.translate(ne,re),W(),te(),Y(ae*T),Z(),$(ie,!0),X(ae*L),ee(),Q(0!==P||0!==D),$(ie,!1),J(ie),e.translate(-ne,-re)}g&&e.translate(-d.x,-d.y),o&&l.drawNodeUnderlay(e,t,d,r,a),g&&e.translate(d.x,d.y),W(),te(),Y(),Z(),$(f,!0),X(),ee(),Q(0!==P||0!==D),$(f,!1),J(),g&&e.translate(-d.x,-d.y),l.drawElementText(e,t,null,i),o&&l.drawNodeOverlay(e,t,d,r,a),n&&e.translate(p.x1,p.y1)}}},gu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,a,i){if(n.visible()){var o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-opacity")).value,l=n.pstyle("".concat(e,"-color")).value,u=n.pstyle("".concat(e,"-shape")).value,c=n.pstyle("".concat(e,"-corner-radius")).value;if(s>0){if(r=r||n.position(),null==a||null==i){var d=n.padding();a=n.width()+2*d,i=n.height()+2*d}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,a+2*o,i+2*o,c),t.fill()}}}};fu.drawNodeOverlay=gu("overlay"),fu.drawNodeUnderlay=gu("underlay"),fu.hasPie=function(e){return(e=e[0])._private.hasPie},fu.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),i=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,d=0;this.usePaths()&&(o=0,s=0),"%"===i.units?c*=i.pfValue:void 0!==i.pfValue&&(c=i.pfValue/2);for(var h=1;h<=a.pieBackgroundN;h++){var p=t.pstyle("pie-"+h+"-background-size").value,f=t.pstyle("pie-"+h+"-background-color").value,g=t.pstyle("pie-"+h+"-background-opacity").value*n,v=p/100;v+d>1&&(v=1-d);var y=1.5*Math.PI+2*Math.PI*d,m=y+2*Math.PI*v;0===p||d>=1||d+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,f[0],f[1],f[2],g),e.fill(),d+=v)}};for(var vu={getPixelRatio:function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},paintCache:function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,a=0;a<n.length;a++)if((t=n[a]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},createGradientStyleFor:function(e,t,n,r,a){var i,o=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===r)if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),d=n.midpoint(),h=Tt(u,d),p=Tt(c,d);i=e.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(h,p))}else{var f=o?{x:0,y:0}:n.position(),g=n.paddedWidth(),v=n.paddedHeight();i=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(g,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();i=e.createLinearGradient(y.x,y.y,m.x,m.y)}else{var b=o?{x:0,y:0}:n.position(),x=n.paddedWidth()/2,w=n.paddedHeight()/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":i=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":i=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":i=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":i=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":i=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":i=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":i=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":i=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!i)return null;for(var E=l.length===s.length,k=s.length,C=0;C<k;C++)i.addColorStop(E?l[C]:C/(k-1),"rgba("+s[C][0]+","+s[C][1]+","+s[C][2]+","+a+")");return i},gradientFillStyle:function(e,t,n,r){var a=this.createGradientStyleFor(e,"background",t,n,r);if(!a)return null;e.fillStyle=a},colorFillStyle:function(e,t,n,r,a){e.fillStyle="rgba("+t+","+n+","+r+","+a+")"},eleFillStyle:function(e,t,n){var r=t.pstyle("background-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientFillStyle(e,t,r,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},gradientStrokeStyle:function(e,t,n,r){var a=this.createGradientStyleFor(e,"line",t,n,r);if(!a)return null;e.strokeStyle=a},colorStrokeStyle:function(e,t,n,r,a){e.strokeStyle="rgba("+t+","+n+","+r+","+a+")"},eleStrokeStyle:function(e,t,n){var r=t.pstyle("line-fill").value;if("linear-gradient"===r||"radial-gradient"===r)this.gradientStrokeStyle(e,t,r,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},matchCanvasSize:function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),a=r[2],i=r[3],o=t.getPixelRatio(),s=t.motionBlurPxRatio;e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]&&e!==t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG]||(o=s);var l,u=a*o,c=i*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=i+"px";for(var h=0;h<t.CANVAS_LAYERS;h++)(l=n.canvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";for(h=0;h<t.BUFFER_COUNT;h++)(l=n.bufferCanvases[h]).width=u,l.height=c,l.style.width=a+"px",l.style.height=i+"px";t.textureMult=1,o<=1&&(l=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,l.width=u*t.textureMult,l.height=c*t.textureMult),t.canvasWidth=u,t.canvasHeight=c}},renderTo:function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},render:function(e){var t=(e=e||Ge()).forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,a=e.forcedZoom,i=e.forcedPan,o=this,s=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,l=o.cy,u=o.data,c=u.canvasNeedsRedraw,d=o.textureOnViewport&&!t&&(o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming),h=void 0!==e.motionBlur?e.motionBlur:o.motionBlur,p=o.motionBlurPxRatio,f=l.hasCompoundNodes(),g=o.hoverData.draggingEles,v=!(!o.hoverData.selecting&&!o.touchData.selecting),y=h=h&&!t&&o.motionBlurEnabled&&!v;t||(o.prevPxRatio!==s&&(o.invalidateContainerClientCoordsCache(),o.matchCanvasSize(o.container),o.redrawHint("eles",!0),o.redrawHint("drag",!0)),o.prevPxRatio=s),!t&&o.motionBlurTimeout&&clearTimeout(o.motionBlurTimeout),h&&(null==o.mbFrames&&(o.mbFrames=0),o.mbFrames++,o.mbFrames<3&&(y=!1),o.mbFrames>o.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!d&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),x=void 0!==a?a:b,w=l.pan(),E={x:w.x,y:w.y},k={zoom:b,pan:{x:w.x,y:w.y}},C=o.prevViewport;void 0===C||k.zoom!==C.zoom||k.pan.x!==C.pan.x||k.pan.y!==C.pan.y||g&&!f||(o.motionBlurPxRatio=1),i&&(E=i),x*=s,E.x*=s,E.y*=s;var S=o.getCachedZSortedEles();function P(e,t,n,r,a){var i=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,a),e.globalCompositeOperation=i}function D(e,r){var s,l,c,d;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=E,l=x,c=o.canvasWidth,d=o.canvasHeight):(s={x:w.x*p,y:w.y*p},l=b*p,c=o.canvasWidth*p,d=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?P(e,0,0,c,d):t||void 0!==r&&!r||e.clearRect(0,0,c,d),n||(e.translate(s.x,s.y),e.scale(l,l)),i&&e.translate(i.x,i.y),a&&e.scale(a,a)}if(d||(o.textureDrawLastFrame=!1),d){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var T=o.data.bufferContexts[o.TEXTURE_BUFFER];T.setTransform(1,0,0,1,0,0),T.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:T,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult}),(k=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight}).mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var _=u.contexts[o.NODE],M=o.textureCache.texture;k=o.textureCache.viewport,_.setTransform(1,0,0,1,0,0),h?P(_,0,0,k.width,k.height):_.clearRect(0,0,k.width,k.height);var B=m.core("outside-texture-bg-color").value,N=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(_,B[0],B[1],B[2],N),_.fillRect(0,0,k.width,k.height),b=l.zoom(),D(_,!1),_.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s),_.drawImage(M,k.mpan.x,k.mpan.y,k.width/k.zoom/s,k.height/k.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var I=l.extent(),z=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),A=o.hideEdgesOnViewport&&z,L=[];if(L[o.NODE]=!c[o.NODE]&&h&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,L[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),L[o.DRAG]=!c[o.DRAG]&&h&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,L[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||L[o.NODE]){var O=h&&!L[o.NODE]&&1!==p;D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.nondrag,s,I):o.drawLayeredElements(_,S.nondrag,s,I),o.debug&&o.drawDebugPoints(_,S.nondrag),n||h||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||L[o.DRAG])&&(O=h&&!L[o.DRAG]&&1!==p,D(_=t||(O?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]),h&&!O?"motionBlur":void 0),A?o.drawCachedNodes(_,S.drag,s,I):o.drawCachedElements(_,S.drag,s,I),o.debug&&o.drawDebugPoints(_,S.drag),n||h||(c[o.DRAG]=!1)),o.showFps||!r&&c[o.SELECT_BOX]&&!n){if(D(_=t||u.contexts[o.SELECT_BOX]),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){b=o.cy.zoom();var R=m.core("selection-box-border-width").value/b;_.lineWidth=R,_.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+")",_.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),R>0&&(_.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+")",_.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){b=o.cy.zoom();var V=u.bgActivePosistion;_.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+")",_.beginPath(),_.arc(V.x,V.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var F=o.lastRedrawTime;if(o.showFps&&F){F=Math.round(F);var j=Math.round(1e3/F);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+F+" ms = "+j+" fps",0,20),_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min(j/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(h&&1!==p){var q=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],H=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(e,0,0,o.canvasWidth,o.canvasHeight);var r=p;e.drawImage(t,0,0,o.canvasWidth*r,o.canvasHeight*r,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||L[o.NODE])&&(H(q,Y,L[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||L[o.DRAG])&&(H(X,W,L[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=k,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),h&&(o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!d,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()}),100)),t||l.emit("render")}},yu={drawPolygonPath:function(e,t,n,r,a,i){var o=r/2,s=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*i[0],n+s*i[1]);for(var l=1;l<i.length/2;l++)e.lineTo(t+o*i[2*l],n+s*i[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,a,i,o){o.forEach((function(t){return yl(e,t)})),e.closePath()},drawRoundRectanglePath:function(e,t,n,r,a,i){var o=r/2,s=a/2,l="auto"===i?ln(r,a):Math.min(i,s,o);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},drawBottomRoundRectanglePath:function(e,t,n,r,a,i){var o=r/2,s=a/2,l="auto"===i?ln(r,a):i;e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},drawCutRectanglePath:function(e,t,n,r,a,i,o){var s=r/2,l=a/2,u="auto"===o?8:o;e.beginPath&&e.beginPath(),e.moveTo(t-s+u,n-l),e.lineTo(t+s-u,n-l),e.lineTo(t+s,n-l+u),e.lineTo(t+s,n+l-u),e.lineTo(t+s-u,n+l),e.lineTo(t-s+u,n+l),e.lineTo(t-s,n+l-u),e.lineTo(t-s,n-l+u),e.closePath()},drawBarrelPath:function(e,t,n,r,a){var i=r/2,o=a/2,s=t-i,l=t+i,u=n-o,c=n+o,d=cn(r,a),h=d.widthOffset,p=d.heightOffset,f=d.ctrlPtOffsetPct*h;e.beginPath&&e.beginPath(),e.moveTo(s,u+p),e.lineTo(s,c-p),e.quadraticCurveTo(s+f,c,s+h,c),e.lineTo(l-h,c),e.quadraticCurveTo(l-f,c,l,c-p),e.lineTo(l,u+p),e.quadraticCurveTo(l-f,u,l-h,u),e.lineTo(s+h,u),e.quadraticCurveTo(s+f,u,s,u+p),e.closePath()}},mu=Math.sin(0),bu=Math.cos(0),xu={},wu={},Eu=Math.PI/40,ku=0*Math.PI;ku<2*Math.PI;ku+=Eu)xu[ku]=Math.sin(ku),wu[ku]=Math.cos(ku);yu.drawEllipsePath=function(e,t,n,r,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,a/2,0,0,2*Math.PI);else for(var i,o,s=r/2,l=a/2,u=0*Math.PI;u<2*Math.PI;u+=Eu)i=t-s*xu[u]*mu+s*wu[u]*bu,o=n+l*wu[u]*mu+l*xu[u]*bu,0===u?e.moveTo(i,o):e.lineTo(i,o);e.closePath()};var Cu={};function Su(e){var t=e.indexOf(",");return e.substr(t+1)}function Pu(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Er((function(r,a){try{t.toBlob((function(e){null!=e?r(e):a(new Error("`canvas.toBlob()` sent a null value in its callback"))}),n,e.quality)}catch(e){a(e)}}));case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),i=0;i<n.length;i++)a[i]=n.charCodeAt(i);return new Blob([r],{type:t})}(Su(r()),n);case"base64":return Su(r());default:return r()}}Cu.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Cu.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),a=e.full?Math.ceil(n.w):r[2],i=e.full?Math.ceil(n.h):r[3],o=k(e.maxWidth)||k(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)a*=e.scale,i*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;k(e.maxWidth)&&(u=l*e.maxWidth/a),k(e.maxHeight)&&(c=l*e.maxHeight/i),a*=l=Math.min(u,c),i*=l}o||(a*=s,i*=s,l*=s);var d=document.createElement("canvas");d.width=a,d.height=i,d.style.width=a+"px",d.style.height=i+"px";var h=d.getContext("2d");if(a>0&&i>0){h.clearRect(0,0,a,i),h.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,p),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,i),h.fill())}return d},Cu.png=function(e){return Pu(e,this.bufferCanvasImage(e),"image/png")},Cu.jpg=function(e){return Pu(e,this.bufferCanvasImage(e),"image/jpeg")};var Du=_u,Tu=_u.prototype;function _u(e){var t=this,n=t.cy.window().document;t.data={canvases:new Array(Tu.CANVAS_LAYERS),contexts:new Array(Tu.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Tu.CANVAS_LAYERS),bufferCanvases:new Array(Tu.BUFFER_COUNT),bufferContexts:new Array(Tu.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=a,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.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"};p&&p.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<Tu.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=n.createElement("canvas");t.data.contexts[l]=u.getContext("2d"),Object.keys(s).forEach((function(e){u.style[e]=s[e]})),u.style.position="absolute",u.setAttribute("data-id","layer"+l),u.style.zIndex=String(Tu.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}for(t.data.topCanvas=t.data.canvases[0],t.data.canvases[Tu.NODE].setAttribute("data-id","layer"+Tu.NODE+"-node"),t.data.canvases[Tu.SELECT_BOX].setAttribute("data-id","layer"+Tu.SELECT_BOX+"-selectbox"),t.data.canvases[Tu.DRAG].setAttribute("data-id","layer"+Tu.DRAG+"-drag"),l=0;l<Tu.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=n.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var c=zt(),d=function(e){return{x:-e.w/2,y:-e.h/2}},h=function(e){return e.boundingBox(),e[0]._private.bodyBounds},f=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||c},g=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||c},v=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||c},y=function(e,t){return t},m=function(e,t,n){var r=e?e+"-":"";return{x:t.x+n.pstyle(r+"text-margin-x").pfValue,y:t.y+n.pstyle(r+"text-margin-y").pfValue}},b=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},x=t.data.eleTxrCache=new Yl(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},drawElement:function(e,n,r,a,i){return t.drawElement(e,n,r,!1,!1,i)},getBoundingBox:h,getRotationPoint:function(e){return{x:((t=h(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2};var t},getRotationOffset:function(e){return d(h(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),w=t.data.lblTxrCache=new Yl(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"main",i)},getBoundingBox:f,getRotationPoint:function(e){return m("",b(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=f(e),n=d(f(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n},isVisible:y}),E=t.data.slbTxrCache=new Yl(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"source",i)},getBoundingBox:g,getRotationPoint:function(e){return m("source",b(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return d(g(e))},isVisible:y}),k=t.data.tlbTxrCache=new Yl(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,n,r,a,i){return t.drawElementText(e,n,r,a,"target",i)},getBoundingBox:v,getRotationPoint:function(e){return m("target",b(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return d(v(e))},isVisible:y}),C=t.data.lyrTxrCache=new Wl(t);t.onUpdateEleCalcs((function(e,t){x.invalidateElements(t),w.invalidateElements(t),E.invalidateElements(t),k.invalidateElements(t),C.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}}));var S=function(e){for(var t=0;t<e.length;t++)C.enqueueElementRefinement(e[t].ele)};x.onDequeue(S),w.onDequeue(S),E.onDequeue(S),k.onDequeue(S)}Tu.CANVAS_LAYERS=3,Tu.SELECT_BOX=0,Tu.DRAG=1,Tu.NODE=2,Tu.BUFFER_COUNT=3,Tu.TEXTURE_BUFFER=0,Tu.MOTIONBLUR_BUFFER_NODE=1,Tu.MOTIONBLUR_BUFFER_DRAG=2,Tu.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Tu.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Tu.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Tu.SELECT_BOX]=t}};var Mu="undefined"!=typeof Path2D;Tu.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},Tu.usePaths=function(){return Mu&&this.pathsEnabled},Tu.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Tu.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Tu.makeOffscreenCanvas=function(e,t){var n;return"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":r(OffscreenCanvas))?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t),n},[Zl,nu,uu,du,hu,fu,vu,yu,Cu,{nodeShapeImpl:function(e,t,n,r,a,i,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,a,i);case"polygon":return this.drawPolygonPath(t,n,r,a,i,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,a,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,a,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,a,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,a,i,s);case"barrel":return this.drawBarrelPath(t,n,r,a,i)}}}].forEach((function(e){Y(Tu,e)}));var Bu=[{type:"layout",extensions:Xs},{type:"renderer",extensions:[{name:"null",impl:Ws},{name:"base",impl:Ll},{name:"canvas",impl:Du}]}],Nu={},Iu={};function zu(e,t,n){var r=n,a=function(n){Xe("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(rs.prototype[t])return a(t);rs.prototype[t]=n}else if("collection"===e){if(bo.prototype[t])return a(t);bo.prototype[t]=n}else if("layout"===e){for(var i=function(e){this.options=e,n.call(this,e),E(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var d=function(e){return e._private.cy},h={addEventFields:function(e,t){t.layout=e,t.cy=d(e),t.target=e},bubble:function(){return!0},parent:function(e){return d(e)}};Y(o,{createEmitter:function(){return this._private.emitter=new Oi(h,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Ca.eventAliasesOn(o),r=i}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=Au("renderer","base"),f=p.prototype,g=n,v=n.prototype,y=function(){p.apply(this,arguments),g.apply(this,arguments)},m=y.prototype;for(var b in f){var x=f[b];if(null!=v[b])return a(b);m[b]=x}for(var w in v)m[w]=v[w];f.clientFunctions.forEach((function(e){m[e]=m[e]||function(){qe("Renderer does not implement `renderer."+e+"()` on its prototype")}})),r=y}else if("__proto__"===e||"constructor"===e||"prototype"===e)return qe(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return W({map:Nu,keys:[e,t],value:r})}function Au(e,t){return H({map:Nu,keys:[e,t]})}function Lu(e,t,n,r,a){return W({map:Iu,keys:[e,t,n,r],value:a})}function Ou(e,t,n,r){return H({map:Iu,keys:[e,t,n,r]})}var Ru=function(){return 2===arguments.length?Au.apply(null,arguments):3===arguments.length?zu.apply(null,arguments):4===arguments.length?Ou.apply(null,arguments):5===arguments.length?Lu.apply(null,arguments):void qe("Invalid extension access syntax")};rs.prototype.extension=Ru,Bu.forEach((function(e){e.extensions.forEach((function(t){zu(e.type,t.name,t.impl)}))}));var Vu=function e(){if(!(this instanceof e))return new e;this.length=0},Fu=Vu.prototype;Fu.instanceString=function(){return"stylesheet"},Fu.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},Fu.css=function(e,t){var n=this.length-1;if(b(e))this[n].properties.push({name:e,value:t});else if(E(e))for(var r=e,a=Object.keys(r),i=0;i<a.length;i++){var o=a[i],s=r[o];if(null!=s){var l=Qo.properties[o]||Qo.properties[z(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},Fu.style=Fu.css,Fu.generateStyle=function(e){var t=new Qo(e);return this.appendToStyle(t)},Fu.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,a=n.properties;e.selector(r);for(var i=0;i<a.length;i++){var o=a[i];e.css(o.name,o.value)}}return e};var ju=function(e){return void 0===e&&(e={}),E(e)?new rs(e):b(e)?Ru.apply(Ru,arguments):void 0};ju.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(ju),e.apply(null,t),this},ju.warnings=function(e){return Ye(e)},ju.version="3.30.4",ju.stylesheet=ju.Stylesheet=Vu}}]);