@reventlessdev/reventless-host-shell 3.0.0-alpha.85 → 3.0.0-alpha.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Geocoder.res-CeTTzLkO.js +1 -0
- package/dist/assets/GraphMode.res-DW1Jfswj.js +1 -0
- package/dist/assets/GraphView.res-B4o_hlrV.js +15 -0
- package/dist/assets/MapMode.res-eVBe7mcb.js +5 -0
- package/dist/assets/StateMachineDiagram.res-TANoSyBh.js +1 -0
- package/dist/assets/__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs_commonjs-proxy-BBGkOHMQ.js +1 -0
- package/dist/assets/__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-DWrxCvCs.js +20 -0
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__reventless_host_shell-BLQUn2lH.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-BS-h5UZc.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-CkYd2Guw.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs-B8MMWKQv.js +1 -0
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-DysgZ6xd.js +1 -0
- package/dist/assets/hostInit-B7rzcxKq.js +1 -0
- package/dist/assets/index-Cdx3tGBL.js +11 -0
- package/dist/assets/index-UCThKRxS.js +1 -0
- package/dist/assets/preload-helper-BhLMWRjL.js +1 -0
- package/dist/assets/remoteEntry-DQwU6kJ5.js +1 -0
- package/dist/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-Dep87C4a.js +1 -0
- package/dist/mf-entry-bootstrap-0.js +2 -2
- package/package.json +7 -6
- package/vite.config.mjs +6 -0
- package/dist/assets/Geocoder.res-BhG45M1K.js +0 -7
- package/dist/assets/GraphMode.res-3KIITtcn.js +0 -1
- package/dist/assets/GraphView.res-DxaoewS-.js +0 -336
- package/dist/assets/MapMode.res-Bw8jTTaX.js +0 -824
- package/dist/assets/StateMachineDiagram.res-ByRwN1Sc.js +0 -3
- package/dist/assets/__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs_commonjs-proxy-CfkhEoF5.js +0 -9
- package/dist/assets/__virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BUE6rcGI.js +0 -24
- package/dist/assets/_virtual_mf-localSharedImportMap___mfe_internal__reventless_host_shell-CzSBjFgf.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-CuPed97e.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-hre-5-8f.js +0 -9
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom__loadShare__.mjs-Bp_g55i_.js +0 -1
- package/dist/assets/_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BzAfciYp.js +0 -1
- package/dist/assets/hostInit-DfBruhJ7.js +0 -1
- package/dist/assets/index-BPpA5yNt.js +0 -133
- package/dist/assets/index-ClvBwV6J.js +0 -1
- package/dist/assets/preload-helper-BlTxHScW.js +0 -1
- package/dist/assets/remoteEntry-Bamd8euJ.js +0 -1
- package/dist/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__reventless_host_shell__remoteEntry-_hash_-C8lRAcSv.js +0 -7
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{h as e,b as t}from"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react__loadShare__.mjs-BS-h5UZc.js";import{p as n,t as r,b as i,h as a,d as o,e as s,i as l,j as u,k as c,l as h,m as d,g as f,n as g,q as p,u as v,v as y,x as m,y as b,f as x,z as w,A as E,B as T,D as _,E as C,R as N,F as A,G as M}from"./index-Cdx3tGBL.js";function D(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{a as k}from"./_virtual_mf___mfe_internal__reventless_host_shell__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-CkYd2Guw.js";function I(e,t,n){let r=void 0!==t?t:[];return s(h(e),e=>{let t=e[1],i=e[0],a=l(t),o=e=>!c(e,r,n),s=u(i,t,a);if("object"==typeof s)switch(s.TAG){case"KEntityId":let e=s._0;return o(e)?[i,e,!1]:void 0;case"KArrayOfEntityIds":let t=s._0;return o(t)?[i,t,!0]:void 0;default:return}})}function P(e,t,n){return 0!==I(e,void 0!==t?t:[],n).length}function S(e,t,n){return n?s(f(g(i(e.dict,t),p),[]),d):v(y(e.dict,t),[],e=>[e])}function L(e){let t=I(e.schema,void 0,void 0),s=n(e),l={};s.forEach(t=>{l[t.key]=r(e,t)});let u=s.map(t=>({id:t.key,label:r(e,t),group:e.readModelName})),c=s.flatMap(n=>t.flatMap(t=>{let r=t[1];return S(n,t[0],t[2]).map(t=>{let n=i(l,t);return void 0!==n?{id:t,label:n,group:e.readModelName}:{id:t,label:(o=t,o.length>8?o.slice(0,8)+"…":o),group:a(r)};var o})})),h=o(u.concat(c),[],(e,t)=>e.some(e=>e.id===t.id)?e:e.concat([t])),d=s.flatMap(e=>t.flatMap(t=>{let n=t[0];return S(e,n,t[2]).filter(t=>t!==e.key).map(t=>({from:e.key,to_:t,label:a(n)}))}));return{nodes:h,edges:d}}function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t,n){return t&&function(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,Y(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function F(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=U(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 a,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,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function z(e,t,n){return(t=Y(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function V(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,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(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 G(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||U(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Y(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function X(e){return X="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},X(e)}function U(e,t){if(e){if("string"==typeof e)return O(e,t);var n={}.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)?O(e,t):void 0}}var j="undefined"==typeof window?null:window,H=j?j.navigator:null;j&&j.document;var W,q,K,Z,$,Q,J,ee,te,ne,re,ie,ae,oe,se,le,ue,ce,he,de,fe,ge,pe,ve,ye,me,be,xe,we=X(""),Ee=X({}),Te=X(function(){}),_e="undefined"==typeof HTMLElement?"undefined":X(HTMLElement),Ce=function(e){return e&&e.instanceString&&Ae(e.instanceString)?e.instanceString():null},Ne=function(e){return null!=e&&X(e)==we},Ae=function(e){return null!=e&&X(e)===Te},Me=function(e){return!Pe(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},De=function(e){return null!=e&&X(e)===Ee&&!Me(e)&&e.constructor===Object},ke=function(e){return null!=e&&X(e)===X(1)&&!isNaN(e)},Ie=function(e){return"undefined"===_e?void 0:null!=e&&e instanceof HTMLElement},Pe=function(e){return Se(e)||Le(e)},Se=function(e){return"collection"===Ce(e)&&e._private.single},Le=function(e){return"collection"===Ce(e)&&!e._private.single},Oe=function(e){return"core"===Ce(e)},Re=function(e){return"stylesheet"===Ce(e)},Be=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},Fe=function(e){return function(e){return null!=e&&X(e)===Ee}(e)&&Ae(e.then)},ze=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(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},Ve=ze(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),Ge=ze(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Ye=ze(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),Xe=function(e){return Be(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ue=function(e,t){return e.slice(-1*t.length)===t},je="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",He="rgb[a]?\\(("+je+"[%]?)\\s*,\\s*("+je+"[%]?)\\s*,\\s*("+je+"[%]?)(?:\\s*,\\s*("+je+"))?\\)",We="rgb[a]?\\((?:"+je+"[%]?)\\s*,\\s*(?:"+je+"[%]?)\\s*,\\s*(?:"+je+"[%]?)(?:\\s*,\\s*(?:"+je+"))?\\)",qe="hsl[a]?\\(("+je+")\\s*,\\s*("+je+"[%])\\s*,\\s*("+je+"[%])(?:\\s*,\\s*("+je+"))?\\)",Ke="hsl[a]?\\((?:"+je+")\\s*,\\s*(?:"+je+"[%])\\s*,\\s*(?:"+je+"[%])(?:\\s*,\\s*(?:"+je+"))?\\)",Ze=function(e,t){return e<t?-1:e>t?1:0},$e=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 i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];e[o]=r[o]}}return e},Qe=function(e){return(Me(e)?e:null)||function(e){return Je[e.toLowerCase()]}(e)||function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,r,i=16;return 4===e.length?(t=parseInt(e[1]+e[1],i),n=parseInt(e[2]+e[2],i),r=parseInt(e[3]+e[3],i)):(t=parseInt(e[1]+e[2],i),n=parseInt(e[3]+e[4],i),r=parseInt(e[5]+e[6],i)),[t,n,r]}}(e)||function(e){var t,n=new RegExp("^"+He+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}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}(e)||function(e){var t,n,r,i,a,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("^"+qe+"$").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,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t}(e)},Je={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]},et=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(De(a))throw Error("Tried to set map with object key");i<n.length-1?(null==t[a]&&(t[a]={}),t=t[a]):t[a]=e.value}},tt=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var a=n[i];if(De(a))throw Error("Tried to get map with object key");if(null==(t=t[a]))return t}return t},nt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function it(){if(q)return W;return q=1,W=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function at(){if(Q)return $;Q=1;var e=function(){if(Z)return K;Z=1;var e="object"==typeof nt&&nt&&nt.Object===Object&&nt;return K=e}(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return $=n}function ot(){if(ie)return re;ie=1;var e=function(){if(ne)return te;ne=1;var e=/\s/;return te=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n},te}(),t=/^\s+/;return re=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n},re}function st(){if(oe)return ae;oe=1;var e=at().Symbol;return ae=e}function lt(){if(de)return he;de=1;var e=st(),t=function(){if(le)return se;le=1;var e=st(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return se=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(l){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(ce)return ue;ce=1;var e=Object.prototype.toString;return ue=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return he=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function ut(){if(ve)return pe;ve=1;var e=lt(),t=ge?fe:(ge=1,fe=function(e){return null!=e&&"object"==typeof e});return pe=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}var ct=rt(function(){if(xe)return be;xe=1;var e=it(),t=function(){if(ee)return J;ee=1;var e=at();return J=function(){return e.Date.now()}}(),n=function(){if(me)return ye;me=1;var e=ot(),t=it(),n=ut(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,a=/^0o[0-7]+$/i,o=parseInt;return ye=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(t(s)){var l="function"==typeof s.valueOf?s.valueOf():s;s=t(l)?l+"":l}if("string"!=typeof s)return 0===s?s:+s;s=e(s);var u=i.test(s);return u||a.test(s)?o(s.slice(2),u?2:8):r.test(s)?NaN:+s}}(),r=Math.max,i=Math.min;return be=function(a,o,s){var l,u,c,h,d,f,g=0,p=!1,v=!1,y=!0;if("function"!=typeof a)throw new TypeError("Expected a function");function m(e){var t=l,n=u;return l=u=void 0,g=e,h=a.apply(n,t)}function b(e){var t=e-f;return void 0===f||t>=o||t<0||v&&e-g>=c}function x(){var e=t();if(b(e))return w(e);d=setTimeout(x,function(e){var t=o-(e-f);return v?i(t,c-(e-g)):t}(e))}function w(e){return d=void 0,y&&l?m(e):(l=u=void 0,h)}function E(){var e=t(),n=b(e);if(l=arguments,u=this,f=e,n){if(void 0===d)return function(e){return g=e,d=setTimeout(x,o),p?m(e):h}(f);if(v)return clearTimeout(d),d=setTimeout(x,o),m(f)}return void 0===d&&(d=setTimeout(x,o)),h}return o=n(o)||0,e(s)&&(p=!!s.leading,c=(v="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),E.cancel=function(){void 0!==d&&clearTimeout(d),g=0,l=f=u=d=void 0},E.flush=function(){return void 0===d?h:w(t())},E}}()),ht=j?j.performance:null,dt=ht&&ht.now?function(){return ht.now()}:function(){return Date.now()},ft=function(){if(j){if(j.requestAnimationFrame)return function(e){j.requestAnimationFrame(e)};if(j.mozRequestAnimationFrame)return function(e){j.mozRequestAnimationFrame(e)};if(j.webkitRequestAnimationFrame)return function(e){j.webkitRequestAnimationFrame(e)};if(j.msRequestAnimationFrame)return function(e){j.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(dt())},1e3/60)}}(),gt=function(e){return ft(e)},pt=dt,vt=9261,yt=5381,mt=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt;!(t=e.next()).done;)n=65599*n+t.value|0;return n},bt=function(e){return 65599*(arguments.length>1&&void 0!==arguments[1]?arguments[1]:vt)+e|0},xt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yt;return(t<<5)+t+e|0},wt=function(e){return 2097152*e[0]+e[1]},Et=function(e,t){return[bt(e[0],t[0]),xt(e[1],t[1])]},Tt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return mt({next:function(){return r<i?n.value=e[r++]:n.done=!0,n}},t)},_t=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return mt({next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}},t)},Ct=function(){return Nt(arguments)},Nt=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];t=0===n?_t(r):_t(r,t)}return t};function At(e,t,n){if(0===n)return e;var r=(t.x1+t.x2)/2,i=(t.y1+t.y2)/2,a=t.w/t.h,o=1/a,s=function(e,t,n,r,i){var a=i*Math.PI/180;return{x:Math.cos(a)*(e-n)-Math.sin(a)*(t-r)+n,y:Math.sin(a)*(e-n)+Math.cos(a)*(t-r)+r}}(e.x,e.y,r,i,n),l=function(e,t,n,r,i,a){return{x:(e-n)*i+n,y:(t-r)*a+r}}(s.x,s.y,r,i,a,o);return{x:l.x,y:l.y}}var Mt=!0,Dt=null!=console.warn,kt=null!=console.trace,It=Number.MAX_SAFE_INTEGER||9007199254740991,Pt=function(){return!0},St=function(){return!1},Lt=function(){return 0},Ot=function(){},Rt=function(e){throw new Error(e)},Bt=function(e){if(void 0===e)return Mt;Mt=!!e},Ft=function(e){Bt()&&(Dt?console.warn(e):(console.log(e),kt&&console.trace()))},zt=function(e){return null==e?e:Me(e)?e.slice():De(e)?function(e){return $e({},e)}(e):e},Vt=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},Gt={},Yt=function(){return Gt},Xt=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var a=t[i],o=null==n?void 0:n[a];r[a]=void 0===o?e[a]:o}return r}},Ut=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},jt=function(e){e.splice(0,e.length)},Ht=function(e,t,n){return n&&(t=Ye(n,t)),e[t]},Wt=function(e,t,n,r){n&&(t=Ye(n,t)),e[t]=r},qt="undefined"!=typeof Map?Map:function(){return B(function e(){R(this,e),this._obj={}},[{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]}}])}(),Kt=function(){return B(function e(t){if(R(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])}},[{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)}}])}(),Zt="undefined"!==("undefined"==typeof Set?"undefined":X(Set))?Set:Kt,$t=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&Oe(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 i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group: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 Zt,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==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];Me(t.classes)?l=t.classes:Ne(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];h&&""!==h&&i.classes.add(h)}this.createEmitter(),(void 0===n||n)&&this.restore();var d=t.style||t.css;d&&(Ft("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))}else Rt("An element must be of type `nodes` or `edges`; you specified `"+r+"`")}else Rt("An element must have a core reference and parameters set")},Qt=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;De(t)&&!Pe(t)&&(t=(i=t).roots||i.root,n=i.visit,r=i.directed),r=2!==arguments.length||Ae(n)?r:n,n=Ae(n)?n:function(){};for(var a,o=this._private.cy,s=t=Ne(t)?this.filter(t):t,l=[],u=[],c={},h={},d={},f=0,g=this.byGroup(),p=g.nodes,v=g.edges,y=0;y<s.length;y++){var m=s[y],b=m.id();m.isNode()&&(l.unshift(m),e.bfs&&(d[b]=!0,u.push(m)),h[b]=0)}for(var x,w=function(){var t=e.bfs?l.shift():l.pop(),i=t.id();if(e.dfs){if(d[i])return 0;d[i]=!0,u.push(t)}var o,s=h[i],g=c[i],y=null!=g?g.source():null,m=null!=g?g.target():null,b=null==g?void 0:t.same(y)?m[0]:y[0];if(!0===(o=n(t,g,b,f++,s)))return a=t,1;if(!1===o)return 1;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],T=E.connectedNodes().filter(function(e){return!e.same(t)&&p.has(e)}),_=T.id();0===T.length||d[_]||(T=T[0],l.push(T),e.bfs&&(d[_]=!0,u.push(T)),c[_]=E,h[_]=h[i]+1)}};0!==l.length&&(0===(x=w())||1!==x););for(var E=o.collection(),T=0;T<u.length;T++){var _=u[T],C=c[_.id()];null!=C&&E.push(C),E.push(_)}return{path:o.collection(E),found:o.collection(a)}}},Jt={breadthFirstSearch:Qt({bfs:!0}),depthFirstSearch:Qt({dfs:!0})};Jt.bfs=Jt.breadthFirstSearch,Jt.dfs=Jt.depthFirstSearch;var en,tn,nn,rn={exports:{}},an=rn.exports;function on(){return en||(en=1,e=rn,function(){var t,n,r,i,a,o,s,l,u,c,h,d,f,g,p;r=Math.floor,c=Math.min,n=function(e,t){return e<t?-1:e>t?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);i<a;)o(t,e[s=r((i+a)/2)])<0?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),g(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,p(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,p(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&r(e[0],t)<0&&(t=(i=[e[0],t])[0],e[0]=i[1],p(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),l=[],a=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;a<o;a++)i=s[a],l.push(p(e,i,t));return l},f=function(e,t,r){var i;if(null==r&&(r=n),-1!==(i=e.indexOf(t)))return g(e,0,i,r),p(e,i,r)},h=function(e,t,r){var a,o,l,u,c;if(null==r&&(r=n),!(o=e.slice(0,t)).length)return o;for(i(o,r),l=0,u=(c=e.slice(t)).length;l<u;l++)a=c[l],s(o,a,r);return o.sort(r).reverse()},d=function(e,t,r){var o,s,l,h,d,f,g,p,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],h=0,f=(g=e.slice(t)).length;h<f;h++)r(o=g[h],s)<0&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,p=c(t,e.length);0<=p?d<p:d>p;0<=p?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},p=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i<a;)(s=i+1)<a&&!(r(e[i],e[s])<0)&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,g(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=f,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(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 i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return f(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(an)),rn.exports;var e}var sn,ln=rt(nn?tn:(nn=1,tn=on())),un=Xt({root:null,weight:function(e){return 1},directed:!1}),cn={dijkstra:function(e){if(!De(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=un(e),r=n.root,i=n.weight,a=n.directed,o=this,s=i,l=Ne(r)?this.filter(r)[0]:r[0],u={},c={},h={},d=this.byGroup(),f=d.nodes,g=d.edges;g.unmergeBy(function(e){return e.isLoop()});for(var p=function(e){return u[e.id()]},v=function(e,t){u[e.id()]=t,y.updateItem(e)},y=new ln(function(e,t){return p(e)-p(t)}),m=0;m<f.length;m++){var b=f[m];u[b.id()]=b.same(l)?0:1/0,y.push(b)}for(var x=function(e,t){for(var n,r=(a?e.edgesTo(t):e.edgesWith(t)).intersect(g),i=1/0,o=0;o<r.length;o++){var l=r[o],u=s(l);(u<i||!n)&&(i=u,n=l)}return{edge:n,dist:i}};y.size()>0;){var w=y.pop(),E=p(w),T=w.id();if(h[T]=E,E!==1/0)for(var _=w.neighborhood().intersect(f),C=0;C<_.length;C++){var N=_[C],A=N.id(),M=x(w,N),D=E+M.dist;D<p(N)&&(v(N,D),c[A]={node:w,edge:M.edge})}}return{distanceTo:function(e){var t=Ne(e)?f.filter(e)[0]:e[0];return h[t.id()]},pathTo:function(e){var t=Ne(e)?f.filter(e)[0]:e[0],n=[],r=t,i=r.id();if(t.length>0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},hn={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t<a.length;t++){if(a[t].has(e))return t}},l=0;l<i;l++)a[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 h=u[c],d=h.source()[0],f=h.target()[0],g=s(d),p=s(f),v=a[g],y=a[p];g!==p&&(o.merge(h),v.merge(y),a.splice(p,1))}return o}},dn=Xt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),fn={aStar:function(e){var t=this.cy(),n=dn(e),r=n.root,i=n.goal,a=n.heuristic,o=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l,u,c=r.id(),h=i.id(),d={},f={},g={},p=new ln(function(e,t){return f[e.id()]-f[t.id()]}),v=new Zt,y={},m={},b=function(e,t){p.push(e),v.add(t)},x=function(){l=p.pop(),u=l.id(),v.delete(u)},w=function(e){return v.has(e)};b(r,c),d[c]=0,f[c]=a(r);for(var E=0;p.size()>0;){if(x(),E++,u===h){for(var T=[],_=i,C=h,N=m[C];T.unshift(_),null!=N&&T.unshift(N),null!=(_=y[C]);)N=m[C=_.id()];return{found:!0,distance:d[u],path:this.spawn(T),steps:E}}g[u]=!0;for(var A=l._private.edges,M=0;M<A.length;M++){var D=A[M];if(this.hasElementWithId(D.id())&&(!o||D.data("source")===u)){var k=D.source(),I=D.target(),P=k.id()!==u?k:I,S=P.id();if(this.hasElementWithId(S)&&!g[S]){var L=d[u]+s(D);w(S)?L<d[S]&&(d[S]=L,f[S]=L+a(P),y[S]=l,m[S]=D):(d[S]=L,f[S]=L+a(P),b(P,S),y[S]=l,m[S]=D)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},gn=Xt({weight:function(e){return 1},directed:!1}),pn={floydWarshall:function(e){for(var t=this.cy(),n=gn(e),r=n.weight,i=n.directed,a=r,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,h=function(e){return s.indexOf(e)},d=function(e){return s[e]},f=new Array(c),g=0;g<c;g++){var p=g%u,v=(g-p)/u;f[g]=v===p?0:1/0}for(var y=new Array(c),m=new Array(c),b=0;b<l.length;b++){var x=l[b],w=x.source()[0],E=x.target()[0];if(w!==E){var T=h(w),_=h(E),C=T*u+_,N=a(x);if(f[C]>N&&(f[C]=N,y[C]=_,m[C]=x),!i){var A=_*u+T;!i&&f[A]>N&&(f[A]=N,y[A]=T,m[A]=x)}}}for(var M=0;M<u;M++)for(var D=0;D<u;D++)for(var k=D*u+M,I=0;I<u;I++){var P=D*u+I,S=M*u+I;f[k]+f[S]<f[P]&&(f[P]=f[k]+f[S],y[P]=y[k])}var L=function(e){return h(function(e){return(Ne(e)?t.filter(e):e)[0]}(e))},O={distance:function(e,t){var n=L(e),r=L(t);return f[n*u+r]},path:function(e,n){var r=L(e),i=L(n),a=d(r);if(r===i)return a.collection();if(null==y[r*u+i])return t.collection();var o,s=t.collection(),l=r;for(s.merge(a);r!==i;)l=r,r=y[r*u+i],o=m[l*u+r],s.merge(o),s.merge(d(r));return s}};return O}},vn=Xt({weight:function(e){return 1},directed:!1,root:null}),yn={bellmanFord:function(e){var t=this,n=vn(e),r=n.weight,i=n.directed,a=n.root,o=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,d=h.length,f=new qt,g=!1,p=[];a=l.collection(a)[0],c.unmergeBy(function(e){return e.isLoop()});for(var v=c.length,y=function(e){var t=f.get(e.id());return t||(t={},f.set(e.id(),t)),t},m=function(e){return(Ne(e)?l.$(e):e)[0]},b=0;b<d;b++){var x=h[b],w=y(x);x.same(a)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var E=!1,T=function(e,t,n,r,i,a){var o=r.dist+a;o<i.dist&&!n.same(r.edge)&&(i.dist=o,i.pred=e,i.edge=n,E=!0)},_=1;_<d;_++){E=!1;for(var C=0;C<v;C++){var N=c[C],A=N.source(),M=N.target(),D=o(N),k=y(A),I=y(M);T(A,0,N,k,I,D),i||T(M,0,N,I,k,D)}if(!E)break}if(E)for(var P=[],S=0;S<v;S++){var L=c[S],O=L.source(),R=L.target(),B=o(L),F=y(O).dist,z=y(R).dist;if(F+B<z||!i&&z+B<F){if(g||(Ft("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),!1===e.findNegativeWeightCycles)break;var V=[];F+B<z&&V.push(O),!i&&z+B<F&&V.push(R);for(var G=V.length,Y=0;Y<G;Y++){var X=V[Y],U=[X];U.push(y(X).edge);for(var j=y(X).pred;-1===U.indexOf(j);)U.push(j),U.push(y(j).edge),j=y(j).pred;for(var H=(U=U.slice(U.indexOf(j)))[0].id(),W=0,q=2;q<U.length;q+=2)U[q].id()<H&&(H=U[q].id(),W=q);(U=U.slice(W).concat(U.slice(0,W))).push(U[0]);var K=U.map(function(e){return e.id()}).join(",");-1===P.indexOf(K)&&(p.push(s.spawn(U)),P.push(K))}}}return{distanceTo:function(e){return y(m(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a,r=[],i=m(e);;){if(null==i)return t.spawn();var o=y(i),l=o.edge,u=o.pred;if(r.unshift(i[0]),i.same(n)&&r.length>0)break;null!=l&&r.unshift(l),i=u}return s.spawn(r)},hasNegativeWeightCycle:g,negativeWeightCycles:p}}},mn=Math.sqrt(2),bn=function(e,t,n){0===n.length&&Rt("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var f=0;f<l.length;f++){var g=l[f];g[1]===s?(l[f]=g.slice(),l[f][1]=o):g[2]===s&&(l[f]=g.slice(),l[f][2]=o)}for(var p=0;p<t.length;p++)t[p]===s&&(t[p]=o);return l},xn=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=bn(i,e,t),n--}return t},wn={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/mn);if(!(i<2)){for(var l=[],u=0;u<a;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,d=[],f=new Array(i),g=new Array(i),p=new Array(i),v=function(e,t){for(var n=0;n<i;n++)t[n]=e[n]},y=0;y<=o;y++){for(var m=0;m<i;m++)g[m]=m;var b=xn(g,l.slice(),i,s),x=b.slice();v(g,p);var w=xn(g,b,s,2),E=xn(p,x,s,2);w.length<=E.length&&w.length<h?(h=w.length,d=w,v(g,f)):E.length<=w.length&&E.length<h&&(h=E.length,d=E,v(p,f))}for(var T=this.spawn(d.map(function(e){return r[e[0]]})),_=this.spawn(),C=this.spawn(),N=f[0],A=0;A<f.length;A++){var M=f[A],D=n[A];M===N?_.merge(D):C.merge(D)}var k=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEach(function(t){e.contains(t)&&!T.contains(t)&&n.merge(t)})}),n},I=[k(_),k(C)];return{cut:T,components:I,partition1:_,partition2:C}}Rt("At least 2 nodes are required for Karger-Stein algorithm")}},En=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Tn=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},_n=function(e){return{x:e[0],y:e[1]}},Cn=function(e,t){return Math.atan2(t,e)-Math.PI/2},Nn=Math.log2||function(e){return Math.log(e)/Math.log(2)},An=function(e){return e>0?1:e<0?-1:0},Mn=function(e,t){return Math.sqrt(Dn(e,t))},Dn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},kn=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},In=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},Pn=function(e,t,n,r){return{x:In(e.x,t.x,n.x,r),y:In(e.y,t.y,n.y,r)}},Sn=function(e,t,n){return Math.max(e,Math.min(n,t))},Ln=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}}},On=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},Rn=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},Bn=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},Fn=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=V(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},zn=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},Vn=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)))))))},Gn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Yn=function(e,t){return Gn(e,t.x,t.y)},Xn=function(e,t){return Gn(e,t.x1,t.y1)&&Gn(e,t.x2,t.y2)},Un=null!==(sn=Math.hypot)&&void 0!==sn?sn:function(e,t){return Math.sqrt(e*e+t*t)};function jn(e,t,n,r,i,a){var o=function(e,t){if(e.length<3)throw new Error("Need at least 3 vertices");var n=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},r=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},i=function(e,t){return{x:e.x*t,y:e.y*t}},a=function(e,t){return e.x*t.y-e.y*t.x},o=function(e){var t=Un(e.x,e.y);return 0===t?{x:0,y:0}:{x:e.x/t,y:e.y/t}},s=function(e,t,o,s){var l=r(t,e),u=r(s,o),c=a(l,u);if(Math.abs(c)<1e-9)return n(e,i(l,.5));var h=a(r(o,e),u)/c;return n(e,i(l,h))},l=e.map(function(e){return{x:e.x,y:e.y}});(function(e){for(var t=0,n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length];t+=r.x*i.y-i.x*r.y}return t/2})(l)<0&&l.reverse();for(var u=l.length,c=[],h=0;h<u;h++){var d=l[h],f=l[(h+1)%u],g=r(f,d),p=o({x:g.y,y:-g.x});c.push(p)}for(var v=c.map(function(e,r){return{p1:n(l[r],i(e,t)),p2:n(l[(r+1)%u],i(e,t))}}),y=[],m=0;m<u;m++){var b=v[(m-1+u)%u],x=v[m],w=s(b.p1,b.p2,x.p1,x.p2);y.push(w)}return y}(ar(e,t,n,r,i),a),s=Ln();return o.forEach(function(e){return Rn(s,e.x,e.y)}),s}var Hn=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?hr(i,a):u,h=i/2,d=a/2,f=(c=Math.min(c,h,d))!==h,g=c!==d;if(f){var p=r-d-o;if((s=ir(e,t,n,r,n-h+c-o,p,n+h-c+o,p,!1)).length>0)return s}if(g){var v=n+h+o;if((s=ir(e,t,n,r,v,r-d+c-o,v,r+d-c+o,!1)).length>0)return s}if(f){var y=r+d+o;if((s=ir(e,t,n,r,n-h+c-o,y,n+h-c+o,y,!1)).length>0)return s}if(g){var m=n-h-o;if((s=ir(e,t,n,r,m,r-d+c-o,m,r+d-c+o,!1)).length>0)return s}var b=n-h+c,x=r-d+c;if((l=nr(e,t,n,r,b,x,c+o)).length>0&&l[0]<=b&&l[1]<=x)return[l[0],l[1]];var w=n+h-c,E=r-d+c;if((l=nr(e,t,n,r,w,E,c+o)).length>0&&l[0]>=w&&l[1]<=E)return[l[0],l[1]];var T=n+h-c,_=r+d-c;if((l=nr(e,t,n,r,T,_,c+o)).length>0&&l[0]>=T&&l[1]>=_)return[l[0],l[1]];var C=n-h+c,N=r+d-c;return(l=nr(e,t,n,r,C,N,c+o)).length>0&&l[0]<=C&&l[1]>=N?[l[0],l[1]]:[]},Wn=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},qn=function(e,t,n,r,i,a,o,s,l){var u=Math.min(n,o,i)-l,c=Math.max(n,o,i)+l,h=Math.min(r,s,a)-l,d=Math.max(r,s,a)+l;return!(e<u||e>c||t<h||t>d)},Kn=function(e,t,n,r,i,a,o,s){var l=[];!function(e,t,n,r,i){var a,o,s,l,u,c,h,d;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,i[4]=i[2]=-(d+h)):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=[],c=0;c<6;c+=2)Math.abs(l[c+1])<1e-7&&l[c]>=0&&l[c]<=1&&u.push(l[c]);u.push(1),u.push(0);for(var h,d,f,g=-1,p=0;p<u.length;p++)h=Math.pow(1-u[p],2)*n+2*(1-u[p])*u[p]*i+u[p]*u[p]*o,d=Math.pow(1-u[p],2)*r+2*(1-u[p])*u[p]*a+u[p]*u[p]*s,f=Math.pow(h-e,2)+Math.pow(d-t,2),g>=0?f<g&&(g=f):g=f;return g},Zn=function(e,t,n,r,i,a){var o=[e-n,t-r],s=[i-n,a-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],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-a)*(t-a):u-h},$n=function(e,t,n){for(var r,i,a,o,s=0,l=0;l<n.length/2;l++)if(r=n[2*l],i=n[2*l+1],l+1<n.length/2?(a=n[2*(l+1)],o=n[2*(l+1)+1]):(a=n[2*(l+1-n.length/2)],o=n[2*(l+1-n.length/2)+1]),r==e&&a==e);else{if(!(r>=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},Qn=function(e,t,n,r,i,a,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 h,d=Math.cos(-u),f=Math.sin(-u),g=0;g<c.length/2;g++)c[2*g]=a/2*(n[2*g]*d-n[2*g+1]*f),c[2*g+1]=o/2*(n[2*g+1]*d+n[2*g]*f),c[2*g]+=r,c[2*g+1]+=i;if(l>0){var p=er(c,-l);h=Jn(p)}else h=c;return $n(e,t,h)},Jn=function(e){for(var t,n,r,i,a,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],i=e[4*c+3],c<e.length/4-1?(a=e[4*(c+1)],o=e[4*(c+1)+1],s=e[4*(c+1)+2],l=e[4*(c+1)+3]):(a=e[0],o=e[1],s=e[2],l=e[3]);var h=ir(t,n,r,i,a,o,s,l,!0);u[2*c]=h[0],u[2*c+1]=h[1]}return u},er=function(e,t){for(var n,r,i,a,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?(i=e[2*(s+1)],a=e[2*(s+1)+1]):(i=e[0],a=e[1]);var l=a-r,u=-(i-n),c=Math.sqrt(l*l+u*u),h=l/c,d=u/c;o[4*s]=n+h*t,o[4*s+1]=r+d*t,o[4*s+2]=i+h*t,o[4*s+3]=a+d*t}return o},tr=function(e,t,n,r,i,a,o){return e-=i,t-=a,(e/=n/2+o)*e+(t/=r/2+o)*t<=1},nr=function(e,t,n,r,i,a,o){var s=[n-e,r-t],l=[e-i,t-a],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=c*c-4*u*(l[0]*l[0]+l[1]*l[1]-o*o);if(h<0)return[];var d=(-c+Math.sqrt(h))/(2*u),f=(-c-Math.sqrt(h))/(2*u),g=Math.min(d,f),p=Math.max(d,f),v=[];if(g>=0&&g<=1&&v.push(g),p>=0&&p<=1&&v.push(p),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]},rr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},ir=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,f=r-t,g=s-a,p=h*d-g*u,v=c*d-f*u,y=g*c-h*f;if(0!==y){var m=p/y,b=v/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||l?[e+m*c,t+m*f]:[]}return 0===p||0===v?rr(e,n,o)===o?[o,s]:rr(e,n,i)===i?[i,a]:rr(i,o,n)===n?[n,r]:[]:[]},ar=function(e,t,n,r,i){var a=[],o=r/2,s=i/2,l=t,u=n;a.push({x:l+o*e[0],y:u+s*e[1]});for(var c=1;c<e.length/2;c++)a.push({x:l+o*e[2*c],y:u+s*e[2*c+1]});return a},or=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,f,g=[],p=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y<p.length/2;y++)p[2*y]=n[2*y]*a+r,p[2*y+1]=n[2*y+1]*o+i;if(s>0){var m=er(p,-s);u=Jn(m)}else u=p}else u=n;for(var b=0;b<u.length/2;b++)c=u[2*b],h=u[2*b+1],b<u.length/2-1?(d=u[2*(b+1)],f=u[2*(b+1)+1]):(d=u[0],f=u[1]),0!==(l=ir(e,t,r,i,c,h,d,f)).length&&g.push(l[0],l[1]);return g},sr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),a=(i-n)/i;return a<0&&(a=1e-5),[t[0]+a*r[0],t[1]+a*r[1]]},lr=function(e,t){var n=cr(e,t);return n=ur(n)},ur=function(e){for(var t,n,r=e.length/2,i=1/0,a=1/0,o=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);for(var u=2/(o-i),c=2/(s-a),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),o=Math.max(o,t),a=Math.min(a,n),s=Math.max(s,n);if(a<-1)for(var d=0;d<r;d++)n=e[2*d+1]=e[2*d+1]+(-1-a);return e},cr=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 i,a=new Array(2*e),o=0;o<e;o++)i=o*n+r,a[2*o]=Math.cos(i),a[2*o+1]=Math.sin(-i);return a},hr=function(e,t){return Math.min(e/4,t/4,8)},dr=function(e,t){return Math.min(e/10,t/10,8)},fr=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}};function gr(e,t){function n(e){for(var t=[],n=0;n<e.length;n++){var r=e[n],i=e[(n+1)%e.length],a={x:i.x-r.x,y:i.y-r.y},o={x:-a.y,y:a.x},s=Math.sqrt(o.x*o.x+o.y*o.y);t.push({x:o.x/s,y:o.y/s})}return t}function r(e,t){var n,r=1/0,i=-1/0,a=F(e);try{for(a.s();!(n=a.n()).done;){var o=n.value,s=o.x*t.x+o.y*t.y;r=Math.min(r,s),i=Math.max(i,s)}}catch(l){a.e(l)}finally{a.f()}return{min:r,max:i}}function i(e,t){return!(e.max<t.min||t.max<e.min)}var a,o=F([].concat(G(n(e)),G(n(t))));try{for(o.s();!(a=o.n()).done;){var s=a.value;if(!i(r(e,s),r(t,s)))return!1}}catch(l){o.e(l)}finally{o.f()}return!0}var pr=Xt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),vr={pageRank:function(e){for(var t=pr(e),n=t.dampingFactor,r=t.precision,i=t.iterations,a=t.weight,o=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,d=u.length,f=new Array(h),g=new Array(c),p=(1-n)/c,v=0;v<c;v++){for(var y=0;y<c;y++){f[v*c+y]=0}g[v]=0}for(var m=0;m<d;m++){var b=u[m],x=b.data("source"),w=b.data("target");if(x!==w){var E=l.indexOfId(x),T=l.indexOfId(w),_=a(b);f[T*c+E]+=_,g[E]+=_}}for(var C=1/c+p,N=0;N<c;N++)if(0===g[N])for(var A=0;A<c;A++){f[A*c+N]=C}else for(var M=0;M<c;M++){var D=M*c+N;f[D]=f[D]/g[N]+p}for(var k,I=new Array(c),P=new Array(c),S=0;S<c;S++)I[S]=1;for(var L=0;L<i;L++){for(var O=0;O<c;O++)P[O]=0;for(var R=0;R<c;R++)for(var B=0;B<c;B++){var F=R*c+B;P[R]+=f[F]*I[B]}kn(P),k=I,I=P,P=k;for(var z=0,V=0;V<c;V++){var G=k[V]-I[V];z+=G*G}if(z<r)break}return{rank:function(e){return e=o.collection(e)[0],I[l.indexOf(e)]}}}},yr=Xt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),mr={degreeCentralityNormalized:function(e){e=yr(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},a={},o=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);o<h.indegree&&(o=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,a[c]=h.outdegree}return{indegree:function(e){return 0==o?0:(Ne(e)&&(e=t.filter(e)),i[e.id()]/o)},outdegree:function(e){return 0===s?0:(Ne(e)&&(e=t.filter(e)),a[e.id()]/s)}}}for(var d={},f=0,g=0;g<r;g++){var p=n[g];e.root=p;var v=this.degreeCentrality(e);f<v.degree&&(f=v.degree),d[p.id()]=v.degree}return{degree:function(e){return 0===f?0:(Ne(e)&&(e=t.filter(e)),d[e.id()]/f)}}},degreeCentrality:function(e){e=yr(e);var t=this.cy(),n=this,r=e,i=r.root,a=r.weight,o=r.directed,s=r.alpha;if(i=t.collection(i)[0],o){for(var l=i.connectedEdges(),u=l.filter(function(e){return e.target().same(i)&&n.has(e)}),c=l.filter(function(e){return e.source().same(i)&&n.has(e)}),h=u.length,d=c.length,f=0,g=0,p=0;p<u.length;p++)f+=a(u[p]);for(var v=0;v<c.length;v++)g+=a(c[v]);return{indegree:Math.pow(h,1-s)*Math.pow(f,s),outdegree:Math.pow(d,1-s)*Math.pow(g,s)}}for(var y=i.connectedEdges().intersection(n),m=y.length,b=0,x=0;x<y.length;x++)b+=a(y[x]);return{degree:Math.pow(m,1-s)*Math.pow(b,s)}}};mr.dc=mr.degreeCentrality,mr.dcn=mr.degreeCentralityNormalised=mr.degreeCentralityNormalized;var br=Xt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),xr={closenessCentralityNormalized:function(e){for(var t=br(e),n=t.harmonic,r=t.weight,i=t.directed,a=this.cy(),o={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,d=l[c],f=0;f<l.length;f++)if(c!==f){var g=u.distance(d,l[f]);h+=n?1/g:g}n||(h=1/h),s<h&&(s=h),o[d.id()]=h}return{closeness:function(e){return 0==s?0:(e=Ne(e)?a.filter(e)[0].id():e.id(),o[e]/s)}}},closenessCentrality:function(e){var t=br(e),n=t.root,r=t.weight,i=t.directed,a=t.harmonic;n=this.filter(n)[0];for(var o=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=o.distanceTo(c);s+=a?1/h:h}}return a?s:1/s}};xr.cc=xr.closenessCentrality,xr.ccn=xr.closenessCentralityNormalised=xr.closenessCentralityNormalized;var wr=Xt({weight:null,directed:!1}),Er={betweennessCentrality:function(e){for(var t=wr(e),n=t.directed,r=t.weight,i=null!=r,a=this.cy(),o=this.nodes(),s={},l={},u=0,c=function(e,t){l[e]=t,t>u&&(u=t)},h=function(e){return l[e]},d=0;d<o.length;d++){var f=o[d],g=f.id();s[g]=n?f.outgoers().nodes():f.openNeighborhood().nodes(),c(g,0)}for(var p=function(){for(var e=o[v].id(),t=[],n={},l={},u={},d=new ln(function(e,t){return u[e]-u[t]}),f=0;f<o.length;f++){var g=o[f].id();n[g]=[],l[g]=0,u[g]=1/0}for(l[e]=1,u[e]=0,d.push(e);!d.empty();){var p=d.pop();if(t.push(p),i)for(var y=0;y<s[p].length;y++){var m=s[p][y],b=a.getElementById(p),x=void 0;x=b.edgesTo(m).length>0?b.edgesTo(m)[0]:m.edgesTo(b)[0];var w=r(x);m=m.id(),u[m]>u[p]+w&&(u[m]=u[p]+w,d.nodes.indexOf(m)<0?d.push(m):d.updateItem(m),l[m]=0,n[m]=[]),u[m]==u[p]+w&&(l[m]=l[m]+l[p],n[m].push(p))}else for(var E=0;E<s[p].length;E++){var T=s[p][E].id();u[T]==1/0&&(d.push(T),u[T]=u[p]+1),u[T]==u[p]+1&&(l[T]=l[T]+l[p],n[T].push(p))}}for(var _={},C=0;C<o.length;C++)_[o[C].id()]=0;for(;t.length>0;){for(var N=t.pop(),A=0;A<n[N].length;A++){var M=n[N][A];_[M]=_[M]+l[M]/l[N]*(1+_[N])}N!=o[v].id()&&c(N,h(N)+_[N])}},v=0;v<o.length;v++)p();var y={betweenness:function(e){var t=a.collection(e).id();return h(t)},betweennessNormalized:function(e){if(0==u)return 0;var t=a.collection(e).id();return h(t)/u}};return y.betweennessNormalised=y.betweennessNormalized,y}};Er.bc=Er.betweennessCentrality;var Tr=Xt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),_r=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},Cr=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var a=0;a<t;a++)e[a*t+r]=e[a*t+r]/n}},Nr=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var a=0;a<n;a++)r[i*n+a]=0;for(var o=0;o<n;o++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+o]*t[o*n+s]}return r},Ar=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=Nr(e,r,t);return e},Mr=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Cr(r,t),r},Dr=function(e,t,n,r){for(var i=0;i<n;i++){if(Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r)!==Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r))return!1}return!0},kr=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},Ir=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=function(e){return Tr(e)}(e),a={},o=0;o<t.length;o++)a[t[o].id()]=o;for(var s,l=t.length,u=l*l,c=new Array(u),h=0;h<u;h++)c[h]=0;for(var d=0;d<n.length;d++){var f=n[d],g=a[f.source().id()],p=a[f.target().id()],v=_r(f,i.attributes);c[g*l+p]+=v,c[p*l+g]+=v}!function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n}(c,l,i.multFactor),Cr(c,l);for(var y=!0,m=0;y&&m<i.maxIterations;)y=!1,s=Ar(c,l,i.expandFactor),c=Mr(s,l,i.inflateFactor),Dr(c,s,u,4)||(y=!0),m++;var b=function(e,t,n,r){for(var i=[],a=0;a<t;a++){for(var o=[],s=0;s<t;s++)Math.round(1e3*e[a*t+s])/1e3>0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(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&&kr(e[t],e[n])&&e.splice(n,1);return e}(b),b},Pr={markovClustering:Ir,mcl:Ir},Sr=function(e){return e},Lr=function(e,t){return Math.abs(t-e)},Or=function(e,t,n){return e+Lr(t,n)},Rr=function(e,t,n){return e+Math.pow(n-t,2)},Br=function(e){return Math.sqrt(e)},Fr=function(e,t,n){return Math.max(e,Lr(t,n))},zr=function(e,t,n,r,i){for(var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Sr,o=r,s=0;s<e;s++)o=i(o,t(s),n(s));return a(o)},Vr={euclidean:function(e,t,n){return e>=2?zr(e,t,n,0,Rr,Br):zr(e,t,n,0,Or)},squaredEuclidean:function(e,t,n){return zr(e,t,n,0,Rr)},manhattan:function(e,t,n){return zr(e,t,n,0,Or)},max:function(e,t,n){return zr(e,t,n,-1/0,Fr)}};function Gr(e,t,n,r,i,a){var o;return o=Ae(e)?e:Vr[e]||Vr.euclidean,0===t&&Ae(e)?o(i,a):o(t,n,r,i,a)}Vr["squared-euclidean"]=Vr.squaredEuclidean,Vr.squaredeuclidean=Vr.squaredEuclidean;var Yr=Xt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Xr=function(e){return Yr(e)},Ur=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return Gr(e,r.length,a,function(e){return r[e](t)},o,s)},jr=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,a[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()*(a[c]-i[c])+i[c];o[u]=s}return o},Hr=function(e,t,n,r,i){for(var a=1/0,o=0,s=0;s<t.length;s++){var l=Ur(n,e,t[s],r,i);l<a&&(a=l,o=s)}return o},Wr=function(e,t,n){for(var r=[],i=null,a=0;a<t.length;a++)n[(i=t[a]).id()]===e&&r.push(i);return r},qr=function(e,t,n){return Math.abs(t-e)<=n},Kr=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){if(Math.abs(e[r][i]-t[r][i])>n)return!1}return!0},Zr=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},$r=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];Zr(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var a=0;a<t;a++)n[a]=e[Math.floor(Math.random()*e.length)];return n},Qr=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=Ur("manhattan",t[i],e,n,"kMedoids");return r},Jr=function(e,t,n,r,i){for(var a,o,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){a=0,o=0;for(var h=0;h<t.length;h++)a+=r[h][u]*i.attributes[c](t[h]),o+=r[h][u];e[u][c]=a/o}},ei=function(e,t,n,r,i){for(var a=0;a<e.length;a++)t[a]=e[a].slice();for(var o,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){o=0;for(var d=0;d<n.length;d++)s=Ur(i.distance,r[h],n[c],i.attributes,"cmeans"),l=Ur(i.distance,r[h],n[d],i.attributes,"cmeans"),o+=Math.pow(s/l,u);e[h][c]=1/o}},ti=function(e){var t,n,r,i,a,o=this.cy(),s=this.nodes(),l=Xr(e);i=new Array(s.length);for(var u=0;u<s.length;u++)i[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 h=0;h<s.length;h++){for(var d=0,f=0;f<l.k;f++)r[h][f]=Math.random(),d+=r[h][f];for(var g=0;g<l.k;g++)r[h][g]=r[h][g]/d}n=new Array(l.k);for(var p=0;p<l.k;p++)n[p]=new Array(l.attributes.length);a=new Array(s.length);for(var v=0;v<s.length;v++)a[v]=new Array(l.k);for(var y=!0,m=0;y&&m<l.maxIterations;)y=!1,Jr(n,s,r,a,l),ei(r,i,n,s,l),Kr(r,i,l.sensitivityThreshold)||(y=!0),m++;return t=function(e,t,n,r){for(var i,a,o=new Array(n.k),s=0;s<o.length;s++)o[s]=[];for(var l=0;l<t.length;l++){i=-1/0,a=-1;for(var u=0;u<t[0].length;u++)t[l][u]>i&&(i=t[l][u],a=u);o[a].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}},ni={kMeans:function(e){var t,n=this.cy(),r=this.nodes(),i=null,a=Xr(e),o=new Array(a.k),s={};a.testMode?"number"==typeof a.testCentroids?(a.testCentroids,t=jr(r,a.k,a.attributes)):t="object"===X(a.testCentroids)?a.testCentroids:jr(r,a.k,a.attributes):t=jr(r,a.k,a.attributes);for(var l=!0,u=0;l&&u<a.maxIterations;){for(var c=0;c<r.length;c++)s[(i=r[c]).id()]=Hr(i,t,a.distance,a.attributes,"kMeans");l=!1;for(var h=0;h<a.k;h++){var d=Wr(h,r,s);if(0!==d.length){for(var f=a.attributes.length,g=t[h],p=new Array(f),v=new Array(f),y=0;y<f;y++){v[y]=0;for(var m=0;m<d.length;m++)i=d[m],v[y]+=a.attributes[y](i);p[y]=v[y]/d.length,qr(p[y],g[y],a.sensitivityThreshold)||(l=!0)}t[h]=p,o[h]=n.collection(d)}}u++}return o},kMedoids:function(e){var t,n,r=this.cy(),i=this.nodes(),a=null,o=Xr(e),s=new Array(o.k),l={},u=new Array(o.k);o.testMode?"number"==typeof o.testCentroids||(t="object"===X(o.testCentroids)?o.testCentroids:$r(i,o.k)):t=$r(i,o.k);for(var c=!0,h=0;c&&h<o.maxIterations;){for(var d=0;d<i.length;d++)l[(a=i[d]).id()]=Hr(a,t,o.distance,o.attributes,"kMedoids");c=!1;for(var f=0;f<t.length;f++){var g=Wr(f,i,l);if(0!==g.length){u[f]=Qr(t[f],g,o.attributes);for(var p=0;p<g.length;p++)(n=Qr(g[p],g,o.attributes))<u[f]&&(u[f]=n,t[f]=g[p],c=!0);s[f]=r.collection(g)}}h++}return s},fuzzyCMeans:ti,fcm:ti},ri=Xt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ii={single:"min",complete:"max"},ai=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return Gr(i.distance,l.length,function(t){return l[t](e)},function(e){return l[e](t)},e,t)},c=0;c<e.length;c++){var h=e[c].key,d=n[h][r[h]];d<s&&(o=h,s=d)}if("threshold"===i.mode&&s>=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var f,g=t[o],p=t[r[o]];f="dendrogram"===i.mode?{left:g,right:p,key:g.key}:{value:g.value.concat(p.value),key:g.key},e[g.index]=f,e.splice(p.index,1),t[g.key]=f;for(var v=0;v<e.length;v++){var y=e[v];g.key===y.key?a=1/0:"min"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]>n[p.key][y.key]&&(a=n[p.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]<n[p.key][y.key]&&(a=n[p.key][y.key])):a="mean"===i.linkage?(n[g.key][y.key]*g.size+n[p.key][y.key]*p.size)/(g.size+p.size):"dendrogram"===i.mode?u(y.value,g.value):u(y.value[0],g.value[0]),n[g.key][y.key]=n[y.key][g.key]=a}for(var m=0;m<e.length;m++){var b=e[m].key;if(r[b]===g.key||r[b]===p.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 g.key=p.key=g.index=p.index=null,!0},oi=function(e,t,n){e&&(e.value?t.push(e.value):(e.left&&oi(e.left,t),e.right&&oi(e.right,t)))},si=function(e,t){if(!e)return"";if(e.left&&e.right){var n=si(e.left,t),r=si(e.right,t),i=t.add({group:"nodes",data:{id:n+","+r}});return t.add({group:"edges",data:{source:n,target:i.id()}}),t.add({group:"edges",data:{source:r,target:i.id()}}),i.id()}return e.value?e.value.id():void 0},li=function(e,t,n){if(!e)return[];var r=[],i=[],a=[];return 0===t?(e.left&&oi(e.left,r),e.right&&oi(e.right,i),a=r.concat(i),[n.collection(a)]):1===t?e.value?[n.collection(e.value)]:(e.left&&oi(e.left,r),e.right&&oi(e.right,i),[n.collection(r),n.collection(i)]):e.value?[n.collection(e.value)]:(e.left&&(r=li(e.left,t-1,n)),e.right&&(i=li(e.right,t-1,n)),r.concat(i))},ui=function(e){for(var t=this.cy(),n=this.nodes(),r=function(e){var t=ri(e),n=ii[t.linkage];return null!=n&&(t.linkage=n),t}(e),i=r.attributes,a=function(e,t){return Gr(r.distance,i.length,function(t){return i[t](e)},function(e){return i[e](t)},e,t)},o=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:"dendrogram"===r.mode?n[c]:[n[c]],key:c,index:c};o[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var d=0;d<o.length;d++)for(var f=0;f<=d;f++){var g=void 0;g="dendrogram"===r.mode?d===f?1/0:a(o[d].value,o[f].value):d===f?1/0:a(o[d].value[0],o[f].value[0]),s[d][f]=g,s[f][d]=g,g<s[d][l[d]]&&(l[d]=f)}for(var p,v=ai(o,u,s,l,r);v;)v=ai(o,u,s,l,r);return"dendrogram"===r.mode?(p=li(o[0],r.dendrogramDepth,t),r.addDendrogram&&si(o[0],t)):(p=new Array(o.length),o.forEach(function(e,n){e.key=e.index=null,p[n]=t.collection(e.value)})),p},ci={hierarchicalClustering:ui,hca:ui},hi=Xt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),di=function(e,t,n,r){var i=function(e,t){return r[t](e)};return-Gr(e,r.length,function(e){return i(t,e)},function(e){return i(n,e)},t,n)},fi=function(e,t){var n=null;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],i=!(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 a=0,o=e.length-1;o>=0;o--){var s=e[o];i?isFinite(s)||(e[o]=-1/0,a++):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+a]:(e[u-1+a]+e[u+a])/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,i=0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(r+=o,i++)}return r/i}(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,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.min(a,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,i=t;i<n;i++){var a=e[i];isFinite(a)&&(r=Math.max(a,r))}return r}(e):t,n},gi=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var a=-1,o=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>o&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},pi=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Rt("Damping must range on [0.5, 1). Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(e){return e===n})||ke(n)||Rt("Preference must be one of [".concat(r.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number. Got: ").concat(n)),hi(e)}(e),c={},h=0;h<l.length;h++)c[l[h].id()]=h;n=(t=l.length)*t,r=new Array(n);for(var d=0;d<n;d++)r[d]=-1/0;for(var f=0;f<t;f++)for(var g=0;g<t;g++)f!==g&&(r[f*t+g]=di(u.distance,l[f],l[g],u.attributes));i=fi(r,u.preference);for(var p=0;p<t;p++)r[p*t+p]=i;a=new Array(n);for(var v=0;v<n;v++)a[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,T=new Array(t*u.minIterations),_=0;_<T.length;_++)T[_]=0;for(E=0;E<u.maxIterations;E++){for(var C=0;C<t;C++){for(var N=-1/0,A=-1/0,M=-1,D=0,k=0;k<t;k++)m[k]=a[C*t+k],(D=o[C*t+k]+r[C*t+k])>=N?(A=N,N=D,M=k):D>A&&(A=D);for(var I=0;I<t;I++)a[C*t+I]=(1-u.damping)*(r[C*t+I]-N)+u.damping*m[I];a[C*t+M]=(1-u.damping)*(r[C*t+M]-A)+u.damping*m[M]}for(var P=0;P<t;P++){for(var S=0,L=0;L<t;L++)m[L]=o[L*t+P],b[L]=Math.max(0,a[L*t+P]),S+=b[L];S-=b[P],b[P]=a[P*t+P],S+=b[P];for(var O=0;O<t;O++)o[O*t+P]=(1-u.damping)*Math.min(0,S-b[O])+u.damping*m[O];o[P*t+P]=(1-u.damping)*(S-b[P])+u.damping*m[P]}for(var R=0,B=0;B<t;B++){var F=o[B*t+B]+a[B*t+B]>0?1:0;T[E%u.minIterations*t+B]=F,R+=F}if(R>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var z=0,V=0;V<t;V++){x[V]=0;for(var G=0;G<u.minIterations;G++)x[V]+=T[G*t+V];0!==x[V]&&x[V]!==u.minIterations||z++}if(z===t)break}}for(var Y=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=gi(e,t,n),i=0;i<n.length;i++){for(var a=[],o=0;o<r.length;o++)r[o]===n[i]&&a.push(o);for(var s=-1,l=-1/0,u=0;u<a.length;u++){for(var c=0,h=0;h<a.length;h++)c+=t[a[h]*e+a[u]];c>l&&(s=u,l=c)}n[i]=a[s]}return gi(e,t,n)}(t,r,Y),U={},j=0;j<Y.length;j++)U[Y[j]]=[];for(var H=0;H<l.length;H++){var W=X[c[l[H].id()]];null!=W&&U[W].push(l[H])}for(var q=new Array(Y.length),K=0;K<Y.length;K++)q[K]=s.collection(U[Y[K]]);return q},vi={affinityPropagation:pi,ap:pi},yi=Xt({root:void 0,directed:!1}),mi={hierholzer:function(e){if(!De(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=yi(e),o=a.root,s=a.directed,l=this,u=!1;o&&(i=Ne(o)?this.filter(o)[0].id():o[0].id());var c={},h={};s?l.forEach(function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;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 h[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())})):h[t]=[e.source().id(),e.target().id()]});var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var f=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=h[t][0],i!=(r=h[t][1])?(c[r]=c[r].filter(function(e){return e!=t}),i=r):s||i==n||(c[n]=c[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},g=[],p=[];for(p=f(i);1!=p.length;)0==c[p[0]].length?(g.unshift(l.getElementById(p.shift())),g.unshift(l.getElementById(p.shift()))):p=f(p.shift()).concat(p);for(var v in g.unshift(l.getElementById(p.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},bi=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(l,u,c){l===c&&(r+=1),t[u]={id:n,low:n++,cutVertex:!1};var h,d,f,g,p=e.getElementById(u).connectedEdges().intersection(e);0===p.size()?i.push(e.spawn(e.getElementById(u))):p.forEach(function(n){h=n.source().id(),d=n.target().id(),(f=h===u?d:h)!==c&&(g=n.id(),o[g]||(o[g]=!0,a.push({x:u,y:f,edge:n})),f in t?t[u].low=Math.min(t[u].low,t[f].id):(s(l,f,u),t[u].low=Math.min(t[u].low,t[f].low),t[u].id<=t[f].low&&(t[u].cutVertex=!0,function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach(function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach(function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter(function(e){return e.isLoop()})):l.merge(i)})}),i.push(l)}(u,f))))})};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:i}},xi=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.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=i.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),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},wi={};[Jt,cn,hn,fn,pn,yn,wn,vr,mr,xr,Er,Pr,ni,ci,vi,mi,{hopcroftTarjanBiconnected:bi,htbc:bi,htb:bi,hopcroftTarjanBiconnectedComponents:bi},{tarjanStronglyConnected:xi,tsc:xi,tscc:xi,tarjanStronglyConnectedComponents:xi}].forEach(function(e){$e(wi,e)});
|
|
2
|
+
/*!
|
|
3
|
+
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
|
|
4
|
+
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
|
|
5
|
+
Licensed under The MIT License (http://opensource.org/licenses/MIT)
|
|
6
|
+
*/
|
|
7
|
+
var Ei=function(e){if(!(this instanceof Ei))return new Ei(e);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 e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Ei.prototype={fulfill:function(e){return Ti(this,1,"fulfillValue",e)},reject:function(e){return Ti(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Ei;return n.onFulfilled.push(Ni(e,r,"fulfill")),n.onRejected.push(Ni(t,r,"reject")),_i(n),r.proxy}};var Ti=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,_i(e)),e},_i=function(e){1===e.state?Ci(e,"onFulfilled",e.fulfillValue):2===e.state&&Ci(e,"onRejected",e.rejectReason)},Ci=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e<r.length;e++)r[e](n)};"function"==typeof setImmediate?setImmediate(i):setTimeout(i,0)}},Ni=function(e,t,n){return function(r){if("function"!=typeof e)t[n].call(t,r);else{var i;try{i=e(r)}catch(a){return void t.reject(a)}Ai(t,i)}}},Ai=function(e,t){if(e!==t&&e.proxy!==t){var n;if("object"===X(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(i){return void e.reject(i)}if("function"!=typeof n)e.fulfill(t);else{var r=!1;try{n.call(t,function(n){r||(r=!0,n===t?e.reject(new TypeError("circular thenable chain")):Ai(e,n))},function(t){r||(r=!0,e.reject(t))})}catch(i){r||e.reject(i)}}}else e.reject(new TypeError("cannot resolve promise with itself"))};Ei.all=function(e){return new Ei(function(t,n){for(var r=new Array(e.length),i=0,a=function(n,a){r[n]=a,++i===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){a(t,e)},function(e){n(e)}):a(t,r)})(o)})},Ei.resolve=function(e){return new Ei(function(t,n){t(e)})},Ei.reject=function(e){return new Ei(function(t,n){n(e)})};var Mi="undefined"!=typeof Promise?Promise:Ei,Di=function(e,t,n){var r=Oe(e),i=!r,a=this._private=$e({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&Ae(a.complete)&&a.completes.push(a.complete),i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(r){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},ki=Di.prototype;$e(ki,{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),Pe(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 i=e.style[r],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[r]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;if("frame"===e)t=n.frames;else t=n.completes;return new Mi(function(e,n){t.push(function(){e()})})}}),ki.complete=ki.completed,ki.run=ki.play,ki.running=ki.playing;var Ii,Pi,Si,Li,Oi,Ri,Bi,Fi,zi,Vi,Gi,Yi,Xi,Ui,ji,Hi,Wi,qi,Ki,Zi,$i,Qi,Ji,ea,ta,na,ra,ia,aa,oa,sa,la,ua,ca,ha,da,fa,ga,pa,va,ya,ma,ba,xa,wa,Ea,Ta,_a,Ca,Na,Aa,Ma,Da,ka,Ia,Pa,Sa,La,Oa,Ra,Ba,Fa,za,Va,Ga,Ya,Xa,Ua,ja,Ha,Wa,qa,Ka,Za,$a,Qa,Ja,eo,to,no,ro,io,ao,oo,so,lo,uo={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,i=r?n:[n],a=this._private.cy||this,o=!r,s=!o;if(!a.styleEnabled())return this;var l=a.style();if(e=$e({},e,t),0===Object.keys(e).length)return new Di(i[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=a.pan(),h=a.zoom();e.position=Tn(u,h,c)}if(o&&null!=e.panBy){var d=e.panBy,f=a.pan();e.pan={x:f.x+d.x,y:f.y+d.y}}var g=e.center||e.centre;if(o&&null!=g){var p=a.getCenterPan(g.eles,e.zoom);null!=p&&(e.pan=p)}if(o&&null!=e.fit){var v=e.fit,y=a.getFitViewport(v.eles||v.boundingBox,v.padding);null!=y&&(e.pan=y.pan,e.zoom=y.zoom)}if(o&&De(e.zoom)){var m=a.getZoomedViewport(e.zoom);null!=m?(m.zoomed&&(e.zoom=m.zoom),m.panned&&(e.pan=m.pan)):e.zoom=null}return new Di(i[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=$e({},e,t));for(var i=0;i<r.length;i++){var a=r[i],o=a.animated()&&(void 0===e.queue||e.queue);a.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],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<r.length;a++){for(var o=r[a]._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 i.notify("draw"),this}}};function co(){if(Pi)return Ii;Pi=1;var e=Array.isArray;return Ii=e}function ho(){if(Vi)return zi;Vi=1;var e,t=function(){if(Fi)return Bi;Fi=1;var e=at()["__core-js_shared__"];return Bi=e}(),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return zi=function(e){return!!n&&n in e}}function fo(){if(Ui)return Xi;Ui=1;var e=function(){if(Ri)return Oi;Ri=1;var e=lt(),t=it();return Oi=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}(),t=ho(),n=it(),r=function(){if(Yi)return Gi;Yi=1;var e=Function.prototype.toString;return Gi=function(t){if(null!=t){try{return e.call(t)}catch(n){}try{return t+""}catch(n){}}return""}}(),i=/^\[object .+?Constructor\]$/,a=Function.prototype,o=Object.prototype,s=a.toString,l=o.hasOwnProperty,u=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Xi=function(a){return!(!n(a)||t(a))&&(e(a)?u:i).test(r(a))}}function go(){if(qi)return Wi;qi=1;var e=fo(),t=(Hi||(Hi=1,ji=function(e,t){return null==e?void 0:e[t]}),ji);return Wi=function(n,r){var i=t(n,r);return e(i)?i:void 0},Wi}function po(){if(Zi)return Ki;Zi=1;var e=go()(Object,"create");return Ki=e}function vo(){if(la)return sa;la=1;var e=function(){if(Qi)return $i;Qi=1;var e=po();return $i=function(){this.__data__=e?e(null):{},this.size=0}}(),t=ea?Ji:(ea=1,Ji=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),n=function(){if(na)return ta;na=1;var e=po(),t=Object.prototype.hasOwnProperty;return ta=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0},ta}(),r=function(){if(ia)return ra;ia=1;var e=po(),t=Object.prototype.hasOwnProperty;return ra=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)},ra}(),i=function(){if(oa)return aa;oa=1;var e=po();return aa=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this},aa}();function a(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])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,sa=a}function yo(){if(da)return ha;return da=1,ha=function(e,t){return e===t||e!=e&&t!=t}}function mo(){if(ga)return fa;ga=1;var e=yo();return fa=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1},fa}function bo(){if(_a)return Ta;_a=1;var e=ca?ua:(ca=1,ua=function(){this.__data__=[],this.size=0}),t=function(){if(va)return pa;va=1;var e=mo(),t=Array.prototype.splice;return pa=function(n){var r=this.__data__,i=e(r,n);return!(i<0||(i==r.length-1?r.pop():t.call(r,i,1),--this.size,0))},pa}(),n=function(){if(ma)return ya;ma=1;var e=mo();return ya=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]},ya}(),r=function(){if(xa)return ba;xa=1;var e=mo();return ba=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(Ea)return wa;Ea=1;var e=mo();return wa=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this},wa}();function a(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])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ta=a}function xo(){if(Ma)return Aa;Ma=1;var e=vo(),t=bo(),n=function(){if(Na)return Ca;Na=1;var e=go()(at(),"Map");return Ca=e}();return Aa=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}function wo(){if(Pa)return Ia;Pa=1;var e=ka?Da:(ka=1,Da=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return Ia=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map},Ia}function Eo(){if(Ya)return Ga;Ya=1;var e=xo(),t=function(){if(La)return Sa;La=1;var e=wo();return Sa=function(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}}(),n=function(){if(Ra)return Oa;Ra=1;var e=wo();return Oa=function(t){return e(this,t).get(t)}}(),r=function(){if(Fa)return Ba;Fa=1;var e=wo();return Ba=function(t){return e(this,t).has(t)}}(),i=function(){if(Va)return za;Va=1;var e=wo();return za=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this},za}();function a(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])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ga=a}function To(){if(Ha)return ja;Ha=1;var e=function(){if(Ua)return Xa;Ua=1;var e=Eo();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,Xa=t}();return ja=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n},ja}function _o(){if(qa)return Wa;qa=1;var e=To(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r});return Wa=r}function Co(){if(Za)return Ka;return Za=1,Ka=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i},Ka}function No(){if(eo)return Ja;eo=1;var e=function(){if(Qa)return $a;Qa=1;var e=st(),t=Co(),n=co(),r=ut(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return $a=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o},$a}();return Ja=function(t){return null==t?"":e(t)}}function Ao(){if(no)return to;no=1;var e=co(),t=function(){if(Li)return Si;Li=1;var e=co(),t=ut(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Si=function(i,a){if(e(i))return!1;var o=typeof i;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=i&&!t(i))||r.test(i)||!n.test(i)||null!=a&&i in Object(a)},Si}(),n=_o(),r=No();return to=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))},to}function Mo(){if(io)return ro;io=1;var e=ut();return ro=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}var Do,ko,Io,Po,So,Lo,Oo,Ro,Bo,Fo,zo,Vo,Go=function(){if(lo)return so;lo=1;var e=function(){if(oo)return ao;oo=1;var e=Ao(),t=Mo();return ao=function(n,r){for(var i=0,a=(r=e(r,n)).length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0},ao}();return so=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i},so}(),Yo=rt(Go);function Xo(){if(Po)return Io;Po=1;var e=function(){if(ko)return Do;ko=1;var e=go(),t=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(n){}}();return Do=t}();return Io=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r},Io}function Uo(){if(Fo)return Bo;Fo=1;var e=function(){if(Lo)return So;Lo=1;var e=Xo(),t=yo(),n=Object.prototype.hasOwnProperty;return So=function(r,i,a){var o=r[i];n.call(r,i)&&t(o,a)&&(void 0!==a||i in r)||e(r,i,a)},So}(),t=Ao(),n=function(){if(Ro)return Oo;Ro=1;var e=/^(?:0|[1-9]\d*)$/;return Oo=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}(),r=it(),i=Mo();return Bo=function(a,o,s,l){if(!r(a))return a;for(var u=-1,c=(o=t(o,a)).length,h=c-1,d=a;null!=d&&++u<c;){var f=i(o[u]),g=s;if("__proto__"===f||"constructor"===f||"prototype"===f)return a;if(u!=h){var p=d[f];void 0===(g=l?l(p,f,d):void 0)&&(g=r(p)?p:n(o[u+1])?[]:{})}e(d,f,g),d=d[f]}return a},Bo}var jo,Ho,Wo,qo,Ko=function(){if(Vo)return zo;Vo=1;var e=Uo();return zo=function(t,n,r){return null==t?t:e(t,n,r)},zo}(),Zo=rt(Ko);var $o=function(){if(qo)return Wo;qo=1;var e=Co(),t=(Ho||(Ho=1,jo=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}),jo),n=co(),r=ut(),i=_o(),a=Mo(),o=No();return Wo=function(s){return n(s)?e(s,a):r(s)?[s]:t(i(o(s)))}}(),Qo=rt($o),Jo={data:function(e){return e=$e({},{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,i=this,a=void 0!==i.length,o=a?i:[i],s=a?i[0]:i;if(Ne(t)){var l,u=-1!==t.indexOf(".")&&Qo(t);if(r.allowGetting&&void 0===n)return s&&(r.beforeGet(s),l=u&&void 0===s._private[r.field][t]?Yo(s._private[r.field],u):s._private[r.field][t]),l;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var c=z({},t,n);r.beforeSet(i,c);for(var h=0,d=o.length;h<d;h++){var f=o[h];r.canSet(f)&&(u&&void 0===s._private[r.field][t]?Zo(f._private[r.field],u,n):f._private[r.field][t]=n)}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}}else if(r.allowSetting&&De(t)){var g,p,v=t,y=Object.keys(v);r.beforeSet(i,v);for(var m=0;m<y.length;m++){if(p=v[g=y[m]],!r.immutableKeys[g])for(var b=0;b<o.length;b++){var x=o[b];r.canSet(x)&&(x._private[r.field][g]=p)}}r.updateStyle&&i.updateStyle(),r.onSet(i),r.settingTriggersEvent&&i[r.triggerFnName](r.settingEvent)}else if(r.allowBinding&&Ae(t)){var w=t;i.on(r.bindingEvent,w)}else if(r.allowGetting&&void 0===t){var E;return s&&(r.beforeGet(s),E=s._private[r.field]),E}return i}},removeData:function(e){return e=$e({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,r=this,i=void 0!==r.length?r:[r];if(Ne(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var l=a[s];if(!Be(l))if(!n.immutableKeys[l])for(var u=0,c=i.length;u<c;u++)i[u]._private[n.field][l]=void 0}n.triggerEvent&&r[n.triggerFnName](n.event)}else if(void 0===t){for(var h=0,d=i.length;h<d;h++)for(var f=i[h]._private[n.field],g=Object.keys(f),p=0;p<g.length;p++){var v=g[p];!n.immutableKeys[v]&&(f[v]=void 0)}n.triggerEvent&&r[n.triggerFnName](n.event)}return r}}},es={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 Mi(function(e,t){var i=r.concat([function(t){n.off.apply(n,a),e(t)}]),a=i.concat([]);n.on.apply(n,i)})}}},ts={};[uo,Jo,es].forEach(function(e){$e(ts,e)});var ns={animate:ts.animate(),animation:ts.animation(),animated:ts.animated(),clearQueue:ts.clearQueue(),delay:ts.delay(),delayAnimation:ts.delayAnimation(),stop:ts.stop()},rs={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}Me(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],i=new Zt(e),a=0;a<t.length;a++){for(var o=t[a],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var h=e[c];if(!l.has(h)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=i,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){Me(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a<o;a++)for(var s=n[a],l=s._private.classes,u=!1,c=0;c<e.length;c++){var h=e[c],d=l.has(h),f=!1;t||r&&!d?(l.add(h),f=!0):(!t||r&&d)&&(l.delete(h),f=!0),!u&&f&&(i.push(s),u=!0)}return i.length>0&&this.spawn(i).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}};rs.className=rs.classNames=rs.classes;var is={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:je,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};is.variable="(?:[\\w-.]|(?:\\\\"+is.metaChar+"))+",is.className="(?:[\\w-]|(?:\\\\"+is.metaChar+"))+",is.value=is.string+"|"+is.number,is.id=is.variable,function(){var e,t,n;for(e=is.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],is.comparatorOp+="|@"+t;for(e=is.comparatorOp.split("|"),n=0;n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="!==t&&(is.comparatorOp+="|\\!"+t)}();var as=0,os=1,ss=2,ls=3,us=4,cs=5,hs=6,ds=7,fs=8,gs=9,ps=10,vs=11,ys=12,ms=13,bs=14,xs=15,ws=16,Es=17,Ts=18,_s=19,Cs=20,Ns=[{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*Ze(e,t)}(e.selector,t.selector)}),As=function(){for(var e,t={},n=0;n<Ns.length;n++)t[(e=Ns[n]).selector]=e.matches;return t}(),Ms="("+Ns.map(function(e){return e.selector}).join("|")+")",Ds=function(e){return e.replace(new RegExp("\\\\("+is.metaChar+")","g"),function(e,t){return t})},ks=function(e,t,n){e[e.length-1]=n},Is=[{name:"group",query:!0,regex:"("+is.group+")",populate:function(e,t,n){var r=V(n,1)[0];t.checks.push({type:as,value:"*"===r?r:r+"s"})}},{name:"state",query:!0,regex:Ms,populate:function(e,t,n){var r=V(n,1)[0];t.checks.push({type:ds,value:r})}},{name:"id",query:!0,regex:"\\#("+is.id+")",populate:function(e,t,n){var r=V(n,1)[0];t.checks.push({type:fs,value:Ds(r)})}},{name:"className",query:!0,regex:"\\.("+is.className+")",populate:function(e,t,n){var r=V(n,1)[0];t.checks.push({type:gs,value:Ds(r)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+is.variable+")\\s*\\]",populate:function(e,t,n){var r=V(n,1)[0];t.checks.push({type:us,field:Ds(r)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+is.variable+")\\s*("+is.comparatorOp+")\\s*("+is.value+")\\s*\\]",populate:function(e,t,n){var r=V(n,3),i=r[0],a=r[1],o=r[2];o=null!=new RegExp("^"+is.string+"$").exec(o)?o.substring(1,o.length-1):parseFloat(o),t.checks.push({type:ls,field:Ds(i),operator:a,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+is.boolOp+")\\s*("+is.variable+")\\s*\\]",populate:function(e,t,n){var r=V(n,2),i=r[0],a=r[1];t.checks.push({type:cs,field:Ds(a),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+is.meta+")\\s*("+is.comparatorOp+")\\s*("+is.number+")\\s*\\]\\]",populate:function(e,t,n){var r=V(n,3),i=r[0],a=r[1],o=r[2];t.checks.push({type:hs,field:Ds(i),operator:a,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:is.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,a=e[e.length-1];return null!=n&&(a.subject=n,e.currentSubject=null),a.edgeCount=r,a.compoundCount=i,e.edgeCount=0,e.compoundCount=0,e[e.length++]={checks:[]}}},{name:"directedEdge",separator:!0,regex:is.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:vs,source:r,target:i}),ks(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:ys,source:o,target:s}),ks(e,0,a),e.edgeCount++,s}},{name:"undirectedEdge",separator:!0,regex:is.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r=t,i={checks:[]};return n.checks.push({type:ps,nodes:[r,i]}),ks(e,0,n),e.edgeCount++,i}var a={checks:[]},o=t,s={checks:[]};return a.checks.push({type:bs,node:o,neighbor:s}),ks(e,0,a),s}},{name:"child",separator:!0,regex:is.child,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:xs,parent:i,child:r}),ks(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:_s,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Cs}],c.checks.push({type:Cs}),s.checks.push({type:Es,parent:c,child:u}),ks(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},f=[{type:Es,parent:h,child:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"descendant",separator:!0,regex:is.descendant,populate:function(e,t){if(null==e.currentSubject){var n={checks:[]},r={checks:[]},i=e[e.length-1];return n.checks.push({type:ws,ancestor:i,descendant:r}),ks(e,0,n),e.compoundCount++,r}if(e.currentSubject===t){var a={checks:[]},o=e[e.length-1],s={checks:[]},l={checks:[]},u={checks:[]},c={checks:[]};return a.checks.push({type:_s,left:o,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:Cs}],c.checks.push({type:Cs}),s.checks.push({type:Ts,ancestor:c,descendant:u}),ks(e,0,a),e.currentSubject=l,e.compoundCount++,u}var h={checks:[]},d={checks:[]},f=[{type:Ts,ancestor:h,descendant:d}];return h.checks=t.checks,t.checks=f,e.compoundCount++,d}},{name:"subject",modifier:!0,regex:is.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return Ft("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;r===vs?n.type=ms:r===ps&&(n.type=bs,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];Is.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var Ps=function(e){for(var t,n,r,i=0;i<Is.length;i++){var a=Is[i],o=a.name,s=e.match(a.regexObj);if(null!=s){n=s,t=a,r=o;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},Ss={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 i=Ps(n);if(null==i.expr)return Ft("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(t,r,a);if(!1===o)return!1;if(null!=o&&(r=o),(n=i.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 Ft("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Ft("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Ft("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 Ne(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case as:var l=e(s);return l.substring(0,l.length-1);case ls:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case cs:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case us:return"["+r.field+"]";case hs:var f=r.operator;return"[["+r.field+n(e(f))+t(s)+"]]";case ds:return s;case fs:return"#"+s;case gs:return"."+s;case Es:case xs:return i(r.parent,a)+n(">")+i(r.child,a);case Ts:case ws:return i(r.ancestor,a)+" "+i(r.descendant,a);case _s:var g=i(r.left,a),p=i(r.subject,a),v=i(r.right,a);return g+(g.length>0?" ":"")+p+v;case Cs:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o<this.length;o++){var s=this[o];a+=i(s,s.subject),this.length>1&&o<this.length-1&&(a+=", ")}return this.toStringCache=a,a}},Ls=function(e,t,n){var r,i,a,o=Ne(e),s=ke(e),l=Ne(n),u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1}return!c||null==e&&h||(r=!r),r},Os=function(e,t){return e.data(t)},Rs=[],Bs=function(e,t){return e.checks.every(function(e){return Rs[e.type](e,t)})};Rs[as]=function(e,t){var n=e.value;return"*"===n||n===t.group()},Rs[ds]=function(e,t){return function(e,t){return As[e](t)}(e.value,t)},Rs[fs]=function(e,t){var n=e.value;return t.id()===n},Rs[gs]=function(e,t){var n=e.value;return t.hasClass(n)},Rs[hs]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Ls(function(e,t){return e[t]()}(t,n),r,i)},Rs[ls]=function(e,t){var n=e.field,r=e.operator,i=e.value;return Ls(Os(t,n),r,i)},Rs[cs]=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}}(Os(t,n),r)},Rs[us]=function(e,t){var n=e.field;return e.operator,void 0!==Os(t,n)},Rs[ps]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return Bs(n,i)&&Bs(r,a)||Bs(r,i)&&Bs(n,a)},Rs[bs]=function(e,t){return Bs(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&Bs(e.neighbor,t)})},Rs[vs]=function(e,t){return Bs(e.source,t.source())&&Bs(e.target,t.target())},Rs[ys]=function(e,t){return Bs(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&Bs(e.target,t)})},Rs[ms]=function(e,t){return Bs(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&Bs(e.source,t)})},Rs[xs]=function(e,t){return Bs(e.child,t)&&Bs(e.parent,t.parent())},Rs[Es]=function(e,t){return Bs(e.parent,t)&&t.children().some(function(t){return Bs(e.child,t)})},Rs[ws]=function(e,t){return Bs(e.descendant,t)&&t.ancestors().some(function(t){return Bs(e.ancestor,t)})},Rs[Ts]=function(e,t){return Bs(e.ancestor,t)&&t.descendants().some(function(t){return Bs(e.descendant,t)})},Rs[_s]=function(e,t){return Bs(e.subject,t)&&Bs(e.left,t)&&Bs(e.right,t)},Rs[Cs]=function(){return!0},Rs[os]=function(e,t){return e.value.has(t)},Rs[ss]=function(e,t){return(0,e.value)(t)};var Fs={matches:function(e){for(var t=0;t<this.length;t++){var n=this[t];if(Bs(n,e))return!0}return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===fs)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(Bs(r,e))return!0}return!1};return null==t.text()&&(n=function(){return!0}),e.filter(n)}},zs=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||Ne(e)&&e.match(/^\s*$/)||(Pe(e)?this.addQuery({checks:[{type:os,value:e.collection()}]}):Ae(e)?this.addQuery({checks:[{type:ss,value:e}]}):Ne(e)?this.parse(e)||(this.invalid=!0):Rt("A selector must be created from a string; found "))},Vs=zs.prototype;[Ss,Fs].forEach(function(e){return $e(Vs,e)}),Vs.text=function(){return this.inputText},Vs.size=function(){return this.length},Vs.eq=function(e){return this[e]},Vs.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Vs.addQuery=function(e){this[this.length++]=e},Vs.selector=Vs.toString;var Gs={allAre:function(e){var t=new zs(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new zs(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())})}};Gs.allAreNeighbours=Gs.allAreNeighbors,Gs.has=Gs.contains,Gs.equal=Gs.equals=Gs.same;var Ys,Xs,Us=function(e,t){return function(n,r,i,a){var o,s=n,l=this;if(null==s?o="":Pe(s)&&1===s.length&&(o=s.id()),1===l.length&&o){var u=l[0]._private,c=u.traversalCache=u.traversalCache||{},h=c[t]=c[t]||[],d=_t(o),f=h[d];return f||(h[d]=e.call(l,n,r,i,a))}return e.call(l,n,r,i,a)}},js={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 i=this[r]._private.parent;i&&t.push(i)}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 i=n[r];t.push(i)}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:Us(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n]._private.children,i=0;i<r.length;i++)t.push(r[i]);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 i=n[r];t.push(i),i.children().nonempty()&&e(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function Hs(e,t,n,r){for(var i=[],a=new Zt,o=e.cy().hasCompoundNodes(),s=0;s<e.length;s++){var l=e[s];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Ws(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}function qs(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}function Ks(e,t,n){qs(e,t,n),Ws(e,t,n)}js.forEachDown=function(e){return Hs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Ws)},js.forEachUp=function(e){return Hs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],qs)},js.forEachUpAndDown=function(e){return Hs(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Ks)},js.ancestors=js.parents,(Ys=Xs={data:ts.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:ts.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ts.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ts.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ts.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ts.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Ys.data,Ys.removeAttr=Ys.removeData;var Zs,$s,Qs=Xs,Js={};function el(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(r+=e(i,s))}return r}}}function tl(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var o=i[a][e](n);void 0===o||void 0!==r&&!t(o,r)||(r=o)}return r}}$e(Js,{degree:el(function(e,t){return t.source().same(t.target())?2:1}),indegree:el(function(e,t){return t.target().same(e)?1:0}),outdegree:el(function(e,t){return t.source().same(e)?1:0})}),$e(Js,{minDegree:tl("degree",function(e,t){return e<t}),maxDegree:tl("degree",function(e,t){return e>t}),minIndegree:tl("indegree",function(e,t){return e<t}),maxIndegree:tl("indegree",function(e,t){return e>t}),minOutdegree:tl("outdegree",function(e,t){return e<t}),maxOutdegree:tl("outdegree",function(e,t){return e>t})}),$e(Js,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var nl=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var a=i._private.position,o={x:null!=t.x?t.x-a.x:0,y:null!=t.y?t.y-a.y:0};!i.isParent()||0===o.x&&0===o.y||i.children().shift(o,n),i.dirtyBoundingBoxCache()}}},rl={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){nl(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Zs=$s={position:ts.data(rl),silentPosition:ts.data($e({},rl,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){nl(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(De(e))t?this.silentPosition(e):this.position(e);else if(Ae(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var a,o=this[i];(a=n(o,i))&&(t?o.silentPosition(a):o.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(De(e)?(r={x:ke(e.x)?e.x:0,y:ke(e.y)?e.y:0},n=t):Ne(e)&&ke(t)&&((r={x:0,y:0})[e]=t),null!=r){var i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var o=this[a];if(!(i.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)}}i.endBatch()}return this},silentShift:function(e,t){return De(e)?this.shift(e,!0):Ne(e)&&ke(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),a=r.pan(),o=De(e)?e:void 0,s=void 0!==o||void 0!==t&&Ne(e);if(n&&n.isNode()){if(!s){var l=n.position();return o=En(l,i,a),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-a[e])/i):void 0!==o&&c.position(Tn(o,i,a))}}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=De(e)?e:void 0,a=void 0!==i||void 0!==t&&Ne(e),o=r.hasCompoundNodes();if(n&&n.isNode()){if(!a){var s=n.position(),l=o?n.parent():null,u=l&&l.length>0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d<this.length;d++){var f=this[d],g=o?f.parent():null,p=g&&g.length>0,v=p;p&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==i&&f.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}},Zs.modelPosition=Zs.point=Zs.position,Zs.modelPositions=Zs.points=Zs.positions,Zs.renderedPoint=Zs.renderedPosition,Zs.relativePoint=Zs.relativePosition;var il,al,ol=$s,sl=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},ll=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}};il=al={},al.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},al.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},al.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,i={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")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,f=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),p=g.biasDiff,v=g.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}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-p+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;a.compoundBoundsClean&&!e||(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var ul=function(e){return e===1/0||e===-1/0?0:e},cl=function(e,t,n,r,i){r-t!==0&&i-n!==0&&null!=t&&null!=n&&null!=r&&null!=i&&(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=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},hl=function(e,t){return null==t?e:cl(e,t.x1,t.y1,t.x2,t.y2)},dl=function(e,t,n){return Ht(e,t,n)},fl=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,Bn(u,1),cl(e,u.x1,u.y1,u.x2,u.y2)}}},gl=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=dl(a,"labelWidth",n),f=dl(a,"labelHeight",n),g=dl(a,"labelX",n),p=dl(a,"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,T=f,_=d,C=_/2,N=T/2;if(m)o=g-C,s=g+C,l=p-N,u=p+N;else{switch(sl(c.value)){case"left":o=g-_,s=g;break;case"center":o=g-C,s=g+C;break;case"right":o=g,s=g+_}switch(ll(h.value)){case"top":l=p-T,u=p;break;case"center":l=p-N,u=p+N;break;case"bottom":l=p,u=p+T}}var A=v-Math.max(x,w)-E-2,M=v+Math.max(x,w)+E+2,D=y-Math.max(x,w)-E-2,k=y+Math.max(x,w)+E+2;o+=A,s+=M,l+=D,u+=k;var I=n||"main",P=i.labelBounds,S=P[I]=P[I]||{};S.x1=o,S.y1=l,S.x2=s,S.y2=u,S.w=s-o,S.h=u-l,S.leftPad=A,S.rightPad=M,S.topPad=D,S.botPad=k;var L=m&&"autorotate"===b.strValue,O=null!=b.pfValue&&0!==b.pfValue;if(L||O){var R=L?dl(i.rstyle,"labelAngle",n):b.pfValue,B=Math.cos(R),F=Math.sin(R),z=(o+s)/2,V=(l+u)/2;if(!m){switch(sl(c.value)){case"left":z=s;break;case"right":z=o}switch(ll(h.value)){case"top":V=u;break;case"bottom":V=l}}var G=function(e,t){return{x:(e-=z)*B-(t-=V)*F+z,y:e*F+t*B+V}},Y=G(o,l),X=G(o,u),U=G(s,l),j=G(s,u);o=Math.min(Y.x,X.x,U.x,j.x),s=Math.max(Y.x,X.x,U.x,j.x),l=Math.min(Y.y,X.y,U.y,j.y),u=Math.max(Y.y,X.y,U.y,j.y)}var H=I+"Rot",W=P[H]=P[H]||{};W.x1=o,W.y1=l,W.x2=s,W.y2=u,W.w=s-o,W.h=u-l,cl(e,o,l,s,u),cl(i.labelBounds.all,o,l,s,u)}return e}},pl=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;vl(e,t,n,r,"outside",r/2)}},vl=function(e,t,n,r,i,a){if(!(0===n||r<=0||"inside"===i)){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var l=t.position(),u=l.x,c=l.y,h=t.width(),d=t.height();if(s.hasMiterBounds){"center"===i&&(r/=2);var f=s.miterBounds(u,c,h,d,r);hl(e,f)}else null!=a&&a>0&&Fn(e,[a,a,a,a])}}},yl=function(e,t){var n,r,i,a,o,s,l,u=e._private.cy,c=u.styleEnabled(),h=u.headless(),d=Ln(),f=e._private,g=e.isNode(),p=e.isEdge(),v=f.rstyle,y=g&&c?e.pstyle("bounds-expansion").pfValue:[0],m=function(e){return"none"!==e.pstyle("display").value},b=!c||m(e)&&(!p||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),T=0;if(c&&(T=e.pstyle("width").pfValue/2),g&&t.includeNodes){var _=e.position();o=_.x,s=_.y;var C=e.outerWidth()/2,N=e.outerHeight()/2;cl(d,n=o-C,i=s-N,r=o+C,a=s+N),c&&pl(d,e),c&&t.includeOutlines&&!h&&pl(d,e),c&&function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;vl(e,t,n,r,i)}}(d,e)}else if(p&&t.includeEdges)if(c&&!h){var A=e.pstyle("curve-style").strValue;if(n=Math.min(v.srcX,v.midX,v.tgtX),r=Math.max(v.srcX,v.midX,v.tgtX),i=Math.min(v.srcY,v.midY,v.tgtY),a=Math.max(v.srcY,v.midY,v.tgtY),cl(d,n-=T,i-=T,r+=T,a+=T),"haystack"===A){var M=v.haystackPts;if(M&&2===M.length){if(n=M[0].x,i=M[0].y,n>(r=M[1].x)){var D=n;n=r,r=D}if(i>(a=M[1].y)){var k=i;i=a,a=k}cl(d,n-T,i-T,r+T,a+T)}}else if("bezier"===A||"unbundled-bezier"===A||Ue(A,"segments")||Ue(A,"taxi")){var I;switch(A){case"bezier":case"unbundled-bezier":I=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":I=v.linePts}if(null!=I)for(var P=0;P<I.length;P++){var S=I[P];n=S.x-T,r=S.x+T,i=S.y-T,a=S.y+T,cl(d,n,i,r,a)}}}else{var L=e.source().position(),O=e.target().position();if((n=L.x)>(r=O.x)){var R=n;n=r,r=R}if((i=L.y)>(a=O.y)){var B=i;i=a,a=B}cl(d,n-=T,i-=T,r+=T,a+=T)}if(c&&t.includeEdges&&p&&(fl(d,e,"mid-source"),fl(d,e,"mid-target"),fl(d,e,"source"),fl(d,e,"target")),c)if("yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;cl(d,d.x1+F,d.y1+z,d.x2+F,d.y2+z)}var V=f.bodyBounds=f.bodyBounds||{};zn(V,d),Fn(V,y),Bn(V,1),c&&(n=d.x1,r=d.x2,i=d.y1,a=d.y2,cl(d,n-E,i-E,r+E,a+E));var G=f.overlayBounds=f.overlayBounds||{};zn(G,d),Fn(G,y),Bn(G,1);var Y=f.labelBounds=f.labelBounds||{};null!=Y.all?((l=Y.all).x1=1/0,l.y1=1/0,l.x2=-1/0,l.y2=-1/0,l.w=0,l.h=0):Y.all=Ln(),c&&t.includeLabels&&(t.includeMainLabels&&gl(d,e,null),p&&(t.includeSourceLabels&&gl(d,e,"source"),t.includeTargetLabels&&gl(d,e,"target")))}return d.x1=ul(d.x1),d.y1=ul(d.y1),d.x2=ul(d.x2),d.y2=ul(d.y2),d.w=ul(d.x2-d.x1),d.h=ul(d.y2-d.y1),d.w>0&&d.h>0&&b&&(Fn(d,y),Bn(d,1)),d},ml=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),r+=n(e.includeOutlines)},bl=function(e){var t=function(e){return Math.round(e)};if(e.isEdge()){var n=e.source().position(),r=e.target().position();return Tt([t(n.x),t(n.y),t(r.x),t(r.y)])}var i=e.position();return Tt([t(i.x),t(i.y)])},xl=function(e,t){var n,r=e._private,i=e.isEdge(),a=(null==t?El:ml(t))===El;if(null==r.bbCache?(n=yl(e,wl),r.bbCache=n,r.bbCachePosKey=bl(e)):n=r.bbCache,!a){var o=e.isNode();n=Ln(),(t.includeNodes&&o||t.includeEdges&&!o)&&(t.includeOverlays?hl(n,r.overlayBounds):hl(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?hl(n,r.labelBounds.all):(t.includeMainLabels&&hl(n,r.labelBounds.mainRot),t.includeSourceLabels&&hl(n,r.labelBounds.sourceRot),t.includeTargetLabels&&hl(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},wl={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},El=ml(wl),Tl=Xt(wl);al.boundingBox=function(e){var t,n=void 0===e||void 0===e.useCache||!0===e.useCache,r=ze(function(e){var t=e._private;return null==t.bbCache||t.styleDirty||t.bbCachePosKey!==bl(e)},function(e){return e.id()});if(n&&1===this.length&&!r(this[0]))e=void 0===e?wl:Tl(e),t=xl(this[0],e);else{t=Ln();var i=Tl(e=e||wl),a=this,o=a.cy().styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var s=0;s<a.length;s++){var l=a[s];r(l)&&l.dirtyBoundingBoxCache(),hl(t,xl(l,i))}}return t.x1=ul(t.x1),t.y1=ul(t.y1),t.x2=ul(t.x2),t.y2=ul(t.y2),t.w=ul(t.x2-t.x1),t.h=ul(t.y2-t.y1),t},al.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},al.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(e){return e.isParent()}),t=t.not(i)),De(e)){var a=e;e=function(){return a}}n.startBatch(),t.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.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&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),o},il.boundingbox=il.bb=il.boundingBox,il.renderedBoundingbox=il.renderedBoundingBox;var _l,Cl,Nl=al;_l=Cl={};var Al=function(e){e.uppercaseName=Xe(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Xe(e.outerName),_l[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 i=t.pstyle(e.name);return"label"===i.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):i.pfValue}return 1}},_l["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t){if(n){var r=t[e.name](),i=t.pstyle("border-position").value;return r+("center"===i?t.pstyle("border-width").pfValue:"outside"===i?2*t.pstyle("border-width").pfValue:0)+2*t.padding()}return 1}},_l["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},_l["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};Al({name:"width"}),Al({name:"height"}),Cl.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},Cl.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},Cl.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var Ml=Cl,Dl={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)}}},kl=Object.keys(Dl).reduce(function(e,t){var n=Dl[t],r=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)}(t);return e[t]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)}(this,n.get)},n.mult?e[r]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(e){return En(e,i,r)})}}(this,n.get)}:e[r]=function(){return function(e,t){if(e.isEdge()&&e.takesUpSpace()){var n=e.cy();return En(t(e),n.zoom(),n.pan())}}(this,n.get)},e},{}),Il=$e({},ol,Nl,Ml,kl),Pl=function(e,t){this.recycle(e,t)};function Sl(){return!1}function Ll(){return!0}Pl.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Sl,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ll:Sl):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(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ll;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ll;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ll,this.stopPropagation()},isDefaultPrevented:Sl,isPropagationStopped:Sl,isImmediatePropagationStopped:Sl};var Ol=/^([^.]+)(\.(?:[^.]+))?$/,Rl={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},Bl=Object.keys(Rl),Fl={};function zl(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Fl,t=arguments.length>1?arguments[1]:void 0,n=0;n<Bl.length;n++){var r=Bl[n];this[r]=e[r]||Rl[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Vl=zl.prototype,Gl=function(e,t,n,r,i,a,o){Ae(r)&&(i=r,r=null),o&&(a=null==a?o:$e({},a,o));for(var s=Me(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!Be(u)){var c=u.match(Ol);if(c)if(!1===t(e,u,c[1],c[2]?c[2]:null,r,i,a))break}}},Yl=function(e,t){return e.addEventFields(e.context,t),new Pl(t.type,t)},Xl=function(e,t,n){if("event"!==Ce(n))if(De(n))t(e,Yl(e,n));else for(var r=Me(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var a=r[i];if(!Be(a)){var o=a.match(Ol);if(o){var s=o[1],l=o[2]?o[2]:null;t(e,Yl(e,{type:s,namespace:l,target:e.context}))}}}else t(e,n)};Vl.on=Vl.addListener=function(e,t,n,r,i){return Gl(this,function(e,t,n,r,i,a,o){Ae(a)&&e.listeners.push({event:t,callback:a,type:n,namespace:r,qualifier:i,conf:o})},e,t,n,r,i),this},Vl.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Vl.removeListener=Vl.off=function(e,t,n,r){var i=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var a=this.listeners,o=function(o){var s=a[o];Gl(i,function(t,n,r,i,l,u){if((s.type===r||"*"===e)&&(!i&&".*"!==s.namespace||s.namespace===i)&&(!l||t.qualifierCompare(s.qualifier,l))&&(!u||s.callback===u))return a.splice(o,1),!1},e,t,n,r)},s=a.length-1;s>=0;s--)o(s);return this},Vl.removeAllListeners=function(){return this.removeListener("*")},Vl.emit=Vl.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,Me(t)||(t=[t]),Xl(this,function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||".*"===n.namespace)&&e.eventMatches(e.context,n,a)){var i=[a];null!=t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}}(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==n}));var o=e.callbackContext(e.context,n,a),l=n.callback.apply(o,i);e.afterEmit(e.context,n,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s<i;s++)o();e.bubble(e.context)&&!a.isPropagationStopped()&&e.parent(e.context).emit(a,t)},e),this.emitting--,this};var Ul={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&&Se(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()}},jl=function(e){return Ne(e)?new zs(e):e},Hl={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new zl(Ul,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=jl(t),i=0;i<this.length;i++){this[i].emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=jl(t),i=0;i<this.length;i++){this[i].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=jl(t),i=0;i<this.length;i++){this[i].emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=jl(t),i=0;i<this.length;i++){this[i].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}};ts.eventAliasesOn(Hl);var Wl={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(Ne(e)||Pe(e))return new zs(e).filter(this);if(Ae(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var a=r[i];(t?e.apply(t,[a,i,r]):e(a,i,r))&&n.push(a)}return n}return this.spawn()},not:function(e){if(e){Ne(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(Ne(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=e,i=this.length<e.length,a=i?this:r,o=i?r:this,s=0;s<a.length;s++){var l=a[s];o.has(l)&&n.push(l)}return n},xor:function(e){var t=this._private.cy;Ne(e)&&(e=t.$(e));var n=this.spawn(),r=e,i=function(e,t){for(var r=0;r<e.length;r++){var i=e[r],a=i._private.data.id;t.hasElementWithId(a)||n.push(i)}};return i(this,r),i(r,this),n},diff:function(e){var t=this._private.cy;Ne(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),a=e,o=function(e,t,n){for(var r=0;r<e.length;r++){var a=e[r],o=a._private.data.id;t.hasElementWithId(o)?i.merge(a):n.push(a)}};return o(this,a,n),o(a,this,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(Ne(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var a=e[i],o=!this.has(a);o&&r.push(a)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&Ne(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,a=0;a<e.length;a++){var o=e[a],s=o._private.data.id;if(!i.has(s)){var l=this.length++;this[l]=o,i.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 i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,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 i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&Ne(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,i=0;i<r.length;i++){var a=r[i],o=t?e.apply(t,[a,i,r]):e(a,i,r);n.push(o)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n,r=-1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s>r&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a<i.length;a++){var o=i[a],s=t?e.apply(t,[o,a,i]):e(o,a,i);s<r&&(r=s,n=o)}return{value:r,ele:n}}},ql=Wl;ql.u=ql["|"]=ql["+"]=ql.union=ql.or=ql.add,ql["\\"]=ql["!"]=ql["-"]=ql.difference=ql.relativeComplement=ql.subtract=ql.not,ql.n=ql["&"]=ql["."]=ql.and=ql.intersection=ql.intersect,ql["^"]=ql["(+)"]=ql["(-)"]=ql.symmetricDifference=ql.symdiff=ql.xor,ql.fnFilter=ql.filterFn=ql.stdFilter=ql.filter,ql.complement=ql.abscomp=ql.absoluteComplement;var Kl=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?It:0}var i=r(e)-r(t);if(0!==i)return i;function a(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}var o=a(e)-a(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()},Zl={forEach:function(e,t){if(Ae(e))for(var n=this.length,r=0;r<n;r++){var i=this[r];if(!1===(t?e.apply(t,[i,r,this]):e(i,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 i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);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(!Ae(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Kl)},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:It-1}var r=t.source,i=t.target,a=r.zDepth(),o=i.zDepth();return Math.max(a,o,0)}}};Zl.each=Zl.forEach;var $l;$l="undefined",("undefined"==typeof Symbol?"undefined":X(Symbol))!=$l&&X(Symbol.iterator)!=$l&&(Zl[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,r=this.length;return z({next:function(){return n<r?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var Ql=Xt({nodeDimensionsIncludeLabels:!1}),Jl={layoutDimensions:function(e){var t;if(e=Ql(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()}),i=this.cy(),a=t.eles,o=function(e){return e.id()},s=ze(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=Ln(),t=0;t<r.length;t++){var n=r[t],i=s(n,t);Rn(e,i.x,i.y)}return e}(),c=ze(function(e,n){var r=s(e,n);l&&(r=function(e,t,n){var r=t.x1+t.w/2,i=t.y1+t.h/2;return{x:r+(n.x-r)*e,y:i+(n.y-i)*e}}(Math.abs(t.spacingFactor),u,r));return null!=t.transform&&(r=t.transform(e,r)),r},o);if(t.animate){for(var h=0;h<r.length;h++){var d=r[h],f=c(d,h);if(null==t.animateFilter||t.animateFilter(d,h)){var g=d.animation({position:f,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else d.position(f)}if(t.fit){var p=i.animation({fit:{boundingBox:a.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(p)}else if(void 0!==t.zoom&&void 0!==t.pan){var v=i.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}),Mi.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&&i.fit(t.eles,t.padding),null!=t.zoom&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout($e({},e,{eles:this}))}};function eu(e,t,n){var r,i=n._private,a=i.styleCache=i.styleCache||[];return null!=(r=a[e])?r:r=a[e]=t(n)}function tu(e,t){return e=_t(e),function(n){return eu(e,t,n)}}function nu(e,t){e=_t(e);var n=function(e){return t.call(e)};return function(){var t=this[0];if(t)return eu(e,n,t)}}Jl.createLayout=Jl.makeLayout=Jl.layout;var ru={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};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)});return 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){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i: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,i=n.style();if(De(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify("style")}else if(Ne(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(void 0===e)for(var a=0;a<i.length;a++){var o=i[a];r.removeAllBypasses(o,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var l=i[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,i=n.pstyle("opacity").value;if(!t)return i;var a=r.data.parent?n.parents():null;if(a)for(var o=0;o<a.length;o++){i*=a[o].pstyle("opacity").value}return i}},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 iu(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 au(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 i=this[0],a=e.hasCompoundNodes();if(i){var o=i._private;if(!t(i))return!1;if(i.isNode())return!a||iu(i,r);var s=o.source,l=o.target;return n(s)&&(!a||iu(s,n))&&(s===l||n(l)&&(!a||iu(l,n)))}}}var ou=tu("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});ru.takesUpSpace=nu("takesUpSpace",au({ok:ou}));var su=tu("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&ou(e)}),lu=tu("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&ou(e)});ru.interactive=nu("interactive",au({ok:su,parentOk:lu,edgeOkViaNode:ou})),ru.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var uu=tu("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&ou(e)}),cu=ou;ru.visible=nu("visible",au({ok:uu,edgeOkViaNode:cu})),ru.hidden=function(){var e=this[0];if(e)return!e.visible()},ru.isBundledBezier=nu("isBundledBezier",function(){return!!this.cy().styleEnabled()&&(!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace())}),ru.bypass=ru.css=ru.style,ru.renderedCss=ru.renderedStyle,ru.removeBypass=ru.removeCss=ru.removeStyle,ru.pstyle=ru.parsedStyle;var hu={};function du(e){return function(){var t=arguments,n=[];if(2===t.length){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(1===t.length&&Ae(t[0])){var a=t[0];this.on(e.event,a)}else if(0===t.length||1===t.length&&Me(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 h=e.overrideAble(l);if(void 0!==h&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),o&&d.emit(o)}return this}}function fu(e){hu[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]}},hu[e.on]=du({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),hu[e.off]=du({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}fu({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),fu({field:"grabbable",overrideField:function(e){return!e.cy().autoungrabify()&&!e.pannable()&&void 0},on:"grabify",off:"ungrabify"}),fu({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),fu({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),hu.deselect=hu.unselect,hu.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},fu({field:"active",on:"activate",off:"unactivate"}),fu({field:"pannable",on:"panify",off:"unpanify"}),hu.inactive=function(){var e=this[0];if(e)return!e._private.active};var gu={},pu=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode()){for(var a=!1,o=i.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();if(e.noIncomingEdges&&c===i&&u!==i||e.noOutgoingEdges&&u===i&&c!==i){a=!0;break}}a||n.push(i)}}return this.spawn(n,!0).filter(t)}},vu=function(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r];if(i.isNode())for(var a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target();e.outgoing&&l===i?(n.push(s),n.push(u)):e.incoming&&u===i&&(n.push(s),n.push(l))}}return this.spawn(n,!0).filter(t)}},yu=function(e){return function(t){for(var n=this,r=[],i={};;){var a=e.outgoing?n.outgoers():n.incomers();if(0===a.length)break;for(var o=!1,s=0;s<a.length;s++){var l=a[s],u=l.id();i[u]||(i[u]=!0,r.push(l),o=!0)}if(!o)break;n=a}return this.spawn(r,!0).filter(t)}};function mu(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r]._private[e.attr];i&&n.push(i)}return this.spawn(n,!0).filter(t)}}function bu(e){return function(t){var n=[],r=this._private.cy,i=e||{};Ne(t)&&(t=r.$(t));for(var a=0;a<t.length;a++)for(var o=t[a]._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),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target);if(c||h){if(i.thisIsSrc||i.thisIsTgt){if(i.thisIsSrc&&!c)continue;if(i.thisIsTgt&&!h)continue}n.push(l)}}return this.spawn(n,!0)}}function xu(e){return e=$e({},{codirected:!1},e),function(t){for(var n=[],r=this.edges(),i=e,a=0;a<r.length;a++)for(var o=r[a]._private,s=o.source,l=s._private.data.id,u=o.data.target,c=s._private.edges,h=0;h<c.length;h++){var d=c[h],f=d._private.data,g=f.target,p=f.source,v=g===u&&p===l,y=l===g&&u===p;(i.codirected&&v||!i.codirected&&(v||y))&&n.push(d)}return this.spawn(n,!0).filter(t)}}gu.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},$e(gu,{roots:pu({noIncomingEdges:!0}),leaves:pu({noOutgoingEdges:!0}),outgoers:Us(vu({outgoing:!0}),"outgoers"),successors:yu({outgoing:!0}),incomers:Us(vu({incoming:!0}),"incomers"),predecessors:yu({})}),$e(gu,{neighborhood:Us(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),o=0;o<a.length;o++){var s=a[o],l=s.source(),u=s.target(),c=i===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)}}),gu.neighbourhood=gu.neighborhood,gu.closedNeighbourhood=gu.closedNeighborhood,gu.openNeighbourhood=gu.openNeighborhood,$e(gu,{source:Us(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:Us(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:mu({attr:"source"}),targets:mu({attr:"target"})}),$e(gu,{edgesWith:Us(bu(),"edgesWith"),edgesTo:Us(bu({thisIsSrc:!0}),"edgesTo")}),$e(gu,{connectedEdges:Us(function(e){for(var t=[],n=0;n<this.length;n++){var r=this[n];if(r.isNode())for(var i=r._private.edges,a=0;a<i.length;a++){var o=i[a];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:Us(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:Us(xu(),"parallelEdges"),codirectedEdges:Us(xu({codirected:!0}),"codirectedEdges")}),$e(gu,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=null==e?t.nodes():e.nodes(),a=[];null!=e&&i.empty()&&(i=e.sources());var o=function(e,t){r.merge(e),i.unmerge(e),t.merge(e)};if(i.empty())return t.spawn();var s=function(){var e=n.collection();a.push(e);var r=i[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(i.length>0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),gu.componentsOf=gu.components;var wu=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 i=new qt,a=!1;if(t){if(t.length>0&&De(t[0])&&!Se(t[0])){a=!0;for(var o=[],s=new Zt,l=0,u=t.length;l<u;l++){var c=t[l];null==c.data&&(c.data={});var h=c.data;if(null==h.id)h.id=Vt();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var d=new $t(e,c,!1);o.push(d),s.add(h.id)}t=o}}else t=[];this.length=0;for(var f=0,g=t.length;f<g;f++){var p=t[f][0];if(null!=p){var v=p._private.data.id;n&&i.has(v)||(n&&i.set(v,{index:this.length,ele:p}),this[this.length]=p,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 qt,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=i),a&&!r&&this.restore()}else Rt("A collection must have a reference to the core")},Eu=$t.prototype=wu.prototype=Object.create(Array.prototype);Eu.instanceString=function(){return"collection"},Eu.spawn=function(e,t){return new wu(this.cy(),e,t)},Eu.spawnSelf=function(){return this.spawn(this)},Eu.cy=function(){return this._private.cy},Eu.renderer=function(){return this._private.cy.renderer()},Eu.element=function(){return this[0]},Eu.collection=function(){return Le(this)?this:new wu(this._private.cy,[this])},Eu.unique=function(){return new wu(this._private.cy,this,!0)},Eu.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Eu.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new wu(t)},Eu.$id=Eu.getElementById,Eu.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},Eu.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Eu.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Eu.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var r=t._private;if(De(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,o={},s=e.data.source,l=e.data.target;null!=s&&s!=i.source&&(o.source=""+s,a=!0),null!=l&&l!=i.target&&(o.target=""+l,a=!0),a&&(t=t.move(o))}else{var u="parent"in e.data,c=e.data.parent;!u||null==c&&null==i.parent||c==i.parent||(void 0===c&&(c=null),null!=c&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(n,i,a){var o=e[n];null!=o&&o!==r[n]&&(o?t[i]():t[a]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var d={data:zt(r.data),position:zt(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var f=0;return r.classes.forEach(function(e){return d.classes+=0===f++?e:" "+e}),d}}},Eu.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},Eu.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n].json(),i=new $t(e,r,!1);t.push(i)}return new wu(e,t)},Eu.copy=Eu.clone,Eu.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],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u<c;u++){var h=i[u];r&&!h.removed()||(h.isNode()?s.push(h):l.push(h))}e=s.concat(l);var d=function(){e.splice(t,1),t--};for(t=0;t<e.length;t++){var f=e[t],g=f._private,p=g.data;if(f.clearTraversalCache(),r||g.removed)if(void 0===p.id)p.id=Vt();else if(ke(p.id))p.id=""+p.id;else{if(Be(p.id)||!Ne(p.id)){Rt("Can not create element with invalid string ID `"+p.id+"`"),d();continue}if(a.hasElementWithId(p.id)){Rt("Can not create second element with ID `"+p.id+"`"),d();continue}}else;var v=p.id;if(f.isNode()){var y=g.position;null==y.x&&(y.x=0),null==y.y&&(y.y=0)}if(f.isEdge()){for(var m=f,b=["source","target"],x=b.length,w=!1,E=0;E<x;E++){var T=b[E],_=p[T];ke(_)&&(_=p[T]=""+p[T]),null==_||""===_?(Rt("Can not create edge `"+v+"` with unspecified "+T),w=!0):a.hasElementWithId(_)||(Rt("Can not create edge `"+v+"` with nonexistent "+T+" `"+_+"`"),w=!0)}if(w){d();continue}var C=a.getElementById(p.source),N=a.getElementById(p.target);C.same(N)?C._private.edges.push(m):(C._private.edges.push(m),N._private.edges.push(m)),m._private.source=C,m._private.target=N}g.map=new qt,g.map.set(v,{ele:f,index:0}),g.removed=!1,r&&a.addToPool(f)}for(var A=0;A<s.length;A++){var M=s[A],D=M._private.data;ke(D.parent)&&(D.parent=""+D.parent);var k=D.parent;if(null!=k||M._private.parent){var I=M._private.parent?a.collection().merge(M._private.parent):a.getElementById(k);if(I.empty())D.parent=void 0;else if(I[0].removed())Ft("Node added with missing parent, reference to parent removed"),D.parent=void 0,M._private.parent=null;else{for(var P=!1,S=I;!S.empty();){if(M.same(S)){P=!0,D.parent=void 0;break}S=S.parent()}P||(I[0]._private.children.push(M),M._private.parent=I[0],o.hasCompoundNodes=!0)}}}if(e.length>0){for(var L=e.length===i.length?i:new wu(a,e),O=0;O<L.length;O++){var R=L[O];R.isNode()||(R.parallelEdges().clearTraversalCache(),R.source().clearTraversalCache(),R.target().clearTraversalCache())}(o.hasCompoundNodes?a.collection().merge(L).merge(L.connectedNodes()).merge(L.parent()):L).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(n),n?L.emitAndNotify("add"):r&&L.emit("add")}return i},Eu.removed=function(){var e=this[0];return e&&e._private.removed},Eu.inside=function(){var e=this[0];return e&&!e._private.removed},Eu.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=[],i={},a=n._private.cy;function o(e){var n=i[e.id()];t&&e.removed()||n||(i[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;Ut(n,t),e.clearTraversalCache()}function c(e){e.clearTraversalCache()}var h=[];function d(e,t){t=t[0];var n=(e=e[0])._private.children,r=e.id();Ut(n,t),t._private.parent=null,h.ids[r]||(h.ids[r]=!0,h.push(e))}h.ids={},n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var f=0;f<r.length;f++){var g=r[f];if(g.isEdge()){var p=g.source()[0],v=g.target()[0];u(p,g),u(v,g);for(var y=g.parallelEdges(),m=0;m<y.length;m++){var b=y[m];c(b),b.isBundledBezier()&&b.dirtyBoundingBoxCache()}}else{var x=g.parent();0!==x.length&&d(x,g)}t&&(g._private.removed=!0)}var w=a._private.elements;a._private.hasCompoundNodes=!1;for(var E=0;E<w.length;E++){if(w[E].isParent()){a._private.hasCompoundNodes=!0;break}}var T=new wu(this.cy(),r);T.size()>0&&(e?T.emitAndNotify("remove"):t&&T.emit("remove"));for(var _=0;_<h.length;_++){var C=h[_];t&&C.removed()||C.updateStyle()}return T},Eu.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var o=a(e.source),s=a(e.target),l=null!=o&&t.hasElementWithId(o),u=null!=s&&t.hasElementWithId(s);(l||u)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],a=t._private.data;t.isEdge()&&(l&&(a.source=o),u&&(a.target=s))}n.restore(r,i)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var c=a(e.parent);if(null===c||t.hasElementWithId(c)){var h=null===c?void 0:c;t.batch(function(){var e=n.remove(r,i);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var a=n[t],o=a._private.data;a.isNode()&&(o.parent=h)}e.restore(r,i)}),n.emitAndNotify("move")}}return this},[wi,ns,rs,Gs,js,Qs,Js,Il,Hl,Wl,{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}},Zl,Jl,ru,hu,gu].forEach(function(e){$e(Eu,e)});var Tu={add:function(e){var t,n=this;if(Pe(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],a=0;a<r.length;a++){var o=r[a];i.push(o.json())}t=new wu(n,i)}}else if(Me(e)){t=new wu(n,e)}else if(De(e)&&(Me(e.nodes)||Me(e.edges))){for(var s=e,l=[],u=["nodes","edges"],c=0,h=u.length;c<h;c++){var d=u[c],f=s[d];if(Me(f))for(var g=0,p=f.length;g<p;g++){var v=$e({group:d},f[g]);l.push(v)}}t=new wu(n,l)}else{t=new $t(n,e).collection()}return t},remove:function(e){if(Pe(e));else if(Ne(e)){var t=e;e=this.$(t)}return e.remove()}};
|
|
8
|
+
/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function _u(e,t,n,r){var i=.1,a="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=a?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 h(e,t,n){return((l(t,n)*e+u(t,n))*e+c(t))*e}function d(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+c(t)}function f(t){for(var r=0,a=1;10!==a&&s[a]<=t;++a)r+=i;--a;var o=r+(t-s[a])/(s[a+1]-s[a])*i,l=d(o,e,n);return l>=.001?function(t,r){for(var i=0;i<4;++i){var a=d(r,e,n);if(0===a)return r;r-=(h(r,e,n)-t)/a}return r}(t,o):0===l?o:function(t,r,i){var a,o,s=0;do{(a=h(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o}while(Math.abs(a)>1e-7&&++s<10);return o}(t,r,r+i)}var g=!1;function p(){g=!0,e===t&&n===r||function(){for(var t=0;t<11;++t)s[t]=h(t*i,e,n)}()}var v=function(i){return g||p(),e===t&&n===r?i:0===i?0:1===i?1:h(f(i),t,r)};v.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var y="generateBezier("+[e,t,n,r]+")";return v.toString=function(){return y},v}
|
|
9
|
+
/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Cu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,o=(a=null!==i)?(c=e(t,r))/i*.016:.016;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>h&&Math.abs(s.v)>h;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),Nu=function(e,t,n,r){var i=_u(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},Au={linear:function(e,t,n){return e+(t-e)*n},ease:Nu(.25,.1,.25,1),"ease-in":Nu(.42,0,1,1),"ease-out":Nu(0,0,.58,1),"ease-in-out":Nu(.42,0,.58,1),"ease-in-sine":Nu(.47,0,.745,.715),"ease-out-sine":Nu(.39,.575,.565,1),"ease-in-out-sine":Nu(.445,.05,.55,.95),"ease-in-quad":Nu(.55,.085,.68,.53),"ease-out-quad":Nu(.25,.46,.45,.94),"ease-in-out-quad":Nu(.455,.03,.515,.955),"ease-in-cubic":Nu(.55,.055,.675,.19),"ease-out-cubic":Nu(.215,.61,.355,1),"ease-in-out-cubic":Nu(.645,.045,.355,1),"ease-in-quart":Nu(.895,.03,.685,.22),"ease-out-quart":Nu(.165,.84,.44,1),"ease-in-out-quart":Nu(.77,0,.175,1),"ease-in-quint":Nu(.755,.05,.855,.06),"ease-out-quint":Nu(.23,1,.32,1),"ease-in-out-quint":Nu(.86,0,.07,1),"ease-in-expo":Nu(.95,.05,.795,.035),"ease-out-expo":Nu(.19,1,.22,1),"ease-in-out-expo":Nu(1,0,0,1),"ease-in-circ":Nu(.6,.04,.98,.335),"ease-out-circ":Nu(.075,.82,.165,1),"ease-in-out-circ":Nu(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return Au.linear;var r=Cu(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":Nu};function Mu(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function Du(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function ku(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=Du(e,i),s=Du(t,i);if(ke(o)&&ke(s))return Mu(a,o,s,n,r);if(Me(o)&&Me(s)){for(var l=[],u=0;u<s.length;u++){var c=o[u],h=s[u];if(null!=c&&null!=h){var d=Mu(a,c,h,n,r);l.push(d)}else l.push(h)}return l}}function Iu(e,t,n,r){var i=!r,a=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=Au.linear;else{var c,h,d;if(Ne(s))c=u.parse("transition-timing-function",s).value;else c=s;Ne(c)?(h=c,d=[]):(h=c[1],d=c.slice(2).map(function(e){return+e})),d.length>0?("spring"===h&&d.push(o.duration),o.easingImpl=Au[h].apply(null,d)):o.easingImpl=Au[h]}var f,g=o.easingImpl;if(f=0===o.duration?1:(n-l)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var p=o.startPosition,v=o.position;if(v&&i&&!e.locked()){var y={};Pu(p.x,v.x)&&(y.x=ku(p.x,v.x,f,g)),Pu(p.y,v.y)&&(y.y=ku(p.y,v.y,f,g)),e.position(y)}var m=o.startPan,b=o.pan,x=a.pan,w=null!=b&&r;w&&(Pu(m.x,b.x)&&(x.x=ku(m.x,b.x,f,g)),Pu(m.y,b.y)&&(x.y=ku(m.y,b.y,f,g)),e.emit("pan"));var E=o.startZoom,T=o.zoom,_=null!=T&&r;_&&(Pu(E,T)&&(a.zoom=Sn(a.minZoom,ku(E,T,f,g),a.maxZoom)),e.emit("zoom")),(w||_)&&e.emit("viewport");var C=o.style;if(C&&C.length>0&&i){for(var N=0;N<C.length;N++){var A=C[N],M=A.name,D=A,k=o.startStyle[M],I=ku(k,D,f,g,u.properties[k.name]);u.overrideBypass(e,M,I)}e.emit("style")}}return o.progress=f,f}function Pu(e,t){return null!=e&&null!=t&&(!(!ke(e)||!ke(t))||!(!e||!t))}function Su(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function Lu(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var l=o.shift();l&&a.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=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||Su(0,h,e),Iu(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o<n.length;o++){var s=i(n[o]);a=a||s}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Ou={animate:ts.animate(),animation:ts.animation(),animated:ts.animated(),clearQueue:ts.clearQueue(),delay:ts.delay(),delayAnimation:ts.delayAnimation(),stop:ts.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){Lu(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&>(function(n){Lu(n,e),t()})}()}}},Ru={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&&Se(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}},Bu=function(e){return Ne(e)?new zs(e):e},Fu={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new zl(Ru,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Bu(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Bu(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Bu(t),n),this},once:function(e,t,n){return this.emitter().one(e,Bu(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}};ts.eventAliasesOn(Fu);var zu={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)}};zu.jpeg=zu.jpg;var Vu={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=Ne(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r($e({},e,{cy:t,eles:i}));return a}Rt("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else Rt("A `name` must be specified to make a layout");else Rt("Layout options must be specified to make a layout")}};Vu.createLayout=Vu.makeLayout=Vu.layout;var Gu={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 i=this.renderer();!this.destroyed()&&i&&i.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 i=n[r],a=e[i];t.getElementById(i).data(a)}})}},Yu=Xt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),Xu={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&&Ft("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=Yu(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")}else Rt("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)}};Xu.invalidateDimensions=Xu.resize;var Uu={collection:function(e,t){return Ne(e)?this.$(e):Pe(e)?e.collection():Me(e)?(t||(t={}),new wu(this,e,t.unique,t.removed)):new wu(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}};Uu.elements=Uu.filter=Uu.$;var ju={},Hu="t";ju.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r<e.length;r++){var i=e[r],a=t.getContextMeta(i);if(!a.empty){var o=t.getContextStyle(a),s=t.applyContextStyle(a,o,i);i._private.appliedInitStyle?t.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,t.updateStyleHints(i)&&n.push(i)}}return n},ju.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+"-"+t,a=r[i];if(a)return a;for(var o=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Hu,h=t[l]===Hu,d=c!==h,f=u.mappedProperties.length>0;if(d||h&&f){var g=void 0;d&&f||d?g=u.properties:f&&(g=u.mappedProperties);for(var p=0;p<g.length;p++){for(var v=g[p],y=v.name,m=!1,b=l+1;b<n.length;b++){var x=n[b];if(t[b]===Hu&&(m=null!=x.properties[v.name]))break}s[y]||m||(s[y]=!0,o.push(y))}}}return r[i]=o,o},ju.getContextMeta=function(e){for(var t,n=this,r="",i=e._private.styleCxtKey||"",a=0;a<n.length;a++){var o=n[a];r+=o.selector&&o.selector.matches(e)?Hu:"f"}return t=n.getPropertiesDiff(i,r),e._private.styleCxtKey=r,{key:r,diffPropNames:t,empty:0===t.length}},ju.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}},i=0;i<this.length;i++){var a=this[i];if(t[i]===Hu)for(var o=0;o<a.properties.length;o++){var s=a.properties[o];r[s.name]=s}}return n[t]=r,r},ju.applyContextStyle=function(e,t,n){for(var r=e.diffPropNames,i={},a=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===a.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 h=i[s]={prev:u};this.applyParsedProperty(n,l),h.next=n.pstyle(s),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:i}},ju.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=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<i.length;u++){var c=i[u];t.styleKeys[c]=[vt,yt]}for(var h=function(e,n){return t.styleKeys[n][0]=bt(e,t.styleKeys[n][0])},d=function(e,n){return t.styleKeys[n][1]=xt(e,t.styleKeys[n][1])},f=function(e,t){h(e,t),d(e,t)},g=function(e,t){for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);h(r,t),d(r,t)}},p=function(e){return-128<e&&e<128&&Math.floor(e)!==e?2e9-(1024*e|0):e},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 T=null==b.enums?m.value:null,_=null!=E,C=_||null!=T,N=m.units;if(x.number&&C&&!x.multiple)f(p(_?E:T),w),_||null==N||g(N,w);else g(m.strValue,w)}}for(var A,M,D=[vt,yt],k=0;k<i.length;k++){var I=i[k],P=t.styleKeys[I];D[0]=bt(P[0],D[0]),D[1]=xt(P[1],D[1])}t.styleKey=(A=D[0],M=D[1],2097152*A+M);var S=t.styleKeys;t.labelDimsKey=wt(S.labelDimensions);var L=a(e,["label"],S.labelDimensions);if(t.labelKey=wt(L),t.labelStyleKey=wt(Et(S.commonLabel,L)),!s){var O=a(e,["source-label"],S.labelDimensions);t.sourceLabelKey=wt(O),t.sourceLabelStyleKey=wt(Et(S.commonLabel,O));var R=a(e,["target-label"],S.labelDimensions);t.targetLabelKey=wt(R),t.targetLabelStyleKey=wt(Et(S.commonLabel,R))}if(s){var B=t.styleKeys,F=B.nodeBody,z=B.nodeBorder,V=B.nodeOutline,G=B.backgroundImage,Y=B.compound,X=B.pie,U=B.stripe,j=[F,z,V,G,Y,X,U].filter(function(e){return null!=e}).reduce(Et,[vt,yt]);t.nodeKey=wt(j),t.hasPie=null!=X&&X[0]!==vt&&X[1]!==yt,t.hasStripe=null!=U&&U[0]!==vt&&U[1]!==yt}return o!==t.styleKey},ju.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,t.hasStripe=null},ju.applyParsedProperty=function(e,t){var n,r=this,i=t,a=e._private.style,o=r.types,s=r.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,h=e._private,d="mapping",f=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},g=function(){var t=f(u),n=f(i);r.checkTriggers(e,i.name,t,n)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i.delete)return a[i.name]=void 0,g(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,g(),!0):(g(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,g(),!0):(g(),!0);var p=function(){Ft("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var v,y=i.field.split("."),m=h.data,b=0;b<y.length&&m;b++){m=m[y[b]]}if(null==m)return p(),!1;if(!ke(m))return Ft("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;var x=i.fieldMax-i.fieldMin;if((v=0===x?0:(m-i.fieldMin)/x)<0?v=0:v>1&&(v=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],T=i.valueMin[1],_=i.valueMax[1],C=i.valueMin[2],N=i.valueMax[2],A=null==i.valueMin[3]?1:i.valueMin[3],M=null==i.valueMax[3]?1:i.valueMax[3],D=[Math.round(w+(E-w)*v),Math.round(T+(_-T)*v),Math.round(C+(N-C)*v),Math.round(A+(M-A)*v)];n={bypass:i.bypass,name:i.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!s.number)return!1;var k=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,k,i.bypass,d)}if(!n)return p(),!1;n.mapping=i,i=n;break;case o.data:for(var I=i.field.split("."),P=h.data,S=0;S<I.length&&P;S++){P=P[I[S]]}if(null!=P&&(n=this.parse(i.name,P,i.bypass,d)),!n)return p(),!1;n.mapping=i,i=n;break;case o.fn:var L=i.value,O=null!=i.fnValue?i.fnValue:L(e);if(i.prevFnValue=O,null==O)return Ft("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(n=this.parse(i.name,O,i.bypass,d)))return Ft("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invalid)"),!1;n.mapping=zt(i),i=n;break;case void 0:break;default:return!1}return l?(i.bypassed=c?u.bypassed:u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,g(),!0},ju.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 i=r._private.style,a=Object.keys(i),o=0;o<a.length;o++){var s=a[o],l=i[s];null!=l&&(l.bypass?l.bypassed=null:i[s]=null)}else r._private.style={}}},ju.update=function(){this._private.cy.mutableElements().updateStyle()},ju.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,o=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),d=t[c];if(d){var f=d.prev,g=null!=d.next?d.next:h,p=!1,v=void 0,y=1e-6;f&&(ke(f.pfValue)&&ke(g.pfValue)?(p=g.pfValue-f.pfValue,v=f.pfValue+y*p):ke(f.value)&&ke(g.value)?(p=g.value-f.value,v=f.value+y*p):Me(f.value)&&Me(g.value)&&(p=f.value[0]!==g.value[0]||f.value[1]!==g.value[1]||f.value[2]!==g.value[2],v=f.strValue),p&&(s[c]=g.strValue,this.applyBypass(e,c,v),l=!0))}}if(!l)return;r.transitioning=!0,new Mi(function(t){o>0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},ju.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||null!=s&&s(n,r,e)&&a(o)},ju.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},ju.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},ju.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},ju.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},ju.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Wu={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;a<this.properties.length;a++){var o=this.properties[a].name,s=this.parse(o,n,!0);s&&i.push(s)}}else if(Ne(t)){var l=this.parse(t,n,!0);l&&i.push(l)}else{if(!De(t))return!1;var u=t;r=n;for(var c=Object.keys(u),h=0;h<c.length;h++){var d=c[h],f=u[d];if(void 0===f&&(f=u[Ge(d)]),void 0!==f){var g=this.parse(d,f,!0);g&&i.push(g)}}}if(0===i.length)return!1;for(var p=!1,v=0;v<e.length;v++){for(var y=e[v],m={},b=void 0,x=0;x<i.length;x++){var w=i[x];if(r){var E=y.pstyle(w.name);b=m[w.name]={prev:E}}p=this.applyParsedProperty(y,zt(w))||p,r&&(b.next=y.pstyle(w.name))}p&&this.updateStyleHints(y),r&&this.updateTransitions(y,m,true)}return p},overrideBypass:function(e,t,n){t=Ve(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],o=this.properties[t].type,s=o.color,l=o.mutiple,u=a?null!=a.pfValue?a.pfValue:a.value:null;a&&a.bypass?(a.value=n,null!=a.pfValue&&(a.pfValue=n),a.strValue=s?"rgb("+n.join(",")+")":l?n.join(" "):""+n,this.updateStyleHints(i)):this.applyBypass(i,t,n),this.checkTriggers(i,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 i=e[r],a={},o=0;o<t.length;o++){var s=t[o],l=this.properties[s],u=i.pstyle(l.name);if(u&&u.bypass){var c=this.parse(s,"",!0),h=a[l.name]={prev:u};this.applyParsedProperty(i,c),h.next=i.pstyle(l.name)}}this.updateStyleHints(i),n&&this.updateTransitions(i,a,true)}}},qu={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)}},Ku={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={},i=0;i<n.properties.length;i++){var a=n.properties[i],o=n.getStylePropertyValue(e,a.name,t);null!=o&&(r[a.name]=o,r[Ge(a.name)]=o)}return r}},getIndexedStyle:function(e,t,n,r){var i=e.pstyle(t)[n][r];return null!=i?i: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 i=r.type,a=e.pstyle(r.name);if(a){var o=a.value,s=a.units,l=a.strValue;if(n&&i.number&&null!=o&&ke(o)){var u=e.cy().zoom(),c=function(e){return e*u},h=function(e,t){return c(e)+t},d=Me(o);return(d?s.every(function(e){return null!=e}):null!=s)?d?o.map(function(e,t){return h(e,s[t])}).join(" "):h(o,s):d?o.map(function(e){return Ne(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 i=t[r].name,a=e.pstyle(i);void 0!==a&&(a=De(a)?this.parse(i,a.strValue):this.parse(i,a)),a&&(n[i]=a)}return n},getPropsList:function(e){var t=[],n=e,r=this.properties;if(n)for(var i=Object.keys(n),a=0;a<i.length;a++){var o=i[a],s=n[o],l=r[o]||r[Ve(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},getNonDefaultPropertiesHash:function(e,t,n){var r,i,a,o,s,l,u=n.slice();for(s=0;s<t.length;s++)if(r=t[s],null!=(i=e.pstyle(r,!1)))if(null!=i.pfValue)u[0]=bt(o,u[0]),u[1]=xt(o,u[1]);else for(a=i.strValue,l=0;l<a.length;l++)o=a.charCodeAt(l),u[0]=bt(o,u[0]),u[1]=xt(o,u[1]);return u}};Ku.getPropertiesHash=Ku.getNonDefaultPropertiesHash;var Zu={appendFromJson:function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,o=Object.keys(a);t.selector(i);for(var s=0;s<o.length;s++){var l=o[s],u=a[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,i=n.properties,a={},o=0;o<i.length;o++){var s=i[o];a[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:a})}return e}},$u={appendFromString:function(e){var t,n,r,i=this,a=""+e;function o(){a=a.length>t.length?a.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(a.match(/^\s*$/))break;var l=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!l){Ft("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=l[0];var u=l[1];if("core"!==u)if(new zs(u).invalid){Ft("Skipping parsing of block: Invalid selector found in string stylesheet: "+u),o();continue}var c=l[2],h=!1;n=c;for(var d=[];;){if(n.match(/^\s*$/))break;var f=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){Ft("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),h=!0;break}r=f[0];var g=f[1],p=f[2];if(this.properties[g])i.parse(g,p)?(d.push({name:g,val:p}),s()):(Ft("Skipping property: Invalid property definition in: "+r),s());else Ft("Skipping property: Invalid property name in: "+r),s()}if(h){o();break}i.selector(u);for(var v=0;v<d.length;v++){var y=d[v];i.css(y.name,y.val)}o()}return i},fromString:function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t}},Qu={};!function(){var e=je,t=We,n=Ke,r=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},i=function(r){var i=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*("+i+")\\s*\\,\\s*("+i+")\\)$"},a=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];Qu.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"]},axisDirectionExplicit:{enums:["leftward","rightward","upward","downward"]},axisDirectionPrimary:{enums:["horizontal","vertical"]},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},boxSelection:{enums:["contain","overlap","none"]},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","circle"]},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","top-inside","center","bottom","bottom-inside"]},halign:{enums:["left","left-inside","center","right","right-inside"]},justification:{enums:["left","center","right","auto"]},textMetrics:{enums:["font","glyph"]},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:i("mapData")},mapLayoutData:{mapping:!0,regex:i("mapLayoutData")},mapScratch:{mapping:!0,regex:i("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:a,singleRegexMatchValue:!0},urls:{regexes:a,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 Ne(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=Be(e),r=Be(t);return n&&!r||!n&&r}},s=Qu.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}],h=[{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}],d=[{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},{name:"text-metrics",type:s.textMetrics},{name:"box-select-labels",type:s.bool,triggersBounds:o.any}],f=[{name:"events",type:s.bool,triggersZOrder:o.any},{name:"text-events",type:s.bool,triggersZOrder:o.any},{name:"box-selection",type:s.boxSelection,triggersZOrder:o.any}],g=[{name:"display",type:s.display,triggersZOrder:o.any,triggersBounds:o.any,triggersBoundsOfConnectedEdges:o.any,triggersBoundsOfParallelEdges:function(e,t,n){return e!==t&&"bezier"===n.pstyle("curve-style").value}},{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}],p=[{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},b=[{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}],x=[{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}],w=[{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}],E=[{name:"background-image",type:s.urls},{name:"background-image-crossorigin",type:s.bgCrossOrigin},{name:"background-image-opacity",type:s.zeroOneNumbers},{name:"background-image-containment",type:s.bgContainment},{name:"background-image-smoothing",type:s.bools},{name:"background-position-x",type:s.bgPos},{name:"background-position-y",type:s.bgPos},{name:"background-width-relative-to",type:s.bgRelativeTo},{name:"background-height-relative-to",type:s.bgRelativeTo},{name:"background-repeat",type:s.bgRepeat},{name:"background-fit",type:s.bgFit},{name:"background-clip",type:s.bgClip},{name:"background-width",type:s.bgWH},{name:"background-height",type:s.bgWH},{name:"background-offset-x",type:s.bgPos},{name:"background-offset-y",type:s.bgPos}],T=[{name:"position",type:s.position,triggersBounds: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}],_=[{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,triggersBoundsOfParallelEdges:function(e,t){return e!==t&&("bezier"===e||"bezier"===t)}},{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}],C=[{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}],N=[{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}],A=[];Qu.pieBackgroundN=16,A.push({name:"pie-size",type:s.sizeMaybePercent}),A.push({name:"pie-hole",type:s.sizeMaybePercent}),A.push({name:"pie-start-angle",type:s.angle});for(var M=1;M<=Qu.pieBackgroundN;M++)A.push({name:"pie-"+M+"-background-color",type:s.color}),A.push({name:"pie-"+M+"-background-size",type:s.percent}),A.push({name:"pie-"+M+"-background-opacity",type:s.zeroOneNumber});var D=[];Qu.stripeBackgroundN=16,D.push({name:"stripe-size",type:s.sizeMaybePercent}),D.push({name:"stripe-direction",type:s.axisDirectionPrimary});for(var k=1;k<=Qu.stripeBackgroundN;k++)D.push({name:"stripe-"+k+"-background-color",type:s.color}),D.push({name:"stripe-"+k+"-background-size",type:s.percent}),D.push({name:"stripe-"+k+"-background-opacity",type:s.zeroOneNumber});var I=[],P=Qu.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){P.forEach(function(t){var n=t+"-"+e.name,r=e.type,i=e.triggersBounds;I.push({name:n,type:r,triggersBounds:i})})},{});var S=Qu.properties=[].concat(f,y,g,p,v,C,d,h,l,u,c,b,x,w,E,A,D,T,_,I,N),L=Qu.propertyGroups={behavior:f,transition:y,visibility:g,overlay:p,underlay:v,ghost:C,commonLabel:d,labelDimensions:h,mainLabel:l,sourceLabel:u,targetLabel:c,nodeBody:b,nodeBorder:x,nodeOutline:w,backgroundImage:E,pie:A,stripe:D,compound:T,edgeLine:_,edgeArrow:I,core:N},O=Qu.propertyGroupNames={};(Qu.propertyGroupKeys=Object.keys(L)).forEach(function(e){O[e]=L[e].map(function(e){return e.name}),L[e].forEach(function(t){return t.groupKey=e})});var R=Qu.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"}];Qu.propertyNames=S.map(function(e){return e.name});for(var B=0;B<S.length;B++){var F=S[B];S[F.name]=F}for(var z=0;z<R.length;z++){var V=R[z],G=S[V.pointsTo],Y={name:V.name,alias:!0,pointsTo:G};S.push(Y),S[V.name]=Y}}(),Qu.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},Qu.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=$e({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","box-selection":"contain","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","text-metrics":"font","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","box-select-labels":"no","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%","pie-hole":0,"pie-start-angle":"0deg"},[{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<=Qu.pieBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}return e},{}),{"stripe-size":"100%","stripe-direction":"horizontal"},[{name:"stripe-{{i}}-background-color",value:"black"},{name:"stripe-{{i}}-background-size",value:"0%"},{name:"stripe-{{i}}-background-opacity",value:1}].reduce(function(e,t){for(var n=1;n<=Qu.stripeBackgroundN;n++){var r=t.name.replace("{{i}}",n),i=t.value;e[r]=i}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 Qu.arrowPrefixes.forEach(function(n){var r=n+"-"+t.name,i=t.value;e[r]=i}),e},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,o=t[a],s=this.parse(a,o);n[a]=s}}return e.defaultProperties=n,e.defaultProperties},Qu.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 Ju={parse:function(e,t,n,r){var i=this;if(Ae(t))return i.parseImplWarn(e,t,n,r);var a,o=Ct(e,""+t,n?"t":"f","mapping"===r||!0===r||!1===r||null==r?"dontcare":r),s=i.propCache=i.propCache||[];return(a=s[o])||(a=s[o]=i.parseImplWarn(e,t,n,r)),(n||"mapping"===r)&&(a=zt(a))&&(a.value=zt(a.value)),a},parseImplWarn:function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return i||null==t||Ft("The style property `".concat(e,": ").concat(t,"` is invalid")),!i||"width"!==i.name&&"height"!==i.name||"label"!==t||Ft("The style value of `label` is deprecated for `"+i.name+"`"),i}};Ju.parseImpl=function(e,t,n,r){var i=this;e=Ve(e);var a=i.properties[e],o=t,s=i.types;if(!a)return null;if(void 0===t)return null;a.alias&&(a=a.pointsTo,e=a.name);var l=Ne(t);l&&(t=t.trim());var u,c,h=a.type;if(!h)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Ae(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 d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,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(h.multiple)return!1;var f=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var p=this.parse(e,c[5]);if(!p||p.mapped)return!1;if(g.pfValue===p.pfValue||g.strValue===p.strValue)return Ft("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=p.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:f,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:p.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):Me(t)?t:[t],h.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",T=!1,_=0;_<m.length;_++){var C=i.parse(e,m[_],n,"multiple");T=T||Ne(C.value),b.push(C.value),w.push(null!=C.pfValue?C.pfValue:C.value),x.push(C.units),E+=(_>0?" ":"")+C.strValue}return h.validate&&!h.validate(b,x)?null:h.singleEnum&&T?1===b.length&&Ne(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var N,A,M=function(){for(var r=0;r<h.enums.length;r++){if(h.enums[r]===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(h.number){var D,k="px";if(h.units&&(D=h.units),h.implicitUnits&&(k=h.implicitUnits),!h.unitless)if(l){var I="px|em"+(h.allowPercent?"|\\%":"");D&&(I=D);var P=t.match("^("+je+")("+I+")?$");P&&(t=P[1],D=P[2]||k)}else D&&!h.implicitUnits||(D=k);if(t=parseFloat(t),isNaN(t)&&void 0===h.enums)return null;if(isNaN(t)&&void 0!==h.enums)return t=o,M();if(h.integer&&(!ke(A=t)||Math.floor(A)!==A))return null;if(void 0!==h.min&&(t<h.min||h.strictMin&&t===h.min)||void 0!==h.max&&(t>h.max||h.strictMax&&t===h.max))return null;var S={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:n};return h.unitless||"px"!==D&&"em"!==D?S.pfValue=t:S.pfValue="px"!==D&&D?this.getEmSizeInPixels()*t:t,"ms"!==D&&"s"!==D||(S.pfValue="ms"===D?t:1e3*t),"deg"!==D&&"rad"!==D||(S.pfValue="rad"===D?t:(N=t,Math.PI*N/180)),"%"===D&&(S.pfValue=t/100),S}if(h.propList){var L=[],O=""+t;if("none"===O);else{for(var R=O.split(/\s*,\s*|\s+/),B=0;B<R.length;B++){var F=R[B].trim();i.properties[F]?L.push(F):Ft("`"+F+"` is not a valid property name")}if(0===L.length)return null}return{name:e,value:L,strValue:0===L.length?"none":L.join(" "),bypass:n}}if(h.color){var z=Qe(t);return z?{name:e,value:z,pfValue:z,strValue:"rgb("+z[0]+","+z[1]+","+z[2]+")",bypass:n}:null}if(h.regex||h.regexes){if(h.enums){var V=M();if(V)return V}for(var G=h.regexes?h.regexes:[h.regex],Y=0;Y<G.length;Y++){var X=new RegExp(G[Y]).exec(t);if(X)return{name:e,value:h.singleRegexMatchValue?X[1]:X,strValue:""+t,bypass:n}}return null}return h.string?{name:e,value:""+t,strValue:""+t,bypass:n}:h.enums?M():null};var ec=function(e){if(!(this instanceof ec))return new ec(e);Oe(e)?(this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()):Rt("A style must have a core reference")},tc=ec.prototype;tc.instanceString=function(){return"style"},tc.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},tc.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},tc.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},tc.selector=function(e){var t="core"===e?null:new zs(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},tc.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],i=t[r.name];void 0===i&&(i=t[Ge(r.name)]),void 0!==i&&this.cssRule(r.name,i)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},tc.style=tc.css,tc.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.name.match(/stripe-(\d+)-background-size/)&&n.value&&(this._private.hasStripe=!0),n.mapped&&this[r].mappedProperties.push(n),!this[r].selector&&(this._private.coreStyle[n.name]=n)}return this},tc.append=function(e){return Re(e)?e.appendToStyle(this):Me(e)?this.appendFromJson(e):Ne(e)&&this.appendFromString(e),this},ec.fromJson=function(e,t){var n=new ec(e);return n.fromJson(t),n},ec.fromString=function(e,t){return new ec(e).fromString(t)},[ju,Wu,qu,Ku,Zu,$u,Qu,Ju].forEach(function(e){$e(tc,e)}),ec.types=tc.types,ec.properties=tc.properties,ec.propertyGroups=tc.propertyGroups,ec.propertyGroupNames=tc.propertyGroupNames,ec.propertyGroupKeys=tc.propertyGroupKeys;var nc={style:function(e){e&&this.setStyle(e).update();return this._private.style},setStyle:function(e){var t=this._private;return Re(e)?t.style=e.generateStyle(this):Me(e)?t.style=ec.fromJson(this,e):Ne(e)?t.style=ec.fromString(this,e):t.style=ec(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},rc={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,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(Ne(a[0]))return o[e=a[0]];if(De(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,ke(r)&&(o.x=r),ke(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;t=a[1],"x"!==(e=a[0])&&"y"!==e||!ke(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:De(e)&&(a=(i=s[0]).x,o=i.y,ke(a)&&(l.x+=a),ke(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!ke(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},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(ke(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n,r;if(Ne(e)){var i=e;e=this.$(i)}else if(De(r=e)&&ke(r.x1)&&ke(r.x2)&&ke(r.y1)&&ke(r.y2)){var a=e;(n={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else Pe(e)||(e=this.mutableElements());if(!Pe(e)||!e.empty()){n=n||e.boundingBox();var o,s=this.width(),l=this.height();if(t=ke(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 ke(e)&&ke(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ke(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:ke(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,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),ke(e)?n=e:De(e)&&(n=e.level,null!=e.position?t=En(e.position,a,i):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||!ke(n)||n===a||null!=t&&(!ke(t.x)||!ke(t.y)))return null;if(null!=t){var s=i,l=a,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:i}},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,i=[],a=!1,o=!1;if(!e)return this;if(ke(e.zoom)||(n=!1),De(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ke(l.x)&&(t.pan.x=l.x,o=!1),ke(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var 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(Ne(e)){var n=e;e=this.mutableElements().filter(n)}else Pe(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-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,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.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}};rc.centre=rc.center,rc.autolockNodes=rc.autolock,rc.autoungrabifyNodes=rc.autoungrabify;var ic={data:ts.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ts.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ts.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ts.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ic.attr=ic.data,ic.removeAttr=ic.removeData;var ac=function(e){var t=this,n=(e=$e({},e)).container;n&&!Ie(n)&&Ie(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==j&&void 0!==n&&!e.headless,o=e;o.layout=$e({name:a?"grid":"null"},o.layout),o.renderer=$e({name:a?"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 wu(this),listeners:[],aniEles:new wu(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?a:o.styleEnabled,zoom:ke(o.zoom)?o.zoom:1,pan:{x:De(o.pan)&&ke(o.pan.x)?o.pan.x:0,y:De(o.pan)&&ke(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=$e({},o,o.renderer);t.initRenderer(u);!function(e,t){if(e.some(Fe))return Mi.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(De(e)||Me(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 a=$e({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,function(){t.startAnimationLoop(),l.ready=!0,Ae(o.ready)&&t.on("ready",o.ready);for(var e=0;e<i.length;e++){var n=i[e];t.on("ready",n)}r&&(r.readies=[]),t.emit("ready")},o.done)})},oc=ac.prototype;$e(oc,{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 j;var e=this._private.container.ownerDocument;return void 0===e||null==e?j:e.defaultView||j},mount:function(e){if(null!=e){var t=this,n=t._private,r=n.options;return!Ie(e)&&Ie(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer($e({},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 zt(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements();if(De(e)){if(t.startBatch(),e.elements){var i={},a=function(e,n){for(var r=[],a=[],o=0;o<e.length;o++){var s=e[o];if(s.data.id){var l=""+s.data.id,u=t.getElementById(l);i[l]=!0,0!==u.length?a.push({ele:u,json:s}):n?(s.group=n,r.push(s)):r.push(s)}else Ft("cy.json() cannot handle elements without an ID attribute")}t.add(r);for(var c=0;c<a.length;c++){var h=a[c],d=h.ele,f=h.json;d.json(f)}};if(Me(e.elements))a(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];Me(u)&&a(u,l)}var c=t.collection();r.filter(function(e){return!i[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 h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<h.length;d++){var f=h[d];null!=e[f]&&t[f](e[f])}return t.endBatch(),this}var g={};!!e?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},r.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=zt(t.data());var p=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=zt(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=zt(p.renderer),g.hideEdgesOnViewport=p.hideEdgesOnViewport,g.textureOnViewport=p.textureOnViewport,g.wheelSensitivity=p.wheelSensitivity,g.motionBlur=p.motionBlur,g.multiClickDebounceTime=p.multiClickDebounceTime,g}}),oc.$id=oc.getElementById,[Tu,Ou,Fu,zu,Vu,Gu,Xu,Uu,nc,rc,ic].forEach(function(e){$e(oc,e)});var sc={fit:!0,directed:!1,direction:"downward",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}},lc={maximal:!1,acyclic:!1},uc=function(e){return e.scratch("breadthfirst")},cc=function(e,t){return e.scratch("breadthfirst",t)};function hc(e){this.options=$e({},sc,lc,e)}hc.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter(function(e){return e.isChildless()}),a=r,o=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=!!t.boundingBox,u=Ln(l?t.boundingBox:structuredClone(n.extent()));if(Pe(t.roots))e=t.roots;else if(Me(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var d=t.roots[h],f=n.getElementById(d);c.push(f)}e=n.collection(c)}else if(Ne(t.roots))e=n.$(t.roots);else if(o)e=i.roots();else{var g=r.components();e=n.collection();for(var p=function(){var t=g[v],n=t.maxDegree(!1),r=t.filter(function(e){return e.degree(!1)===n});e=e.add(r)},v=0;v<g.length;v++)p()}var y=[],m={},b=function(e,t){null==y[t]&&(y[t]=[]);var n=y[t].length;y[t].push(e),cc(e,{index:n,depth:t})};a.bfs({roots:e,directed:t.directed,visit:function(e,t,n,r,i){var a=e[0],o=a.id();a.isChildless()&&b(a,i),m[o]=!0}});for(var x=[],w=0;w<i.length;w++){var E=i[w];m[E.id()]||x.push(E)}var T=function(e){for(var t=y[e],n=0;n<t.length;n++){var r=t[n];null!=r?cc(r,{depth:e,index:n}):(t.splice(n,1),n--)}},_=function(e,n){for(var i=uc(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l<a.length;l++){var u=a[l],c=uc(u);o=Math.max(o,c.depth)}if(i.depth<=o){if(!t.acyclic&&n[s])return null;var h=o+1;return function(e,t){var n=uc(e),r=n.depth,i=n.index;y[r][i]=null,e.isChildless()&&b(e,t)}(e,h),n[s]=h,!0}return!1};if(o&&s){var C=[],N={},A=function(e){return C.push(e)},M=function(){return C.shift()};for(i.forEach(function(e){return C.push(e)});C.length>0;){var D=M(),k=_(D,N);if(k)D.outgoers().filter(function(e){return e.isNode()&&r.has(e)}).forEach(A);else if(null===k){Ft("Detected double maximal shift for node `"+D.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(t.avoidOverlap)for(var P=0;P<i.length;P++){var S=i[P].layoutDimensions(t),L=S.w,O=S.h;I=Math.max(I,L,O)}var R={},B=function(e){if(R[e.id()])return R[e.id()];for(var t=uc(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=uc(s);if(null!=l){var u=l.index,c=l.depth;if(null!=u&&null!=c){var h=y[c].length;c<t&&(r+=u/h,a++)}}}}return r/=a=Math.max(1,a),0===a&&(r=0),R[e.id()]=r,r},F=function(e,t){var n=B(e)-B(t);return 0===n?Ze(e.id(),t.id()):n};void 0!==t.depthSort&&(F=t.depthSort);for(var z=y.length,V=0;V<z;V++)y[V].sort(F),T(V);for(var G=[],Y=0;Y<x.length;Y++)G.push(x[Y]);G.length&&(y.unshift(G),z=y.length,function(){for(var e=0;e<z;e++)T(e)}());for(var X=0,U=0;U<z;U++)X=Math.max(y[U].length,X);var j=u.x1+u.w/2,H=u.y1+u.h/2,W=i.reduce(function(e,n){return r=n.boundingBox({includeLabels:t.nodeDimensionsIncludeLabels}),{w:-1===e.w?r.w:(e.w+r.w)/2,h:-1===e.h?r.h:(e.h+r.h)/2};var r},{w:-1,h:-1}),q=Math.max(1===z?0:l?(u.h-2*t.padding-W.h)/(z-1):(u.h-2*t.padding-W.h)/(z+1),I),K=y.reduce(function(e,t){return Math.max(e,t.length)},0),Z={downward:0,leftward:90,upward:180,rightward:-90};-1===Object.keys(Z).indexOf(t.direction)&&Rt("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(Z).join(", ")));return r.nodes().layoutPositions(this,t,function(e){return At(function(e){var n=uc(e),r=n.depth,i=n.index;if(t.circle){var a=Math.min(u.w/2/z,u.h/2/z),o=(a=Math.max(a,I))*r+a-(z>0&&y[0].length<=3?a/2:0),s=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(o=1),{x:j+o*Math.cos(s),y:H+o*Math.sin(s)}}var c=y[r].length,h=Math.max(1===c?0:l?(u.w-2*t.padding-W.w)/((t.grid?K:c)-1):(u.w-2*t.padding-W.w)/((t.grid?K:c)+1),I);return{x:j+(i+1-(c+1)/2)*h,y:H+(r+1-(z+1)/2)*q}}(e),u,Z[t.direction])}),this};var dc={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 fc(e){this.options=$e({},dc,e)}fc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=Ln(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/a.length:t.sweep)/Math.max(1,a.length-1),h=0,d=0;d<a.length;d++){var f=a[d].layoutDimensions(t),g=f.w,p=f.h;h=Math.max(h,g,p)}if(o=ke(t.radius)?t.radius:a.length<=1?0:Math.min(s.h,s.w)/2-h,a.length>1&&t.avoidOverlap){h*=1.75;var v=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(h*h/(v*v+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l+a,y:u+s}}),this};var gc,pc={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 vc(e){this.options=$e({},pc,e)}vc.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=Ln(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,h=0;h<a.length;h++){var d,f=a[h];d=t.concentric(f),u.push({value:d,node:f}),f._private.scratch.concentric=d}a.updateStyle();for(var g=0;g<a.length;g++){var p=a[g].layoutDimensions(t);c=Math.max(c,p.w,p.h)}u.sort(function(e,t){return t.value-e.value});for(var v=t.levelWidth(a),y=[[]],m=y[0],b=0;b<u.length;b++){var x=u[b];if(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,T=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,T)}for(var _=0,C=0;C<y.length;C++){var N=y[C],A=void 0===t.sweep?2*Math.PI-2*Math.PI/N.length:t.sweep,M=N.dTheta=A/Math.max(1,N.length-1);if(N.length>1&&t.avoidOverlap){var D=Math.cos(M)-Math.cos(0),k=Math.sin(M)-Math.sin(0),I=Math.sqrt(w*w/(D*D+k*k));_=Math.max(I,_)}N.r=_,_+=w}if(t.equidistant){for(var P=0,S=0,L=0;L<y.length;L++){var O=y[L].r-S;P=Math.max(P,O)}S=0;for(var R=0;R<y.length;R++){var B=y[R];0===R&&(S=B.r),B.r=S,S+=P}}for(var F={},z=0;z<y.length;z++)for(var V=y[z],G=V.dTheta,Y=V.r,X=0;X<V.length;X++){var U=V[X],j=t.startAngle+(n?1:-1)*G*X,H={x:s+Y*Math.cos(j),y:l+Y*Math.sin(j)};F[U.node.id()]=H}return i.nodes().layoutPositions(this,t,function(e){var t=e.id();return F[t]}),this};var yc={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 mc(e){this.options=$e({},yc,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"),i=t.some(function(e){return e.data("id")===n}),a=t.some(function(e){return e.data("id")===r});return!i||!a});this.options.eles=this.options.eles.not(n)}mc.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}),gc=!0===e.debug;var r=bc(t,n,e);gc&&(void 0)(r),e.randomize&&Ec(r);var i=pt(),a=function(){_c(r,t,e),!0===e.fit&&t.fit(e.padding)},o=function(t){return!(n.stopped||t>=e.numIter)&&(Cc(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature<e.minTemp))},s=function(){if(!0===e.animate||!1===e.animate)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),i=Tc(r,e,t);t.layoutPositions(n,e,i)}},l=0,u=!0;if(!0===e.animate){var c=function(){for(var t=0;u&&t<e.refresh;)u=o(l),l++,t++;u?(pt()-i>=e.animationThreshold&&a(),gt(c)):(Bc(r,e),s())};c()}else{for(;u;)u=o(l),l++;Bc(r,e),s()}return this},mc.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},mc.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var bc=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=Ln(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){l[c[h].id()]=u}for(u=0;u<o.nodeSize;u++){var d=(y=i[u]).layoutDimensions(n);(S={}).isLocked=y.locked(),S.id=y.data("id"),S.parentId=y.data("parent"),S.cmptId=l[y.id()],S.children=[],S.positionX=y.position("x"),S.positionY=y.position("y"),S.offsetX=0,S.offsetY=0,S.height=d.w,S.width=d.h,S.maxX=S.positionX+S.width/2,S.minX=S.positionX-S.width/2,S.maxY=S.positionY+S.height/2,S.minY=S.positionY-S.height/2,S.padLeft=parseFloat(y.style("padding")),S.padRight=parseFloat(y.style("padding")),S.padTop=parseFloat(y.style("padding")),S.padBottom=parseFloat(y.style("padding")),S.nodeRepulsion=Ae(n.nodeRepulsion)?n.nodeRepulsion(y):n.nodeRepulsion,o.layoutNodes.push(S),o.idToIndex[S.id]=u}var f=[],g=0,p=-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):(f[++p]=y.id,v.push(y.id))}for(o.graphSet.push(v);g<=p;){var b=f[g++],x=o.idToIndex[b],w=o.layoutNodes[x].children;if(w.length>0){o.graphSet.push(w);for(u=0;u<w.length;u++)f[++p]=w[u]}}for(u=0;u<o.graphSet.length;u++){var E=o.graphSet[u];for(h=0;h<E.length;h++){var T=o.idToIndex[E[h]];o.indexToGraph[T]=u}}for(u=0;u<o.edgeSize;u++){var _=r[u],C={};C.id=_.data("id"),C.sourceId=_.data("source"),C.targetId=_.data("target");var N=Ae(n.idealEdgeLength)?n.idealEdgeLength(_):n.idealEdgeLength,A=Ae(n.edgeElasticity)?n.edgeElasticity(_):n.edgeElasticity,M=o.idToIndex[C.sourceId],D=o.idToIndex[C.targetId];if(o.indexToGraph[M]!=o.indexToGraph[D]){for(var k=xc(C.sourceId,C.targetId,o),I=o.graphSet[k],P=0,S=o.layoutNodes[M];-1===I.indexOf(S.id);)S=o.layoutNodes[o.idToIndex[S.parentId]],P++;for(S=o.layoutNodes[D];-1===I.indexOf(S.id);)S=o.layoutNodes[o.idToIndex[S.parentId]],P++;N*=P*n.nestingFactor}C.idealLength=N,C.elasticity=A,o.layoutEdges.push(C)}return o},xc=function(e,t,n){var r=wc(e,t,0,n);return 2>r.count?0:r.graph},wc=function(e,t,n,r){var i=r.graphSet[n];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:n};for(var a=0,o=0;o<i.length;o++){var s=i[o],l=r.idToIndex[s],u=r.layoutNodes[l].children;if(0!==u.length){var c=r.indexToGraph[r.idToIndex[u[0]]],h=wc(e,t,c,r);if(0!==h.count){if(1!==h.count)return h;if(2===++a)break}}}return{count:a,graph:n}},Ec=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var a=e.layoutNodes[i];0!==a.children.length||a.isLocked||(a.positionX=Math.random()*n,a.positionY=Math.random()*r)}},Tc=function(e,t,n){var r=e.boundingBox,i={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")]];i.x1=Math.min(i.x1,n.positionX),i.x2=Math.max(i.x2,n.positionX),i.y1=Math.min(i.y1,n.positionY),i.y2=Math.max(i.y2,n.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(n,a){var o=e.layoutNodes[e.idToIndex[n.data("id")]];if(t.boundingBox){var s=0===i.w?.5:(o.positionX-i.x1)/i.w,l=0===i.h?.5:(o.positionY-i.y1)/i.h;return{x:r.x1+s*r.w,y:r.y1+l*r.h}}return{x:o.positionX,y:o.positionY}}},_c=function(e,t,n){var r=n.layout,i=n.eles.nodes(),a=Tc(e,n,i);i.positions(a),!0!==e.ready&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},Cc=function(e,t,n){Nc(e,t),Ic(e),Pc(e,t),Sc(e),Lc(e)},Nc=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,a=0;a<i;a++)for(var o=e.layoutNodes[e.idToIndex[r[a]]],s=a+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];Mc(o,l,e,t)}},Ac=function(e){return-e+2*e*Math.random()},Mc=function(e,t,n,r){if(e.cmptId===t.cmptId||n.isCompound){var i=t.positionX-e.positionX,a=t.positionY-e.positionY;0===i&&0===a&&(i=Ac(1),a=Ac(1));var o=Dc(e,t,i,a);if(o>0)var s=(u=r.nodeOverlap*o)*i/(p=Math.sqrt(i*i+a*a)),l=u*a/p;else{var u,c=kc(e,i,a),h=kc(t,-1*i,-1*a),d=h.x-c.x,f=h.y-c.y,g=d*d+f*f,p=Math.sqrt(g);s=(u=(e.nodeRepulsion+t.nodeRepulsion)/g)*d/p,l=u*f/p}e.isLocked||(e.offsetX-=s,e.offsetY-=l),t.isLocked||(t.offsetX+=s,t.offsetY+=l)}},Dc=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},kc=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0<n||0===t&&0>n?(u.x=r,u.y=i+a/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+o/2,u.y=i+o*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},Ic=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],a=e.layoutNodes[i],o=e.idToIndex[r.targetId],s=e.layoutNodes[o],l=s.positionX-a.positionX,u=s.positionY-a.positionY;if(0!==l||0!==u){var c=kc(a,l,u),h=kc(s,-1*l,-1*u),d=h.x-c.x,f=h.y-c.y,g=Math.sqrt(d*d+f*f),p=Math.pow(r.idealLength-g,2)/r.elasticity;if(0!==g)var v=p*d/g,y=p*f/g;else v=0,y=0;a.isLocked||(a.offsetX+=v,a.offsetY+=y),s.isLocked||(s.offsetX-=v,s.offsetY-=y)}}},Pc=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var r=e.graphSet[n],i=r.length;if(0===n)var a=e.clientHeight/2,o=e.clientWidth/2;else{var s=e.layoutNodes[e.idToIndex[r[0]]],l=e.layoutNodes[e.idToIndex[s.parentId]];a=l.positionX,o=l.positionY}for(var u=0;u<i;u++){var c=e.layoutNodes[e.idToIndex[r[u]]];if(!c.isLocked){var h=a-c.positionX,d=o-c.positionY,f=Math.sqrt(h*h+d*d);if(f>1){var g=t.gravity*h/f,p=t.gravity*d/f;c.offsetX+=g,c.offsetY+=p}}}}},Sc=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var d=e.layoutNodes[e.idToIndex[l[h]]];d.offsetX+=u,d.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},Lc=function(e,t){for(var n=0;n<e.nodeSize;n++){0<(i=e.layoutNodes[n]).children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(n=0;n<e.nodeSize;n++){if(!(0<(i=e.layoutNodes[n]).children.length||i.isLocked)){var r=Oc(i.offsetX,i.offsetY,e.temperature);i.positionX+=r.x,i.positionY+=r.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,Rc(i,e)}}for(n=0;n<e.nodeSize;n++){var i;0<(i=e.layoutNodes[n]).children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},Oc=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},Rc=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;return(null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeft<r.minX)&&(r.minX=e.minX-r.padLeft,i=!0),(null==r.maxY||e.maxY+r.padBottom>r.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTop<r.minY)&&(r.minY=e.minY-r.padTop,i=!0),i?Rc(r,t):void 0}},Bc=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var a=n[i],o=a.cmptId;(r[o]=r[o]||[]).push(a)}var s=0;for(i=0;i<r.length;i++){if(p=r[i]){p.x1=1/0,p.x2=-1/0,p.y1=1/0,p.y2=-1/0;for(var l=0;l<p.length;l++){var u=p[l];p.x1=Math.min(p.x1,u.positionX-u.width/2),p.x2=Math.max(p.x2,u.positionX+u.width/2),p.y1=Math.min(p.y1,u.positionY-u.height/2),p.y2=Math.max(p.y2,u.positionY+u.height/2)}p.w=p.x2-p.x1,p.h=p.y2-p.y1,s+=p.w*p.h}}r.sort(function(e,t){return t.w*t.h-e.w*e.h});var c=0,h=0,d=0,f=0,g=Math.sqrt(s)*e.clientWidth/e.clientHeight;for(i=0;i<r.length;i++){var p;if(p=r[i]){for(l=0;l<p.length;l++){(u=p[l]).isLocked||(u.positionX+=c-p.x1,u.positionY+=h-p.y1)}c+=p.w+t.componentSpacing,d+=p.w+t.componentSpacing,f=Math.max(f,p.h),d>g&&(h+=f+t.componentSpacing,c=0,d=0,f=0)}}},Fc={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 zc(e){this.options=$e({},Fc,e)}zc.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=Ln(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},d=t.rows,f=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=f)l=d,u=f;else if(null!=d&&null==f)l=d,u=Math.ceil(o/l);else if(null==d&&null!=f)u=f,l=Math.ceil(o/u);else if(u*l>o){var g=c(),p=h();(g-1)*p>=o?c(g-1):(p-1)*g>=o&&h(p-1)}else for(;u*l<o;){var v=c(),y=h();(y+1)*v>=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x<i.length;x++){var w=i[x],E=w._private.position;null!=E.x&&null!=E.y||(E.x=0,E.y=0);var T=w.layoutDimensions(t),_=t.avoidOverlapPadding,C=T.w+_,N=T.h+_;m=Math.max(m,C),b=Math.max(b,N)}for(var A={},M=function(e,t){return!!A["c-"+e+"-"+t]},D=function(e,t){A["c-"+e+"-"+t]=!0},k=0,I=0,P=function(){++I>=u&&(I=0,k++)},S={},L=0;L<i.length;L++){var O=i[L],R=t.position(O);if(R&&(void 0!==R.row||void 0!==R.col)){var B={row:R.row,col:R.col};if(void 0===B.col)for(B.col=0;M(B.row,B.col);)B.col++;else if(void 0===B.row)for(B.row=0;M(B.row,B.col);)B.row++;S[O.id()]=B,D(B.row,B.col)}}i.layoutPositions(this,t,function(e,t){var n,r;if(e.locked()||e.isParent())return!1;var i=S[e.id()];if(i)n=i.col*m+m/2+a.x1,r=i.row*b+b/2+a.y1;else{for(;M(k,I);)P();n=I*m+m/2+a.x1,r=k*b+b/2+a.y1,D(k,I),P()}return{x:n,y:r}})}return this};var Vc={ready:function(){},stop:function(){}};function Gc(e){this.options=$e({},Vc,e)}Gc.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},Gc.prototype.stop=function(){return this};var Yc={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 Xc(e){this.options=$e({},Yc,e)}Xc.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=Ae(e.positions);return t.layoutPositions(this,e,function(t,r){var i=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!=i&&i}),this};var Uc={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 jc(e){this.options=$e({},Uc,e)}jc.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=Ln(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 Hc=[{name:"breadthfirst",impl:hc},{name:"circle",impl:fc},{name:"concentric",impl:vc},{name:"cose",impl:mc},{name:"grid",impl:zc},{name:"null",impl:Gc},{name:"preset",impl:Xc},{name:"random",impl:jc}];function Wc(e){this.options=e,this.notifications=0}var qc=function(){},Kc=function(){throw new Error("A headless instance can not render images")};Wc.prototype={recalculateRenderedStyle:qc,notify:function(){this.notifications++},init:qc,isHeadless:function(){return!0},png:Kc,jpg:Kc};var Zc={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(r(s,l,t,n,i))}return a},a=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){Ne(s)&&(s=e[s]),e[r]=$e({name:r,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,r,o,s){var l=a(i(this.points,n+2*s,r,o));return $n(e,t,l)},roughCollide:n,draw:function(e,n,r,a){var o=i(this.points,n,r,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:o},s)};s("none",{collide:St,roughCollide:St,draw:Ot,spacing:Lt,gap:Lt}),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,a,o,s){var l=i(this.points,n,a,o),u=this.controlPoint,c=r(u[0],u[1],n,a,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=a(i(this.points,n+2*l,r,o)),c=a(i(this.pointsTee,n+2*l,r,o));return $n(e,t,u)||$n(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.pointsTee,n,r,a);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),h=a(i(this.points,n+2*l,r,o));return $n(e,t,h)||c},draw:function(e,n,r,a,o){var s=i(this.pointsTr,n,r,a);t.arrowShapeImpl(this.name)(e,s,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("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=a(i(this.points,n+2*l,r,o)),c=a(i(this.crossLinePts(n,s),n+2*l,r,o));return $n(e,t,u)||$n(e,t,c)},draw:function(e,n,r,a,o){var s=i(this.points,n,r,a),l=i(this.crossLinePts(n,o),n,r,a);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,i,a,o){var s=i;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,i,a){t.arrowShapeImpl(this.name)(e,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("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}})}},$c={projectIntoViewport:function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],o=r[4],s=n.pan(),l=n.zoom();return[((e-i)/o-s.x)/l,((t-a)/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))},i=r("padding-left"),a=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"),h=(r("border-bottom-width"),e.clientWidth),d=e.clientHeight,f=i+a,g=o+s,p=l+u,v=t.width/(h+p),y=h-f,m=d-g,b=t.left+i+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 i,a,o=this,s=this,l=s.getCachedZSortedEles(),u=[],c=s.cy.zoom(),h=s.cy.hasCompoundNodes(),d=(r?24:8)/c,f=(r?8:2)/c,g=(r?8:2)/c,p=1/0;function v(e,t){if(e.isNode()){if(a)return;a=e,u.push(e)}if(e.isEdge()&&(null==t||t<p))if(i){if(i.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&i.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,i=e,p=null!=t?t:p;break}}else u.push(e),i=e,p=null!=t?t:p}function y(n){var r=n.outerWidth()+2*f,i=n.outerHeight()+2*f,a=r/2,l=i/2,u=n.position(),c="auto"===n.pstyle("corner-radius").value?"auto":n.pstyle("corner-radius").pfValue,h=n._private.rscratch;if(u.x-a<=e&&e<=u.x+a&&u.y-l<=t&&t<=u.y+l&&s.nodeShapes[o.getNodeShape(n)].checkPoint(e,t,0,r,i,u.x,u.y,c,h))return v(n,0),!0}function m(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,f=l/2+d,g=f*f,p=2*f,m=i.source,b=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var x=a.allpts,w=0;w+3<x.length;w+=2)if(Wn(e,t,x[w],x[w+1],x[w+2],x[w+3],p)&&g>(r=Zn(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5<a.allpts.length;w+=4)if(qn(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5],p)&&g>(r=Kn(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||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),T=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w<T.length;w++){var _=T[w],C=s.arrowShapes[n.pstyle(_.name+"-arrow-shape").value],N=n.pstyle("width").pfValue;if(C.roughCollide(e,t,E,_.angle,{x:_.x,y:_.y},N,d)&&C.collide(e,t,E,_.angle,{x:_.x,y:_.y},N,d))return v(n),!0}h&&u.length>0&&(y(m),y(b))}function b(e,t,n){return Ht(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),h=b(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,f=n.pstyle(i+"text-margin-y").pfValue,p=s.x1-o-d,y=s.x2+o-d,m=s.y1-o-f,x=s.y2+o-f;if(h){var w=Math.cos(h),E=Math.sin(h),T=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},_=T(p,m),C=T(p,x),N=T(y,m),A=T(y,x),M=[_.x+d,_.y+f,N.x+d,N.y+f,A.x+d,A.y+f,C.x+d,C.y+f];if($n(e,t,M))return v(n),!0}else if(Gn(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){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,r),c=Math.max(t,r),h=Ln({x1:e=s,y1:t=u,x2:n=l,y2:r=c}),d=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],f=[[d[0],d[1]],[d[1],d[2]],[d[2],d[3]],[d[3],d[0]]];function g(e,t,n){return Ht(e,t,n)}function p(e,t){var n=e._private,r=a;e.boundingBox();var i=n.labelBounds.main;if(!i)return null;var o=g(n.rscratch,"labelX",t),s=g(n.rscratch,"labelY",t),l=g(n.rscratch,"labelAngle",t),u=e.pstyle("text-margin-x").pfValue,c=e.pstyle("text-margin-y").pfValue,h=i.x1-r-u,d=i.x2+r-u,f=i.y1-r-c,p=i.y2+r-c;if(l){var v=Math.cos(l),y=Math.sin(l),m=function(e,t){return{x:(e-=o)*v-(t-=s)*y+o,y:e*y+t*v+s}};return[m(h,f),m(d,f),m(d,p),m(h,p)]}return[{x:h,y:f},{x:d,y:f},{x:d,y:p},{x:h,y:p}]}function v(e,t,n,r){function i(e,t,n){return(n.y-e.y)*(t.x-e.x)>(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}for(var y=0;y<i.length;y++){var m=i[y];if(m.isNode()){var b=m,x="yes"===b.pstyle("text-events").strValue,w=b.pstyle("box-selection").strValue,E="yes"===b.pstyle("box-select-labels").strValue;if("none"===w)continue;var T=("overlap"===w||E)&&x,_=b.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:T});if("contain"===w){var C=!1;if(E&&x){var N=p(b);N&&gr(N,d)&&(o.push(b),C=!0)}!C&&Xn(h,_)&&o.push(b)}else if("overlap"===w&&Vn(h,_)){var A=b.boundingBox({includeNodes:!0,includeEdges:!0,includeLabels:!1,includeMainLabels:!1,includeSourceLabels:!1,includeTargetLabels:!1});if(gr([{x:A.x1,y:A.y1},{x:A.x2,y:A.y1},{x:A.x2,y:A.y2},{x:A.x1,y:A.y2}],d))o.push(b);else{var M=p(b);M&&gr(M,d)&&o.push(b)}}}else{var D=m,k=D._private,I=k.rscratch,P=D.pstyle("box-selection").strValue;if("none"===P)continue;if("contain"===P){if(null!=I.startX&&null!=I.startY&&!Gn(h,I.startX,I.startY))continue;if(null!=I.endX&&null!=I.endY&&!Gn(h,I.endX,I.endY))continue;if("bezier"===I.edgeType||"multibezier"===I.edgeType||"self"===I.edgeType||"compound"===I.edgeType||"segments"===I.edgeType||"haystack"===I.edgeType){for(var S=k.rstyle.bezierPts||k.rstyle.linePts||k.rstyle.haystackPts,L=!0,O=0;O<S.length;O++)if(!Yn(h,S[O])){L=!1;break}L&&o.push(D)}else"straight"===I.edgeType&&o.push(D)}else if("overlap"===P){var R=!1;if(null!=I.startX&&null!=I.startY&&null!=I.endX&&null!=I.endY&&(Gn(h,I.startX,I.startY)||Gn(h,I.endX,I.endY)))o.push(D),R=!0;else if(!R&&"haystack"===I.edgeType)for(var B=k.rstyle.haystackPts,F=0;F<B.length;F++)if(Yn(h,B[F])){o.push(D),R=!0;break}if(!R){var z=k.rstyle.bezierPts||k.rstyle.linePts||k.rstyle.haystackPts;if((!z||z.length<2)&&"straight"===I.edgeType&&null!=I.startX&&null!=I.startY&&null!=I.endX&&null!=I.endY&&(z=[{x:I.startX,y:I.startY},{x:I.endX,y:I.endY}]),!z||z.length<2)continue;for(var G=0;G<z.length-1;G++){for(var Y=z[G],X=z[G+1],U=0;U<f.length;U++){var j=V(f[U],2);if(v(Y,X,j[0],j[1])){o.push(D),R=!0;break}}if(R)break}}}}}return o}},Qc={calculateArrowAngles:function(e){var t,n,r,i,a,o,s=e._private.rscratch,l="haystack"===s.edgeType,u="bezier"===s.edgeType,c="multibezier"===s.edgeType,h="segments"===s.edgeType,d="compound"===s.edgeType,f="self"===s.edgeType;if(l?(r=s.haystackPts[0],i=s.haystackPts[1],a=s.haystackPts[2],o=s.haystackPts[3]):(r=s.arrowStartX,i=s.arrowStartY,a=s.arrowEndX,o=s.arrowEndY),p=s.midX,v=s.midY,h)t=r-s.segpts[0],n=i-s.segpts[1];else if(c||d||f||u){var g=s.allpts;t=r-In(g[0],g[2],g[4],.1),n=i-In(g[1],g[3],g[5],.1)}else t=r-p,n=i-v;s.srcArrowAngle=Cn(t,n);var p=s.midX,v=s.midY;if(l&&(p=(r+a)/2,v=(i+o)/2),t=a-r,n=o-i,h)if((g=s.allpts).length/2%2==0){var y=(C=g.length/2)-2;t=g[C]-g[y],n=g[C+1]-g[y+1]}else if(s.isRound)t=s.midVector[1],n=-s.midVector[0];else{y=(C=g.length/2-1)-2;t=g[C]-g[y],n=g[C+1]-g[y+1]}else if(c||d||f){var m,b,x,w,g=s.allpts;if(s.ctrlpts.length/2%2==0){var E=(T=(_=g.length/2-1)+2)+2;m=In(g[_],g[T],g[E],0),b=In(g[_+1],g[T+1],g[E+1],0),x=In(g[_],g[T],g[E],1e-4),w=In(g[_+1],g[T+1],g[E+1],1e-4)}else{var T,_;E=(T=g.length/2-1)+2;m=In(g[_=T-2],g[T],g[E],.4999),b=In(g[_+1],g[T+1],g[E+1],.4999),x=In(g[_],g[T],g[E],.5),w=In(g[_+1],g[T+1],g[E+1],.5)}t=x-m,n=w-b}if(s.midtgtArrowAngle=Cn(t,n),s.midDispX=t,s.midDispY=n,t*=-1,n*=-1,h)if((g=s.allpts).length/2%2==0);else if(!s.isRound){var C,N=(C=g.length/2-1)+2;t=-(g[N]-g[C]),n=-(g[N+1]-g[C+1])}if(s.midsrcArrowAngle=Cn(t,n),h)t=a-s.segpts[s.segpts.length-2],n=o-s.segpts[s.segpts.length-1];else if(c||d||f||u){var A=(g=s.allpts).length;t=a-In(g[A-6],g[A-4],g[A-2],.9),n=o-In(g[A-5],g[A-3],g[A-1],.9)}else t=a-p,n=o-v;s.tgtArrowAngle=Cn(t,n)}};Qc.getArrowWidth=Qc.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 Jc,eh,th,nh,rh,ih,ah,oh,sh,lh,uh,ch,hh,dh,fh,gh,ph,vh={},yh={},mh=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)},bh=function(e,t,n,r,i){var a,o;if(e!==ph?mh(t,e,vh):((o=vh).x=-1*(a=yh).x,o.y=-1*a.y,o.nx=-1*a.nx,o.ny=-1*a.ny,o.ang=a.ang>0?-(Math.PI-a.ang):Math.PI+a.ang),mh(t,n,yh),th=vh.nx*yh.ny-vh.ny*yh.nx,nh=vh.nx*yh.nx-vh.ny*-yh.ny,ah=Math.asin(Math.max(-1,Math.min(1,th))),Math.abs(ah)<1e-6)return Jc=t.x,eh=t.y,void(sh=uh=0);rh=1,ih=!1,nh<0?ah<0?ah=Math.PI+ah:(ah=Math.PI-ah,rh=-1,ih=!0):ah>0&&(rh=-1,ih=!0),uh=void 0!==t.radius?t.radius:r,oh=ah/2,ch=Math.min(vh.len/2,yh.len/2),i?(lh=Math.abs(Math.cos(oh)*uh/Math.sin(oh)))>ch?(lh=ch,sh=Math.abs(lh*Math.sin(oh)/Math.cos(oh))):sh=uh:(lh=Math.min(ch,uh),sh=Math.abs(lh*Math.sin(oh)/Math.cos(oh))),fh=t.x+yh.nx*lh,gh=t.y+yh.ny*lh,Jc=fh-yh.ny*sh*rh,eh=gh+yh.nx*sh*rh,hh=t.x+vh.nx*lh,dh=t.y+vh.ny*lh,ph=t};function xh(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 wh(e,t,n,r){var i=!(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}:(bh(e,t,n,r,i),{cx:Jc,cy:eh,radius:sh,startX:hh,startY:dh,stopX:fh,stopY:gh,startAngle:vh.ang+Math.PI/2*rh,endAngle:yh.ang-Math.PI/2*rh,counterClockwise:ih})}var Eh=.01,Th=Math.sqrt(.02),_h={};function Ch(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}_h.findMidptPtsEtc=function(e,t){var n,r=t.posPts,i=t.intersectionPts,a=t.vectorNormInverse,o=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),l=null!=o.units&&null!=s.units;switch(e.pstyle("edge-distances").value){case"node-position":n=r;break;case"intersection":n=i;break;case"endpoints":if(l){var u=V(this.manualEndptToPx(e.source()[0],o),2),c=u[0],h=u[1],d=V(this.manualEndptToPx(e.target()[0],s),2),f=d[0],g=d[1],p={x1:c,y1:h,x2:f,y2:g};a=function(e,t,n,r){var i=r-t,a=n-e,o=Math.sqrt(a*a+i*i);return{x:-i/o,y:a/o}}(c,h,f,g),n=p}else Ft("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=i}return{midptPts:n,vectorNormInverse:a}},_h.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=2*Math.random()*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=2*Math.random()*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var o=r.source,s=r.target,l=o.position(),u=s.position(),c=o.width(),h=s.width(),d=o.height(),f=s.height(),g=n.pstyle("haystack-radius").value/2;i.haystackPts=i.allpts=[i.source.x*c*g+l.x,i.source.y*d*g+l.y,i.target.x*h*g+u.x,i.target.y*f*g+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},_h.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),o=e.pstyle("radius-type"),s=Math.min(r.pfValue.length,i.pfValue.length),l=a.pfValue[a.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 h=r.pfValue[c],d=i.pfValue[c],f=1-h,g=h,p=this.findMidptPtsEtc(e,t),v=p.midptPts,y=p.vectorNormInverse,m={x:v.x1*f+v.x2*g,y:v.y1*f+v.y2*g};n.segpts.push(m.x+y.x*d,m.y+y.y*d),n.radii.push(void 0!==a.pfValue[c]?a.pfValue[c]:l),n.isArcRadius.push("arc-radius"===(void 0!==o.pfValue[c]?o.pfValue[c]:u))}},_h.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=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,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,f=h;r&&(d=0,f=l);var g=u-Math.PI/2,p=g-c/2,v=g+c/2,y=String(u+"_"+c);d=void 0===a[y]?a[y]=0:++a[y],i.ctrlpts=[o.x+1.4*Math.cos(p)*f*(d/3+1),o.y+1.4*Math.sin(p)*f*(d/3+1),o.x+1.4*Math.cos(v)*f*(d/3+1),o.y+1.4*Math.sin(v)*f*(d/3+1)]},_h.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,o=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),f=d?d.pfValue[0]:void 0,g=n,p=h;r&&(g=0,p=f);var v={x:a.x-s/2,y:a.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(s*Eh)),x=Math.max(.5,Math.log(u*Eh));i.ctrlpts=[m.x,m.y-(1+Math.pow(50,1.12)/100)*p*(g/3+1)*b,m.x-(1+Math.pow(50,1.12)/100)*p*(g/3+1)*x,m.y]},_h.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},_h.findBezierPoints=function(e,t,n,r,i){var a=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,h=l.value[0],d=r;a.edgeType=d?"multibezier":"bezier",a.ctrlpts=[];for(var f=0;f<u;f++){var g=(.5-t.eles.length/2+n)*o*(i?-1:1),p=void 0,v=An(g);d&&(c=s?s.pfValue[f]:o,h=l.value[f]);var y=void 0!==(p=r?c:void 0!==c?v*c:void 0)?p:g,m=1-h,b=h,x=this.findMidptPtsEtc(e,t),w=x.midptPts,E=x.vectorNormInverse,T={x:w.x1*m+w.x2*b,y:w.y1*m+w.y2*b};a.ctrlpts.push(T.x+E.x*y,T.y+E.y*y)}},_h.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",i="horizontal",a="leftward",o="rightward",s="downward",l="upward",u=t.posPts,c=t.srcW,h=t.srcH,d=t.tgtW,f=t.tgtH,g="node-position"!==e.pstyle("edge-distances").value,p=e.pstyle("taxi-direction").value,v=p,y=e.pstyle("taxi-turn"),m="%"===y.units,b=y.pfValue,x=b<0,w=e.pstyle("taxi-turn-min-distance").pfValue,E=g?(c+d)/2:0,T=g?(h+f)/2:0,_=u.x2-u.x1,C=u.y2-u.y1,N=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},A=N(_,E),M=N(C,T),D=!1;"auto"===v?p=Math.abs(A)>Math.abs(M)?i:r:v===l||v===s?(p=r,D=!0):v!==a&&v!==o||(p=i,D=!0);var k,I=p===r,P=I?M:A,S=I?C:_,L=An(S),O=!1;(D&&(m||x)||!(v===s&&S<0||v===l&&S>0||v===a&&S>0||v===o&&S<0)||(P=(L*=-1)*Math.abs(P),O=!0),m)?k=(b<0?1+b:b)*P:k=(b<0?P:0)+b*L;var R=function(e){return Math.abs(e)<w||Math.abs(e)>=Math.abs(P)},B=R(k),F=R(Math.abs(P)-Math.abs(k));if((B||F)&&!O)if(I){var z=Math.abs(S)<=h/2,V=Math.abs(_)<=d/2;if(z){var G=(u.x1+u.x2)/2,Y=u.y1,X=u.y2;n.segpts=[G,Y,G,X]}else if(V){var U=(u.y1+u.y2)/2,j=u.x1,H=u.x2;n.segpts=[j,U,H,U]}else n.segpts=[u.x1,u.y2]}else{var W=Math.abs(S)<=c/2,q=Math.abs(C)<=f/2;if(W){var K=(u.y1+u.y2)/2,Z=u.x1,$=u.x2;n.segpts=[Z,K,$,K]}else if(q){var Q=(u.x1+u.x2)/2,J=u.y1,ee=u.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[u.x2,u.y1]}else if(I){var te=u.y1+k+(g?h/2*L:0),ne=u.x1,re=u.x2;n.segpts=[ne,te,re,te]}else{var ie=u.x1+k+(g?c/2*L:0),ae=u.y1,oe=u.y2;n.segpts=[ie,ae,ie,oe]}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)}},_h.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,f=t.srcRs,g=t.tgtRs,p=!ke(n.startX)||!ke(n.startY),v=!ke(n.arrowStartX)||!ke(n.arrowStartY),y=!ke(n.endX)||!ke(n.endY),m=!ke(n.arrowEndX)||!ke(n.arrowEndY),b=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),x=Mn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=x<b,E=Mn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),T=E<b,_=!1;if(p||v||w){_=!0;var C={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},N=Math.sqrt(C.x*C.x+C.y*C.y),A={x:C.x/N,y:C.y/N},M=Math.max(a,o),D={x:n.ctrlpts[0]+2*A.x*M,y:n.ctrlpts[1]+2*A.y*M},k=u.intersectLine(r.x,r.y,a,o,D.x,D.y,0,h,f);w?(n.ctrlpts[0]=n.ctrlpts[0]+A.x*(b-x),n.ctrlpts[1]=n.ctrlpts[1]+A.y*(b-x)):(n.ctrlpts[0]=k[0]+A.x*b,n.ctrlpts[1]=k[1]+A.y*b)}if(y||m||T){_=!0;var I={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},P=Math.sqrt(I.x*I.x+I.y*I.y),S={x:I.x/P,y:I.y/P},L=Math.max(a,o),O={x:n.ctrlpts[0]+2*S.x*L,y:n.ctrlpts[1]+2*S.y*L},R=c.intersectLine(i.x,i.y,s,l,O.x,O.y,0,d,g);T?(n.ctrlpts[0]=n.ctrlpts[0]+S.x*(b-E),n.ctrlpts[1]=n.ctrlpts[1]+S.y*(b-E)):(n.ctrlpts[0]=R[0]+S.x*b,n.ctrlpts[1]=R[1]+S.y*b)}_&&this.findEndpoints(e)}},_h.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=In(t.allpts[r],t.allpts[r+2],t.allpts[r+4],.5),t.midY=In(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 i=2;i+3<t.allpts.length;i+=2){var a=t.radii[i/2-1],o=t.isArcRadius[i/2-1];t.roundCorners.push(wh({x:t.allpts[i-2],y:t.allpts[i-1]},{x:t.allpts[i],y:t.allpts[i+1],radius:a},{x:t.allpts[i+2],y:t.allpts[i+3]},a,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]},h=t.roundCorners[u/2];if(0===h.radius){var d={x:t.segpts[u+2],y:t.segpts[u+3]};t.midX=c.x,t.midY=c.y,t.midVector=[c.y-d.y,d.x-c.x]}else{var f=[c.x-h.cx,c.y-h.cy],g=h.radius/Math.sqrt(Math.pow(f[0],2)+Math.pow(f[1],2));f=f.map(function(e){return e*g}),t.midX=h.cx+f[0],t.midY=h.cy+f[1],t.midVector=f}}else t.midX=t.segpts[u],t.midY=t.segpts[u+1]}}},_h.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ke(t.startX)&&ke(t.startY)&&ke(t.endX)&&ke(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Ft("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."))},_h.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,r=n.cy.hasCompoundNodes(),i=new qt,a=function(e,t){return[].concat(G(e),[t?1:0]).join("-")},o=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,h=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace())if("haystack"!==h){var d="unbundled-bezier"===h||Ue(h,"segments")||"straight"===h||"straight-triangle"===h||Ue(h,"taxi"),f="unbundled-bezier"===h||"bezier"===h,g=c.source,p=c.target,v=[g.poolIndex(),p.poolIndex()].sort(),y=a(v,d),m=i.get(y);null==m&&(m={eles:[]},o.push({pairId:v,edgeIsUnbundled:d}),i.set(y,m)),m.eles.push(u),d&&(m.hasUnbundled=!0),f&&(m.hasBezier=!0)}else s.push(u)}for(var b=function(){var e,s=o[x],l=s.pairId,u=s.edgeIsUnbundled,c=a(l,u),h=i.get(c);if(!h.hasUnbundled){var d=h.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});jt(h.eles),d.forEach(function(e){return h.eles.push(e)}),h.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var f=h.eles[0],g=f.source(),p=f.target();if(g.poolIndex()>p.poolIndex()){var v=g;g=p,p=v}var y=h.srcPos=g.position(),m=h.tgtPos=p.position(),b=h.srcW=g.outerWidth(),w=h.srcH=g.outerHeight(),E=h.tgtW=p.outerWidth(),T=h.tgtH=p.outerHeight(),_=h.srcShape=n.nodeShapes[t.getNodeShape(g)],C=h.tgtShape=n.nodeShapes[t.getNodeShape(p)],N=h.srcCornerRadius="auto"===g.pstyle("corner-radius").value?"auto":g.pstyle("corner-radius").pfValue,A=h.tgtCornerRadius="auto"===p.pstyle("corner-radius").value?"auto":p.pstyle("corner-radius").pfValue,M=h.tgtRs=p._private.rscratch,D=h.srcRs=g._private.rscratch;h.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var k=0;k<h.eles.length;k++){var I=h.eles[k],P=I[0]._private.rscratch,S=I.pstyle("curve-style").value,L="unbundled-bezier"===S||Ue(S,"segments")||Ue(S,"taxi"),O=!g.same(I.source());if(!h.calculatedIntersection&&g!==p&&(h.hasBezier||h.hasUnbundled)){h.calculatedIntersection=!0;var R=_.intersectLine(y.x,y.y,b,w,m.x,m.y,0,N,D),B=h.srcIntn=R,F=C.intersectLine(m.x,m.y,E,T,y.x,y.y,0,A,M),z=h.tgtIntn=F,V=h.intersectionPts={x1:R[0],x2:F[0],y1:R[1],y2:F[1]},G=h.posPts={x1:y.x,x2:m.x,y1:y.y,y2:m.y},Y=F[1]-R[1],X=F[0]-R[0],U=Math.sqrt(X*X+Y*Y);ke(U)&&U>=Th||(U=Math.sqrt(Math.max(X*X,Eh)+Math.max(Y*Y,Eh)));var j=h.vector={x:X,y:Y},H=h.vectorNorm={x:j.x/U,y:j.y/U},W={x:-H.y,y:H.x};h.nodesOverlap=!ke(U)||C.checkPoint(R[0],R[1],0,E,T,m.x,m.y,A,M)||_.checkPoint(F[0],F[1],0,b,w,y.x,y.y,N,D),h.vectorNormInverse=W,e={nodesOverlap:h.nodesOverlap,dirCounts:h.dirCounts,calculatedIntersection:!0,hasBezier:h.hasBezier,hasUnbundled:h.hasUnbundled,eles:h.eles,srcPos:m,srcRs:M,tgtPos:y,tgtRs:D,srcW:E,srcH:T,tgtW:b,tgtH:w,srcIntn:z,tgtIntn:B,srcShape:C,tgtShape:_,posPts:{x1:G.x2,y1:G.y2,x2:G.x1,y2:G.y1},intersectionPts:{x1:V.x2,y1:V.y2,x2:V.x1,y2:V.y1},vector:{x:-j.x,y:-j.y},vectorNorm:{x:-H.x,y:-H.y},vectorNormInverse:{x:-W.x,y:-W.y}}}var q=O?e:h;P.nodesOverlap=q.nodesOverlap,P.srcIntn=q.srcIntn,P.tgtIntn=q.tgtIntn,P.isRound=S.startsWith("round"),r&&(g.isParent()||g.isChild()||p.isParent()||p.isChild())&&(g.parents().anySame(p)||p.parents().anySame(g)||g.same(p)&&g.isParent())?t.findCompoundLoopPoints(I,q,k,L):g===p?t.findLoopPoints(I,q,k,L):S.endsWith("segments")?t.findSegmentsPoints(I,q):S.endsWith("taxi")?t.findTaxiPoints(I,q):"straight"===S||!L&&h.eles.length%2==1&&k===Math.floor(h.eles.length/2)?t.findStraightEdgePoints(I):t.findBezierPoints(I,q,k,L,O),t.findEndpoints(I),t.tryToCorrectInvalidPoints(I,q),t.checkForInvalidEdgeWarning(I),t.storeAllpts(I),t.storeEdgeProjections(I),t.calculateArrowAngles(I),t.recalculateEdgeLabelProjections(I),t.calculateLabelAngles(I)}},x=0;x<o.length;x++)b();this.findHaystackPoints(s)}},_h.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return Ch(t.segpts)},_h.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 Ch(t.ctrlpts)},_h.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var Nh={manualEndptToPx:function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight(),a=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]*i),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,i),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,i,u[0],u[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,a)},findEndpoints:function(e){var t,n,r,i,a,o,s,l,u,c=this,h=e.source()[0],d=e.target()[0],f=h.position(),g=d.position(),p=e.pstyle("target-arrow-shape").value,v=e.pstyle("source-arrow-shape").value,y=e.pstyle("target-distance-from-node").pfValue,m=e.pstyle("source-distance-from-node").pfValue,b=h._private.rscratch,x=d._private.rscratch,w=e.pstyle("curve-style").value,E=e._private.rscratch,T=E.edgeType,_=Ue(w,"taxi"),C="self"===T||"compound"===T,N="bezier"===T||"multibezier"===T||C,A="bezier"!==T,M="straight"===T||"segments"===T,D="segments"===T,k=N||A||M,I=C||_,P=e.pstyle("source-endpoint"),S=I?"outside-to-node":P.value,L="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,O=e.pstyle("target-endpoint"),R=I?"outside-to-node":O.value,B="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue;E.srcManEndpt=P,E.tgtManEndpt=O;var F=null!==(t=2===(null==O||null===(n=O.pfValue)||void 0===n?void 0:n.length)?O.pfValue:null)&&void 0!==t?t:[0,0],z=null!==(r=2===(null==P||null===(i=P.pfValue)||void 0===i?void 0:i.length)?P.pfValue:null)&&void 0!==r?r:[0,0];if(N){var V=[E.ctrlpts[0],E.ctrlpts[1]];o=A?[E.ctrlpts[E.ctrlpts.length-2],E.ctrlpts[E.ctrlpts.length-1]]:V,s=V}else if(M){var G=D?E.segpts.slice(0,2):[g.x+F[0],g.y+F[1]];o=D?E.segpts.slice(E.segpts.length-2):[f.x+z[0],f.y+z[1]],s=G}if("inside-to-node"===R)a=[g.x,g.y];else if(O.units)a=this.manualEndptToPx(d,O);else if("outside-to-line"===R)a=E.tgtIntn;else if("outside-to-node"===R||"outside-to-node-or-label"===R?l=o:"outside-to-line"!==R&&"outside-to-line-or-label"!==R||(l=[f.x,f.y]),a=c.nodeShapes[this.getNodeShape(d)].intersectLine(g.x,g.y,d.outerWidth(),d.outerHeight(),l[0],l[1],0,B,x),"outside-to-node-or-label"===R||"outside-to-line-or-label"===R){var Y=d._private.rscratch,X=Y.labelWidth,U=Y.labelHeight,j=Y.labelX,H=Y.labelY,W=X/2,q=U/2,K=d.pstyle("text-valign").value;"top"===(K=ll(K))?H-=q:"bottom"===K&&(H+=q);var Z=d.pstyle("text-halign").value;"left"===(Z=sl(Z))?j-=W:"right"===Z&&(j+=W);var $=or(l[0],l[1],[j-W,H-q,j+W,H-q,j+W,H+q,j-W,H+q],g.x,g.y);if($.length>0){var Q=f,J=Dn(Q,_n(a)),ee=Dn(Q,_n($)),te=J;if(ee<J&&(a=$,te=ee),$.length>2)Dn(Q,{x:$[2],y:$[3]})<te&&(a=[$[2],$[3]])}}var ne=sr(a,o,c.arrowShapes[p].spacing(e)+y),re=sr(a,o,c.arrowShapes[p].gap(e)+y);if(E.endX=re[0],E.endY=re[1],E.arrowEndX=ne[0],E.arrowEndY=ne[1],"inside-to-node"===S)a=[f.x,f.y];else if(P.units)a=this.manualEndptToPx(h,P);else if("outside-to-line"===S)a=E.srcIntn;else if("outside-to-node"===S||"outside-to-node-or-label"===S?u=s:"outside-to-line"!==S&&"outside-to-line-or-label"!==S||(u=[g.x,g.y]),a=c.nodeShapes[this.getNodeShape(h)].intersectLine(f.x,f.y,h.outerWidth(),h.outerHeight(),u[0],u[1],0,L,b),"outside-to-node-or-label"===S||"outside-to-line-or-label"===S){var ie=h._private.rscratch,ae=ie.labelWidth,oe=ie.labelHeight,se=ie.labelX,le=ie.labelY,ue=ae/2,ce=oe/2,he=h.pstyle("text-valign").value;"top"===(he=ll(he))?le-=ce:"bottom"===he&&(le+=ce);var de=h.pstyle("text-halign").value;"left"===(de=sl(de))?se-=ue:"right"===de&&(se+=ue);var fe=or(u[0],u[1],[se-ue,le-ce,se+ue,le-ce,se+ue,le+ce,se-ue,le+ce],f.x,f.y);if(fe.length>0){var ge=g,pe=Dn(ge,_n(a)),ve=Dn(ge,_n(fe)),ye=pe;if(ve<pe&&(a=[fe[0],fe[1]],ye=ve),fe.length>2)Dn(ge,{x:fe[2],y:fe[3]})<ye&&(a=[fe[2],fe[3]])}}var me=sr(a,s,c.arrowShapes[v].spacing(e)+m),be=sr(a,s,c.arrowShapes[v].gap(e)+m);E.startX=be[0],E.startY=be[1],E.arrowStartX=me[0],E.arrowStartY=me[1],k&&(ke(E.startX)&&ke(E.startY)&&ke(E.endX)&&ke(E.endY)?E.badLine=!1:E.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}}},Ah={};function Mh(e,t,n){for(var r=function(e,t,n,r){return In(e,t,n,r)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}Ah.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 i=0;i+5<n.allpts.length;i+=4)Mh(this,e,n.allpts.slice(i,i+6))}else if("segments"===r){var a=t.rstyle.linePts=[];for(i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+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},Ah.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Dh={recalculateNodeLabelProjection:function(e){var t=e.pstyle("label").strValue;if(!Be(t)){var n,r,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,d=i.rstyle;switch(u){case"left":n=l.x-a/2-s;break;case"left-inside":n=l.x-a/2+s;break;case"right":n=l.x+a/2+s;break;case"right-inside":n=l.x+a/2-s;break;default:n=l.x}switch(c){case"top":r=l.y-o/2-s;break;case"top-inside":r=l.y-o/2+s;break;case"bottom":r=l.y+o/2+s;break;case"bottom-inside":r=l.y+o/2-s;break;default:r=l.y}h.labelX=n,h.labelY=r,d.labelX=n,d.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}}},kh=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},Ih=function(e,t){var n=t.x-e.x,r=t.y-e.y;return kh(n,r)};Dh.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var o=function(e,t,r){Wt(n.rscratch,e,t,r),Wt(n.rstyle,e,t,r)};o("labelX",null,t.x),o("labelY",null,t.y);var s=kh(r.midDispX,r.midDispY);o("labelAutoAngle",null,s);var l=function(){if(l.cache)return l.cache;for(var e=[],t=0;t+5<r.allpts.length;t+=4){var a={x:r.allpts[t],y:r.allpts[t+1]},o={x:r.allpts[t+2],y:r.allpts[t+3]},s={x:r.allpts[t+4],y:r.allpts[t+5]};e.push({p0:a,p1:o,p2:s,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=i.bezierProjPcts.length;function h(e,t,n,r,i){var a=Mn(t,n),o=e.segments[e.segments.length-1],s={p0:t,p1:n,t0:r,t1:i,startDist:o?o.startDist+o.length:0,length:a};e.segments.push(s),e.length+=a}for(var d=0;d<e.length;d++){var f=e[d],g=e[d-1];g&&(f.startDist=g.startDist+g.length),h(f,f.p0,u[d*c],0,i.bezierProjPcts[0]);for(var p=0;p<c-1;p++)h(f,u[d*c+p],u[d*c+p+1],i.bezierProjPcts[p],i.bezierProjPcts[p+1]);h(f,u[d*c+c-1],f.p2,i.bezierProjPcts[c-1],1)}return l.cache=e},u=function(n){var i,s="source"===n;if(a[n]){var u=e.pstyle(n+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var c,h=l(),d=0,f=0,g=0;g<h.length;g++){for(var p=h[s?g:h.length-1-g],v=0;v<p.segments.length;v++){var y=p.segments[s?v:p.segments.length-1-v],m=g===h.length-1&&v===p.segments.length-1;if(d=f,(f+=y.length)>=u||m){c={cp:p,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,T=s?x.t0+E*w:x.t1-E*w;T=Sn(0,T,1),t=Pn(b.p0,b.p1,b.p2,T),i=function(e,t,n,r){var i=Sn(0,r-.001,1),a=Sn(0,r+.001,1),o=Pn(e,t,n,i),s=Pn(e,t,n,a);return Ih(o,s)}(b.p0,b.p1,b.p2,T);break;case"straight":case"segments":case"haystack":for(var _,C,N,A,M=0,D=r.allpts.length,k=0;k+3<D&&(s?(N={x:r.allpts[k],y:r.allpts[k+1]},A={x:r.allpts[k+2],y:r.allpts[k+3]}):(N={x:r.allpts[D-2-k],y:r.allpts[D-1-k]},A={x:r.allpts[D-4-k],y:r.allpts[D-3-k]}),C=M,!((M+=_=Mn(N,A))>=u));k+=2);var I=(u-C)/_;I=Sn(0,I,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=Mn(e,t),s=i/o,l=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+l*r}}(N,A,I),i=Ih(N,A)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Dh.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Dh.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=_t(r,e._private.labelDimsKey);if(Ht(n.rscratch,"prefixedLabelDimsKey",t)!==i){Wt(n.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("font-size").pfValue,l=e.pstyle("text-wrap").strValue,u=Ht(n.rscratch,"labelWrapCachedLines",t)||[],c="wrap"!==l?1:Math.max(u.length,1),h=s*o,d=a.width,f=a.height+(c-1)*(o-1)*s;Wt(n.rstyle,"labelWidth",t,d),Wt(n.rscratch,"labelWidth",t,d),Wt(n.rstyle,"labelHeight",t,f),Wt(n.rscratch,"labelHeight",t,f),Wt(n.rscratch,"labelLineHeight",t,h),Wt(n.rscratch,"labelActualDescent",t,a.labelActualDescent)}},Dh.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Wt(n.rscratch,e,t,r),r):Ht(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.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=i.split("\n"),c=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],f=/[\s\u200b]+|$/g,g=0;g<u.length;g++){var p=u[g],v=this.calculateLabelDimensions(e,p).width;if(h){var y=p.split("").join("");p=y}if(v>c){var m,b="",x=0,w=F(p.matchAll(f));try{for(w.s();!(m=w.n()).done;){var E=m.value,T=E[0],_=p.substring(x,E.index);x=E.index+T.length;var C=0===b.length?_:b+_+T;this.calculateLabelDimensions(e,C).width<=c?b+=_+T:(b&&d.push(b),b=_+T)}}catch(k){w.e(k)}finally{w.f()}b.match(/^[\s\u200b]+$/)||d.push(b)}else d.push(p)}o("labelWrapCachedLines",d),i=o("labelWrapCachedText",d.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var N=e.pstyle("text-max-width").pfValue,A="",M=!1;if(this.calculateLabelDimensions(e,i).width<N)return i;for(var D=0;D<i.length;D++){if(this.calculateLabelDimensions(e,A+i[D]+"…").width>N)break;A+=i[D],D===i.length-1&&(M=!0)}return M||(A+="…"),A}return i},Dh.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;return"auto"===t?e.isNode()?function(e){switch(e){case"left":case"right-inside":return"right";case"right":case"left-inside":return"left";default:return"center"}}(n):"center":t},Dh.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue,a=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=e.pstyle("text-metrics").strValue||"font",l=this.labelCalcCanvas,u=this.labelCalcCanvasContext;if(!l){l=this.labelCalcCanvas=n.createElement("canvas"),u=this.labelCalcCanvasContext=l.getContext("2d");var c=l.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}u.font="".concat(r," ").concat(o," ").concat(i,"px ").concat(a);for(var h=0,d=0,f=t.split("\n"),g=f.length,p=0,v=0,y=0;y<g;y++){var m=f[y],b=u.measureText(m),x=Math.ceil(b.width),w=i;"glyph"===s&&(0===y&&(v=b.actualBoundingBoxAscent),y===g-1&&(p=b.actualBoundingBoxDescent)),h=Math.max(x,h),d+=w}return"glyph"===s&&(d-=i-v-p),{width:h+=0,height:d+=0,labelActualAscent:v,labelActualDescent:p}},Dh.calculateLabelAngle=function(e,t){var n=e._private.rscratch,r=e.isEdge(),i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=a.strValue;return"none"===o?0:r&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},Dh.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 Ph={},Sh=!1;Ph.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(e.width()<28||e.height()<28))return Sh||(Ft("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Sh=!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 Lh={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 i=e[r]._private.rstyle;i.clean=!1,i.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 i=function(i){if(i){var a=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(a)for(var u=0;u<a.length;u++){(0,a[u])(i,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,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};if(0!==e.length){var r=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||n(o.source())&&n(o.target())||(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(e){return!e._private.rstyle.clean&&e.isBundledBezier()})&&(l.clean=!1),t&&l.clean||o.removed()||"none"!==o.pstyle("display").value&&("nodes"===s.group?i.push(o):r.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),h.nodeX=d.x,h.nodeY=d.y,h.nodeW=c.pstyle("width").pfValue,h.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var f=0;f<r.length;f++){var g=r[f]._private,p=g.rstyle,v=g.rscratch;p.srcX=v.arrowStartX,p.srcY=v.arrowStartY,p.tgtX=v.arrowEndX,p.tgtY=v.arrowEndY,p.midX=v.midX,p.midY=v.midY,p.labelAngle=v.labelAngle,p.sourceLabelAngle=v.sourceLabelAngle,p.targetLabelAngle=v.targetLabelAngle}}}}},Oh={updateCachedGrabbedEles:function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=(i=e[n])._private.rscratch;i.grabbed()&&!i.isParent()?t.push(i):r.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},invalidateCachedZSortedEles:function(){this.cachedZSortedEles=null},getCachedZSortedEles:function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Kl),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t}},Rh={};[$c,Qc,_h,Nh,Ah,Dh,Ph,Lh,Oh].forEach(function(e){$e(Rh,e)});var Bh={getCachedImage:function(e,t,n){var r=this.imageCache=this.imageCache||{},i=r[e];if(i)return i.image.complete||i.image.addEventListener("load",n),i.image;var a=(i=r[e]=r[e]||{}).image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});var o="data:";return e.substring(0,5).toLowerCase()===o||(t="null"===t?null:t,a.crossOrigin=t),a.src=e,a}},Fh=function(e,t){var n=e[0];n&&n._private.grabbed!==t&&(n._private.grabbed=t,e.updateStyle(!1))},zh={registerBinding:function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],o=0;o<e.length;o++){var s=e[o];if(void 0!==s){var l=this.binder(s);a.push(l.on.apply(l,i))}}return a}return(l=this.binder(e)).on.apply(l,i)}};zh.binder=function(e){var t,n=this,r=n.cy.window(),i=e===r||e===r.document||e===r.document.body||(t=e,"undefined"!=typeof HTMLElement&&t instanceof HTMLElement);if(null==n.supportsPassiveEvents){var a=!1;try{var o=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});r.addEventListener("test",null,o)}catch(l){}n.supportsPassiveEvents=a}var s=function(t,r,a){var o=Array.prototype.slice.call(arguments);return i&&n.supportsPassiveEvents&&(o[2]={capture:null!=a&&a,passive:!1,once:!1}),n.bindings.push({target:e,args:o}),(e.addEventListener||e.on).apply(e,o),this};return{on:s,addEventListener:s,addListener:s,bind:s}},zh.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},zh.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},zh.load=function(){var e=this,t=e.cy.window(),n=function(e){return e.selected()},r=function(t,n,r,i){null==t&&(t=e.cy);for(var a=0;a<n.length;a++){var o=n[a];t.emit({originalEvent:r,type:o,position:i})}},i=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},a=function(t,n){var r=!0;if(e.cy.hasCompoundNodes()&&t&&t.pannable())for(var i=0;n&&i<n.length;i++){if((t=n[i]).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){Fh(e,!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),d(t,{inDragLayer:n.inDragLayer}),e.updateCachedGrabbedEles()},c=u,h=function(t){t&&(e.getCachedZSortedEles().forEach(function(e){!function(e){Fh(e,!1)}(e),function(e){e[0]._private.rscratch.inDragLayer=!1}(e),function(e){e[0]._private.rscratch.isGrabTarget=!1}(e)}),e.updateCachedGrabbedEles())},d=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()),i=r.connectedEdges();t.inDragLayer&&(i.forEach(o),r.forEach(o)),t.addToList&&r.forEach(function(e){l(e,t)})}}},f=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},g="undefined"!=typeof MutationObserver,p="undefined"!=typeof ResizeObserver;g?(e.removeObserver=new MutationObserver(function(t){for(var n=0;n<t.length;n++){var r=t[n].removedNodes;if(r)for(var i=0;i<r.length;i++){if(r[i]===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=ct(function(){e.cy.resize()},100);g&&(e.styleObserver=new MutationObserver(v),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",v),p&&(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],i=n[1],a=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+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var h=e.container,d=t.target.parentNode,f=!1;d;){if(d===h){f=!0;break}d=d.parentNode}return!!f};e.registerBinding(e.container,"mousedown",function(t){if(m(t)&&(1!==e.hoverData.which||1===t.which)){t.preventDefault(),f(),e.hoverData.capture=!0,e.hoverData.which=t.which;var n=e.cy,i=[t.clientX,t.clientY],a=e.projectIntoViewport(i[0],i[1]),o=e.selection,l=e.findNearestElements(a[0],a[1],!0,!1),h=l[0],d=e.dragData.possibleDragElements;e.hoverData.mdownPos=a,e.hoverData.mdownGPos=i;var g=function(e){return{originalEvent:t,type:e,position:{x:a[0],y:a[1]}}};if(3==t.which){e.hoverData.cxtStarted=!0;var p={originalEvent:t,type:"cxttapstart",position:{x:a[0],y:a[1]}};h?(h.activate(),h.emit(p),e.hoverData.down=h):n.emit(p),e.hoverData.downTime=(new Date).getTime(),e.hoverData.cxtDragged=!1}else if(1==t.which){if(h&&h.activate(),null!=h&&e.nodeIsGrabbable(h)){if(s(h),h.selected()){d=e.dragData.possibleDragElements=n.collection();var v=n.$(function(t){return t.isNode()&&t.selected()&&e.nodeIsGrabbable(t)});u(v,{addToList:d}),h.emit(g("grabon")),v.forEach(function(e){e.emit(g("grab"))})}else d=e.dragData.possibleDragElements=n.collection(),c(h,{addToList:d}),h.emit(g("grabon")).emit(g("grab"));e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=h,e.hoverData.downs=l,e.hoverData.downTime=(new Date).getTime(),r(h,["mousedown","tapstart","vmousedown"],t,{x:a[0],y:a[1]}),null==h?(o[4]=1,e.data.bgActivePosistion={x:a[0],y:a[1]},e.redrawHint("select",!0),e.redraw()):h.pannable()&&(o[4]=1),e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var t=e.hoverData.down;t?t.emit(g("taphold")):n.emit(g("taphold"))}},e.tapholdDuration)}o[0]=o[2]=a[0],o[1]=o[3]=a[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]),d=e.hoverData.mdownPos,f=e.hoverData.mdownGPos,g=e.selection,p=null;e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.selecting||(p=e.findNearestElement(c[0],c[1],!0,!1));var v,y=e.hoverData.last,b=e.hoverData.down,x=[c[0]-g[2],c[1]-g[3]],w=e.dragData.possibleDragElements;if(f){var E=l[0]-f[0],T=E*E,_=l[1]-f[1],C=T+_*_;e.hoverData.isOverThresholdDrag=v=C>=e.desktopTapThreshold2}var N=i(t);v&&(e.hoverData.tapholdCancelled=!0);n=!0,r(p,["mousemove","vmousemove","tapdrag"],t,{x:c[0],y:c[1]});var A=function(e){return{originalEvent:t,type:e,position:{x:c[0],y:c[1]}}},M=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||o.emit(A("boxstart")),g[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(v){var D=A("cxtdrag");b?b.emit(D):o.emit(D),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&p===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit(A("cxtdragout")),e.hoverData.cxtOver=p,p&&p.emit(A("cxtdragover")))}}else if(e.hoverData.dragging){if(n=!0,o.panningEnabled()&&o.userPanningEnabled()){var k;if(e.hoverData.justStartedPan){var I=e.hoverData.mdownPos;k={x:(c[0]-I[0])*s,y:(c[1]-I[1])*s},e.hoverData.justStartedPan=!1}else k={x:x[0]*s,y:x[1]*s};o.panBy(k),o.emit(A("dragpan")),e.hoverData.dragged=!0}c=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=g[4]||null!=b&&!b.pannable()){if(b&&b.pannable()&&b.active()&&b.unactivate(),b&&b.grabbed()||p==y||(y&&r(y,["mouseout","tapdragout"],t,{x:c[0],y:c[1]}),p&&r(p,["mouseover","tapdragover"],t,{x:c[0],y:c[1]}),e.hoverData.last=p),b)if(v){if(o.boxSelectionEnabled()&&N)b&&b.grabbed()&&(h(w),b.emit(A("freeon")),w.emit(A("free")),e.dragData.didDrag&&(b.emit(A("dragfreeon")),w.emit(A("dragfree")))),M();else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var P=!e.dragData.didDrag;P&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||u(w,{inDragLayer:!0});var S={x:0,y:0};if(ke(x[0])&&ke(x[1])&&(S.x+=x[0],S.y+=x[1],P)){var L=e.hoverData.dragDelta;L&&ke(L[0])&&ke(L[1])&&(S.x+=L[0],S.y+=L[1])}e.hoverData.draggingEles=!0,w.silentShift(S).emit(A("position")).emit(A("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 if(v){if(e.hoverData.dragging||!o.boxSelectionEnabled()||!N&&o.panningEnabled()&&o.userPanningEnabled()){if(!e.hoverData.selecting&&o.panningEnabled()&&o.userPanningEnabled()){a(b,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,g[4]=0,e.data.bgActivePosistion=_n(d),e.redrawHint("select",!0),e.redraw())}}else M();b&&b.pannable()&&b.active()&&b.unactivate()}return g[2]=c[0],g[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 a=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,d=i(t);e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate();var f=function(e){return{originalEvent:t,type:e,position:{x:o[0],y:o[1]}}};if(3===e.hoverData.which){var g=f("cxttapend");if(c?c.emit(g):a.emit(g),!e.hoverData.cxtDragged){var p=f("cxttap");c?c.emit(p):a.emit(p)}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<=a.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]})},a.multiClickDebounceTime()),w=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||i(t)||(a.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=a.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===a.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(a.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var v=a.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),v.length>0&&e.redrawHint("eles",!0),a.emit(f("boxend"));var y=function(e){return e.selectable()&&!e.selected()};"additive"===a.selectionType()||d||a.$(n).unmerge(v).unselect(),v.emit(f("box")).stdFilter(y).select().emit(f("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 m=c&&c.grabbed();h(u),m&&(c.emit(f("freeon")),u.emit(f("free")),e.dragData.didDrag&&(c.emit(f("dragfreeon")),u.emit(f("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 T,_,C,N,A,M,D,k,I,P,S,L,O,R,B=[],F=1e5,z=function(t){var n=!1,r=t.deltaY;if(null==r&&(null!=t.wheelDeltaY?r=t.wheelDeltaY/4:null!=t.wheelDelta&&(r=t.wheelDelta/4)),0!==r){if(null==T)if(B.length>=4){var i=B;if(T=function(e,t){for(var n=0;n<e.length;n++)if(e[n]%t!==0)return!1;return!0}(i,5),!T){var a=Math.abs(i[0]);T=function(e){for(var t=Math.abs(e[0]),n=1;n<e.length;n++)if(Math.abs(e[n])!==t)return!1;return!0}(i)&&a>5}if(T)for(var o=0;o<i.length;o++)F=Math.min(Math.abs(i[o]),F)}else B.push(r),n=!0;else T&&(F=Math.min(Math.abs(r),F));if(!e.scrollingPage){var s=e.cy,l=s.zoom(),u=s.pan(),c=e.projectIntoViewport(t.clientX,t.clientY),h=[c[0]*l+u.x,c[1]*l+u.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||0!==e.selection[4])t.preventDefault();else if(s.panningEnabled()&&s.userPanningEnabled()&&s.zoomingEnabled()&&s.userZoomingEnabled()){var d;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),n&&Math.abs(r)>5&&(r=5*An(r)),d=r/-250,T&&(d/=F,d*=3),d*=e.wheelSensitivity,1===t.deltaMode&&(d*=33);var f=s.zoom()*Math.pow(10,d);"gesturechange"===t.type&&(f=e.gestureStartZoom*t.scale),s.zoom({level:f,renderedPosition:{x:h[0],y:h[1]}}),s.emit({type:"gesturechange"===t.type?"pinchzoom":"scrollzoom",originalEvent:t,position:{x:c[0],y:c[1]}})}}}};e.registerBinding(e.container,"wheel",z,!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||z(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 V,G,Y,X,U,j,H,W=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},q=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",V=function(t){if(e.hasTouchStarted=!0,m(t)){f(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,i=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);i[0]=o[0],i[1]=o[1]}if(t.touches[1]){o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);i[2]=o[0],i[3]=o[1]}if(t.touches[2]){o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);i[4]=o[0],i[5]=o[1]}var l=function(e){return{originalEvent:t,type:e,position:{x:i[0],y:i[1]}}};if(t.touches[1]){e.touchData.singleTouchMoved=!0,h(e.dragData.touchDragEles);var d=e.findContainerClientCoords();P=d[0],S=d[1],L=d[2],O=d[3],_=t.touches[0].clientX-P,C=t.touches[0].clientY-S,N=t.touches[1].clientX-P,A=t.touches[1].clientY-S,R=0<=_&&_<=L&&0<=N&&N<=L&&0<=C&&C<=O&&0<=A&&A<=O;var g=n.pan(),p=n.zoom();M=W(_,C,N,A),D=q(_,C,N,A),I=[((k=[(_+N)/2,(C+A)/2])[0]-g.x)/p,(k[1]-g.y)/p];if(D<4e4&&!t.touches[2]){var v=e.findNearestElement(i[0],i[1],!0,!0),y=e.findNearestElement(i[2],i[3],!0,!0);return v&&v.isNode()?(v.activate().emit(l("cxttapstart")),e.touchData.start=v):y&&y.isNode()?(y.activate().emit(l("cxttapstart")),e.touchData.start=y):n.emit(l("cxttapstart")),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 b=e.findNearestElements(i[0],i[1],!0,!0),x=b[0];if(null!=x&&(x.activate(),e.touchData.start=x,e.touchData.starts=b,e.nodeIsGrabbable(x))){var w=e.dragData.touchDragEles=n.collection(),E=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),x.selected()?(E=n.$(function(t){return t.selected()&&e.nodeIsGrabbable(t)}),u(E,{addToList:w})):c(x,{addToList:w}),s(x),x.emit(l("grabon")),E?E.forEach(function(e){e.emit(l("grab"))}):x.emit(l("grab"))}r(x,["touchstart","tapstart","vmousedown"],t,{x:i[0],y:i[1]}),null==x&&(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:i[0],y:i[1]})},e.tapholdDuration)}if(t.touches.length>=1){for(var T=e.touchData.startPosition=[null,null,null,null,null,null],B=0;B<i.length;B++)T[B]=a[B]=i[B];var F=t.touches[0];e.touchData.startGPosition=[F.clientX,F.clientY]}}},!1),e.registerBinding(t,"touchmove",G=function(t){var n=e.touchData.capture;if(n||m(t)){var i=e.selection,o=e.cy,s=e.touchData.now,l=e.touchData.earlier,c=o.zoom();if(t.touches[0]){var d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}var f,g=function(e){return{originalEvent:t,type:e,position:{x:s[0],y:s[1]}}},p=e.touchData.startGPosition;if(n&&t.touches[0]&&p){for(var v=[],y=0;y<s.length;y++)v[y]=s[y]-l[y];var b=t.touches[0].clientX-p[0],x=b*b,w=t.touches[0].clientY-p[1];f=x+w*w>=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var E=t.touches[0].clientX-P,T=t.touches[0].clientY-S,k=t.touches[1].clientX-P,L=t.touches[1].clientY-S,O=q(E,T,k,L);if(O/D>=2.25||O>=22500){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var B=g("cxttapend");e.touchData.start?(e.touchData.start.unactivate().emit(B),e.touchData.start=null):o.emit(B)}}if(n&&e.touchData.cxt){B=g("cxtdrag");e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(B):o.emit(B),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var F=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&F===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit(g("cxtdragout")),e.touchData.cxtOver=F,F&&F.emit(g("cxtdragover")))}else if(n&&t.touches[2]&&o.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||o.emit(g("boxstart")),e.touchData.selecting=!0,e.touchData.didSelect=!0,i[4]=1,i&&0!==i.length&&void 0!==i[0]?(i[2]=(s[0]+s[2]+s[4])/3,i[3]=(s[1]+s[3]+s[5])/3):(i[0]=(s[0]+s[2]+s[4])/3,i[1]=(s[1]+s[3]+s[5])/3,i[2]=(s[0]+s[2]+s[4])/3+1,i[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 z=0;z<ee.length;z++){var V=ee[z]._private;V.grabbed=!1,V.rscratch.inDragLayer=!1}}var G=e.touchData.start,Y=(E=t.touches[0].clientX-P,T=t.touches[0].clientY-S,k=t.touches[1].clientX-P,L=t.touches[1].clientY-S,W(E,T,k,L)),X=Y/M;if(R){var U=(E-_+(k-N))/2,j=(T-C+(L-A))/2,H=o.zoom(),K=H*X,Z=o.pan(),$=I[0]*H+Z.x,Q=I[1]*H+Z.y,J={x:-K/H*($-Z.x-U)+$,y:-K/H*(Q-Z.y-j)+Q};if(G&&G.active()){var ee=e.dragData.touchDragEles;h(ee),e.redrawHint("drag",!0),e.redrawHint("eles",!0),G.unactivate().emit(g("freeon")),ee.emit(g("free")),e.dragData.didDrag&&(G.emit(g("dragfreeon")),ee.emit(g("dragfree")))}o.viewport({zoom:K,pan:J,cancelOnFailedZoom:!0}),o.emit(g("pinchzoom")),M=Y,_=E,C=T,N=k,A=L,e.pinching=!0}if(t.touches[0]){d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}if(t.touches[1]){d=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);s[2]=d[0],s[3]=d[1]}if(t.touches[2]){d=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);s[4]=d[0],s[5]=d[1]}}else if(t.touches[0]&&!e.touchData.didSelect){var te=e.touchData.start,ne=e.touchData.last;if(e.hoverData.draggingEles||e.swipePanning||(F=e.findNearestElement(s[0],s[1],!0,!0)),n&&null!=te&&t.preventDefault(),n&&null!=te&&e.nodeIsDraggable(te))if(f){ee=e.dragData.touchDragEles;var re=!e.dragData.didDrag;re&&u(ee,{inDragLayer:!0}),e.dragData.didDrag=!0;var ie={x:0,y:0};if(ke(v[0])&&ke(v[1]))if(ie.x+=v[0],ie.y+=v[1],re)e.redrawHint("eles",!0),(ae=e.touchData.dragDelta)&&ke(ae[0])&&ke(ae[1])&&(ie.x+=ae[0],ie.y+=ae[1]);e.hoverData.draggingEles=!0,ee.silentShift(ie).emit(g("position")).emit(g("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 ae;0===(ae=e.touchData.dragDelta=e.touchData.dragDelta||[]).length?(ae.push(v[0]),ae.push(v[1])):(ae[0]+=v[0],ae[1]+=v[1])}if(r(te||F,["touchmove","tapdrag","vmousemove"],t,{x:s[0],y:s[1]}),te&&te.grabbed()||F==ne||(ne&&ne.emit(g("tapdragout")),F&&F.emit(g("tapdragover"))),e.touchData.last=F,n)for(z=0;z<s.length;z++)s[z]&&e.touchData.startPosition[z]&&f&&(e.touchData.singleTouchMoved=!0);if(n&&(null==te||te.pannable())&&o.panningEnabled()&&o.userPanningEnabled()){a(te,e.touchData.starts)&&(t.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=_n(e.touchData.startPosition)),e.swipePanning?(o.panBy({x:v[0]*c,y:v[1]*c}),o.emit(g("dragpan"))):f&&(e.swipePanning=!0,o.panBy({x:b*c,y:w*c}),o.emit(g("dragpan")),te&&(te.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));d=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);s[0]=d[0],s[1]=d[1]}}for(y=0;y<s.length;y++)l[y]=s[y];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",Y=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",X=function(t){var i=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o=e.cy,s=o.zoom(),l=e.touchData.now,u=e.touchData.earlier;if(t.touches[0]){var c=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);l[0]=c[0],l[1]=c[1]}if(t.touches[1]){c=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY);l[2]=c[0],l[3]=c[1]}if(t.touches[2]){c=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY);l[4]=c[0],l[5]=c[1]}var d,f=function(e){return{originalEvent:t,type:e,position:{x:l[0],y:l[1]}}};if(i&&i.unactivate(),e.touchData.cxt){if(d=f("cxttapend"),i?i.emit(d):o.emit(d),!e.touchData.cxtDragged){var g=f("cxttap");i?i.emit(g):o.emit(g)}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]&&o.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=o.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),o.emit(f("boxend"));p.emit(f("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(f("boxselect")),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=i&&i.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 v=e.dragData.touchDragEles;if(null!=i){var y=i._private.grabbed;h(v),e.redrawHint("drag",!0),e.redrawHint("eles",!0),y&&(i.emit(f("freeon")),v.emit(f("free")),e.dragData.didDrag&&(i.emit(f("dragfreeon")),v.emit(f("dragfree")))),r(i,["touchend","tapend","vmouseup","tapdragout"],t,{x:l[0],y:l[1]}),i.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(l[0],l[1],!0,!0);r(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:l[0],y:l[1]})}var b=e.touchData.startPosition[0]-l[0],x=b*b,w=e.touchData.startPosition[1]-l[1],E=(x+w*w)*s*s;e.touchData.singleTouchMoved||(i||o.$(":selected").unselect(["tapunselect"]),r(i,["tap","vclick"],t,{x:l[0],y:l[1]}),U=!1,t.timeStamp-H<=o.multiClickDebounceTime()?(j&&clearTimeout(j),U=!0,H=null,r(i,["dbltap","vdblclick"],t,{x:l[0],y:l[1]})):(j=setTimeout(function(){U||r(i,["onetap","voneclick"],t,{x:l[0],y:l[1]})},o.multiClickDebounceTime()),H=t.timeStamp)),null!=i&&!e.dragData.didDrag&&i._private.selectable&&E<e.touchTapThreshold2&&!e.pinching&&("single"===o.selectionType()?(o.$(n).unmerge(i).unselect(["tapunselect"]),i.select(["tapselect"])):i.selected()?i.unselect(["tapunselect"]):i.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var T=0;T<l.length;T++)u[T]=l[T];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=[],Z=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}},$=function(e){K.push(function(e){return{event:e,touch:Z(e)}}(e))},Q=function(e){for(var t=0;t<K.length;t++){if(K[t].event.pointerId===e.pointerId)return void K.splice(t,1)}},J=function(e){e.touches=K.map(function(e){return e.touch})},ee=function(e){return"mouse"===e.pointerType||4===e.pointerType};e.registerBinding(e.container,"pointerdown",function(e){ee(e)||(e.preventDefault(),$(e),J(e),V(e))}),e.registerBinding(e.container,"pointerup",function(e){ee(e)||(Q(e),J(e),X(e))}),e.registerBinding(e.container,"pointercancel",function(e){ee(e)||(Q(e),J(e),Y())}),e.registerBinding(e.container,"pointermove",function(e){ee(e)||(e.preventDefault(),function(e){var t=K.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=Z(e)}(e),J(e),G(e))})}};var Vh={generatePolygon:function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,r,i,this.points)},intersectLine:function(e,t,n,r,i,a,o,s){return or(i,a,this.points,e,t,n/2,r/2,o)},checkPoint:function(e,t,n,r,i,a,o,s){return Qn(e,t,this.points,a,o,r,i,[0,-1],n)},hasMiterBounds:"rectangle"!==e,miterBounds:function(e,t,n,r,i,a){return jn(this.points,e,t,n,r,i)}}}};Vh.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return function(e,t,n,r,i,a){var o=n-e,s=r-t;o/=i,s/=a;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]}(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return tr(e,t,r,i,a,o,n)}}},Vh.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,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=i/2;a="auto"===a?dr(r,i):a;for(var c=new Array(t.length/2),h=0;h<t.length/2;h++)c[h]={x:e+l*t[2*h],y:n+u*t[2*h+1]};var d,f,g,p,v=c.length;for(f=c[v-1],d=0;d<v;d++)g=c[d%v],p=c[(d+1)%v],o[s][d]=wh(f,g,p,a),f=g,g=p;return o[s]},draw:function(e,t,n,r,i,a,o){this.renderer.nodeShapeImpl("round-polygon",e,t,n,r,i,this.points,this.getOrCreateCorners(t,n,r,i,a,o,"drawCorners"))},intersectLine:function(e,t,n,r,i,a,o,s,l){return function(e,t,n,r,i,a,o,s,l){var u,c=[],h=new Array(2*n.length);l.forEach(function(n,a){0===a?(h[h.length-2]=n.startX,h[h.length-1]=n.startY):(h[4*a-2]=n.startX,h[4*a-1]=n.startY),h[4*a]=n.stopX,h[4*a+1]=n.stopY,0!==(u=nr(e,t,r,i,n.cx,n.cy,n.radius)).length&&c.push(u[0],u[1])});for(var d=0;d<h.length/4;d++)0!==(u=ir(e,t,r,i,h[4*d],h[4*d+1],h[4*d+2],h[4*d+3],!1)).length&&c.push(u[0],u[1]);if(c.length>2){for(var f=[c[0],c[1]],g=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),p=1;p<c.length/2;p++){var v=Math.pow(c[2*p]-e,2)+Math.pow(c[2*p+1]-t,2);v<=g&&(f[0]=c[2*p],f[1]=c[2*p+1],g=v)}return f}return c}(i,a,this.points,e,t,0,0,0,this.getOrCreateCorners(e,t,n,r,s,l,"corners"))},checkPoint:function(e,t,n,r,i,a,o,s,l){return function(e,t,n,r,i,a,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 $n(e,t,l)}(e,t,this.points,0,0,0,0,this.getOrCreateCorners(a,o,r,i,s,l,"corners"))}}},Vh.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:lr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){return Hn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=r/2,u=i/2;s="auto"===s?hr(r,i):s;var c=2*(s=Math.min(l,u,s));return!!Qn(e,t,this.points,a,o,r,i-c,[0,-1],n)||(!!Qn(e,t,this.points,a,o,r-c,i,[0,-1],n)||(!!tr(e,t,c,c,a-l+s,o-u+s,n)||(!!tr(e,t,c,c,a+l-s,o-u+s,n)||(!!tr(e,t,c,c,a+l-s,o+u-s,n)||!!tr(e,t,c,c,a-l+s,o+u-s,n)))))}}},Vh.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:8,points:lr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,null,a)},generateCutTrianglePts:function(e,t,n,r,i){var a="auto"===i?this.cornerLength:i,o=t/2,s=e/2,l=n-s,u=n+s,c=r-o,h=r+o;return{topLeft:[l,c+a,l+a,c,l+a,c+a],topRight:[u-a,c,u,c+a,u-a,c+a],bottomRight:[u,h-a,u-a,h,u-a,h-a],bottomLeft:[l+a,h,l,h-a,l+a,h-a]}},intersectLine:function(e,t,n,r,i,a,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 or(i,a,u,e,t)},checkPoint:function(e,t,n,r,i,a,o,s){var l="auto"===s?this.cornerLength:s;if(Qn(e,t,this.points,a,o,r,i-2*l,[0,-1],n))return!0;if(Qn(e,t,this.points,a,o,r-2*l,i,[0,-1],n))return!0;var u=this.generateCutTrianglePts(r,i,a,o);return $n(e,t,u.topLeft)||$n(e,t,u.topRight)||$n(e,t,u.bottomRight)||$n(e,t,u.bottomLeft)}}},Vh.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:lr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){var l=this.generateBarrelBezierPts(n+2*o,r+2*o,e,t),u=function(e){var t=Pn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=Pn({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),r=Pn({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 or(i,a,c,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,a=e/2,o=n-a,s=n+a,l=r-i,u=r+i,c=fr(e,t),h=c.heightOffset,d=c.widthOffset,f=c.ctrlPtOffsetPct*e,g={topLeft:[o,l+h,o+f,l,o+d,l],topRight:[s-d,l,s-f,l,s,l+h],bottomRight:[s,u-h,s-f,u,s-d,u],bottomLeft:[o+d,u,o+f,u,o,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,n,r,i,a,o,s){var l=fr(r,i),u=l.heightOffset,c=l.widthOffset;if(Qn(e,t,this.points,a,o,r,i-2*u,[0,-1],n))return!0;if(Qn(e,t,this.points,a,o,r-2*c,i,[0,-1],n))return!0;for(var h=this.generateBarrelBezierPts(r,i,a,o),d=function(e,t,n){var r,i,a=n[4],o=n[2],s=n[0],l=n[5],u=n[1],c=Math.min(a,s),h=Math.max(a,s),d=Math.min(l,u),f=Math.max(l,u);if(c<=e&&e<=h&&d<=t&&t<=f){var g=[(r=a)-2*(i=o)+s,2*(i-r),r],p=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]}(g[0],g[1],g[2],e).filter(function(e){return 0<=e&&e<=1});if(p.length>0)return p[0]}return null},f=Object.keys(h),g=0;g<f.length;g++){var p=h[f[g]],v=d(e,t,p);if(null!=v){var y=p[5],m=p[3],b=p[1],x=In(y,m,b,v);if(p.isTop&&x<=t)return!0;if(p.isBottom&&t<=x)return!0}}return!1}}},Vh.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:lr(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=t-(r/2+o),u=ir(i,a,e,t,e-(n/2+o),l,e+(n/2+o),l,!1);return u.length>0?u:Hn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?hr(r,i):s);if(Qn(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(Qn(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!$n(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||(!!tr(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!tr(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},Vh.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",lr(3,0)),this.generateRoundPolygon("round-triangle",lr(3,0)),this.generatePolygon("rectangle",lr(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",lr(5,0)),this.generateRoundPolygon("round-pentagon",lr(5,0)),this.generatePolygon("hexagon",lr(6,0)),this.generateRoundPolygon("round-hexagon",lr(6,0)),this.generatePolygon("heptagon",lr(7,0)),this.generateRoundPolygon("round-heptagon",lr(7,0)),this.generatePolygon("octagon",lr(8,0)),this.generateRoundPolygon("round-octagon",lr(8,0));var r=new Array(20),i=cr(5,0),a=cr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<a.length/2;s++)a[2*s]*=o,a[2*s+1]*=o;for(s=0;s<5;s++)r[4*s]=i[2*s],r[4*s+1]=i[2*s+1],r[4*s+2]=a[2*s],r[4*s+3]=a[2*s+1];r=ur(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)}};var Gh={timeToRender:function(){return this.redrawTotalTime/this.redrawCount},redraw:function(e){e=e||Yt();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&&Rt("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})}}},Yh=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};Gh.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(r){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){Yh(e,!0,r);var i=pt();e.render(e.renderOptions);var a=e.lastDrawTime=pt();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else Yh(e,!1,r);e.skipFrame=!1,gt(n)}};gt(n)}};var Xh=function(e){this.init(e)},Uh=Xh.prototype;Uh.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],Uh.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 i=r.document,a=i.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=null!=i.getElementById(o);if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=i.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",a.insertBefore(u,a.children[0])}"static"===r.getComputedStyle(n).getPropertyValue("position")&&Ft("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.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ke(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()},Uh.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),"gc"===e&&n.redrawHint("gc",!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())},Uh.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(i){}},Uh.isHeadless=function(){return!1},[Zc,Rh,Bh,zh,Vh,Gh].forEach(function(e){$e(Uh,e)});var jh=1e3/60,Hh=function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=ct(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=e.priority||Ot;n.beforeRender(function(i,a){var o=pt(),s=n.averageRedrawTime,l=n.lastRedrawTime,u=[],c=n.cy.extent(),h=n.getPixelRatio();for(i||n.flushRenderedStyleQueue();;){var d=pt(),f=d-o,g=d-a;if(l<jh){var p=jh-(i?s:0);if(g>=e.deqFastCost*p)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*jh)break;var v=e.deq(t,h,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),!i&&e.shouldRedraw(t,u,h,c)&&r())},i(t))}}},Wh=function(){return B(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:St;R(this,e),this.idsByKey=new qt,this.keyForId=new qt,this.cachesByLvl=new qt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&Rt("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new Zt,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 qt,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)}}])}(),qh=7.99,Kh={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Zh=Xt({getKey:null,doesEleInvalidateKey:St,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Pt,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),$h=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Zh(t);$e(n,r),n.lookup=new Wh(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Qh=$h.prototype;Qh.reasons=Kh,Qh.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Qh.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},Qh.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new ln(function(e,t){return t.reqs-e.reqs})},Qh.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},Qh.getElement=function(e,t,n,r,i){var a=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(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Nn(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,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var f,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(f=c<=25?25:c<=50?50:50*Math.ceil(c/50),c>1024||h>1024)return null;var p=a.getTextureQueue(f),v=p[p.length-2],y=function(){return a.recycleTexture(f,h)||a.addTexture(f,h)};v||(v=p[p.length-1]),v||(v=y()),v.width-v.usedWidth<h&&(v=y());for(var m,b=function(e){return e&&e.scaledLabelShown===d},x=i&&i===Kh.dequeue,w=i&&i===Kh.highQuality,E=i&&i===Kh.downscale,T=r+1;T<=3;T++){var _=l.get(e,T);if(_){m=_;break}}var C=m&&m.level===r+1?m:null,N=function(){v.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,v.usedWidth,0,h,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,h,f),b(C))N();else if(b(m)){if(!w)return a.queueElement(e,m.level-1),m;for(var A=m.level;A>r;A--)C=a.getElement(e,t,n,A,Kh.downscale);N()}else{var M;if(!x&&!w&&!E)for(var D=r-1;D>=-4;D--){var k=l.get(e,D);if(k){M=k;break}}if(b(M))return a.queueElement(e,r),M;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+8),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},Qh.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Qh.invalidateElement=function(e){var t=this,n=t.lookup,r=[];if(n.isInvalid(e)){for(var i=-4;i<=3;i++){var a=n.getForCachedKey(e,i);a&&r.push(a)}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)}},Qh.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},Qh.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?Ut(t,e):e.fullnessChecks++},Qh.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;Ut(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a<i.length;a++){var o=i[a];r.deleteCache(o.key,o.level)}jt(i),this.getRetiredTextureQueue(t).push(e)},Qh.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},Qh.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),r=this.getRetiredTextureQueue(e),i=0;i<r.length;i++){var a=r[i];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,jt(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),Ut(r,a),n.push(a),a}},Qh.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},Qh.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o<1&&n.size()>0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,Kh.dequeue)}}return i},Qh.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=It,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},Qh.onDequeue=function(e){this.onDequeues.push(e)},Qh.offDequeue=function(e){Ut(this.onDequeues,e)},Qh.setupDequeueing=Hh({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 i=0;i<t.length;i++)for(var a=t[i].eles,o=0;o<a.length;o++){var s=a[o].boundingBox();if(Vn(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Jh=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=pt()-500,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=ct(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 ln(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},ed=Jh.prototype,td=0,nd=Math.pow(2,53)-1;ed.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),o={id:td=++td%nd,bb:e,level:t,width:r,height:i,canvas:a,context:a.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},ed.getLayers=function(e,t,n){var r=this,i=r.renderer.cy.zoom(),a=r.firstGet;if(r.firstGet=!1,null==n)if((n=Math.ceil(Nn(i*t)))<-4)n=-4;else if(i>=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},i=function(e){if(!s)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&Ut(c,o)}}();var h=function(t){var i=(t=t||{}).after;!function(){if(!o){o=Ln();for(var t=0;t<e.length;t++)On(o,e[t].boundingBox())}}();var a=Math.ceil(o.w*u),s=Math.ceil(o.h*u);if(a>32767||s>32767)return null;if(a*s>16e6)return null;var l=r.makeLayer(o,n);if(null!=i){var h=c.indexOf(i)+1;c.splice(h,0,l)}else(void 0===t.insert||t.insert)&&c.unshift(l);return l};if(r.skipping&&!a)return null;for(var d=null,f=e.length/1,g=!a,p=0;p<e.length;p++){var v=e[p],y=v._private.rscratch,m=y.imgLayerCaches=y.imgLayerCaches||{},b=m[n];if(b)d=b;else{if((!d||d.eles.length>=f||!Xn(d.bb,v.boundingBox()))&&!(d=h({insert:!0,after:d})))return null;s||g?r.queueLayer(d,v):r.drawEleInLayer(d,v,n,t),d.eles.push(v),m[n]=d}}return s||(g?null:c)},ed.getEleLevelForLayerLevel=function(e,t){return e},ed.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,true),i.setImgSmoothing(a,!0))},ed.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i<n.length;i++){var a=n[i];if(a.reqs>0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},ed.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,o=0;o<t.length;o++)if(i.eles[0]===t[o]){a=o;break}if(a<0)this.invalidateLayer(i);else{var s=a;for(o=0;o<i.eles.length;o++)if(i.eles[o]!==t[s+o]){this.invalidateLayer(i);break}}}},ed.updateElementsInLayers=function(e,t){for(var n=Se(e[0]),r=0;r<e.length;r++)for(var i=n?null:e[r],a=n?e[r]:e[r].ele,o=a._private.rscratch,s=o.imgLayerCaches=o.imgLayerCaches||{},l=-4;l<=2;l++){var u=s[l];u&&(i&&this.getEleLevelForLayerLevel(u.level)!==i.level||t(u,a,i))}},ed.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},ed.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=pt(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},ed.invalidateLayer=function(e){if(this.lastInvalidationTime=pt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Ut(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},ed.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,r){var i=e.replacement;if(i||((i=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,i.eles=e.eles),!i.reqs)for(var a=0;a<i.eles.length;a++)t.queueLayer(i,i.eles[a])})},ed.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},ed.queueLayer=function(e,t){var n=this.layersQueue,r=e.elesQueue,i=r.hasId=r.hasId||{};if(!e.replacement){if(t){if(i[t.id()])return;r.push(t),i[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},ed.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<1&&0!==n.size();){var a=n.peek();if(a.replacement)n.pop();else if(a.replaces&&a!==a.replaces.replacement)n.pop();else if(a.invalid)n.pop();else{var o=a.elesQueue.shift();o&&(t.drawEleInLayer(a,o,a.level,e),i++),0===r.length&&r.push(!0),0===a.elesQueue.length&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}}return r},ed.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 i=0;i<e.eles.length;i++){var a=e.eles[i]._private,o=a.imgLayerCaches=a.imgLayerCaches||{};o&&(o[e.level]=e)}this.requestRedraw()}},ed.requestRedraw=ct(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),ed.setupDequeueing=Hh({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)},onDeqd:Ot,shouldRedraw:Pt,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var rd,id={};function ad(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function od(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];0===i&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function sd(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var o=n,s=n[0];e.moveTo(s.x,s.y);for(i=1;i<o.length;i++){a=o[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function ld(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,2*Math.PI,!1);var a=t,o=a[0];e.moveTo(o.x,o.y);for(var s=0;s<a.length;s++){var l=a[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function ud(e,t,n,r){e.arc(t,n,r,0,2*Math.PI,!1)}id.arrowShapeImpl=function(e){return(rd||(rd={polygon:ad,"triangle-backcurve":od,"triangle-tee":sd,"circle-triangle":ld,"triangle-cross":sd,circle:ud}))[e]};var cd={drawElement:function(e,t,n,r,i,a){t.isNode()?this.drawNode(e,t,n,r,i,a):this.drawEdge(e,t,n,r,i,a)},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,i,a,o,s){var l=this,u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,r,i,a);if(null!=c){var h=s(l,t);if(0===h)return;var d,f,g,p,v,y,m=o(l,t),b=u.x1,x=u.y1,w=u.w,E=u.h;if(0!==m){var T=n.getRotationPoint(t);g=T.x,p=T.y,e.translate(g,p),e.rotate(m),(v=l.getImgSmoothing(e))||l.setImgSmoothing(e,!0);var _=n.getRotationOffset(t);d=_.x,f=_.y}else d=b,f=x;1!==h&&(y=e.globalAlpha,e.globalAlpha=y*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,d,f,w,E),1!==h&&(e.globalAlpha=y),0!==m&&(e.rotate(-m),e.translate(-g,-p),v||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}}},hd=function(){return 0},dd=function(e,t){return e.getTextAngle(t,null)},fd=function(e,t){return e.getTextAngle(t,"source")},gd=function(e,t){return e.getTextAngle(t,"target")},pd=function(e,t){return t.effectiveOpacity()},vd=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};cd.drawCachedElement=function(e,t,n,r,i,a){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,d=t.boundingBox(),f=!0===a?l.reasons.highQuality:null;if(0!==d.w&&0!==d.h&&t.visible()&&(!r||Vn(d,r))){var g=t.isEdge(),p=t.element()._private.rscratch.badLine;o.drawElementUnderlay(e,t),o.drawCachedElementPortion(e,t,l,n,i,f,hd,pd),g&&p||o.drawCachedElementPortion(e,t,u,n,i,f,dd,vd),g&&!p&&(o.drawCachedElementPortion(e,t,c,n,i,f,fd,vd),o.drawCachedElementPortion(e,t,h,n,i,f,gd,vd)),o.drawElementOverlay(e,t)}},cd.drawElements=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];this.drawElement(e,r)}},cd.drawCachedElements=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];this.drawCachedElement(e,a,n,r)}},cd.drawCachedNodes=function(e,t,n,r){for(var i=0;i<t.length;i++){var a=t[i];a.isNode()&&this.drawCachedElement(e,a,n,r)}},cd.drawLayeredElements=function(e,t,n,r){var i=this.data.lyrTxrCache.getLayers(t,n);if(i)for(var a=0;a<i.length;a++){var o=i[a],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 yd={drawEdge:function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,p=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"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=f,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),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,T=t.pstyle("ghost-opacity").value,_=y*T;e.translate(w,E),b(_),x(_),e.translate(-w,-E)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=f+p,e.lineCap=g,p>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===h?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")):e.lineCap="butt"}();i&&o.drawEdgeUnderlay(e,t),b(),x(),i&&o.drawEdgeOverlay(e,t),o.drawElementText(e,t,null,r),n&&e.translate(l.x1,l.y1)}}},md=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 i=this,a=i.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||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};yd.drawEdgeOverlay=md("overlay"),yd.drawEdgeUnderlay=md("underlay"),yd.drawEdgePath=function(e,t,n,r){var i,a=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("$");a.pathCacheKey&&a.pathCacheKey===h?(i=t=a.pathCache,s=!0):(i=t=new Path2D,a.pathCacheKey=h,a.pathCache=i)}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&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"haystack":for(var f=2;f+1<n.length;f+=2)t.lineTo(n[f],n[f+1]);break;case"segments":if(a.isRound){var g,p=F(a.roundCorners);try{for(p.s();!(g=p.n()).done;){xh(t,g.value)}}catch(y){p.e(y)}finally{p.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var v=2;v+1<n.length;v+=2)t.lineTo(n[v],n[v+1])}t=o,l?t.stroke(i):t.stroke(),t.setLineDash&&t.setLineDash([])},yd.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]),s=[a[1]/o,-a[0]/o],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},yd.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i="haystack"===r.edgeType;i||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),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},yd.drawArrowhead=function(e,t,n,r,i,a,o){if(!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a)){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,h=t.pstyle("width").pfValue,d=t.pstyle(n+"-arrow-width"),f="match-line"===d.value?h:d.pfValue;"%"===d.units&&(f*=h);var g=t.pstyle("opacity").value;void 0===o&&(o=g);var p=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,h,l,f,r,i,a),e.globalCompositeOperation=p);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,h,l,f,r,i,a)}}},yd.drawArrowShape=function(e,t,n,r,i,a,o,s,l){var u,c=this,h=this.usePaths()&&"triangle-cross"!==i,d=!1,f=t,g={x:o,y:s},p=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,p),y=c.arrowShapes[i];if(h){var m=c.arrowPathCache=c.arrowPathCache||[],b=_t(i),x=m[b];null!=x?(u=t=x,d=!0):(u=t=new Path2D,m[b]=u)}d||(t.beginPath&&t.beginPath(),h?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,l,g,r),t.closePath&&t.closePath()),t=f,h&&(t.translate(o,s),t.rotate(l),t.scale(v,v)),"filled"!==n&&"both"!==n||(h?t.fill(u):t.fill()),"hollow"!==n&&"both"!==n||(t.lineWidth=a/(h?v:1),t.lineJoin="miter",h?t.stroke(u):t.stroke()),h&&(t.scale(1/v,1/v),t.rotate(-l),t.translate(-o,-s))};var bd={safeDrawImage:function(e,t,n,r,i,a,o,s,l,u){if(!(i<=0||a<=0||l<=0||u<=0))try{e.drawImage(t,n,r,i,a,o,s,l,u)}catch(c){Ft(c)}},drawInscribedImage:function(e,t,n,r,i){var a=this,o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),f=n.width(),g=n.height(),p=2*n.padding(),v=f+("inner"===c(n,"background-width-relative-to","value",r)?0:p),y=g+("inner"===c(n,"background-height-relative-to","value",r)?0:p),m=n._private.rscratch,b="node"===c(n,"background-clip","value",r),x=c(n,"background-image-opacity","value",r)*i,w=c(n,"background-image-smoothing","value",r),E=n.pstyle("corner-radius").value;"auto"!==E&&(E=n.pstyle("corner-radius").pfValue);var T=t.width||t.cachedW,_=t.height||t.cachedH;null!=T&&null!=_||(document.body.appendChild(t),T=t.cachedW=t.width||t.offsetWidth,_=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var C=T,N=_;if("auto"!==c(n,"background-width","value",r)&&(C="%"===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)&&(N="%"===c(n,"background-height","units",r)?c(n,"background-height","pfValue",r)*y:c(n,"background-height","pfValue",r)),0!==C&&0!==N){if("contain"===h)C*=A=Math.min(v/C,y/N),N*=A;else if("cover"===h){var A;C*=A=Math.max(v/C,y/N),N*=A}var M=s-v/2,D=c(n,"background-position-x","units",r),k=c(n,"background-position-x","pfValue",r);M+="%"===D?(v-C)*k:k;var I=c(n,"background-offset-x","units",r),P=c(n,"background-offset-x","pfValue",r);M+="%"===I?(v-C)*P:P;var S=l-y/2,L=c(n,"background-position-y","units",r),O=c(n,"background-position-y","pfValue",r);S+="%"===L?(y-N)*O:O;var R=c(n,"background-offset-y","units",r),B=c(n,"background-offset-y","pfValue",r);S+="%"===R?(y-N)*B:B,m.pathCache&&(M-=s,S-=l,s=0,l=0);var F=e.globalAlpha;e.globalAlpha=x;var z=a.getImgSmoothing(e),V=!1;if("no"===w&&z?(a.setImgSmoothing(e,!1),V=!0):"yes"!==w||z||(a.setImgSmoothing(e,!0),V=!0),"no-repeat"===d)b&&(e.save(),m.pathCache?e.clip(m.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.clip())),a.safeDrawImage(e,t,0,0,T,_,M,S,C,N),b&&e.restore();else{var G=e.createPattern(t,d);e.fillStyle=G,a.nodeShapes[a.getNodeShape(n)].draw(e,s,l,v,y,E,m),e.translate(M,S),e.fill(),e.translate(-M,-S)}e.globalAlpha=F,V&&a.setImgSmoothing(e,z)}}},xd={};function wd(e,t,n,r,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}xd.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(Nn(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},xd.drawElementText=function(e,t,n,r,i){var a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!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),u="glyph"===t.pstyle("text-metrics").strValue;e.textAlign=l,e.textBaseline=u?"alphabetic":"bottom"}else{var c=t.element()._private.rscratch.badLine,h=t.pstyle("label"),d=t.pstyle("source-label"),f=t.pstyle("target-label");if(c||(!h||!h.value)&&(!d||!d.value)&&(!f||!f.value))return;e.textAlign="center",e.textBaseline="bottom"}var g,p=!n;n&&(g=n,e.translate(-g.x1,-g.y1)),null==i?(o.drawText(e,t,null,p,a),t.isEdge()&&(o.drawText(e,t,"source",p,a),o.drawText(e,t,"target",p,a))):o.drawText(e,t,i,p,a),n&&e.translate(g.x1,g.y1)},xd.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},xd.setupTextStyle=function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=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+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},xd.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=Ht(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},xd.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Ht(a,"labelX",n),c=Ht(a,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var d,f=n?n+"-":"",g=Ht(a,"labelWidth",n),p=Ht(a,"labelHeight",n),v=Ht(a,"labelActualDescent",n),y=t.pstyle(f+"text-margin-x").pfValue,m=t.pstyle(f+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;b&&(x="center",w="center"),u+=y,c+=m,0!==(d=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(d),u=0,c=0);var E=sl(x),T=ll(w);switch(T){case"top":break;case"center":c+=p/2;break;case"bottom":c+=p}var _=t.pstyle("text-background-opacity").value,C=t.pstyle("text-border-opacity").value,N=t.pstyle("text-border-width").pfValue,A=t.pstyle("text-background-padding").pfValue,M=t.pstyle("text-background-shape").strValue,D="round-rectangle"===M||"roundrectangle"===M,k="circle"===M;if(_>0||N>0&&C>0){var I=e.fillStyle,P=e.strokeStyle,S=e.lineWidth,L=t.pstyle("text-background-color").value,O=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value,B=_>0,F=N>0&&C>0,z=u-A;switch(E){case"left":z-=g;break;case"center":z-=g/2}var V=c-p-A,G=g+2*A,Y=p+2*A;if(B&&(e.fillStyle="rgba(".concat(L[0],",").concat(L[1],",").concat(L[2],",").concat(_*o,")")),F&&(e.strokeStyle="rgba(".concat(O[0],",").concat(O[1],",").concat(O[2],",").concat(C*o,")"),e.lineWidth=N,e.setLineDash))switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=N/4,e.setLineDash([]);break;default:e.setLineDash([])}if(D?(e.beginPath(),wd(e,z,V,G,Y,2)):k?(e.beginPath(),function(e,t,n,r,i){var a=Math.min(r,i)/2,o=t+r/2,s=n+i/2;e.beginPath(),e.arc(o,s,a,0,2*Math.PI),e.closePath()}(e,z,V,G,Y)):(e.beginPath(),e.rect(z,V,G,Y)),B&&e.fill(),F&&e.stroke(),F&&"double"===R){var X=N/2;e.beginPath(),D?wd(e,z+X,V+X,G-2*X,Y-2*X,2):e.rect(z+X,V+X,G-2*X,Y-2*X),e.stroke()}e.fillStyle=I,e.strokeStyle=P,e.lineWidth=S,e.setLineDash&&e.setLineDash([])}var U=2*t.pstyle("text-outline-width").pfValue;if(U>0&&(e.lineWidth=U),c-=v,"wrap"===t.pstyle("text-wrap").value){var j=Ht(a,"labelWrapCachedLines",n),H=Ht(a,"labelLineHeight",n),W=g/2,q=this.getLabelJustification(t);switch("auto"===q||("left"===E?"left"===q?u+=-g:"center"===q&&(u+=-W):"center"===E?"left"===q?u+=-W:"right"===q&&(u+=W):"right"===E&&("center"===q?u+=W:"right"===q&&(u+=g))),T){case"top":case"center":case"bottom":c-=(j.length-1)*H}for(var K=0;K<j.length;K++)U>0&&e.strokeText(j[K],u,c),e.fillText(j[K],u,c),c+=H}else U>0&&e.strokeText(h,u,c),e.fillText(h,u,c);0!==d&&(e.rotate(-d),e.translate(-s,-l))}}};var Ed={drawNode:function(e,t,n){var r,i,a=!(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,h=t.position();if(ke(h.x)&&ke(h.y)&&(!s||t.visible())){var d,f,g=s?t.effectiveOpacity():1,p=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(f=n,e.translate(-f.x1,-f.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 T=m[E];if(b[E]=null!=T&&"none"!==T){var _=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",E);w++,x[E]=l.getCachedImage(T,_,function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var C=t.pstyle("background-blacken").value,N=t.pstyle("border-width").pfValue,A=t.pstyle("background-opacity").value*g,M=t.pstyle("border-color").value,D=t.pstyle("border-style").value,k=t.pstyle("border-join").value,I=t.pstyle("border-cap").value,P=t.pstyle("border-position").value,S=t.pstyle("border-dash-pattern").pfValue,L=t.pstyle("border-dash-offset").pfValue,O=t.pstyle("border-opacity").value*g,R=t.pstyle("outline-width").pfValue,B=t.pstyle("outline-color").value,F=t.pstyle("outline-style").value,z=t.pstyle("outline-opacity").value*g,V=t.pstyle("outline-offset").value,G=t.pstyle("corner-radius").value;"auto"!==G&&(G=t.pstyle("corner-radius").pfValue);var Y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;l.eleFillStyle(e,t,n)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:O;l.colorStrokeStyle(e,M[0],M[1],M[2],t)},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},j=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=Ct("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+G),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},H=t.pstyle("shape").strValue,W=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(h.x,h.y);var q=j(r,i,H,W);d=q.path,v=q.cacheHit}var K=function(){if(!v){var n=h;p&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i,G,c)}p?e.fill(d):e.fill()},Z=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=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?a++:b[o]&&x[o].complete&&!x[o].error&&(a++,l.drawInscribedImage(e,x[o],t,o,n))}u.backgrounding=!(a===w),i!==u.backgrounding&&t.updateStyle(!1)},$=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(p||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,G,c)))},Q=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasStripe(t)&&(e.save(),p?e.clip(c.pathCache):(l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,G,c),e.clip()),l.drawStripe(e,t,a),e.restore(),n&&(p||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,G,c)))},J=function(){var t=(C>0?C:-C)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:g),n=C>0?0:255;0!==C&&(l.colorFillStyle(e,n,n,n,t),p?e.fill(d):e.fill())},ee=function(){if(N>0){if(e.lineWidth=N,e.lineCap=I,e.lineJoin=k,e.setLineDash)switch(D){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(S),e.lineDashOffset=L;break;case"solid":case"double":e.setLineDash([])}if("center"!==P){if(e.save(),e.lineWidth*=2,"inside"===P)p?e.clip(d):e.clip();else{var t=new Path2D;t.rect(-r/2-N,-i/2-N,r+2*N,i+2*N),t.addPath(d),e.clip(t,"evenodd")}p?e.stroke(d):e.stroke(),e.restore()}else p?e.stroke(d):e.stroke();if("double"===D){e.lineWidth=N/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(d):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},te=function(){if(R>0){if(e.lineWidth=R,e.lineCap="butt",e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=h;p&&(n={x:0,y:0});var a=l.getNodeShape(t),o=N;"inside"===P&&(o=0),"outside"===P&&(o*=2);var s,u=(r+o+(R+V))/r,c=(i+o+(R+V))/i,d=r*u,f=i*c,g=l.nodeShapes[a].points;if(p)s=j(d,f,a,g).path;if("ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,d,f);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+V+R):"round-heptagon"===a?(v=1.075*(o+V+R),m=-(o/2+V+R)/35):"round-hexagon"===a?v=1.12*(o+V+R):"round-pentagon"===a?(v=1.13*(o+V+R),m=-(o/2+V+R)/15):"round-tag"===a?(v=1.12*(o+V+R),y=.07*(o/2+R+V)):"round-triangle"===a&&(v=(o+V+R)*(Math.PI/2),m=-(o+V/2+R)/Math.PI),0!==v&&(d=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(f=i*(c=(i+v)/i)));for(var b=d/2,x=f/2,w=(G="auto"===G?dr(d,f):G)+(o+R+V)/2,E=new Array(g.length/2),T=new Array(g.length/2),_=0;_<g.length/2;_++)E[_]={x:n.x+y+b*g[2*_],y:n.y+m+x*g[2*_+1]};var C,A,M,D,k=E.length;for(A=E[k-1],C=0;C<k;C++)M=E[C%k],D=E[(C+1)%k],T[C]=wh(A,M,D,w),A=M,M=D;l.drawRoundPolygonPath(s||e,n.x+y,n.y+m,r*u,i*c,g,T)}else if(["roundrectangle","round-rectangle"].includes(a))G="auto"===G?hr(d,f):G,l.drawRoundRectanglePath(s||e,n.x,n.y,d,f,G+(o+R+V)/2);else if(["cutrectangle","cut-rectangle"].includes(a))G="auto"===G?8:G,l.drawCutRectanglePath(s||e,n.x,n.y,d,f,null,G+(o+R+V)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(a))G="auto"===G?hr(d,f):G,l.drawBottomRoundRectanglePath(s||e,n.x,n.y,d,f,G+(o+R+V)/2);else if("barrel"===a)l.drawBarrelPath(s||e,n.x,n.y,d,f);else if(a.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(a)){g=Jn(er(g,(o+R+V)/r)),l.drawPolygonPath(s||e,n.x,n.y,r,i,g)}else{g=Jn(er(g,-((o+R+V)/r))),l.drawPolygonPath(s||e,n.x,n.y,r,i,g)}if(p?e.stroke(s):e.stroke(),"double"===F){e.lineWidth=o/3;var I=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(s):e.stroke(),e.globalCompositeOperation=I}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,ie=t.pstyle("ghost-opacity").value,ae=ie*g;e.translate(ne,re),U(),te(),Y(ie*A),K(),Z(ae,!0),X(ie*O),ee(),$(0!==C||0!==N),Q(0!==C||0!==N),Z(ae,!1),J(ae),e.translate(-ne,-re)}p&&e.translate(-h.x,-h.y),o&&l.drawNodeUnderlay(e,t,h,r,i),p&&e.translate(h.x,h.y),U(),te(),Y(),K(),Z(g,!0),X(),ee(),$(0!==C||0!==N),Q(0!==C||0!==N),Z(g,!1),J(),p&&e.translate(-h.x,-h.y),l.drawElementText(e,t,null,a),o&&l.drawNodeOverlay(e,t,h,r,i),n&&e.translate(f.x1,f.y1)}}},Td=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,a){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==i||null==a){var h=n.padding();i=n.width()+2*h,a=n.height()+2*h}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};Ed.drawNodeOverlay=Td("overlay"),Ed.drawNodeUnderlay=Td("underlay"),Ed.hasPie=function(e){return(e=e[0])._private.hasPie},Ed.hasStripe=function(e){return(e=e[0])._private.hasStripe},Ed.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i,a=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=r.x,c=r.y,h=t.width(),d=t.height(),f=Math.min(h,d)/2,g=0;if(this.usePaths()&&(u=0,c=0),"%"===o.units?f*=o.pfValue:void 0!==o.pfValue&&(f=o.pfValue/2),"%"===s.units?i=f*s.pfValue:void 0!==s.pfValue&&(i=s.pfValue/2),!(i>=f))for(var p=1;p<=a.pieBackgroundN;p++){var v=t.pstyle("pie-"+p+"-background-size").value,y=t.pstyle("pie-"+p+"-background-color").value,m=t.pstyle("pie-"+p+"-background-opacity").value*n,b=v/100;b+g>1&&(b=1-g);var x=1.5*Math.PI+2*Math.PI*g,w=(x+=l)+2*Math.PI*b;0===v||g>=1||g+b>1||(0===i?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,f,x,w),e.closePath()):(e.beginPath(),e.arc(u,c,f,x,w),e.arc(u,c,i,w,x,!0),e.closePath()),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),g+=b)}},Ed.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),l=t.height(),u=0,c=this.usePaths();e.save();var h=t.pstyle("stripe-direction").value,d=t.pstyle("stripe-size");switch(h){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,g=l;"%"===d.units?(f*=d.pfValue,g*=d.pfValue):void 0!==d.pfValue&&(f=d.pfValue,g=d.pfValue),c&&(a=0,o=0),o-=f/2,a-=g/2;for(var p=1;p<=i.stripeBackgroundN;p++){var v=t.pstyle("stripe-"+p+"-background-size").value,y=t.pstyle("stripe-"+p+"-background-color").value,m=t.pstyle("stripe-"+p+"-background-opacity").value*n,b=v/100;b+u>1&&(b=1-u),0===v||u>=1||u+b>1||(e.beginPath(),e.rect(a,o+g*u,f,g*b),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],m),e.fill(),u+=b)}e.restore()};var _d,Cd={};function Nd(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function Ad(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Md(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function Dd(e,t){return!!t.picking||"solid"===e.pstyle("background-fill").value&&("none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||(0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)))}function kd(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Id(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||new Array(4);return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Pd(e,t){var n=t||new Array(4);return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function Sd(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function Ld(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function Od(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function Rd(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function Bd(e,t,n,r){var i=V(Ld(e,n),3),a=i[0],o=i[1],s=i[2],l=Od(e,o,t*a),u=a*s,c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,t*u,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,u,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,u,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),d=0;d<t;d++)h[d]=Rd(e,o,l,u,a,d);return c.dataArray=l,c.stride=u,c.size=a,c.getView=function(e){return h[e]},c.setPoint=function(e,t,n){var r=h[e];r[0]=t,r[1]=n},c.bufferSubData=function(t){e.bindBuffer(e.ARRAY_BUFFER,c),t?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,t*a):e.bufferSubData(e.ARRAY_BUFFER,0,l)},c}Cd.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},Cd.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;i<n.length;i++)if((t=n[i]).context===e){r=!1;break}return r&&(t={context:e},n.push(t)),t},Cd.createGradientStyleFor=function(e,t,n,r,i){var a,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(),h=n.midpoint(),d=Mn(u,h),f=Mn(c,h);a=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(d,f))}else{var g=o?{x:0,y:0}:n.position(),p=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(p,v))}else if(n.isEdge()){var y=n.sourceEndpoint(),m=n.targetEndpoint();a=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":a=e.createLinearGradient(b.x,b.y-w,b.x,b.y+w);break;case"to-top":a=e.createLinearGradient(b.x,b.y+w,b.x,b.y-w);break;case"to-left":a=e.createLinearGradient(b.x+x,b.y,b.x-x,b.y);break;case"to-right":a=e.createLinearGradient(b.x-x,b.y,b.x+x,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-x,b.y-w,b.x+x,b.y+w);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-x,b.y+w,b.x+x,b.y-w);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+x,b.y-w,b.x-x,b.y+w);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+x,b.y+w,b.x-x,b.y-w)}}if(!a)return null;for(var E=l.length===s.length,T=s.length,_=0;_<T;_++)a.addColorStop(E?l[_]:_/(T-1),"rgba("+s[_][0]+","+s[_][1]+","+s[_][2]+","+i+")");return a},Cd.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},Cd.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},Cd.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 i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},Cd.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},Cd.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},Cd.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 i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},Cd.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=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=i*o,c=a*o;if(u!==t.canvasWidth||c!==t.canvasHeight){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)(l=n.canvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"px";for(d=0;d<t.BUFFER_COUNT;d++)(l=n.bufferCanvases[d]).width=u,l.height=c,l.style.width=i+"px",l.style.height=a+"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,t.pixelRatio=o}},Cd.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},Cd.clearCanvas=function(){var e=this,t=e.data;function n(t){t.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},Cd.render=function(e){var t=this;e=e||Yt();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,o=e.forcedZoom,s=e.forcedPan,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=t.data,c=u.canvasNeedsRedraw,h=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),d=void 0!==e.motionBlur?e.motionBlur:t.motionBlur,f=t.motionBlurPxRatio,g=n.hasCompoundNodes(),p=t.hoverData.draggingEles,v=!(!t.hoverData.selecting&&!t.touchData.selecting),y=d=d&&!r&&t.motionBlurEnabled&&!v;r||(t.prevPxRatio!==l&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=l),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),d&&(null==t.mbFrames&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(y=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},T={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport;void 0===_||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y||p&&!g||(t.motionBlurPxRatio=1),s&&(E=s),x*=l,E.x*=l,E.y*=l;var C=t.getCachedZSortedEles();function N(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function A(e,n){var a,l,c,h;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=E,l=x,c=t.canvasWidth,h=t.canvasHeight):(a={x:w.x*f,y:w.y*f},l=b*f,c=t.canvasWidth*f,h=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?N(e,0,0,c,h):r||void 0!==n&&!n||e.clearRect(0,0,c,h),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var M=t.data.bufferContexts[t.TEXTURE_BUFFER];M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:M,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult}),(T=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var D=u.contexts[t.NODE],k=t.textureCache.texture;T=t.textureCache.viewport;D.setTransform(1,0,0,1,0,0),d?N(D,0,0,T.width,T.height):D.clearRect(0,0,T.width,T.height);var I=m.core("outside-texture-bg-color").value,P=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(D,I[0],I[1],I[2],P),D.fillRect(0,0,T.width,T.height);b=n.zoom();A(D,!1),D.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),D.drawImage(k,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var S=n.extent(),L=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),O=t.hideEdgesOnViewport&&L,R=[];if(R[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,R[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),R[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,R[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||R[t.NODE]){var B=d&&!R[t.NODE]&&1!==f;A(D=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),d&&!B?"motionBlur":void 0),O?t.drawCachedNodes(D,C.nondrag,l,S):t.drawLayeredElements(D,C.nondrag,l,S),t.debug&&t.drawDebugPoints(D,C.nondrag),i||d||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||R[t.DRAG])){B=d&&!R[t.DRAG]&&1!==f;A(D=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]),d&&!B?"motionBlur":void 0),O?t.drawCachedNodes(D,C.drag,l,S):t.drawCachedElements(D,C.drag,l,S),t.debug&&t.drawDebugPoints(D,C.drag),i||d||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,A),d&&1!==f){var F=u.contexts[t.NODE],z=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],V=u.contexts[t.DRAG],G=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):N(e,0,0,t.canvasWidth,t.canvasHeight);var i=f;e.drawImage(n,0,0,t.canvasWidth*i,t.canvasHeight*i,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||R[t.NODE])&&(Y(F,z,R[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||R[t.DRAG])&&(Y(V,G,R[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=T,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},Cd.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||i.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var h=n.cy.zoom(),d=a.core("selection-box-border-width").value/h;c.lineWidth=d,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),d>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){h=n.cy.zoom();var f=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(f.x,f.y,a.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var g=n.lastRedrawTime;if(n.showFps&&g){g=Math.round(g);var p=Math.round(1e3/g),v="1 frame = "+g+" ms = "+p+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!_d){var y=c.measureText(v);_d=y.actualBoundingBoxAscent}c.fillText(v,0,_d);c.strokeRect(0,_d+10,250,20),c.fillRect(0,_d+10,250*Math.min(p/60,1),20)}s||(l[n.SELECT_BOX]=!1)}};var Fd="undefined"!=typeof Float32Array?Float32Array:Array;function zd(){var e=new Fd(9);return Fd!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function Vd(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function Gd(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],f=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+f*o+u,e[7]=d*i+f*s+c,e[8]=d*a+f*l+h,e}function Yd(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(n),f=Math.cos(n);return e[0]=f*r+d*o,e[1]=f*i+d*s,e[2]=f*a+d*l,e[3]=f*o-d*r,e[4]=f*s-d*i,e[5]=f*l-d*a,e[6]=u,e[7]=c,e[8]=h,e}function Xd(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Ud=function(){return B(function e(t,n,r,i){R(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(o=t*(a=i/t),s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,h=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,u=a,c=o*s;i.save(),i.translate(u,c),i.scale(l,l),n(i,t),i.restore()}},d=[null,null],f=function(){h(r.freePointer,r.canvas),d[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},d[1]={x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},g=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=i)f();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===i?(g(),f()):this.enableWrapping?function(){var e=r.scratch,t=r.canvas;e.clear(),h({x:0,row:0},e);var n=i-r.freePointer.x,a=u-n,s=o,l=r.freePointer.x,f=r.freePointer.row*o,g=n;t.context.drawImage(e,0,0,g,s,l,f,g,s),d[0]={x:l,y:f,w:g,h:c};var p=n,v=(r.freePointer.row+1)*o,y=a;t&&t.context.drawImage(e,p,0,y,s,0,v,y,s),d[1]={x:0,y:v,w:y,h:c},r.freePointer.x=a,r.freePointer.row++}():(g(),f())}return this.keyToLocation.set(e,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row<n-1}},{key:"bufferIfNeeded",value:function(e){this.texture||(this.texture=function(e){var t=e.createTexture();return t.buffer=function(n){e.bindTexture(e.TEXTURE_2D,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,n),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},t.deleteTexture=function(){e.deleteTexture(t)},t}(e,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),jd=function(){return B(function e(t,n,r,i){R(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set},[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas;return new Ud(e,t,n,r)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var e=this.r,t=this.texSize,n=this.texRows,r=this.createTextureCanvas,i=Math.floor(t/n);this.scratch=r(e,t,i,"scratch")}return this.scratch}},{key:"draw",value:function(e,t,n){var r=this.styleKeyToAtlas.get(e);return r||((r=this.atlases[this.atlases.length-1])&&r.canFit(t)||(r&&r.lock(),r=this._createAtlas(),this.atlases.push(r)),r.draw(e,t,n),this.styleKeyToAtlas.set(e,r)),r}},{key:"getAtlas",value:function(e){return this.styleKeyToAtlas.get(e)}},{key:"hasAtlas",value:function(e){return this.styleKeyToAtlas.has(e)}},{key:"markKeyForGC",value:function(e){this.markedKeys.add(e)}},{key:"gc",value:function(){var e=this,t=this.markedKeys;if(0!==t.size){var n,r=[],i=new Map,a=null,o=F(this.atlases);try{var s=function(){var o,s,l=n.value,u=l.getKeys(),c=(s=u,(o=t).intersection?o.intersection(s):new Set(G(o).filter(function(e){return s.has(e)})));if(0===c.size)return r.push(l),u.forEach(function(e){return i.set(e,l)}),1;a||(a=e._createAtlas(),r.push(a));var h,d=F(u);try{for(d.s();!(h=d.n()).done;){var f=h.value;if(!c.has(f)){var g=V(l.getOffsets(f),2),p=g[0],v=g[1];a.canFit({w:p.w+v.w,h:p.h})||(a.lock(),a=e._createAtlas(),r.push(a)),l.canvas&&(e._copyTextureToNewAtlas(f,l,a),i.set(f,a))}}}catch(y){d.e(y)}finally{d.f()}l.dispose()};for(o.s();!(n=o.n()).done;)s()}catch(l){o.e(l)}finally{o.f()}this.atlases=r,this.styleKeyToAtlas=i,this.markedKeys=new Set}else console.log("nothing to garbage collect")}},{key:"_copyTextureToNewAtlas",value:function(e,t,n){var r=V(t.getOffsets(e),2),i=r[0],a=r[1];if(0===a.w)n.draw(e,i,function(e){e.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h)});else{var o=this._getScratchCanvas();o.clear(),o.context.drawImage(t.canvas,i.x,i.y,i.w,i.h,0,0,i.w,i.h),o.context.drawImage(t.canvas,a.x,a.y,a.w,a.h,i.w,0,a.w,a.h);var s=i.w+a.w,l=i.h;n.draw(e,{w:s,h:l},function(e){e.drawImage(o,0,0,s,l,0,0,s,l)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();var Hd=function(){return B(function e(t,n){R(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map},[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"addAtlasCollection",value:function(e,t){var n=this.globalOptions,r=n.webglTexSize,i=n.createTextureCanvas,a=t.texRows,o=this._cacheScratchCanvas(i),s=new jd(this.r,r,a,o);this.collections.set(e,s)}},{key:"addRenderType",value:function(e,t){var n=t.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var r=this.collections.get(n),i=$e({type:e,atlasCollection:r},t);this.renderTypes.set(e,i)}},{key:"getRenderTypeOpts",value:function(e){return this.renderTypes.get(e)}},{key:"getAtlasCollection",value:function(e){return this.collections.get(e)}},{key:"_cacheScratchCanvas",value:function(e){var t=-1,n=-1,r=null;return function(i,a,o,s){return s?(r&&a==t&&o==n||(t=a,n=o,r=e(i,a,o)),r):e(i,a,o)}}},{key:"_key",value:function(e,t){return"".concat(e,"-").concat(t)}},{key:"invalidate",value:function(e){var t,n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,a=void 0!==i&&i,o=r.filterEle,s=void 0===o?function(){return!0}:o,l=r.filterType,u=void 0===l?function(){return!0}:l,c=!1,h=!1,d=F(e);try{for(d.s();!(t=d.n()).done;){var f=t.value;if(s(f)){var g,p=F(this.renderTypes.values());try{var v=function(){var e=g.value,t=e.type;if(u(t)){var r=n.collections.get(e.collection),i=e.getKey(f),o=Array.isArray(i)?i:[i];if(a)o.forEach(function(e){return r.markKeyForGC(e)}),h=!0;else{var s=e.getID?e.getID(f):f.id(),l=n._key(t,s),d=n.typeAndIdToKey.get(l);void 0===d||kd(o,d)||(c=!0,n.typeAndIdToKey.delete(l),d.forEach(function(e){return r.markKeyForGC(e)}))}}};for(p.s();!(g=p.n()).done;)v()}catch(y){p.e(y)}finally{p.f()}}}}catch(y){d.e(y)}finally{d.f()}return h&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var e,t=F(this.collections.values());try{for(t.s();!(e=t.n()).done;){e.value.gc()}}catch(n){t.e(n)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n,r){var i=this.renderTypes.get(t),a=this.collections.get(i.collection),o=!1,s=a.draw(r,n,function(t){i.drawClipped?(t.save(),t.beginPath(),t.rect(0,0,n.w,n.h),t.clip(),i.drawElement(t,e,n,!0,!0),t.restore()):i.drawElement(t,e,n,!0,!0),o=!0});if(o){var l=i.getID?i.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.has(u)?this.typeAndIdToKey.get(u).push(r):this.typeAndIdToKey.set(u,[r])}return s}},{key:"getAtlasInfo",value:function(e,t){var n=this,r=this.renderTypes.get(t),i=r.getKey(e);return(Array.isArray(i)?i:[i]).map(function(i){var a=r.getBoundingBox(e,i),o=n.getOrCreateAtlas(e,t,a,i),s=V(o.getOffsets(i),2),l=s[0];return{atlas:o,tex:l,tex1:l,tex2:s[1],bb:a}})}},{key:"getDebugInfo",value:function(){var e,t=[],n=F(this.collections);try{for(n.s();!(e=n.n()).done;){var r=V(e.value,2),i=r[0],a=r[1].getCounts(),o=a.keyCount,s=a.atlasCount;t.push({type:i,keyCount:o,atlasCount:s})}}catch(l){n.e(l)}finally{n.f()}return t}}])}(),Wd=function(){return B(function e(t){R(this,e),this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.batchAtlases=[]},[{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(e,t){return t})}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e){return this.batchAtlases.length!==this.maxAtlasesPerBatch||this.batchAtlases.includes(e)}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)throw new Error("cannot add more atlases to batch");this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}}])}(),qd={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Kd=1,Zd=2,$d=function(){return B(function e(t,n,r){R(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=Ad,this.atlasManager=new Hd(t,r),this.batchManager=new Wd(r),this.simpleShapeOptions=new Map,this.program=this._createShaderProgram(qd.SCREEN),this.pickingProgram=this._createShaderProgram(qd.PICKING),this.vao=this._createVAO()},[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addTextureAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"addSimpleShapeRenderType",value:function(e,t){this.simpleShapeOptions.set(e,t)}},{key:"invalidate",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),i="#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n\t"),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x<q.y)? 1.570796327 : 0.0;\n for( int i=0; i<5; i++ ) {\n vec2 cs = vec2(cos(w),sin(w));\n vec2 u = ab*vec2( cs.x,cs.y);\n vec2 v = ab*vec2(-cs.y,cs.x);\n w = w + dot(p-u,v)/(dot(p-u,u)+dot(v,v));\n }\n \n // compute final point and distance\n float d = length(p-ab*vec2(cos(w),sin(w)));\n \n // return signed distance\n return (dot(p/ab,p/ab)>1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n\telse "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "),a=function(e,t,n){var r=Nd(e,e.VERTEX_SHADER,t),i=Nd(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}(t,n,i);a.aPosition=t.getAttribLocation(a,"aPosition"),a.aIndex=t.getAttribLocation(a,"aIndex"),a.aVertType=t.getAttribLocation(a,"aVertType"),a.aTransform=t.getAttribLocation(a,"aTransform"),a.aAtlasId=t.getAttribLocation(a,"aAtlasId"),a.aTex=t.getAttribLocation(a,"aTex"),a.aPointAPointB=t.getAttribLocation(a,"aPointAPointB"),a.aPointCPointD=t.getAttribLocation(a,"aPointCPointD"),a.aLineWidth=t.getAttribLocation(a,"aLineWidth"),a.aColor=t.getAttribLocation(a,"aColor"),a.aCornerRadius=t.getAttribLocation(a,"aCornerRadius"),a.aBorderColor=t.getAttribLocation(a,"aBorderColor"),a.uPanZoomMatrix=t.getUniformLocation(a,"uPanZoomMatrix"),a.uAtlasSize=t.getUniformLocation(a,"uAtlasSize"),a.uBGColor=t.getUniformLocation(a,"uBGColor"),a.uZoom=t.getUniformLocation(a,"uZoom"),a.uTextures=[];for(var o=0;o<this.batchManager.getMaxAtlasesPerBatch();o++)a.uTextures.push(t.getUniformLocation(a,"uTexture".concat(o)));return a}},{key:"_createVAO",value:function(){var e=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=e.length/2;var t=this.maxInstances,n=this.gl,r=this.program,i=n.createVertexArray();return n.bindVertexArray(i),function(e,t,n,r){var i=V(Ld(e,t),2),a=i[0],o=i[1],s=Od(e,o,r),l=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null)}(n,"vec2",r.aPosition,e),this.transformBuffer=function(e,t,n){for(var r=new Float32Array(9*t),i=new Array(t),a=0;a<t;a++){var o=9*a*4;i[a]=new Float32Array(r.buffer,o,9)}var s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,r.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var u=n+l;e.enableVertexAttribArray(u),e.vertexAttribPointer(u,3,e.FLOAT,!1,36,12*l),e.vertexAttribDivisor(u,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),s.getMatrixView=function(e){return i[e]},s.setData=function(e,t){i[t].set(e,0)},s.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferSubData(e.ARRAY_BUFFER,0,r)},s}(n,t,r.aTransform),this.indexBuffer=Bd(n,t,"vec4",r.aIndex),this.vertTypeBuffer=Bd(n,t,"int",r.aVertType),this.atlasIdBuffer=Bd(n,t,"int",r.aAtlasId),this.texBuffer=Bd(n,t,"vec4",r.aTex),this.pointAPointBBuffer=Bd(n,t,"vec4",r.aPointAPointB),this.pointCPointDBuffer=Bd(n,t,"vec4",r.aPointCPointD),this.lineWidthBuffer=Bd(n,t,"vec2",r.aLineWidth),this.colorBuffer=Bd(n,t,"vec4",r.aColor),this.cornerRadiusBuffer=Bd(n,t,"vec4",r.aCornerRadius),this.borderColorBuffer=Bd(n,t,"vec4",r.aBorderColor),n.bindVertexArray(null),i}},{key:"buffers",get:function(){var e=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(e){return Ue(e,"Buffer")}).map(function(t){return e[t]})),this._buffers}},{key:"startFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qd.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var o=a.getTexPickingMode(e);if(o===Kd)return;if(o==Zd)return void this.drawPickingRectangle(e,t,n)}var s,l=F(r.getAtlasInfo(e,n));try{for(l.s();!(s=l.n()).done;){var u=s.value,c=u.atlas,h=u.tex1,d=u.tex2;i.canAddToCurrentBatch(c)||this.endBatch();for(var f=i.getAtlasIndexForBatch(c),g=0,p=[[h,!0],[d,!1]];g<p.length;g++){var v=V(p[g],2),y=v[0],m=v[1];if(0!=y.w){var b=this.instanceCount;this.vertTypeBuffer.getView(b)[0]=0,Pd(t,this.indexBuffer.getView(b)),this.atlasIdBuffer.getView(b)[0]=f;var x=this.texBuffer.getView(b);x[0]=y.x,x[1]=y.y,x[2]=y.w,x[3]=y.h;var w=this.transformBuffer.getMatrixView(b);this.setTransformMatrix(e,w,a,u,m),this.instanceCount++,m||this.wrappedCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}catch(E){l.e(E)}finally{l.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,u=s.w/(s.w+l.w);i||(u=1-u);var c=this._getAdjustedBB(o,a,i,u);this._applyTransformMatrix(t,c,n,e)}else{var h=n.getBoundingBox(e),d=this._getAdjustedBB(h,a,!0,1);this._applyTransformMatrix(t,d,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var i,a;Vd(e);var o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);Gd(e,e,[s.x,s.y]),Yd(e,e,o);var l=n.getRotationOffset(r);i=l.x+(t.xOffset||0),a=l.y+(t.yOffset||0)}else i=t.x1,a=t.y1;Gd(e,e,[i,a]),Xd(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(i+=l=o-u,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l,yOffset:e.yOffset}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=4,Pd(t,this.indexBuffer.getView(i)),Id([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(void 0===a||r.isSimple&&!r.isSimple(e,this.renderTarget))this.drawTexture(e,t,n);else{var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,5===a||6===a){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,i.radius,s),u=this.cornerRadiusBuffer.getView(o);u[0]=l,u[1]=l,u[2]=l,u[3]=l,6===a&&(u[0]=0,u[2]=0)}Pd(t,this.indexBuffer.getView(o));var c=this.renderTarget.picking?1:"node-body"===n?e.effectiveOpacity():1,h=this.renderTarget.picking?1:e.pstyle(i.opacity).value*c;Id(e.pstyle(i.color).value,h,this.colorBuffer.getView(o));var d=this.lineWidthBuffer.getView(o);if(d[0]=0,d[1]=0,i.border){var f=e.pstyle("border-width").value;if(f>0){Id(e.pstyle("border-color").value,c*e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var g=e.pstyle("border-position").value;if("inside"===g)d[0]=0,d[1]=-f;else if("outside"===g)d[0]=f,d[1]=0;else{var p=f/2;d[0]=p,d[1]=-p}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,i=n.h;if("auto"===e.pstyle(t).value)return hr(r,i);var a=e.pstyle(t).pfValue,o=r/2,s=i/2;return Math.min(a,s,o)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a))if("none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value*e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(u,c),d=this.instanceCount,f=this.transformBuffer.getMatrixView(d);Vd(f),Gd(f,f,[r,i]),Xd(f,f,[h,h]),Yd(f,f,a),this.vertTypeBuffer.getView(d)[0]=3,Pd(t,this.indexBuffer.getView(d)),Id(s,l,this.colorBuffer.getView(d)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,Pd(t,this.indexBuffer.getView(l)),Id(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c<n.length-2;c+=2){var h=this.instanceCount;this.vertTypeBuffer.getView(h)[0]=2,Pd(t,this.indexBuffer.getView(h)),Id(o,s,this.colorBuffer.getView(h)),this.lineWidthBuffer.getView(h)[0]=a;var d=n[c-2],f=n[c-1],g=n[c],p=n[c+1],v=n[c+2],y=n[c+3],m=n[c+4],b=n[c+5];0==c&&(d=2*g-v+.001,f=2*p-y+.001),c==n.length-4&&(m=2*v-g+.001,b=2*y-p+.001);var x=this.pointAPointBBuffer.getView(h);x[0]=d,x[1]=f,x[2]=g,x[3]=p;var w=this.pointCPointDBuffer.getView(h);w[0]=v,w[1]=y,w[2]=m,w[3]=b,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!t.badLine&&null!=t.allpts&&!isNaN(t.allpts[0])}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(Math.max(15,5),this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var i=Array(e.length-2),a=0;a<i.length;a+=2){var o=(1-t)*e[a]+t*e[a+2],s=(1-t)*e[a+1]+t*e[a+3];i[a]=o,i[a+1]=s}return this._setCurvePoint(i,t,n,r)}n[r]=e[0],n[r+1]=e[1]}},{key:"endBatch",value:function(){var e=this.gl,t=this.vao,n=this.vertexCount,r=this.instanceCount;if(0!==r){var i=this.renderTarget.picking?this.pickingProgram:this.program;e.useProgram(i),e.bindVertexArray(t);var a,o=F(this.buffers);try{for(o.s();!(a=o.n()).done;){a.value.bufferSubData(r)}}catch(f){o.e(f)}finally{o.f()}for(var s,l,u=this.batchManager.getAtlases(),c=0;c<u.length;c++)u[c].bufferIfNeeded(e);for(var h=0;h<u.length;h++)e.activeTexture(e.TEXTURE0+h),e.bindTexture(e.TEXTURE_2D,u[h].texture),e.uniform1i(i.uTextures[h],h);e.uniform1f(i.uZoom,(s=this.r,l=s.pixelRatio,s.cy.zoom()*l)),e.uniformMatrix3fv(i.uPanZoomMatrix,!1,this.panZoomMatrix),e.uniform1i(i.uAtlasSize,this.batchManager.getAtlasSize());var d=Id(this.bgColor,1);e.uniform4fv(i.uBGColor,d),e.drawArraysInstanced(e.TRIANGLES,0,n,r),e.bindVertexArray(null),e.bindTexture(e.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:r,atlasCount:u.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var e=this.atlasManager.getDebugInfo(),t=e.reduce(function(e,t){return e+t.atlasCount},0),n=this.batchDebugInfo,r=n.reduce(function(e,t){return e+t.count},0);return{atlasInfo:e,totalAtlases:t,wrappedCount:this.wrappedCount,simpleCount:this.simpleCount,batchCount:n.length,batchInfo:n,totalInstances:r}}}])}(),Qd={};function Jd(e,t){var n=e._private.rscratch;return Ht(n,"labelWrapCachedLines",t)||[]}Qd.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=function(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return Qe(n)}(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=function(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(t,r){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,r,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}(r),n.pickingFrameBuffer.needsDraw=!0,n.drawing=new $d(n,r,e);var i=function(e){return function(t){return n.getTextAngle(t,e)}},a=function(e){return function(t){var n=t.pstyle(e);return n&&n.value}},o=function(e){return function(t){return t.pstyle("".concat(e,"-opacity")).value>0}},s=function(e){return"yes"===e.pstyle("text-events").strValue?Zd:Kd},l=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};n.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),n.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),n.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),n.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:l,isSimple:Dd,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),n.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:l,isVisible:o("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),n.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:l,isVisible:o("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),n.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:s,getKey:ef(t.getLabelKey,null),getBoundingBox:tf(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")}),n.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:s,getKey:ef(t.getSourceLabelKey,"source"),getBoundingBox:tf(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")}),n.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:s,getKey:ef(t.getTargetLabelKey,"target"),getBoundingBox:tf(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")});var u=ct(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(e,t){var r=!1;t&&t.length>0&&(r|=n.drawing.invalidate(t)),r&&u()}),function(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>qh?(!function(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}(e),t.call(e,n)):(!function(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}(e),af(e,n,qd.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return function(e,t,n){var r,i,a,o=function(e,t,n){var r,i,a,o,s=Md(e),l=s.pan,u=s.zoom,c=function(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return[a,o=Math.round(e.canvasHeight-o)]}(e,l,u,t,n),h=V(c,2),d=h[0],f=h[1],g=6;if(r=d-g/2,i=f-g/2,a=g,o=g,0===a||0===o)return[];var p=e.data.contexts[e.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),af(e,null,qd.PICKING),e.pickingFrameBuffer.needsDraw=!1);var v=a*o,y=new Uint8Array(4*v);p.readPixels(r,i,a,o,p.RGBA,p.UNSIGNED_BYTE,y),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var m=new Set,b=0;b<v;b++){var x=Sd(y.slice(4*b,4*b+4))-1;x>=0&&m.add(x)}return m}(e,t,n),s=e.getCachedZSortedEles(),l=F(o);try{for(l.s();!(a=l.n()).done;){var u=s[a.value];if(!r&&u.isNode()&&(r=u),!i&&u.isEdge()&&(i=u),r&&i)break}}catch(c){l.e(c)}finally{l.f()}return[r,i].filter(Boolean)}(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}(n)};var ef=function(e,t){return function(n){var r=e(n),i=Jd(n,t);return i.length>1?i.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},tf=function(e,t){return function(n,r){var i=e(n);if("string"==typeof r){var a=r.indexOf("_");if(a>0){var o=Number(r.substring(a+1)),s=Jd(n,t),l=i.h/s.length,u=l*o,c=i.y1+u;return{x1:i.x1,w:i.w,y1:c,h:l,yOffset:u}}}return i}};function nf(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Md(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function rf(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function af(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&function(e,t){e.drawSelectionRectangle(t,function(t){return nf(e,t)})}(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var o=e.data.contexts[e.WEBGL];n.screen?(o.clearColor(0,0,0,0),o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA)):o.disable(o.BLEND),o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT),o.viewport(0,0,o.canvas.width,o.canvas.height);var s=function(e){var t=e.canvasWidth,n=e.canvasHeight,r=Md(e),i=r.pan,a=r.zoom,o=zd();Gd(o,o,[i.x,i.y]),Xd(o,o,[a,a]);var s=zd();!function(e,t,n){e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1}(s,t,n);var l,u,c,h,d,f,g,p,v,y,m,b,x,w,E,T,_,C,N,A,M,D=zd();return l=D,c=o,h=(u=s)[0],d=u[1],f=u[2],g=u[3],p=u[4],v=u[5],y=u[6],m=u[7],b=u[8],x=c[0],w=c[1],E=c[2],T=c[3],_=c[4],C=c[5],N=c[6],A=c[7],M=c[8],l[0]=x*h+w*g+E*y,l[1]=x*d+w*p+E*m,l[2]=x*f+w*v+E*b,l[3]=T*h+_*g+C*y,l[4]=T*d+_*p+C*m,l[5]=T*f+_*v+C*b,l[6]=N*h+A*g+M*y,l[7]=N*d+A*p+M*m,l[8]=N*f+A*v+M*b,D}(e),l=e.getCachedZSortedEles();if(a=l.length,i.startFrame(s,n),n.screen){for(var u=0;u<l.nondrag.length;u++)rf(e,u,l.nondrag[u]);for(var c=0;c<l.drag.length;c++)rf(e,c,l.drag[c])}else if(n.picking)for(var h=0;h<l.length;h++)rf(e,h,l[h]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(function(e){var t=e.data.contexts[e.NODE];t.save(),nf(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}(e),function(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=i.atlases,s=0;s<o.length;s++){var l=o[s].canvas;if(l){var u=l.width,c=l.height,h=u*s,d=l.height*r;a.save(),a.scale(.4,.4),a.drawImage(l,h,d),a.strokeStyle="black",a.rect(h,d,u,c),a.stroke(),a.restore()}}},n=0;t(e.drawing,"node",n++),t(e.drawing,"label",n++)}(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var d=performance.now(),f=Math.ceil(d-r),g=i.getDebugInfo(),p=["".concat(a," elements"),"".concat(g.totalInstances," instances"),"".concat(g.batchCount," batches"),"".concat(g.totalAtlases," atlases"),"".concat(g.wrappedCount," wrapped textures"),"".concat(g.simpleCount," simple shapes")].join(", ");console.log("WebGL (".concat(n.name,") - frame time ").concat(f,"ms")),console.log("Totals:"),console.log(" ".concat(p)),console.log("Texture Atlases Used:");var v,y=F(g.atlasInfo);try{for(y.s();!(v=y.n()).done;){var m=v.value;console.log(" ".concat(m.type,": ").concat(m.keyCount," keys, ").concat(m.atlasCount," atlases"))}}catch(b){y.e(b)}finally{y.f()}console.log("")}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,i.gc())}for(var of={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l<a.length/2;l++)e.lineTo(t+o*a[2*l],n+s*a[2*l+1]);e.closePath()},drawRoundPolygonPath:function(e,t,n,r,i,a,o){o.forEach(function(t){return xh(e,t)}),e.closePath()},drawRoundRectanglePath:function(e,t,n,r,i,a){var o=r/2,s=i/2,l="auto"===a?hr(r,i):Math.min(a,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,i,a){var o=r/2,s=i/2,l="auto"===a?hr(r,i):a;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,i,a,o){var s=r/2,l=i/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,i){var a=r/2,o=i/2,s=t-a,l=t+a,u=n-o,c=n+o,h=fr(r,i),d=h.widthOffset,f=h.heightOffset,g=h.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(s,u+f),e.lineTo(s,c-f),e.quadraticCurveTo(s+g,c,s+d,c),e.lineTo(l-d,c),e.quadraticCurveTo(l-g,c,l,c-f),e.lineTo(l,u+f),e.quadraticCurveTo(l-g,u,l-d,u),e.lineTo(s+d,u),e.quadraticCurveTo(s+g,u,s,u+f),e.closePath()}},sf=Math.sin(0),lf=Math.cos(0),uf={},cf={},hf=Math.PI/40,df=0*Math.PI;df<2*Math.PI;df+=hf)uf[df]=Math.sin(df),cf[df]=Math.cos(df);of.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,o,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=hf)a=t-s*uf[u]*sf+s*cf[u]*lf,o=n+l*cf[u]*sf+l*uf[u]*lf,0===u?e.moveTo(a,o):e.lineTo(a,o);e.closePath()};var ff={};function gf(e){var t=e.indexOf(",");return e.substr(t+1)}function pf(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Mi(function(r,i){try{t.toBlob(function(e){null!=e?r(e):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(a){i(a)}});case"blob":return function(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}(gf(r()),n);case"base64":return gf(r());default:return r()}}ff.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},ff.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),r=this.findContainerClientCoords(),i=e.full?Math.ceil(n.w):r[2],a=e.full?Math.ceil(n.h):r[3],o=ke(e.maxWidth)||ke(e.maxHeight),s=this.getPixelRatio(),l=1;if(void 0!==e.scale)i*=e.scale,a*=e.scale,l=e.scale;else if(o){var u=1/0,c=1/0;ke(e.maxWidth)&&(u=l*e.maxWidth/i),ke(e.maxHeight)&&(c=l*e.maxHeight/a),i*=l=Math.min(u,c),a*=l}o||(i*=s,a*=s,l*=s);var h=document.createElement("canvas");h.width=i,h.height=a,h.style.width=i+"px",h.style.height=a+"px";var d=h.getContext("2d");if(i>0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var g=t.pan(),p={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(p.x,p.y),d.scale(l,l),this.drawElements(d,f),d.scale(1/l,1/l),d.translate(-p.x,-p.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},ff.png=function(e){return pf(e,this.bufferCanvasImage(e),"image/png")},ff.jpg=function(e){return pf(e,this.bufferCanvasImage(e),"image/jpeg")};var vf={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},yf=bf,mf=bf.prototype;function bf(e){var t=this,n=t.cy.window().document;e.webgl&&(mf.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(mf.CANVAS_LAYERS),contexts:new Array(mf.CANVAS_LAYERS),canvasNeedsRedraw:new Array(mf.CANVAS_LAYERS),bufferCanvases:new Array(mf.BUFFER_COUNT),bufferContexts:new Array(mf.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;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"};H&&H.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<mf.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=n.createElement("canvas"),c=mf.CANVAS_TYPES[l];t.data.contexts[l]=u.getContext(c),t.data.contexts[l]||Rt("Could not create canvas of type "+c),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(mf.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[mf.NODE].setAttribute("data-id","layer"+mf.NODE+"-node"),t.data.canvases[mf.SELECT_BOX].setAttribute("data-id","layer"+mf.SELECT_BOX+"-selectbox"),t.data.canvases[mf.DRAG].setAttribute("data-id","layer"+mf.DRAG+"-drag"),t.data.canvases[mf.WEBGL]&&t.data.canvases[mf.WEBGL].setAttribute("data-id","layer"+mf.WEBGL+"-webgl");for(l=0;l<mf.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 h=Ln(),d=function(e){return{x:-e.w/2,y:-e.h/2}},f=function(e){return e[0]._private.nodeKey},g=function(e){return e[0]._private.labelStyleKey},p=function(e){return e[0]._private.sourceLabelStyleKey},v=function(e){return e[0]._private.targetLabelStyleKey},y=function(e,n,r,i,a){return t.drawElement(e,n,r,!1,!1,a)},m=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"main",a)},b=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"source",a)},x=function(e,n,r,i,a){return t.drawElementText(e,n,r,i,"target",a)},w=function(e){return e.boundingBox(),e[0]._private.bodyBounds},E=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||h},T=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||h},_=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||h},C=function(e,t){return t},N=function(e){return{x:((t=w(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2};var t},A=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}},M=function(e,t,n){var r=e[0]._private.rscratch;return{x:r[t],y:r[n]}},D=function(e){return A("",M(e,"labelX","labelY"),e)},k=function(e){return A("source",M(e,"sourceLabelX","sourceLabelY"),e)},I=function(e){return A("target",M(e,"targetLabelX","targetLabelY"),e)},P=function(e){return d(w(e))},S=function(e){return d(T(e))},L=function(e){return d(_(e))},O=function(e){var t=E(e),n=d(E(e));if(e.isNode()){switch(sl(e.pstyle("text-halign").value)){case"left":n.x=-t.w-(t.leftPad||0);break;case"right":n.x=-(t.rightPad||0)}switch(ll(e.pstyle("text-valign").value)){case"top":n.y=-t.h-(t.topPad||0);break;case"bottom":n.y=-(t.botPad||0)}}return n},R=t.data.eleTxrCache=new $h(t,{getKey:f,doesEleInvalidateKey:function(e){var t=e[0]._private;return!(t.oldBackgroundTimestamp===t.backgroundTimestamp)},drawElement:y,getBoundingBox:w,getRotationPoint:N,getRotationOffset:P,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),B=t.data.lblTxrCache=new $h(t,{getKey:g,drawElement:m,getBoundingBox:E,getRotationPoint:D,getRotationOffset:O,isVisible:C}),F=t.data.slbTxrCache=new $h(t,{getKey:p,drawElement:b,getBoundingBox:T,getRotationPoint:k,getRotationOffset:S,isVisible:C}),z=t.data.tlbTxrCache=new $h(t,{getKey:v,drawElement:x,getBoundingBox:_,getRotationPoint:I,getRotationOffset:L,isVisible:C}),V=t.data.lyrTxrCache=new Jh(t);t.onUpdateEleCalcs(function(e,t){R.invalidateElements(t),B.invalidateElements(t),F.invalidateElements(t),z.invalidateElements(t),V.invalidateElements(t);for(var n=0;n<t.length;n++){var r=t[n]._private;r.oldBackgroundTimestamp=r.backgroundTimestamp}});var G=function(e){for(var t=0;t<e.length;t++)V.enqueueElementRefinement(e[t].ele)};R.onDequeue(G),B.onDequeue(G),F.onDequeue(G),z.onDequeue(G),e.webgl&&t.initWebgl(e,{getStyleKey:f,getLabelKey:g,getSourceLabelKey:p,getTargetLabelKey:v,drawElement:y,drawLabel:m,drawSourceLabel:b,drawTargetLabel:x,getElementBox:w,getLabelBox:E,getSourceLabelBox:T,getTargetLabelBox:_,getElementRotationPoint:N,getElementRotationOffset:P,getLabelRotationPoint:D,getSourceLabelRotationPoint:k,getTargetLabelRotationPoint:I,getLabelRotationOffset:O,getSourceLabelRotationOffset:S,getTargetLabelRotationOffset:L})}mf.CANVAS_LAYERS=3,mf.SELECT_BOX=0,mf.DRAG=1,mf.NODE=2,mf.WEBGL=3,mf.CANVAS_TYPES=["2d","2d","2d","webgl2"],mf.BUFFER_COUNT=3,mf.TEXTURE_BUFFER=0,mf.MOTIONBLUR_BUFFER_NODE=1,mf.MOTIONBLUR_BUFFER_DRAG=2,mf.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[mf.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[mf.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[mf.SELECT_BOX]=t;break;case"gc":n.data.gc=!0}};var xf="undefined"!=typeof Path2D;mf.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},mf.usePaths=function(){return xf&&this.pathsEnabled},mf.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},mf.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},mf.makeOffscreenCanvas=function(e,t){var n;"undefined"!==("undefined"==typeof OffscreenCanvas?"undefined":X(OffscreenCanvas))?n=new OffscreenCanvas(e,t):((n=this.cy.window().document.createElement("canvas")).width=e,n.height=t);return n},[id,cd,yd,bd,xd,Ed,Cd,Qd,of,ff,vf].forEach(function(e){$e(mf,e)});var wf=[{type:"layout",extensions:Hc},{type:"renderer",extensions:[{name:"null",impl:Wc},{name:"base",impl:Xh},{name:"canvas",impl:yf}]}],Ef={},Tf={};function _f(e,t,n){var r=n,i=function(n){Ft("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(ac.prototype[t])return i(t);ac.prototype[t]=n}else if("collection"===e){if(wu.prototype[t])return i(t);wu.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),De(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.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 h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};$e(o,{createEmitter:function(){return this._private.emitter=new zl(d,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}}),ts.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var f=Cf("renderer","base"),g=f.prototype,p=n,v=n.prototype,y=function(){f.apply(this,arguments),p.apply(this,arguments)},m=y.prototype;for(var b in g){var x=g[b];if(null!=v[b])return i(b);m[b]=x}for(var w in v)m[w]=v[w];g.clientFunctions.forEach(function(e){m[e]=m[e]||function(){Rt("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=y}else if("__proto__"===e||"constructor"===e||"prototype"===e)return Rt(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return et({map:Ef,keys:[e,t],value:r})}function Cf(e,t){return tt({map:Ef,keys:[e,t]})}function Nf(e,t,n,r,i){return et({map:Tf,keys:[e,t,n,r],value:i})}function Af(e,t,n,r){return tt({map:Tf,keys:[e,t,n,r]})}var Mf=function(){return 2===arguments.length?Cf.apply(null,arguments):3===arguments.length?_f.apply(null,arguments):4===arguments.length?Af.apply(null,arguments):5===arguments.length?Nf.apply(null,arguments):void Rt("Invalid extension access syntax")};ac.prototype.extension=Mf,wf.forEach(function(e){e.extensions.forEach(function(t){_f(e.type,t.name,t.impl)})});var Df=function(){if(!(this instanceof Df))return new Df;this.length=0},kf=Df.prototype;kf.instanceString=function(){return"stylesheet"},kf.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},kf.css=function(e,t){var n=this.length-1;if(Ne(e))this[n].properties.push({name:e,value:t});else if(De(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=ec.properties[o]||ec.properties[Ge(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},kf.style=kf.css,kf.generateStyle=function(e){var t=new ec(e);return this.appendToStyle(t)},kf.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var If=function(e){return void 0===e&&(e={}),De(e)?new ac(e):Ne(e)?Mf.apply(Mf,arguments):void 0};
|
|
10
|
+
/*!
|
|
11
|
+
* cytoscape-dagre 3.0.0
|
|
12
|
+
* https://github.com/cytoscape/cytoscape.js-dagre
|
|
13
|
+
* License: MIT
|
|
14
|
+
*/
|
|
15
|
+
function Pf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Sf(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Pf(e,t);var n={}.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)?Pf(e,t):void 0}}(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}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 a,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,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Lf(e){return Lf="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},Lf(e)}If.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(If),e.apply(null,t),this},If.warnings=function(e){return Bt(e)},If.version="3.34.0",If.stylesheet=If.Stylesheet=Df;var Of={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(e){return 1},edgeWeight:function(e){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,useDagreEdgeControlPoints:!1,automaticDagreEdgeStyle:!1,dagreEdgeStyle:{"curve-style":"unbundled-bezier","control-point-weights":function(e){return e.scratch("controlPointWeights")},"control-point-distances":function(e){return e.scratch("controlPointDistances")},"edge-distances":"intersection","edge-ends-overlap":!1},animate:!1,animateFilter:function(e,t){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(e,t){return t},ready:function(){},sort:void 0,stop:function(){}},Rf=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e},Bf=Object.defineProperty,Ff=(e,t,n)=>((e,t,n)=>t in e?Bf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n),zf={};((e,t)=>{for(var n in t)Bf(e,n,{get:t[n],enumerable:!0})})(zf,{Graph:()=>Yf,alg:()=>Jf,json:()=>qf,version:()=>Wf});var Vf=Object.defineProperty,Gf=(e,t)=>{for(var n in t)Vf(e,n,{get:t[n],enumerable:!0})},Yf=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=!("directed"in e)||e.directed,this._isMultigraph="multigraph"in e&&e.multigraph,this._isCompound="compound"in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn="function"!=typeof e?()=>e:e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>0===Object.keys(this._in[e]).length)}sinks(){return this.nodes().filter(e=>0===Object.keys(this._out[e]).length)}setNodes(e,t){return e.forEach(e=>{void 0!==t?this.setNode(e,t):this.setNode(e)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===t)t="\0";else{for(let n=t+="";void 0!==n;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if("\0"!==t)return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if("\0"===e)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),0===t.length}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=null!=i?i:void 0,null!=i?i:void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn="function"!=typeof e?()=>e:e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(void 0!==t?this.setEdge(e,n,t):this.setEdge(e,n),n)),this}setEdge(e,t,n,r){let i,a,o,s,l=!1;"object"==typeof e&&null!==e&&"v"in e?(i=e.v,a=e.w,o=e.name,2===arguments.length&&(s=t,l=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,l=!0)),i=""+i,a=""+a,void 0!==o&&(o=""+o);let u=jf(this._isDirected,i,a,o);if(u in this._edgeLabels)return l&&(this._edgeLabels[u]=s),this;if(void 0!==o&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(i),this.setNode(a),this._edgeLabels[u]=l?s:this._defaultEdgeLabelFn(i,a,o);let c=function(e,t,n,r){let i=""+t,a=""+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}(this._isDirected,i,a,o);return i=c.v,a=c.w,Object.freeze(c),this._edgeObjs[u]=c,Xf(this._preds[a],i),Xf(this._sucs[i],a),this._in[a][u]=c,this._out[i][u]=c,this._edgeCount++,this}edge(e,t,n){let r=1===arguments.length?Hf(this._isDirected,e):jf(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=1===arguments.length?this.edge(e):this.edge(e,t,n);return"object"!=typeof r?{label:r}:r}hasEdge(e,t,n){return(1===arguments.length?Hf(this._isDirected,e):jf(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=1===arguments.length?Hf(this._isDirected,e):jf(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],Uf(this._preds[t],e),Uf(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Xf(e,t){e[t]?e[t]++:e[t]=1}function Uf(e,t){void 0!==e[t]&&! --e[t]&&delete e[t]}function jf(e,t,n,r){let i=""+t,a=""+n;if(!e&&i>a){let e=i;i=a,a=e}return i+""+a+""+(void 0===r?"\0":r)}function Hf(e,t){return jf(e,t.v,t.w,t.name)}var Wf="4.0.1",qf={};function Kf(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Zf(e),edges:$f(e)},n=e.graph();return void 0!==n&&(t.value=structuredClone(n)),t}function Zf(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return void 0!==n&&(i.value=n),void 0!==r&&(i.parent=r),i})}function $f(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return void 0!==t.name&&(r.name=t.name),void 0!==n&&(r.value=n),r})}function Qf(e){let t=new Yf(e.options);return void 0!==e.value&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}Gf(qf,{read:()=>Qf,write:()=>Kf});var Jf={};Gf(Jf,{CycleException:()=>hg,bellmanFord:()=>tg,components:()=>ng,dijkstra:()=>ag,dijkstraAll:()=>og,findCycles:()=>lg,floydWarshall:()=>cg,isAcyclic:()=>fg,postorder:()=>yg,preorder:()=>mg,prim:()=>bg,shortestPaths:()=>xg,tarjan:()=>sg,topsort:()=>dg});var eg=()=>1;function tg(e,t,n,r){return function(e,t,n,r){let i,a={},o=0,s=e.nodes(),l=function(e){let t=n(e);a[e.v].distance+t<a[e.w].distance&&(a[e.w]={distance:a[e.v].distance+t,predecessor:e.v},i=!0)},u=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;l({v:n,w:r})})})};s.forEach(function(e){let n=e===t?0:Number.POSITIVE_INFINITY;a[e]={distance:n,predecessor:""}});let c=s.length;for(let h=1;h<c&&(i=!1,o++,u(),i);h++);if(o===c-1&&(i=!1,u(),i))throw new Error("The graph contains a negative weight cycle");return a}(e,String(t),n||eg,r||function(t){return e.outEdges(t)})}function ng(e){let t,n={},r=[];function i(r){r in n||(n[r]=!0,t.push(r),e.successors(r).forEach(i),e.predecessors(r).forEach(i))}return e.nodes().forEach(function(e){t=[],i(e),t.length&&r.push(t)}),r}var rg=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(void 0===n)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t,n=this._arr,r=n[e].priority;for(;0!==e&&(t=e>>1,!(n[t].priority<r));)this._swap(e,t),e=t}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},ig=()=>1;function ag(e,t,n,r){return function(e,t,n,r){let i,a,o={},s=new rg,l=function(e){let t=e.v!==i?e.v:e.w,r=o[t],l=n(e),u=a.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+l);u<r.distance&&(r.distance=u,r.predecessor=i,s.decrease(t,u))};for(e.nodes().forEach(function(e){let n=e===t?0:Number.POSITIVE_INFINITY;o[e]={distance:n,predecessor:""},s.add(e,n)});s.size()>0&&(i=s.removeMin(),a=o[i],a.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}(e,String(t),n||ig,r||function(t){return e.outEdges(t)})}function og(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=ag(e,i,t,n),r},{})}function sg(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e,t=[];do{e=n.pop(),r[e].onStack=!1,t.push(e)}while(o!==e);i.push(t)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function lg(e){return sg(e).filter(function(t){return t.length>1||1===t.length&&e.hasEdge(t[0],t[0])})}var ug=()=>1;function cg(e,t,n){return function(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:""},i.forEach(function(t){e!==t&&(r[e][t]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}(e,t||ug,n||function(t){return e.outEdges(t)})}var hg=class extends Error{constructor(...e){super(...e)}};function dg(e){let t={},n={},r=[];if(e.sinks().forEach(function i(a){if(a in n)throw new hg;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}),Object.keys(t).length!==e.nodeCount())throw new hg;return r}function fg(e){try{dg(e)}catch(t){if(t instanceof hg)return!1;throw t}return!0}function gg(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=t=>{var n;return null!=(n=e.isDirected()?e.successors(t):e.neighbors(t))?n:[]},o={};return t.forEach(function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);i=pg(e,t,"post"===n,o,a,r,i)}),i}function pg(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=pg(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function vg(e,t,n){return gg(e,t,n,function(e,t){return e.push(t),e},[])}function yg(e,t){return vg(e,t,"post")}function mg(e,t){return vg(e,t,"pre")}function bg(e,t){let n,r=new Yf,i={},a=new rg;function o(e){let r=e.v===n?e.w:e.v,o=a.priority(r);if(void 0!==o){let s=t(e);s<o&&(i[r]=n,a.decrease(r,s))}}if(0===e.nodeCount())return r;e.nodes().forEach(function(e){a.add(e,Number.POSITIVE_INFINITY),r.setNode(e)}),a.decrease(e.nodes()[0],0);let s=!1;for(;a.size()>0;){if(n=a.removeMin(),n in i)r.setEdge(n,i[n]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(n).forEach(o)}return r}function xg(e,t,n,r){return function(e,t,n,r){if(void 0===n)return ag(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return tg(e,t,n,r)}return ag(e,t,n,r)}(e,t,n,null!=r?r:t=>{let n=e.outEdges(t);return null!=n?n:[]})}function wg(e,t,n,r){let i=r;for(;e.hasNode(i);)i=Pg(r);return n.dummy=t,e.setNode(i,n),i}function Eg(e){let t=new Yf({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Tg(e,t){let n,r,i=e.x,a=e.y,o=t.x-i,s=t.y-a,l=e.width/2,u=e.height/2;if(!o&&!s)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(s)*l>Math.abs(o)*u?(s<0&&(u=-u),n=u*o/s,r=u):(o<0&&(l=-l),n=l,r=l*s/o),{x:i+n,y:a+r}}function _g(e){let t=Sg(Mg(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;void 0!==i&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function Cg(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),wg(e,"border",i,t)}var Ng=65535;function Ag(e,t){if(t.length>Ng){let n=function(e,t=Ng){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}(t);return e(...n.map(t=>e(...t)))}return e(...t)}function Mg(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n});return Ag(Math.max,t)}function Dg(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function kg(e,t){return t()}var Ig=0;function Pg(e){return e+""+ ++Ig}function Sg(e,t,n=1){null==t&&(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let a=e;r(a);a+=n)i.push(a);return i}function Lg(e,t){let n={};for(let r of t)void 0!==e[r]&&(n[r]=e[r]);return n}function Og(e,t){let n;return n="string"==typeof t?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}var Rg="\0";function Bg(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Fg(e,t){if("_next"!==e&&"_prev"!==e)return t}var zg=class{constructor(){Ff(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Bg(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Bg(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,Fg)),n=n._prev;return"["+e.join(", ")+"]"}},Vg=()=>1;function Gg(e,t){if(e.nodeCount()<=1)return[];let n=function(e,t){let n=new Yf,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let l=n.node(e.v),u=n.node(e.w);i=Math.max(i,l.out+=o),r=Math.max(r,u.in+=o)});let a=function(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}(i+r+3).map(()=>new zg),o=r+1;return n.nodes().forEach(e=>{Xg(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}(e,t||Vg);return function(e,t,n){var r;let i,a=[],o=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;i=s.dequeue();)Yg(e,t,n,i);for(;i=o.dequeue();)Yg(e,t,n,i);if(e.nodeCount())for(let o=t.length-2;o>0;--o)if(i=null==(r=t[o])?void 0:r.dequeue(),i){a=a.concat(Yg(e,t,n,i,!0)||[]);break}}return a}(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Yg(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Xg(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Xg(t,n,o)}),e.removeNode(r.v),o}function Xg(e,t,n){var r,i,a;n.out?n.in?null==(a=e[n.out-n.in+t])||a.enqueue(n):null==(i=e[e.length-1])||i.enqueue(n):null==(r=e[0])||r.enqueue(n)}function Ug(e){var t;("greedy"===e.graph().acyclicer?Gg(e,(t=e,e=>t.edge(e).weight)):function(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,Pg("rev"))})}function jg(e){e.graph().dummyChains=[],e.edges().forEach(t=>function(e,t){let n,r,i,a=t.v,o=e.node(a).rank,s=t.w,l=e.node(s).rank,u=t.name,c=e.edge(t),h=c.labelRank;if(l===o+1)return;for(e.removeEdge(t),i=0,++o;o<l;++i,++o)c.points=[],r={width:0,height:0,edgeLabel:c,edgeObj:t,rank:o},n=wg(e,"edge",r,"_d"),o===h&&(r.width=c.width,r.height=c.height,r.dummy="edge-label",r.labelpos=c.labelpos),e.setEdge(a,n,{weight:c.weight},u),0===i&&e.graph().dummyChains.push(n),a=n;e.setEdge(a,s,{weight:c.weight},u)}(e,t))}function Hg(e){let t={};e.sources().forEach(function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>null==t?Number.POSITIVE_INFINITY:n(t.w)-e.edge(t).minlen):[],s=Ag(Math.min,o);return s===Number.POSITIVE_INFINITY&&(s=0),i.rank=s})}function Wg(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var qg=function(e){let t=new Yf({directed:!1}),n=e.nodes();if(0===n.length)throw new Error("Graph must have at least one node");let r,i,a=n[0],o=e.nodeCount();for(t.setNode(a,{});Kg(t,e)<o&&(r=Zg(t,e),r);)i=t.hasNode(r.v)?Wg(e,r):-Wg(e,r),$g(t,e,i);return t};function Kg(e,t){return e.nodes().forEach(function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Wg(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}),e.nodeCount()}function Zg(e,t){return t.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=Wg(t,r)),i<n[0]?[i,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function $g(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:Qg,postorder:Jg}=Jf,ep=tp;function tp(e){e=function(e){let t=(new Yf).setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}(e),Hg(e);let t,n,r=qg(e);for(ip(r),np(r,e);t=op(r);)n=sp(r,e,t),lp(r,e,t,n)}function np(e,t){let n=Jg(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>function(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=rp(e,t,n)}(e,t,n))}function rp(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||(i=!1,a=t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,l=s?a.w:a.v;if(l!==r){let r=s===i,u=t.edge(a).weight;if(o+=r?u:-u,function(e,t,n){return e.hasEdge(t,n)}(e,n,l)){let t=e.edge(n,l).cutvalue;o+=r?-t:t}}}),o}function ip(e,t){arguments.length<2&&(t=e.nodes()[0]),ap(e,{},1,t)}function ap(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=ap(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function op(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function sp(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,l=!1;return a.lim>o.lim&&(s=o,l=!0),t.edges().filter(t=>l===up(e,e.node(t.v),s)&&l!==up(e,e.node(t.w),s)).reduce((e,n)=>Wg(t,n)<Wg(t,e)?n:e)}function lp(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ip(e),np(e,t),function(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=Qg(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}(e,t)}function up(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}tp.initLowLimValues=ip,tp.initCutValues=np,tp.calcCutValue=rp,tp.leaveEdge=op,tp.enterEdge=sp,tp.exchangeEdges=lp;var cp=function(e){let t=e.graph().ranker;if("function"==typeof t)return t(e);switch(t){case"network-simplex":default:dp(e);break;case"tight-tree":!function(e){Hg(e),qg(e)}(e);break;case"longest-path":hp(e);case"none":}};var hp=Hg;function dp(e){ep(e)}var fp=function(e){let t=function(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Rg).forEach(r),t}(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=function(e,t,n,r){let i,a=[],o=[],s=Math.min(t[n].low,t[r].low),l=Math.max(t[n].lim,t[r].lim);i=n;do{i=e.parent(i),a.push(i)}while(i&&(t[i].low>s||l>t[i].lim));let u=i,c=r;for(;(c=e.parent(c))!==u;)o.push(c);return{path:a.concat(o.reverse()),lca:u}}(e,t,i.v,i.w),o=a.path,s=a.lca,l=0,u=o[l],c=!0;for(;n!==i.w;){if(r=e.node(n),c){for(;(u=o[l])!==s&&e.node(u).maxRank<r.rank;)l++;u===s&&(c=!1)}if(!c){for(;l<o.length-1&&e.node(o[l+1]).minRank<=r.rank;)l++;u=o[l]}void 0!==u&&e.setParent(n,u),n=e.successors(n)[0]}})};function gp(e){let t=wg(e,"root",{},"_root"),n=function(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Rg).forEach(e=>n(e,1)),t}(e),r=Object.values(n),i=Ag(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=function(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}(e)+1;e.children(Rg).forEach(r=>pp(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function pp(e,t,n,r,i,a,o){var s;let l=e.children(o);if(!l.length)return void(o!==t&&e.setEdge(t,o,{weight:0,minlen:n}));let u=Cg(e,"_bt"),c=Cg(e,"_bb"),h=e.node(o);e.setParent(u,o),h.borderTop=u,e.setParent(c,o),h.borderBottom=c,l.forEach(s=>{var l;pp(e,t,n,r,i,a,s);let h=e.node(s),d=h.borderTop?h.borderTop:s,f=h.borderBottom?h.borderBottom:s,g=h.borderTop?r:2*r,p=d!==f?1:i-(null!=(l=a[o])?l:0)+1;e.setEdge(u,d,{weight:g,minlen:p,nestingEdge:!0}),e.setEdge(f,c,{weight:g,minlen:p,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,u,{weight:0,minlen:i+(null!=(s=a[o])?s:0)})}var vp=function(e){e.children(Rg).forEach(function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)yp(e,"borderLeft","_bl",n,i,t),yp(e,"borderRight","_br",n,i,t)}})};function yp(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],l=wg(e,"border",o,n);i[t][a]=l,e.setParent(l,r),s&&e.setEdge(s,l,{weight:1})}function mp(e){var t;let n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase();("bt"===n||"rl"===n)&&function(e){e.nodes().forEach(t=>wp(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);null==(n=r.points)||n.forEach(wp),Object.hasOwn(r,"y")&&wp(r)})}(e),("lr"===n||"rl"===n)&&(function(e){e.nodes().forEach(t=>Ep(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);null==(n=r.points)||n.forEach(Ep),Object.hasOwn(r,"x")&&Ep(r)})}(e),bp(e))}function bp(e){e.nodes().forEach(t=>xp(e.node(t))),e.edges().forEach(t=>xp(e.edge(t)))}function xp(e){let t=e.width;e.width=e.height,e.height=t}function wp(e){e.y=-e.y}function Ep(e){let t=e.x;e.x=e.y,e.y=t}function Tp(e,t){let n=0;for(let r=1;r<t.length;++r)n+=_p(e,t[r-1],t[r]);return n}function _p(e,t,n){let r=function(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;a-=1;let s=new Array(o).fill(0),l=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;l+=e.weight*n}),l}function Cp(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];void 0!==t&&void 0!==r&&(r.indegree++,t.out.push(r))}),function(e){let t=[];function n(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function r(t){return n=>{n.in.push(t),0===--n.indegree&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>Lg(e,["vs","i","barycenter","weight"]))}(Object.values(n).filter(e=>!e.indegree))}function Np(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Ap(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};o&&(i=i.filter(e=>e!==o&&e!==s));let u=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}(e,i);u.forEach(t=>{if(e.children(t.v).length){let i=Ap(e,t.v,n,r);l[t.v]=i,Object.hasOwn(i,"barycenter")&&function(e,t){void 0!==e.barycenter?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}(t,i)}});let c=Cp(u,n);!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(c,l);let h=function(e,t){let n=function(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}(e,e=>Object.hasOwn(e,"barycenter")),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,l=0;r.sort(function(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}(!!t)),l=Np(a,i,l),r.forEach(e=>{l+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,l=Np(a,i,l)});let u={vs:a.flat(1)};return s&&(u.barycenter=o/s,u.weight=s),u}(c,r);if(o&&s){h.vs=[o,h.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+n.order+i.order)/(h.weight+2),h.weight+=2}}return h}function Mp(e,t,n,r){r||(r=e.nodes());let i=function(e){let t;for(;e.hasNode(t=Pg("_root")););return t}(e),a=new Yf({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let l=e[n](r);l&&l.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=void 0!==i?i.weight:0;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,"minRank")&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Dp(e,t={}){if("function"==typeof t.customOrder)return void t.customOrder(e,Dp);let n=Mg(e),r=kp(e,Sg(1,n+1),"inEdges"),i=kp(e,Sg(n-1,-1,-1),"outEdges"),a=function(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=Sg(Ag(Math.max,r)+1).map(()=>[]);return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(function n(r){if(t[r])return;t[r]=!0;let a=e.node(r);i[a.rank].push(r);let o=e.successors(r);o&&o.forEach(n)}),i}(e);if(Pp(e,a),t.disableOptimalOrderHeuristic)return;let o,s=Number.POSITIVE_INFINITY,l=t.constraints||[];for(let u=0,c=0;c<4;++u,++c){Ip(u%2?r:i,u%4>=2,l),a=_g(e);let t=Tp(e,a);t<s?(c=0,o=Object.assign({},a),s=t):t===s&&(o=structuredClone(a))}Pp(e,o)}function kp(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let a of e.nodes()){let t=e.node(a);if("number"==typeof t.rank&&i(t.rank,a),"number"==typeof t.minRank&&"number"==typeof t.maxRank)for(let e=t.minRank;e<=t.maxRank;e++)e!==t.rank&&i(e,a)}return t.map(function(t){return Mp(e,t,n,r.get(t)||[])})}function Ip(e,t,n){let r=new Yf;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=Ap(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),function(e,t,n){let r,i={};n.forEach(n=>{let a,o,s=e.parent(n);for(;s;){if(a=e.parent(s),a?(o=i[a],i[a]=s):(o=r,r=s),o&&o!==s)return void t.setEdge(o,s);s=a}})}(e,r,a.vs)})}function Pp(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Sp(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Lp(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return void 0!==r&&Object.hasOwn(r,n)}function Op(e,t,n,r,i=!1){let a={},o=function(e,t,n,r){let i=new Yf,a=e.graph(),o=function(e,t,n){return(r,i,a)=>{let o,s=r.node(i),l=r.node(a),u=0;if(u+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":o=-s.width/2;break;case"r":o=s.width/2}if(o&&(u+=n?o:-o),o=void 0,u+=(s.dummy?t:e)/2,u+=(l.dummy?t:e)/2,u+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":o=l.width/2;break;case"r":o=-l.width/2}return o&&(u+=n?o:-o),u}}(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(void 0!==a){if(i.setNode(a),void 0!==r){let s=n[r];if(void 0!==s){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}(e,t,n,i),s=i?"borderLeft":"borderRight";function l(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}return l(function(e){let t=o.inEdges(e);a[e]=t?t.reduce((e,t)=>{var n;let r=null!=(n=a[t.v])?n:0,i=o.edge(t);return Math.max(e,r+(void 0!==i?i:0))},0):0},function(e){return o.predecessors(e)||[]}),l(function(t){let n=o.outEdges(t),r=Number.POSITIVE_INFINITY;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(void 0!==n?n:0)-(void 0!==r?r:0))},Number.POSITIVE_INFINITY));let i=e.node(t);r!==Number.POSITIVE_INFINITY&&i.borderType!==s&&(a[t]=Math.max(void 0!==a[t]?a[t]:0,r))},function(e){return o.successors(e)||[]}),Object.keys(r).forEach(e=>{var t;let r=n[e];void 0!==r&&(a[e]=null!=(t=a[r])?t:0)}),a}function Rp(e){let t,n=_g(e),r=Object.assign(function(e,t){let n={};return t.length&&t.reduce(function(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,l)=>{let u=function(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}(e,t),c=u?e.node(u).order:o;(u||t===s)&&(r.slice(a,l+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||c<o)&&(!a.dummy||!e.node(t).dummy)&&Sp(n,r,t)})}),a=l+1,i=c)}),r}),n}(e,n),function(e,t){let n={};function r(t,r,i,a,o){Sg(r,i).forEach(r=>{let i=t[r];if(void 0!==i&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(void 0===t)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Sp(n,t,i)})}})}return t.length&&t.reduce(function(t,n){let i=-1,a=-1,o=0;return n.forEach((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(void 0===s)return;a=e.node(s).order,r(n,o,l,i,a),o=l,i=a}}r(n,o,n.length,a,t.length)}),n}),n}(e,n)),i={};["u","d"].forEach(a=>{t="u"===a?n:Object.values(n).reverse(),["l","r"].forEach(n=>{"r"===n&&(t=t.map(e=>Object.values(e).reverse()));let o=function(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(void 0!==n?n:0)-(void 0!==r?r:0)}),l=(r.length-1)/2;for(let s=Math.floor(l),u=Math.ceil(l);s<=u;++s){let l=r[s];if(void 0===l)continue;let u=o[l];if(void 0!==u&&a[e]===e&&t<u&&!Lp(n,e,l)){let n=i[l];void 0!==n&&(a[l]=e,a[e]=i[e]=n,t=u)}}}})}),{root:i,align:a}}(0,t,r,t=>("u"===a?e.predecessors(t):e.successors(t))||[]),s=Op(e,t,o.root,o.align,"r"===n);"r"===n&&(s=Og(s,e=>-e)),i[a+n]=s})});let a=function(e,t){return Object.values(t).reduce((t,n)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([t,n])=>{let a=function(e,t){return e.node(t).width}(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[Number.POSITIVE_INFINITY,null])[1]}(e,i);return function(e,t){let n=Object.values(t),r=Ag(Math.min,n),i=Ag(Math.max,n);["u","d"].forEach(n=>{["l","r"].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let l=Object.values(s),u=r-Ag(Math.min,l);"l"!==a&&(u=i-Ag(Math.max,l)),u&&(e[o]=Og(s,e=>e+u))})})}(i,a),function(e,t){let n=e.ul;return n?Og(n,(n,r)=>{var i,a;if(t){let n=t.toLowerCase(),i=e[n];if(i&&void 0!==i[r])return i[r]}let o=Object.values(e).map(e=>{let t=e[r];return void 0!==t?t:0}).sort((e,t)=>e-t);return((null!=(i=o[1])?i:0)+(null!=(a=o[2])?a:0))/2}):{}}(i,e.graph().align)}function Bp(e){(function(e){let t=_g(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{var r;let i=null!=(r=e.node(n).height)?r:0;return t>i?t:i},0);t.forEach(t=>{let r=e.node(t);r.y="top"===i?a+r.height/2:"bottom"===i?a+n-r.height/2:a+n/2}),a+=n+r})})(e=Eg(e)),Object.entries(Rp(e)).forEach(([t,n])=>e.node(t).x=n)}var Fp=["nodesep","edgesep","ranksep","marginx","marginy"],zp={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Vp=["acyclicer","ranker","rankdir","align","rankalign"],Gp=["width","height","rank"],Yp={width:0,height:0},Xp=["minlen","weight","width","height","labeloffset"],Up={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},jp=["labelpos"];function Hp(e,t){return Og(Lg(e,t),Number)}function Wp(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}var qp={graphlib:zf,version:"3.0.0",layout:function(e,t={}){let n=t.debugTiming?Dg:kg;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>function(e){let t=new Yf({multigraph:!0,compound:!0}),n=Wp(e.graph());return t.setGraph(Object.assign({},zp,Hp(n,Fp),Lg(n,Vp))),e.nodes().forEach(n=>{let r=Hp(Wp(e.node(n)),Gp);Object.keys(Yp).forEach(e=>{void 0===r[e]&&(r[e]=Yp[e])}),t.setNode(n,r);let i=e.parent(n);void 0!==i&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Wp(e.edge(n));t.setEdge(n,Object.assign({},Up,Hp(r,Xp),Lg(r,jp)))}),t}(e));return n(" runLayout",()=>function(e,t,n){t(" makeSpaceForEdgeLabels",()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(e)),t(" removeSelfEdges",()=>function(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(e)),t(" acyclic",()=>Ug(e)),t(" nestingGraph.run",()=>gp(e)),t(" rank",()=>cp(Eg(e))),t(" injectEdgeLabelProxies",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};wg(e,"edge-proxy",r,"_ep")}})}(e)),t(" removeEmptyRanks",()=>function(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>void 0!==e),n=Ag(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{void 0===t&&n%a!==0?--i:void 0!==t&&i&&t.forEach(t=>e.node(t).rank+=i)})}(e)),t(" nestingGraph.cleanup",()=>function(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}(e)),t(" normalizeRanks",()=>function(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n}),n=Ag(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,"rank")&&(r.rank-=n)})}(e)),t(" assignRankMinMax",()=>function(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}(e)),t(" removeEdgeLabelProxies",()=>function(e){e.nodes().forEach(t=>{let n=e.node(t);if("edge-proxy"===n.dummy){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}(e)),t(" normalize.run",()=>jg(e)),t(" parentDummyChains",()=>fp(e)),t(" addBorderSegments",()=>vp(e)),t(" order",()=>Dp(e,n)),t(" insertSelfEdges",()=>function(e){_g(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{wg(e,"selfedge",{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},"_se")}),delete i.selfEdges})})}(e)),t(" adjustCoordinateSystem",()=>function(e){var t;let n=null==(t=e.graph().rankdir)?void 0:t.toLowerCase();("lr"===n||"rl"===n)&&bp(e)}(e)),t(" position",()=>Bp(e)),t(" positionSelfEdges",()=>function(e){e.nodes().forEach(t=>{let n=e.node(t);if("selfedge"===n.dummy){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,l=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-l},{x:a+5*s/6,y:o-l},{x:a+s,y:o},{x:a+5*s/6,y:o+l},{x:a+2*s/3,y:o+l}],r.label.x=n.x,r.label.y=n.y}})}(e)),t(" removeBorderNodes",()=>function(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{"border"===e.node(t).dummy&&e.removeNode(t)})}(e)),t(" normalize.undo",()=>function(e){e.graph().dummyChains.forEach(t=>{let n,r=e.node(t),i=r.edgeLabel;for(e.setEdge(r.edgeObj,i);r.dummy;)n=e.successors(t)[0],e.removeNode(t),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),t=n,r=e.node(t)})}(e)),t(" fixupEdgeLabelCoords",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch(("l"===n.labelpos||"r"===n.labelpos)&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(e)),t(" undoCoordinateSystem",()=>mp(e)),t(" translateGraph",()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function l(e){let a=e.x,o=e.y,s=e.width,l=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-l/2),i=Math.max(i,o+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,"x")&&(i.x-=t),Object.hasOwn(i,"y")&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}(e)),t(" assignNodeIntersects",()=>function(e){e.edges().forEach(t=>{let n,r,i=e.edge(t),a=e.node(t.v),o=e.node(t.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=o,r=a),i.points.unshift(Tg(a,n)),i.points.push(Tg(o,r))})}(e)),t(" reversePoints",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}(e)),t(" acyclic.undo",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}(e))}(r,n,t)),n(" updateInputGraph",()=>function(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(e,r)),r})},debug:function(e){let t=_g(e),n=new Yf({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,"layer"+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r="layer"+t;n.setNode(r,{rank:"same"}),e.reduce((e,t)=>(n.setEdge(e,t,{style:"invis"}),t))}),n},util:{time:Dg,notime:kg}},Kp=qp,Zp=function(e){return"function"==typeof e},$p=.001;/*! For license information please see dagre.esm.js.LEGAL.txt */function Qp(e){this.options=Rf({},Of,e)}function Jp(e,t){return{x:nv(e.x-t.x),y:nv(e.y-t.y)}}function ev(e,t){return nv(e.x*t.x)+nv(e.y*t.y)}function tv(e,t){var n=function(e){var t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t,len:t}}(Jp(t,e)),r=n.x,i=n.y,a=n.len,o={x:r,y:i},s=function(e){return{x:-e.y,y:e.x}}(o);return{src:e,tgt:t,dir:o,normal:s,len:a}}function nv(e){return Math.abs(e)<$p?e<0?-.001:$p:e}function rv(e,t){var n=tv(t.source().position(),t.target().position()),r=function(e){var t,n=1/0,r=-1/0,i=Sf(e);try{for(i.s();!(t=i.n()).done;){var a=t.value;a.weight<n&&(n=a.weight),a.weight>r&&(r=a.weight)}}catch(s){i.e(s)}finally{i.f()}var o=r-n||1;return e.map(function(e){return{distance:e.distance,weight:(e.weight-n)/o}})}(e.points.map(function(e){return function(e,t){var n=Jp(e,t.src);return{weight:nv(ev(n,t.dir)/t.len),distance:nv(ev(n,t.normal))}}(e,n)}));return{controlPointWeights:r.slice(1,-1).map(function(e){return e.weight}),controlPointDistances:r.slice(1,-1).map(function(e){return e.distance})}}Qp.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=function(e,t){return Zp(t)?t.apply(e,[e]):t},i=e.boundingBox||{x1:0,y1:0,w:t.width(),h:t.height()};void 0===i.x2&&(i.x2=i.x1+i.w),void 0===i.w&&(i.w=i.x2-i.x1),void 0===i.y2&&(i.y2=i.y1+i.h),void 0===i.h&&(i.h=i.y2-i.y1);var a=new Kp.graphlib.Graph({multigraph:!0,compound:!0}),o={},s=function(e,t){null!=t&&(o[e]=t)};s("nodesep",e.nodeSep),s("edgesep",e.edgeSep),s("ranksep",e.rankSep),s("rankdir",e.rankDir),s("align",e.align),s("ranker",e.ranker),s("acyclicer",e.acyclicer),a.setGraph(o),a.setDefaultEdgeLabel(function(){return{}}),a.setDefaultNodeLabel(function(){return{}});var l=n.nodes();Zp(e.sort)&&(l=l.sort(e.sort));for(var u=0;u<l.length;u++){var c=l[u],h=c.layoutDimensions(e);a.setNode(c.id(),{width:h.w,height:h.h,shape:"ellipse",name:c.id()})}for(var d=0;d<l.length;d++){var f=l[d];f.isChild()&&a.setParent(f.id(),f.parent().id())}var g=n.edges().stdFilter(function(e){return!e.source().isParent()&&!e.target().isParent()});Zp(e.sort)&&(g=g.sort(e.sort));for(var p=0;p<g.length;p++){var v=g[p];a.setEdge(v.source().id(),v.target().id(),{minlen:r(v,e.minLen),weight:r(v,e.edgeWeight),name:v.id()},v.id())}Kp.layout(a);for(var y,m=a.nodes(),b=0;b<m.length;b++){var x=m[b],w=a.node(x);t.getElementById(x).scratch().dagre=w}e.boundingBox?(y={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},l.forEach(function(e){var t=e.scratch().dagre;y.x1=Math.min(y.x1,t.x),y.x2=Math.max(y.x2,t.x),y.y1=Math.min(y.y1,t.y),y.y2=Math.max(y.y2,t.y)}),y.w=y.x2-y.x1,y.h=y.y2-y.y1):y=i;return l.layoutPositions(this,e,function(t){var n=(t="object"===Lf(t)?t:this).scratch().dagre;return function(t){if(e.boundingBox){var n=0===y.w?0:(t.x-y.x1)/y.w,r=0===y.h?0:(t.y-y.y1)/y.h;return{x:i.x1+n*i.w,y:i.y1+r*i.h}}return t}({x:n.x,y:n.y})}),e.useDagreEdgeControlPoints&&(e.automaticDagreEdgeStyle&&(t.edges().addClass("useDagreEdgeControlPoints"),t.style().selector("edge.useDagreEdgeControlPoints").style(e.dagreEdgeStyle).update()),a.edges().forEach(function(e){var n=t.getElementById(e.name),r=a.edge(e);r&&r.points&&n.scratch(rv(r,n))})),this};var iv=function(e){e&&e("layout","dagre",Qp)};"undefined"!=typeof window&&void 0!==window.cytoscape&&iv(window.cytoscape);var av,ov={exports:{}},sv={exports:{}},lv={exports:{}};function uv(){return av?lv.exports:(av=1,e=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=28)}([function(e,t,n){function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r},function(e,t,n){var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw"Node is not incident with this edge"},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=new Array(4);this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){e.exports=function(e){this.vGraphObject=e}},function(e,t,n){var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(5);function u(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,this.rect=null!=n&&null!=t?new a(t.x,t.y,n.width,n.height):new a}for(var c in u.prototype=Object.create(r.prototype),r)u[c]=r[c];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(e){this.rect.width=e},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(e){this.rect.height=e},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},u.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},u.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},u.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},u.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}}),t},u.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.source!=n&&r.target!=n)throw"Incorrect edge source and/or target";r.target!=e&&r.source!=e||t.push(r)}),t},u.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}}),e},u.prototype.withChildren=function(){var e=new Set;if(e.add(this),null!=this.child)for(var t=this.child.getNodes(),n=0;n<t.length;n++)t[n].withChildren().forEach(function(t){e.add(t)});return e},u.prototype.getNoOfChildren=function(){var e=0;if(null==this.child)e=1;else for(var t=this.child.getNodes(),n=0;n<t.length;n++)e+=t[n].getNoOfChildren();return 0==e&&(e=1),e},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){return null==this.child?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},u.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},u.prototype.updateBounds=function(){if(null==this.getChild())throw"assert failed";if(0!=this.getChild().getNodes().length){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth&&("left"==this.labelPosHorizontal?(this.rect.x-=this.labelWidth,this.setWidth(t+this.labelWidth)):"center"==this.labelPosHorizontal&&this.labelWidth>t?(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)):"right"==this.labelPosHorizontal&&this.setWidth(t+this.labelWidth)),this.labelHeight&&("top"==this.labelPosVertical?(this.rect.y-=this.labelHeight,this.setHeight(n+this.labelHeight)):"center"==this.labelPosVertical&&this.labelHeight>n?(this.rect.y-=(this.labelHeight-n)/2,this.setHeight(this.labelHeight)):"bottom"==this.labelPosVertical&&this.setHeight(n+this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=3*i.MAX_NODE_DISPLACEMENT_INCREMENTAL,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i},function(e,t,n){function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(7),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var f in d.prototype=Object.create(r.prototype),r)d[f]=r[f];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i<r;i++)(a=n[i]).isInterGraph?this.graphManager.remove(a):a.source.owner.remove(a);if(-1==(o=this.nodes.indexOf(t)))throw"Node not in owner node list!";this.nodes.splice(o,1)}else if(e instanceof l){var a;if(null==(a=e))throw"Edge is null!";if(null==a.source||null==a.target)throw"Source and/or target is null!";if(null==a.source.owner||null==a.target.owner||a.source.owner!=this||a.target.owner!=this)throw"Source and/or target owner is invalid!";var o,u=a.source.edges.indexOf(a),c=a.target.edges.indexOf(a);if(!(u>-1&&c>-1))throw"Source and/or target doesn't know this edge!";if(a.source.edges.splice(u,1),a.target!=a.source&&a.target.edges.splice(c,1),-1==(o=a.source.owner.getEdges().indexOf(a)))throw"Not in owner's edge list!";a.source.owner.getEdges().splice(o,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l<s;l++){var u=o[l];r>(e=u.getTop())&&(r=e),a>(t=u.getLeft())&&(a=t)}return r==i.MAX_VALUE?null:(n=null!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,f=d.length,g=0;g<f;g++){var p=d[g];e&&null!=p.child&&p.updateBounds(),s>(t=p.getLeft())&&(s=t),l<(n=p.getRight())&&(l=n),c>(r=p.getTop())&&(c=r),h<(a=p.getBottom())&&(h=a)}var v=new u(s,c,l-s,h-c);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=null!=d[0].getParent().paddingLeft?d[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},d.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,c=-i.MAX_VALUE,h=e.length,d=0;d<h;d++){var f=e[d];o>(t=f.getLeft())&&(o=t),s<(n=f.getRight())&&(s=n),l>(r=f.getTop())&&(l=r),c<(a=f.getBottom())&&(c=a)}return new u(o,l,s-o,c-l)},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++)e+=t[r].calcEstimatedSize();return this.estimatedSize=0==e?a.EMPTY_COMPOUND_NODE_SIZE:e/Math.sqrt(this.nodes.length),this.estimatedSize},d.prototype.updateConnected=function(){var e=this;if(0!=this.nodes.length){var t,n,r=new h,i=new Set,a=this.nodes[0];for(a.withChildren().forEach(function(e){r.push(e),i.add(e)});0!==r.length;)for(var o=(t=(a=r.shift()).getEdges()).length,s=0;s<o;s++)null==(n=t[s].getOtherEndInGraph(a,this))||i.has(n)||n.withChildren().forEach(function(e){r.push(e),i.add(e)});if(this.isConnected=!1,i.size>=this.nodes.length){var l=0;i.forEach(function(t){t.owner==e&&l++}),l==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d},function(e,t,n){var r,i=n(1);function a(e){r=n(6),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,n=e;var a=(r=t).getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";for(var n,a=[],o=(a=a.concat(t.getEdges())).length,s=0;s<o;s++)n=a[s],t.remove(n);var l,u=[];for(o=(u=u.concat(t.getNodes())).length,s=0;s<o;s++)l=u[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var c=this.graphs.indexOf(t);this.graphs.splice(c,1),t.parent=null}else if(e instanceof i){if(null==(n=e))throw"Edge is null!";if(!n.isInterGraph)throw"Not an inter-graph edge!";if(null==n.source||null==n.target)throw"Source and/or target is null!";if(-1==n.source.edges.indexOf(n)||-1==n.target.edges.indexOf(n))throw"Source and/or target doesn't know this edge!";if(c=n.source.edges.indexOf(n),n.source.edges.splice(c,1),c=n.target.edges.indexOf(n),n.target.edges.splice(c,1),null==n.source.owner||null==n.source.owner.getGraphManager())throw"Edge owner graph or owner graph manager is null!";if(-1==n.source.owner.getGraphManager().edges.indexOf(n))throw"Not in owner graph manager's edge list!";c=n.source.owner.getGraphManager().edges.indexOf(n),n.source.owner.getGraphManager().edges.splice(c,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(null==this.allNodes){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(null==this.allEdges){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(null!=this.allNodesToApplyGravitation)throw"assert failed";this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=e,null==e.parent&&(e.parent=this.layout.newNode("Root node"))},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(null==e||null==t)throw"assert failed";if(e==t)return!0;for(var n,r=e.getOwner();null!=(n=r.getParent());){if(n==t)return!0;if(null==(r=n.getOwner()))break}for(r=t.getOwner();null!=(n=r.getParent());){if(n==e)return!0;if(null==(r=n.getOwner()))break}return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++)if(t=(e=a[s]).source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t!=n){for(r=t.getOwner();null==e.lca;){for(e.targetInLca=n,i=n.getOwner();null==e.lca;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(null!=e.lca)throw"assert failed";e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;null==e.lca&&(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(null==e.lca)throw"assert failed"}else e.lca=t.getOwner()},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();for(var n=e.getOwner();null!=n;){for(var r=t.getOwner();null!=r;){if(r==n)return r;r=r.getParent().getOwner()}n=n.getParent().getOwner()}return n},a.prototype.calcInclusionTreeDepths=function(e,t){var n;null==e&&null==t&&(e=this.rootGraph,t=1);for(var r=e.getNodes(),i=r.length,a=0;a<i;a++)(n=r[a]).inclusionTreeDepth=t,null!=n.child&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=[],n=this.edges.length,r=0;r<n;r++)e=this.edges[r],this.isOneAncestorOfOther(e.source,e.target)&&t.push(e);for(r=0;r<t.length;r++)this.remove(t[r]);return!1},e.exports=a},function(e,t,n){var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw"assert failed";var i=new Array(2);this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),l=e.getY(),u=e.getRight(),c=e.getX(),h=e.getBottom(),d=e.getRight(),f=e.getWidthHalf(),g=e.getHeightHalf(),p=t.getX(),v=t.getY(),y=t.getRight(),m=t.getX(),b=t.getBottom(),x=t.getRight(),w=t.getWidthHalf(),E=t.getHeightHalf(),T=!1,_=!1;if(r===a){if(i>o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(i<o)return n[0]=r,n[1]=h,n[2]=a,n[3]=v,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(r<a)return n[0]=u,n[1]=i,n[2]=p,n[3]=o,!1}else{var C=e.height/e.width,N=t.height/t.width,A=(o-i)/(a-r),M=void 0,D=void 0,k=void 0,I=void 0,P=void 0,S=void 0;if(-C===A?r>a?(n[0]=c,n[1]=h,T=!0):(n[0]=u,n[1]=l,T=!0):C===A&&(r>a?(n[0]=s,n[1]=l,T=!0):(n[0]=d,n[1]=h,T=!0)),-N===A?a>r?(n[2]=m,n[3]=b,_=!0):(n[2]=y,n[3]=v,_=!0):N===A&&(a>r?(n[2]=p,n[3]=v,_=!0):(n[2]=x,n[3]=b,_=!0)),T&&_)return!1;if(r>a?i>o?(M=this.getCardinalDirection(C,A,4),D=this.getCardinalDirection(N,A,2)):(M=this.getCardinalDirection(-C,A,3),D=this.getCardinalDirection(-N,A,1)):i>o?(M=this.getCardinalDirection(-C,A,1),D=this.getCardinalDirection(-N,A,3)):(M=this.getCardinalDirection(C,A,2),D=this.getCardinalDirection(N,A,4)),!T)switch(M){case 1:I=l,k=r+-g/A,n[0]=k,n[1]=I;break;case 2:k=d,I=i+f*A,n[0]=k,n[1]=I;break;case 3:I=h,k=r+g/A,n[0]=k,n[1]=I;break;case 4:k=c,I=i+-f*A,n[0]=k,n[1]=I}if(!_)switch(D){case 1:S=v,P=a+-E/A,n[2]=P,n[3]=S;break;case 2:P=x,S=o+w*A,n[2]=P,n[3]=S;break;case 3:S=b,P=a+E/A,n[2]=P,n[3]=S;break;case 4:P=m,S=o+-w*A,n[2]=P,n[3]=S}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a,o,s,l,u,c,h,d=e.x,f=e.y,g=t.x,p=t.y,v=n.x,y=n.y,m=i.x,b=i.y;return 0===(h=(a=p-f)*(l=v-m)-(o=b-y)*(s=d-g))?null:new r((s*(c=m*y-v*b)-l*(u=g*f-d*p))/h,(o*u-a*c)/h)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)):i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI,i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,l=n.x,u=n.y,c=r.x,h=r.y,d=(o-i)*(h-u)-(c-l)*(s-a);if(0===d)return!1;var f=((h-u)*(c-i)+(l-c)*(h-a))/d,g=((a-s)*(c-i)+(o-i)*(h-a))/d;return 0<f&&f<1&&0<g&&g<1},i.findCircleLineIntersections=function(e,t,n,r,i,a,o){var s=(n-e)*(n-e)+(r-t)*(r-t),l=2*((e-i)*(n-e)+(t-a)*(r-t)),u=(e-i)*(e-i)+(t-a)*(t-a)-o*o;if(l*l-4*s*u>=0){var c=(-l+Math.sqrt(l*l-4*s*u))/(2*s),h=(-l-Math.sqrt(l*l-4*s*u))/(2*s);return c>=0&&c<=1?[c]:h>=0&&h<=1?[h]:null}return null},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i},function(e,t,n){function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(e){return{value:e,next:null,prev:null}},a=function(e,t,n,r){return null!==e?e.next=t:r.head=t,null!==n?n.prev=t:r.tail=t,t.prev=e,t.next=n,r.length++,t},o=function(e,t){var n=e.prev,r=e.next;return null!==n?n.next=r:t.head=r,null!==r?r.prev=n:t.tail=n,e.prev=e.next=null,t.length--,e},s=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.length=0,this.head=null,this.tail=null,null!=t&&t.forEach(function(e){return n.push(e)})}return r(e,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(e,t){return a(t.prev,i(e),t,this)}},{key:"insertAfter",value:function(e,t){return a(t,i(e),t.next,this)}},{key:"insertNodeBefore",value:function(e,t){return a(t.prev,e,t,this)}},{key:"insertNodeAfter",value:function(e,t){return a(t,e,t.next,this)}},{key:"push",value:function(e){return a(this.tail,i(e),null,this)}},{key:"unshift",value:function(e){return a(null,i(e),this.head,this)}},{key:"remove",value:function(e){return o(e,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:"set_object_at",value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}();e.exports=s},function(e,t,n){function r(e,t,n){this.x=null,this.y=null,null==e&&null==t&&null==n?(this.x=0,this.y=0):"number"==typeof e&&"number"==typeof t&&null==n?(this.x=e,this.y=t):"Point"==e.constructor.name&&null==t&&null==n&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){"Point"==e.constructor.name&&null==t&&null==n?(n=e,this.setLocation(n.x,n.y)):"number"==typeof e&&"number"==typeof t&&null==n&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if("Point"==e.constructor.name){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return(new r).constructor.name+"[x="+this.x+",y="+this.y+"]"},e.exports=r},function(e,t,n){function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,null!=e&&null!=t&&null!=n&&null!=r&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r},function(e,t,n){var 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};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:(null!=e.uniqueID||(e.uniqueID=i.getString(),i.lastID++),e.uniqueID)},i.getString=function(e){return null==e&&(e=i.lastID),"Object#"+e},i.isPrimitive=function(e){var t=void 0===e?"undefined":r(e);return null==e||"object"!=t&&"function"!=t},e.exports=i},function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(0),a=n(7),o=n(3),s=n(1),l=n(6),u=n(5),c=n(17),h=n(29);function d(e){h.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,null!=e&&(this.isRemoteUse=e)}d.RANDOM_SEED=1,d.prototype=Object.create(h.prototype),d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},d.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},d.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},d.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},d.prototype.newGraph=function(e){return new l(null,this.graphManager,e)},d.prototype.newNode=function(e){return new o(this.graphManager,e)},d.prototype.newEdge=function(e){return new s(null,null,e)},d.prototype.checkLayoutSuccess=function(){return null==this.graphManager.getRoot()||0==this.graphManager.getRoot().getNodes().length||this.graphManager.includesInvalidEdge()},d.prototype.runLayout=function(){var e;return this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters(),e=!this.checkLayoutSuccess()&&this.layout(),"during"!==i.ANIMATE&&(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},d.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},d.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];var n=this.graphManager.getRoot().getNodes();for(t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},d.prototype.update=function(e){if(null==e)this.update2();else if(e instanceof o){var t=e;if(null!=t.getChild())for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);null!=t.vGraphObject&&t.vGraphObject.update(t)}else if(e instanceof s){var i=e;null!=i.vGraphObject&&i.vGraphObject.update(i)}else if(e instanceof l){var a=e;null!=a.vGraphObject&&a.vGraphObject.update(a)}},d.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},d.prototype.transform=function(e){if(null==e)this.transform(new u(0,0));else{var t=new c,n=this.graphManager.getRoot().updateLeftTop();if(null!=n){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i=0;i<r.length;i++)r[i].transform(t)}}},d.prototype.positionNodesRandomly=function(e){if(null==e)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)null==(n=(t=r[i]).getChild())||0==n.getNodes().length?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},d.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)null!=n[a].getChild()&&(i=!1);if(!i)return e;var o=new Set,s=[],l=new Map,u=[];for(u=u.concat(n);u.length>0&&t;){for(s.push(u[0]);s.length>0&&t;){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a<h.length;a++){var d=h[a].getOtherEnd(c);if(l.get(c)!=d){if(o.has(d)){t=!1;break}s.push(d),l.set(d,c)}}}if(t){var f=[].concat(r(o));for(e.push(f),a=0;a<f.length;a++){var g=f[a],p=u.indexOf(g);p>-1&&u.splice(p,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}return o=this.newEdge(null),this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},d.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys())).concat(e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new u(o.getCenterX(),o.getCenterY()),l=n.bendpoints.get(a);l.x=s.x,l.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},d.transform=function(e,t,n,r){if(null!=n&&null!=r){var i=t;return e<=50?i-=(t-t/n)/50*(50-e):i+=(t*r-t)/50*(e-50),i}var a,o;return e<=50?(a=9*t/500,o=t/10):(a=9*t/50,o=-8*t),a*e+o},d.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;1!=t.length&&2!=t.length||(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=(c=t[o]).getNeighborsList().size;r.set(c,c.getNeighborsList().size),1==s&&n.push(c)}var l=[];for(l=l.concat(n);!i;){var u=[];for(u=u.concat(l),l=[],o=0;o<t.length;o++){var c=t[o],h=t.indexOf(c);h>=0&&t.splice(h,1),c.getNeighborsList().forEach(function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;1==t&&l.push(e),r.set(e,t)}})}n=n.concat(l),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){var r=n(5);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){var r=n(15),i=n(4),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l,u=this.getGraphManager().getAllEdges(),c=0;c<u.length;c++)t=(e=u[c]).idealLength,e.isInterGraph&&(r=e.getSource(),o=e.getTarget(),s=e.getSourceInLca().getEstimatedSize(),l=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=s+l-2*a.SIMPLE_NODE_SIZE),n=e.getLca().getInclusionTreeDepth(),e.idealLength+=t*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(r.getInclusionTreeDepth()+o.getInclusionTreeDepth()-2*n))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n<t.length;n++)e=t[n],this.calcSpringForce(e,e.idealLength)},l.prototype.calcRepulsionForces=function(){var e,t,n,r,a,o=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e<l.length;e++)n=l[e],this.calculateRepulsionForceOfANode(n,a,o,s),a.add(n);else for(e=0;e<l.length;e++)for(n=l[e],t=e+1;t<l.length;t++)r=l[t],n.getOwner()==r.getOwner()&&this.calcRepulsionForce(n,r)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t=0;t<e.length;t++)e[t].move()},l.prototype.calcSpringForce=function(e,t){var n,r,i,a,o=e.getSource(),s=e.getTarget();if(this.uniformLeafNodeSizes&&null==o.getChild()&&null==s.getChild())e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;0!=(n=e.getLength())&&(i=(r=e.edgeElasticity*(n-t))*(e.lengthX/n),a=r*(e.lengthY/n),o.springForceX+=i,o.springForceY+=a,s.springForceX-=i,s.springForceY-=a)},l.prototype.calcRepulsionForce=function(e,t){var n,r,a,l,u,c,h,d=e.getRect(),f=t.getRect(),g=new Array(2),p=new Array(4);if(d.intersects(f)){o.calcSeparationAmount(d,f,g,i.DEFAULT_EDGE_LENGTH/2),c=2*g[0],h=2*g[1];var v=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=v*c,e.repulsionForceY-=v*h,t.repulsionForceX+=v*c,t.repulsionForceY+=v*h}else this.uniformLeafNodeSizes&&null==e.getChild()&&null==t.getChild()?(n=f.getCenterX()-d.getCenterX(),r=f.getCenterY()-d.getCenterY()):(o.getIntersection(d,f,p),n=p[2]-p[0],r=p[3]-p[1]),Math.abs(n)<i.MIN_REPULSION_DIST&&(n=s.sign(n)*i.MIN_REPULSION_DIST),Math.abs(r)<i.MIN_REPULSION_DIST&&(r=s.sign(r)*i.MIN_REPULSION_DIST),a=n*n+r*r,l=Math.sqrt(a),c=(u=(e.nodeRepulsion/2+t.nodeRepulsion/2)*e.noOfChildren*t.noOfChildren/a)*n/l,h=u*r/l,e.repulsionForceX-=c,e.repulsionForceY-=h,t.repulsionForceX+=c,t.repulsionForceY+=h},l.prototype.calcGravitationalForce=function(e){var t,n,r,i,a,o,s,l;n=((t=e.getOwner()).getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,e.getOwner()==this.graphManager.getRoot()?(o>(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)(e=t[n]).noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t,n;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=new Array(t),i=0;i<t;i++)r[i]=new Array(n);for(i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=new Array;return r},l.prototype.addNodeToGrid=function(e,t,n){var r,i,a,o;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var l=a;l<=o;l++)this.grid[s][l].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,r){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&n||r){var a,o=new Set;e.surrounding=new Array;for(var s=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var u=e.startY-1;u<e.finishY+2;u++)if(!(l<0||u<0||l>=s.length||u>=s[0].length))for(var c=0;c<s[l][u].length;c++)if(a=s[l][u][c],e.getOwner()==a.getOwner()&&e!=a&&!t.has(a)&&!o.has(a)){var h=Math.abs(e.getCenterX()-a.getCenterX())-(e.getWidth()/2+a.getWidth()/2),d=Math.abs(e.getCenterY()-a.getCenterY())-(e.getHeight()/2+a.getHeight()/2);h<=this.repulsionRange&&d<=this.repulsionRange&&o.add(a)}e.surrounding=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l},function(e,t,n){var r=n(1),i=n(4);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH,this.edgeElasticity=i.DEFAULT_SPRING_STRENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a},function(e,t,n){var r=n(3),i=n(4);function a(e,t,n,a){r.call(this,e,t,n,a),this.nodeRepulsion=i.DEFAULT_REPULSION_STRENGTH,this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=a},function(e,t,n){function r(e,t){this.width=0,this.height=0,null!==e&&null!==t&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r},function(e,t,n){var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),null!=this.map[e]},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i},function(e,t,n){var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return 0===this.size()},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i},function(e,t,n){function r(){}r.multMat=function(e,t){for(var n=[],r=0;r<e.length;r++){n[r]=[];for(var i=0;i<t[0].length;i++){n[r][i]=0;for(var a=0;a<e[0].length;a++)n[r][i]+=e[r][a]*t[a][i]}}return n},r.transpose=function(e){for(var t=[],n=0;n<e[0].length;n++){t[n]=[];for(var r=0;r<e.length;r++)t[n][r]=e[r][n]}return t},r.multCons=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]*t;return n},r.minusOp=function(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=e[r]-t[r];return n},r.dotProduct=function(e,t){for(var n=0,r=0;r<e.length;r++)n+=e[r]*t[r];return n},r.mag=function(e){return Math.sqrt(this.dotProduct(e,e))},r.normalize=function(e){for(var t=[],n=this.mag(e),r=0;r<e.length;r++)t[r]=e[r]/n;return t},r.multGamma=function(e){for(var t=[],n=0,r=0;r<e.length;r++)n+=e[r];n*=-1/e.length;for(var i=0;i<e.length;i++)t[i]=n+e[i];return t},r.multL=function(e,t,n){for(var r=[],i=[],a=[],o=0;o<t[0].length;o++){for(var s=0,l=0;l<t.length;l++)s+=-.5*t[l][o]*e[l];i[o]=s}for(var u=0;u<n.length;u++){for(var c=0,h=0;h<n.length;h++)c+=n[u][h]*i[h];a[u]=c}for(var d=0;d<t.length;d++){for(var f=0,g=0;g<t[0].length;g++)f+=t[d][g]*a[g];r[d]=f}return r},e.exports=r},function(e,t,n){var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(11),a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),null===n&&void 0===n||(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof i?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:"_quicksort",value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:"_partition",value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(!(i<a))return a;this._swap(e,i,a),i++,a--}}},{key:"_get",value:function(e,t){return e instanceof i?e.get_object_at(t):e[t]}},{key:"_set",value:function(e,t,n){e instanceof i?e.set_object_at(t,n):e[t]=n}},{key:"_swap",value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:"_defaultCompareFunction",value:function(e,t){return t>e}}]),e}();e.exports=a},function(e,t,n){function r(){}r.svd=function(e){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=e.length,this.n=e[0].length;var t=Math.min(this.m,this.n);this.s=function(e){for(var t=[];e-- >0;)t.push(0);return t}(Math.min(this.m+1,this.n)),this.U=function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}([this.m,t]),this.V=function(e){return function e(t){if(0==t.length)return 0;for(var n=[],r=0;r<t[0];r++)n.push(e(t.slice(1)));return n}(e)}([this.n,this.n]);for(var n=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.n),i=function(e){for(var t=[];e-- >0;)t.push(0);return t}(this.m),a=Math.min(this.m-1,this.n),o=Math.max(0,Math.min(this.n-2,this.m)),s=0;s<Math.max(a,o);s++){if(s<a){this.s[s]=0;for(var l=s;l<this.m;l++)this.s[s]=r.hypot(this.s[s],e[l][s]);if(0!==this.s[s]){e[s][s]<0&&(this.s[s]=-this.s[s]);for(var u=s;u<this.m;u++)e[u][s]/=this.s[s];e[s][s]+=1}this.s[s]=-this.s[s]}for(var c=s+1;c<this.n;c++){if(function(e,t){return e&&t}(s<a,0!==this.s[s])){for(var h=0,d=s;d<this.m;d++)h+=e[d][s]*e[d][c];h=-h/e[s][s];for(var f=s;f<this.m;f++)e[f][c]+=h*e[f][s]}n[c]=e[s][c]}if(function(e,t){return t}(0,s<a))for(var g=s;g<this.m;g++)this.U[g][s]=e[g][s];if(s<o){n[s]=0;for(var p=s+1;p<this.n;p++)n[s]=r.hypot(n[s],n[p]);if(0!==n[s]){n[s+1]<0&&(n[s]=-n[s]);for(var v=s+1;v<this.n;v++)n[v]/=n[s];n[s+1]+=1}if(n[s]=-n[s],function(e,t){return e&&t}(s+1<this.m,0!==n[s])){for(var y=s+1;y<this.m;y++)i[y]=0;for(var m=s+1;m<this.n;m++)for(var b=s+1;b<this.m;b++)i[b]+=n[m]*e[b][m];for(var x=s+1;x<this.n;x++)for(var w=-n[x]/n[s+1],E=s+1;E<this.m;E++)e[E][x]+=w*i[E]}for(var T=s+1;T<this.n;T++)this.V[T][s]=n[T]}}var _=Math.min(this.n,this.m+1);a<this.n&&(this.s[a]=e[a][a]),this.m<_&&(this.s[_-1]=0),o+1<_&&(n[o]=e[o][_-1]),n[_-1]=0;for(var C=a;C<t;C++){for(var N=0;N<this.m;N++)this.U[N][C]=0;this.U[C][C]=1}for(var A=a-1;A>=0;A--)if(0!==this.s[A]){for(var M=A+1;M<t;M++){for(var D=0,k=A;k<this.m;k++)D+=this.U[k][A]*this.U[k][M];D=-D/this.U[A][A];for(var I=A;I<this.m;I++)this.U[I][M]+=D*this.U[I][A]}for(var P=A;P<this.m;P++)this.U[P][A]=-this.U[P][A];this.U[A][A]=1+this.U[A][A];for(var S=0;S<A-1;S++)this.U[S][A]=0}else{for(var L=0;L<this.m;L++)this.U[L][A]=0;this.U[A][A]=1}for(var O=this.n-1;O>=0;O--){if(function(e,t){return e&&t}(O<o,0!==n[O]))for(var R=O+1;R<t;R++){for(var B=0,F=O+1;F<this.n;F++)B+=this.V[F][O]*this.V[F][R];B=-B/this.V[O+1][O];for(var z=O+1;z<this.n;z++)this.V[z][R]+=B*this.V[z][O]}for(var V=0;V<this.n;V++)this.V[V][O]=0;this.V[O][O]=1}for(var G=_-1,Y=Math.pow(2,-52),X=Math.pow(2,-966);_>0;){var U=void 0,j=void 0;for(U=_-2;U>=-1&&-1!==U;U--)if(Math.abs(n[U])<=X+Y*(Math.abs(this.s[U])+Math.abs(this.s[U+1]))){n[U]=0;break}if(U===_-2)j=4;else{var H=void 0;for(H=_-1;H>=U&&H!==U;H--){var W=(H!==_?Math.abs(n[H]):0)+(H!==U+1?Math.abs(n[H-1]):0);if(Math.abs(this.s[H])<=X+Y*W){this.s[H]=0;break}}H===U?j=3:H===_-1?j=1:(j=2,U=H)}switch(U++,j){case 1:var q=n[_-2];n[_-2]=0;for(var K=_-2;K>=U;K--){var Z=r.hypot(this.s[K],q),$=this.s[K]/Z,Q=q/Z;this.s[K]=Z,K!==U&&(q=-Q*n[K-1],n[K-1]=$*n[K-1]);for(var J=0;J<this.n;J++)Z=$*this.V[J][K]+Q*this.V[J][_-1],this.V[J][_-1]=-Q*this.V[J][K]+$*this.V[J][_-1],this.V[J][K]=Z}break;case 2:var ee=n[U-1];n[U-1]=0;for(var te=U;te<_;te++){var ne=r.hypot(this.s[te],ee),re=this.s[te]/ne,ie=ee/ne;this.s[te]=ne,ee=-ie*n[te],n[te]=re*n[te];for(var ae=0;ae<this.m;ae++)ne=re*this.U[ae][te]+ie*this.U[ae][U-1],this.U[ae][U-1]=-ie*this.U[ae][te]+re*this.U[ae][U-1],this.U[ae][te]=ne}break;case 3:var oe=Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[_-1]),Math.abs(this.s[_-2])),Math.abs(n[_-2])),Math.abs(this.s[U])),Math.abs(n[U])),se=this.s[_-1]/oe,le=this.s[_-2]/oe,ue=n[_-2]/oe,ce=this.s[U]/oe,he=n[U]/oe,de=((le+se)*(le-se)+ue*ue)/2,fe=se*ue*(se*ue),ge=0;(function(e,t){return e||t})(0!==de,0!==fe)&&(ge=Math.sqrt(de*de+fe),de<0&&(ge=-ge),ge=fe/(de+ge));for(var pe=(ce+se)*(ce-se)+ge,ve=ce*he,ye=U;ye<_-1;ye++){var me=r.hypot(pe,ve),be=pe/me,xe=ve/me;ye!==U&&(n[ye-1]=me),pe=be*this.s[ye]+xe*n[ye],n[ye]=be*n[ye]-xe*this.s[ye],ve=xe*this.s[ye+1],this.s[ye+1]=be*this.s[ye+1];for(var we=0;we<this.n;we++)me=be*this.V[we][ye]+xe*this.V[we][ye+1],this.V[we][ye+1]=-xe*this.V[we][ye]+be*this.V[we][ye+1],this.V[we][ye]=me;if(be=pe/(me=r.hypot(pe,ve)),xe=ve/me,this.s[ye]=me,pe=be*n[ye]+xe*this.s[ye+1],this.s[ye+1]=-xe*n[ye]+be*this.s[ye+1],ve=xe*n[ye+1],n[ye+1]=be*n[ye+1],ye<this.m-1)for(var Ee=0;Ee<this.m;Ee++)me=be*this.U[Ee][ye]+xe*this.U[Ee][ye+1],this.U[Ee][ye+1]=-xe*this.U[Ee][ye]+be*this.U[Ee][ye+1],this.U[Ee][ye]=me}n[_-2]=pe;break;case 4:if(this.s[U]<=0){this.s[U]=this.s[U]<0?-this.s[U]:0;for(var Te=0;Te<=G;Te++)this.V[Te][U]=-this.V[Te][U]}for(;U<G&&!(this.s[U]>=this.s[U+1]);){var _e=this.s[U];if(this.s[U]=this.s[U+1],this.s[U+1]=_e,U<this.n-1)for(var Ce=0;Ce<this.n;Ce++)_e=this.V[Ce][U+1],this.V[Ce][U+1]=this.V[Ce][U],this.V[Ce][U]=_e;if(U<this.m-1)for(var Ne=0;Ne<this.m;Ne++)_e=this.U[Ne][U+1],this.U[Ne][U+1]=this.U[Ne][U],this.U[Ne][U]=_e;U++}_--}}return{U:this.U,V:this.V,S:this.s}},r.hypot=function(e,t){var n=void 0;return Math.abs(e)>Math.abs(t)?(n=t/e,n=Math.abs(e)*Math.sqrt(1+n*n)):0!=t?(n=e/t,n=Math.abs(t)*Math.sqrt(1+n*n)):n=0,n},e.exports=r},function(e,t,n){var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var o=0;o<this.iMax;o++){this.grid[o]=new Array(this.jMax);for(var s=0;s<this.jMax;s++)this.grid[o][s]=0}this.tracebackGrid=new Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=new Array(this.jMax);for(var u=0;u<this.jMax;u++)this.tracebackGrid[l][u]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=[this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty,this.grid[n-1][r]+this.gap_penalty,this.grid[n][r-1]+this.gap_penalty],a=this.arrayAllMaxIndexes(i);this.grid[n][r]=i[a[0]],this.tracebackGrid[n][r]=[a.includes(0),a.includes(1),a.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:"-"+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:"-"+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),0===t.pos[0]&&0===t.pos[1]&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:"getAllIndexes",value:function(e,t){for(var n=[],r=-1;-1!==(r=e.indexOf(t,r+1));)n.push(r);return n}},{key:"arrayAllMaxIndexes",value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}();e.exports=i},function(e,t,n){var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(4),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(5),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(25),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(6),r.LEdge=n(1),r.LGraphManager=n(7),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(27),r.Matrix=n(24),r.SVD=n(26),e.exports=r},function(e,t,n){function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r}])},lv.exports=e());var e}var cv;function hv(){return cv?sv.exports:(cv=1,e=function(e){return t={45:(e,t,n)=>{var r={};r.layoutBase=n(551),r.CoSEConstants=n(806),r.CoSEEdge=n(767),r.CoSEGraph=n(880),r.CoSEGraphManager=n(578),r.CoSELayout=n(765),r.CoSENode=n(991),r.ConstraintHandler=n(902),e.exports=r},806:(e,t,n)=>{var r=n(551).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,i.ENFORCE_CONSTRAINTS=!0,i.APPLY_LAYOUT=!0,i.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,i.TREE_REDUCTION_ON_INCREMENTAL=!0,i.PURE_INCREMENTAL=i.DEFAULT_INCREMENTAL,e.exports=i},767:(e,t,n)=>{var r=n(551).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},880:(e,t,n)=>{var r=n(551).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},578:(e,t,n)=>{var r=n(551).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},765:(e,t,n)=>{var r=n(551).FDLayout,i=n(578),a=n(880),o=n(991),s=n(767),l=n(806),u=n(902),c=n(551).FDLayoutConstants,h=n(551).LayoutConstants,d=n(551).Point,f=n(551).PointD,g=n(551).DimensionD,p=n(551).Layout,v=n(551).Integer,y=n(551).IGeometry,m=n(551).LGraph,b=n(551).Transform,x=n(551).LinkedList;function w(){r.call(this),this.toBeTiled={},this.constraints={}}for(var E in w.prototype=Object.create(r.prototype),r)w[E]=r[E];w.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},w.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},w.prototype.newNode=function(e){return new o(this.graphManager,e)},w.prototype.newEdge=function(e){return new s(null,null,e)},w.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(l.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=l.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=c.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=c.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},w.prototype.initSpringEmbedder=function(){r.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/c.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},w.prototype.layout=function(){return h.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},w.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental)l.TREE_REDUCTION_ON_INCREMENTAL&&(this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation(),t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)}),this.graphManager.setAllNodesToApplyGravitation(n));else{var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(u.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),l.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},w.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%c.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),l.PURE_INCREMENTAL?this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),l.PURE_INCREMENTAL?this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=c.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},w.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if("during"===c.ANIMATE)this.emit("layoutstarted");else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},w.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t=0;t<e.length;t++)e[t].calculateDisplacement();for(Object.keys(this.constraints).length>0&&this.updateDisplacements(),t=0;t<e.length;t++)e[t].move()},w.prototype.initConstraintVariables=function(){var e=this;this.idToNodeMap=new Map,this.fixedNodeSet=new Set;for(var t=this.graphManager.getAllNodes(),n=0;n<t.length;n++){var r=t[n];this.idToNodeMap.set(r.id,r)}var i=function t(n){for(var r,i=n.getChild().getNodes(),a=0,o=0;o<i.length;o++)null==(r=i[o]).getChild()?e.fixedNodeSet.has(r.id)&&(a+=100):a+=t(r);return a};if(this.constraints.fixedNodeConstraint)for(this.constraints.fixedNodeConstraint.forEach(function(t){e.fixedNodeSet.add(t.nodeId)}),t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)if(null!=(r=t[n]).getChild()){var a=i(r);a>0&&(r.fixedNodeWeight=a)}if(this.constraints.relativePlacementConstraint){var o=new Map,s=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(t){e.fixedNodesOnHorizontal.add(t),e.fixedNodesOnVertical.add(t)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical){var u=this.constraints.alignmentConstraint.vertical;for(n=0;n<u.length;n++)this.dummyToNodeForVerticalAlignment.set("dummy"+n,[]),u[n].forEach(function(t){o.set(t,"dummy"+n),e.dummyToNodeForVerticalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnHorizontal.add("dummy"+n)})}if(this.constraints.alignmentConstraint.horizontal){var c=this.constraints.alignmentConstraint.horizontal;for(n=0;n<c.length;n++)this.dummyToNodeForHorizontalAlignment.set("dummy"+n,[]),c[n].forEach(function(t){s.set(t,"dummy"+n),e.dummyToNodeForHorizontalAlignment.get("dummy"+n).push(t),e.fixedNodeSet.has(t)&&e.fixedNodesOnVertical.add("dummy"+n)})}}if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.shuffle=function(e){var t,n,r;for(r=e.length-1;r>=2*e.length/3;r--)t=Math.floor(Math.random()*(r+1)),n=e[r],e[r]=e[t],e[t]=n;return e},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(t){if(t.left){var n=o.has(t.left)?o.get(t.left):t.left,r=o.has(t.right)?o.get(t.right):t.right;e.nodesInRelativeHorizontal.includes(n)||(e.nodesInRelativeHorizontal.push(n),e.nodeToRelativeConstraintMapHorizontal.set(n,[]),e.dummyToNodeForVerticalAlignment.has(n)?e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(n)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(n,e.idToNodeMap.get(n).getCenterX())),e.nodesInRelativeHorizontal.includes(r)||(e.nodesInRelativeHorizontal.push(r),e.nodeToRelativeConstraintMapHorizontal.set(r,[]),e.dummyToNodeForVerticalAlignment.has(r)?e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(r)[0]).getCenterX()):e.nodeToTempPositionMapHorizontal.set(r,e.idToNodeMap.get(r).getCenterX())),e.nodeToRelativeConstraintMapHorizontal.get(n).push({right:r,gap:t.gap}),e.nodeToRelativeConstraintMapHorizontal.get(r).push({left:n,gap:t.gap})}else{var i=s.has(t.top)?s.get(t.top):t.top,a=s.has(t.bottom)?s.get(t.bottom):t.bottom;e.nodesInRelativeVertical.includes(i)||(e.nodesInRelativeVertical.push(i),e.nodeToRelativeConstraintMapVertical.set(i,[]),e.dummyToNodeForHorizontalAlignment.has(i)?e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(i)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(i,e.idToNodeMap.get(i).getCenterY())),e.nodesInRelativeVertical.includes(a)||(e.nodesInRelativeVertical.push(a),e.nodeToRelativeConstraintMapVertical.set(a,[]),e.dummyToNodeForHorizontalAlignment.has(a)?e.nodeToTempPositionMapVertical.set(a,e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(a)[0]).getCenterY()):e.nodeToTempPositionMapVertical.set(a,e.idToNodeMap.get(a).getCenterY())),e.nodeToRelativeConstraintMapVertical.get(i).push({bottom:a,gap:t.gap}),e.nodeToRelativeConstraintMapVertical.get(a).push({top:i,gap:t.gap})}});else{var h=new Map,d=new Map;this.constraints.relativePlacementConstraint.forEach(function(e){if(e.left){var t=o.has(e.left)?o.get(e.left):e.left,n=o.has(e.right)?o.get(e.right):e.right;h.has(t)?h.get(t).push(n):h.set(t,[n]),h.has(n)?h.get(n).push(t):h.set(n,[t])}else{var r=s.has(e.top)?s.get(e.top):e.top,i=s.has(e.bottom)?s.get(e.bottom):e.bottom;d.has(r)?d.get(r).push(i):d.set(r,[i]),d.has(i)?d.get(i).push(r):d.set(i,[r])}});var f=function(e,t){var n=[],r=[],i=new x,a=new Set,o=0;return e.forEach(function(s,l){if(!a.has(l)){n[o]=[],r[o]=!1;var u=l;for(i.push(u),a.add(u),n[o].push(u);0!=i.length;)u=i.shift(),t.has(u)&&(r[o]=!0),e.get(u).forEach(function(e){a.has(e)||(i.push(e),a.add(e),n[o].push(e))});o++}}),{components:n,isFixed:r}},g=f(h,e.fixedNodesOnHorizontal);this.componentsOnHorizontal=g.components,this.fixedComponentsOnHorizontal=g.isFixed;var p=f(d,e.fixedNodesOnVertical);this.componentsOnVertical=p.components,this.fixedComponentsOnVertical=p.isFixed}}},w.prototype.updateDisplacements=function(){var e=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function(t){var n=e.idToNodeMap.get(t.nodeId);n.displacementX=0,n.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var t=this.constraints.alignmentConstraint.vertical,n=0;n<t.length;n++){for(var r=0,i=0;i<t[n].length;i++){if(this.fixedNodeSet.has(t[n][i])){r=0;break}r+=this.idToNodeMap.get(t[n][i]).displacementX}var a=r/t[n].length;for(i=0;i<t[n].length;i++)this.idToNodeMap.get(t[n][i]).displacementX=a}if(this.constraints.alignmentConstraint.horizontal){var o=this.constraints.alignmentConstraint.horizontal;for(n=0;n<o.length;n++){var s=0;for(i=0;i<o[n].length;i++){if(this.fixedNodeSet.has(o[n][i])){s=0;break}s+=this.idToNodeMap.get(o[n][i]).displacementY}var u=s/o[n].length;for(i=0;i<o[n].length;i++)this.idToNodeMap.get(o[n][i]).displacementY=u}}}if(this.constraints.relativePlacementConstraint)if(l.RELAX_MOVEMENT_ON_CONSTRAINTS)this.totalIterations%10==0&&(this.shuffle(this.nodesInRelativeHorizontal),this.shuffle(this.nodesInRelativeVertical)),this.nodesInRelativeHorizontal.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForVerticalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForVerticalAlignment.get(t)[0]).displacementX:e.idToNodeMap.get(t).displacementX,e.nodeToRelativeConstraintMapHorizontal.get(t).forEach(function(r){var i;r.right?(i=e.nodeToTempPositionMapHorizontal.get(r.right)-e.nodeToTempPositionMapHorizontal.get(t)-n)<r.gap&&(n-=r.gap-i):(i=e.nodeToTempPositionMapHorizontal.get(t)-e.nodeToTempPositionMapHorizontal.get(r.left)+n)<r.gap&&(n+=r.gap-i)}),e.nodeToTempPositionMapHorizontal.set(t,e.nodeToTempPositionMapHorizontal.get(t)+n),e.dummyToNodeForVerticalAlignment.has(t)?e.dummyToNodeForVerticalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementX=n}):e.idToNodeMap.get(t).displacementX=n}}),this.nodesInRelativeVertical.forEach(function(t){if(!e.fixedNodesOnHorizontal.has(t)){var n=0;n=e.dummyToNodeForHorizontalAlignment.has(t)?e.idToNodeMap.get(e.dummyToNodeForHorizontalAlignment.get(t)[0]).displacementY:e.idToNodeMap.get(t).displacementY,e.nodeToRelativeConstraintMapVertical.get(t).forEach(function(r){var i;r.bottom?(i=e.nodeToTempPositionMapVertical.get(r.bottom)-e.nodeToTempPositionMapVertical.get(t)-n)<r.gap&&(n-=r.gap-i):(i=e.nodeToTempPositionMapVertical.get(t)-e.nodeToTempPositionMapVertical.get(r.top)+n)<r.gap&&(n+=r.gap-i)}),e.nodeToTempPositionMapVertical.set(t,e.nodeToTempPositionMapVertical.get(t)+n),e.dummyToNodeForHorizontalAlignment.has(t)?e.dummyToNodeForHorizontalAlignment.get(t).forEach(function(t){e.idToNodeMap.get(t).displacementY=n}):e.idToNodeMap.get(t).displacementY=n}});else{for(n=0;n<this.componentsOnHorizontal.length;n++){var c=this.componentsOnHorizontal[n];if(this.fixedComponentsOnHorizontal[n])for(i=0;i<c.length;i++)this.dummyToNodeForVerticalAlignment.has(c[i])?this.dummyToNodeForVerticalAlignment.get(c[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=0}):this.idToNodeMap.get(c[i]).displacementX=0;else{var h=0,d=0;for(i=0;i<c.length;i++)this.dummyToNodeForVerticalAlignment.has(c[i])?(h+=(g=this.dummyToNodeForVerticalAlignment.get(c[i])).length*this.idToNodeMap.get(g[0]).displacementX,d+=g.length):(h+=this.idToNodeMap.get(c[i]).displacementX,d++);var f=h/d;for(i=0;i<c.length;i++)this.dummyToNodeForVerticalAlignment.has(c[i])?this.dummyToNodeForVerticalAlignment.get(c[i]).forEach(function(t){e.idToNodeMap.get(t).displacementX=f}):this.idToNodeMap.get(c[i]).displacementX=f}}for(n=0;n<this.componentsOnVertical.length;n++)if(c=this.componentsOnVertical[n],this.fixedComponentsOnVertical[n])for(i=0;i<c.length;i++)this.dummyToNodeForHorizontalAlignment.has(c[i])?this.dummyToNodeForHorizontalAlignment.get(c[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=0}):this.idToNodeMap.get(c[i]).displacementY=0;else{for(h=0,d=0,i=0;i<c.length;i++){var g;this.dummyToNodeForHorizontalAlignment.has(c[i])?(h+=(g=this.dummyToNodeForHorizontalAlignment.get(c[i])).length*this.idToNodeMap.get(g[0]).displacementY,d+=g.length):(h+=this.idToNodeMap.get(c[i]).displacementY,d++)}for(f=h/d,i=0;i<c.length;i++)this.dummyToNodeForHorizontalAlignment.has(c[i])?this.dummyToNodeForHorizontalAlignment.get(c[i]).forEach(function(t){e.idToNodeMap.get(t).displacementY=f}):this.idToNodeMap.get(c[i]).displacementY=f}}},w.prototype.calculateNodesToApplyGravitationTo=function(){var e,t,n=[],r=this.graphManager.getGraphs(),i=r.length;for(t=0;t<i;t++)(e=r[t]).updateConnected(),e.isConnected||(n=n.concat(e.getNodes()));return n},w.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t,n=new Set;for(t=0;t<e.length;t++){var r=e[t];if(!n.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new f),r.getBendpoints().push(new f),this.createDummyNodesForBendpoints(r),n.add(r);else{var o=[];if(o=(o=o.concat(i.getEdgeListToNode(a))).concat(a.getEdgeListToNode(i)),!n.has(o[0])){var s;if(o.length>1)for(s=0;s<o.length;s++){var l=o[s];l.getBendpoints().push(new f),this.createDummyNodesForBendpoints(l)}o.forEach(function(e){n.add(e)})}}}if(n.size==e.length)break}},w.prototype.positionNodesRadially=function(e){for(var t=new d(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,0!=s&&(i+=l.DEFAULT_COMPONENT_SEPERATION),r=0);var u=e[s],c=p.findCenterOfTree(u);t.x=a,t.y=i,(o=w.radialLayout(u,c,t)).y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(h.WORLD_CENTER_X-o.x/2,h.WORLD_CENTER_Y-o.y/2))},w.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(t,null,0,359,0,r);var i=m.calculateBounds(e),a=new b;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},w.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360*y.TWO_PI/360,l=i*Math.cos(s),u=i*Math.sin(s);e.setCenter(l,u);var c=[],h=(c=c.concat(e.getEdges())).length;null!=t&&h--;for(var d,f=0,g=c.length,p=e.getEdgesBetween(t);p.length>1;){var v=p[0];p.splice(0,1);var m=c.indexOf(v);m>=0&&c.splice(m,1),g--,h--}d=null!=t?(c.indexOf(p[0])+1)%g:0;for(var b=Math.abs(r-n)/h,x=d;f!=h;x=++x%g){var E=c[x].getOtherEnd(e);if(E!=t){var T=(n+f*b)%360,_=(T+b)%360;w.branchRadialLayout(E,e,T,_,i+a,a),f++}}},w.maxDiagonalInTree=function(e){for(var t=v.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=(s=r[i]).getParent();0!==this.getNodeDegreeWithChildren(s)||null!=a.id&&this.getToBeTiled(a)||n.push(s)}for(i=0;i<n.length;i++){var s,l=(s=n[i]).getParent().id;void 0===t[l]&&(t[l]=[]),t[l]=t[l].concat(s)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u<t[n].length;u++){var c=t[n][u];l.remove(c),s.add(c)}}})},w.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},w.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];if(t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height,r.setCenter(t[n].centerX,t[n].centerY),r.labelMarginLeft=0,r.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var i=r.rect.width,a=r.rect.height;r.labelWidth&&("left"==r.labelPosHorizontal?(r.rect.x-=r.labelWidth,r.setWidth(i+r.labelWidth),r.labelMarginLeft=r.labelWidth):"center"==r.labelPosHorizontal&&r.labelWidth>i?(r.rect.x-=(r.labelWidth-i)/2,r.setWidth(r.labelWidth),r.labelMarginLeft=(r.labelWidth-i)/2):"right"==r.labelPosHorizontal&&r.setWidth(i+r.labelWidth)),r.labelHeight&&("top"==r.labelPosVertical?(r.rect.y-=r.labelHeight,r.setHeight(a+r.labelHeight),r.labelMarginTop=r.labelHeight):"center"==r.labelPosVertical&&r.labelHeight>a?(r.rect.y-=(r.labelHeight-a)/2,r.setHeight(r.labelHeight),r.labelMarginTop=(r.labelHeight-a)/2):"bottom"==r.labelPosVertical&&r.setHeight(a+r.labelHeight))}})},w.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop,a=t.labelMarginLeft,o=t.labelMarginTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i,a,o)}},w.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop,o=r.labelMarginLeft,s=r.labelMarginTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a,o,s)})},w.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},w.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},w.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(null==e.getChild())return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},w.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},w.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];null!=n.getChild()&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},w.prototype.adjustLocations=function(e,t,n,r,i,a,o){n+=i+o;for(var s=t+=r+a,l=0;l<e.rows.length;l++){var u=e.rows[l];t=s;for(var c=0,h=0;h<u.length;h++){var d=u[h];d.rect.x=t,d.rect.y=n,t+=d.rect.width+e.horizontalPadding,d.rect.height>c&&(c=d.rect.height)}n+=c+e.verticalPadding}},w.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];if(n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height,i.setCenter(n.tiledMemberPack[r].centerX,n.tiledMemberPack[r].centerY),i.labelMarginLeft=0,i.labelMarginTop=0,l.NODE_DIMENSIONS_INCLUDE_LABELS){var a=i.rect.width,o=i.rect.height;i.labelWidth&&("left"==i.labelPosHorizontal?(i.rect.x-=i.labelWidth,i.setWidth(a+i.labelWidth),i.labelMarginLeft=i.labelWidth):"center"==i.labelPosHorizontal&&i.labelWidth>a?(i.rect.x-=(i.labelWidth-a)/2,i.setWidth(i.labelWidth),i.labelMarginLeft=(i.labelWidth-a)/2):"right"==i.labelPosHorizontal&&i.setWidth(a+i.labelWidth)),i.labelHeight&&("top"==i.labelPosVertical?(i.rect.y-=i.labelHeight,i.setHeight(o+i.labelHeight),i.labelMarginTop=i.labelHeight):"center"==i.labelPosVertical&&i.labelHeight>o?(i.rect.y-=(i.labelHeight-o)/2,i.setHeight(i.labelHeight),i.labelMarginTop=(i.labelHeight-o)/2):"bottom"==i.labelPosVertical&&i.setHeight(o+i.labelHeight))}})},w.prototype.tileNodes=function(e,t){var n=this.tileNodesByFavoringDim(e,t,!0),r=this.tileNodesByFavoringDim(e,t,!1),i=this.getOrgRatio(n);return this.getOrgRatio(r)<i?r:n},w.prototype.getOrgRatio=function(e){var t=e.width/e.height;return t<1&&(t=1/t),t},w.prototype.calcIdealRowWidth=function(e,t){var n=l.TILING_PADDING_VERTICAL,r=l.TILING_PADDING_HORIZONTAL,i=e.length,a=0,o=0,s=0;e.forEach(function(e){a+=e.getWidth(),o+=e.getHeight(),e.getWidth()>s&&(s=e.getWidth())});var u,c=a/i,h=o/i,d=Math.pow(n-r,2)+4*(c+r)*(h+n)*i,f=(r-n+Math.sqrt(d))/(2*(c+r));t?(u=Math.ceil(f))==f&&u++:u=Math.floor(f);var g=u*(c+r)-r;return s>g&&(g=s),g+=2*r},w.prototype.tileNodesByFavoringDim=function(e,t,n){var r=l.TILING_PADDING_VERTICAL,i=l.TILING_PADDING_HORIZONTAL,a=l.TILING_COMPARE_BY,o={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:r,horizontalPadding:i,centerX:0,centerY:0};a&&(o.idealRowWidth=this.calcIdealRowWidth(e,n));var s=function(e){return e.rect.width*e.rect.height},u=function(e,t){return s(t)-s(e)};e.sort(function(e,t){var n=u;return o.idealRowWidth?(n=a)(e.id,t.id):n(e,t)});for(var c=0,h=0,d=0;d<e.length;d++)c+=(f=e[d]).getCenterX(),h+=f.getCenterY();for(o.centerX=c/e.length,o.centerY=h/e.length,d=0;d<e.length;d++){var f=e[d];if(0==o.rows.length)this.insertNodeToRow(o,f,0,t);else if(this.canAddHorizontal(o,f.rect.width,f.rect.height)){var g=o.rows.length-1;o.idealRowWidth||(g=this.getShortestRowIndex(o)),this.insertNodeToRow(o,f,g,t)}else this.insertNodeToRow(o,f,o.rows.length,t);this.shiftToLastRow(o)}return o},w.prototype.insertNodeToRow=function(e,t,n,r){var i=r;n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(i),e.rowHeight.push(0));var a=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width<a&&(e.width=a);var o=t.rect.height;n>0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},w.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},w.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},w.prototype.canAddHorizontal=function(e,t,n){if(e.idealRowWidth){var r=e.rows.length-1;return e.rowWidth[r]+t+e.horizontalPadding<=e.idealRowWidth}var i=this.getShortestRowIndex(e);if(i<0)return!0;var a=e.rowWidth[i];if(a+e.horizontalPadding+t<=e.width)return!0;var o,s,l=0;return e.rowHeight[i]<n&&i>0&&(l=n+e.verticalPadding-e.rowHeight[i]),o=e.width-a>=t+e.horizontalPadding?(e.height+l)/(a+t+e.horizontalPadding):(e.height+l)/e.width,l=n+e.verticalPadding,(s=e.width<t?(e.height+l)/t:(e.height+l)/e.width)<1&&(s=1/s),o<1&&(o=1/o),o<s},w.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var u=e.rowHeight[t]+e.rowHeight[n];e.height+=u-l,this.shiftToLastRow(e)}},w.prototype.tilingPreLayout=function(){l.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},w.prototype.tilingPostLayout=function(){l.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},w.prototype.reduceTrees=function(){for(var e,t=[],n=!0;n;){var r=this.graphManager.getAllNodes(),i=[];n=!1;for(var a=0;a<r.length;a++)if(1==(e=r[a]).getEdges().length&&!e.getEdges()[0].isInterGraph&&null==e.getChild()){if(l.PURE_INCREMENTAL){var o=e.getEdges()[0].getOtherEnd(e),s=new g(e.getCenterX()-o.getCenterX(),e.getCenterY()-o.getCenterY());i.push([e,e.getEdges()[0],e.getOwner(),s])}else i.push([e,e.getEdges()[0],e.getOwner()]);n=!0}if(1==n){for(var u=[],c=0;c<i.length;c++)1==i[c][0].getEdges().length&&(u.push(i[c]),i[c][0].getOwner().remove(i[c][0]));t.push(u),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=t},w.prototype.growTree=function(e){for(var t,n=e[e.length-1],r=0;r<n.length;r++)t=n[r],this.findPlaceforPrunedNode(t),t[2].add(t[0]),t[2].add(t[1],t[1].source,t[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},w.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0];if(n=r==e[1].source?e[1].target:e[1].source,l.PURE_INCREMENTAL)r.setCenter(n.getCenterX()+e[3].getWidth(),n.getCenterY()+e[3].getHeight());else{var i=n.startX,a=n.finishX,o=n.startY,s=n.finishY,u=[0,0,0,0];if(o>0)for(var h=i;h<=a;h++)u[0]+=this.grid[h][o-1].length+this.grid[h][o].length-1;if(a<this.grid.length-1)for(h=o;h<=s;h++)u[1]+=this.grid[a+1][h].length+this.grid[a][h].length-1;if(s<this.grid[0].length-1)for(h=i;h<=a;h++)u[2]+=this.grid[h][s+1].length+this.grid[h][s].length-1;if(i>0)for(h=o;h<=s;h++)u[3]+=this.grid[i-1][h].length+this.grid[i][h].length-1;for(var d,f,g=v.MAX_VALUE,p=0;p<u.length;p++)u[p]<g?(g=u[p],d=1,f=p):u[p]==g&&d++;if(3==d&&0==g)0==u[0]&&0==u[1]&&0==u[2]?t=1:0==u[0]&&0==u[1]&&0==u[3]?t=0:0==u[0]&&0==u[2]&&0==u[3]?t=3:0==u[1]&&0==u[2]&&0==u[3]&&(t=2);else if(2==d&&0==g){var y=Math.floor(2*Math.random());t=0==u[0]&&0==u[1]?0==y?0:1:0==u[0]&&0==u[2]?0==y?0:2:0==u[0]&&0==u[3]?0==y?0:3:0==u[1]&&0==u[2]?0==y?1:2:0==u[1]&&0==u[3]?0==y?1:3:0==y?2:3}else t=4==d&&0==g?y=Math.floor(4*Math.random()):f;0==t?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-c.DEFAULT_EDGE_LENGTH-r.getHeight()/2):1==t?r.setCenter(n.getCenterX()+n.getWidth()/2+c.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):2==t?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+c.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-c.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())}},e.exports=w},991:(e,t,n)=>{var r=n(551).FDLayoutNode,i=n(551).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.calculateDisplacement=function(){var e=this.graphManager.getLayout();null!=this.getChild()&&this.fixedNodeWeight?(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i<r.length;i++)null==(n=r[i]).getChild()?(n.displacementX+=e,n.displacementY+=t):n.propogateDisplacementToChildren(e,t)},a.prototype.move=function(){var e=this.graphManager.getLayout();null!=this.child&&0!=this.child.getNodes().length||(this.moveBy(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY)),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a},902:(e,t,n)=>{function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var i=n(806),a=n(551).LinkedList,o=n(551).Matrix,s=n(551).SVD;function l(){}l.handleConstraints=function(e){var t={};t.fixedNodeConstraint=e.constraints.fixedNodeConstraint,t.alignmentConstraint=e.constraints.alignmentConstraint,t.relativePlacementConstraint=e.constraints.relativePlacementConstraint;for(var n=new Map,l=new Map,u=[],c=[],h=e.getAllNodes(),d=0,f=0;f<h.length;f++){var g=h[f];null==g.getChild()&&(l.set(g.id,d++),u.push(g.getCenterX()),c.push(g.getCenterY()),n.set(g.id,g))}t.relativePlacementConstraint&&t.relativePlacementConstraint.forEach(function(e){e.gap||0==e.gap||(e.left?e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.left).getWidth()/2+n.get(e.right).getWidth()/2:e.gap=i.DEFAULT_EDGE_LENGTH+n.get(e.top).getHeight()/2+n.get(e.bottom).getHeight()/2)});var p=function(e){var t=0,n=0;return e.forEach(function(e){t+=u[l.get(e)],n+=c[l.get(e)]}),{x:t/e.size,y:n/e.size}},v=function(e,t,n,i,o){var s=new Map;e.forEach(function(e,t){s.set(t,0)}),e.forEach(function(e,t){e.forEach(function(e){s.set(e.id,s.get(e.id)+1)})});var h=new Map,d=new Map,f=new a;s.forEach(function(e,r){0==e?(f.push(r),n||("horizontal"==t?h.set(r,l.has(r)?u[l.get(r)]:i.get(r)):h.set(r,l.has(r)?c[l.get(r)]:i.get(r)))):h.set(r,Number.NEGATIVE_INFINITY),n&&d.set(r,new Set([r]))}),n&&o.forEach(function(e){var r=[];if(e.forEach(function(e){n.has(e)&&r.push(e)}),r.length>0){var a=0;r.forEach(function(e){"horizontal"==t?(h.set(e,l.has(e)?u[l.get(e)]:i.get(e)),a+=h.get(e)):(h.set(e,l.has(e)?c[l.get(e)]:i.get(e)),a+=h.get(e))}),a/=r.length,e.forEach(function(e){n.has(e)||h.set(e,a)})}else{var o=0;e.forEach(function(e){o+="horizontal"==t?l.has(e)?u[l.get(e)]:i.get(e):l.has(e)?c[l.get(e)]:i.get(e)}),o/=e.length,e.forEach(function(e){h.set(e,o)})}});for(var g=function(){var r=f.shift();e.get(r).forEach(function(e){if(h.get(e.id)<h.get(r)+e.gap)if(n&&n.has(e.id)){var a=void 0;if(a="horizontal"==t?l.has(e.id)?u[l.get(e.id)]:i.get(e.id):l.has(e.id)?c[l.get(e.id)]:i.get(e.id),h.set(e.id,a),a<h.get(r)+e.gap){var o=h.get(r)+e.gap-a;d.get(r).forEach(function(e){h.set(e,h.get(e)-o)})}}else h.set(e.id,h.get(r)+e.gap);s.set(e.id,s.get(e.id)-1),0==s.get(e.id)&&f.push(e.id),n&&d.set(e.id,function(e,t){var n=new Set(e),r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var l=o.value;n.add(l)}}catch(u){i=!0,a=u}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(d.get(r),d.get(e.id)))})};0!=f.length;)g();if(n){var p=new Set;e.forEach(function(e,t){0==e.length&&p.add(t)});var v=[];d.forEach(function(e,t){if(p.has(t)){var i=!1,a=!0,o=!1,s=void 0;try{for(var l,u=e[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var c=l.value;n.has(c)&&(i=!0)}}catch(f){o=!0,s=f}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}if(!i){var h=!1,d=void 0;v.forEach(function(t,n){t.has([].concat(r(e))[0])&&(h=!0,d=n)}),h?e.forEach(function(e){v[d].add(e)}):v.push(new Set(e))}}}),v.forEach(function(e,n){var r=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=Number.NEGATIVE_INFINITY,d=!0,f=!1,g=void 0;try{for(var p,v=e[Symbol.iterator]();!(d=(p=v.next()).done);d=!0){var y=p.value,m=void 0;m="horizontal"==t?l.has(y)?u[l.get(y)]:i.get(y):l.has(y)?c[l.get(y)]:i.get(y);var b=h.get(y);m<r&&(r=m),m>o&&(o=m),b<a&&(a=b),b>s&&(s=b)}}catch(A){f=!0,g=A}finally{try{!d&&v.return&&v.return()}finally{if(f)throw g}}var x=(r+o)/2-(a+s)/2,w=!0,E=!1,T=void 0;try{for(var _,C=e[Symbol.iterator]();!(w=(_=C.next()).done);w=!0){var N=_.value;h.set(N,h.get(N)+x)}}catch(A){E=!0,T=A}finally{try{!w&&C.return&&C.return()}finally{if(E)throw T}}})}return h},y=function(e){var t=0,n=0,r=0,i=0;if(e.forEach(function(e){e.left?u[l.get(e.left)]-u[l.get(e.right)]>=0?t++:n++:c[l.get(e.top)]-c[l.get(e.bottom)]>=0?r++:i++}),t>n&&r>i)for(var a=0;a<l.size;a++)u[a]=-1*u[a],c[a]=-1*c[a];else if(t>n)for(var o=0;o<l.size;o++)u[o]=-1*u[o];else if(r>i)for(var s=0;s<l.size;s++)c[s]=-1*c[s]},m=function(e){var t=[],n=new a,r=new Set,i=0;return e.forEach(function(a,o){if(!r.has(o)){t[i]=[];var s=o;for(n.push(s),r.add(s),t[i].push(s);0!=n.length;)s=n.shift(),e.get(s).forEach(function(e){r.has(e.id)||(n.push(e.id),r.add(e.id),t[i].push(e.id))});i++}}),t},b=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(n).push(e),t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},x=function(e){var t=new Map;return e.forEach(function(e,n){t.set(n,[])}),e.forEach(function(e,n){e.forEach(function(e){t.get(e.id).push({id:n,gap:e.gap,direction:e.direction})})}),t},w=[],E=[],T=!1,_=!1,C=new Set,N=new Map,A=new Map,M=[];if(t.fixedNodeConstraint&&t.fixedNodeConstraint.forEach(function(e){C.add(e.nodeId)}),t.relativePlacementConstraint&&(t.relativePlacementConstraint.forEach(function(e){e.left?(N.has(e.left)?N.get(e.left).push({id:e.right,gap:e.gap,direction:"horizontal"}):N.set(e.left,[{id:e.right,gap:e.gap,direction:"horizontal"}]),N.has(e.right)||N.set(e.right,[])):(N.has(e.top)?N.get(e.top).push({id:e.bottom,gap:e.gap,direction:"vertical"}):N.set(e.top,[{id:e.bottom,gap:e.gap,direction:"vertical"}]),N.has(e.bottom)||N.set(e.bottom,[]))}),A=b(N),M=m(A)),i.TRANSFORM_ON_CONSTRAINT_HANDLING){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>1)t.fixedNodeConstraint.forEach(function(e,t){w[t]=[e.position.x,e.position.y],E[t]=[u[l.get(e.nodeId)],c[l.get(e.nodeId)]]}),T=!0;else if(t.alignmentConstraint)!function(){var e=0;if(t.alignmentConstraint.vertical){for(var n=t.alignmentConstraint.vertical,i=function(t){var i=new Set;n[t].forEach(function(e){i.add(e)});var a=new Set([].concat(r(i)).filter(function(e){return C.has(e)})),o=void 0;o=a.size>0?u[l.get(a.values().next().value)]:p(i).x,n[t].forEach(function(t){w[e]=[o,c[l.get(t)]],E[e]=[u[l.get(t)],c[l.get(t)]],e++})},a=0;a<n.length;a++)i(a);T=!0}if(t.alignmentConstraint.horizontal){for(var o=t.alignmentConstraint.horizontal,s=function(t){var n=new Set;o[t].forEach(function(e){n.add(e)});var i=new Set([].concat(r(n)).filter(function(e){return C.has(e)})),a=void 0;a=i.size>0?u[l.get(i.values().next().value)]:p(n).y,o[t].forEach(function(t){w[e]=[u[l.get(t)],a],E[e]=[u[l.get(t)],c[l.get(t)]],e++})},h=0;h<o.length;h++)s(h);T=!0}t.relativePlacementConstraint&&(_=!0)}();else if(t.relativePlacementConstraint){for(var D=0,k=0,I=0;I<M.length;I++)M[I].length>D&&(D=M[I].length,k=I);if(D<A.size/2)y(t.relativePlacementConstraint),T=!1,_=!1;else{var P=new Map,S=new Map,L=[];M[k].forEach(function(e){N.get(e).forEach(function(t){"horizontal"==t.direction?(P.has(e)?P.get(e).push(t):P.set(e,[t]),P.has(t.id)||P.set(t.id,[]),L.push({left:e,right:t.id})):(S.has(e)?S.get(e).push(t):S.set(e,[t]),S.has(t.id)||S.set(t.id,[]),L.push({top:e,bottom:t.id}))})}),y(L),_=!1;var O=v(P,"horizontal"),R=v(S,"vertical");M[k].forEach(function(e,t){E[t]=[u[l.get(e)],c[l.get(e)]],w[t]=[],O.has(e)?w[t][0]=O.get(e):w[t][0]=u[l.get(e)],R.has(e)?w[t][1]=R.get(e):w[t][1]=c[l.get(e)]}),T=!0}}if(T){for(var B,F=o.transpose(w),z=o.transpose(E),V=0;V<F.length;V++)F[V]=o.multGamma(F[V]),z[V]=o.multGamma(z[V]);var G=o.multMat(F,o.transpose(z)),Y=s.svd(G);B=o.multMat(Y.V,o.transpose(Y.U));for(var X=0;X<l.size;X++){var U=[u[X],c[X]],j=[B[0][0],B[1][0]],H=[B[0][1],B[1][1]];u[X]=o.dotProduct(U,j),c[X]=o.dotProduct(U,H)}_&&y(t.relativePlacementConstraint)}}if(i.ENFORCE_CONSTRAINTS){if(t.fixedNodeConstraint&&t.fixedNodeConstraint.length>0){var W={x:0,y:0};t.fixedNodeConstraint.forEach(function(e,t){var n,r,i={x:u[l.get(e.nodeId)],y:c[l.get(e.nodeId)]},a=e.position,o=(r=i,{x:(n=a).x-r.x,y:n.y-r.y});W.x+=o.x,W.y+=o.y}),W.x/=t.fixedNodeConstraint.length,W.y/=t.fixedNodeConstraint.length,u.forEach(function(e,t){u[t]+=W.x}),c.forEach(function(e,t){c[t]+=W.y}),t.fixedNodeConstraint.forEach(function(e){u[l.get(e.nodeId)]=e.position.x,c[l.get(e.nodeId)]=e.position.y})}if(t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var q=t.alignmentConstraint.vertical,K=function(e){var t=new Set;q[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return C.has(e)})),i=void 0;i=n.size>0?u[l.get(n.values().next().value)]:p(t).x,t.forEach(function(e){C.has(e)||(u[l.get(e)]=i)})},Z=0;Z<q.length;Z++)K(Z);if(t.alignmentConstraint.horizontal)for(var $=t.alignmentConstraint.horizontal,Q=function(e){var t=new Set;$[e].forEach(function(e){t.add(e)});var n=new Set([].concat(r(t)).filter(function(e){return C.has(e)})),i=void 0;i=n.size>0?c[l.get(n.values().next().value)]:p(t).y,t.forEach(function(e){C.has(e)||(c[l.get(e)]=i)})},J=0;J<$.length;J++)Q(J)}t.relativePlacementConstraint&&function(){var e=new Map,n=new Map,r=new Map,i=new Map,a=new Map,o=new Map,s=new Set,h=new Set;if(C.forEach(function(e){s.add(e),h.add(e)}),t.alignmentConstraint){if(t.alignmentConstraint.vertical)for(var d=t.alignmentConstraint.vertical,f=function(t){r.set("dummy"+t,[]),d[t].forEach(function(n){e.set(n,"dummy"+t),r.get("dummy"+t).push(n),C.has(n)&&s.add("dummy"+t)}),a.set("dummy"+t,u[l.get(d[t][0])])},g=0;g<d.length;g++)f(g);if(t.alignmentConstraint.horizontal)for(var p=t.alignmentConstraint.horizontal,y=function(e){i.set("dummy"+e,[]),p[e].forEach(function(t){n.set(t,"dummy"+e),i.get("dummy"+e).push(t),C.has(t)&&h.add("dummy"+e)}),o.set("dummy"+e,c[l.get(p[e][0])])},w=0;w<p.length;w++)y(w)}var E=new Map,T=new Map,_=function(t){N.get(t).forEach(function(r){var i=void 0,a=void 0;"horizontal"==r.direction?(i=e.get(t)?e.get(t):t,a=e.get(r.id)?{id:e.get(r.id),gap:r.gap,direction:r.direction}:r,E.has(i)?E.get(i).push(a):E.set(i,[a]),E.has(a.id)||E.set(a.id,[])):(i=n.get(t)?n.get(t):t,a=n.get(r.id)?{id:n.get(r.id),gap:r.gap,direction:r.direction}:r,T.has(i)?T.get(i).push(a):T.set(i,[a]),T.has(a.id)||T.set(a.id,[]))})},A=!0,M=!1,D=void 0;try{for(var k,I=N.keys()[Symbol.iterator]();!(A=(k=I.next()).done);A=!0)_(k.value)}catch(ee){M=!0,D=ee}finally{try{!A&&I.return&&I.return()}finally{if(M)throw D}}var P=b(E),S=b(T),L=m(P),O=m(S),R=x(E),B=x(T),F=[],z=[];L.forEach(function(e,t){F[t]=[],e.forEach(function(e){0==R.get(e).length&&F[t].push(e)})}),O.forEach(function(e,t){z[t]=[],e.forEach(function(e){0==B.get(e).length&&z[t].push(e)})});var V=v(E,"horizontal",s,a,F),G=v(T,"vertical",h,o,z),Y=function(e){r.get(e)?r.get(e).forEach(function(t){u[l.get(t)]=V.get(e)}):u[l.get(e)]=V.get(e)},X=!0,U=!1,j=void 0;try{for(var H,W=V.keys()[Symbol.iterator]();!(X=(H=W.next()).done);X=!0)Y(H.value)}catch(ee){U=!0,j=ee}finally{try{!X&&W.return&&W.return()}finally{if(U)throw j}}var q=function(e){i.get(e)?i.get(e).forEach(function(t){c[l.get(t)]=G.get(e)}):c[l.get(e)]=G.get(e)},K=!0,Z=!1,$=void 0;try{for(var Q,J=G.keys()[Symbol.iterator]();!(K=(Q=J.next()).done);K=!0)q(Q.value)}catch(ee){Z=!0,$=ee}finally{try{!K&&J.return&&J.return()}finally{if(Z)throw $}}}()}for(var ee=0;ee<h.length;ee++){var te=h[ee];null==te.getChild()&&te.setCenter(u[l.get(te.id)],c[l.get(te.id)])}},e.exports=l},551:t=>{t.exports=e}},n={},r=function e(r){var i=n[r];if(void 0!==i)return i.exports;var a=n[r]={exports:{}};return t[r](a,a.exports,e),a.exports}(45),r;var t,n,r},sv.exports=e(uv()));var e}var dv;dv=function(e){return t={658:e=>{e.exports=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}},548:(e,t,n)=>{var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(l){i=!0,a=l}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=n(140).layoutBase.LinkedList,a={getTopMostNodes:function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;var r=e.filter(function(e,n){"number"==typeof e&&(e=n);for(var r=e.parent()[0];null!=r;){if(t[r.id()])return!1;r=r.parent()[0]}return!0});return r},connectComponents:function(e,t,n,r){var a=new i,o=new Set,s=[],l=void 0,u=void 0,c=void 0,h=!1,d=1,f=[],g=[],p=function(){var r=e.collection();g.push(r);var i=n[0],p=e.collection();p.merge(i).merge(i.descendants().intersection(t)),s.push(i),p.forEach(function(e){a.push(e),o.add(e),r.merge(e)});for(var v=function(){i=a.shift();var u=e.collection();i.neighborhood().nodes().forEach(function(e){t.intersection(i.edgesWith(e)).length>0&&u.merge(e)});for(var c=0;c<u.length;c++){var h=u[c];null==(l=n.intersection(h.union(h.ancestors())))||o.has(l[0])||l.union(l.descendants()).forEach(function(e){a.push(e),o.add(e),r.merge(e),n.has(e)&&s.push(e)})}};0!=a.length;)v();if(r.forEach(function(e){t.intersection(e.connectedEdges()).forEach(function(e){r.has(e.source())&&r.has(e.target())&&r.merge(e)})}),s.length==n.length&&(h=!0),!h||h&&d>1){u=s[0],c=u.connectedEdges().length,s.forEach(function(e){e.connectedEdges().length<c&&(c=e.connectedEdges().length,u=e)}),f.push(u.id());var y=e.collection();y.merge(s[0]),s.forEach(function(e){y.merge(e)}),s=[],n=n.difference(y),d++}};do{p()}while(!h);return r&&f.length>0&&r.set("dummy"+(r.size+1),f),g},relocateComponent:function(e,t,n){if(!n.fixedNodeConstraint){var i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;if("draft"==n.quality){var l=!0,u=!1,c=void 0;try{for(var h,d=t.nodeIndexes[Symbol.iterator]();!(l=(h=d.next()).done);l=!0){var f=h.value,g=r(f,2),p=g[0],v=g[1],y=n.cy.getElementById(p);if(y){var m=y.boundingBox(),b=t.xCoords[v]-m.w/2,x=t.xCoords[v]+m.w/2,w=t.yCoords[v]-m.h/2,E=t.yCoords[v]+m.h/2;b<i&&(i=b),x>a&&(a=x),w<o&&(o=w),E>s&&(s=E)}}}catch(A){u=!0,c=A}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}var T=e.x-(a+i)/2,_=e.y-(s+o)/2;t.xCoords=t.xCoords.map(function(e){return e+T}),t.yCoords=t.yCoords.map(function(e){return e+_})}else{Object.keys(t).forEach(function(e){var n=t[e],r=n.getRect().x,l=n.getRect().x+n.getRect().width,u=n.getRect().y,c=n.getRect().y+n.getRect().height;r<i&&(i=r),l>a&&(a=l),u<o&&(o=u),c>s&&(s=c)});var C=e.x-(a+i)/2,N=e.y-(s+o)/2;Object.keys(t).forEach(function(e){var n=t[e];n.setCenter(n.getCenterX()+C,n.getCenterY()+N)})}}},calcBoundingBox:function(e,t,n,r){for(var i=Number.MAX_SAFE_INTEGER,a=Number.MIN_SAFE_INTEGER,o=Number.MAX_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER,l=void 0,u=void 0,c=void 0,h=void 0,d=e.descendants().not(":parent"),f=d.length,g=0;g<f;g++){var p=d[g];i>(l=t[r.get(p.id())]-p.width()/2)&&(i=l),a<(u=t[r.get(p.id())]+p.width()/2)&&(a=u),o>(c=n[r.get(p.id())]-p.height()/2)&&(o=c),s<(h=n[r.get(p.id())]+p.height()/2)&&(s=h)}var v={};return v.topLeftX=i,v.topLeftY=o,v.width=a-i,v.height=s-o,v},calcParentsWithoutChildren:function(e,t){var n=e.collection();return t.nodes(":parent").forEach(function(e){var t=!1;e.children().forEach(function(e){"none"!=e.css("display")&&(t=!0)}),t||n.merge(e)}),n}};e.exports=a},816:(e,t,n)=>{var r=n(548),i=n(140).CoSELayout,a=n(140).CoSENode,o=n(140).layoutBase.PointD,s=n(140).layoutBase.DimensionD,l=n(140).layoutBase.LayoutConstants,u=n(140).layoutBase.FDLayoutConstants,c=n(140).CoSEConstants;e.exports={coseLayout:function(e,t){var n=e.cy,h=e.eles,d=h.nodes(),f=h.edges(),g=void 0,p=void 0,v=void 0,y={};e.randomize&&(g=t.nodeIndexes,p=t.xCoords,v=t.yCoords);var m=function(e){return"function"==typeof e},b=function(e,t){return m(e)?e(t):e},x=r.calcParentsWithoutChildren(n,h);null!=e.nestingFactor&&(c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=u.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),null!=e.gravity&&(c.DEFAULT_GRAVITY_STRENGTH=u.DEFAULT_GRAVITY_STRENGTH=e.gravity),null!=e.numIter&&(c.MAX_ITERATIONS=u.MAX_ITERATIONS=e.numIter),null!=e.gravityRange&&(c.DEFAULT_GRAVITY_RANGE_FACTOR=u.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),null!=e.gravityCompound&&(c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=u.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),null!=e.gravityRangeCompound&&(c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=u.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),null!=e.initialEnergyOnIncremental&&(c.DEFAULT_COOLING_FACTOR_INCREMENTAL=u.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),null!=e.tilingCompareBy&&(c.TILING_COMPARE_BY=e.tilingCompareBy),"proof"==e.quality?l.QUALITY=2:l.QUALITY=0,c.NODE_DIMENSIONS_INCLUDE_LABELS=u.NODE_DIMENSIONS_INCLUDE_LABELS=l.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,c.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!e.randomize,c.ANIMATE=u.ANIMATE=l.ANIMATE=e.animate,c.TILE=e.tile,c.TILING_PADDING_VERTICAL="function"==typeof e.tilingPaddingVertical?e.tilingPaddingVertical.call():e.tilingPaddingVertical,c.TILING_PADDING_HORIZONTAL="function"==typeof e.tilingPaddingHorizontal?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal,c.DEFAULT_INCREMENTAL=u.DEFAULT_INCREMENTAL=l.DEFAULT_INCREMENTAL=!0,c.PURE_INCREMENTAL=!e.randomize,l.DEFAULT_UNIFORM_LEAF_NODE_SIZES=e.uniformNodeDimensions,"transformed"==e.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,c.ENFORCE_CONSTRAINTS=!1,c.APPLY_LAYOUT=!1),"enforced"==e.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!0,c.APPLY_LAYOUT=!1),"cose"==e.step&&(c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!1,c.APPLY_LAYOUT=!0),"all"==e.step&&(e.randomize?c.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:c.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,c.ENFORCE_CONSTRAINTS=!0,c.APPLY_LAYOUT=!0),e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint?c.TREE_REDUCTION_ON_INCREMENTAL=!1:c.TREE_REDUCTION_ON_INCREMENTAL=!0;var w=new i,E=w.newGraphManager();return function e(t,n,i,l){for(var u=n.length,c=0;c<u;c++){var h=n[c],d=null;0==h.intersection(x).length&&(d=h.children());var f=void 0,m=h.layoutDimensions({nodeDimensionsIncludeLabels:l.nodeDimensionsIncludeLabels});if(null!=h.outerWidth()&&null!=h.outerHeight())if(l.randomize)if(h.isParent()){var w=r.calcBoundingBox(h,p,v,g);f=0==h.intersection(x).length?t.add(new a(i.graphManager,new o(w.topLeftX,w.topLeftY),new s(w.width,w.height))):t.add(new a(i.graphManager,new o(w.topLeftX,w.topLeftY),new s(parseFloat(m.w),parseFloat(m.h))))}else f=t.add(new a(i.graphManager,new o(p[g.get(h.id())]-m.w/2,v[g.get(h.id())]-m.h/2),new s(parseFloat(m.w),parseFloat(m.h))));else f=t.add(new a(i.graphManager,new o(h.position("x")-m.w/2,h.position("y")-m.h/2),new s(parseFloat(m.w),parseFloat(m.h))));else f=t.add(new a(this.graphManager));f.id=h.data("id"),f.nodeRepulsion=b(l.nodeRepulsion,h),f.paddingLeft=parseInt(h.css("padding")),f.paddingTop=parseInt(h.css("padding")),f.paddingRight=parseInt(h.css("padding")),f.paddingBottom=parseInt(h.css("padding")),l.nodeDimensionsIncludeLabels&&(f.labelWidth=h.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).w,f.labelHeight=h.boundingBox({includeLabels:!0,includeNodes:!1,includeOverlays:!1}).h,f.labelPosVertical=h.css("text-valign"),f.labelPosHorizontal=h.css("text-halign")),y[h.data("id")]=f,isNaN(f.rect.x)&&(f.rect.x=0),isNaN(f.rect.y)&&(f.rect.y=0),null!=d&&d.length>0&&e(i.getGraphManager().add(i.newGraph(),f),d,i,l)}}(E.addRoot(),r.getTopMostNodes(d),w,e),function(t,n,r){for(var i=0,a=0,o=0;o<r.length;o++){var s=r[o],l=y[s.data("source")],h=y[s.data("target")];if(l&&h&&l!==h&&0==l.getEdgesBetween(h).length){var d=n.add(t.newEdge(),l,h);d.id=s.id(),d.idealLength=b(e.idealEdgeLength,s),d.edgeElasticity=b(e.edgeElasticity,s),i+=d.idealLength,a++}}null!=e.idealEdgeLength&&(a>0?c.DEFAULT_EDGE_LENGTH=u.DEFAULT_EDGE_LENGTH=i/a:m(e.idealEdgeLength)?c.DEFAULT_EDGE_LENGTH=u.DEFAULT_EDGE_LENGTH=50:c.DEFAULT_EDGE_LENGTH=u.DEFAULT_EDGE_LENGTH=e.idealEdgeLength,c.MIN_REPULSION_DIST=u.MIN_REPULSION_DIST=u.DEFAULT_EDGE_LENGTH/10,c.DEFAULT_RADIAL_SEPARATION=u.DEFAULT_EDGE_LENGTH)}(w,E,f),function(e,t){t.fixedNodeConstraint&&(e.constraints.fixedNodeConstraint=t.fixedNodeConstraint),t.alignmentConstraint&&(e.constraints.alignmentConstraint=t.alignmentConstraint),t.relativePlacementConstraint&&(e.constraints.relativePlacementConstraint=t.relativePlacementConstraint)}(w,e),w.runLayout(),y}}},212:(e,t,n)=>{var r=function(){function e(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)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(658),a=n(548),o=n(657).spectralLayout,s=n(816).coseLayout,l=Object.freeze({quality:"default",randomize:!0,animate:!0,animationDuration:1e3,animationEasing:void 0,fit:!0,padding:30,nodeDimensionsIncludeLabels:!1,uniformNodeDimensions:!1,packComponents:!0,step:"all",samplingType:!0,sampleSize:25,nodeSeparation:75,piTol:1e-7,nodeRepulsion:function(e){return 4500},idealEdgeLength:function(e){return 50},edgeElasticity:function(e){return.45},nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,tilingCompareBy:void 0,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.3,fixedNodeConstraint:void 0,alignmentConstraint:void 0,relativePlacementConstraint:void 0,ready:function(){},stop:function(){}}),u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=i({},l,t)}return r(e,[{key:"run",value:function(){var e=this.options,t=e.cy,n=e.eles,r=[],i=[],l=void 0,u=[];!e.fixedNodeConstraint||Array.isArray(e.fixedNodeConstraint)&&0!=e.fixedNodeConstraint.length||(e.fixedNodeConstraint=void 0),e.alignmentConstraint&&(!e.alignmentConstraint.vertical||Array.isArray(e.alignmentConstraint.vertical)&&0!=e.alignmentConstraint.vertical.length||(e.alignmentConstraint.vertical=void 0),!e.alignmentConstraint.horizontal||Array.isArray(e.alignmentConstraint.horizontal)&&0!=e.alignmentConstraint.horizontal.length||(e.alignmentConstraint.horizontal=void 0)),!e.relativePlacementConstraint||Array.isArray(e.relativePlacementConstraint)&&0!=e.relativePlacementConstraint.length||(e.relativePlacementConstraint=void 0),(e.fixedNodeConstraint||e.alignmentConstraint||e.relativePlacementConstraint)&&(e.tile=!1,e.packComponents=!1);var c=void 0,h=!1;if(t.layoutUtilities&&e.packComponents&&((c=t.layoutUtilities("get"))||(c=t.layoutUtilities()),h=!0),n.nodes().length>0)if(h){var d=a.getTopMostNodes(e.eles.nodes());if((l=a.connectComponents(t,e.eles,d)).forEach(function(e){var t=e.boundingBox();u.push({x:t.x1+t.w/2,y:t.y1+t.h/2})}),e.randomize&&l.forEach(function(t){e.eles=t,r.push(o(e))}),"default"==e.quality||"proof"==e.quality){var f=t.collection();if(e.tile){var g=new Map,p=0,v={nodeIndexes:g,xCoords:[],yCoords:[]},y=[];if(l.forEach(function(e,t){0==e.edges().length&&(e.nodes().forEach(function(t,n){f.merge(e.nodes()[n]),t.isParent()||(v.nodeIndexes.set(e.nodes()[n].id(),p++),v.xCoords.push(e.nodes()[0].position().x),v.yCoords.push(e.nodes()[0].position().y))}),y.push(t))}),f.length>1){var m=f.boundingBox();u.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),l.push(f),r.push(v);for(var b=y.length-1;b>=0;b--)l.splice(y[b],1),r.splice(y[b],1),u.splice(y[b],1)}}l.forEach(function(t,n){e.eles=t,i.push(s(e,r[n])),a.relocateComponent(u[n],i[n],e)})}else l.forEach(function(t,n){a.relocateComponent(u[n],r[n],e)});var x=new Set;if(l.length>1){var w=[],E=n.filter(function(e){return"none"==e.css("display")});l.forEach(function(t,n){var o=void 0;if("draft"==e.quality&&(o=r[n].nodeIndexes),t.nodes().not(E).length>0){var s={edges:[],nodes:[]},l=void 0;t.nodes().not(E).forEach(function(t){if("draft"==e.quality)if(t.isParent()){var u=a.calcBoundingBox(t,r[n].xCoords,r[n].yCoords,o);s.nodes.push({x:u.topLeftX,y:u.topLeftY,width:u.width,height:u.height})}else l=o.get(t.id()),s.nodes.push({x:r[n].xCoords[l]-t.boundingbox().w/2,y:r[n].yCoords[l]-t.boundingbox().h/2,width:t.boundingbox().w,height:t.boundingbox().h});else i[n][t.id()]&&s.nodes.push({x:i[n][t.id()].getLeft(),y:i[n][t.id()].getTop(),width:i[n][t.id()].getWidth(),height:i[n][t.id()].getHeight()})}),t.edges().forEach(function(t){var l=t.source(),u=t.target();if("none"!=l.css("display")&&"none"!=u.css("display"))if("draft"==e.quality){var c=o.get(l.id()),h=o.get(u.id()),d=[],f=[];if(l.isParent()){var g=a.calcBoundingBox(l,r[n].xCoords,r[n].yCoords,o);d.push(g.topLeftX+g.width/2),d.push(g.topLeftY+g.height/2)}else d.push(r[n].xCoords[c]),d.push(r[n].yCoords[c]);if(u.isParent()){var p=a.calcBoundingBox(u,r[n].xCoords,r[n].yCoords,o);f.push(p.topLeftX+p.width/2),f.push(p.topLeftY+p.height/2)}else f.push(r[n].xCoords[h]),f.push(r[n].yCoords[h]);s.edges.push({startX:d[0],startY:d[1],endX:f[0],endY:f[1]})}else i[n][l.id()]&&i[n][u.id()]&&s.edges.push({startX:i[n][l.id()].getCenterX(),startY:i[n][l.id()].getCenterY(),endX:i[n][u.id()].getCenterX(),endY:i[n][u.id()].getCenterY()})}),s.nodes.length>0&&(w.push(s),x.add(n))}});var T=c.packComponents(w,e.randomize).shifts;if("draft"==e.quality)r.forEach(function(e,t){var n=e.xCoords.map(function(e){return e+T[t].dx}),r=e.yCoords.map(function(e){return e+T[t].dy});e.xCoords=n,e.yCoords=r});else{var _=0;x.forEach(function(e){Object.keys(i[e]).forEach(function(t){var n=i[e][t];n.setCenter(n.getCenterX()+T[_].dx,n.getCenterY()+T[_].dy)}),_++})}}}else{var C=e.eles.boundingBox();if(u.push({x:C.x1+C.w/2,y:C.y1+C.h/2}),e.randomize){var N=o(e);r.push(N)}"default"==e.quality||"proof"==e.quality?(i.push(s(e,r[0])),a.relocateComponent(u[0],i[0],e)):a.relocateComponent(u[0],r[0],e)}var A=function(t,n){if("default"==e.quality||"proof"==e.quality){"number"==typeof t&&(t=n);var a=void 0,o=void 0,s=t.data("id");return i.forEach(function(e){s in e&&(a={x:e[s].getRect().getCenterX(),y:e[s].getRect().getCenterY()},o=e[s])}),e.nodeDimensionsIncludeLabels&&(o.labelWidth&&("left"==o.labelPosHorizontal?a.x+=o.labelWidth/2:"right"==o.labelPosHorizontal&&(a.x-=o.labelWidth/2)),o.labelHeight&&("top"==o.labelPosVertical?a.y+=o.labelHeight/2:"bottom"==o.labelPosVertical&&(a.y-=o.labelHeight/2))),null==a&&(a={x:t.position("x"),y:t.position("y")}),{x:a.x,y:a.y}}var l=void 0;return r.forEach(function(e){var n=e.nodeIndexes.get(t.id());null!=n&&(l={x:e.xCoords[n],y:e.yCoords[n]})}),null==l&&(l={x:t.position("x"),y:t.position("y")}),{x:l.x,y:l.y}};if("default"==e.quality||"proof"==e.quality||e.randomize){var M=a.calcParentsWithoutChildren(t,n),D=n.filter(function(e){return"none"==e.css("display")});e.eles=n.not(D),n.nodes().not(":parent").not(D).layoutPositions(this,e,A),M.length>0&&M.forEach(function(e){e.position(A(e))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),e}();e.exports=u},657:(e,t,n)=>{var r=n(548),i=n(140).layoutBase.Matrix,a=n(140).layoutBase.SVD;e.exports={spectralLayout:function(e){var t=e.cy,n=e.eles,o=n.nodes(),s=n.nodes(":parent"),l=new Map,u=new Map,c=new Map,h=[],d=[],f=[],g=[],p=[],v=[],y=[],m=[],b=void 0,x=1e8,w=1e-9,E=e.piTol,T=e.samplingType,_=e.nodeSeparation,C=void 0,N=function(e,t,n){for(var r=[],i=0,a=0,o=0,s=void 0,l=[],c=0,d=1,f=0;f<b;f++)l[f]=x;for(r[a]=e,l[e]=0;a>=i;){o=r[i++];for(var g=h[o],y=0;y<g.length;y++)l[s=u.get(g[y])]==x&&(l[s]=l[o]+1,r[++a]=s);v[o][t]=l[o]*_}if(n){for(var m=0;m<b;m++)v[m][t]<p[m]&&(p[m]=v[m][t]);for(var w=0;w<b;w++)p[w]>c&&(c=p[w],d=w)}return d};r.connectComponents(t,n,r.getTopMostNodes(o),l),s.forEach(function(e){r.connectComponents(t,n,r.getTopMostNodes(e.descendants().intersection(n)),l)});for(var A=0,M=0;M<o.length;M++)o[M].isParent()||u.set(o[M].id(),A++);var D=!0,k=!1,I=void 0;try{for(var P,S=l.keys()[Symbol.iterator]();!(D=(P=S.next()).done);D=!0){var L=P.value;u.set(L,A++)}}catch(Z){k=!0,I=Z}finally{try{!D&&S.return&&S.return()}finally{if(k)throw I}}for(var O=0;O<u.size;O++)h[O]=[];s.forEach(function(e){for(var t=e.children().intersection(n);0==t.nodes(":childless").length;)t=t.nodes()[0].children().intersection(n);var r=0,i=t.nodes(":childless")[0].connectedEdges().length;t.nodes(":childless").forEach(function(e,t){e.connectedEdges().length<i&&(i=e.connectedEdges().length,r=t)}),c.set(e.id(),t.nodes(":childless")[r].id())}),o.forEach(function(e){var t=void 0;t=e.isParent()?u.get(c.get(e.id())):u.get(e.id()),e.neighborhood().nodes().forEach(function(r){n.intersection(e.edgesWith(r)).length>0&&(r.isParent()?h[t].push(c.get(r.id())):h[t].push(r.id()))})});var R=function(e){var n=u.get(e),r=void 0;l.get(e).forEach(function(i){r=t.getElementById(i).isParent()?c.get(i):i,h[n].push(r),h[u.get(r)].push(e)})},B=!0,F=!1,z=void 0;try{for(var V,G=l.keys()[Symbol.iterator]();!(B=(V=G.next()).done);B=!0)R(V.value)}catch(Z){F=!0,z=Z}finally{try{!B&&G.return&&G.return()}finally{if(F)throw z}}var Y=void 0;if((b=u.size)>2){C=b<e.sampleSize?b:e.sampleSize;for(var X=0;X<b;X++)v[X]=[];for(var U=0;U<C;U++)m[U]=[];return"draft"==e.quality||"all"==e.step?(function(e){var t=void 0;if(e){t=Math.floor(Math.random()*b);for(var n=0;n<b;n++)p[n]=x;for(var r=0;r<C;r++)g[r]=t,t=N(t,r,e)}else{!function(){for(var e=0,t=0,n=!1;t<C;){e=Math.floor(Math.random()*b),n=!1;for(var r=0;r<t;r++)if(g[r]==e){n=!0;break}n||(g[t]=e,t++)}}();for(var i=0;i<C;i++)N(g[i],i,e)}for(var a=0;a<b;a++)for(var o=0;o<C;o++)v[a][o]*=v[a][o];for(var s=0;s<C;s++)y[s]=[];for(var l=0;l<C;l++)for(var u=0;u<C;u++)y[l][u]=v[g[u]][l]}(T),function(){for(var e=a.svd(y),t=e.S,n=e.U,r=e.V,o=t[0]*t[0]*t[0],s=[],l=0;l<C;l++){s[l]=[];for(var u=0;u<C;u++)s[l][u]=0,l==u&&(s[l][u]=t[l]/(t[l]*t[l]+o/(t[l]*t[l])))}m=i.multMat(i.multMat(r,s),i.transpose(n))}(),function(){for(var e=void 0,t=void 0,n=[],r=[],a=[],o=[],s=0;s<b;s++)n[s]=Math.random(),r[s]=Math.random();n=i.normalize(n),r=i.normalize(r);for(var l=w,u=w,c=void 0;;){for(var h=0;h<b;h++)a[h]=n[h];if(n=i.multGamma(i.multL(i.multGamma(a),v,m)),e=i.dotProduct(a,n),n=i.normalize(n),l=i.dotProduct(a,n),(c=Math.abs(l/u))<=1+E&&c>=1)break;u=l}for(var g=0;g<b;g++)a[g]=n[g];for(u=w;;){for(var p=0;p<b;p++)o[p]=r[p];if(o=i.minusOp(o,i.multCons(a,i.dotProduct(a,o))),r=i.multGamma(i.multL(i.multGamma(o),v,m)),t=i.dotProduct(o,r),r=i.normalize(r),l=i.dotProduct(o,r),(c=Math.abs(l/u))<=1+E&&c>=1)break;u=l}for(var y=0;y<b;y++)o[y]=r[y];d=i.multCons(a,Math.sqrt(Math.abs(e))),f=i.multCons(o,Math.sqrt(Math.abs(t)))}(),Y={nodeIndexes:u,xCoords:d,yCoords:f}):(u.forEach(function(e,n){d.push(t.getElementById(n).position("x")),f.push(t.getElementById(n).position("y"))}),Y={nodeIndexes:u,xCoords:d,yCoords:f}),Y}var j=u.keys(),H=t.getElementById(j.next().value),W=H.position(),q=H.outerWidth();if(d.push(W.x),f.push(W.y),2==b){var K=t.getElementById(j.next().value).outerWidth();d.push(W.x+q/2+K/2+e.idealEdgeLength),f.push(W.y)}return Y={nodeIndexes:u,xCoords:d,yCoords:f}}}},579:(e,t,n)=>{var r=n(212),i=function(e){e&&e("layout","fcose",r)};"undefined"!=typeof cytoscape&&i(cytoscape),e.exports=i},140:t=>{t.exports=e}},n={},r=function e(r){var i=n[r];if(void 0!==i)return i.exports;var a=n[r]={exports:{}};return t[r](a,a.exports,e),a.exports}(579),r;var t,n,r};const fv=D(ov.exports=dv(hv()));function gv(e,t){return{selector:e,style:m(t)}}function pv(e){If.use(e)}let vv={targetId:function(e){return e.target.id()}},yv={contents:!1};function mv(e,t,n){let r=getComputedStyle(e).getPropertyValue(t).trim();return""===r?n:r}let bv=["#7c9c5e","#b0743c","#7466a3","#4d8a8a","#a35f74"];function xv(e){return"grp-"+e.replace(/[^a-zA-Z0-9_-]+/g,"-")}function wv(e,t){return e+"-"+t.replace(/[^a-zA-Z0-9_-]+/g,"-")}function Ev(e){return s(e,e=>e).join(" ")}function Tv(e,t){return wv(e,t.bg+"-"+t.border+"-"+t.fg+"-"+(f(t.emphasis,!1)?"b":"n")+(f(t.dashed,!1)?"d":"s"))}function _v(e,t){let n=e.map(e=>e.id),r=e.map(e=>({data:{id:e.id,label:e.label},classes:Ev([T(e.group,xv),T(e.accent,e=>wv("fill",e)),T(e.chip,e=>Tv("nchip",e))])})),i=t.filter(e=>!!n.includes(e.from)&&n.includes(e.to_)).map((e,t)=>({data:{id:"__edge__"+t.toString(),source:e.from,target:e.to_,label:e.label},classes:Ev([T(e.chip,e=>Tv("echip",e))])}));return r.concat(i)}function Cv(e,t){return o(s(t,e=>e),[],(t,n)=>{let r=Tv(e,n);return t.some(e=>e[0]===r)?t:t.concat([[r,n]])})}function Nv(e){let t=e[1];return gv("."+e[0],[["shape","round-rectangle"],["corner-radius","14"],["background-color",t.bg],["background-opacity","1"],["border-color",t.border],["border-width",f(t.emphasis,!1)?"3":"1.5"],["border-style",f(t.dashed,!1)?"dashed":"solid"],["width","label"],["height","label"],["padding","10px"],["label","data(label)"],["color",t.fg],["font-size","12px"],["font-weight","500"],["text-valign","center"],["text-halign","center"],["text-margin-x","0"],["text-wrap","wrap"],["text-max-width","180"],["min-zoomed-font-size","7"]])}function Av(e){let t=e[1],n=f(t.dashed,!1);return gv("."+e[0],[["line-color",t.border],["line-style",n?"dashed":"solid"],["target-arrow-color",t.border],["width","1.5"],["label","data(label)"],["color",t.fg],["font-size","11px"],["font-weight",n?"400":"500"],["font-style",n?"italic":"normal"],["text-rotation","autorotate"],["text-background-color",t.bg],["text-background-opacity",n?"0.85":"1"],["text-background-padding","4"],["text-background-shape","roundrectangle"],["text-border-color",t.border],["text-border-width",n?"0":"1"],["text-border-opacity",n?"0":"1"],["min-zoomed-font-size","7"]])}function Mv(e,t,n){let r=function(e){return o(e,[],(e,t)=>{let n=t.group;return void 0===n||e.includes(n)?e:e.concat([n])})}(t),i=mv(e,C.brand,"#3b6ea5"),a=mv(e,C.textPrimary,"#1a1a1a"),l=mv(e,C.border,"#d4d4d4"),u=mv(e,C.surface,"#ffffff"),c=e=>0===e?i:bv[_(e-1|0,bv.length)],h=[gv("node",[["background-color",i],["border-width","2"],["border-color",u],["width","18"],["height","18"],["label","data(label)"],["color",a],["font-size","11px"],["text-valign","center"],["text-halign","right"],["text-margin-x","6"],["text-wrap","ellipsis"],["text-max-width","150"],["min-zoomed-font-size","7"]]),gv("node:parent",[["background-color",l],["background-opacity","0.12"],["border-width","1"],["border-color",l],["text-valign","top"],["text-halign","center"],["font-size","12px"],["color",a],["padding","12"]]),gv("edge",[["width","1.5"],["line-color",l],["target-arrow-color",l],["target-arrow-shape","triangle"],["arrow-scale","0.9"],["curve-style","bezier"]])],d=r.map((e,t)=>gv("."+xv(e),[["background-color",c(t)]])),f=(g=t.map(e=>e.accent),o(s(g,e=>e),[],(e,t)=>e.includes(t)?e:e.concat([t]))).map(e=>gv("."+wv("fill",e),[["background-color",e]]));var g;return[h,d,f,Cv("nchip",t.map(e=>e.chip)).map(Nv),Cv("echip",n.map(e=>e.chip)).map(Av)].flat()}function Dv(e){switch(e){case"breadthfirst":return{name:"breadthfirst",fit:!0,padding:24,animate:!1,spacingFactor:1.1,nodeDimensionsIncludeLabels:!0,directed:!0};case"concentric":return{name:"concentric",fit:!0,padding:24,animate:!1,nodeDimensionsIncludeLabels:!0,minNodeSpacing:40};case"cose":return{name:"cose",fit:!0,padding:24,animate:!1,idealEdgeLength:90,nodeRepulsion:9e3,numIter:800,randomize:!0,componentSpacing:80};case"dagre":return{name:"dagre",fit:!0,padding:24,animate:!1,nodeDimensionsIncludeLabels:!0,rankDir:"BT",nodeSep:28,rankSep:56};case"dagre-lr":return{name:"dagre",fit:!0,padding:24,animate:!1,nodeDimensionsIncludeLabels:!0,rankDir:"LR",nodeSep:48,rankSep:130};case"fcose":return{name:"fcose",fit:!0,padding:24,animate:!1,nodeDimensionsIncludeLabels:!0,idealEdgeLength:80,nodeRepulsion:6e3,randomize:!0,quality:"proof",nodeSeparation:90,gravityCompound:1.5};default:return{name:e,fit:!0,padding:24,animate:!1}}}function kv(e){return"var("+e+")"}let Iv={color:kv(C.textSecondary),fontSize:kv(M.sizeSm),padding:kv(A.lg)};let Pv=function(n){let r=n.height,i=n.layout,a=n.onOpenNode,o=n.edges,s=n.nodes,l=void 0!==i?i:"dagre",u=void 0!==r?r:"520px",c=e(null),h=e(void 0),d=e(a);d.current=a;let g=e([s,o]);g.current=[s,o];let p=b(),v=function(e,t){return e.map(e=>e.id+"|"+e.label+"|"+f(e.group,"")).join(",")+"//"+t.map(e=>e.from+">"+e.to_).join(",")}(s,o),y=e(!0);return t(()=>{let e=c.current;if(null==e)return;!function(){if(!yv.contents)yv.contents=!0,pv(iv),pv(fv)}();let t=If({container:e,elements:_v(s,o),style:Mv(e,s,o),layout:Dv(l),minZoom:.2,maxZoom:3});t.on("tap","node",e=>x(d.current,t=>t(vv.targetId(e)))),h.current=w(t);let n=new ResizeObserver(()=>{t.resize(),t.fit(24)});return n.observe(e),()=>{h.current=void 0,n.disconnect(),t.destroy()}},[]),t(()=>{if(y.current)y.current=!1;else{let e=h.current,t=c.current;if(void 0!==e&&null!=t){let n=E(e),r=g.current,i=r[1],a=r[0];n.remove(n.elements()),n.add(_v(a,i)),n.style(Mv(t,a,i)),n.layout(Dv(l)).run()}}},[v,l]),t(()=>{let e=h.current,t=c.current;if(void 0!==e&&null!=t){let n=g.current;E(e).style(Mv(t,n[0],n[1]))}},[p.preset]),0===s.length?k("div",{children:"No relationships to graph.",style:Iv}):k("div",{ref:w(c),style:(m=u,{background:kv(C.surface),border:"1px solid "+kv(C.border),height:m,overflow:"hidden",width:"100%",borderRadius:kv(N.md)})});var m};export{L as b,P as g,Pv as m};
|