@doocs/md-cli 0.1.2 → 0.1.4

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.
Files changed (70) hide show
  1. package/dist/apple-touch-icon.png +0 -0
  2. package/dist/favicon-16x16.png +0 -0
  3. package/dist/favicon-32x32.png +0 -0
  4. package/dist/favicon.ico +0 -0
  5. package/dist/index.html +17 -3
  6. package/dist/manifest.webmanifest +1 -0
  7. package/dist/mpmd/icon-256-gray.png +0 -0
  8. package/dist/pwa-192x192-maskable.png +0 -0
  9. package/dist/pwa-192x192.png +0 -0
  10. package/dist/pwa-512x512-maskable.png +0 -0
  11. package/dist/pwa-512x512.png +0 -0
  12. package/dist/registerSW.js +1 -0
  13. package/dist/static/css/md-index-B4AMcWDE.css +1 -0
  14. package/dist/static/css/md-vendor_-D8IL6iVj.css +1 -0
  15. package/dist/static/js/md-hljs-DzXSk77f.js +10 -0
  16. package/dist/static/js/md-index-CvCnfZRB.js +626 -0
  17. package/dist/static/js/md-mermaid-BPz6h6Vo.js +1972 -0
  18. package/dist/static/js/md-vendor_.pnpm-BdZ7DMjQ.js +1245 -0
  19. package/dist/sw.js +1 -0
  20. package/dist/workbox-3aa584b4.js +1 -0
  21. package/index.js +48 -29
  22. package/package.json +9 -7
  23. package/server.js +106 -0
  24. package/util.js +53 -100
  25. package/dist/static/css/md-index-BcSsiNbL.css +0 -1
  26. package/dist/static/js/md-_basePickBy-n_ptBhRl.js +0 -1
  27. package/dist/static/js/md-_baseUniq-UI9XjDSS.js +0 -1
  28. package/dist/static/js/md-arc-CG0xZpwd.js +0 -1
  29. package/dist/static/js/md-architectureDiagram-IEHRJDOE-B39-e7po.js +0 -36
  30. package/dist/static/js/md-blockDiagram-JOT3LUYC-LZ0ocwzX.js +0 -121
  31. package/dist/static/js/md-c4Diagram-VJAJSXHY-D9kp_i50.js +0 -10
  32. package/dist/static/js/md-channel-X9Rtbm_e.js +0 -1
  33. package/dist/static/js/md-chunk-4BMEZGHF-C8HfuzwX.js +0 -1
  34. package/dist/static/js/md-chunk-A2AXSNBT-EpvWi1vW.js +0 -164
  35. package/dist/static/js/md-chunk-AEK57VVT-DfI_dP3H.js +0 -220
  36. package/dist/static/js/md-chunk-D6G4REZN-eU4UvCQM.js +0 -1
  37. package/dist/static/js/md-chunk-RZ5BOZE2-Ed7DVqsi.js +0 -1
  38. package/dist/static/js/md-chunk-XZIHB7SX-DSEuEo-L.js +0 -1
  39. package/dist/static/js/md-classDiagram-GIVACNV2-C8j3o3BZ.js +0 -1
  40. package/dist/static/js/md-classDiagram-v2-COTLJTTW-C8j3o3BZ.js +0 -1
  41. package/dist/static/js/md-clone-BUv47ZVZ.js +0 -1
  42. package/dist/static/js/md-cytoscape.esm-CWd-UyhZ.js +0 -191
  43. package/dist/static/js/md-dagre-OKDRZEBW-bRx_xZmN.js +0 -4
  44. package/dist/static/js/md-diagram-SSKATNLV-B-n-ZMhl.js +0 -43
  45. package/dist/static/js/md-diagram-VNBRO52H-CEMh5zVN.js +0 -24
  46. package/dist/static/js/md-erDiagram-Q7BY3M3F-ClKBDTYs.js +0 -60
  47. package/dist/static/js/md-flowDiagram-4HSFHLVR-BZet97G-.js +0 -161
  48. package/dist/static/js/md-ganttDiagram-APWFNJXF-xU1noQGk.js +0 -257
  49. package/dist/static/js/md-gitGraphDiagram-7IBYFJ6S-sLIFQS94.js +0 -65
  50. package/dist/static/js/md-graph-DwcZOKUv.js +0 -1
  51. package/dist/static/js/md-index-lEHYkmyN.js +0 -1258
  52. package/dist/static/js/md-infoDiagram-PH2N3AL5-D7-qapHx.js +0 -2
  53. package/dist/static/js/md-init-Gi6I4Gst.js +0 -1
  54. package/dist/static/js/md-journeyDiagram-U35MCT3I-BNTJgTly.js +0 -138
  55. package/dist/static/js/md-kanban-definition-NDS4AKOZ-B1bGm5dE.js +0 -88
  56. package/dist/static/js/md-layout-BJ3G4Vtz.js +0 -1
  57. package/dist/static/js/md-linear-BJwrzNxm.js +0 -1
  58. package/dist/static/js/md-mindmap-definition-ALO5MXBD-DePXZ4X5.js +0 -95
  59. package/dist/static/js/md-ordinal-CxVaQH2l.js +0 -1
  60. package/dist/static/js/md-pieDiagram-IB7DONF6-ELBfb3J2.js +0 -30
  61. package/dist/static/js/md-quadrantDiagram-7GDLP6J5-Dt6sdst_.js +0 -7
  62. package/dist/static/js/md-radar-MK3ICKWK-BfSn9gz-.js +0 -128
  63. package/dist/static/js/md-requirementDiagram-KVF5MWMF-5nh_v62_.js +0 -64
  64. package/dist/static/js/md-sankeyDiagram-QLVOVGJD-DgxGKuA0.js +0 -10
  65. package/dist/static/js/md-sequenceDiagram-X6HHIX6F-CLQaG9fm.js +0 -122
  66. package/dist/static/js/md-stateDiagram-DGXRK772-C8bDEi8S.js +0 -1
  67. package/dist/static/js/md-stateDiagram-v2-YXO3MK2T-DEKZORpF.js +0 -1
  68. package/dist/static/js/md-timeline-definition-BDJGKUSR-D10WCdsV.js +0 -61
  69. package/dist/static/js/md-xychartDiagram-VJFVF3MP-DcCVYGwf.js +0 -7
  70. package/mm.config.js +0 -55
@@ -1,191 +0,0 @@
1
- import{aq as ss}from"./md-index-lEHYkmyN.js";function co(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,a=Array(e);t<e;t++)a[t]=r[t];return a}function zf(r){if(Array.isArray(r))return r}function Ff(r){if(Array.isArray(r))return co(r)}function st(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qf(r,e){for(var t=0;t<e.length;t++){var a=e[t];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(r,Nl(a.key),a)}}function ut(r,e,t){return e&&qf(r.prototype,e),Object.defineProperty(r,"prototype",{writable:!1}),r}function Pr(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=Mo(r))||e){t&&(r=t);var a=0,n=function(){};return{s:n,n:function(){return a>=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,s=!1;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return o=l.done,l},e:function(l){s=!0,i=l},f:function(){try{o||t.return==null||t.return()}finally{if(s)throw i}}}}function Il(r,e,t){return(e=Nl(e))in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Vf(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function _f(r,e){var t=r==null?null:typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t!=null){var a,n,i,o,s=[],l=!0,u=!1;try{if(i=(t=t.call(r)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(a=i.call(t)).done)&&(s.push(a.value),s.length!==e);l=!0);}catch(v){u=!0,n=v}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(u)throw n}}return s}}function Gf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Hf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
4
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function je(r,e){return zf(r)||_f(r,e)||Mo(r,e)||Gf()}function Ol(r){return Ff(r)||Vf(r)||Mo(r)||Hf()}function Kf(r,e){if(typeof r!="object"||!r)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var a=t.call(r,e);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}function Nl(r){var e=Kf(r,"string");return typeof e=="symbol"?e:e+""}function Ue(r){"@babel/helpers - typeof";return Ue=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ue(r)}function Mo(r,e){if(r){if(typeof r=="string")return co(r,e);var t={}.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?co(r,e):void 0}}var Ke=typeof window>"u"?null:window,us=Ke?Ke.navigator:null;Ke&&Ke.document;var $f=Ue(""),zl=Ue({}),Uf=Ue(function(){}),Wf=typeof HTMLElement>"u"?"undefined":Ue(HTMLElement),Ca=function(e){return e&&e.instanceString&&_e(e.instanceString)?e.instanceString():null},fe=function(e){return e!=null&&Ue(e)==$f},_e=function(e){return e!=null&&Ue(e)===Uf},Le=function(e){return!br(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ke=function(e){return e!=null&&Ue(e)===zl&&!Le(e)&&e.constructor===Object},Yf=function(e){return e!=null&&Ue(e)===zl},ae=function(e){return e!=null&&Ue(e)===Ue(1)&&!isNaN(e)},Xf=function(e){return ae(e)&&Math.floor(e)===e},un=function(e){if(Wf!=="undefined")return e!=null&&e instanceof HTMLElement},br=function(e){return Ta(e)||Fl(e)},Ta=function(e){return Ca(e)==="collection"&&e._private.single},Fl=function(e){return Ca(e)==="collection"&&!e._private.single},Lo=function(e){return Ca(e)==="core"},ql=function(e){return Ca(e)==="stylesheet"},Zf=function(e){return Ca(e)==="event"},rt=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Qf=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Jf=function(e){return ke(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},jf=function(e){return Yf(e)&&_e(e.then)},ec=function(){return us&&us.userAgent.match(/msie|trident|edge/i)},Vt=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;o<arguments.length;o++)i.push(arguments[o]);return i.join("$")});var a=function(){var i=this,o=arguments,s,l=t.apply(i,o),u=a.cache;return(s=u[l])||(s=u[l]=e.apply(i,o)),s};return a.cache={},a},Io=Vt(function(r){return r.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),xn=Vt(function(r){return r.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Vl=Vt(function(r,e){return r+e[0].toUpperCase()+e.substring(1)},function(r,e){return r+"$"+e}),ls=function(e){return rt(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},$e="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",rc="rgb[a]?\\(("+$e+"[%]?)\\s*,\\s*("+$e+"[%]?)\\s*,\\s*("+$e+"[%]?)(?:\\s*,\\s*("+$e+"))?\\)",tc="rgb[a]?\\((?:"+$e+"[%]?)\\s*,\\s*(?:"+$e+"[%]?)\\s*,\\s*(?:"+$e+"[%]?)(?:\\s*,\\s*(?:"+$e+"))?\\)",ac="hsl[a]?\\(("+$e+")\\s*,\\s*("+$e+"[%])\\s*,\\s*("+$e+"[%])(?:\\s*,\\s*("+$e+"))?\\)",nc="hsl[a]?\\((?:"+$e+")\\s*,\\s*(?:"+$e+"[%])\\s*,\\s*(?:"+$e+"[%])(?:\\s*,\\s*(?:"+$e+"))?\\)",ic="\\#[0-9a-fA-F]{3}",oc="\\#[0-9a-fA-F]{6}",_l=function(e,t){return e<t?-1:e>t?1:0},sc=function(e,t){return-1*_l(e,t)},ge=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t<e.length;t++){var a=e[t];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var o=n[i];r[o]=a[o]}}return r},uc=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,a,n,i,o=16;return t?(a=parseInt(e[1]+e[1],o),n=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(a=parseInt(e[1]+e[2],o),n=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[a,n,i]}},lc=function(e){var t,a,n,i,o,s,l,u;function v(h,y,g){return g<0&&(g+=1),g>1&&(g-=1),g<1/6?h+(y-h)*6*g:g<1/2?y:g<2/3?h+(y-h)*(2/3-g)*6:h}var f=new RegExp("^"+ac+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,o=f[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,d=2*i-c;s=Math.round(255*v(d,c,a+1/3)),l=Math.round(255*v(d,c,a)),u=Math.round(255*v(d,c,a-1/3))}t=[s,l,u,o]}return t},vc=function(e){var t,a=new RegExp("^"+rc+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(s&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},fc=function(e){return cc[e.toLowerCase()]},Gl=function(e){return(Le(e)?e:null)||fc(e)||uc(e)||vc(e)||lc(e)},cc={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]},Hl=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(ke(o))throw Error("Tried to set map with object key");i<a.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},Kl=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var o=a[i];if(ke(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t},za=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ss<"u"?ss:typeof self<"u"?self:{};function Sa(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var _n,vs;function Da(){if(vs)return _n;vs=1;function r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}return _n=r,_n}var Gn,fs;function hc(){if(fs)return Gn;fs=1;var r=typeof za=="object"&&za&&za.Object===Object&&za;return Gn=r,Gn}var Hn,cs;function En(){if(cs)return Hn;cs=1;var r=hc(),e=typeof self=="object"&&self&&self.Object===Object&&self,t=r||e||Function("return this")();return Hn=t,Hn}var Kn,hs;function dc(){if(hs)return Kn;hs=1;var r=En(),e=function(){return r.Date.now()};return Kn=e,Kn}var $n,ds;function gc(){if(ds)return $n;ds=1;var r=/\s/;function e(t){for(var a=t.length;a--&&r.test(t.charAt(a)););return a}return $n=e,$n}var Un,gs;function pc(){if(gs)return Un;gs=1;var r=gc(),e=/^\s+/;function t(a){return a&&a.slice(0,r(a)+1).replace(e,"")}return Un=t,Un}var Wn,ps;function Oo(){if(ps)return Wn;ps=1;var r=En(),e=r.Symbol;return Wn=e,Wn}var Yn,ys;function yc(){if(ys)return Yn;ys=1;var r=Oo(),e=Object.prototype,t=e.hasOwnProperty,a=e.toString,n=r?r.toStringTag:void 0;function i(o){var s=t.call(o,n),l=o[n];try{o[n]=void 0;var u=!0}catch{}var v=a.call(o);return u&&(s?o[n]=l:delete o[n]),v}return Yn=i,Yn}var Xn,ms;function mc(){if(ms)return Xn;ms=1;var r=Object.prototype,e=r.toString;function t(a){return e.call(a)}return Xn=t,Xn}var Zn,bs;function $l(){if(bs)return Zn;bs=1;var r=Oo(),e=yc(),t=mc(),a="[object Null]",n="[object Undefined]",i=r?r.toStringTag:void 0;function o(s){return s==null?s===void 0?n:a:i&&i in Object(s)?e(s):t(s)}return Zn=o,Zn}var Qn,ws;function bc(){if(ws)return Qn;ws=1;function r(e){return e!=null&&typeof e=="object"}return Qn=r,Qn}var Jn,xs;function ka(){if(xs)return Jn;xs=1;var r=$l(),e=bc(),t="[object Symbol]";function a(n){return typeof n=="symbol"||e(n)&&r(n)==t}return Jn=a,Jn}var jn,Es;function wc(){if(Es)return jn;Es=1;var r=pc(),e=Da(),t=ka(),a=NaN,n=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function l(u){if(typeof u=="number")return u;if(t(u))return a;if(e(u)){var v=typeof u.valueOf=="function"?u.valueOf():u;u=e(v)?v+"":v}if(typeof u!="string")return u===0?u:+u;u=r(u);var f=i.test(u);return f||o.test(u)?s(u.slice(2),f?2:8):n.test(u)?a:+u}return jn=l,jn}var ei,Cs;function xc(){if(Cs)return ei;Cs=1;var r=Da(),e=dc(),t=wc(),a="Expected a function",n=Math.max,i=Math.min;function o(s,l,u){var v,f,c,d,h,y,g=0,p=!1,m=!1,b=!0;if(typeof s!="function")throw new TypeError(a);l=t(l)||0,r(u)&&(p=!!u.leading,m="maxWait"in u,c=m?n(t(u.maxWait)||0,l):c,b="trailing"in u?!!u.trailing:b);function w(P){var R=v,L=f;return v=f=void 0,g=P,d=s.apply(L,R),d}function E(P){return g=P,h=setTimeout(S,l),p?w(P):d}function C(P){var R=P-y,L=P-g,I=l-R;return m?i(I,c-L):I}function x(P){var R=P-y,L=P-g;return y===void 0||R>=l||R<0||m&&L>=c}function S(){var P=e();if(x(P))return k(P);h=setTimeout(S,C(P))}function k(P){return h=void 0,b&&v?w(P):(v=f=void 0,d)}function A(){h!==void 0&&clearTimeout(h),g=0,v=y=f=h=void 0}function D(){return h===void 0?d:k(e())}function B(){var P=e(),R=x(P);if(v=arguments,f=this,y=P,R){if(h===void 0)return E(y);if(m)return clearTimeout(h),h=setTimeout(S,l),w(y)}return h===void 0&&(h=setTimeout(S,l)),d}return B.cancel=A,B.flush=D,B}return ei=o,ei}var Ec=xc(),Pa=Sa(Ec),ri=Ke?Ke.performance:null,Ul=ri&&ri.now?function(){return ri.now()}:function(){return Date.now()},Cc=function(){if(Ke){if(Ke.requestAnimationFrame)return function(r){Ke.requestAnimationFrame(r)};if(Ke.mozRequestAnimationFrame)return function(r){Ke.mozRequestAnimationFrame(r)};if(Ke.webkitRequestAnimationFrame)return function(r){Ke.webkitRequestAnimationFrame(r)};if(Ke.msRequestAnimationFrame)return function(r){Ke.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(Ul())},1e3/60)}}(),ln=function(e){return Cc(e)},$r=Ul,Mt=9261,Wl=65599,oa=5381,Yl=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Mt,a=t,n;n=e.next(),!n.done;)a=a*Wl+n.value|0;return a},ha=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Mt;return t*Wl+e|0},da=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oa;return(t<<5)+t+e|0},Tc=function(e,t){return e*2097152+t},Xr=function(e){return e[0]*2097152+e[1]},Fa=function(e,t){return[ha(e[0],t[0]),da(e[1],t[1])]},Ts=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Yl(o,t)},tt=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Yl(o,t)},Xl=function(){return Sc(arguments)},Sc=function(e){for(var t,a=0;a<e.length;a++){var n=e[a];a===0?t=tt(n):t=tt(n,t)}return t},Ss=!0,Dc=console.warn!=null,kc=console.trace!=null,No=Number.MAX_SAFE_INTEGER||9007199254740991,Zl=function(){return!0},vn=function(){return!1},Ds=function(){return 0},zo=function(){},Ve=function(e){throw new Error(e)},Ql=function(e){if(e!==void 0)Ss=!!e;else return Ss},Re=function(e){Ql()&&(Dc?console.warn(e):(console.log(e),kc&&console.trace()))},Pc=function(e){return ge({},e)},Nr=function(e){return e==null?e:Le(e)?e.slice():ke(e)?Pc(e):e},Ac=function(e){return e.slice()},Jl=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},Bc={},jl=function(){return Bc},We=function(e){var t=Object.keys(e);return function(a){for(var n={},i=0;i<t.length;i++){var o=t[i],s=a==null?void 0:a[o];n[o]=s===void 0?e[o]:s}return n}},at=function(e,t,a){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},Fo=function(e){e.splice(0,e.length)},Rc=function(e,t){for(var a=0;a<t.length;a++){var n=t[a];e.push(n)}},Er=function(e,t,a){return a&&(t=Vl(a,t)),e[t]},Hr=function(e,t,a,n){a&&(t=Vl(a,t)),e[t]=n},Mc=function(){function r(){st(this,r),this._obj={}}return ut(r,[{key:"set",value:function(t,a){return this._obj[t]=a,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}])}(),Kr=typeof Map<"u"?Map:Mc,Lc="undefined",Ic=function(){function r(e){if(st(this,r),this._obj=Object.create(null),this.size=0,e!=null){var t;e.instanceString!=null&&e.instanceString()===this.instanceString()?t=e.toArray():t=e;for(var a=0;a<t.length;a++)this.add(t[a])}}return ut(r,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var a=this._obj;a[t]!==1&&(a[t]=1,this.size++)}},{key:"delete",value:function(t){var a=this._obj;a[t]===1&&(a[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(a){return t.has(a)})}},{key:"forEach",value:function(t,a){return this.toArray().forEach(t,a)}}])}(),$t=(typeof Set>"u"?"undefined":Ue(Set))!==Lc?Set:Ic,Cn=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!Lo(e)){Ve("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ve("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?n==="edges":!!t.pannable,active:!1,classes:new $t,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),l=e.zoom();i.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];Le(t.classes)?u=t.classes:fe(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;v<f;v++){var c=u[v];!c||c===""||i.classes.add(c)}this.createEmitter(),(a===void 0||a)&&this.restore();var d=t.style||t.css;d&&(Re("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(d))},ks=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var o;ke(a)&&!br(a)&&(o=a,a=o.roots||o.root,n=o.visit,i=o.directed),i=arguments.length===2&&!_e(n)?n:i,n=_e(n)?n:function(){};for(var s=this._private.cy,l=a=fe(a)?this.filter(a):a,u=[],v=[],f={},c={},d={},h=0,y,g=this.byGroup(),p=g.nodes,m=g.edges,b=0;b<l.length;b++){var w=l[b],E=w.id();w.isNode()&&(u.unshift(w),e.bfs&&(d[E]=!0,v.push(w)),c[E]=0)}for(var C=function(){var P=e.bfs?u.shift():u.pop(),R=P.id();if(e.dfs){if(d[R])return 0;d[R]=!0,v.push(P)}var L=c[R],I=f[R],M=I!=null?I.source():null,O=I!=null?I.target():null,_=I==null?void 0:P.same(M)?O[0]:M[0],H;if(H=n(P,I,_,h++,L),H===!0)return y=P,1;if(H===!1)return 1;for(var z=P.connectedEdges().filter(function(Q){return(!i||Q.source().same(P))&&m.has(Q)}),G=0;G<z.length;G++){var W=z[G],X=W.connectedNodes().filter(function(Q){return!Q.same(P)&&p.has(Q)}),Z=X.id();X.length!==0&&!d[Z]&&(X=X[0],u.push(X),e.bfs&&(d[Z]=!0,v.push(X)),f[Z]=W,c[Z]=c[R]+1)}},x;u.length!==0&&(x=C(),!(x!==0&&x===1)););for(var S=s.collection(),k=0;k<v.length;k++){var A=v[k],D=f[A.id()];D!=null&&S.push(D),S.push(A)}return{path:s.collection(S),found:s.collection(y)}}},ga={breadthFirstSearch:ks({bfs:!0}),depthFirstSearch:ks({dfs:!0})};ga.bfs=ga.breadthFirstSearch;ga.dfs=ga.depthFirstSearch;var Za={exports:{}},Oc=Za.exports,Ps;function Nc(){return Ps||(Ps=1,function(r,e){(function(){var t,a,n,i,o,s,l,u,v,f,c,d,h,y,g;n=Math.floor,f=Math.min,a=function(p,m){return p<m?-1:p>m?1:0},v=function(p,m,b,w,E){var C;if(b==null&&(b=0),E==null&&(E=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=p.length);b<w;)C=n((b+w)/2),E(m,p[C])<0?w=C:b=C+1;return[].splice.apply(p,[b,b-b].concat(m)),m},s=function(p,m,b){return b==null&&(b=a),p.push(m),y(p,0,p.length-1,b)},o=function(p,m){var b,w;return m==null&&(m=a),b=p.pop(),p.length?(w=p[0],p[0]=b,g(p,0,m)):w=b,w},u=function(p,m,b){var w;return b==null&&(b=a),w=p[0],p[0]=m,g(p,0,b),w},l=function(p,m,b){var w;return b==null&&(b=a),p.length&&b(p[0],m)<0&&(w=[p[0],m],m=w[0],p[0]=w[1],g(p,0,b)),m},i=function(p,m){var b,w,E,C,x,S;for(m==null&&(m=a),C=(function(){S=[];for(var k=0,A=n(p.length/2);0<=A?k<A:k>A;0<=A?k++:k--)S.push(k);return S}).apply(this).reverse(),x=[],w=0,E=C.length;w<E;w++)b=C[w],x.push(g(p,b,m));return x},h=function(p,m,b){var w;if(b==null&&(b=a),w=p.indexOf(m),w!==-1)return y(p,0,w,b),g(p,w,b)},c=function(p,m,b){var w,E,C,x,S;if(b==null&&(b=a),E=p.slice(0,m),!E.length)return E;for(i(E,b),S=p.slice(m),C=0,x=S.length;C<x;C++)w=S[C],l(E,w,b);return E.sort(b).reverse()},d=function(p,m,b){var w,E,C,x,S,k,A,D,B;if(b==null&&(b=a),m*10<=p.length){if(C=p.slice(0,m).sort(b),!C.length)return C;for(E=C[C.length-1],A=p.slice(m),x=0,k=A.length;x<k;x++)w=A[x],b(w,E)<0&&(v(C,w,0,null,b),C.pop(),E=C[C.length-1]);return C}for(i(p,b),B=[],S=0,D=f(m,p.length);0<=D?S<D:S>D;0<=D?++S:--S)B.push(o(p,b));return B},y=function(p,m,b,w){var E,C,x;for(w==null&&(w=a),E=p[b];b>m;){if(x=b-1>>1,C=p[x],w(E,C)<0){p[b]=C,b=x;continue}break}return p[b]=E},g=function(p,m,b){var w,E,C,x,S;for(b==null&&(b=a),E=p.length,S=m,C=p[m],w=2*m+1;w<E;)x=w+1,x<E&&!(b(p[w],p[x])<0)&&(w=x),p[m]=p[w],m=w,w=2*m+1;return p[m]=C,y(p,S,m,b)},t=function(){p.push=s,p.pop=o,p.replace=u,p.pushpop=l,p.heapify=i,p.updateItem=h,p.nlargest=c,p.nsmallest=d;function p(m){this.cmp=m??a,this.nodes=[]}return p.prototype.push=function(m){return s(this.nodes,m,this.cmp)},p.prototype.pop=function(){return o(this.nodes,this.cmp)},p.prototype.peek=function(){return this.nodes[0]},p.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},p.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},p.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},p.prototype.heapify=function(){return i(this.nodes,this.cmp)},p.prototype.updateItem=function(m){return h(this.nodes,m,this.cmp)},p.prototype.clear=function(){return this.nodes=[]},p.prototype.empty=function(){return this.nodes.length===0},p.prototype.size=function(){return this.nodes.length},p.prototype.clone=function(){var m;return m=new p,m.nodes=this.nodes.slice(0),m},p.prototype.toArray=function(){return this.nodes.slice(0)},p.prototype.insert=p.prototype.push,p.prototype.top=p.prototype.peek,p.prototype.front=p.prototype.peek,p.prototype.has=p.prototype.contains,p.prototype.copy=p.prototype.clone,p}(),function(p,m){return r.exports=m()}(this,function(){return t})}).call(Oc)}(Za)),Za.exports}var ti,As;function zc(){return As||(As=1,ti=Nc()),ti}var Fc=zc(),Aa=Sa(Fc),qc=We({root:null,weight:function(e){return 1},directed:!1}),Vc={dijkstra:function(e){if(!ke(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var a=qc(e),n=a.root,i=a.weight,o=a.directed,s=this,l=i,u=fe(n)?this.filter(n)[0]:n[0],v={},f={},c={},d=this.byGroup(),h=d.nodes,y=d.edges;y.unmergeBy(function(L){return L.isLoop()});for(var g=function(I){return v[I.id()]},p=function(I,M){v[I.id()]=M,m.updateItem(I)},m=new Aa(function(L,I){return g(L)-g(I)}),b=0;b<h.length;b++){var w=h[b];v[w.id()]=w.same(u)?0:1/0,m.push(w)}for(var E=function(I,M){for(var O=(o?I.edgesTo(M):I.edgesWith(M)).intersect(y),_=1/0,H,z=0;z<O.length;z++){var G=O[z],W=l(G);(W<_||!H)&&(_=W,H=G)}return{edge:H,dist:_}};m.size()>0;){var C=m.pop(),x=g(C),S=C.id();if(c[S]=x,x!==1/0)for(var k=C.neighborhood().intersect(h),A=0;A<k.length;A++){var D=k[A],B=D.id(),P=E(C,D),R=x+P.dist;R<g(D)&&(p(D,R),f[B]={node:C,edge:P.edge})}}return{distanceTo:function(I){var M=fe(I)?h.filter(I)[0]:I[0];return c[M.id()]},pathTo:function(I){var M=fe(I)?h.filter(I)[0]:I[0],O=[],_=M,H=_.id();if(M.length>0)for(O.unshift(M);f[H];){var z=f[H];O.unshift(z.edge),O.unshift(z.node),_=z.node,H=_.id()}return s.spawn(O)}}}},_c={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,o=new Array(i),s=a,l=function(w){for(var E=0;E<o.length;E++){var C=o[E];if(C.has(w))return E}},u=0;u<i;u++)o[u]=this.spawn(a[u]);for(var v=n.sort(function(b,w){return e(b)-e(w)}),f=0;f<v.length;f++){var c=v[f],d=c.source()[0],h=c.target()[0],y=l(d),g=l(h),p=o[y],m=o[g];y!==g&&(s.merge(c),p.merge(m),o.splice(g,1))}return s}},Gc=We({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Hc={aStar:function(e){var t=this.cy(),a=Gc(e),n=a.root,i=a.goal,o=a.heuristic,s=a.directed,l=a.weight;n=t.collection(n)[0],i=t.collection(i)[0];var u=n.id(),v=i.id(),f={},c={},d={},h=new Aa(function(H,z){return c[H.id()]-c[z.id()]}),y=new $t,g={},p={},m=function(z,G){h.push(z),y.add(G)},b,w,E=function(){b=h.pop(),w=b.id(),y.delete(w)},C=function(z){return y.has(z)};m(n,u),f[u]=0,c[u]=o(n);for(var x=0;h.size()>0;){if(E(),x++,w===v){for(var S=[],k=i,A=v,D=p[A];S.unshift(k),D!=null&&S.unshift(D),k=g[A],k!=null;)A=k.id(),D=p[A];return{found:!0,distance:f[w],path:this.spawn(S),steps:x}}d[w]=!0;for(var B=b._private.edges,P=0;P<B.length;P++){var R=B[P];if(this.hasElementWithId(R.id())&&!(s&&R.data("source")!==w)){var L=R.source(),I=R.target(),M=L.id()!==w?L:I,O=M.id();if(this.hasElementWithId(O)&&!d[O]){var _=f[w]+l(R);if(!C(O)){f[O]=_,c[O]=_+o(M),m(M,O),g[O]=b,p[O]=R;continue}_<f[O]&&(f[O]=_,c[O]=_+o(M),g[O]=b,p[O]=R)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},Kc=We({weight:function(e){return 1},directed:!1}),$c={floydWarshall:function(e){for(var t=this.cy(),a=Kc(e),n=a.weight,i=a.directed,o=n,s=this.byGroup(),l=s.nodes,u=s.edges,v=l.length,f=v*v,c=function(W){return l.indexOf(W)},d=function(W){return l[W]},h=new Array(f),y=0;y<f;y++){var g=y%v,p=(y-g)/v;p===g?h[y]=0:h[y]=1/0}for(var m=new Array(f),b=new Array(f),w=0;w<u.length;w++){var E=u[w],C=E.source()[0],x=E.target()[0];if(C!==x){var S=c(C),k=c(x),A=S*v+k,D=o(E);if(h[A]>D&&(h[A]=D,m[A]=k,b[A]=E),!i){var B=k*v+S;!i&&h[B]>D&&(h[B]=D,m[B]=S,b[B]=E)}}}for(var P=0;P<v;P++)for(var R=0;R<v;R++)for(var L=R*v+P,I=0;I<v;I++){var M=R*v+I,O=P*v+I;h[L]+h[O]<h[M]&&(h[M]=h[L]+h[O],m[M]=m[L])}var _=function(W){return(fe(W)?t.filter(W):W)[0]},H=function(W){return c(_(W))},z={distance:function(W,X){var Z=H(W),Q=H(X);return h[Z*v+Q]},path:function(W,X){var Z=H(W),Q=H(X),ee=d(Z);if(Z===Q)return ee.collection();if(m[Z*v+Q]==null)return t.collection();var re=t.collection(),K=Z,N;for(re.merge(ee);Z!==Q;)K=Z,Z=m[Z*v+Q],N=b[K*v+Z],re.merge(N),re.merge(d(Z));return re}};return z}},Uc=We({weight:function(e){return 1},directed:!1,root:null}),Wc={bellmanFord:function(e){var t=this,a=Uc(e),n=a.weight,i=a.directed,o=a.root,s=n,l=this,u=this.cy(),v=this.byGroup(),f=v.edges,c=v.nodes,d=c.length,h=new Kr,y=!1,g=[];o=u.collection(o)[0],f.unmergeBy(function(Ae){return Ae.isLoop()});for(var p=f.length,m=function(oe){var ue=h.get(oe.id());return ue||(ue={},h.set(oe.id(),ue)),ue},b=function(oe){return(fe(oe)?u.$(oe):oe)[0]},w=function(oe){return m(b(oe)).dist},E=function(oe){for(var ue=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,he=b(oe),ye=[],de=he;;){if(de==null)return t.spawn();var me=m(de),Ce=me.edge,Se=me.pred;if(ye.unshift(de[0]),de.same(ue)&&ye.length>0)break;Ce!=null&&ye.unshift(Ce),de=Se}return l.spawn(ye)},C=0;C<d;C++){var x=c[C],S=m(x);x.same(o)?S.dist=0:S.dist=1/0,S.pred=null,S.edge=null}for(var k=!1,A=function(oe,ue,he,ye,de,me){var Ce=ye.dist+me;Ce<de.dist&&!he.same(ye.edge)&&(de.dist=Ce,de.pred=oe,de.edge=he,k=!0)},D=1;D<d;D++){k=!1;for(var B=0;B<p;B++){var P=f[B],R=P.source(),L=P.target(),I=s(P),M=m(R),O=m(L);A(R,L,P,M,O,I),i||A(L,R,P,O,M,I)}if(!k)break}if(k)for(var _=[],H=0;H<p;H++){var z=f[H],G=z.source(),W=z.target(),X=s(z),Z=m(G).dist,Q=m(W).dist;if(Z+X<Q||!i&&Q+X<Z)if(y||(Re("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var ee=[];Z+X<Q&&ee.push(G),!i&&Q+X<Z&&ee.push(W);for(var re=ee.length,K=0;K<re;K++){var N=ee[K],$=[N];$.push(m(N).edge);for(var J=m(N).pred;$.indexOf(J)===-1;)$.push(J),$.push(m(J).edge),J=m(J).pred;$=$.slice($.indexOf(J));for(var te=$[0].id(),le=0,xe=2;xe<$.length;xe+=2)$[xe].id()<te&&(te=$[xe].id(),le=xe);$=$.slice(le).concat($.slice(0,le)),$.push($[0]);var Ie=$.map(function(Ae){return Ae.id()}).join(",");_.indexOf(Ie)===-1&&(g.push(l.spawn($)),_.push(Ie))}}else break}return{distanceTo:w,pathTo:E,hasNegativeWeightCycle:y,negativeWeightCycles:g}}},Yc=Math.sqrt(2),Xc=function(e,t,a){a.length===0&&Ve("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],o=n[2],s=t[i],l=t[o],u=a,v=u.length-1;v>=0;v--){var f=u[v],c=f[1],d=f[2];(t[c]===s&&t[d]===l||t[c]===l&&t[d]===s)&&u.splice(v,1)}for(var h=0;h<u.length;h++){var y=u[h];y[1]===l?(u[h]=y.slice(),u[h][1]=s):y[2]===l&&(u[h]=y.slice(),u[h][2]=s)}for(var g=0;g<t.length;g++)t[g]===l&&(t[g]=s);return u},ai=function(e,t,a,n){for(;a>n;){var i=Math.floor(Math.random()*t.length);t=Xc(i,e,t),a--}return t},Zc={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(O){return O.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Yc);if(i<2){Ve("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],v=0;v<o;v++){var f=n[v];u.push([v,a.indexOf(f.source()),a.indexOf(f.target())])}for(var c=1/0,d=[],h=new Array(i),y=new Array(i),g=new Array(i),p=function(_,H){for(var z=0;z<i;z++)H[z]=_[z]},m=0;m<=s;m++){for(var b=0;b<i;b++)y[b]=b;var w=ai(y,u.slice(),i,l),E=w.slice();p(y,g);var C=ai(y,w,l,2),x=ai(g,E,l,2);C.length<=x.length&&C.length<c?(c=C.length,d=C,p(y,h)):x.length<=C.length&&x.length<c&&(c=x.length,d=x,p(g,h))}for(var S=this.spawn(d.map(function(O){return n[O[0]]})),k=this.spawn(),A=this.spawn(),D=h[0],B=0;B<h.length;B++){var P=h[B],R=a[B];P===D?k.merge(R):A.merge(R)}var L=function(_){var H=e.spawn();return _.forEach(function(z){H.merge(z),z.connectedEdges().forEach(function(G){e.contains(G)&&!S.contains(G)&&H.merge(G)})}),H},I=[L(k),L(A)],M={cut:S,components:I,partition1:k,partition2:A};return M}},Qc=function(e){return{x:e.x,y:e.y}},Tn=function(e,t,a){return{x:e.x*t+a.x,y:e.y*t+a.y}},ev=function(e,t,a){return{x:(e.x-a.x)/t,y:(e.y-a.y)/t}},Lt=function(e){return{x:e[0],y:e[1]}},Jc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.min(o,n))}return n},jc=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i<a;i++){var o=e[i];isFinite(o)&&(n=Math.max(o,n))}return n},eh=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=t;o<a;o++){var s=e[o];isFinite(s)&&(n+=s,i++)}return n/i},rh=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a<e.length&&e.splice(a,e.length-a),t>0&&e.splice(0,t));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,s++):e.splice(l,1)}i&&e.sort(function(c,d){return c-d});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},th=function(e){return Math.PI*e/180},qa=function(e,t){return Math.atan2(t,e)-Math.PI/2},qo=Math.log2||function(r){return Math.log(r)/Math.log(2)},rv=function(e){return e>0?1:e<0?-1:0},yt=function(e,t){return Math.sqrt(ct(e,t))},ct=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},ah=function(e){for(var t=e.length,a=0,n=0;n<t;n++)a+=e[n];for(var i=0;i<t;i++)e[i]=e[i]/a;return e},Je=function(e,t,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*t+n*n*a},Nt=function(e,t,a,n){return{x:Je(e.x,t.x,a.x,n),y:Je(e.y,t.y,a.y,n)}},nh=function(e,t,a,n){var i={x:t.x-e.x,y:t.y-e.y},o=yt(e,t),s={x:i.x/o,y:i.y/o};return a=a??0,n=n??a*o,{x:e.x+s.x*n,y:e.y+s.y*n}},pa=function(e,t,a){return Math.max(e,Math.min(a,t))},pr=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},ih=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},oh=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},sh=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},tv=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},uh=function(e,t,a){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Qa=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ja=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(t.length===1)a=n=i=o=t[0];else if(t.length===2)a=i=t[0],o=n=t[1];else if(t.length===4){var s=je(t,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Bs=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},Vo=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)},_t=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},lh=function(e,t){return _t(e,t.x,t.y)},av=function(e,t){return _t(e,t.x1,t.y1)&&_t(e,t.x2,t.y2)},nv=function(e,t,a,n,i,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?mt(i,o):l,v=i/2,f=o/2;u=Math.min(u,v,f);var c=u!==v,d=u!==f,h;if(c){var y=a-v+u-s,g=n-f-s,p=a+v-u+s,m=g;if(h=Jr(e,t,a,n,y,g,p,m,!1),h.length>0)return h}if(d){var b=a+v+s,w=n-f+u-s,E=b,C=n+f-u+s;if(h=Jr(e,t,a,n,b,w,E,C,!1),h.length>0)return h}if(c){var x=a-v+u-s,S=n+f+s,k=a+v-u+s,A=S;if(h=Jr(e,t,a,n,x,S,k,A,!1),h.length>0)return h}if(d){var D=a-v-s,B=n-f+u-s,P=D,R=n+f-u+s;if(h=Jr(e,t,a,n,D,B,P,R,!1),h.length>0)return h}var L;{var I=a-v+u,M=n-f+u;if(L=sa(e,t,a,n,I,M,u+s),L.length>0&&L[0]<=I&&L[1]<=M)return[L[0],L[1]]}{var O=a+v-u,_=n-f+u;if(L=sa(e,t,a,n,O,_,u+s),L.length>0&&L[0]>=O&&L[1]<=_)return[L[0],L[1]]}{var H=a+v-u,z=n+f-u;if(L=sa(e,t,a,n,H,z,u+s),L.length>0&&L[0]>=H&&L[1]>=z)return[L[0],L[1]]}{var G=a-v+u,W=n+f-u;if(L=sa(e,t,a,n,G,W,u+s),L.length>0&&L[0]<=G&&L[1]>=W)return[L[0],L[1]]}return[]},vh=function(e,t,a,n,i,o,s){var l=s,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,o),c=Math.max(n,o);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},fh=function(e,t,a,n,i,o,s,l,u){var v={x1:Math.min(a,s,i)-u,x2:Math.max(a,s,i)+u,y1:Math.min(n,l,o)-u,y2:Math.max(n,l,o)+u};return!(e<v.x1||e>v.x2||t<v.y1||t>v.y2)},ch=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,l=(-t+o)/s,u=(-t-o)/s;return[l,u]},hh=function(e,t,a,n,i){var o=1e-5;e===0&&(e=o),t/=e,a/=e,n/=e;var s,l,u,v,f,c,d,h;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,s=l*l*l+u*u,i[1]=0,d=t/3,s>0){f=u+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=u-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+f+c,d+=(f+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+f)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,s===0){h=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),h=2*Math.sqrt(l),i[0]=-d+h*Math.cos(v/3),i[2]=-d+h*Math.cos((v+2*Math.PI)/3),i[4]=-d+h*Math.cos((v+4*Math.PI)/3)},dh=function(e,t,a,n,i,o,s,l){var u=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*l+4*o*o-4*o*l+l*l,v=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*l-6*o*o+3*o*l,f=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*l-n*t+2*o*o+2*o*t-l*t,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*t-o*t,d=[];hh(u,v,f,c,d);for(var h=1e-7,y=[],g=0;g<6;g+=2)Math.abs(d[g+1])<h&&d[g]>=0&&d[g]<=1&&y.push(d[g]);y.push(1),y.push(0);for(var p=-1,m,b,w,E=0;E<y.length;E++)m=Math.pow(1-y[E],2)*a+2*(1-y[E])*y[E]*i+y[E]*y[E]*s,b=Math.pow(1-y[E],2)*n+2*(1-y[E])*y[E]*o+y[E]*y[E]*l,w=Math.pow(m-e,2)+Math.pow(b-t,2),p>=0?w<p&&(p=w):p=w;return p},gh=function(e,t,a,n,i,o){var s=[e-a,t-n],l=[i-a,o-n],u=l[0]*l[0]+l[1]*l[1],v=s[0]*s[0]+s[1]*s[1],f=s[0]*l[0]+s[1]*l[1],c=f*f/u;return f<0?v:c>u?(e-i)*(e-i)+(t-o)*(t-o):v-c},gr=function(e,t,a){for(var n,i,o,s,l,u=0,v=0;v<a.length/2;v++)if(n=a[v*2],i=a[v*2+1],v+1<a.length/2?(o=a[(v+1)*2],s=a[(v+1)*2+1]):(o=a[(v+1-a.length/2)*2],s=a[(v+1-a.length/2)*2+1]),!(n==e&&o==e))if(n>=e&&e>=o||n<=e&&e<=o)l=(e-n)/(o-n)*(s-i)+i,l>t&&u++;else continue;return u%2!==0},Ur=function(e,t,a,n,i,o,s,l,u){var v=new Array(a.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),d=Math.sin(-f),h=0;h<v.length/2;h++)v[h*2]=o/2*(a[h*2]*c-a[h*2+1]*d),v[h*2+1]=s/2*(a[h*2+1]*c+a[h*2]*d),v[h*2]+=n,v[h*2+1]+=i;var y;if(u>0){var g=cn(v,-u);y=fn(g)}else y=v;return gr(e,t,y)},ph=function(e,t,a,n,i,o,s,l){for(var u=new Array(a.length*2),v=0;v<l.length;v++){var f=l[v];u[v*4+0]=f.startX,u[v*4+1]=f.startY,u[v*4+2]=f.stopX,u[v*4+3]=f.stopY;var c=Math.pow(f.cx-e,2)+Math.pow(f.cy-t,2);if(c<=Math.pow(f.radius,2))return!0}return gr(e,t,u)},fn=function(e){for(var t=new Array(e.length/2),a,n,i,o,s,l,u,v,f=0;f<e.length/4;f++){a=e[f*4],n=e[f*4+1],i=e[f*4+2],o=e[f*4+3],f<e.length/4-1?(s=e[(f+1)*4],l=e[(f+1)*4+1],u=e[(f+1)*4+2],v=e[(f+1)*4+3]):(s=e[0],l=e[1],u=e[2],v=e[3]);var c=Jr(a,n,i,o,s,l,u,v,!0);t[f*2]=c[0],t[f*2+1]=c[1]}return t},cn=function(e,t){for(var a=new Array(e.length*2),n,i,o,s,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(o=e[(l+1)*2],s=e[(l+1)*2+1]):(o=e[0],s=e[1]);var u=s-i,v=-(o-n),f=Math.sqrt(u*u+v*v),c=u/f,d=v/f;a[l*4]=n+c*t,a[l*4+1]=i+d*t,a[l*4+2]=o+c*t,a[l*4+3]=s+d*t}return a},yh=function(e,t,a,n,i,o){var s=a-e,l=n-t;s/=i,l/=o;var u=Math.sqrt(s*s+l*l),v=u-1;if(v<0)return[];var f=v/u;return[(a-e)*f+e,(n-t)*f+t]},pt=function(e,t,a,n,i,o,s){return e-=i,t-=o,e/=a/2+s,t/=n/2+s,e*e+t*t<=1},sa=function(e,t,a,n,i,o,s){var l=[a-e,n-t],u=[e-i,t-o],v=l[0]*l[0]+l[1]*l[1],f=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-s*s,d=f*f-4*v*c;if(d<0)return[];var h=(-f+Math.sqrt(d))/(2*v),y=(-f-Math.sqrt(d))/(2*v),g=Math.min(h,y),p=Math.max(h,y),m=[];if(g>=0&&g<=1&&m.push(g),p>=0&&p<=1&&m.push(p),m.length===0)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var E=m[1]*l[0]+e,C=m[1]*l[1]+t;return[b,w,E,C]}else return[b,w]},ni=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},Jr=function(e,t,a,n,i,o,s,l,u){var v=e-i,f=a-e,c=s-i,d=t-o,h=n-t,y=l-o,g=c*d-y*v,p=f*d-h*v,m=y*f-c*h;if(m!==0){var b=g/m,w=p/m,E=.001,C=0-E,x=1+E;return C<=b&&b<=x&&C<=w&&w<=x?[e+b*f,t+b*h]:u?[e+b*f,t+b*h]:[]}else return g===0||p===0?ni(e,a,s)===s?[s,l]:ni(e,a,i)===i?[i,o]:ni(i,s,a)===a?[a,n]:[]:[]},ya=function(e,t,a,n,i,o,s,l){var u=[],v,f=new Array(a.length),c=!0;o==null&&(c=!1);var d;if(c){for(var h=0;h<f.length/2;h++)f[h*2]=a[h*2]*o+n,f[h*2+1]=a[h*2+1]*s+i;if(l>0){var y=cn(f,-l);d=fn(y)}else d=f}else d=a;for(var g,p,m,b,w=0;w<d.length/2;w++)g=d[w*2],p=d[w*2+1],w<d.length/2-1?(m=d[(w+1)*2],b=d[(w+1)*2+1]):(m=d[0],b=d[1]),v=Jr(e,t,n,i,g,p,m,b),v.length!==0&&u.push(v[0],v[1]);return u},mh=function(e,t,a,n,i,o,s,l,u){var v=[],f,c=new Array(a.length*2);u.forEach(function(m,b){b===0?(c[c.length-2]=m.startX,c[c.length-1]=m.startY):(c[b*4-2]=m.startX,c[b*4-1]=m.startY),c[b*4]=m.stopX,c[b*4+1]=m.stopY,f=sa(e,t,n,i,m.cx,m.cy,m.radius),f.length!==0&&v.push(f[0],f[1])});for(var d=0;d<c.length/4;d++)f=Jr(e,t,n,i,c[d*4],c[d*4+1],c[d*4+2],c[d*4+3],!1),f.length!==0&&v.push(f[0],f[1]);if(v.length>2){for(var h=[v[0],v[1]],y=Math.pow(h[0]-e,2)+Math.pow(h[1]-t,2),g=1;g<v.length/2;g++){var p=Math.pow(v[g*2]-e,2)+Math.pow(v[g*2+1]-t,2);p<=y&&(h[0]=v[g*2],h[1]=v[g*2+1],y=p)}return h}return v},Va=function(e,t,a){var n=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),o=(i-a)/i;return o<0&&(o=1e-5),[t[0]+o*n[0],t[1]+o*n[1]]},cr=function(e,t){var a=ho(e,t);return a=iv(a),a},iv=function(e){for(var t,a,n=e.length/2,i=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u<n;u++)t=e[2*u],a=e[2*u+1],i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,a),l=Math.max(l,a);for(var v=2/(s-i),f=2/(l-o),c=0;c<n;c++)t=e[2*c]=e[2*c]*v,a=e[2*c+1]=e[2*c+1]*f,i=Math.min(i,t),s=Math.max(s,t),o=Math.min(o,a),l=Math.max(l,a);if(o<-1)for(var d=0;d<n;d++)a=e[2*d+1]=e[2*d+1]+(-1-o);return e},ho=function(e,t){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=t;for(var i=new Array(e*2),o,s=0;s<e;s++)o=s*a+n,i[2*s]=Math.cos(o),i[2*s+1]=Math.sin(-o);return i},mt=function(e,t){return Math.min(e/4,t/4,8)},ov=function(e,t){return Math.min(e/10,t/10,8)},_o=function(){return 8},bh=function(e,t,a){return[e-2*t+a,2*(t-e),e]},go=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},wh=We({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),xh={pageRank:function(e){for(var t=wh(e),a=t.dampingFactor,n=t.precision,i=t.iterations,o=t.weight,s=this._private.cy,l=this.byGroup(),u=l.nodes,v=l.edges,f=u.length,c=f*f,d=v.length,h=new Array(c),y=new Array(f),g=(1-a)/f,p=0;p<f;p++){for(var m=0;m<f;m++){var b=p*f+m;h[b]=0}y[p]=0}for(var w=0;w<d;w++){var E=v[w],C=E.data("source"),x=E.data("target");if(C!==x){var S=u.indexOfId(C),k=u.indexOfId(x),A=o(E),D=k*f+S;h[D]+=A,y[S]+=A}}for(var B=1/f+g,P=0;P<f;P++)if(y[P]===0)for(var R=0;R<f;R++){var L=R*f+P;h[L]=B}else for(var I=0;I<f;I++){var M=I*f+P;h[M]=h[M]/y[P]+g}for(var O=new Array(f),_=new Array(f),H,z=0;z<f;z++)O[z]=1;for(var G=0;G<i;G++){for(var W=0;W<f;W++)_[W]=0;for(var X=0;X<f;X++)for(var Z=0;Z<f;Z++){var Q=X*f+Z;_[X]+=h[Q]*O[Z]}ah(_),H=O,O=_,_=H;for(var ee=0,re=0;re<f;re++){var K=H[re]-O[re];ee+=K*K}if(ee<n)break}var N={rank:function(J){return J=s.collection(J)[0],O[u.indexOf(J)]}};return N}},Rs=We({root:null,weight:function(e){return 1},directed:!1,alpha:0}),zt={degreeCentralityNormalized:function(e){e=Rs(e);var t=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var v={},f={},c=0,d=0,h=0;h<n;h++){var y=a[h],g=y.id();e.root=y;var p=this.degreeCentrality(e);c<p.indegree&&(c=p.indegree),d<p.outdegree&&(d=p.outdegree),v[g]=p.indegree,f[g]=p.outdegree}return{indegree:function(b){return c==0?0:(fe(b)&&(b=t.filter(b)),v[b.id()]/c)},outdegree:function(b){return d===0?0:(fe(b)&&(b=t.filter(b)),f[b.id()]/d)}}}else{for(var i={},o=0,s=0;s<n;s++){var l=a[s];e.root=l;var u=this.degreeCentrality(e);o<u.degree&&(o=u.degree),i[l.id()]=u.degree}return{degree:function(b){return o===0?0:(fe(b)&&(b=t.filter(b)),i[b.id()]/o)}}}},degreeCentrality:function(e){e=Rs(e);var t=this.cy(),a=this,n=e,i=n.root,o=n.weight,s=n.directed,l=n.alpha;if(i=t.collection(i)[0],s){for(var d=i.connectedEdges(),h=d.filter(function(C){return C.target().same(i)&&a.has(C)}),y=d.filter(function(C){return C.source().same(i)&&a.has(C)}),g=h.length,p=y.length,m=0,b=0,w=0;w<h.length;w++)m+=o(h[w]);for(var E=0;E<y.length;E++)b+=o(y[E]);return{indegree:Math.pow(g,1-l)*Math.pow(m,l),outdegree:Math.pow(p,1-l)*Math.pow(b,l)}}else{for(var u=i.connectedEdges().intersection(a),v=u.length,f=0,c=0;c<u.length;c++)f+=o(u[c]);return{degree:Math.pow(v,1-l)*Math.pow(f,l)}}}};zt.dc=zt.degreeCentrality;zt.dcn=zt.degreeCentralityNormalised=zt.degreeCentralityNormalized;var Ms=We({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Ft={closenessCentralityNormalized:function(e){for(var t=Ms(e),a=t.harmonic,n=t.weight,i=t.directed,o=this.cy(),s={},l=0,u=this.nodes(),v=this.floydWarshall({weight:n,directed:i}),f=0;f<u.length;f++){for(var c=0,d=u[f],h=0;h<u.length;h++)if(f!==h){var y=v.distance(d,u[h]);a?c+=1/y:c+=y}a||(c=1/c),l<c&&(l=c),s[d.id()]=c}return{closeness:function(p){return l==0?0:(fe(p)?p=o.filter(p)[0].id():p=p.id(),s[p]/l)}}},closenessCentrality:function(e){var t=Ms(e),a=t.root,n=t.weight,i=t.directed,o=t.harmonic;a=this.filter(a)[0];for(var s=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),v=0;v<u.length;v++){var f=u[v];if(!f.same(a)){var c=s.distanceTo(f);o?l+=1/c:l+=c}}return o?l:1/l}};Ft.cc=Ft.closenessCentrality;Ft.ccn=Ft.closenessCentralityNormalised=Ft.closenessCentralityNormalized;var Eh=We({weight:null,directed:!1}),po={betweennessCentrality:function(e){for(var t=Eh(e),a=t.directed,n=t.weight,i=n!=null,o=this.cy(),s=this.nodes(),l={},u={},v=0,f={set:function(b,w){u[b]=w,w>v&&(v=w)},get:function(b){return u[b]}},c=0;c<s.length;c++){var d=s[c],h=d.id();a?l[h]=d.outgoers().nodes():l[h]=d.openNeighborhood().nodes(),f.set(h,0)}for(var y=function(){for(var b=s[g].id(),w=[],E={},C={},x={},S=new Aa(function(X,Z){return x[X]-x[Z]}),k=0;k<s.length;k++){var A=s[k].id();E[A]=[],C[A]=0,x[A]=1/0}for(C[b]=1,x[b]=0,S.push(b);!S.empty();){var D=S.pop();if(w.push(D),i)for(var B=0;B<l[D].length;B++){var P=l[D][B],R=o.getElementById(D),L=void 0;R.edgesTo(P).length>0?L=R.edgesTo(P)[0]:L=P.edgesTo(R)[0];var I=n(L);P=P.id(),x[P]>x[D]+I&&(x[P]=x[D]+I,S.nodes.indexOf(P)<0?S.push(P):S.updateItem(P),C[P]=0,E[P]=[]),x[P]==x[D]+I&&(C[P]=C[P]+C[D],E[P].push(D))}else for(var M=0;M<l[D].length;M++){var O=l[D][M].id();x[O]==1/0&&(S.push(O),x[O]=x[D]+1),x[O]==x[D]+1&&(C[O]=C[O]+C[D],E[O].push(D))}}for(var _={},H=0;H<s.length;H++)_[s[H].id()]=0;for(;w.length>0;){for(var z=w.pop(),G=0;G<E[z].length;G++){var W=E[z][G];_[W]=_[W]+C[W]/C[z]*(1+_[z])}z!=s[g].id()&&f.set(z,f.get(z)+_[z])}},g=0;g<s.length;g++)y();var p={betweenness:function(b){var w=o.collection(b).id();return f.get(w)},betweennessNormalized:function(b){if(v==0)return 0;var w=o.collection(b).id();return f.get(w)/v}};return p.betweennessNormalised=p.betweennessNormalized,p}};po.bc=po.betweennessCentrality;var Ch=We({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(r){return 1}]}),Th=function(e){return Ch(e)},Sh=function(e,t){for(var a=0,n=0;n<t.length;n++)a+=t[n](e);return a},Dh=function(e,t,a){for(var n=0;n<t;n++)e[n*t+n]=a},sv=function(e,t){for(var a,n=0;n<t;n++){a=0;for(var i=0;i<t;i++)a+=e[i*t+n];for(var o=0;o<t;o++)e[o*t+n]=e[o*t+n]/a}},kh=function(e,t,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var o=0;o<a;o++)n[i*a+o]=0;for(var s=0;s<a;s++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+s]*t[s*a+l]}return n},Ph=function(e,t,a){for(var n=e.slice(0),i=1;i<a;i++)e=kh(e,n,t);return e},Ah=function(e,t,a){for(var n=new Array(t*t),i=0;i<t*t;i++)n[i]=Math.pow(e[i],a);return sv(n,t),n},Bh=function(e,t,a,n){for(var i=0;i<a;i++){var o=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),s=Math.round(t[i]*Math.pow(10,n))/Math.pow(10,n);if(o!==s)return!1}return!0},Rh=function(e,t,a,n){for(var i=[],o=0;o<t;o++){for(var s=[],l=0;l<t;l++)Math.round(e[o*t+l]*1e3)/1e3>0&&s.push(a[l]);s.length!==0&&i.push(n.collection(s))}return i},Mh=function(e,t){for(var a=0;a<e.length;a++)if(!t[a]||e[a].id()!==t[a].id())return!1;return!0},Lh=function(e){for(var t=0;t<e.length;t++)for(var a=0;a<e.length;a++)t!=a&&Mh(e[t],e[a])&&e.splice(a,1);return e},Ls=function(e){for(var t=this.nodes(),a=this.edges(),n=this.cy(),i=Th(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var l=t.length,u=l*l,v=new Array(u),f,c=0;c<u;c++)v[c]=0;for(var d=0;d<a.length;d++){var h=a[d],y=o[h.source().id()],g=o[h.target().id()],p=Sh(h,i.attributes);v[y*l+g]+=p,v[g*l+y]+=p}Dh(v,l,i.multFactor),sv(v,l);for(var m=!0,b=0;m&&b<i.maxIterations;)m=!1,f=Ph(v,l,i.expandFactor),v=Ah(f,l,i.inflateFactor),Bh(v,f,u,4)||(m=!0),b++;var w=Rh(v,l,t,n);return w=Lh(w),w},Ih={markovClustering:Ls,mcl:Ls},Oh=function(e){return e},uv=function(e,t){return Math.abs(t-e)},Is=function(e,t,a){return e+uv(t,a)},Os=function(e,t,a){return e+Math.pow(a-t,2)},Nh=function(e){return Math.sqrt(e)},zh=function(e,t,a){return Math.max(e,uv(t,a))},ea=function(e,t,a,n,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Oh,s=n,l,u,v=0;v<e;v++)l=t(v),u=a(v),s=i(s,l,u);return o(s)},Gt={euclidean:function(e,t,a){return e>=2?ea(e,t,a,0,Os,Nh):ea(e,t,a,0,Is)},squaredEuclidean:function(e,t,a){return ea(e,t,a,0,Os)},manhattan:function(e,t,a){return ea(e,t,a,0,Is)},max:function(e,t,a){return ea(e,t,a,-1/0,zh)}};Gt["squared-euclidean"]=Gt.squaredEuclidean;Gt.squaredeuclidean=Gt.squaredEuclidean;function Sn(r,e,t,a,n,i){var o;return _e(r)?o=r:o=Gt[r]||Gt.euclidean,e===0&&_e(r)?o(n,i):o(e,t,a,n,i)}var Fh=We({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Go=function(e){return Fh(e)},hn=function(e,t,a,n,i){var o=i!=="kMedoids",s=o?function(f){return a[f]}:function(f){return n[f](a)},l=function(c){return n[c](t)},u=a,v=t;return Sn(e,n.length,s,l,u,v)},ii=function(e,t,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(t),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,o[u]=e.max(a[u]).value;for(var v=0;v<t;v++){l=[];for(var f=0;f<n;f++)l[f]=Math.random()*(o[f]-i[f])+i[f];s[v]=l}return s},lv=function(e,t,a,n,i){for(var o=1/0,s=0,l=0;l<t.length;l++){var u=hn(a,e,t[l],n,i);u<o&&(o=u,s=l)}return s},vv=function(e,t,a){for(var n=[],i=null,o=0;o<t.length;o++)i=t[o],a[i.id()]===e&&n.push(i);return n},qh=function(e,t,a){return Math.abs(t-e)<=a},Vh=function(e,t,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var o=Math.abs(e[n][i]-t[n][i]);if(o>a)return!1}return!0},_h=function(e,t,a){for(var n=0;n<a;n++)if(e===t[n])return!0;return!1},Ns=function(e,t){var a=new Array(t);if(e.length<50)for(var n=0;n<t;n++){for(var i=e[Math.floor(Math.random()*e.length)];_h(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var o=0;o<t;o++)a[o]=e[Math.floor(Math.random()*e.length)];return a},zs=function(e,t,a){for(var n=0,i=0;i<t.length;i++)n+=hn("manhattan",t[i],e,a,"kMedoids");return n},Gh=function(e){var t=this.cy(),a=this.nodes(),n=null,i=Go(e),o=new Array(i.k),s={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=ii(a,i.k,i.attributes)):Ue(i.testCentroids)==="object"?l=i.testCentroids:l=ii(a,i.k,i.attributes):l=ii(a,i.k,i.attributes);for(var u=!0,v=0;u&&v<i.maxIterations;){for(var f=0;f<a.length;f++)n=a[f],s[n.id()]=lv(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var d=vv(c,a,s);if(d.length!==0){for(var h=i.attributes.length,y=l[c],g=new Array(h),p=new Array(h),m=0;m<h;m++){p[m]=0;for(var b=0;b<d.length;b++)n=d[b],p[m]+=i.attributes[m](n);g[m]=p[m]/d.length,qh(g[m],y[m],i.sensitivityThreshold)||(u=!0)}l[c]=g,o[c]=t.collection(d)}}v++}return o},Hh=function(e){var t=this.cy(),a=this.nodes(),n=null,i=Go(e),o=new Array(i.k),s,l={},u,v=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(Ue(i.testCentroids)==="object"?s=i.testCentroids:s=Ns(a,i.k)):s=Ns(a,i.k);for(var f=!0,c=0;f&&c<i.maxIterations;){for(var d=0;d<a.length;d++)n=a[d],l[n.id()]=lv(n,s,i.distance,i.attributes,"kMedoids");f=!1;for(var h=0;h<s.length;h++){var y=vv(h,a,l);if(y.length!==0){v[h]=zs(s[h],y,i.attributes);for(var g=0;g<y.length;g++)u=zs(y[g],y,i.attributes),u<v[h]&&(v[h]=u,s[h]=y[g],f=!0);o[h]=t.collection(y)}}c++}return o},Kh=function(e,t,a,n,i){for(var o,s,l=0;l<t.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var v=0;v<e.length;v++)for(var f=0;f<i.attributes.length;f++){o=0,s=0;for(var c=0;c<t.length;c++)o+=n[c][v]*i.attributes[f](t[c]),s+=n[c][v];e[v][f]=o/s}},$h=function(e,t,a,n,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var s,l,u,v=2/(i.m-1),f=0;f<a.length;f++)for(var c=0;c<n.length;c++){s=0;for(var d=0;d<a.length;d++)l=hn(i.distance,n[c],a[f],i.attributes,"cmeans"),u=hn(i.distance,n[c],a[d],i.attributes,"cmeans"),s+=Math.pow(l/u,v);e[c][f]=1/s}},Uh=function(e,t,a,n){for(var i=new Array(a.k),o=0;o<i.length;o++)i[o]=[];for(var s,l,u=0;u<t.length;u++){s=-1/0,l=-1;for(var v=0;v<t[0].length;v++)t[u][v]>s&&(s=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f<i.length;f++)i[f]=n.collection(i[f]);return i},Fs=function(e){var t=this.cy(),a=this.nodes(),n=Go(e),i,o,s,l,u;l=new Array(a.length);for(var v=0;v<a.length;v++)l[v]=new Array(n.k);s=new Array(a.length);for(var f=0;f<a.length;f++)s[f]=new Array(n.k);for(var c=0;c<a.length;c++){for(var d=0,h=0;h<n.k;h++)s[c][h]=Math.random(),d+=s[c][h];for(var y=0;y<n.k;y++)s[c][y]=s[c][y]/d}o=new Array(n.k);for(var g=0;g<n.k;g++)o[g]=new Array(n.attributes.length);u=new Array(a.length);for(var p=0;p<a.length;p++)u[p]=new Array(n.k);for(var m=!0,b=0;m&&b<n.maxIterations;)m=!1,Kh(o,a,s,u,n),$h(s,l,o,a,n),Vh(s,l,n.sensitivityThreshold)||(m=!0),b++;return i=Uh(a,s,n,t),{clusters:i,degreeOfMembership:s}},Wh={kMeans:Gh,kMedoids:Hh,fuzzyCMeans:Fs,fcm:Fs},Yh=We({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Xh={single:"min",complete:"max"},Zh=function(e){var t=Yh(e),a=Xh[t.linkage];return a!=null&&(t.linkage=a),t},qs=function(e,t,a,n,i){for(var o=0,s=1/0,l,u=i.attributes,v=function(k,A){return Sn(i.distance,u.length,function(D){return u[D](k)},function(D){return u[D](A)},k,A)},f=0;f<e.length;f++){var c=e[f].key,d=a[c][n[c]];d<s&&(o=c,s=d)}if(i.mode==="threshold"&&s>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var h=t[o],y=t[n[o]],g;i.mode==="dendrogram"?g={left:h,right:y,key:h.key}:g={value:h.value.concat(y.value),key:h.key},e[h.index]=g,e.splice(y.index,1),t[h.key]=g;for(var p=0;p<e.length;p++){var m=e[p];h.key===m.key?l=1/0:i.linkage==="min"?(l=a[h.key][m.key],a[h.key][m.key]>a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[h.key][m.key],a[h.key][m.key]<a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="mean"?l=(a[h.key][m.key]*h.size+a[y.key][m.key]*y.size)/(h.size+y.size):i.mode==="dendrogram"?l=v(m.value,h.value):l=v(m.value[0],h.value[0]),a[h.key][m.key]=a[m.key][h.key]=l}for(var b=0;b<e.length;b++){var w=e[b].key;if(n[w]===h.key||n[w]===y.key){for(var E=w,C=0;C<e.length;C++){var x=e[C].key;a[w][x]<a[w][E]&&(E=x)}n[w]=E}e[b].index=b}return h.key=y.key=h.index=y.index=null,!0},It=function(e,t,a){e&&(e.value?t.push(e.value):(e.left&&It(e.left,t),e.right&&It(e.right,t)))},yo=function(e,t){if(!e)return"";if(e.left&&e.right){var a=yo(e.left,t),n=yo(e.right,t),i=t.add({group:"nodes",data:{id:a+","+n}});return t.add({group:"edges",data:{source:a,target:i.id()}}),t.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},mo=function(e,t,a){if(!e)return[];var n=[],i=[],o=[];return t===0?(e.left&&It(e.left,n),e.right&&It(e.right,i),o=n.concat(i),[a.collection(o)]):t===1?e.value?[a.collection(e.value)]:(e.left&&It(e.left,n),e.right&&It(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=mo(e.left,t-1,a)),e.right&&(i=mo(e.right,t-1,a)),n.concat(i))},Vs=function(e){for(var t=this.cy(),a=this.nodes(),n=Zh(e),i=n.attributes,o=function(b,w){return Sn(n.distance,i.length,function(E){return i[E](b)},function(E){return i[E](w)},b,w)},s=[],l=[],u=[],v=[],f=0;f<a.length;f++){var c={value:n.mode==="dendrogram"?a[f]:[a[f]],key:f,index:f};s[f]=c,v[f]=c,l[f]=[],u[f]=0}for(var d=0;d<s.length;d++)for(var h=0;h<=d;h++){var y=void 0;n.mode==="dendrogram"?y=d===h?1/0:o(s[d].value,s[h].value):y=d===h?1/0:o(s[d].value[0],s[h].value[0]),l[d][h]=y,l[h][d]=y,y<l[d][u[d]]&&(u[d]=h)}for(var g=qs(s,v,l,u,n);g;)g=qs(s,v,l,u,n);var p;return n.mode==="dendrogram"?(p=mo(s[0],n.dendrogramDepth,t),n.addDendrogram&&yo(s[0],t)):(p=new Array(s.length),s.forEach(function(m,b){m.key=m.index=null,p[b]=t.collection(m.value)})),p},Qh={hierarchicalClustering:Vs,hca:Vs},Jh=We({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),jh=function(e){var t=e.damping,a=e.preference;.5<=t&&t<1||Ve("Damping must range on [0.5, 1). Got: ".concat(t));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ae(a)||Ve("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),Jh(e)},ed=function(e,t,a,n){var i=function(s,l){return n[l](s)};return-Sn(e,n.length,function(o){return i(t,o)},function(o){return i(a,o)},t,a)},rd=function(e,t){var a=null;return t==="median"?a=rh(e):t==="mean"?a=eh(e):t==="min"?a=Jc(e):t==="max"?a=jc(e):a=t,a},td=function(e,t,a){for(var n=[],i=0;i<e;i++)t[i*e+i]+a[i*e+i]>0&&n.push(i);return n},_s=function(e,t,a){for(var n=[],i=0;i<e;i++){for(var o=-1,s=-1/0,l=0;l<a.length;l++){var u=a[l];t[i*e+u]>s&&(o=u,s=t[i*e+u])}o>0&&n.push(o)}for(var v=0;v<a.length;v++)n[a[v]]=a[v];return n},ad=function(e,t,a){for(var n=_s(e,t,a),i=0;i<a.length;i++){for(var o=[],s=0;s<n.length;s++)n[s]===a[i]&&o.push(s);for(var l=-1,u=-1/0,v=0;v<o.length;v++){for(var f=0,c=0;c<o.length;c++)f+=t[o[c]*e+o[v]];f>u&&(l=v,u=f)}a[i]=o[l]}return n=_s(e,t,a),n},Gs=function(e){for(var t=this.cy(),a=this.nodes(),n=jh(e),i={},o=0;o<a.length;o++)i[a[o].id()]=o;var s,l,u,v,f,c;s=a.length,l=s*s,u=new Array(l);for(var d=0;d<l;d++)u[d]=-1/0;for(var h=0;h<s;h++)for(var y=0;y<s;y++)h!==y&&(u[h*s+y]=ed(n.distance,a[h],a[y],n.attributes));v=rd(u,n.preference);for(var g=0;g<s;g++)u[g*s+g]=v;f=new Array(l);for(var p=0;p<l;p++)f[p]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var b=new Array(s),w=new Array(s),E=new Array(s),C=0;C<s;C++)b[C]=0,w[C]=0,E[C]=0;for(var x=new Array(s*n.minIterations),S=0;S<x.length;S++)x[S]=0;var k;for(k=0;k<n.maxIterations;k++){for(var A=0;A<s;A++){for(var D=-1/0,B=-1/0,P=-1,R=0,L=0;L<s;L++)b[L]=f[A*s+L],R=c[A*s+L]+u[A*s+L],R>=D?(B=D,D=R,P=L):R>B&&(B=R);for(var I=0;I<s;I++)f[A*s+I]=(1-n.damping)*(u[A*s+I]-D)+n.damping*b[I];f[A*s+P]=(1-n.damping)*(u[A*s+P]-B)+n.damping*b[P]}for(var M=0;M<s;M++){for(var O=0,_=0;_<s;_++)b[_]=c[_*s+M],w[_]=Math.max(0,f[_*s+M]),O+=w[_];O-=w[M],w[M]=f[M*s+M],O+=w[M];for(var H=0;H<s;H++)c[H*s+M]=(1-n.damping)*Math.min(0,O-w[H])+n.damping*b[H];c[M*s+M]=(1-n.damping)*(O-w[M])+n.damping*b[M]}for(var z=0,G=0;G<s;G++){var W=c[G*s+G]+f[G*s+G]>0?1:0;x[k%n.minIterations*s+G]=W,z+=W}if(z>0&&(k>=n.minIterations-1||k==n.maxIterations-1)){for(var X=0,Z=0;Z<s;Z++){E[Z]=0;for(var Q=0;Q<n.minIterations;Q++)E[Z]+=x[Q*s+Z];(E[Z]===0||E[Z]===n.minIterations)&&X++}if(X===s)break}}for(var ee=td(s,f,c),re=ad(s,u,ee),K={},N=0;N<ee.length;N++)K[ee[N]]=[];for(var $=0;$<a.length;$++){var J=i[a[$].id()],te=re[J];te!=null&&K[te].push(a[$])}for(var le=new Array(ee.length),xe=0;xe<ee.length;xe++)le[xe]=t.collection(K[ee[xe]]);return le},nd={affinityPropagation:Gs,ap:Gs},id=We({root:void 0,directed:!1}),od={hierholzer:function(e){if(!ke(e)){var t=arguments;e={root:t[0],directed:t[1]}}var a=id(e),n=a.root,i=a.directed,o=this,s=!1,l,u,v;n&&(v=fe(n)?this.filter(n)[0].id():n[0].id());var f={},c={};i?o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.indegree(!0),E=m.outdegree(!0),C=w-E,x=E-w;C==1?l?s=!0:l=b:x==1?u?s=!0:u=b:(x>1||C>1)&&(s=!0),f[b]=[],m.outgoers().forEach(function(S){S.isEdge()&&f[b].push(S.id())})}else c[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(l?u?s=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(E){return f[b].push(E.id())})}else c[b]=[m.source().id(),m.target().id()]});var d={found:!1,trail:void 0};if(s)return d;if(u&&l)if(i){if(v&&u!=v)return d;v=u}else{if(v&&u!=v&&l!=v)return d;v||(v=u)}else v||(v=o[0].id());var h=function(b){for(var w=b,E=[b],C,x,S;f[w].length;)C=f[w].shift(),x=c[C][0],S=c[C][1],w!=S?(f[S]=f[S].filter(function(k){return k!=C}),w=S):!i&&w!=x&&(f[x]=f[x].filter(function(k){return k!=C}),w=x),E.unshift(C),E.unshift(w);return E},y=[],g=[];for(g=h(v);g.length!=1;)f[g[0]].length==0?(y.unshift(o.getElementById(g.shift())),y.unshift(o.getElementById(g.shift()))):g=h(g.shift()).concat(g);y.unshift(o.getElementById(g.shift()));for(var p in f)if(f[p].length)return d;return d.found=!0,d.trail=this.spawn(y,!0),d}},_a=function(){var e=this,t={},a=0,n=0,i=[],o=[],s={},l=function(c,d){for(var h=o.length-1,y=[],g=e.spawn();o[h].x!=c||o[h].y!=d;)y.push(o.pop().edge),h--;y.push(o.pop().edge),y.forEach(function(p){var m=p.connectedNodes().intersection(e);g.merge(p),m.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(e);g.merge(b),t[w].cutVertex?g.merge(E.filter(function(C){return C.isLoop()})):g.merge(E)})}),i.push(g)},u=function(c,d,h){c===h&&(n+=1),t[d]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(d).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(d)));else{var g,p,m,b;y.forEach(function(w){g=w.source().id(),p=w.target().id(),m=g===d?p:g,m!==h&&(b=w.id(),s[b]||(s[b]=!0,o.push({x:d,y:m,edge:w})),m in t?t[d].low=Math.min(t[d].low,t[m].id):(u(c,m,d),t[d].low=Math.min(t[d].low,t[m].low),t[d].id<=t[m].low&&(t[d].cutVertex=!0,l(d,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},sd={hopcroftTarjanBiconnected:_a,htbc:_a,htb:_a,hopcroftTarjanBiconnectedComponents:_a},Ga=function(){var e=this,t={},a=0,n=[],i=[],o=e.spawn(e),s=function(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(y){var g=y.target().id();g!==u&&(g in t||s(g),t[g].explored||(t[u].low=Math.min(t[u].low,t[g].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var d=f.edgesWith(f),h=f.merge(d);n.push(h),o=o.difference(h)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||s(u)}}),{cut:o,components:n}},ud={tarjanStronglyConnected:Ga,tsc:Ga,tscc:Ga,tarjanStronglyConnectedComponents:Ga},fv={};[ga,Vc,_c,Hc,$c,Wc,Zc,xh,zt,Ft,po,Ih,Wh,Qh,nd,od,sd,ud].forEach(function(r){ge(fv,r)});/*!
5
- Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
6
- Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
7
- Licensed under The MIT License (http://opensource.org/licenses/MIT)
8
- */var cv=0,hv=1,dv=2,Br=function(e){if(!(this instanceof Br))return new Br(e);this.id="Thenable/1.0.7",this.state=cv,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Br.prototype={fulfill:function(e){return Hs(this,hv,"fulfillValue",e)},reject:function(e){return Hs(this,dv,"rejectReason",e)},then:function(e,t){var a=this,n=new Br;return a.onFulfilled.push($s(e,n,"fulfill")),a.onRejected.push($s(t,n,"reject")),gv(a),n.proxy}};var Hs=function(e,t,a,n){return e.state===cv&&(e.state=t,e[a]=n,gv(e)),e},gv=function(e){e.state===hv?Ks(e,"onFulfilled",e.fulfillValue):e.state===dv&&Ks(e,"onRejected",e.rejectReason)},Ks=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var s=0;s<n.length;s++)n[s](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},$s=function(e,t,a){return function(n){if(typeof e!="function")t[a].call(t,n);else{var i;try{i=e(n)}catch(o){t.reject(o);return}pv(t,i)}}},pv=function(e,t){if(e===t||e.proxy===t){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(Ue(t)==="object"&&t!==null||typeof t=="function")try{a=t.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(t,function(i){n||(n=!0,i===t?e.reject(new TypeError("circular thenable chain")):pv(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(t)};Br.all=function(r){return new Br(function(e,t){for(var a=new Array(r.length),n=0,i=function(l,u){a[l]=u,n++,n===r.length&&e(a)},o=0;o<r.length;o++)(function(s){var l=r[s],u=l!=null&&l.then!=null;if(u)l.then(function(f){i(s,f)},function(f){t(f)});else{var v=l;i(s,v)}})(o)})};Br.resolve=function(r){return new Br(function(e,t){e(r)})};Br.reject=function(r){return new Br(function(e,t){t(r)})};var Ut=typeof Promise<"u"?Promise:Br,bo=function(e,t,a){var n=Lo(e),i=!n,o=this._private=ge({duration:1e3},t,a);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&_e(o.complete)&&o.completes.push(o.complete),i){var s=e.position();o.startPosition=o.startPosition||{x:s.x,y:s.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(n){var l=e.pan();o.startPan={x:l.x,y:l.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},bt=bo.prototype;ge(bt,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,a=e.target._private.animation;e.queue?t=a.queue:t=a.current,t.push(this),br(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,a=t.playing;return e===void 0?t.progress:(a&&this.pause(),t.progress=e,t.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(u,v){var f=e[u];f!=null&&(e[u]=e[v],e[v]=f)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],o=i.name,s=e.startStyle[o];e.startStyle[o]=i,e.style[n]=s}return t&&this.play(),this},promise:function(e){var t=this._private,a;switch(e){case"frame":a=t.frames;break;default:case"complete":case"completed":a=t.completes}return new Ut(function(n,i){a.push(function(){n()})})}});bt.complete=bt.completed;bt.run=bt.play;bt.running=bt.playing;var ld={animated:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return!1;var o=n[0];if(o)return o._private.animation.current.length>0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o<n.length;o++){var s=n[o];s._private.animation.queue=[]}return this}},delay:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:t,duration:t,complete:a}):this}},delayAnimation:function(){return function(t,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:t,duration:t,complete:a}):this}},animation:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this,l=!i,u=!l;if(!s.styleEnabled())return this;var v=s.style();t=ge({},t,a);var f=Object.keys(t).length===0;if(f)return new bo(o[0],t);switch(t.duration===void 0&&(t.duration=400),t.duration){case"slow":t.duration=600;break;case"fast":t.duration=200;break}if(u&&(t.style=v.getPropsList(t.style||t.css),t.css=void 0),u&&t.renderedPosition!=null){var c=t.renderedPosition,d=s.pan(),h=s.zoom();t.position=ev(c,h,d)}if(l&&t.panBy!=null){var y=t.panBy,g=s.pan();t.pan={x:g.x+y.x,y:g.y+y.y}}var p=t.center||t.centre;if(l&&p!=null){var m=s.getCenterPan(p.eles,t.zoom);m!=null&&(t.pan=m)}if(l&&t.fit!=null){var b=t.fit,w=s.getFitViewport(b.eles||b.boundingBox,b.padding);w!=null&&(t.pan=w.pan,t.zoom=w.zoom)}if(l&&ke(t.zoom)){var E=s.getZoomedViewport(t.zoom);E!=null?(E.zoomed&&(t.zoom=E.zoom),E.panned&&(t.pan=E.pan)):t.zoom=null}return new bo(o[0],t)}},animate:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;a&&(t=ge({},t,a));for(var l=0;l<o.length;l++){var u=o[l],v=u.animated()&&(t.queue===void 0||t.queue),f=u.animation(t,v?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(t,a){var n=this,i=n.length!==void 0,o=i?n:[n],s=this._private.cy||this;if(!s.styleEnabled())return this;for(var l=0;l<o.length;l++){for(var u=o[l],v=u._private,f=v.animation.current,c=0;c<f.length;c++){var d=f[c],h=d._private;a&&(h.duration=0)}t&&(v.animation.queue=[]),a||(v.animation.current=[])}return s.notify("draw"),this}}},oi,Us;function Dn(){if(Us)return oi;Us=1;var r=Array.isArray;return oi=r,oi}var si,Ws;function vd(){if(Ws)return si;Ws=1;var r=Dn(),e=ka(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function n(i,o){if(r(i))return!1;var s=typeof i;return s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)?!0:a.test(i)||!t.test(i)||o!=null&&i in Object(o)}return si=n,si}var ui,Ys;function fd(){if(Ys)return ui;Ys=1;var r=$l(),e=Da(),t="[object AsyncFunction]",a="[object Function]",n="[object GeneratorFunction]",i="[object Proxy]";function o(s){if(!e(s))return!1;var l=r(s);return l==a||l==n||l==t||l==i}return ui=o,ui}var li,Xs;function cd(){if(Xs)return li;Xs=1;var r=En(),e=r["__core-js_shared__"];return li=e,li}var vi,Zs;function hd(){if(Zs)return vi;Zs=1;var r=cd(),e=function(){var a=/[^.]+$/.exec(r&&r.keys&&r.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""}();function t(a){return!!e&&e in a}return vi=t,vi}var fi,Qs;function dd(){if(Qs)return fi;Qs=1;var r=Function.prototype,e=r.toString;function t(a){if(a!=null){try{return e.call(a)}catch{}try{return a+""}catch{}}return""}return fi=t,fi}var ci,Js;function gd(){if(Js)return ci;Js=1;var r=fd(),e=hd(),t=Da(),a=dd(),n=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,l=o.toString,u=s.hasOwnProperty,v=RegExp("^"+l.call(u).replace(n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(c){if(!t(c)||e(c))return!1;var d=r(c)?v:i;return d.test(a(c))}return ci=f,ci}var hi,js;function pd(){if(js)return hi;js=1;function r(e,t){return e==null?void 0:e[t]}return hi=r,hi}var di,eu;function Ho(){if(eu)return di;eu=1;var r=gd(),e=pd();function t(a,n){var i=e(a,n);return r(i)?i:void 0}return di=t,di}var gi,ru;function kn(){if(ru)return gi;ru=1;var r=Ho(),e=r(Object,"create");return gi=e,gi}var pi,tu;function yd(){if(tu)return pi;tu=1;var r=kn();function e(){this.__data__=r?r(null):{},this.size=0}return pi=e,pi}var yi,au;function md(){if(au)return yi;au=1;function r(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}return yi=r,yi}var mi,nu;function bd(){if(nu)return mi;nu=1;var r=kn(),e="__lodash_hash_undefined__",t=Object.prototype,a=t.hasOwnProperty;function n(i){var o=this.__data__;if(r){var s=o[i];return s===e?void 0:s}return a.call(o,i)?o[i]:void 0}return mi=n,mi}var bi,iu;function wd(){if(iu)return bi;iu=1;var r=kn(),e=Object.prototype,t=e.hasOwnProperty;function a(n){var i=this.__data__;return r?i[n]!==void 0:t.call(i,n)}return bi=a,bi}var wi,ou;function xd(){if(ou)return wi;ou=1;var r=kn(),e="__lodash_hash_undefined__";function t(a,n){var i=this.__data__;return this.size+=this.has(a)?0:1,i[a]=r&&n===void 0?e:n,this}return wi=t,wi}var xi,su;function Ed(){if(su)return xi;su=1;var r=yd(),e=md(),t=bd(),a=wd(),n=xd();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,xi=i,xi}var Ei,uu;function Cd(){if(uu)return Ei;uu=1;function r(){this.__data__=[],this.size=0}return Ei=r,Ei}var Ci,lu;function yv(){if(lu)return Ci;lu=1;function r(e,t){return e===t||e!==e&&t!==t}return Ci=r,Ci}var Ti,vu;function Pn(){if(vu)return Ti;vu=1;var r=yv();function e(t,a){for(var n=t.length;n--;)if(r(t[n][0],a))return n;return-1}return Ti=e,Ti}var Si,fu;function Td(){if(fu)return Si;fu=1;var r=Pn(),e=Array.prototype,t=e.splice;function a(n){var i=this.__data__,o=r(i,n);if(o<0)return!1;var s=i.length-1;return o==s?i.pop():t.call(i,o,1),--this.size,!0}return Si=a,Si}var Di,cu;function Sd(){if(cu)return Di;cu=1;var r=Pn();function e(t){var a=this.__data__,n=r(a,t);return n<0?void 0:a[n][1]}return Di=e,Di}var ki,hu;function Dd(){if(hu)return ki;hu=1;var r=Pn();function e(t){return r(this.__data__,t)>-1}return ki=e,ki}var Pi,du;function kd(){if(du)return Pi;du=1;var r=Pn();function e(t,a){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,a])):n[i][1]=a,this}return Pi=e,Pi}var Ai,gu;function Pd(){if(gu)return Ai;gu=1;var r=Cd(),e=Td(),t=Sd(),a=Dd(),n=kd();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Ai=i,Ai}var Bi,pu;function Ad(){if(pu)return Bi;pu=1;var r=Ho(),e=En(),t=r(e,"Map");return Bi=t,Bi}var Ri,yu;function Bd(){if(yu)return Ri;yu=1;var r=Ed(),e=Pd(),t=Ad();function a(){this.size=0,this.__data__={hash:new r,map:new(t||e),string:new r}}return Ri=a,Ri}var Mi,mu;function Rd(){if(mu)return Mi;mu=1;function r(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}return Mi=r,Mi}var Li,bu;function An(){if(bu)return Li;bu=1;var r=Rd();function e(t,a){var n=t.__data__;return r(a)?n[typeof a=="string"?"string":"hash"]:n.map}return Li=e,Li}var Ii,wu;function Md(){if(wu)return Ii;wu=1;var r=An();function e(t){var a=r(this,t).delete(t);return this.size-=a?1:0,a}return Ii=e,Ii}var Oi,xu;function Ld(){if(xu)return Oi;xu=1;var r=An();function e(t){return r(this,t).get(t)}return Oi=e,Oi}var Ni,Eu;function Id(){if(Eu)return Ni;Eu=1;var r=An();function e(t){return r(this,t).has(t)}return Ni=e,Ni}var zi,Cu;function Od(){if(Cu)return zi;Cu=1;var r=An();function e(t,a){var n=r(this,t),i=n.size;return n.set(t,a),this.size+=n.size==i?0:1,this}return zi=e,zi}var Fi,Tu;function Nd(){if(Tu)return Fi;Tu=1;var r=Bd(),e=Md(),t=Ld(),a=Id(),n=Od();function i(o){var s=-1,l=o==null?0:o.length;for(this.clear();++s<l;){var u=o[s];this.set(u[0],u[1])}}return i.prototype.clear=r,i.prototype.delete=e,i.prototype.get=t,i.prototype.has=a,i.prototype.set=n,Fi=i,Fi}var qi,Su;function zd(){if(Su)return qi;Su=1;var r=Nd(),e="Expected a function";function t(a,n){if(typeof a!="function"||n!=null&&typeof n!="function")throw new TypeError(e);var i=function(){var o=arguments,s=n?n.apply(this,o):o[0],l=i.cache;if(l.has(s))return l.get(s);var u=a.apply(this,o);return i.cache=l.set(s,u)||l,u};return i.cache=new(t.Cache||r),i}return t.Cache=r,qi=t,qi}var Vi,Du;function Fd(){if(Du)return Vi;Du=1;var r=zd(),e=500;function t(a){var n=r(a,function(o){return i.size===e&&i.clear(),o}),i=n.cache;return n}return Vi=t,Vi}var _i,ku;function mv(){if(ku)return _i;ku=1;var r=Fd(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,a=r(function(n){var i=[];return n.charCodeAt(0)===46&&i.push(""),n.replace(e,function(o,s,l,u){i.push(l?u.replace(t,"$1"):s||o)}),i});return _i=a,_i}var Gi,Pu;function bv(){if(Pu)return Gi;Pu=1;function r(e,t){for(var a=-1,n=e==null?0:e.length,i=Array(n);++a<n;)i[a]=t(e[a],a,e);return i}return Gi=r,Gi}var Hi,Au;function qd(){if(Au)return Hi;Au=1;var r=Oo(),e=bv(),t=Dn(),a=ka(),n=r?r.prototype:void 0,i=n?n.toString:void 0;function o(s){if(typeof s=="string")return s;if(t(s))return e(s,o)+"";if(a(s))return i?i.call(s):"";var l=s+"";return l=="0"&&1/s==-1/0?"-0":l}return Hi=o,Hi}var Ki,Bu;function wv(){if(Bu)return Ki;Bu=1;var r=qd();function e(t){return t==null?"":r(t)}return Ki=e,Ki}var $i,Ru;function xv(){if(Ru)return $i;Ru=1;var r=Dn(),e=vd(),t=mv(),a=wv();function n(i,o){return r(i)?i:e(i,o)?[i]:t(a(i))}return $i=n,$i}var Ui,Mu;function Ko(){if(Mu)return Ui;Mu=1;var r=ka();function e(t){if(typeof t=="string"||r(t))return t;var a=t+"";return a=="0"&&1/t==-1/0?"-0":a}return Ui=e,Ui}var Wi,Lu;function Vd(){if(Lu)return Wi;Lu=1;var r=xv(),e=Ko();function t(a,n){n=r(n,a);for(var i=0,o=n.length;a!=null&&i<o;)a=a[e(n[i++])];return i&&i==o?a:void 0}return Wi=t,Wi}var Yi,Iu;function _d(){if(Iu)return Yi;Iu=1;var r=Vd();function e(t,a,n){var i=t==null?void 0:r(t,a);return i===void 0?n:i}return Yi=e,Yi}var Gd=_d(),Hd=Sa(Gd),Xi,Ou;function Kd(){if(Ou)return Xi;Ou=1;var r=Ho(),e=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch{}}();return Xi=e,Xi}var Zi,Nu;function $d(){if(Nu)return Zi;Nu=1;var r=Kd();function e(t,a,n){a=="__proto__"&&r?r(t,a,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[a]=n}return Zi=e,Zi}var Qi,zu;function Ud(){if(zu)return Qi;zu=1;var r=$d(),e=yv(),t=Object.prototype,a=t.hasOwnProperty;function n(i,o,s){var l=i[o];(!(a.call(i,o)&&e(l,s))||s===void 0&&!(o in i))&&r(i,o,s)}return Qi=n,Qi}var Ji,Fu;function Wd(){if(Fu)return Ji;Fu=1;var r=9007199254740991,e=/^(?:0|[1-9]\d*)$/;function t(a,n){var i=typeof a;return n=n??r,!!n&&(i=="number"||i!="symbol"&&e.test(a))&&a>-1&&a%1==0&&a<n}return Ji=t,Ji}var ji,qu;function Yd(){if(qu)return ji;qu=1;var r=Ud(),e=xv(),t=Wd(),a=Da(),n=Ko();function i(o,s,l,u){if(!a(o))return o;s=e(s,o);for(var v=-1,f=s.length,c=f-1,d=o;d!=null&&++v<f;){var h=n(s[v]),y=l;if(h==="__proto__"||h==="constructor"||h==="prototype")return o;if(v!=c){var g=d[h];y=u?u(g,h,d):void 0,y===void 0&&(y=a(g)?g:t(s[v+1])?[]:{})}r(d,h,y),d=d[h]}return o}return ji=i,ji}var eo,Vu;function Xd(){if(Vu)return eo;Vu=1;var r=Yd();function e(t,a,n){return t==null?t:r(t,a,n)}return eo=e,eo}var Zd=Xd(),Qd=Sa(Zd),ro,_u;function Jd(){if(_u)return ro;_u=1;function r(e,t){var a=-1,n=e.length;for(t||(t=Array(n));++a<n;)t[a]=e[a];return t}return ro=r,ro}var to,Gu;function jd(){if(Gu)return to;Gu=1;var r=bv(),e=Jd(),t=Dn(),a=ka(),n=mv(),i=Ko(),o=wv();function s(l){return t(l)?r(l,i):a(l)?[l]:e(n(o(l)))}return to=s,to}var eg=jd(),rg=Sa(eg),tg={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=ge({},t,e),function(n,i){var o=e,s=this,l=s.length!==void 0,u=l?s:[s],v=l?s[0]:s;if(fe(n)){var f=n.indexOf(".")!==-1,c=f&&rg(n);if(o.allowGetting&&i===void 0){var d;return v&&(o.beforeGet(v),c&&v._private[o.field][n]===void 0?d=Hd(v._private[o.field],c):d=v._private[o.field][n]),d}else if(o.allowSetting&&i!==void 0){var h=!o.immutableKeys[n];if(h){var y=Il({},n,i);o.beforeSet(s,y);for(var g=0,p=u.length;g<p;g++){var m=u[g];o.canSet(m)&&(c&&v._private[o.field][n]===void 0?Qd(m._private[o.field],c,i):m._private[o.field][n]=i)}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}}}else if(o.allowSetting&&ke(n)){var b=n,w,E,C=Object.keys(b);o.beforeSet(s,b);for(var x=0;x<C.length;x++){w=C[x],E=b[w];var S=!o.immutableKeys[w];if(S)for(var k=0;k<u.length;k++){var A=u[k];o.canSet(A)&&(A._private[o.field][w]=E)}}o.updateStyle&&s.updateStyle(),o.onSet(s),o.settingTriggersEvent&&s[o.triggerFnName](o.settingEvent)}else if(o.allowBinding&&_e(n)){var D=n;s.on(o.bindingEvent,D)}else if(o.allowGetting&&n===void 0){var B;return v&&(o.beforeGet(v),B=v._private[o.field]),B}return s}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ge({},t,e),function(n){var i=e,o=this,s=o.length!==void 0,l=s?o:[o];if(fe(n)){for(var u=n.split(/\s+/),v=u.length,f=0;f<v;f++){var c=u[f];if(!rt(c)){var d=!i.immutableKeys[c];if(d)for(var h=0,y=l.length;h<y;h++)l[h]._private[i.field][c]=void 0}}i.triggerEvent&&o[i.triggerFnName](i.event)}else if(n===void 0){for(var g=0,p=l.length;g<p;g++)for(var m=l[g]._private[i.field],b=Object.keys(m),w=0;w<b.length;w++){var E=b[w],C=!i.immutableKeys[E];C&&(m[E]=void 0)}i.triggerEvent&&o[i.triggerFnName](i.event)}return o}}},ag={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(a,n){var i=this,o=Array.prototype.slice.call(arguments,0);return new Ut(function(s,l){var u=function(d){i.off.apply(i,f),s(d)},v=o.concat([u]),f=v.concat([]);i.on.apply(i,v)})}}},Be={};[ld,tg,ag].forEach(function(r){ge(Be,r)});var ng={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.stop()},ja={classes:function(e){var t=this;if(e===void 0){var a=[];return t[0]._private.classes.forEach(function(h){return a.push(h)}),a}else Le(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new $t(e),o=0;o<t.length;o++){for(var s=t[o],l=s._private,u=l.classes,v=!1,f=0;f<e.length;f++){var c=e[f],d=u.has(c);if(!d){v=!0;break}}v||(v=u.size!==e.length),v&&(l.classes=i,n.push(s))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Le(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],o=0,s=a.length;o<s;o++)for(var l=a[o],u=l._private.classes,v=!1,f=0;f<e.length;f++){var c=e[f],d=u.has(c),h=!1;t||n&&!d?(u.add(c),h=!0):(!t||n&&d)&&(u.delete(c),h=!0),!v&&h&&(i.push(l),v=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};ja.className=ja.classNames=ja.classes;var De={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:$e,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};De.variable="(?:[\\w-.]|(?:\\\\"+De.metaChar+"))+";De.className="(?:[\\w-]|(?:\\\\"+De.metaChar+"))+";De.value=De.string+"|"+De.number;De.id=De.variable;(function(){var r,e,t;for(r=De.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],De.comparatorOp+="|@"+e;for(r=De.comparatorOp.split("|"),t=0;t<r.length;t++)e=r[t],!(e.indexOf("!")>=0)&&e!=="="&&(De.comparatorOp+="|\\!"+e)})();var Me=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},wo=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(r,e){return sc(r.selector,e.selector)}),ig=function(){for(var r={},e,t=0;t<wo.length;t++)e=wo[t],r[e.selector]=e.matches;return r}(),og=function(e,t){return ig[e](t)},sg="("+wo.map(function(r){return r.selector}).join("|")+")",Tt=function(e){return e.replace(new RegExp("\\\\("+De.metaChar+")","g"),function(t,a){return a})},Zr=function(e,t,a){e[e.length-1]=a},xo=[{name:"group",query:!0,regex:"("+De.group+")",populate:function(e,t,a){var n=je(a,1),i=n[0];t.checks.push({type:se.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:sg,populate:function(e,t,a){var n=je(a,1),i=n[0];t.checks.push({type:se.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+De.id+")",populate:function(e,t,a){var n=je(a,1),i=n[0];t.checks.push({type:se.ID,value:Tt(i)})}},{name:"className",query:!0,regex:"\\.("+De.className+")",populate:function(e,t,a){var n=je(a,1),i=n[0];t.checks.push({type:se.CLASS,value:Tt(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+De.variable+")\\s*\\]",populate:function(e,t,a){var n=je(a,1),i=n[0];t.checks.push({type:se.DATA_EXIST,field:Tt(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+De.variable+")\\s*("+De.comparatorOp+")\\s*("+De.value+")\\s*\\]",populate:function(e,t,a){var n=je(a,3),i=n[0],o=n[1],s=n[2],l=new RegExp("^"+De.string+"$").exec(s)!=null;l?s=s.substring(1,s.length-1):s=parseFloat(s),t.checks.push({type:se.DATA_COMPARE,field:Tt(i),operator:o,value:s})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+De.boolOp+")\\s*("+De.variable+")\\s*\\]",populate:function(e,t,a){var n=je(a,2),i=n[0],o=n[1];t.checks.push({type:se.DATA_BOOL,field:Tt(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+De.meta+")\\s*("+De.comparatorOp+")\\s*("+De.number+")\\s*\\]\\]",populate:function(e,t,a){var n=je(a,3),i=n[0],o=n[1],s=n[2];t.checks.push({type:se.META_COMPARE,field:Tt(i),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:De.separator,populate:function(e,t){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,o=e[e.length-1];a!=null&&(o.subject=a,e.currentSubject=null),o.edgeCount=n,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var s=e[e.length++]=Me();return s}},{name:"directedEdge",separator:!0,regex:De.directedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Me(),n=t,i=Me();return a.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),Zr(e,t,a),e.edgeCount++,i}else{var o=Me(),s=t,l=Me();return o.checks.push({type:se.NODE_SOURCE,source:s,target:l}),Zr(e,t,o),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:De.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var a=Me(),n=t,i=Me();return a.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),Zr(e,t,a),e.edgeCount++,i}else{var o=Me(),s=t,l=Me();return o.checks.push({type:se.NODE_NEIGHBOR,node:s,neighbor:l}),Zr(e,t,o),l}}},{name:"child",separator:!0,regex:De.child,populate:function(e,t){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:se.CHILD,parent:i,child:n}),Zr(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var o=Me(),s=e[e.length-1],l=Me(),u=Me(),v=Me(),f=Me();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),l.checks.push({type:se.PARENT,parent:f,child:v}),Zr(e,s,o),e.currentSubject=u,e.compoundCount++,v}else{var c=Me(),d=Me(),h=[{type:se.PARENT,parent:c,child:d}];return c.checks=t.checks,t.checks=h,e.compoundCount++,d}}},{name:"descendant",separator:!0,regex:De.descendant,populate:function(e,t){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),Zr(e,t,a),e.compoundCount++,n}else if(e.currentSubject===t){var o=Me(),s=e[e.length-1],l=Me(),u=Me(),v=Me(),f=Me();return o.checks.push({type:se.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:se.TRUE}],f.checks.push({type:se.TRUE}),l.checks.push({type:se.ANCESTOR,ancestor:f,descendant:v}),Zr(e,s,o),e.currentSubject=u,e.compoundCount++,v}else{var c=Me(),d=Me(),h=[{type:se.ANCESTOR,ancestor:c,descendant:d}];return c.checks=t.checks,t.checks=h,e.compoundCount++,d}}},{name:"subject",modifier:!0,regex:De.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Re("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===se.DIRECTED_EDGE?n.type=se.NODE_TARGET:i===se.UNDIRECTED_EDGE&&(n.type=se.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];xo.forEach(function(r){return r.regexObj=new RegExp("^"+r.regex)});var ug=function(e){for(var t,a,n,i=0;i<xo.length;i++){var o=xo[i],s=o.name,l=e.match(o.regexObj);if(l!=null){a=l,t=o,n=s;var u=l[0];e=e.substring(u.length);break}}return{expr:t,match:a,name:n,remaining:e}},lg=function(e){var t=e.match(/^\s+/);if(t){var a=t[0];e=e.substring(a.length)}return e},vg=function(e){var t=this,a=t.inputText=e,n=t[0]=Me();for(t.length=1,a=lg(a);;){var i=ug(a);if(i.expr==null)return Re("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),s=i.expr.populate(t,n,o);if(s===!1)return!1;if(s!=null&&(n=s),a=i.remaining,a.match(/^\s*$/))break}var l=t[t.length-1];t.currentSubject!=null&&(l.subject=t.currentSubject),l.edgeCount=t.edgeCount,l.compoundCount=t.compoundCount;for(var u=0;u<t.length;u++){var v=t[u];if(v.compoundCount>0&&v.edgeCount>0)return Re("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Re("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Re("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},fg=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return fe(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,d=v.value;switch(c){case se.GROUP:{var h=e(d);return h.substring(0,h.length-1)}case se.DATA_COMPARE:{var y=v.field,g=v.operator;return"["+y+a(e(g))+t(d)+"]"}case se.DATA_BOOL:{var p=v.operator,m=v.field;return"["+e(p)+m+"]"}case se.DATA_EXIST:{var b=v.field;return"["+b+"]"}case se.META_COMPARE:{var w=v.operator,E=v.field;return"[["+E+a(e(w))+t(d)+"]]"}case se.STATE:return d;case se.ID:return"#"+d;case se.CLASS:return"."+d;case se.PARENT:case se.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case se.COMPOUND_SPLIT:{var C=i(v.left,f),x=i(v.subject,f),S=i(v.right,f);return C+(C.length>0?" ":"")+x+S}case se.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,d,h){return c+(f===v&&h===0?"$":"")+n(d,f)},"")},o="",s=0;s<this.length;s++){var l=this[s];o+=i(l,l.subject),this.length>1&&s<this.length-1&&(o+=", ")}return this.toStringCache=o,o},cg={parse:vg,toString:fg},Ev=function(e,t,a){var n,i=fe(e),o=ae(e),s=fe(a),l,u,v=!1,f=!1,c=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||s||v)&&(l=!i&&!o?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return f&&(e!=null||!c)&&(n=!n),n},hg=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},dg=function(e){return e!==void 0},$o=function(e,t){return e.data(t)},gg=function(e,t){return e[t]()},Ge=[],Fe=function(e,t){return e.checks.every(function(a){return Ge[a.type](a,t)})};Ge[se.GROUP]=function(r,e){var t=r.value;return t==="*"||t===e.group()};Ge[se.STATE]=function(r,e){var t=r.value;return og(t,e)};Ge[se.ID]=function(r,e){var t=r.value;return e.id()===t};Ge[se.CLASS]=function(r,e){var t=r.value;return e.hasClass(t)};Ge[se.META_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return Ev(gg(e,t),a,n)};Ge[se.DATA_COMPARE]=function(r,e){var t=r.field,a=r.operator,n=r.value;return Ev($o(e,t),a,n)};Ge[se.DATA_BOOL]=function(r,e){var t=r.field,a=r.operator;return hg($o(e,t),a)};Ge[se.DATA_EXIST]=function(r,e){var t=r.field;return r.operator,dg($o(e,t))};Ge[se.UNDIRECTED_EDGE]=function(r,e){var t=r.nodes[0],a=r.nodes[1],n=e.source(),i=e.target();return Fe(t,n)&&Fe(a,i)||Fe(a,n)&&Fe(t,i)};Ge[se.NODE_NEIGHBOR]=function(r,e){return Fe(r.node,e)&&e.neighborhood().some(function(t){return t.isNode()&&Fe(r.neighbor,t)})};Ge[se.DIRECTED_EDGE]=function(r,e){return Fe(r.source,e.source())&&Fe(r.target,e.target())};Ge[se.NODE_SOURCE]=function(r,e){return Fe(r.source,e)&&e.outgoers().some(function(t){return t.isNode()&&Fe(r.target,t)})};Ge[se.NODE_TARGET]=function(r,e){return Fe(r.target,e)&&e.incomers().some(function(t){return t.isNode()&&Fe(r.source,t)})};Ge[se.CHILD]=function(r,e){return Fe(r.child,e)&&Fe(r.parent,e.parent())};Ge[se.PARENT]=function(r,e){return Fe(r.parent,e)&&e.children().some(function(t){return Fe(r.child,t)})};Ge[se.DESCENDANT]=function(r,e){return Fe(r.descendant,e)&&e.ancestors().some(function(t){return Fe(r.ancestor,t)})};Ge[se.ANCESTOR]=function(r,e){return Fe(r.ancestor,e)&&e.descendants().some(function(t){return Fe(r.descendant,t)})};Ge[se.COMPOUND_SPLIT]=function(r,e){return Fe(r.subject,e)&&Fe(r.left,e)&&Fe(r.right,e)};Ge[se.TRUE]=function(){return!0};Ge[se.COLLECTION]=function(r,e){var t=r.value;return t.has(e)};Ge[se.FILTER]=function(r,e){var t=r.value;return t(e)};var pg=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===se.ID)return e.getElementById(t[0].checks[0].value).collection();var a=function(i){for(var o=0;o<t.length;o++){var s=t[o];if(Fe(s,i))return!0}return!1};return t.text()==null&&(a=function(){return!0}),e.filter(a)},yg=function(e){for(var t=this,a=0;a<t.length;a++){var n=t[a];if(Fe(n,e))return!0}return!1},mg={matches:yg,filter:pg},nt=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||fe(e)&&e.match(/^\s*$/)||(br(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):_e(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):fe(e)?this.parse(e)||(this.invalid=!0):Ve("A selector must be created from a string; found "))},it=nt.prototype;[cg,mg].forEach(function(r){return ge(it,r)});it.text=function(){return this.inputText};it.size=function(){return this.length};it.eq=function(r){return this[r]};it.sameText=function(r){return!this.invalid&&!r.invalid&&this.text()===r.text()};it.addQuery=function(r){this[this.length++]=r};it.selector=it.toString;var jr={allAre:function(e){var t=new nt(e);return this.every(function(a){return t.matches(a)})},is:function(e){var t=new nt(e);return this.some(function(a){return t.matches(a)})},some:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,t){for(var a=0;a<this.length;a++){var n=t?e.apply(t,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,a=e.length;return t!==a?!1:t===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(a){return t.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(a){return t.hasElementWithId(a.id())})}};jr.allAreNeighbours=jr.allAreNeighbors;jr.has=jr.contains;jr.equal=jr.equals=jr.same;var Tr=function(e,t){return function(n,i,o,s){var l=n,u=this,v;if(l==null?v="":br(l)&&l.length===1&&(v=l.id()),u.length===1&&v){var f=u[0]._private,c=f.traversalCache=f.traversalCache||{},d=c[t]=c[t]||[],h=tt(v),y=d[h];return y||(d[h]=e.call(u,n,i,o,s))}else return e.call(u,n,i,o,s)}},Ht={parent:function(e){var t=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];t.push(i)}a=a.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,a=0;a<this.length;a++){var n=this[a],i=n.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:Tr(function(r){for(var e=[],t=0;t<this.length;t++)for(var a=this[t],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(r)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function a(n){for(var i=0;i<n.length;i++){var o=n[i];t.push(o),o.children().nonempty()&&a(o.children())}}return a(this.children()),this.spawn(t,!0).filter(e)}};function Uo(r,e,t,a){for(var n=[],i=new $t,o=r.cy(),s=o.hasCompoundNodes(),l=0;l<r.length;l++){var u=r[l];t?n.push(u):s&&a(n,i,u)}for(;n.length>0;){var v=n.shift();e(v),i.add(v.id()),s&&a(n,i,v)}return r}function Cv(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||r.push(i)}}Ht.forEachDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Uo(this,r,e,Cv)};function Tv(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}Ht.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Uo(this,r,e,Tv)};function bg(r,e,t){Tv(r,e,t),Cv(r,e,t)}Ht.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Uo(this,r,e,bg)};Ht.ancestors=Ht.parents;var ma,Sv;ma=Sv={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Be.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Be.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ma.attr=ma.data;ma.removeAttr=ma.removeData;var wg=Sv,Bn={};function ao(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,o=0;o<i.length;o++){var s=i[o];!e&&s.isLoop()||(a+=r(n,s))}return a}else return}}ge(Bn,{degree:ao(function(r,e){return e.source().same(e.target())?2:1}),indegree:ao(function(r,e){return e.target().same(r)?1:0}),outdegree:ao(function(r,e){return e.source().same(r)?1:0})});function St(r,e){return function(t){for(var a,n=this.nodes(),i=0;i<n.length;i++){var o=n[i],s=o[r](t);s!==void 0&&(a===void 0||e(s,a))&&(a=s)}return a}}ge(Bn,{minDegree:St("degree",function(r,e){return r<e}),maxDegree:St("degree",function(r,e){return r>e}),minIndegree:St("indegree",function(r,e){return r<e}),maxIndegree:St("indegree",function(r,e){return r>e}),minOutdegree:St("outdegree",function(r,e){return r<e}),maxOutdegree:St("outdegree",function(r,e){return r>e})});ge(Bn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n<a.length;n++)t+=a[n].degree(e);return t}});var Ar,Dv,kv=function(e,t,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var o=i._private.position,s={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};i.isParent()&&!(s.x===0&&s.y===0)&&i.children().shift(s,a),i.dirtyBoundingBoxCache()}}},Hu={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){kv(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ar=Dv={position:Be.data(Hu),silentPosition:Be.data(ge({},Hu,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){kv(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(ke(e))t?this.silentPosition(e):this.position(e);else if(_e(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var o=this[i],s=void 0;(s=a(o,i))&&(t?o.silentPosition(s):o.position(s))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,a){var n;if(ke(e)?(n={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},a=t):fe(e)&&ae(t)&&(n={x:0,y:0},n[e]=t),n!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(i.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var l=s.position(),u={x:l.x+n.x,y:l.y+n.y};a?s.silentPosition(u):s.position(u)}}i.endBatch()}return this},silentShift:function(e,t){return ke(e)?this.shift(e,!0):fe(e)&&ae(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var a=this[0],n=this.cy(),i=n.zoom(),o=n.pan(),s=ke(e)?e:void 0,l=s!==void 0||t!==void 0&&fe(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var v=this[u];t!==void 0?v.position(e,(t-o[e])/i):s!==void 0&&v.position(ev(s,i,o))}else{var f=a.position();return s=Tn(f,i,o),e===void 0?s:s[e]}else if(!l)return;return this},relativePosition:function(e,t){var a=this[0],n=this.cy(),i=ke(e)?e:void 0,o=i!==void 0||t!==void 0&&fe(e),s=n.hasCompoundNodes();if(a&&a.isNode())if(o)for(var l=0;l<this.length;l++){var u=this[l],v=s?u.parent():null,f=v&&v.length>0,c=f;f&&(v=v[0]);var d=c?v.position():{x:0,y:0};t!==void 0?u.position(e,t+d[e]):i!==void 0&&u.position({x:i.x+d.x,y:i.y+d.y})}else{var h=a.position(),y=s?a.parent():null,g=y&&y.length>0,p=g;g&&(y=y[0]);var m=p?y.position():{x:0,y:0};return i={x:h.x-m.x,y:h.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Ar.modelPosition=Ar.point=Ar.position;Ar.modelPositions=Ar.points=Ar.positions;Ar.renderedPoint=Ar.renderedPosition;Ar.relativePoint=Ar.relativePosition;var xg=Dv,qt,lt;qt=lt={};lt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}};lt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};lt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function d(k,A,D){var B=0,P=0,R=A+D;return k>0&&R>0&&(B=A/R*k,P=D/R*k),{biasDiff:B,biasComplementDiff:P}}function h(k,A,D,B){if(D.units==="%")switch(B){case"width":return k>0?D.pfValue*k:0;case"height":return A>0?D.pfValue*A:0;case"average":return k>0&&A>0?D.pfValue*(k+A)/2:0;case"min":return k>0&&A>0?k>A?D.pfValue*A:D.pfValue*k:0;case"max":return k>0&&A>0?k>A?D.pfValue*k:D.pfValue*A:0;default:return 0}else return D.units==="px"?D.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var g=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(g=g*100/v.width.val);var p=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(p=p*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=d(v.width.val-f.w,y,g),w=b.biasDiff,E=b.biasComplementDiff,C=d(v.height.val-f.h,p,m),x=C.biasDiff,S=C.biasComplementDiff;s.autoPadding=h(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+E)/2,s.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+S)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||r)&&(t(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Cr=function(e){return e===1/0||e===-1/0?0:e},kr=function(e,t,a,n,i){n-t===0||i-a===0||t==null||a==null||n==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ht=function(e,t){return t==null?e:kr(e,t.x1,t.y1,t.x2,t.y2)},ra=function(e,t,a){return Er(e,t,a)},Ha=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,o=i.arrowWidth/2,s=t.pstyle(a+"-arrow-shape").value,l,u;if(s!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-o,f.y1=u-o,f.x2=l+o,f.y2=u+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,Qa(f,1),kr(e,f.x1,f.y1,f.x2,f.y2)}}},no=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,o=i.rstyle,s=t.pstyle(n+"label").strValue;if(s){var l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=ra(o,"labelWidth",a),f=ra(o,"labelHeight",a),c=ra(o,"labelX",a),d=ra(o,"labelY",a),h=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,g=t.isEdge(),p=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,E=t.pstyle("text-background-padding").pfValue,C=2,x=f,S=v,k=S/2,A=x/2,D,B,P,R;if(g)D=c-k,B=c+k,P=d-A,R=d+A;else{switch(l.value){case"left":D=c-S,B=c;break;case"center":D=c-k,B=c+k;break;case"right":D=c,B=c+S;break}switch(u.value){case"top":P=d-x,R=d;break;case"center":P=d-A,R=d+A;break;case"bottom":P=d,R=d+x;break}}var L=h-Math.max(m,w)-E-C,I=h+Math.max(m,w)+E+C,M=y-Math.max(m,w)-E-C,O=y+Math.max(m,w)+E+C;D+=L,B+=I,P+=M,R+=O;var _=a||"main",H=i.labelBounds,z=H[_]=H[_]||{};z.x1=D,z.y1=P,z.x2=B,z.y2=R,z.w=B-D,z.h=R-P,z.leftPad=L,z.rightPad=I,z.topPad=M,z.botPad=O;var G=g&&p.strValue==="autorotate",W=p.pfValue!=null&&p.pfValue!==0;if(G||W){var X=G?ra(i.rstyle,"labelAngle",a):p.pfValue,Z=Math.cos(X),Q=Math.sin(X),ee=(D+B)/2,re=(P+R)/2;if(!g){switch(l.value){case"left":ee=B;break;case"right":ee=D;break}switch(u.value){case"top":re=R;break;case"bottom":re=P;break}}var K=function(Ae,oe){return Ae=Ae-ee,oe=oe-re,{x:Ae*Z-oe*Q+ee,y:Ae*Q+oe*Z+re}},N=K(D,P),$=K(D,R),J=K(B,P),te=K(B,R);D=Math.min(N.x,$.x,J.x,te.x),B=Math.max(N.x,$.x,J.x,te.x),P=Math.min(N.y,$.y,J.y,te.y),R=Math.max(N.y,$.y,J.y,te.y)}var le=_+"Rot",xe=H[le]=H[le]||{};xe.x1=D,xe.y1=P,xe.x2=B,xe.y2=R,xe.w=B-D,xe.h=R-P,kr(e,D,P,B,R),kr(i.labelBounds.all,D,P,B,R)}return e}},Eg=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,s=n+i,l=(e.w+s*2)/e.w,u=(e.h+s*2)/e.h,v=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(l=(e.w+s*2.4)/e.w,f=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?l=(e.w+s*2.4)/e.w:o==="star"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.6)/e.h,f=-s/3.8):o==="triangle"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.4)/e.h,f=-s/1.4):o==="vee"&&(l=(e.w+s*4.4)/e.w,u=(e.h+s*3.8)/e.h,f=-s*.5);var c=e.h*u-e.h,d=e.w*l-e.w;if(Ja(e,[Math.ceil(c/2),Math.ceil(d/2)]),v!=0||f!==0){var h=sh(e,v,f);tv(e,h)}}}},Cg=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=pr(),s=e._private,l=e.isNode(),u=e.isEdge(),v,f,c,d,h,y,g=s.rstyle,p=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(Ie){return Ie.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var w=0,E=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(E=e.pstyle("overlay-padding").value));var C=0,x=0;n&&t.includeUnderlays&&(C=e.pstyle("underlay-opacity").value,C!==0&&(x=e.pstyle("underlay-padding").value));var S=Math.max(E,x),k=0,A=0;if(n&&(k=e.pstyle("width").pfValue,A=k/2),l&&t.includeNodes){var D=e.position();h=D.x,y=D.y;var B=e.outerWidth(),P=B/2,R=e.outerHeight(),L=R/2;v=h-P,f=h+P,c=y-L,d=y+L,kr(o,v,c,f,d),n&&t.includeOutlines&&Eg(o,e)}else if(u&&t.includeEdges)if(n&&!i){var I=e.pstyle("curve-style").strValue;if(v=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),c=Math.min(g.srcY,g.midY,g.tgtY),d=Math.max(g.srcY,g.midY,g.tgtY),v-=A,f+=A,c-=A,d+=A,kr(o,v,c,f,d),I==="haystack"){var M=g.haystackPts;if(M&&M.length===2){if(v=M[0].x,c=M[0].y,f=M[1].x,d=M[1].y,v>f){var O=v;v=f,f=O}if(c>d){var _=c;c=d,d=_}kr(o,v-A,c-A,f+A,d+A)}}else if(I==="bezier"||I==="unbundled-bezier"||I.endsWith("segments")||I.endsWith("taxi")){var H;switch(I){case"bezier":case"unbundled-bezier":H=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":H=g.linePts;break}if(H!=null)for(var z=0;z<H.length;z++){var G=H[z];v=G.x-A,f=G.x+A,c=G.y-A,d=G.y+A,kr(o,v,c,f,d)}}}else{var W=e.source(),X=W.position(),Z=e.target(),Q=Z.position();if(v=X.x,f=Q.x,c=X.y,d=Q.y,v>f){var ee=v;v=f,f=ee}if(c>d){var re=c;c=d,d=re}v-=A,f+=A,c-=A,d+=A,kr(o,v,c,f,d)}if(n&&t.includeEdges&&u&&(Ha(o,e,"mid-source"),Ha(o,e,"mid-target"),Ha(o,e,"source"),Ha(o,e,"target")),n){var K=e.pstyle("ghost").value==="yes";if(K){var N=e.pstyle("ghost-offset-x").pfValue,$=e.pstyle("ghost-offset-y").pfValue;kr(o,o.x1+N,o.y1+$,o.x2+N,o.y2+$)}}var J=s.bodyBounds=s.bodyBounds||{};Bs(J,o),Ja(J,p),Qa(J,1),n&&(v=o.x1,f=o.x2,c=o.y1,d=o.y2,kr(o,v-S,c-S,f+S,d+S));var te=s.overlayBounds=s.overlayBounds||{};Bs(te,o),Ja(te,p),Qa(te,1);var le=s.labelBounds=s.labelBounds||{};le.all!=null?oh(le.all):le.all=pr(),n&&t.includeLabels&&(t.includeMainLabels&&no(o,e,null),u&&(t.includeSourceLabels&&no(o,e,"source"),t.includeTargetLabels&&no(o,e,"target")))}return o.x1=Cr(o.x1),o.y1=Cr(o.y1),o.x2=Cr(o.x2),o.y2=Cr(o.y2),o.w=Cr(o.x2-o.x1),o.h=Cr(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Ja(o,p),Qa(o,1)),o},Pv=function(e){var t=0,a=function(o){return(o?1:0)<<t++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},Av=function(e){var t=function(s){return Math.round(s)};if(e.isEdge()){var a=e.source().position(),n=e.target().position();return Ts([t(a.x),t(a.y),t(n.x),t(n.y)])}else{var i=e.position();return Ts([t(i.x),t(i.y)])}},Ku=function(e,t){var a=e._private,n,i=e.isEdge(),o=t==null?$u:Pv(t),s=o===$u;if(a.bbCache==null?(n=Cg(e,ba),a.bbCache=n,a.bbCachePosKey=Av(e)):n=a.bbCache,!s){var l=e.isNode();n=pr(),(t.includeNodes&&l||t.includeEdges&&!l)&&(t.includeOverlays?ht(n,a.overlayBounds):ht(n,a.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ht(n,a.labelBounds.all):(t.includeMainLabels&&ht(n,a.labelBounds.mainRot),t.includeSourceLabels&&ht(n,a.labelBounds.sourceRot),t.includeTargetLabels&&ht(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ba={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},$u=Pv(ba),Uu=We(ba);lt.boundingBox=function(r){var e,t=r===void 0||r.useCache===void 0||r.useCache===!0,a=Vt(function(v){var f=v._private;return f.bbCache==null||f.styleDirty||f.bbCachePosKey!==Av(v)},function(v){return v.id()});if(t&&this.length===1&&!a(this[0]))r===void 0?r=ba:r=Uu(r),e=Ku(this[0],r);else{e=pr(),r=r||ba;var n=Uu(r),i=this,o=i.cy(),s=o.styleEnabled();this.edges().forEach(a),this.nodes().forEach(a),s&&this.recalculateRenderedStyle(t),this.updateCompoundBounds(!t);for(var l=0;l<i.length;l++){var u=i[l];a(u)&&u.dirtyBoundingBoxCache(),ht(e,Ku(u,n))}}return e.x1=Cr(e.x1),e.y1=Cr(e.y1),e.x2=Cr(e.x2),e.y2=Cr(e.y2),e.w=Cr(e.x2-e.x1),e.h=Cr(e.y2-e.y1),e};lt.dirtyBoundingBoxCache=function(){for(var r=0;r<this.length;r++){var e=this[r]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};lt.boundingBoxAt=function(r){var e=this.nodes(),t=this.cy(),a=t.hasCompoundNodes(),n=t.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),ke(r)){var i=r;r=function(){return i}}var o=function(v,f){return v._private.bbAtOldPos=r(v,f)},s=function(v){return v._private.bbAtOldPos};t.startBatch(),e.forEach(o).silentPositions(r),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=ih(this.boundingBox({useCache:!1}));return e.silentPositions(s),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),t.endBatch(),l};qt.boundingbox=qt.bb=qt.boundingBox;qt.renderedBoundingbox=qt.renderedBoundingBox;var Tg=lt,ua,Ba;ua=Ba={};var Bv=function(e){e.uppercaseName=ls(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=ls(e.outerName),ua[e.name]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var s=a.pstyle(e.name);switch(s.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return s.pfValue}}else return 1},ua["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,o=i._private.styleEnabled;if(a)if(o){var s=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return s+l+u}else return 1},ua["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},ua["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};Bv({name:"width"});Bv({name:"height"});Ba.padding=function(){var r=this[0],e=r._private;return r.isParent()?(r.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:r.pstyle("padding").pfValue):r.pstyle("padding").pfValue};Ba.paddedHeight=function(){var r=this[0];return r.height()+2*r.padding()};Ba.paddedWidth=function(){var r=this[0];return r.width()+2*r.padding()};var Sg=Ba,Dg=function(e,t){if(e.isEdge()&&e.takesUpSpace())return t(e)},kg=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy();return Tn(t(e),a.zoom(),a.pan())}},Pg=function(e,t){if(e.isEdge()&&e.takesUpSpace()){var a=e.cy(),n=a.pan(),i=a.zoom();return t(e).map(function(o){return Tn(o,i,n)})}},Ag=function(e){return e.renderer().getControlPoints(e)},Bg=function(e){return e.renderer().getSegmentPoints(e)},Rg=function(e){return e.renderer().getSourceEndpoint(e)},Mg=function(e){return e.renderer().getTargetEndpoint(e)},Lg=function(e){return e.renderer().getEdgeMidpoint(e)},Wu={controlPoints:{get:Ag,mult:!0},segmentPoints:{get:Bg,mult:!0},sourceEndpoint:{get:Rg},targetEndpoint:{get:Mg},midpoint:{get:Lg}},Ig=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Og=Object.keys(Wu).reduce(function(r,e){var t=Wu[e],a=Ig(e);return r[e]=function(){return Dg(this,t.get)},t.mult?r[a]=function(){return Pg(this,t.get)}:r[a]=function(){return kg(this,t.get)},r},{}),Ng=ge({},xg,Tg,Sg,Og);/*!
9
- Event object based on jQuery events, MIT license
10
-
11
- https://jquery.org/license/
12
- https://tldrlegal.com/license/mit-license
13
- https://github.com/jquery/jquery/blob/master/src/event.js
14
- */var Rv=function(e,t){this.recycle(e,t)};function ta(){return!1}function Ka(){return!0}Rv.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ta,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Ka:ta):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Ka;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Ka;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Ka,this.stopPropagation()},isDefaultPrevented:ta,isPropagationStopped:ta,isImmediatePropagationStopped:ta};var Mv=/^([^.]+)(\.(?:[^.]+))?$/,zg=".*",Lv={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},Yu=Object.keys(Lv),Fg={};function Rn(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Fg,e=arguments.length>1?arguments[1]:void 0,t=0;t<Yu.length;t++){var a=Yu[t];this[a]=r[a]||Lv[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ot=Rn.prototype,Iv=function(e,t,a,n,i,o,s){_e(n)&&(i=n,n=null),s&&(o==null?o=s:o=ge({},o,s));for(var l=Le(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var v=l[u];if(!rt(v)){var f=v.match(Mv);if(f){var c=f[1],d=f[2]?f[2]:null,h=t(e,v,c,d,n,i,o);if(h===!1)break}}}},Xu=function(e,t){return e.addEventFields(e.context,t),new Rv(t.type,t)},qg=function(e,t,a){if(Zf(a)){t(e,a);return}else if(ke(a)){t(e,Xu(e,a));return}for(var n=Le(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var o=n[i];if(!rt(o)){var s=o.match(Mv);if(s){var l=s[1],u=s[2]?s[2]:null,v=Xu(e,{type:l,namespace:u,target:e.context});t(e,v)}}}};ot.on=ot.addListener=function(r,e,t,a,n){return Iv(this,function(i,o,s,l,u,v,f){_e(v)&&i.listeners.push({event:o,callback:v,type:s,namespace:l,qualifier:u,conf:f})},r,e,t,a,n),this};ot.one=function(r,e,t,a){return this.on(r,e,t,a,{one:!0})};ot.removeListener=ot.off=function(r,e,t,a){var n=this;this.emitting!==0&&(this.listeners=Ac(this.listeners));for(var i=this.listeners,o=function(u){var v=i[u];Iv(n,function(f,c,d,h,y,g){if((v.type===d||r==="*")&&(!h&&v.namespace!==".*"||v.namespace===h)&&(!y||f.qualifierCompare(v.qualifier,y))&&(!g||v.callback===g))return i.splice(u,1),!1},r,e,t,a)},s=i.length-1;s>=0;s--)o(s);return this};ot.removeAllListeners=function(){return this.removeListener("*")};ot.emit=ot.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Le(e)||(e=[e]),qg(this,function(i,o){t!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],n=a.length);for(var s=function(){var v=a[l];if(v.type===o.type&&(!v.namespace||v.namespace===o.namespace||v.namespace===zg)&&i.eventMatches(i.context,v,o)){var f=[o];e!=null&&Rc(f,e),i.beforeEmit(i.context,v,o),v.conf&&v.conf.one&&(i.listeners=i.listeners.filter(function(h){return h!==v}));var c=i.callbackContext(i.context,v,o),d=v.callback.apply(c,f);i.afterEmit(i.context,v,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l<n;l++)s();i.bubble(i.context)&&!o.isPropagationStopped()&&i.parent(i.context).emit(o,e)},r),this.emitting--,this};var Vg={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Ta(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},$a=function(e){return fe(e)?new nt(e):e},Ov={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],a=t._private;a.emitter||(a.emitter=new Rn(Vg,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,a){for(var n=$a(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a)}return this},removeListener:function(e,t,a){for(var n=$a(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,a){for(var n=$a(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,n,a)}return this},once:function(e,t,a){for(var n=$a(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,t){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};Be.eventAliasesOn(Ov);var Nv={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):t.push(n)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(fe(e)||br(e))return new nt(e).filter(this);if(_e(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var o=n[i],s=t?e.apply(t,[o,i,n]):e(o,i,n);s&&a.push(o)}return a}return this.spawn()},not:function(e){if(e){fe(e)&&(e=this.filter(e));for(var t=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||t.push(n)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(fe(e)){var t=e;return this.filter(t)}for(var a=this.spawn(),n=this,i=e,o=this.length<e.length,s=o?n:i,l=o?i:n,u=0;u<s.length;u++){var v=s[u];l.has(v)&&a.push(v)}return a},xor:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var a=this.spawn(),n=this,i=e,o=function(l,u){for(var v=0;v<l.length;v++){var f=l[v],c=f._private.data.id,d=u.hasElementWithId(c);d||a.push(f)}};return o(n,i),o(i,n),a},diff:function(e){var t=this._private.cy;fe(e)&&(e=t.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),o=this,s=e,l=function(v,f,c){for(var d=0;d<v.length;d++){var h=v[d],y=h._private.data.id,g=f.hasElementWithId(y);g?i.merge(h):c.push(h)}};return l(o,s,a),l(s,o,n),{left:a,right:n,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(fe(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],s=!this.has(o);s&&n.push(o)}return n},merge:function(e){var t=this._private,a=t.cy;if(!e)return this;if(e&&fe(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=t.map,o=0;o<e.length;o++){var s=e[o],l=s._private.data.id,u=!i.has(l);if(u){var v=this.length++;this[v]=s,i.set(l,{ele:s,index:v})}}return this},unmergeAt:function(e){var t=this[e],a=t.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var o=e===this.length-1;if(this.length>1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&fe(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;i<n.length;i++){var o=n[i],s=t?e.apply(t,[o,i,n]):e(o,i,n);a.push(s)}return a},reduce:function(e,t){for(var a=t,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,t){for(var a=-1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],l=t?e.apply(t,[s,o,i]):e(s,o,i);l>a&&(a=l,n=s)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,o=0;o<i.length;o++){var s=i[o],l=t?e.apply(t,[s,o,i]):e(s,o,i);l<a&&(a=l,n=s)}return{value:a,ele:n}}},Pe=Nv;Pe.u=Pe["|"]=Pe["+"]=Pe.union=Pe.or=Pe.add;Pe["\\"]=Pe["!"]=Pe["-"]=Pe.difference=Pe.relativeComplement=Pe.subtract=Pe.not;Pe.n=Pe["&"]=Pe["."]=Pe.and=Pe.intersection=Pe.intersect;Pe["^"]=Pe["(+)"]=Pe["(-)"]=Pe.symmetricDifference=Pe.symdiff=Pe.xor;Pe.fnFilter=Pe.filterFn=Pe.stdFilter=Pe.filter;Pe.complement=Pe.abscomp=Pe.absoluteComplement;var _g={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},zv=function(e,t){var a=e.cy(),n=a.hasCompoundNodes();function i(v){var f=v.pstyle("z-compound-depth");return f.value==="auto"?n?v.zDepth():0:f.value==="bottom"?-1:f.value==="top"?No:0}var o=i(e)-i(t);if(o!==0)return o;function s(v){var f=v.pstyle("z-index-compare");return f.value==="auto"&&v.isNode()?1:0}var l=s(e)-s(t);if(l!==0)return l;var u=e.pstyle("z-index").value-t.pstyle("z-index").value;return u!==0?u:e.poolIndex()-t.poolIndex()},dn={forEach:function(e,t){if(_e(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],o=t?e.apply(t,[i,n,this]):e(i,n,this);if(o===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var a=[],n=this.length;t==null&&(t=n),e==null&&(e=0),e<0&&(e=n+e),t<0&&(t=n+t);for(var i=e;i>=0&&i<t&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!_e(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(zv)},zDepth:function(){var e=this[0];if(e){var t=e._private,a=t.group;if(a==="nodes"){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:No-1}else{var i=t.source,o=t.target,s=i.zDepth(),l=o.zDepth();return Math.max(s,l,0)}}}};dn.each=dn.forEach;var Gg=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":Ue(Symbol))!=e&&Ue(Symbol.iterator)!=e;t&&(dn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Il({next:function(){return i<o?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};Gg();var Hg=We({nodeDimensionsIncludeLabels:!1}),en={layoutDimensions:function(e){e=Hg(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();t={w:a.w,h:a.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,a){var n=this.nodes().filter(function(E){return!E.isParent()}),i=this.cy(),o=t.eles,s=function(C){return C.id()},l=Vt(a,s);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(C,x,S){var k={x:x.x1+x.w/2,y:x.y1+x.h/2},A={x:(S.x-k.x)*C,y:(S.y-k.y)*C};return{x:k.x+A.x,y:k.y+A.y}},v=t.spacingFactor&&t.spacingFactor!==1,f=function(){if(!v)return null;for(var C=pr(),x=0;x<n.length;x++){var S=n[x],k=l(S,x);uh(C,k.x,k.y)}return C},c=f(),d=Vt(function(E,C){var x=l(E,C);if(v){var S=Math.abs(t.spacingFactor);x=u(S,c,x)}return t.transform!=null&&(x=t.transform(E,x)),x},s);if(t.animate){for(var h=0;h<n.length;h++){var y=n[h],g=d(y,h),p=t.animateFilter==null||t.animateFilter(y,h);if(p){var m=y.animation({position:g,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else y.position(g)}if(t.fit){var b=i.animation({fit:{boundingBox:o.boundingBoxAt(d),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(b)}else if(t.zoom!==void 0&&t.pan!==void 0){var w=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(w)}e.animations.forEach(function(E){return E.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Ut.all(e.animations.map(function(E){return E.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(d),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(ge({},e,{eles:this}))}};en.createLayout=en.makeLayout=en.layout;function Fv(r,e,t){var a=t._private,n=a.styleCache=a.styleCache||[],i;return(i=n[r])!=null||(i=n[r]=e(t)),i}function Mn(r,e){return r=tt(r),function(a){return Fv(r,e,a)}}function Ln(r,e){r=tt(r);var t=function(n){return e.call(n)};return function(){var n=this[0];if(n)return Fv(r,t,n)}}var ar={recalculateRenderedStyle:function(e){var t=this.cy(),a=t.renderer(),n=t.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(t)}else this.forEach(function(n){t(n),n.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var a=t._private.batchStyleEles;return a.merge(this),this}var n=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(s){return s._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var a=this[t];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){a._private.styleDirty&&(a._private.styleDirty=!1,n.style().apply(a));var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(ke(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(fe(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var s=i[o];n.removeAllBypasses(s,a)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!t)return i;var o=n.data.parent?a.parents():null;if(o)for(var s=0;s<o.length;s++){var l=o[s],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],a=t.cy().hasCompoundNodes();if(t)return a?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function io(r,e){var t=r._private,a=t.data.parent?r.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Wo(r){var e=r.ok,t=r.edgeOkViaNode||r.ok,a=r.parentOk||r.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],o=n.hasCompoundNodes();if(i){var s=i._private;if(!e(i))return!1;if(i.isNode())return!o||io(i,a);var l=s.source,u=s.target;return t(l)&&(!o||io(l,t))&&(l===u||t(u)&&(!o||io(u,t)))}}}var Wt=Mn("eleTakesUpSpace",function(r){return r.pstyle("display").value==="element"&&r.width()!==0&&(r.isNode()?r.height()!==0:!0)});ar.takesUpSpace=Ln("takesUpSpace",Wo({ok:Wt}));var Kg=Mn("eleInteractive",function(r){return r.pstyle("events").value==="yes"&&r.pstyle("visibility").value==="visible"&&Wt(r)}),$g=Mn("parentInteractive",function(r){return r.pstyle("visibility").value==="visible"&&Wt(r)});ar.interactive=Ln("interactive",Wo({ok:Kg,parentOk:$g,edgeOkViaNode:Wt}));ar.noninteractive=function(){var r=this[0];if(r)return!r.interactive()};var Ug=Mn("eleVisible",function(r){return r.pstyle("visibility").value==="visible"&&r.pstyle("opacity").pfValue!==0&&Wt(r)}),Wg=Wt;ar.visible=Ln("visible",Wo({ok:Ug,edgeOkViaNode:Wg}));ar.hidden=function(){var r=this[0];if(r)return!r.visible()};ar.isBundledBezier=Ln("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});ar.bypass=ar.css=ar.style;ar.renderedCss=ar.renderedStyle;ar.removeBypass=ar.removeCss=ar.removeStyle;ar.pstyle=ar.parsedStyle;var et={};function Zu(r){return function(){var e=arguments,t=[];if(e.length===2){var a=e[0],n=e[1];this.on(r.event,a,n)}else if(e.length===1&&_e(e[0])){var i=e[0];this.on(r.event,i)}else if(e.length===0||e.length===1&&Le(e[0])){for(var o=e.length===1?e[0]:null,s=0;s<this.length;s++){var l=this[s],u=!r.ableField||l._private[r.ableField],v=l._private[r.field]!=r.value;if(r.overrideAble){var f=r.overrideAble(l);if(f!==void 0&&(u=f,!f))return this}u&&(l._private[r.field]=r.value,v&&t.push(l))}var c=this.spawn(t);c.updateStyle(),c.emit(r.event),o&&c.emit(o)}return this}}function Yt(r){et[r.field]=function(){var e=this[0];if(e){if(r.overrideField){var t=r.overrideField(e);if(t!==void 0)return t}return e._private[r.field]}},et[r.on]=Zu({event:r.on,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!0}),et[r.off]=Zu({event:r.off,field:r.field,ableField:r.ableField,overrideAble:r.overrideAble,value:!1})}Yt({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Yt({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Yt({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Yt({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});et.deselect=et.unselect;et.grabbed=function(){var r=this[0];if(r)return r._private.grabbed};Yt({field:"active",on:"activate",off:"unactivate"});Yt({field:"pannable",on:"panify",off:"unpanify"});et.inactive=function(){var r=this[0];if(r)return!r._private.active};var sr={},Qu=function(e){return function(a){for(var n=this,i=[],o=0;o<n.length;o++){var s=n[o];if(s.isNode()){for(var l=!1,u=s.connectedEdges(),v=0;v<u.length;v++){var f=u[v],c=f.source(),d=f.target();if(e.noIncomingEdges&&d===s&&c!==s||e.noOutgoingEdges&&c===s&&d!==s){l=!0;break}}l||i.push(s)}}return this.spawn(i,!0).filter(a)}},Ju=function(e){return function(t){for(var a=this,n=[],i=0;i<a.length;i++){var o=a[i];if(o.isNode())for(var s=o.connectedEdges(),l=0;l<s.length;l++){var u=s[l],v=u.source(),f=u.target();e.outgoing&&v===o?(n.push(u),n.push(f)):e.incoming&&f===o&&(n.push(u),n.push(v))}}return this.spawn(n,!0).filter(t)}},ju=function(e){return function(t){for(var a=this,n=[],i={};;){var o=e.outgoing?a.outgoers():a.incomers();if(o.length===0)break;for(var s=!1,l=0;l<o.length;l++){var u=o[l],v=u.id();i[v]||(i[v]=!0,n.push(u),s=!0)}if(!s)break;a=o}return this.spawn(n,!0).filter(t)}};sr.clearTraversalCache=function(){for(var r=0;r<this.length;r++)this[r]._private.traversalCache=null};ge(sr,{roots:Qu({noIncomingEdges:!0}),leaves:Qu({noOutgoingEdges:!0}),outgoers:Tr(Ju({outgoing:!0}),"outgoers"),successors:ju({outgoing:!0}),incomers:Tr(Ju({incoming:!0}),"incomers"),predecessors:ju({})});ge(sr,{neighborhood:Tr(function(r){for(var e=[],t=this.nodes(),a=0;a<t.length;a++)for(var n=t[a],i=n.connectedEdges(),o=0;o<i.length;o++){var s=i[o],l=s.source(),u=s.target(),v=n===l?u:l;v.length>0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});sr.neighbourhood=sr.neighborhood;sr.closedNeighbourhood=sr.closedNeighborhood;sr.openNeighbourhood=sr.openNeighborhood;ge(sr,{source:Tr(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:Tr(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:el({attr:"source"}),targets:el({attr:"target"})});function el(r){return function(t){for(var a=[],n=0;n<this.length;n++){var i=this[n],o=i._private[r.attr];o&&a.push(o)}return this.spawn(a,!0).filter(t)}}ge(sr,{edgesWith:Tr(rl(),"edgesWith"),edgesTo:Tr(rl({thisIsSrc:!0}),"edgesTo")});function rl(r){return function(t){var a=[],n=this._private.cy,i=r||{};fe(t)&&(t=n.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,l=0;l<s.length;l++){var u=s[l],v=u._private.data,f=this.hasElementWithId(v.source)&&t.hasElementWithId(v.target),c=t.hasElementWithId(v.source)&&this.hasElementWithId(v.target),d=f||c;d&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!f||i.thisIsTgt&&!c)||a.push(u))}return this.spawn(a,!0)}}ge(sr,{connectedEdges:Tr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];if(n.isNode())for(var i=n._private.edges,o=0;o<i.length;o++){var s=i[o];e.push(s)}}return this.spawn(e,!0).filter(r)},"connectedEdges"),connectedNodes:Tr(function(r){for(var e=[],t=this,a=0;a<t.length;a++){var n=t[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(r)},"connectedNodes"),parallelEdges:Tr(tl(),"parallelEdges"),codirectedEdges:Tr(tl({codirected:!0}),"codirectedEdges")});function tl(r){var e={codirected:!1};return r=ge({},e,r),function(a){for(var n=[],i=this.edges(),o=r,s=0;s<i.length;s++)for(var l=i[s],u=l._private,v=u.source,f=v._private.data.id,c=u.data.target,d=v._private.edges,h=0;h<d.length;h++){var y=d[h],g=y._private.data,p=g.target,m=g.source,b=p===c&&m===f,w=f===p&&c===m;(o.codirected&&b||!o.codirected&&(b||w))&&n.push(y)}return this.spawn(n,!0).filter(a)}}ge(sr,{components:function(e){var t=this,a=t.cy(),n=a.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var s=function(v,f){n.merge(v),i.unmerge(v),f.merge(v)};if(i.empty())return t.spawn();var l=function(){var v=a.collection();o.push(v);var f=i[0];s(f,v),t.bfs({directed:!1,roots:f,visit:function(d){return s(d,v)}}),v.forEach(function(c){c.connectedEdges().forEach(function(d){t.has(d)&&v.has(d.source())&&v.has(d.target())&&v.merge(d)})})};do l();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});sr.componentsOf=sr.components;var nr=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ve("A collection must have a reference to the core");return}var i=new Kr,o=!1;if(!t)t=[];else if(t.length>0&&ke(t[0])&&!Ta(t[0])){o=!0;for(var s=[],l=new $t,u=0,v=t.length;u<v;u++){var f=t[u];f.data==null&&(f.data={});var c=f.data;if(c.id==null)c.id=Jl();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var d=new Cn(e,f,!1);s.push(d),l.add(c.id)}t=s}this.length=0;for(var h=0,y=t.length;h<y;h++){var g=t[h][0];if(g!=null){var p=g._private.data.id;(!a||!i.has(p))&&(a&&i.set(p,{index:this.length,ele:g}),this[this.length]=g,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var b=this.lazyMap=new Kr,w=this.eles,E=0;E<w.length;E++){var C=w[E];b.set(C.id(),{index:E,ele:C})}}},a&&(this._private.map=i),o&&!n&&this.restore()},ze=Cn.prototype=nr.prototype=Object.create(Array.prototype);ze.instanceString=function(){return"collection"};ze.spawn=function(r,e){return new nr(this.cy(),r,e)};ze.spawnSelf=function(){return this.spawn(this)};ze.cy=function(){return this._private.cy};ze.renderer=function(){return this._private.cy.renderer()};ze.element=function(){return this[0]};ze.collection=function(){return Fl(this)?this:new nr(this._private.cy,[this])};ze.unique=function(){return new nr(this._private.cy,this,!0)};ze.hasElementWithId=function(r){return r=""+r,this._private.map.has(r)};ze.getElementById=function(r){r=""+r;var e=this._private.cy,t=this._private.map.get(r);return t?t.ele:new nr(e)};ze.$id=ze.getElementById;ze.poolIndex=function(){var r=this._private.cy,e=r._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index};ze.indexOf=function(r){var e=r[0]._private.data.id;return this._private.map.get(e).index};ze.indexOfId=function(r){return r=""+r,this._private.map.get(r).index};ze.json=function(r){var e=this.element(),t=this.cy();if(e==null&&r)return this;if(e!=null){var a=e._private;if(ke(r)){if(t.startBatch(),r.data){e.data(r.data);var n=a.data;if(e.isEdge()){var i=!1,o={},s=r.data.source,l=r.data.target;s!=null&&s!=n.source&&(o.source=""+s,i=!0),l!=null&&l!=n.target&&(o.target=""+l,i=!0),i&&(e=e.move(o))}else{var u="parent"in r.data,v=r.data.parent;u&&(v!=null||n.parent!=null)&&v!=n.parent&&(v===void 0&&(v=null),v!=null&&(v=""+v),e=e.move({parent:v}))}}r.position&&e.position(r.position);var f=function(y,g,p){var m=r[y];m!=null&&m!==a[y]&&(m?e[g]():e[p]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),r.classes!=null&&e.classes(r.classes),t.endBatch(),this}else if(r===void 0){var c={data:Nr(a.data),position:Nr(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var d=0;return a.classes.forEach(function(h){return c.classes+=d++===0?h:" "+h}),c}}};ze.jsons=function(){for(var r=[],e=0;e<this.length;e++){var t=this[e],a=t.json();r.push(a)}return r};ze.clone=function(){for(var r=this.cy(),e=[],t=0;t<this.length;t++){var a=this[t],n=a.json(),i=new Cn(r,n,!1);e.push(i)}return new nr(r,e)};ze.copy=ze.clone;ze.restore=function(){for(var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],o=[],s,l=0,u=t.length;l<u;l++){var v=t[l];e&&!v.removed()||(v.isNode()?i.push(v):o.push(v))}s=i.concat(o);var f,c=function(){s.splice(f,1),f--};for(f=0;f<s.length;f++){var d=s[f],h=d._private,y=h.data;if(d.clearTraversalCache(),!(!e&&!h.removed)){if(y.id===void 0)y.id=Jl();else if(ae(y.id))y.id=""+y.id;else if(rt(y.id)||!fe(y.id)){Ve("Can not create element with invalid string ID `"+y.id+"`"),c();continue}else if(a.hasElementWithId(y.id)){Ve("Can not create second element with ID `"+y.id+"`"),c();continue}}var g=y.id;if(d.isNode()){var p=h.position;p.x==null&&(p.x=0),p.y==null&&(p.y=0)}if(d.isEdge()){for(var m=d,b=["source","target"],w=b.length,E=!1,C=0;C<w;C++){var x=b[C],S=y[x];ae(S)&&(S=y[x]=""+y[x]),S==null||S===""?(Ve("Can not create edge `"+g+"` with unspecified "+x),E=!0):a.hasElementWithId(S)||(Ve("Can not create edge `"+g+"` with nonexistant "+x+" `"+S+"`"),E=!0)}if(E){c();continue}var k=a.getElementById(y.source),A=a.getElementById(y.target);k.same(A)?k._private.edges.push(m):(k._private.edges.push(m),A._private.edges.push(m)),m._private.source=k,m._private.target=A}h.map=new Kr,h.map.set(g,{ele:d,index:0}),h.removed=!1,e&&a.addToPool(d)}for(var D=0;D<i.length;D++){var B=i[D],P=B._private.data;ae(P.parent)&&(P.parent=""+P.parent);var R=P.parent,L=R!=null;if(L||B._private.parent){var I=B._private.parent?a.collection().merge(B._private.parent):a.getElementById(R);if(I.empty())P.parent=void 0;else if(I[0].removed())Re("Node added with missing parent, reference to parent removed"),P.parent=void 0,B._private.parent=null;else{for(var M=!1,O=I;!O.empty();){if(B.same(O)){M=!0,P.parent=void 0;break}O=O.parent()}M||(I[0]._private.children.push(B),B._private.parent=I[0],n.hasCompoundNodes=!0)}}}if(s.length>0){for(var _=s.length===t.length?t:new nr(a,s),H=0;H<_.length;H++){var z=_[H];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.target().clearTraversalCache())}var G;n.hasCompoundNodes?G=a.collection().merge(_).merge(_.connectedNodes()).merge(_.parent()):G=_,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r),r?_.emitAndNotify("add"):e&&_.emit("add")}return t};ze.removed=function(){var r=this[0];return r&&r._private.removed};ze.inside=function(){var r=this[0];return r&&!r._private.removed};ze.remove=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function o(R){for(var L=R._private.edges,I=0;I<L.length;I++)l(L[I])}function s(R){for(var L=R._private.children,I=0;I<L.length;I++)l(L[I])}function l(R){var L=n[R.id()];e&&R.removed()||L||(n[R.id()]=!0,R.isNode()?(a.push(R),o(R),s(R)):a.unshift(R))}for(var u=0,v=t.length;u<v;u++){var f=t[u];l(f)}function c(R,L){var I=R._private.edges;at(I,L),R.clearTraversalCache()}function d(R){R.clearTraversalCache()}var h=[];h.ids={};function y(R,L){L=L[0],R=R[0];var I=R._private.children,M=R.id();at(I,L),L._private.parent=null,h.ids[M]||(h.ids[M]=!0,h.push(R))}t.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var g=0;g<a.length;g++){var p=a[g];if(p.isEdge()){var m=p.source()[0],b=p.target()[0];c(m,p),c(b,p);for(var w=p.parallelEdges(),E=0;E<w.length;E++){var C=w[E];d(C),C.isBundledBezier()&&C.dirtyBoundingBoxCache()}}else{var x=p.parent();x.length!==0&&y(x,p)}e&&(p._private.removed=!0)}var S=i._private.elements;i._private.hasCompoundNodes=!1;for(var k=0;k<S.length;k++){var A=S[k];if(A.isParent()){i._private.hasCompoundNodes=!0;break}}var D=new nr(this.cy(),a);D.size()>0&&(r?D.emitAndNotify("remove"):e&&D.emit("remove"));for(var B=0;B<h.length;B++){var P=h[B];(!e||!P.removed())&&P.updateStyle()}return D};ze.move=function(r){var e=this._private.cy,t=this,a=!1,n=!1,i=function(h){return h==null?h:""+h};if(r.source!==void 0||r.target!==void 0){var o=i(r.source),s=i(r.target),l=o!=null&&e.hasElementWithId(o),u=s!=null&&e.hasElementWithId(s);(l||u)&&(e.batch(function(){t.remove(a,n),t.emitAndNotify("moveout");for(var d=0;d<t.length;d++){var h=t[d],y=h._private.data;h.isEdge()&&(l&&(y.source=o),u&&(y.target=s))}t.restore(a,n)}),t.emitAndNotify("move"))}else if(r.parent!==void 0){var v=i(r.parent),f=v===null||e.hasElementWithId(v);if(f){var c=v===null?void 0:v;e.batch(function(){var d=t.remove(a,n);d.emitAndNotify("moveout");for(var h=0;h<t.length;h++){var y=t[h],g=y._private.data;y.isNode()&&(g.parent=c)}d.restore(a,n)}),t.emitAndNotify("move")}}return this};[fv,ng,ja,jr,Ht,wg,Bn,Ng,Ov,Nv,_g,dn,en,ar,et,sr].forEach(function(r){ge(ze,r)});var Yg={add:function(e){var t,a=this;if(br(e)){var n=e;if(n._private.cy===a)t=n.restore();else{for(var i=[],o=0;o<n.length;o++){var s=n[o];i.push(s.json())}t=new nr(a,i)}}else if(Le(e)){var l=e;t=new nr(a,l)}else if(ke(e)&&(Le(e.nodes)||Le(e.edges))){for(var u=e,v=[],f=["nodes","edges"],c=0,d=f.length;c<d;c++){var h=f[c],y=u[h];if(Le(y))for(var g=0,p=y.length;g<p;g++){var m=ge({group:h},y[g]);v.push(m)}}t=new nr(a,v)}else{var b=e;t=new Cn(a,b).collection()}return t},remove:function(e){if(!br(e)){if(fe(e)){var t=e;e=this.$(t)}}return e.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function Xg(r,e,t,a){var n=4,i=.001,o=1e-7,s=10,l=11,u=1/(l-1),v=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;r=Math.min(r,1),t=Math.min(t,1),r=Math.max(r,0),t=Math.max(t,0);var c=v?new Float32Array(l):new Array(l);function d(A,D){return 1-3*D+3*A}function h(A,D){return 3*D-6*A}function y(A){return 3*A}function g(A,D,B){return((d(D,B)*A+h(D,B))*A+y(D))*A}function p(A,D,B){return 3*d(D,B)*A*A+2*h(D,B)*A+y(D)}function m(A,D){for(var B=0;B<n;++B){var P=p(D,r,t);if(P===0)return D;var R=g(D,r,t)-A;D-=R/P}return D}function b(){for(var A=0;A<l;++A)c[A]=g(A*u,r,t)}function w(A,D,B){var P,R,L=0;do R=D+(B-D)/2,P=g(R,r,t)-A,P>0?B=R:D=R;while(Math.abs(P)>o&&++L<s);return R}function E(A){for(var D=0,B=1,P=l-1;B!==P&&c[B]<=A;++B)D+=u;--B;var R=(A-c[B])/(c[B+1]-c[B]),L=D+R*u,I=p(L,r,t);return I>=i?m(A,L):I===0?L:w(A,D,D+u)}var C=!1;function x(){C=!0,(r!==e||t!==a)&&b()}var S=function(D){return C||x(),r===e&&t===a?D:D===0?0:D===1?1:g(E(D),e,a)};S.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var k="generateBezier("+[r,e,t,a]+")";return S.toString=function(){return k},S}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Zg=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:r(o)}}function t(a,n){var i={dx:a.v,dv:r(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),l=e(a,n,s),u=1/6*(i.dx+2*(o.dx+s.dx)+l.dx),v=1/6*(i.dv+2*(o.dv+s.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=16/1e3,c,d,h;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(u=a(n,i),d=u/o*f):d=f;h=t(h||s,d),l.push(1+h.x),u+=16,Math.abs(h.x)>v&&Math.abs(h.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),Ne=function(e,t,a,n){var i=Xg(e,t,a,n);return function(o,s,l){return o+(s-o)*i(l)}},rn={linear:function(e,t,a){return e+(t-e)*a},ease:Ne(.25,.1,.25,1),"ease-in":Ne(.42,0,1,1),"ease-out":Ne(0,0,.58,1),"ease-in-out":Ne(.42,0,.58,1),"ease-in-sine":Ne(.47,0,.745,.715),"ease-out-sine":Ne(.39,.575,.565,1),"ease-in-out-sine":Ne(.445,.05,.55,.95),"ease-in-quad":Ne(.55,.085,.68,.53),"ease-out-quad":Ne(.25,.46,.45,.94),"ease-in-out-quad":Ne(.455,.03,.515,.955),"ease-in-cubic":Ne(.55,.055,.675,.19),"ease-out-cubic":Ne(.215,.61,.355,1),"ease-in-out-cubic":Ne(.645,.045,.355,1),"ease-in-quart":Ne(.895,.03,.685,.22),"ease-out-quart":Ne(.165,.84,.44,1),"ease-in-out-quart":Ne(.77,0,.175,1),"ease-in-quint":Ne(.755,.05,.855,.06),"ease-out-quint":Ne(.23,1,.32,1),"ease-in-out-quint":Ne(.86,0,.07,1),"ease-in-expo":Ne(.95,.05,.795,.035),"ease-out-expo":Ne(.19,1,.22,1),"ease-in-out-expo":Ne(1,0,0,1),"ease-in-circ":Ne(.6,.04,.98,.335),"ease-out-circ":Ne(.075,.82,.165,1),"ease-in-out-circ":Ne(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return rn.linear;var n=Zg(e,t,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":Ne};function al(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function nl(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Dt(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var o=nl(r,n),s=nl(e,n);if(ae(o)&&ae(s))return al(i,o,s,t,a);if(Le(o)&&Le(s)){for(var l=[],u=0;u<s.length;u++){var v=o[u],f=s[u];if(v!=null&&f!=null){var c=al(i,v,f,t,a);l.push(c)}else l.push(f)}return l}}function Qg(r,e,t,a){var n=!a,i=r._private,o=e._private,s=o.easing,l=o.startTime,u=a?r:r.cy(),v=u.style();if(!o.easingImpl)if(s==null)o.easingImpl=rn.linear;else{var f;if(fe(s)){var c=v.parse("transition-timing-function",s);f=c.value}else f=s;var d,h;fe(f)?(d=f,h=[]):(d=f[1],h=f.slice(2).map(function(_){return+_})),h.length>0?(d==="spring"&&h.push(o.duration),o.easingImpl=rn[d].apply(null,h)):o.easingImpl=rn[d]}var y=o.easingImpl,g;if(o.duration===0?g=1:g=(t-l)/o.duration,o.applying&&(g=o.progress),g<0?g=0:g>1&&(g=1),o.delay==null){var p=o.startPosition,m=o.position;if(m&&n&&!r.locked()){var b={};aa(p.x,m.x)&&(b.x=Dt(p.x,m.x,g,y)),aa(p.y,m.y)&&(b.y=Dt(p.y,m.y,g,y)),r.position(b)}var w=o.startPan,E=o.pan,C=i.pan,x=E!=null&&a;x&&(aa(w.x,E.x)&&(C.x=Dt(w.x,E.x,g,y)),aa(w.y,E.y)&&(C.y=Dt(w.y,E.y,g,y)),r.emit("pan"));var S=o.startZoom,k=o.zoom,A=k!=null&&a;A&&(aa(S,k)&&(i.zoom=pa(i.minZoom,Dt(S,k,g,y),i.maxZoom)),r.emit("zoom")),(x||A)&&r.emit("viewport");var D=o.style;if(D&&D.length>0&&n){for(var B=0;B<D.length;B++){var P=D[B],R=P.name,L=P,I=o.startStyle[R],M=v.properties[I.name],O=Dt(I,L,g,y,M);v.overrideBypass(r,R,O)}r.emit("style")}}return o.progress=g,g}function aa(r,e){return r==null||e==null?!1:ae(r)&&ae(e)?!0:!!(r&&e)}function Jg(r,e,t,a){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}function il(r,e){var t=e._private.aniEles,a=[];function n(v,f){var c=v._private,d=c.animation.current,h=c.animation.queue,y=!1;if(d.length===0){var g=h.shift();g&&d.push(g)}for(var p=function(C){for(var x=C.length-1;x>=0;x--){var S=C[x];S()}C.splice(0,C.length)},m=d.length-1;m>=0;m--){var b=d[m],w=b._private;if(w.stopped){d.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Jg(v,b,r),Qg(v,b,r,f),w.applying&&(w.applying=!1),p(w.frames),w.step!=null&&w.step(r),b.completed()&&(d.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,p(w.completes)),y=!0)}return!f&&d.length===0&&h.length===0&&a.push(v),y}for(var i=!1,o=0;o<t.length;o++){var s=t[o],l=n(s);i=i||l}var u=n(e,!0);(i||u)&&(t.length>0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var jg={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&ln(function(i){il(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){il(o,e)},a.beforeRenderPriorities.animations):t()}},ep={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&Ta(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},Ua=function(e){return fe(e)?new nt(e):e},qv={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Rn(ep,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,Ua(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,Ua(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,Ua(t),a),this},once:function(e,t,a){return this.emitter().one(e,Ua(t),a),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Be.eventAliasesOn(qv);var Eo={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Eo.jpeg=Eo.jpg;var tn={layout:function(e){var t=this;if(e==null){Ve("Layout options must be specified to make a layout");return}if(e.name==null){Ve("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){Ve("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;fe(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new n(ge({},e,{cy:t,eles:i}));return o}};tn.createLayout=tn.makeLayout=tn.layout;var rp={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],o=e[i],s=t.getElementById(i);s.data(o)}})}},tp=We({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]}),Co={renderTo:function(e,t,a,n){var i=this._private.renderer;return i.renderTo(e,t,a,n),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,a=t.extension("renderer",e.name);if(a==null){Ve("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Re("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=tp(e);n.cy=t,t._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Co.invalidateDimensions=Co.resize;var an={collection:function(e,t){return fe(e)?this.$(e):br(e)?e.collection():Le(e)?(t||(t={}),new nr(this,e,t.unique,t.removed)):new nr(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};an.elements=an.filter=an.$;var rr={},va="t",ap="f";rr.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i<r.length;i++){var o=r[i],s=e.getContextMeta(o);if(!s.empty){var l=e.getContextStyle(s),u=e.applyContextStyle(s,l,o);o._private.appliedInitStyle?e.updateTransitions(o,u.diffProps):o._private.appliedInitStyle=!0;var v=e.updateStyleHints(o);v&&n.push(o)}}return n};rr.getPropertiesDiff=function(r,e){var t=this,a=t._private.propDiffs=t._private.propDiffs||{},n=r+"-"+e,i=a[n];if(i)return i;for(var o=[],s={},l=0;l<t.length;l++){var u=t[l],v=r[l]===va,f=e[l]===va,c=v!==f,d=u.mappedProperties.length>0;if(c||f&&d){var h=void 0;c&&d||c?h=u.properties:d&&(h=u.mappedProperties);for(var y=0;y<h.length;y++){for(var g=h[y],p=g.name,m=!1,b=l+1;b<t.length;b++){var w=t[b],E=e[b]===va;if(E&&(m=w.properties[g.name]!=null,m))break}!s[p]&&!m&&(s[p]=!0,o.push(p))}}}return a[n]=o,o};rr.getContextMeta=function(r){for(var e=this,t="",a,n=r._private.styleCxtKey||"",i=0;i<e.length;i++){var o=e[i],s=o.selector&&o.selector.matches(r);s?t+=va:t+=ap}return a=e.getPropertiesDiff(n,t),r._private.styleCxtKey=t,{key:t,diffPropNames:a,empty:a.length===0}};rr.getContextStyle=function(r){var e=r.key,t=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<t.length;i++){var o=t[i],s=e[i]===va;if(s)for(var l=0;l<o.properties.length;l++){var u=o.properties[l];n[u.name]=u}}return a[e]=n,n};rr.applyContextStyle=function(r,e,t){for(var a=this,n=r.diffPropNames,i={},o=a.types,s=0;s<n.length;s++){var l=n[s],u=e[l],v=t.pstyle(l);if(!u)if(v)v.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(v!==u){if(u.mapped===o.fn&&v!=null&&v.mapping!=null&&v.mapping.value===u.value){var f=v.mapping,c=f.fnValue=u.value(t);if(c===f.prevFnValue)continue}var d=i[l]={prev:v};a.applyParsedProperty(t,u),d.next=t.pstyle(l),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:i}};rr.updateStyleHints=function(r){var e=r._private,t=this,a=t.propertyGroupNames,n=t.propertyGroupKeys,i=function($,J,te){return t.getPropertiesHash($,J,te)},o=e.styleKey;if(r.removed())return!1;var s=e.group==="nodes",l=r._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var v=n[u];e.styleKeys[v]=[Mt,oa]}for(var f=function($,J){return e.styleKeys[J][0]=ha($,e.styleKeys[J][0])},c=function($,J){return e.styleKeys[J][1]=da($,e.styleKeys[J][1])},d=function($,J){f($,J),c($,J)},h=function($,J){for(var te=0;te<$.length;te++){var le=$.charCodeAt(te);f(le,J),c(le,J)}},y=2e9,g=function($){return-128<$&&$<128&&Math.floor($)!==$?y-($*1024|0):$},p=0;p<a.length;p++){var m=a[p],b=l[m];if(b!=null){var w=this.properties[m],E=w.type,C=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(r,b):b.pfValue!=null&&(x=b.pfValue);var S=w.enums==null?b.value:null,k=x!=null,A=S!=null,D=k||A,B=b.units;if(E.number&&D&&!E.multiple){var P=k?x:S;d(g(P),C),!k&&B!=null&&h(B,C)}else h(b.strValue,C)}}for(var R=[Mt,oa],L=0;L<n.length;L++){var I=n[L],M=e.styleKeys[I];R[0]=ha(M[0],R[0]),R[1]=da(M[1],R[1])}e.styleKey=Tc(R[0],R[1]);var O=e.styleKeys;e.labelDimsKey=Xr(O.labelDimensions);var _=i(r,["label"],O.labelDimensions);if(e.labelKey=Xr(_),e.labelStyleKey=Xr(Fa(O.commonLabel,_)),!s){var H=i(r,["source-label"],O.labelDimensions);e.sourceLabelKey=Xr(H),e.sourceLabelStyleKey=Xr(Fa(O.commonLabel,H));var z=i(r,["target-label"],O.labelDimensions);e.targetLabelKey=Xr(z),e.targetLabelStyleKey=Xr(Fa(O.commonLabel,z))}if(s){var G=e.styleKeys,W=G.nodeBody,X=G.nodeBorder,Z=G.nodeOutline,Q=G.backgroundImage,ee=G.compound,re=G.pie,K=[W,X,Z,Q,ee,re].filter(function(N){return N!=null}).reduce(Fa,[Mt,oa]);e.nodeKey=Xr(K),e.hasPie=re!=null&&re[0]!==Mt&&re[1]!==oa}return o!==e.styleKey};rr.clearStyleHints=function(r){var e=r._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null};rr.applyParsedProperty=function(r,e){var t=this,a=e,n=r._private.style,i,o=t.types,s=t.properties[a.name].type,l=a.bypass,u=n[a.name],v=u&&u.bypass,f=r._private,c="mapping",d=function(W){return W==null?null:W.pfValue!=null?W.pfValue:W.value},h=function(){var W=d(u),X=d(a);t.checkTriggers(r,a.name,W,X)};if(e.name==="curve-style"&&r.isEdge()&&(e.value!=="bezier"&&r.isLoop()||e.value==="haystack"&&(r.source().isParent()||r.target().isParent()))&&(a=e=this.parse(e.name,"bezier",l)),a.delete)return n[a.name]=void 0,h(),!0;if(a.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,h(),!0):!1:(h(),!0);if(a.deleteBypass)return u?u.bypass?(n[a.name]=u.bypassed,h(),!0):!1:(h(),!0);var y=function(){Re("Do not assign mappings to elements without corresponding data (i.e. ele `"+r.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case o.mapData:{for(var g=a.field.split("."),p=f.data,m=0;m<g.length&&p;m++){var b=g[m];p=p[b]}if(p==null)return y(),!1;var w;if(ae(p)){var E=a.fieldMax-a.fieldMin;E===0?w=0:w=(p-a.fieldMin)/E}else return Re("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+p+"` for `"+r.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),s.color){var C=a.valueMin[0],x=a.valueMax[0],S=a.valueMin[1],k=a.valueMax[1],A=a.valueMin[2],D=a.valueMax[2],B=a.valueMin[3]==null?1:a.valueMin[3],P=a.valueMax[3]==null?1:a.valueMax[3],R=[Math.round(C+(x-C)*w),Math.round(S+(k-S)*w),Math.round(A+(D-A)*w),Math.round(B+(P-B)*w)];i={bypass:a.bypass,name:a.name,value:R,strValue:"rgb("+R[0]+", "+R[1]+", "+R[2]+")"}}else if(s.number){var L=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,L,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case o.data:{for(var I=a.field.split("."),M=f.data,O=0;O<I.length&&M;O++){var _=I[O];M=M[_]}if(M!=null&&(i=this.parse(a.name,M,a.bypass,c)),!i)return y(),!1;i.mapping=a,a=i;break}case o.fn:{var H=a.value,z=a.fnValue!=null?a.fnValue:H(r);if(a.prevFnValue=z,z==null)return Re("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+r.id()+"` is null)"),!1;if(i=this.parse(a.name,z,a.bypass,c),!i)return Re("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+r.id()+"` is invalid)"),!1;i.mapping=Nr(a),a=i;break}case void 0:break;default:return!1}return l?(v?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):v?u.bypassed=a:n[a.name]=a,h(),!0};rr.cleanElements=function(r,e){for(var t=0;t<r.length;t++){var a=r[t];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),o=0;o<i.length;o++){var s=i[o],l=n[s];l!=null&&(l.bypass?l.bypassed=null:n[s]=null)}}};rr.update=function(){var r=this._private.cy,e=r.mutableElements();e.updateStyle()};rr.updateTransitions=function(r,e){var t=this,a=r._private,n=r.pstyle("transition-property").value,i=r.pstyle("transition-duration").pfValue,o=r.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var s={},l=!1,u=0;u<n.length;u++){var v=n[u],f=r.pstyle(v),c=e[v];if(c){var d=c.prev,h=d,y=c.next!=null?c.next:f,g=!1,p=void 0,m=1e-6;h&&(ae(h.pfValue)&&ae(y.pfValue)?(g=y.pfValue-h.pfValue,p=h.pfValue+m*g):ae(h.value)&&ae(y.value)?(g=y.value-h.value,p=h.value+m*g):Le(h.value)&&Le(y.value)&&(g=h.value[0]!==y.value[0]||h.value[1]!==y.value[1]||h.value[2]!==y.value[2],p=h.strValue),g&&(s[v]=y.strValue,this.applyBypass(r,v,p),l=!0))}}if(!l)return;a.transitioning=!0,new Ut(function(b){o>0?r.delayAnimation(o).play().promise().then(b):b()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};rr.checkTrigger=function(r,e,t,a,n,i){var o=this.properties[e],s=n(o);r.removed()||s!=null&&s(t,a,r)&&i(o)};rr.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};rr.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache()})};rr.checkConnectedEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfConnectedEdges},function(n){r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};rr.checkParallelEdgesBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBoundsOfParallelEdges},function(n){r.parallelEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};rr.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a),this.checkConnectedEdgesBoundsTrigger(r,e,t,a),this.checkParallelEdgesBoundsTrigger(r,e,t,a)};var Ra={};Ra.applyBypass=function(r,e,t,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;s<n.properties.length;s++){var l=n.properties[s],u=l.name,v=this.parse(u,t,!0);v&&i.push(v)}}else if(fe(e)){var f=this.parse(e,t,!0);f&&i.push(f)}else if(ke(e)){var c=e;a=t;for(var d=Object.keys(c),h=0;h<d.length;h++){var y=d[h],g=c[y];if(g===void 0&&(g=c[xn(y)]),g!==void 0){var p=this.parse(y,g,!0);p&&i.push(p)}}}else return!1;if(i.length===0)return!1;for(var m=!1,b=0;b<r.length;b++){for(var w=r[b],E={},C=void 0,x=0;x<i.length;x++){var S=i[x];if(a){var k=w.pstyle(S.name);C=E[S.name]={prev:k}}m=this.applyParsedProperty(w,Nr(S))||m,a&&(C.next=w.pstyle(S.name))}m&&this.updateStyleHints(w),a&&this.updateTransitions(w,E,o)}return m};Ra.overrideBypass=function(r,e,t){e=Io(e);for(var a=0;a<r.length;a++){var n=r[a],i=n._private.style[e],o=this.properties[e].type,s=o.color,l=o.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,t):(i.value=t,i.pfValue!=null&&(i.pfValue=t),s?i.strValue="rgb("+t.join(",")+")":l?i.strValue=t.join(" "):i.strValue=""+t,this.updateStyleHints(n)),this.checkTriggers(n,e,u,t)}};Ra.removeAllBypasses=function(r,e){return this.removeBypasses(r,this.propertyNames,e)};Ra.removeBypasses=function(r,e,t){for(var a=!0,n=0;n<r.length;n++){for(var i=r[n],o={},s=0;s<e.length;s++){var l=e[s],u=this.properties[l],v=i.pstyle(u.name);if(!(!v||!v.bypass)){var f="",c=this.parse(l,f,!0),d=o[u.name]={prev:v};this.applyParsedProperty(i,c),d.next=i.pstyle(u.name)}}this.updateStyleHints(i),t&&this.updateTransitions(i,o,a)}};var Yo={};Yo.getEmSizeInPixels=function(){var r=this.containerCss("font-size");return r!=null?parseFloat(r):1};Yo.containerCss=function(r){var e=this._private.cy,t=e.container(),a=e.window();if(a&&t&&a.getComputedStyle)return a.getComputedStyle(t).getPropertyValue(r)};var zr={};zr.getRenderedStyle=function(r,e){return e?this.getStylePropertyValue(r,e,!0):this.getRawStyle(r,!0)};zr.getRawStyle=function(r,e){var t=this;if(r=r[0],r){for(var a={},n=0;n<t.properties.length;n++){var i=t.properties[n],o=t.getStylePropertyValue(r,i.name,e);o!=null&&(a[i.name]=o,a[xn(i.name)]=o)}return a}};zr.getIndexedStyle=function(r,e,t,a){var n=r.pstyle(e)[t][a];return n??r.cy().style().getDefaultProperty(e)[t][0]};zr.getStylePropertyValue=function(r,e,t){var a=this;if(r=r[0],r){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,o=r.pstyle(n.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(t&&i.number&&s!=null&&ae(s)){var v=r.cy().zoom(),f=function(g){return g*v},c=function(g,p){return f(g)+p},d=Le(s),h=d?l.every(function(y){return y!=null}):l!=null;return h?d?s.map(function(y,g){return c(y,l[g])}).join(" "):c(s,l):d?s.map(function(y){return fe(y)?y:""+f(y)}).join(" "):""+f(s)}else if(u!=null)return u}return null}};zr.getAnimationStartStyle=function(r,e){for(var t={},a=0;a<e.length;a++){var n=e[a],i=n.name,o=r.pstyle(i);o!==void 0&&(ke(o)?o=this.parse(i,o.strValue):o=this.parse(i,o)),o&&(t[i]=o)}return t};zr.getPropsList=function(r){var e=this,t=[],a=r,n=e.properties;if(a)for(var i=Object.keys(a),o=0;o<i.length;o++){var s=i[o],l=a[s],u=n[s]||n[Io(s)],v=this.parse(u.name,l);v&&t.push(v)}return t};zr.getNonDefaultPropertiesHash=function(r,e,t){var a=t.slice(),n,i,o,s,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=r.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=ha(s,a[0]),a[1]=da(s,a[1]);else for(o=i.strValue,u=0;u<o.length;u++)s=o.charCodeAt(u),a[0]=ha(s,a[0]),a[1]=da(s,a[1]);return a};zr.getPropertiesHash=zr.getNonDefaultPropertiesHash;var In={};In.appendFromJson=function(r){for(var e=this,t=0;t<r.length;t++){var a=r[t],n=a.selector,i=a.style||a.css,o=Object.keys(i);e.selector(n);for(var s=0;s<o.length;s++){var l=o[s],u=i[l];e.css(l,u)}}return e};In.fromJson=function(r){var e=this;return e.resetToDefault(),e.appendFromJson(r),e};In.json=function(){for(var r=[],e=this.defaultLength;e<this.length;e++){for(var t=this[e],a=t.selector,n=t.properties,i={},o=0;o<n.length;o++){var s=n[o];i[s.name]=s.strValue}r.push({selector:a?a.toString():"core",style:i})}return r};var Xo={};Xo.appendFromString=function(r){var e=this,t=this,a=""+r,n,i,o;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Re("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new nt(f);if(c.invalid){Re("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var d=v[2],h=!1;i=d;for(var y=[];;){var g=i.match(/^\s*$/);if(g)break;var p=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!p){Re("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),h=!0;break}o=p[0];var m=p[1],b=p[2],w=e.properties[m];if(!w){Re("Skipping property: Invalid property name in: "+o),l();continue}var E=t.parse(m,b);if(!E){Re("Skipping property: Invalid property definition in: "+o),l();continue}y.push({name:m,val:b}),l()}if(h){s();break}t.selector(f);for(var C=0;C<y.length;C++){var x=y[C];t.css(x.name,x.val)}s()}return t};Xo.fromString=function(r){var e=this;return e.resetToDefault(),e.appendFromString(r),e};var tr={};(function(){var r=$e,e=tc,t=nc,a=ic,n=oc,i=function(K){return"^"+K+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},o=function(K){var N=r+"|\\w+|"+e+"|"+t+"|"+a+"|"+n;return"^"+K+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+r+")\\s*\\,\\s*("+r+")\\s*,\\s*("+N+")\\s*\\,\\s*("+N+")\\)$"},s=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];tr.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:o("mapData")},mapLayoutData:{mapping:!0,regex:o("mapLayoutData")},mapScratch:{mapping:!0,regex:o("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(K,N){switch(K.length){case 2:return N[0]!=="deg"&&N[0]!=="rad"&&N[1]!=="deg"&&N[1]!=="rad";case 1:return fe(K[0])||N[0]==="deg"||N[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*,\\s*("+r+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(K){var N=K.length;return N===1||N===2||N===4}}};var l={zeroNonZero:function(K,N){return(K==null||N==null)&&K!==N||K==0&&N!=0?!0:K!=0&&N==0},any:function(K,N){return K!=N},emptyNonEmpty:function(K,N){var $=rt(K),J=rt(N);return $&&!J||!$&&J}},u=tr.types,v=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],f=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],c=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],d=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],h=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],y=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],g=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:l.any,triggersBoundsOfParallelEdges:function(K,N,$){return K===N?!1:$.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],p=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],b=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],w=function(K,N){return N.value==="label"?-K.poolIndex():N.pfValue},E=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:w},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],C=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],x=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],S=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],k=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],A=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-outline-width",type:u.size},{name:"line-outline-color",type:u.color},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelEdges:function(K,N){return K===N?!1:K==="bezier"||N==="bezier"}},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],D=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],B=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],P=[];tr.pieBackgroundN=16,P.push({name:"pie-size",type:u.sizeMaybePercent});for(var R=1;R<=tr.pieBackgroundN;R++)P.push({name:"pie-"+R+"-background-color",type:u.color}),P.push({name:"pie-"+R+"-background-size",type:u.percent}),P.push({name:"pie-"+R+"-background-opacity",type:u.zeroOneNumber});var L=[],I=tr.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(re){I.forEach(function(K){var N=K+"-"+re.name,$=re.type,J=re.triggersBounds;L.push({name:N,type:$,triggersBounds:J})})},{});var M=tr.properties=[].concat(y,b,g,p,m,D,h,d,v,f,c,E,C,x,S,P,k,A,L,B),O=tr.propertyGroups={behavior:y,transition:b,visibility:g,overlay:p,underlay:m,ghost:D,commonLabel:h,labelDimensions:d,mainLabel:v,sourceLabel:f,targetLabel:c,nodeBody:E,nodeBorder:C,nodeOutline:x,backgroundImage:S,pie:P,compound:k,edgeLine:A,edgeArrow:L,core:B},_=tr.propertyGroupNames={},H=tr.propertyGroupKeys=Object.keys(O);H.forEach(function(re){_[re]=O[re].map(function(K){return K.name}),O[re].forEach(function(K){return K.groupKey=re})});var z=tr.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"}];tr.propertyNames=M.map(function(re){return re.name});for(var G=0;G<M.length;G++){var W=M[G];M[W.name]=W}for(var X=0;X<z.length;X++){var Z=z[X],Q=M[Z.pointsTo],ee={name:Z.name,alias:!0,pointsTo:Q};M.push(ee),M[Z.name]=ee}})();tr.getDefaultProperty=function(r){return this.getDefaultProperties()[r]};tr.getDefaultProperties=function(){var r=this._private;if(r.defaultProperties!=null)return r.defaultProperties;for(var e=ge({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var v=1;v<=tr.pieBackgroundN;v++){var f=u.name.replace("{{i}}",v),c=u.value;l[f]=c}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(l,u){return tr.arrowPrefixes.forEach(function(v){var f=v+"-"+u.name,c=u.value;l[f]=c}),l},{})),t={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,o=e[i],s=this.parse(i,o);t[i]=s}}return r.defaultProperties=t,r.defaultProperties};tr.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 On={};On.parse=function(r,e,t,a){var n=this;if(_e(e))return n.parseImplWarn(r,e,t,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,o=t?"t":"f",s=""+e,l=Xl(r,s,o,i),u=n.propCache=n.propCache||[],v;return(v=u[l])||(v=u[l]=n.parseImplWarn(r,e,t,a)),(t||a==="mapping")&&(v=Nr(v),v&&(v.value=Nr(v.value))),v};On.parseImplWarn=function(r,e,t,a){var n=this.parseImpl(r,e,t,a);return!n&&e!=null&&Re("The style property `".concat(r,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Re("The style value of `label` is deprecated for `"+n.name+"`"),n};On.parseImpl=function(r,e,t,a){var n=this;r=Io(r);var i=n.properties[r],o=e,s=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,r=i.name);var l=fe(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(t&&(e===""||e===null))return{name:r,value:e,bypass:!0,deleteBypass:!0};if(_e(e))return{name:r,value:e,strValue:"fn",mapped:s.fn,bypass:t};var v,f;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(t)return!1;var c=s.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(t||u.multiple)return!1;var d=s.mapData;if(!(u.color||u.number))return!1;var h=this.parse(r,f[4]);if(!h||h.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(h.pfValue===y.pfValue||h.strValue===y.strValue)return Re("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+h.strValue+"`"),this.parse(r,h.strValue);if(u.color){var g=h.value,p=y.value,m=g[0]===p[0]&&g[1]===p[1]&&g[2]===p[2]&&(g[3]===p[3]||(g[3]==null||g[3]===1)&&(p[3]==null||p[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:d,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:h.value,valueMax:y.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):Le(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var w=[],E=[],C=[],x="",S=!1,k=0;k<b.length;k++){var A=n.parse(r,b[k],t,"multiple");S=S||fe(A.value),w.push(A.value),C.push(A.pfValue!=null?A.pfValue:A.value),E.push(A.units),x+=(k>0?" ":"")+A.strValue}return u.validate&&!u.validate(w,E)?null:u.singleEnum&&S?w.length===1&&fe(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:C,strValue:x,bypass:t,units:E}}var D=function(){for(var K=0;K<u.enums.length;K++){var N=u.enums[K];if(N===e)return{name:r,value:e,strValue:""+e,bypass:t}}return null};if(u.number){var B,P="px";if(u.units&&(B=u.units),u.implicitUnits&&(P=u.implicitUnits),!u.unitless)if(l){var R="px|em"+(u.allowPercent?"|\\%":"");B&&(R=B);var L=e.match("^("+$e+")("+R+")?$");L&&(e=L[1],B=L[2]||P)}else(!B||u.implicitUnits)&&(B=P);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=o,D();if(u.integer&&!Xf(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var I={name:r,value:e,strValue:""+e+(B||""),units:B,bypass:t};return u.unitless||B!=="px"&&B!=="em"?I.pfValue=e:I.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(I.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(I.pfValue=B==="rad"?e:th(e)),B==="%"&&(I.pfValue=e/100),I}else if(u.propList){var M=[],O=""+e;if(O!=="none"){for(var _=O.split(/\s*,\s*|\s+/),H=0;H<_.length;H++){var z=_[H].trim();n.properties[z]?M.push(z):Re("`"+z+"` is not a valid property name")}if(M.length===0)return null}return{name:r,value:M,strValue:M.length===0?"none":M.join(" "),bypass:t}}else if(u.color){var G=Gl(e);return G?{name:r,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:t}:null}else if(u.regex||u.regexes){if(u.enums){var W=D();if(W)return W}for(var X=u.regexes?u.regexes:[u.regex],Z=0;Z<X.length;Z++){var Q=new RegExp(X[Z]),ee=Q.exec(e);if(ee)return{name:r,value:u.singleRegexMatchValue?ee[1]:ee,strValue:""+e,bypass:t}}return null}else return u.string?{name:r,value:""+e,strValue:""+e,bypass:t}:u.enums?D():null};var er=function(e){if(!(this instanceof er))return new er(e);if(!Lo(e)){Ve("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},ur=er.prototype;ur.instanceString=function(){return"style"};ur.clear=function(){for(var r=this._private,e=r.cy,t=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,r.contextStyles={},r.propDiffs={},this.cleanElements(t,!0),t.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};ur.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};ur.core=function(r){return this._private.coreStyle[r]||this.getDefaultProperty(r)};ur.selector=function(r){var e=r==="core"?null:new nt(r),t=this.length++;return this[t]={selector:e,properties:[],mappedProperties:[],index:t},this};ur.css=function(){var r=this,e=arguments;if(e.length===1)for(var t=e[0],a=0;a<r.properties.length;a++){var n=r.properties[a],i=t[n.name];i===void 0&&(i=t[xn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};ur.style=ur.css;ur.cssRule=function(r,e){var t=this.parse(r,e);if(t){var a=this.length-1;this[a].properties.push(t),this[a].properties[t.name]=t,t.name.match(/pie-(\d+)-background-size/)&&t.value&&(this._private.hasPie=!0),t.mapped&&this[a].mappedProperties.push(t);var n=!this[a].selector;n&&(this._private.coreStyle[t.name]=t)}return this};ur.append=function(r){return ql(r)?r.appendToStyle(this):Le(r)?this.appendFromJson(r):fe(r)&&this.appendFromString(r),this};er.fromJson=function(r,e){var t=new er(r);return t.fromJson(e),t};er.fromString=function(r,e){return new er(r).fromString(e)};[rr,Ra,Yo,zr,In,Xo,tr,On].forEach(function(r){ge(ur,r)});er.types=ur.types;er.properties=ur.properties;er.propertyGroups=ur.propertyGroups;er.propertyGroupNames=ur.propertyGroupNames;er.propertyGroupKeys=ur.propertyGroupKeys;var np={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return ql(e)?t.style=e.generateStyle(this):Le(e)?t.style=er.fromJson(this,e):fe(e)?t.style=er.fromString(this,e):t.style=er(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},ip="single",wt={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=ip),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,a,n,i,o,s;switch(e.length){case 0:return t;case 1:if(fe(e[0]))return a=e[0],t[a];if(ke(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,s=i.y,ae(o)&&(t.x=o),ae(s)&&(t.y=s),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ae(n)&&(t[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var a=arguments,n=this._private.pan,i,o,s,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:ke(e)&&(s=a[0],l=s.x,u=s.y,ae(l)&&(n.x+=l),ae(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&ae(o)&&(n[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var a=this.getFitViewport(e,t);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ae(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(fe(e)){var n=e;e=this.$(n)}else if(Jf(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else br(e)||(e=this.mutableElements());if(!(br(e)&&e.empty())){a=a||e.boundingBox();var o=this.width(),s=this.height(),l;if(t=ae(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((o-2*t)/a.w,(s-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(o-l*(a.x1+a.x2))/2,y:(s-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,t){var a=this._private;if(t==null){var n=e;e=n.min,t=n.max}return ae(e)&&ae(t)&&e<=t?(a.minZoom=e,a.maxZoom=t):ae(e)&&t===void 0&&e<=a.maxZoom?a.minZoom=e:ae(t)&&e===void 0&&t>=a.minZoom&&(a.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,a=t.pan,n=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),ae(e)?o=e:ke(e)&&(o=e.level,e.position!=null?i=Tn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,s||!ae(o)||o===n||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var l=a,u=n,v=o,f={x:-v/u*(i.x-l.x)+i.x,y:-v/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:v,pan:f}}else return{zoomed:!0,panned:!1,zoom:o,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),a=this._private;return t==null||!t.zoomed?this:(a.zoom=t.zoom,t.panned&&(a.pan.x=t.pan.x,a.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,a=!0,n=!0,i=[],o=!1,s=!1;if(!e)return this;if(ae(e.zoom)||(a=!1),ke(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ae(u.x)&&(t.pan.x=u.x,s=!1),ae(u.y)&&(t.pan.y=u.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(fe(e)){var a=e;e=this.mutableElements().filter(a)}else br(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(n.x1+n.x2))/2,y:(o-t*(n.y1+n.y2))/2};return s}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};wt.centre=wt.center;wt.autolockNodes=wt.autolock;wt.autoungrabifyNodes=wt.autoungrabify;var wa={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};wa.attr=wa.data;wa.removeAttr=wa.removeData;var xa=function(e){var t=this;e=ge({},e);var a=e.container;a&&!un(a)&&un(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var o=Ke!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=ge({name:o?"grid":"null"},s.layout),s.renderer=ge({name:o?"canvas":"null"},s.renderer);var l=function(h,y,g){return y!==void 0?y:g!==void 0?g:h},u=this._private={container:a,ready:!1,options:s,elements:new nr(this),listeners:[],aniEles:new nr(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ae(s.zoom)?s.zoom:1,pan:{x:ke(s.pan)&&ae(s.pan.x)?s.pan.x:0,y:ke(s.pan)&&ae(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var v=function(h,y){var g=h.some(jf);if(g)return Ut.all(h).then(y);y(h)};u.styleEnabled&&t.setStyle([]);var f=ge({},s,s.renderer);t.initRenderer(f);var c=function(h,y,g){t.notifications(!1);var p=t.mutableElements();p.length>0&&p.remove(),h!=null&&(ke(h)||Le(h))&&t.add(h),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var m=ge({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([s.style,s.elements],function(d){var h=d[0],y=d[1];u.styleEnabled&&t.style().append(h),c(y,function(){t.startAnimationLoop(),u.ready=!0,_e(s.ready)&&t.on("ready",s.ready);for(var g=0;g<i.length;g++){var p=i[g];t.on("ready",p)}n&&(n.readies=[]),t.emit("ready")},s.done)})},gn=xa.prototype;ge(gn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return Ke;var t=this._private.container.ownerDocument;return t===void 0||t==null?Ke:t.defaultView||Ke},mount:function(e){if(e!=null){var t=this,a=t._private,n=a.options;return!un(e)&&un(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),a.container=e,a.styleEnabled=!0,t.invalidateSize(),t.initRenderer(ge({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),t.startAnimationLoop(),t.style(n.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Nr(this._private.options)},json:function(e){var t=this,a=t._private,n=t.mutableElements(),i=function(w){return t.getElementById(w.id())};if(ke(e)){if(t.startBatch(),e.elements){var o={},s=function(w,E){for(var C=[],x=[],S=0;S<w.length;S++){var k=w[S];if(!k.data.id){Re("cy.json() cannot handle elements without an ID attribute");continue}var A=""+k.data.id,D=t.getElementById(A);o[A]=!0,D.length!==0?x.push({ele:D,json:k}):(E&&(k.group=E),C.push(k))}t.add(C);for(var B=0;B<x.length;B++){var P=x[B],R=P.ele,L=P.json;R.json(L)}};if(Le(e.elements))s(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var v=l[u],f=e.elements[v];Le(f)&&s(f,v)}var c=t.collection();n.filter(function(b){return!o[b.id()]}).forEach(function(b){b.isParent()?c.merge(b):b.remove()}),c.forEach(function(b){return b.children().move({parent:null})}),c.forEach(function(b){return i(b).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var y=d[h];e[y]!=null&&t[y](e[y])}return t.endBatch(),this}else{var g=!!e,p={};g?p.elements=this.elements().map(function(b){return b.json()}):(p.elements={},n.forEach(function(b){var w=b.group();p.elements[w]||(p.elements[w]=[]),p.elements[w].push(b.json())})),this._private.styleEnabled&&(p.style=t.style().json()),p.data=Nr(t.data());var m=a.options;return p.zoomingEnabled=a.zoomingEnabled,p.userZoomingEnabled=a.userZoomingEnabled,p.zoom=a.zoom,p.minZoom=a.minZoom,p.maxZoom=a.maxZoom,p.panningEnabled=a.panningEnabled,p.userPanningEnabled=a.userPanningEnabled,p.pan=Nr(a.pan),p.boxSelectionEnabled=a.boxSelectionEnabled,p.renderer=Nr(m.renderer),p.hideEdgesOnViewport=m.hideEdgesOnViewport,p.textureOnViewport=m.textureOnViewport,p.wheelSensitivity=m.wheelSensitivity,p.motionBlur=m.motionBlur,p.multiClickDebounceTime=m.multiClickDebounceTime,p}}});gn.$id=gn.getElementById;[Yg,jg,qv,Eo,tn,rp,Co,an,np,wt,wa].forEach(function(r){ge(gn,r)});var op={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},sp={maximal:!1,acyclic:!1},kt=function(e){return e.scratch("breadthfirst")},ol=function(e,t){return e.scratch("breadthfirst",t)};function Vv(r){this.options=ge({},op,sp,r)}Vv.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=t.nodes().filter(function(oe){return oe.isChildless()}),n=t,i=r.directed,o=r.acyclic||r.maximal||r.maximalAdjustments>0,s=!!r.boundingBox,l=e.extent(),u=pr(s?r.boundingBox:{x1:l.x1,y1:l.y1,w:l.w,h:l.h}),v;if(br(r.roots))v=r.roots;else if(Le(r.roots)){for(var f=[],c=0;c<r.roots.length;c++){var d=r.roots[c],h=e.getElementById(d);f.push(h)}v=e.collection(f)}else if(fe(r.roots))v=e.$(r.roots);else if(i)v=a.roots();else{var y=t.components();v=e.collection();for(var g=function(){var ue=y[p],he=ue.maxDegree(!1),ye=ue.filter(function(de){return de.degree(!1)===he});v=v.add(ye)},p=0;p<y.length;p++)g()}var m=[],b={},w=function(ue,he){m[he]==null&&(m[he]=[]);var ye=m[he].length;m[he].push(ue),ol(ue,{index:ye,depth:he})},E=function(ue,he){var ye=kt(ue),de=ye.depth,me=ye.index;m[de][me]=null,ue.isChildless()&&w(ue,he)};n.bfs({roots:v,directed:r.directed,visit:function(ue,he,ye,de,me){var Ce=ue[0],Se=Ce.id();Ce.isChildless()&&w(Ce,me),b[Se]=!0}});for(var C=[],x=0;x<a.length;x++){var S=a[x];b[S.id()]||C.push(S)}var k=function(ue){for(var he=m[ue],ye=0;ye<he.length;ye++){var de=he[ye];if(de==null){he.splice(ye,1),ye--;continue}ol(de,{depth:ue,index:ye})}},A=function(ue,he){for(var ye=kt(ue),de=ue.incomers().filter(function(U){return U.isNode()&&t.has(U)}),me=-1,Ce=ue.id(),Se=0;Se<de.length;Se++){var j=de[Se],T=kt(j);me=Math.max(me,T.depth)}if(ye.depth<=me){if(!r.acyclic&&he[Ce])return null;var q=me+1;return E(ue,q),he[Ce]=q,!0}return!1};if(i&&o){var D=[],B={},P=function(ue){return D.push(ue)},R=function(){return D.shift()};for(a.forEach(function(oe){return D.push(oe)});D.length>0;){var L=R(),I=A(L,B);if(I)L.outgoers().filter(function(oe){return oe.isNode()&&t.has(oe)}).forEach(P);else if(I===null){Re("Detected double maximal shift for node `"+L.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var M=0;if(r.avoidOverlap)for(var O=0;O<a.length;O++){var _=a[O],H=_.layoutDimensions(r),z=H.w,G=H.h;M=Math.max(M,z,G)}var W={},X=function(ue){if(W[ue.id()])return W[ue.id()];for(var he=kt(ue).depth,ye=ue.neighborhood(),de=0,me=0,Ce=0;Ce<ye.length;Ce++){var Se=ye[Ce];if(!(Se.isEdge()||Se.isParent()||!a.has(Se))){var j=kt(Se);if(j!=null){var T=j.index,q=j.depth;if(!(T==null||q==null)){var U=m[q].length;q<he&&(de+=T/U,me++)}}}}return me=Math.max(1,me),de=de/me,me===0&&(de=0),W[ue.id()]=de,de},Z=function(ue,he){var ye=X(ue),de=X(he),me=ye-de;return me===0?_l(ue.id(),he.id()):me};r.depthSort!==void 0&&(Z=r.depthSort);for(var Q=m.length,ee=0;ee<Q;ee++)m[ee].sort(Z),k(ee);for(var re=[],K=0;K<C.length;K++)re.push(C[K]);var N=function(){for(var ue=0;ue<Q;ue++)k(ue)};re.length&&(m.unshift(re),Q=m.length,N());for(var $=0,J=0;J<Q;J++)$=Math.max(m[J].length,$);var te={x:u.x1+u.w/2,y:u.y1+u.h/2},le=a.reduce(function(oe,ue){return function(he){return{w:oe.w===-1?he.w:(oe.w+he.w)/2,h:oe.h===-1?he.h:(oe.h+he.h)/2}}(ue.boundingBox({includeLabels:r.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),xe=Math.max(Q===1?0:s?(u.h-r.padding*2-le.h)/(Q-1):(u.h-r.padding*2-le.h)/(Q+1),M),Ie=m.reduce(function(oe,ue){return Math.max(oe,ue.length)},0),Ae=function(ue){var he=kt(ue),ye=he.depth,de=he.index;if(r.circle){var me=Math.min(u.w/2/Q,u.h/2/Q);me=Math.max(me,M);var Ce=me*ye+me-(Q>0&&m[0].length<=3?me/2:0),Se=2*Math.PI/m[ye].length*de;return ye===0&&m[0].length===1&&(Ce=1),{x:te.x+Ce*Math.cos(Se),y:te.y+Ce*Math.sin(Se)}}else{var j=m[ye].length,T=Math.max(j===1?0:s?(u.w-r.padding*2-le.w)/((r.grid?Ie:j)-1):(u.w-r.padding*2-le.w)/((r.grid?Ie:j)+1),M),q={x:te.x+(de+1-(j+1)/2)*T,y:te.y+(ye+1-(Q+1)/2)*xe};return q}};return t.nodes().layoutPositions(this,r,Ae),this};var up={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function _v(r){this.options=ge({},up,r)}_v.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=pr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),v,f=0,c=0;c<i.length;c++){var d=i[c],h=d.layoutDimensions(e),y=h.w,g=h.h;f=Math.max(f,y,g)}if(ae(e.radius)?v=e.radius:i.length<=1?v=0:v=Math.min(o.h,o.w)/2-f,i.length>1&&e.avoidOverlap){f*=1.75;var p=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(p*p+m*m));v=Math.max(b,v)}var w=function(C,x){var S=e.startAngle+x*u*(n?1:-1),k=v*Math.cos(S),A=v*Math.sin(S),D={x:s.x+k,y:s.y+A};return D};return a.nodes().layoutPositions(this,e,w),this};var lp={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Gv(r){this.options=ge({},lp,r)}Gv.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),o=pr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,v=0;v<i.length;v++){var f=i[v],c=void 0;c=e.concentric(f),l.push({value:c,node:f}),f._private.scratch.concentric=c}i.updateStyle();for(var d=0;d<i.length;d++){var h=i[d],y=h.layoutDimensions(e);u=Math.max(u,y.w,y.h)}l.sort(function(le,xe){return xe.value-le.value});for(var g=e.levelWidth(i),p=[[]],m=p[0],b=0;b<l.length;b++){var w=l[b];if(m.length>0){var E=Math.abs(m[0].value-w.value);E>=g&&(m=[],p.push(m))}m.push(w)}var C=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=p.length>0&&p[0].length>1,S=Math.min(o.w,o.h)/2-C,k=S/(p.length+x?1:0);C=Math.min(C,k)}for(var A=0,D=0;D<p.length;D++){var B=p[D],P=e.sweep===void 0?2*Math.PI-2*Math.PI/B.length:e.sweep,R=B.dTheta=P/Math.max(1,B.length-1);if(B.length>1&&e.avoidOverlap){var L=Math.cos(R)-Math.cos(0),I=Math.sin(R)-Math.sin(0),M=Math.sqrt(C*C/(L*L+I*I));A=Math.max(M,A)}B.r=A,A+=C}if(e.equidistant){for(var O=0,_=0,H=0;H<p.length;H++){var z=p[H],G=z.r-_;O=Math.max(O,G)}_=0;for(var W=0;W<p.length;W++){var X=p[W];W===0&&(_=X.r),X.r=_,_+=O}}for(var Z={},Q=0;Q<p.length;Q++)for(var ee=p[Q],re=ee.dTheta,K=ee.r,N=0;N<ee.length;N++){var $=ee[N],J=e.startAngle+(t?1:-1)*re*N,te={x:s.x+K*Math.cos(J),y:s.y+K*Math.sin(J)};Z[$.node.id()]=te}return n.nodes().layoutPositions(this,e,function(le){var xe=le.id();return Z[xe]}),this};var oo,vp={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 Nn(r){this.options=ge({},vp,r),this.options.layout=this;var e=this.options.eles.nodes(),t=this.options.eles.edges(),a=t.filter(function(n){var i=n.source().data("id"),o=n.target().data("id"),s=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===o});return!s||!l});this.options.eles=this.options.eles.not(a)}Nn.prototype.run=function(){var r=this.options,e=r.cy,t=this;t.stopped=!1,(r.animate===!0||r.animate===!1)&&t.emit({type:"layoutstart",layout:t}),r.debug===!0?oo=!0:oo=!1;var a=fp(e,t,r);oo&&hp(a),r.randomize&&dp(a);var n=$r(),i=function(){gp(a,e,r),r.fit===!0&&e.fit(r.padding)},o=function(c){return!(t.stopped||c>=r.numIter||(pp(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature<r.minTemp))},s=function(){if(r.animate===!0||r.animate===!1)i(),t.one("layoutstop",r.stop),t.emit({type:"layoutstop",layout:t});else{var c=r.eles.nodes(),d=Kv(a,r,c);c.layoutPositions(t,r,d)}},l=0,u=!0;if(r.animate===!0){var v=function(){for(var c=0;u&&c<r.refresh;)u=o(l),l++,c++;if(!u)ul(a,r),s();else{var d=$r();d-n>=r.animationThreshold&&i(),ln(v)}};v()}else{for(;u;)u=o(l),l++;ul(a,r),s()}return this};Nn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Nn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var fp=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=pr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=a.eles.components(),u={},v=0;v<l.length;v++)for(var f=l[v],c=0;c<f.length;c++){var d=f[c];u[d.id()]=v}for(var v=0;v<s.nodeSize;v++){var h=i[v],y=h.layoutDimensions(a),g={};g.isLocked=h.locked(),g.id=h.data("id"),g.parentId=h.data("parent"),g.cmptId=u[h.id()],g.children=[],g.positionX=h.position("x"),g.positionY=h.position("y"),g.offsetX=0,g.offsetY=0,g.height=y.w,g.width=y.h,g.maxX=g.positionX+g.width/2,g.minX=g.positionX-g.width/2,g.maxY=g.positionY+g.height/2,g.minY=g.positionY-g.height/2,g.padLeft=parseFloat(h.style("padding")),g.padRight=parseFloat(h.style("padding")),g.padTop=parseFloat(h.style("padding")),g.padBottom=parseFloat(h.style("padding")),g.nodeRepulsion=_e(a.nodeRepulsion)?a.nodeRepulsion(h):a.nodeRepulsion,s.layoutNodes.push(g),s.idToIndex[g.id]=v}for(var p=[],m=0,b=-1,w=[],v=0;v<s.nodeSize;v++){var h=s.layoutNodes[v],E=h.parentId;E!=null?s.layoutNodes[s.idToIndex[E]].children.push(h.id):(p[++b]=h.id,w.push(h.id))}for(s.graphSet.push(w);m<=b;){var C=p[m++],x=s.idToIndex[C],d=s.layoutNodes[x],S=d.children;if(S.length>0){s.graphSet.push(S);for(var v=0;v<S.length;v++)p[++b]=S[v]}}for(var v=0;v<s.graphSet.length;v++)for(var k=s.graphSet[v],c=0;c<k.length;c++){var A=s.idToIndex[k[c]];s.indexToGraph[A]=v}for(var v=0;v<s.edgeSize;v++){var D=n[v],B={};B.id=D.data("id"),B.sourceId=D.data("source"),B.targetId=D.data("target");var P=_e(a.idealEdgeLength)?a.idealEdgeLength(D):a.idealEdgeLength,R=_e(a.edgeElasticity)?a.edgeElasticity(D):a.edgeElasticity,L=s.idToIndex[B.sourceId],I=s.idToIndex[B.targetId],M=s.indexToGraph[L],O=s.indexToGraph[I];if(M!=O){for(var _=cp(B.sourceId,B.targetId,s),H=s.graphSet[_],z=0,g=s.layoutNodes[L];H.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],z++;for(g=s.layoutNodes[I];H.indexOf(g.id)===-1;)g=s.layoutNodes[s.idToIndex[g.parentId]],z++;P*=z*a.nestingFactor}B.idealLength=P,B.elasticity=R,s.layoutEdges.push(B)}return s},cp=function(e,t,a){var n=Hv(e,t,0,a);return 2>n.count?0:n.graph},Hv=function(e,t,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(t))return{count:2,graph:a};for(var o=0,s=0;s<i.length;s++){var l=i[s],u=n.idToIndex[l],v=n.layoutNodes[u].children;if(v.length!==0){var f=n.indexToGraph[n.idToIndex[v[0]]],c=Hv(e,t,f,n);if(c.count!==0)if(c.count===1){if(o++,o===2)break}else return c}}return{count:o,graph:a}},hp,dp=function(e,t){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*a,o.positionY=Math.random()*n)}},Kv=function(e,t,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(a.forEach(function(o){var s=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,s.positionX),i.x2=Math.max(i.x2,s.positionX),i.y1=Math.min(i.y1,s.positionY),i.y2=Math.max(i.y2,s.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,s){var l=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var u=(l.positionX-i.x1)/i.w,v=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+v*n.h}}else return{x:l.positionX,y:l.positionY}}},gp=function(e,t,a){var n=a.layout,i=a.eles.nodes(),o=Kv(e,a,i);i.positions(o),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},pp=function(e,t,a){yp(e,t),wp(e),xp(e,t),Ep(e),Cp(e)},yp=function(e,t){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,o=0;o<i;o++)for(var s=e.layoutNodes[e.idToIndex[n[o]]],l=o+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];mp(s,u,e,t)}},sl=function(e){return-1+2*e*Math.random()},mp=function(e,t,a,n){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!a.isCompound)){var s=t.positionX-e.positionX,l=t.positionY-e.positionY,u=1;s===0&&l===0&&(s=sl(u),l=sl(u));var v=bp(e,t,s,l);if(v>0)var f=n.nodeOverlap*v,c=Math.sqrt(s*s+l*l),d=f*s/c,h=f*l/c;else var y=pn(e,s,l),g=pn(t,-1*s,-1*l),p=g.x-y.x,m=g.y-y.y,b=p*p+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,d=f*p/c,h=f*m/c;e.isLocked||(e.offsetX-=d,e.offsetY-=h),t.isLocked||(t.offsetX+=d,t.offsetY+=h)}},bp=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},pn=function(e,t,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,l=a/t,u=o/s,v={};return t===0&&0<a||t===0&&0>a?(v.x=n,v.y=i+o/2,v):0<t&&-1*u<=l&&l<=u?(v.x=n+s/2,v.y=i+s*a/2/t,v):0>t&&-1*u<=l&&l<=u?(v.x=n-s/2,v.y=i-s*a/2/t,v):0<a&&(l<=-1*u||l>=u)?(v.x=n+o*t/2/a,v.y=i+o/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-o*t/2/a,v.y=i-o/2),v)},wp=function(e,t){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],o=e.layoutNodes[i],s=e.idToIndex[n.targetId],l=e.layoutNodes[s],u=l.positionX-o.positionX,v=l.positionY-o.positionY;if(!(u===0&&v===0)){var f=pn(o,u,v),c=pn(l,-1*u,-1*v),d=c.x-f.x,h=c.y-f.y,y=Math.sqrt(d*d+h*h),g=Math.pow(n.idealLength-y,2)/n.elasticity;if(y!==0)var p=g*d/y,m=g*h/y;else var p=0,m=0;o.isLocked||(o.offsetX+=p,o.offsetY+=m),l.isLocked||(l.offsetX-=p,l.offsetY-=m)}}},xp=function(e,t){if(t.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],o=i.length;if(n===0)var s=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],v=e.layoutNodes[e.idToIndex[u.parentId]],s=v.positionX,l=v.positionY;for(var f=0;f<o;f++){var c=e.layoutNodes[e.idToIndex[i[f]]];if(!c.isLocked){var d=s-c.positionX,h=l-c.positionY,y=Math.sqrt(d*d+h*h);if(y>a){var g=t.gravity*d/y,p=t.gravity*h/y;c.offsetX+=g,c.offsetY+=p}}}}},Ep=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],l=e.layoutNodes[s],u=l.children;if(0<u.length&&!l.isLocked){for(var v=l.offsetX,f=l.offsetY,c=0;c<u.length;c++){var d=e.layoutNodes[e.idToIndex[u[c]]];d.offsetX+=v,d.offsetY+=f,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},Cp=function(e,t){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Tp(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,$v(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},Tp=function(e,t,a){var n=Math.sqrt(e*e+t*t);if(n>a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},$v=function(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return $v(n,t)}},ul=function(e,t){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var o=a[i],s=o.cmptId,l=n[s]=n[s]||[];l.push(o)}for(var u=0,i=0;i<n.length;i++){var v=n[i];if(v){v.x1=1/0,v.x2=-1/0,v.y1=1/0,v.y2=-1/0;for(var f=0;f<v.length;f++){var c=v[f];v.x1=Math.min(v.x1,c.positionX-c.width/2),v.x2=Math.max(v.x2,c.positionX+c.width/2),v.y1=Math.min(v.y1,c.positionY-c.height/2),v.y2=Math.max(v.y2,c.positionY+c.height/2)}v.w=v.x2-v.x1,v.h=v.y2-v.y1,u+=v.w*v.h}}n.sort(function(m,b){return b.w*b.h-m.w*m.h});for(var d=0,h=0,y=0,g=0,p=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var v=n[i];if(v){for(var f=0;f<v.length;f++){var c=v[f];c.isLocked||(c.positionX+=d-v.x1,c.positionY+=h-v.y1)}d+=v.w+t.componentSpacing,y+=v.w+t.componentSpacing,g=Math.max(g,v.h),y>p&&(h+=g+t.componentSpacing,d=0,y=0,g=0)}}},Sp={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 Uv(r){this.options=ge({},Sp,r)}Uv.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=pr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),v=function(X){if(X==null)return Math.min(l,u);var Z=Math.min(l,u);Z==l?l=X:u=X},f=function(X){if(X==null)return Math.max(l,u);var Z=Math.max(l,u);Z==l?l=X:u=X},c=e.rows,d=e.cols!=null?e.cols:e.columns;if(c!=null&&d!=null)l=c,u=d;else if(c!=null&&d==null)l=c,u=Math.ceil(o/l);else if(c==null&&d!=null)u=d,l=Math.ceil(o/u);else if(u*l>o){var h=v(),y=f();(h-1)*y>=o?v(h-1):(y-1)*h>=o&&f(y-1)}else for(;u*l<o;){var g=v(),p=f();(p+1)*g>=o?f(p+1):v(g+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w<n.length;w++){var E=n[w],C=E._private.position;(C.x==null||C.y==null)&&(C.x=0,C.y=0);var x=E.layoutDimensions(e),S=e.avoidOverlapPadding,k=x.w+S,A=x.h+S;m=Math.max(m,k),b=Math.max(b,A)}for(var D={},B=function(X,Z){return!!D["c-"+X+"-"+Z]},P=function(X,Z){D["c-"+X+"-"+Z]=!0},R=0,L=0,I=function(){L++,L>=u&&(L=0,R++)},M={},O=0;O<n.length;O++){var _=n[O],H=e.position(_);if(H&&(H.row!==void 0||H.col!==void 0)){var z={row:H.row,col:H.col};if(z.col===void 0)for(z.col=0;B(z.row,z.col);)z.col++;else if(z.row===void 0)for(z.row=0;B(z.row,z.col);)z.row++;M[_.id()]=z,P(z.row,z.col)}}var G=function(X,Z){var Q,ee;if(X.locked()||X.isParent())return!1;var re=M[X.id()];if(re)Q=re.col*m+m/2+i.x1,ee=re.row*b+b/2+i.y1;else{for(;B(R,L);)I();Q=L*m+m/2+i.x1,ee=R*b+b/2+i.y1,P(R,L),I()}return{x:Q,y:ee}};n.layoutPositions(this,e,G)}return this};var Dp={ready:function(){},stop:function(){}};function Zo(r){this.options=ge({},Dp,r)}Zo.prototype.run=function(){var r=this.options,e=r.eles,t=this;return r.cy,t.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),t.one("layoutready",r.ready),t.emit("layoutready"),t.one("layoutstop",r.stop),t.emit("layoutstop"),this};Zo.prototype.stop=function(){return this};var kp={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 Wv(r){this.options=ge({},kp,r)}Wv.prototype.run=function(){var r=this.options,e=r.eles,t=e.nodes(),a=_e(r.positions);function n(i){if(r.positions==null)return Qc(i.position());if(a)return r.positions(i);var o=r.positions[i._private.data.id];return o??null}return t.layoutPositions(this,r,function(i,o){var s=n(i);return i.locked()||s==null?!1:s}),this};var Pp={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 Yv(r){this.options=ge({},Pp,r)}Yv.prototype.run=function(){var r=this.options,e=r.cy,t=r.eles,a=pr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(o,s){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return t.nodes().layoutPositions(this,r,n),this};var Ap=[{name:"breadthfirst",impl:Vv},{name:"circle",impl:_v},{name:"concentric",impl:Gv},{name:"cose",impl:Nn},{name:"grid",impl:Uv},{name:"null",impl:Zo},{name:"preset",impl:Wv},{name:"random",impl:Yv}];function Xv(r){this.options=r,this.notifications=0}var ll=function(){},vl=function(){throw new Error("A headless instance can not render images")};Xv.prototype={recalculateRenderedStyle:ll,notify:function(){this.notifications++},init:ll,isHeadless:function(){return!0},png:vl,jpg:vl};var Qo={};Qo.arrowShapeWidth=.3;Qo.registerArrowShapes=function(){var r=this.arrowShapes={},e=this,t=function(u,v,f,c,d,h,y){var g=d.x-f/2-y,p=d.x+f/2+y,m=d.y-f/2-y,b=d.y+f/2+y,w=g<=u&&u<=p&&m<=v&&v<=b;return w},a=function(u,v,f,c,d){var h=u*Math.cos(c)-v*Math.sin(c),y=u*Math.sin(c)+v*Math.cos(c),g=h*f,p=y*f,m=g+d.x,b=p+d.y;return{x:m,y:b}},n=function(u,v,f,c){for(var d=[],h=0;h<u.length;h+=2){var y=u[h],g=u[h+1];d.push(a(y,g,v,f,c))}return d},i=function(u){for(var v=[],f=0;f<u.length;f++){var c=u[f];v.push(c.x,c.y)}return v},o=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},s=function(u,v){fe(v)&&(v=r[v]),r[u]=ge({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,d,h,y,g,p){var m=i(n(this.points,h+2*p,y,g)),b=gr(c,d,m);return b},roughCollide:t,draw:function(c,d,h,y){var g=n(this.points,d,h,y);e.arrowShapeImpl("polygon")(c,g)},spacing:function(c){return 0},gap:o},v)};s("none",{collide:vn,roughCollide:vn,draw:zo,spacing:Ds,gap:Ds}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:r.triangle.points,controlPoint:[0,-.15],roughCollide:t,draw:function(u,v,f,c,d){var h=n(this.points,v,f,c),y=this.controlPoint,g=a(y[0],y[1],v,f,c);e.arrowShapeImpl(this.name)(u,h,g)},gap:function(u){return o(u)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,v,f,c,d,h,y){var g=i(n(this.points,f+2*y,c,d)),p=i(n(this.pointsTee,f+2*y,c,d)),m=gr(u,v,g)||gr(u,v,p);return m},draw:function(u,v,f,c,d){var h=n(this.points,v,f,c),y=n(this.pointsTee,v,f,c);e.arrowShapeImpl(this.name)(u,h,y)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,v,f,c,d,h,y){var g=d,p=Math.pow(g.x-u,2)+Math.pow(g.y-v,2)<=Math.pow((f+2*y)*this.radius,2),m=i(n(this.points,f+2*y,c,d));return gr(u,v,m)||p},draw:function(u,v,f,c,d){var h=n(this.pointsTr,v,f,c);e.arrowShapeImpl(this.name)(u,h,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,v){var f=this.baseCrossLinePts.slice(),c=v/u,d=3,h=5;return f[d]=f[d]-c,f[h]=f[h]-c,f},collide:function(u,v,f,c,d,h,y){var g=i(n(this.points,f+2*y,c,d)),p=i(n(this.crossLinePts(f,h),f+2*y,c,d)),m=gr(u,v,g)||gr(u,v,p);return m},draw:function(u,v,f,c,d){var h=n(this.points,v,f,c),y=n(this.crossLinePts(v,d),v,f,c);e.arrowShapeImpl(this.name)(u,h,y)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return o(u)*.525}}),s("circle",{radius:.15,collide:function(u,v,f,c,d,h,y){var g=d,p=Math.pow(g.x-u,2)+Math.pow(g.y-v,2)<=Math.pow((f+2*y)*this.radius,2);return p},draw:function(u,v,f,c,d){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*v)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var Et={};Et.projectIntoViewport=function(r,e){var t=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],o=a[4],s=t.pan(),l=t.zoom(),u=((r-n)/o-s.x)/l,v=((e-i)/o-s.y)/l;return[u,v]};Et.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var r=this.container,e=r.getBoundingClientRect(),t=this.cy.window().getComputedStyle(r),a=function(p){return parseFloat(t.getPropertyValue(p))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},o=r.clientWidth,s=r.clientHeight,l=n.left+n.right,u=n.top+n.bottom,v=i.left+i.right,f=e.width/(o+v),c=o-l,d=s-u,h=e.left+n.left+i.left,y=e.top+n.top+i.top;return this.containerBB=[h,y,c,d,f]};Et.invalidateContainerClientCoordsCache=function(){this.containerBB=null};Et.findNearestElement=function(r,e,t,a){return this.findNearestElements(r,e,t,a)[0]};Et.findNearestElements=function(r,e,t,a){var n=this,i=this,o=i.getCachedZSortedEles(),s=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),v=(a?24:8)/l,f=(a?8:2)/l,c=(a?8:2)/l,d=1/0,h,y;t&&(o=o.interactive);function g(x,S){if(x.isNode()){if(y)return;y=x,s.push(x)}if(x.isEdge()&&(S==null||S<d))if(h){if(h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&h.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var k=0;k<s.length;k++)if(s[k].isEdge()){s[k]=x,h=x,d=S??d;break}}}else s.push(x),h=x,d=S??d}function p(x){var S=x.outerWidth()+2*f,k=x.outerHeight()+2*f,A=S/2,D=k/2,B=x.position(),P=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,R=x._private.rscratch;if(B.x-A<=r&&r<=B.x+A&&B.y-D<=e&&e<=B.y+D){var L=i.nodeShapes[n.getNodeShape(x)];if(L.checkPoint(r,e,0,S,k,B.x,B.y,P,R))return g(x,0),!0}}function m(x){var S=x._private,k=S.rscratch,A=x.pstyle("width").pfValue,D=x.pstyle("arrow-scale").value,B=A/2+v,P=B*B,R=B*2,O=S.source,_=S.target,L;if(k.edgeType==="segments"||k.edgeType==="straight"||k.edgeType==="haystack"){for(var I=k.allpts,M=0;M+3<I.length;M+=2)if(vh(r,e,I[M],I[M+1],I[M+2],I[M+3],R)&&P>(L=gh(r,e,I[M],I[M+1],I[M+2],I[M+3])))return g(x,L),!0}else if(k.edgeType==="bezier"||k.edgeType==="multibezier"||k.edgeType==="self"||k.edgeType==="compound"){for(var I=k.allpts,M=0;M+5<k.allpts.length;M+=4)if(fh(r,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5],R)&&P>(L=dh(r,e,I[M],I[M+1],I[M+2],I[M+3],I[M+4],I[M+5])))return g(x,L),!0}for(var O=O||S.source,_=_||S.target,H=n.getArrowWidth(A,D),z=[{name:"source",x:k.arrowStartX,y:k.arrowStartY,angle:k.srcArrowAngle},{name:"target",x:k.arrowEndX,y:k.arrowEndY,angle:k.tgtArrowAngle},{name:"mid-source",x:k.midX,y:k.midY,angle:k.midsrcArrowAngle},{name:"mid-target",x:k.midX,y:k.midY,angle:k.midtgtArrowAngle}],M=0;M<z.length;M++){var G=z[M],W=i.arrowShapes[x.pstyle(G.name+"-arrow-shape").value],X=x.pstyle("width").pfValue;if(W.roughCollide(r,e,H,G.angle,{x:G.x,y:G.y},X,v)&&W.collide(r,e,H,G.angle,{x:G.x,y:G.y},X,v))return g(x),!0}u&&s.length>0&&(p(O),p(_))}function b(x,S,k){return Er(x,S,k)}function w(x,S){var k=x._private,A=c,D;S?D=S+"-":D="",x.boundingBox();var B=k.labelBounds[S||"main"],P=x.pstyle(D+"label").value,R=x.pstyle("text-events").strValue==="yes";if(!(!R||!P)){var L=b(k.rscratch,"labelX",S),I=b(k.rscratch,"labelY",S),M=b(k.rscratch,"labelAngle",S),O=x.pstyle(D+"text-margin-x").pfValue,_=x.pstyle(D+"text-margin-y").pfValue,H=B.x1-A-O,z=B.x2+A-O,G=B.y1-A-_,W=B.y2+A-_;if(M){var X=Math.cos(M),Z=Math.sin(M),Q=function(te,le){return te=te-L,le=le-I,{x:te*X-le*Z+L,y:te*Z+le*X+I}},ee=Q(H,G),re=Q(H,W),K=Q(z,G),N=Q(z,W),$=[ee.x+O,ee.y+_,K.x+O,K.y+_,N.x+O,N.y+_,re.x+O,re.y+_];if(gr(r,e,$))return g(x),!0}else if(_t(B,r,e))return g(x),!0}}for(var E=o.length-1;E>=0;E--){var C=o[E];C.isNode()?p(C)||w(C):m(C)||w(C)||w(C,"source")||w(C,"target")}return s};Et.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],o=Math.min(r,t),s=Math.max(r,t),l=Math.min(e,a),u=Math.max(e,a);r=o,t=s,e=l,a=u;for(var v=pr({x1:r,y1:e,x2:t,y2:a}),f=0;f<n.length;f++){var c=n[f];if(c.isNode()){var d=c,h=d.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});Vo(v,h)&&!av(h,v)&&i.push(d)}else{var y=c,g=y._private,p=g.rscratch;if(p.startX!=null&&p.startY!=null&&!_t(v,p.startX,p.startY)||p.endX!=null&&p.endY!=null&&!_t(v,p.endX,p.endY))continue;if(p.edgeType==="bezier"||p.edgeType==="multibezier"||p.edgeType==="self"||p.edgeType==="compound"||p.edgeType==="segments"||p.edgeType==="haystack"){for(var m=g.rstyle.bezierPts||g.rstyle.linePts||g.rstyle.haystackPts,b=!0,w=0;w<m.length;w++)if(!lh(v,m[w])){b=!1;break}b&&i.push(y)}else(p.edgeType==="haystack"||p.edgeType==="straight")&&i.push(y)}}return i};var yn={};yn.calculateArrowAngles=function(r){var e=r._private.rscratch,t=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",o=e.edgeType==="compound",s=e.edgeType==="self",l,u,v,f,c,d,p,m;if(t?(v=e.haystackPts[0],f=e.haystackPts[1],c=e.haystackPts[2],d=e.haystackPts[3]):(v=e.arrowStartX,f=e.arrowStartY,c=e.arrowEndX,d=e.arrowEndY),p=e.midX,m=e.midY,i)l=v-e.segpts[0],u=f-e.segpts[1];else if(n||o||s||a){var h=e.allpts,y=Je(h[0],h[2],h[4],.1),g=Je(h[1],h[3],h[5],.1);l=v-y,u=f-g}else l=v-p,u=f-m;e.srcArrowAngle=qa(l,u);var p=e.midX,m=e.midY;if(t&&(p=(v+c)/2,m=(f+d)/2),l=c-v,u=d-f,i){var h=e.allpts;if(h.length/2%2===0){var b=h.length/2,w=b-2;l=h[b]-h[w],u=h[b+1]-h[w+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var b=h.length/2-1,w=b-2;l=h[b]-h[w],u=h[b+1]-h[w+1]}}else if(n||o||s){var h=e.allpts,E=e.ctrlpts,C,x,S,k;if(E.length/2%2===0){var A=h.length/2-1,D=A+2,B=D+2;C=Je(h[A],h[D],h[B],0),x=Je(h[A+1],h[D+1],h[B+1],0),S=Je(h[A],h[D],h[B],1e-4),k=Je(h[A+1],h[D+1],h[B+1],1e-4)}else{var D=h.length/2-1,A=D-2,B=D+2;C=Je(h[A],h[D],h[B],.4999),x=Je(h[A+1],h[D+1],h[B+1],.4999),S=Je(h[A],h[D],h[B],.5),k=Je(h[A+1],h[D+1],h[B+1],.5)}l=S-C,u=k-x}if(e.midtgtArrowAngle=qa(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var h=e.allpts;if(h.length/2%2!==0){if(!e.isRound){var b=h.length/2-1,P=b+2;l=-(h[P]-h[b]),u=-(h[P+1]-h[b+1])}}}if(e.midsrcArrowAngle=qa(l,u),i)l=c-e.segpts[e.segpts.length-2],u=d-e.segpts[e.segpts.length-1];else if(n||o||s||a){var h=e.allpts,R=h.length,y=Je(h[R-6],h[R-4],h[R-2],.9),g=Je(h[R-5],h[R-3],h[R-1],.9);l=c-y,u=d-g}else l=c-p,u=d-m;e.tgtArrowAngle=qa(l,u)};yn.getArrowWidth=yn.getArrowHeight=function(r,e){var t=this.arrowWidthCache=this.arrowWidthCache||{},a=t[r+", "+e];return a||(a=Math.max(Math.pow(r*13.37,.9),29)*e,t[r+", "+e]=a,a)};var To,So,Or={},xr={},fl,cl,gt,nn,Gr,ft,dt,Ir,Pt,Wa,Zv,Qv,Do,ko,hl,dl=function(e,t,a){a.x=t.x-e.x,a.y=t.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},Bp=function(e,t){t.x=e.x*-1,t.y=e.y*-1,t.nx=e.nx*-1,t.ny=e.ny*-1,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},Rp=function(e,t,a,n,i){if(e!==hl?dl(t,e,Or):Bp(xr,Or),dl(t,a,xr),fl=Or.nx*xr.ny-Or.ny*xr.nx,cl=Or.nx*xr.nx-Or.ny*-xr.ny,Gr=Math.asin(Math.max(-1,Math.min(1,fl))),Math.abs(Gr)<1e-6){To=t.x,So=t.y,dt=Pt=0;return}gt=1,nn=!1,cl<0?Gr<0?Gr=Math.PI+Gr:(Gr=Math.PI-Gr,gt=-1,nn=!0):Gr>0&&(gt=-1,nn=!0),t.radius!==void 0?Pt=t.radius:Pt=n,ft=Gr/2,Wa=Math.min(Or.len/2,xr.len/2),i?(Ir=Math.abs(Math.cos(ft)*Pt/Math.sin(ft)),Ir>Wa?(Ir=Wa,dt=Math.abs(Ir*Math.sin(ft)/Math.cos(ft))):dt=Pt):(Ir=Math.min(Wa,Pt),dt=Math.abs(Ir*Math.sin(ft)/Math.cos(ft))),Do=t.x+xr.nx*Ir,ko=t.y+xr.ny*Ir,To=Do-xr.ny*dt*gt,So=ko+xr.nx*dt*gt,Zv=t.x+Or.nx*Ir,Qv=t.y+Or.ny*Ir,hl=t};function Jv(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Jo(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Rp(r,e,t,a,n),{cx:To,cy:So,radius:dt,startX:Zv,startY:Qv,stopX:Do,stopY:ko,startAngle:Or.ang+Math.PI/2*gt,endAngle:xr.ang-Math.PI/2*gt,counterClockwise:nn})}var Ea=.01,Mp=Math.sqrt(2*Ea),lr={};lr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),l=o.units!=null&&s.units!=null,u=function(E,C,x,S){var k=S-C,A=x-E,D=Math.sqrt(A*A+k*k);return{x:-k/D,y:A/D}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(r.source()[0],o),c=je(f,2),d=c[0],h=c[1],y=this.manualEndptToPx(r.target()[0],s),g=je(y,2),p=g[0],m=g[1],b={x1:d,y1:h,x2:p,y2:m};n=u(d,h,p,m),i=b}else Re("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};lr.findHaystackPoints=function(r){for(var e=0;e<r.length;e++){var t=r[e],a=t._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var o=a.source,s=a.target,l=o.position(),u=s.position(),v=o.width(),f=s.width(),c=o.height(),d=s.height(),h=t.pstyle("haystack-radius").value,y=h/2;n.haystackPts=n.allpts=[n.source.x*v*y+l.x,n.source.y*c*y+l.y,n.target.x*f*y+u.x,n.target.y*d*y+u.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(t),this.calculateArrowAngles(t),this.recalculateEdgeLabelProjections(t),this.calculateLabelAngles(t)}};lr.findSegmentsPoints=function(r,e){var t=r._private.rscratch,a=r.pstyle("segment-weights"),n=r.pstyle("segment-distances"),i=r.pstyle("segment-radii"),o=r.pstyle("radius-type"),s=Math.min(a.pfValue.length,n.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=o.pfValue[o.pfValue.length-1];t.edgeType="segments",t.segpts=[],t.radii=[],t.isArcRadius=[];for(var v=0;v<s;v++){var f=a.pfValue[v],c=n.pfValue[v],d=1-f,h=f,y=this.findMidptPtsEtc(r,e),g=y.midptPts,p=y.vectorNormInverse,m={x:g.x1*d+g.x2*h,y:g.y1*d+g.y2*h};t.segpts.push(m.x+p.x*c,m.y+p.y*c),t.radii.push(i.pfValue[v]!==void 0?i.pfValue[v]:l),t.isArcRadius.push((o.pfValue[v]!==void 0?o.pfValue[v]:u)==="arc-radius")}};lr.findLoopPoints=function(r,e,t,a){var n=r._private.rscratch,i=e.dirCounts,o=e.srcPos,s=r.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=r.pstyle("loop-direction").pfValue,v=r.pstyle("loop-sweep").pfValue,f=r.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=t,d=f;a&&(c=0,d=l);var h=u-Math.PI/2,y=h-v/2,g=h+v/2,p=u+"_"+v;c=i[p]===void 0?i[p]=0:++i[p],n.ctrlpts=[o.x+Math.cos(y)*1.4*d*(c/3+1),o.y+Math.sin(y)*1.4*d*(c/3+1),o.x+Math.cos(g)*1.4*d*(c/3+1),o.y+Math.sin(g)*1.4*d*(c/3+1)]};lr.findCompoundLoopPoints=function(r,e,t,a){var n=r._private.rscratch;n.edgeType="compound";var i=e.srcPos,o=e.tgtPos,s=e.srcW,l=e.srcH,u=e.tgtW,v=e.tgtH,f=r.pstyle("control-point-step-size").pfValue,c=r.pstyle("control-point-distances"),d=c?c.pfValue[0]:void 0,h=t,y=f;a&&(h=0,y=d);var g=50,p={x:i.x-s/2,y:i.y-l/2},m={x:o.x-u/2,y:o.y-v/2},b={x:Math.min(p.x,m.x),y:Math.min(p.y,m.y)},w=.5,E=Math.max(w,Math.log(s*Ea)),C=Math.max(w,Math.log(u*Ea));n.ctrlpts=[b.x,b.y-(1+Math.pow(g,1.12)/100)*y*(h/3+1)*E,b.x-(1+Math.pow(g,1.12)/100)*y*(h/3+1)*C,b.y]};lr.findStraightEdgePoints=function(r){r._private.rscratch.edgeType="straight"};lr.findBezierPoints=function(r,e,t,a,n){var i=r._private.rscratch,o=r.pstyle("control-point-step-size").pfValue,s=r.pstyle("control-point-distances"),l=r.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,v=s?s.pfValue[0]:void 0,f=l.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var d=0;d<u;d++){var h=(.5-e.eles.length/2+t)*o*(n?-1:1),y=void 0,g=rv(h);c&&(v=s?s.pfValue[d]:o,f=l.value[d]),a?y=v:y=v!==void 0?g*v:void 0;var p=y!==void 0?y:h,m=1-f,b=f,w=this.findMidptPtsEtc(r,e),E=w.midptPts,C=w.vectorNormInverse,x={x:E.x1*m+E.x2*b,y:E.y1*m+E.y2*b};i.ctrlpts.push(x.x+C.x*p,x.y+C.y*p)}};lr.findTaxiPoints=function(r,e){var t=r._private.rscratch;t.edgeType="segments";var a="vertical",n="horizontal",i="leftward",o="rightward",s="downward",l="upward",u="auto",v=e.posPts,f=e.srcW,c=e.srcH,d=e.tgtW,h=e.tgtH,y=r.pstyle("edge-distances").value,g=y!=="node-position",p=r.pstyle("taxi-direction").value,m=p,b=r.pstyle("taxi-turn"),w=b.units==="%",E=b.pfValue,C=E<0,x=r.pstyle("taxi-turn-min-distance").pfValue,S=g?(f+d)/2:0,k=g?(c+h)/2:0,A=v.x2-v.x1,D=v.y2-v.y1,B=function(Y,ie){return Y>0?Math.max(Y-ie,0):Math.min(Y+ie,0)},P=B(A,S),R=B(D,k),L=!1;m===u?p=Math.abs(P)>Math.abs(R)?n:a:m===l||m===s?(p=a,L=!0):(m===i||m===o)&&(p=n,L=!0);var I=p===a,M=I?R:P,O=I?D:A,_=rv(O),H=!1;!(L&&(w||C))&&(m===s&&O<0||m===l&&O>0||m===i&&O>0||m===o&&O<0)&&(_*=-1,M=_*Math.abs(M),H=!0);var z;if(w){var G=E<0?1+E:E;z=G*M}else{var W=E<0?M:0;z=W+E*_}var X=function(Y){return Math.abs(Y)<x||Math.abs(Y)>=Math.abs(M)},Z=X(z),Q=X(Math.abs(M)-Math.abs(z)),ee=Z||Q;if(ee&&!H)if(I){var re=Math.abs(O)<=c/2,K=Math.abs(A)<=d/2;if(re){var N=(v.x1+v.x2)/2,$=v.y1,J=v.y2;t.segpts=[N,$,N,J]}else if(K){var te=(v.y1+v.y2)/2,le=v.x1,xe=v.x2;t.segpts=[le,te,xe,te]}else t.segpts=[v.x1,v.y2]}else{var Ie=Math.abs(O)<=f/2,Ae=Math.abs(D)<=h/2;if(Ie){var oe=(v.y1+v.y2)/2,ue=v.x1,he=v.x2;t.segpts=[ue,oe,he,oe]}else if(Ae){var ye=(v.x1+v.x2)/2,de=v.y1,me=v.y2;t.segpts=[ye,de,ye,me]}else t.segpts=[v.x2,v.y1]}else if(I){var Ce=v.y1+z+(g?c/2*_:0),Se=v.x1,j=v.x2;t.segpts=[Se,Ce,j,Ce]}else{var T=v.x1+z+(g?f/2*_:0),q=v.y1,U=v.y2;t.segpts=[T,q,T,U]}if(t.isRound){var F=r.pstyle("taxi-radius").value,V=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(F),t.isArcRadius=new Array(t.segpts.length/2).fill(V)}};lr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,d=e.srcRs,h=e.tgtRs,y=!ae(t.startX)||!ae(t.startY),g=!ae(t.arrowStartX)||!ae(t.arrowStartY),p=!ae(t.endX)||!ae(t.endY),m=!ae(t.arrowEndX)||!ae(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*w,C=yt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=C<E,S=yt({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.endX,y:t.endY}),k=S<E,A=!1;if(y||g||x){A=!0;var D={x:t.ctrlpts[0]-a.x,y:t.ctrlpts[1]-a.y},B=Math.sqrt(D.x*D.x+D.y*D.y),P={x:D.x/B,y:D.y/B},R=Math.max(i,o),L={x:t.ctrlpts[0]+P.x*2*R,y:t.ctrlpts[1]+P.y*2*R},I=u.intersectLine(a.x,a.y,i,o,L.x,L.y,0,f,d);x?(t.ctrlpts[0]=t.ctrlpts[0]+P.x*(E-C),t.ctrlpts[1]=t.ctrlpts[1]+P.y*(E-C)):(t.ctrlpts[0]=I[0]+P.x*E,t.ctrlpts[1]=I[1]+P.y*E)}if(p||m||k){A=!0;var M={x:t.ctrlpts[0]-n.x,y:t.ctrlpts[1]-n.y},O=Math.sqrt(M.x*M.x+M.y*M.y),_={x:M.x/O,y:M.y/O},H=Math.max(i,o),z={x:t.ctrlpts[0]+_.x*2*H,y:t.ctrlpts[1]+_.y*2*H},G=v.intersectLine(n.x,n.y,s,l,z.x,z.y,0,c,h);k?(t.ctrlpts[0]=t.ctrlpts[0]+_.x*(E-S),t.ctrlpts[1]=t.ctrlpts[1]+_.y*(E-S)):(t.ctrlpts[0]=G[0]+_.x*E,t.ctrlpts[1]=G[1]+_.y*E)}A&&this.findEndpoints(r)}};lr.storeAllpts=function(r){var e=r._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var t=0;t+1<e.ctrlpts.length;t+=2)e.allpts.push(e.ctrlpts[t],e.ctrlpts[t+1]),t+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[t]+e.ctrlpts[t+2])/2,(e.ctrlpts[t+1]+e.ctrlpts[t+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=Je(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Je(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var o=e.radii[i/2-1],s=e.isArcRadius[i/2-1];e.roundCorners.push(Jo({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:o},{x:e.allpts[i+2],y:e.allpts[i+3]},o,s))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var v=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[v],e.midY=e.segpts[v+1];else{var f={x:e.segpts[v],y:e.segpts[v+1]},c=e.roundCorners[v/2];if(c.radius===0){var d={x:e.segpts[v+2],y:e.segpts[v+3]};e.midX=f.x,e.midY=f.y,e.midVector=[f.y-d.y,d.x-f.x]}else{var h=[f.x-c.cx,f.y-c.cy],y=c.radius/Math.sqrt(Math.pow(h[0],2)+Math.pow(h[1],2));h=h.map(function(g){return g*y}),e.midX=c.cx+h[0],e.midY=c.cy+h[1],e.midVector=h}}}}};lr.checkForInvalidEdgeWarning=function(r){var e=r[0]._private.rscratch;e.nodesOverlap||ae(e.startX)&&ae(e.startY)&&ae(e.endX)&&ae(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Re("Edge `"+r.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};lr.findEdgeControlPoints=function(r){var e=this;if(!(!r||r.length===0)){for(var t=this,a=t.cy,n=a.hasCompoundNodes(),i=new Kr,o=function(k,A){return[].concat(Ol(k),[A?1:0]).join("-")},s=[],l=[],u=0;u<r.length;u++){var v=r[u],f=v._private,c=v.pstyle("curve-style").value;if(!(v.removed()||!v.takesUpSpace())){if(c==="haystack"){l.push(v);continue}var d=c==="unbundled-bezier"||c.endsWith("segments")||c==="straight"||c==="straight-triangle"||c.endsWith("taxi"),h=c==="unbundled-bezier"||c==="bezier",y=f.source,g=f.target,p=y.poolIndex(),m=g.poolIndex(),b=[p,m].sort(),w=o(b,d),E=i.get(w);E==null&&(E={eles:[]},s.push({pairId:b,edgeIsUnbundled:d}),i.set(w,E)),E.eles.push(v),d&&(E.hasUnbundled=!0),h&&(E.hasBezier=!0)}}for(var C=function(){var k=s[x],A=k.pairId,D=k.edgeIsUnbundled,B=o(A,D),P=i.get(B),R;if(!P.hasUnbundled){var L=P.eles[0].parallelEdges().filter(function(V){return V.isBundledBezier()});Fo(P.eles),L.forEach(function(V){return P.eles.push(V)}),P.eles.sort(function(V,ne){return V.poolIndex()-ne.poolIndex()})}var I=P.eles[0],M=I.source(),O=I.target();if(M.poolIndex()>O.poolIndex()){var _=M;M=O,O=_}var H=P.srcPos=M.position(),z=P.tgtPos=O.position(),G=P.srcW=M.outerWidth(),W=P.srcH=M.outerHeight(),X=P.tgtW=O.outerWidth(),Z=P.tgtH=O.outerHeight(),Q=P.srcShape=t.nodeShapes[e.getNodeShape(M)],ee=P.tgtShape=t.nodeShapes[e.getNodeShape(O)],re=P.srcCornerRadius=M.pstyle("corner-radius").value==="auto"?"auto":M.pstyle("corner-radius").pfValue,K=P.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,N=P.tgtRs=O._private.rscratch,$=P.srcRs=M._private.rscratch;P.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var J=0;J<P.eles.length;J++){var te=P.eles[J],le=te[0]._private.rscratch,xe=te.pstyle("curve-style").value,Ie=xe==="unbundled-bezier"||xe.endsWith("segments")||xe.endsWith("taxi"),Ae=!M.same(te.source());if(!P.calculatedIntersection&&M!==O&&(P.hasBezier||P.hasUnbundled)){P.calculatedIntersection=!0;var oe=Q.intersectLine(H.x,H.y,G,W,z.x,z.y,0,re,$),ue=P.srcIntn=oe,he=ee.intersectLine(z.x,z.y,X,Z,H.x,H.y,0,K,N),ye=P.tgtIntn=he,de=P.intersectionPts={x1:oe[0],x2:he[0],y1:oe[1],y2:he[1]},me=P.posPts={x1:H.x,x2:z.x,y1:H.y,y2:z.y},Ce=Math.abs(he[1]-oe[1]),Se=Math.abs(he[0]-oe[0]),j=Math.sqrt(Se*Se+Ce*Ce);ae(j)&&j>=Mp||(j=Math.sqrt(Math.max(Se*Se,Ea)+Math.max(Ce*Ce,Ea)));var T=P.vector={x:Se,y:Ce},q=P.vectorNorm={x:T.x/j,y:T.y/j},U={x:-q.y,y:q.x};P.nodesOverlap=!ae(j)||ee.checkPoint(oe[0],oe[1],0,X,Z,z.x,z.y,K,N)||Q.checkPoint(he[0],he[1],0,G,W,H.x,H.y,re,$),P.vectorNormInverse=U,R={nodesOverlap:P.nodesOverlap,dirCounts:P.dirCounts,calculatedIntersection:!0,hasBezier:P.hasBezier,hasUnbundled:P.hasUnbundled,eles:P.eles,srcPos:z,srcRs:N,tgtPos:H,tgtRs:$,srcW:X,srcH:Z,tgtW:G,tgtH:W,srcIntn:ye,tgtIntn:ue,srcShape:ee,tgtShape:Q,posPts:{x1:me.x2,y1:me.y2,x2:me.x1,y2:me.y1},intersectionPts:{x1:de.x2,y1:de.y2,x2:de.x1,y2:de.y1},vector:{x:-T.x,y:-T.y},vectorNorm:{x:-q.x,y:-q.y},vectorNormInverse:{x:-U.x,y:-U.y}}}var F=Ae?R:P;le.nodesOverlap=F.nodesOverlap,le.srcIntn=F.srcIntn,le.tgtIntn=F.tgtIntn,le.isRound=xe.startsWith("round"),n&&(M.isParent()||M.isChild()||O.isParent()||O.isChild())&&(M.parents().anySame(O)||O.parents().anySame(M)||M.same(O)&&M.isParent())?e.findCompoundLoopPoints(te,F,J,Ie):M===O?e.findLoopPoints(te,F,J,Ie):xe.endsWith("segments")?e.findSegmentsPoints(te,F):xe.endsWith("taxi")?e.findTaxiPoints(te,F):xe==="straight"||!Ie&&P.eles.length%2===1&&J===Math.floor(P.eles.length/2)?e.findStraightEdgePoints(te):e.findBezierPoints(te,F,J,Ie,Ae),e.findEndpoints(te),e.tryToCorrectInvalidPoints(te,F),e.checkForInvalidEdgeWarning(te),e.storeAllpts(te),e.storeEdgeProjections(te),e.calculateArrowAngles(te),e.recalculateEdgeLabelProjections(te),e.calculateLabelAngles(te)}},x=0;x<s.length;x++)C();this.findHaystackPoints(l)}};function jv(r){var e=[];if(r!=null){for(var t=0;t<r.length;t+=2){var a=r[t],n=r[t+1];e.push({x:a,y:n})}return e}}lr.getSegmentPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="segments")return jv(e.segpts)};lr.getControlPoints=function(r){var e=r[0]._private.rscratch;this.recalculateRenderedStyle(r);var t=e.edgeType;if(t==="bezier"||t==="multibezier"||t==="self"||t==="compound")return jv(e.ctrlpts)};lr.getEdgeMidpoint=function(r){var e=r[0]._private.rscratch;return this.recalculateRenderedStyle(r),{x:e.midX,y:e.midY}};var Ma={};Ma.manualEndptToPx=function(r,e){var t=this,a=r.position(),n=r.outerWidth(),i=r.outerHeight(),o=r._private.rscratch;if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(n,i),v=[a.x+Math.cos(l)*u,a.y+Math.sin(l)*u];return t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,n,i,v[0],v[1],0,r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,o)}};Ma.findEndpoints=function(r){var e=this,t,a=r.source()[0],n=r.target()[0],i=a.position(),o=n.position(),s=r.pstyle("target-arrow-shape").value,l=r.pstyle("source-arrow-shape").value,u=r.pstyle("target-distance-from-node").pfValue,v=r.pstyle("source-distance-from-node").pfValue,f=a._private.rscratch,c=n._private.rscratch,d=r.pstyle("curve-style").value,h=r._private.rscratch,y=h.edgeType,g=d==="taxi",p=y==="self"||y==="compound",m=y==="bezier"||y==="multibezier"||p,b=y!=="bezier",w=y==="straight"||y==="segments",E=y==="segments",C=m||b||w,x=p||g,S=r.pstyle("source-endpoint"),k=x?"outside-to-node":S.value,A=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,D=r.pstyle("target-endpoint"),B=x?"outside-to-node":D.value,P=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue;h.srcManEndpt=S,h.tgtManEndpt=D;var R,L,I,M;if(m){var O=[h.ctrlpts[0],h.ctrlpts[1]],_=b?[h.ctrlpts[h.ctrlpts.length-2],h.ctrlpts[h.ctrlpts.length-1]]:O;R=_,L=O}else if(w){var H=E?h.segpts.slice(0,2):[o.x,o.y],z=E?h.segpts.slice(h.segpts.length-2):[i.x,i.y];R=z,L=H}if(B==="inside-to-node")t=[o.x,o.y];else if(D.units)t=this.manualEndptToPx(n,D);else if(B==="outside-to-line")t=h.tgtIntn;else if(B==="outside-to-node"||B==="outside-to-node-or-label"?I=R:(B==="outside-to-line"||B==="outside-to-line-or-label")&&(I=[i.x,i.y]),t=e.nodeShapes[this.getNodeShape(n)].intersectLine(o.x,o.y,n.outerWidth(),n.outerHeight(),I[0],I[1],0,P,c),B==="outside-to-node-or-label"||B==="outside-to-line-or-label"){var G=n._private.rscratch,W=G.labelWidth,X=G.labelHeight,Z=G.labelX,Q=G.labelY,ee=W/2,re=X/2,K=n.pstyle("text-valign").value;K==="top"?Q-=re:K==="bottom"&&(Q+=re);var N=n.pstyle("text-halign").value;N==="left"?Z-=ee:N==="right"&&(Z+=ee);var $=ya(I[0],I[1],[Z-ee,Q-re,Z+ee,Q-re,Z+ee,Q+re,Z-ee,Q+re],o.x,o.y);if($.length>0){var J=i,te=ct(J,Lt(t)),le=ct(J,Lt($)),xe=te;if(le<te&&(t=$,xe=le),$.length>2){var Ie=ct(J,{x:$[2],y:$[3]});Ie<xe&&(t=[$[2],$[3]])}}}var Ae=Va(t,R,e.arrowShapes[s].spacing(r)+u),oe=Va(t,R,e.arrowShapes[s].gap(r)+u);if(h.endX=oe[0],h.endY=oe[1],h.arrowEndX=Ae[0],h.arrowEndY=Ae[1],k==="inside-to-node")t=[i.x,i.y];else if(S.units)t=this.manualEndptToPx(a,S);else if(k==="outside-to-line")t=h.srcIntn;else if(k==="outside-to-node"||k==="outside-to-node-or-label"?M=L:(k==="outside-to-line"||k==="outside-to-line-or-label")&&(M=[o.x,o.y]),t=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),M[0],M[1],0,A,f),k==="outside-to-node-or-label"||k==="outside-to-line-or-label"){var ue=a._private.rscratch,he=ue.labelWidth,ye=ue.labelHeight,de=ue.labelX,me=ue.labelY,Ce=he/2,Se=ye/2,j=a.pstyle("text-valign").value;j==="top"?me-=Se:j==="bottom"&&(me+=Se);var T=a.pstyle("text-halign").value;T==="left"?de-=Ce:T==="right"&&(de+=Ce);var q=ya(M[0],M[1],[de-Ce,me-Se,de+Ce,me-Se,de+Ce,me+Se,de-Ce,me+Se],i.x,i.y);if(q.length>0){var U=o,F=ct(U,Lt(t)),V=ct(U,Lt(q)),ne=F;if(V<F&&(t=[q[0],q[1]],ne=V),q.length>2){var Y=ct(U,{x:q[2],y:q[3]});Y<ne&&(t=[q[2],q[3]])}}}var ie=Va(t,L,e.arrowShapes[l].spacing(r)+v),ce=Va(t,L,e.arrowShapes[l].gap(r)+v);h.startX=ce[0],h.startY=ce[1],h.arrowStartX=ie[0],h.arrowStartY=ie[1],C&&(!ae(h.startX)||!ae(h.startY)||!ae(h.endX)||!ae(h.endY)?h.badLine=!0:h.badLine=!1)};Ma.getSourceEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Ma.getTargetEndpoint=function(r){var e=r[0]._private.rscratch;switch(this.recalculateRenderedStyle(r),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var jo={};function Lp(r,e,t){for(var a=function(u,v,f,c){return Je(u,v,f,c)},n=e._private,i=n.rstyle.bezierPts,o=0;o<r.bezierProjPcts.length;o++){var s=r.bezierProjPcts[o];i.push({x:a(t[0],t[2],t[4],s),y:a(t[1],t[3],t[5],s)})}}jo.storeEdgeProjections=function(r){var e=r._private,t=e.rscratch,a=t.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<t.allpts.length;n+=4)Lp(this,r,t.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<t.allpts.length;n+=2)i.push({x:t.allpts[n],y:t.allpts[n+1]});else if(a==="haystack"){var o=t.haystackPts;e.rstyle.haystackPts=[{x:o[0],y:o[1]},{x:o[2],y:o[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth};jo.recalculateEdgeProjections=function(r){this.findEdgeControlPoints(r)};var Fr={};Fr.recalculateNodeLabelProjection=function(r){var e=r.pstyle("label").strValue;if(!rt(e)){var t,a,n=r._private,i=r.width(),o=r.height(),s=r.padding(),l=r.position(),u=r.pstyle("text-halign").strValue,v=r.pstyle("text-valign").strValue,f=n.rscratch,c=n.rstyle;switch(u){case"left":t=l.x-i/2-s;break;case"right":t=l.x+i/2+s;break;default:t=l.x}switch(v){case"top":a=l.y-o/2-s;break;case"bottom":a=l.y+o/2+s;break;default:a=l.y}f.labelX=t,f.labelY=a,c.labelX=t,c.labelY=a,this.calculateLabelAngles(r),this.applyLabelDimensions(r)}};var ef=function(e,t){var a=Math.atan(t/e);return e===0&&a<0&&(a=a*-1),a},rf=function(e,t){var a=t.x-e.x,n=t.y-e.y;return ef(a,n)},Ip=function(e,t,a,n){var i=pa(0,n-.001,1),o=pa(0,n+.001,1),s=Nt(e,t,a,i),l=Nt(e,t,a,o);return rf(s,l)};Fr.recalculateEdgeLabelProjections=function(r){var e,t=r._private,a=t.rscratch,n=this,i={mid:r.pstyle("label").strValue,source:r.pstyle("source-label").strValue,target:r.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var o=function(f,c,d){Hr(t.rscratch,f,c,d),Hr(t.rstyle,f,c,d)};o("labelX",null,e.x),o("labelY",null,e.y);var s=ef(a.midDispX,a.midDispY);o("labelAutoAngle",null,s);var l=function(){if(l.cache)return l.cache;for(var f=[],c=0;c+5<a.allpts.length;c+=4){var d={x:a.allpts[c],y:a.allpts[c+1]},h={x:a.allpts[c+2],y:a.allpts[c+3]},y={x:a.allpts[c+4],y:a.allpts[c+5]};f.push({p0:d,p1:h,p2:y,startDist:0,length:0,segments:[]})}var g=t.rstyle.bezierPts,p=n.bezierProjPcts.length;function m(x,S,k,A,D){var B=yt(S,k),P=x.segments[x.segments.length-1],R={p0:S,p1:k,t0:A,t1:D,startDist:P?P.startDist+P.length:0,length:B};x.segments.push(R),x.length+=B}for(var b=0;b<f.length;b++){var w=f[b],E=f[b-1];E&&(w.startDist=E.startDist+E.length),m(w,w.p0,g[b*p],0,n.bezierProjPcts[0]);for(var C=0;C<p-1;C++)m(w,g[b*p+C],g[b*p+C+1],n.bezierProjPcts[C],n.bezierProjPcts[C+1]);m(w,g[b*p+p-1],w.p2,n.bezierProjPcts[p-1],1)}return l.cache=f},u=function(f){var c,d=f==="source";if(i[f]){var h=r.pstyle(f+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=l(),g,p=0,m=0,b=0;b<y.length;b++){for(var w=y[d?b:y.length-1-b],E=0;E<w.segments.length;E++){var C=w.segments[d?E:w.segments.length-1-E],x=b===y.length-1&&E===w.segments.length-1;if(p=m,m+=C.length,m>=h||x){g={cp:w,segment:C};break}}if(g)break}var S=g.cp,k=g.segment,A=(h-p)/k.length,D=k.t1-k.t0,B=d?k.t0+D*A:k.t1-D*A;B=pa(0,B,1),e=Nt(S.p0,S.p1,S.p2,B),c=Ip(S.p0,S.p1,S.p2,B);break}case"straight":case"segments":case"haystack":{for(var P=0,R,L,I,M,O=a.allpts.length,_=0;_+3<O&&(d?(I={x:a.allpts[_],y:a.allpts[_+1]},M={x:a.allpts[_+2],y:a.allpts[_+3]}):(I={x:a.allpts[O-2-_],y:a.allpts[O-1-_]},M={x:a.allpts[O-4-_],y:a.allpts[O-3-_]}),R=yt(I,M),L=P,P+=R,!(P>=h));_+=2);var H=h-L,z=H/R;z=pa(0,z,1),e=nh(I,M,z),c=rf(I,M);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}};Fr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};Fr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=tt(a,r._private.labelDimsKey);if(Er(t.rscratch,"prefixedLabelDimsKey",e)!==n){Hr(t.rscratch,"prefixedLabelDimsKey",e,n);var i=this.calculateLabelDimensions(r,a),o=r.pstyle("line-height").pfValue,s=r.pstyle("text-wrap").strValue,l=Er(t.rscratch,"labelWrapCachedLines",e)||[],u=s!=="wrap"?1:Math.max(l.length,1),v=i.height/u,f=v*o,c=i.width,d=i.height+(u-1)*(o-1)*v;Hr(t.rstyle,"labelWidth",e,c),Hr(t.rscratch,"labelWidth",e,c),Hr(t.rstyle,"labelHeight",e,d),Hr(t.rscratch,"labelHeight",e,d),Hr(t.rscratch,"labelLineHeight",e,f)}};Fr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,o=function(W,X){return X?(Hr(t.rscratch,W,e,X),X):Er(t.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",v=n.split(`
15
- `),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,d=c==="anywhere",h=[],y=/[\s\u200b]+|$/g,g=0;g<v.length;g++){var p=v[g],m=this.calculateLabelDimensions(r,p),b=m.width;if(d){var w=p.split("").join(u);p=w}if(b>f){var E=p.matchAll(y),C="",x=0,S=Pr(E),k;try{for(S.s();!(k=S.n()).done;){var A=k.value,D=A[0],B=p.substring(x,A.index);x=A.index+D.length;var P=C.length===0?B:C+B+D,R=this.calculateLabelDimensions(r,P),L=R.width;L<=f?C+=B+D:(C&&h.push(C),C=B+D)}}catch(G){S.e(G)}finally{S.f()}C.match(/^[\s\u200b]+$/)||h.push(C)}else h.push(p)}o("labelWrapCachedLines",h),n=o("labelWrapCachedText",h.join(`
16
- `)),o("labelWrapKey",l)}else if(s==="ellipsis"){var I=r.pstyle("text-max-width").pfValue,M="",O="…",_=!1;if(this.calculateLabelDimensions(r,n).width<I)return n;for(var H=0;H<n.length;H++){var z=this.calculateLabelDimensions(r,M+n[H]+O).width;if(z>I)break;M+=n[H],H===n.length-1&&(_=!0)}return _||(M+=O),M}return n};Fr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Fr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=0,o=r.pstyle("font-style").strValue,s=r.pstyle("font-size").pfValue,l=r.pstyle("font-family").strValue,u=r.pstyle("font-weight").strValue,v=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=n.createElement("canvas"),f=this.labelCalcCanvasContext=v.getContext("2d");var c=v.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}f.font="".concat(o," ").concat(u," ").concat(s,"px ").concat(l);for(var d=0,h=0,y=e.split(`
17
- `),g=0;g<y.length;g++){var p=y[g],m=f.measureText(p),b=Math.ceil(m.width),w=s;d=Math.max(b,d),h+=w}return d+=i,h+=i,{width:d,height:h}};Fr.calculateLabelAngle=function(r,e){var t=r._private,a=t.rscratch,n=r.isEdge(),i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=o.strValue;return s==="none"?0:n&&s==="autorotate"?a.labelAutoAngle:s==="autorotate"?0:o.pfValue};Fr.calculateLabelAngles=function(r){var e=this,t=r.isEdge(),a=r._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(r),t&&(n.sourceLabelAngle=e.calculateLabelAngle(r,"source"),n.targetLabelAngle=e.calculateLabelAngle(r,"target"))};var tf={},gl=28,pl=!1;tf.getNodeShape=function(r){var e=this,t=r.pstyle("shape").value;if(t==="cutrectangle"&&(r.width()<gl||r.height()<gl))return pl||(Re("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),pl=!0),"rectangle";if(r.isParent())return t==="rectangle"||t==="roundrectangle"||t==="round-rectangle"||t==="cutrectangle"||t==="cut-rectangle"||t==="barrel"?t:"rectangle";if(t==="polygon"){var a=r.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return t};var zn={};zn.registerCalculationListeners=function(){var r=this.cy,e=r.collection(),t=this,a=function(o){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var l=0;l<o.length;l++){var u=o[l],v=u._private,f=v.rstyle;f.clean=!1,f.cleanConnected=!1}};t.binder(r).on("bounds.* dirty.*",function(o){var s=o.target;a(s)}).on("style.* background.*",function(o){var s=o.target;a(s,!1)});var n=function(o){if(o){var s=t.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],v=u._private.rstyle;u.isNode()&&!v.cleanConnected&&(a(u.connectedEdges()),v.cleanConnected=!0)}if(s)for(var f=0;f<s.length;f++){var c=s[f];c(o,e)}t.recalculateRenderedStyle(e),e=r.collection()}};t.flushRenderedStyleQueue=function(){n(!0)},t.beforeRender(n,t.beforeRenderPriorities.eleCalcs)};zn.onUpdateEleCalcs=function(r){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(r)};zn.recalculateRenderedStyle=function(r,e){var t=function(w){return w._private.rstyle.cleanConnected};if(r.length!==0){var a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<r.length;i++){var o=r[i],s=o._private,l=s.rstyle;o.isEdge()&&(!t(o.source())||!t(o.target()))&&(l.clean=!1),o.isEdge()&&o.isBundledBezier()&&o.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(l.clean=!1),!(e&&l.clean||o.removed())&&o.pstyle("display").value!=="none"&&(s.group==="nodes"?n.push(o):a.push(o),l.clean=!0)}for(var u=0;u<n.length;u++){var v=n[u],f=v._private,c=f.rstyle,d=v.position();this.recalculateNodeLabelProjection(v),c.nodeX=d.x,c.nodeY=d.y,c.nodeW=v.pstyle("width").pfValue,c.nodeH=v.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var h=0;h<a.length;h++){var y=a[h],g=y._private,p=g.rstyle,m=g.rscratch;p.srcX=m.arrowStartX,p.srcY=m.arrowStartY,p.tgtX=m.arrowEndX,p.tgtY=m.arrowEndY,p.midX=m.midX,p.midY=m.midY,p.labelAngle=m.labelAngle,p.sourceLabelAngle=m.sourceLabelAngle,p.targetLabelAngle=m.targetLabelAngle}}}};var Fn={};Fn.updateCachedGrabbedEles=function(){var r=this.cachedZSortedEles;if(r){r.drag=[],r.nondrag=[];for(var e=[],t=0;t<r.length;t++){var a=r[t],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?r.drag.push(a):r.nondrag.push(a)}for(var t=0;t<e.length;t++){var a=e[t];r.drag.push(a)}}};Fn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Fn.getCachedZSortedEles=function(r){if(r||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(zv),e.interactive=e.filter(function(t){return t.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var af={};[Et,yn,lr,Ma,jo,Fr,tf,zn,Fn].forEach(function(r){ge(af,r)});var nf={};nf.getCachedImage=function(r,e,t){var a=this,n=a.imageCache=a.imageCache||{},i=n[r];if(i)return i.image.complete||i.image.addEventListener("load",t),i.image;i=n[r]=n[r]||{};var o=i.image=new Image;o.addEventListener("load",t),o.addEventListener("error",function(){o.error=!0});var s="data:",l=r.substring(0,s.length).toLowerCase()===s;return l||(e=e==="null"?null:e,o.crossOrigin=e),o.src=r,o};var Xt={};Xt.registerBinding=function(r,e,t,a){var n=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(r)){for(var i=[],o=0;o<r.length;o++){var s=r[o];if(s!==void 0){var l=this.binder(s);i.push(l.on.apply(l,n))}}return i}var l=this.binder(r);return l.on.apply(l,n)};Xt.binder=function(r){var e=this,t=e.cy.window(),a=r===t||r===t.document||r===t.document.body||Qf(r);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});t.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var o=function(l,u,v){var f=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(f[2]={capture:v??!1,passive:!1,once:!1}),e.bindings.push({target:r,args:f}),(r.addEventListener||r.on).apply(r,f),this};return{on:o,addEventListener:o,addListener:o,bind:o}};Xt.nodeIsDraggable=function(r){return r&&r.isNode()&&!r.locked()&&r.grabbable()};Xt.nodeIsGrabbable=function(r){return this.nodeIsDraggable(r)&&r.interactive()};Xt.load=function(){var r=this,e=r.cy.window(),t=function(T){return T.selected()},a=function(T){var q=T.getRootNode();if(q&&q.nodeType===11&&q.host!==void 0)return q},n=function(T,q,U,F){T==null&&(T=r.cy);for(var V=0;V<q.length;V++){var ne=q[V];T.emit({originalEvent:U,type:ne,position:F})}},i=function(T){return T.shiftKey||T.metaKey||T.ctrlKey},o=function(T,q){var U=!0;if(r.cy.hasCompoundNodes()&&T&&T.pannable())for(var F=0;q&&F<q.length;F++){var T=q[F];if(T.isNode()&&T.isParent()&&!T.pannable()){U=!1;break}}else U=!0;return U},s=function(T){T[0]._private.grabbed=!0},l=function(T){T[0]._private.grabbed=!1},u=function(T){T[0]._private.rscratch.inDragLayer=!0},v=function(T){T[0]._private.rscratch.inDragLayer=!1},f=function(T){T[0]._private.rscratch.isGrabTarget=!0},c=function(T){T[0]._private.rscratch.isGrabTarget=!1},d=function(T,q){var U=q.addToList,F=U.has(T);!F&&T.grabbable()&&!T.locked()&&(U.merge(T),s(T))},h=function(T,q){if(T.cy().hasCompoundNodes()&&!(q.inDragLayer==null&&q.addToList==null)){var U=T.descendants();q.inDragLayer&&(U.forEach(u),U.connectedEdges().forEach(u)),q.addToList&&d(U,q)}},y=function(T,q){q=q||{};var U=T.cy().hasCompoundNodes();q.inDragLayer&&(T.forEach(u),T.neighborhood().stdFilter(function(F){return!U||F.isEdge()}).forEach(u)),q.addToList&&T.forEach(function(F){d(F,q)}),h(T,q),m(T,{inDragLayer:q.inDragLayer}),r.updateCachedGrabbedEles()},g=y,p=function(T){T&&(r.getCachedZSortedEles().forEach(function(q){l(q),v(q),c(q)}),r.updateCachedGrabbedEles())},m=function(T,q){if(!(q.inDragLayer==null&&q.addToList==null)&&T.cy().hasCompoundNodes()){var U=T.ancestors().orphans();if(!U.same(T)){var F=U.descendants().spawnSelf().merge(U).unmerge(T).unmerge(T.descendants()),V=F.connectedEdges();q.inDragLayer&&(V.forEach(u),F.forEach(u)),q.addToList&&F.forEach(function(ne){d(ne,q)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",E=typeof ResizeObserver<"u";w?(r.removeObserver=new MutationObserver(function(j){for(var T=0;T<j.length;T++){var q=j[T],U=q.removedNodes;if(U)for(var F=0;F<U.length;F++){var V=U[F];if(V===r.container){r.destroy();break}}}}),r.container.parentNode&&r.removeObserver.observe(r.container.parentNode,{childList:!0})):r.registerBinding(r.container,"DOMNodeRemoved",function(j){r.destroy()});var C=Pa(function(){r.cy.resize()},100);w&&(r.styleObserver=new MutationObserver(C),r.styleObserver.observe(r.container,{attributes:!0})),r.registerBinding(e,"resize",C),E&&(r.resizeObserver=new ResizeObserver(C),r.resizeObserver.observe(r.container));var x=function(T,q){for(;T!=null;)q(T),T=T.parentNode},S=function(){r.invalidateContainerClientCoordsCache()};x(r.container,function(j){r.registerBinding(j,"transitionend",S),r.registerBinding(j,"animationend",S),r.registerBinding(j,"scroll",S)}),r.registerBinding(r.container,"contextmenu",function(j){j.preventDefault()});var k=function(){return r.selection[4]!==0},A=function(T){for(var q=r.findContainerClientCoords(),U=q[0],F=q[1],V=q[2],ne=q[3],Y=T.touches?T.touches:[T],ie=!1,ce=0;ce<Y.length;ce++){var Ee=Y[ce];if(U<=Ee.clientX&&Ee.clientX<=U+V&&F<=Ee.clientY&&Ee.clientY<=F+ne){ie=!0;break}}if(!ie)return!1;for(var ve=r.container,be=T.target,we=be.parentNode,pe=!1;we;){if(we===ve){pe=!0;break}we=we.parentNode}return!!pe};r.registerBinding(r.container,"mousedown",function(T){if(A(T)&&!(r.hoverData.which===1&&T.which!==1)){T.preventDefault(),b(),r.hoverData.capture=!0,r.hoverData.which=T.which;var q=r.cy,U=[T.clientX,T.clientY],F=r.projectIntoViewport(U[0],U[1]),V=r.selection,ne=r.findNearestElements(F[0],F[1],!0,!1),Y=ne[0],ie=r.dragData.possibleDragElements;r.hoverData.mdownPos=F,r.hoverData.mdownGPos=U;var ce=function(){r.hoverData.tapholdCancelled=!1,clearTimeout(r.hoverData.tapholdTimeout),r.hoverData.tapholdTimeout=setTimeout(function(){if(!r.hoverData.tapholdCancelled){var Oe=r.hoverData.down;Oe?Oe.emit({originalEvent:T,type:"taphold",position:{x:F[0],y:F[1]}}):q.emit({originalEvent:T,type:"taphold",position:{x:F[0],y:F[1]}})}},r.tapholdDuration)};if(T.which==3){r.hoverData.cxtStarted=!0;var Ee={originalEvent:T,type:"cxttapstart",position:{x:F[0],y:F[1]}};Y?(Y.activate(),Y.emit(Ee),r.hoverData.down=Y):q.emit(Ee),r.hoverData.downTime=new Date().getTime(),r.hoverData.cxtDragged=!1}else if(T.which==1){Y&&Y.activate();{if(Y!=null&&r.nodeIsGrabbable(Y)){var ve=function(Oe){return{originalEvent:T,type:Oe,position:{x:F[0],y:F[1]}}},be=function(Oe){Oe.emit(ve("grab"))};if(f(Y),!Y.selected())ie=r.dragData.possibleDragElements=q.collection(),g(Y,{addToList:ie}),Y.emit(ve("grabon")).emit(ve("grab"));else{ie=r.dragData.possibleDragElements=q.collection();var we=q.$(function(pe){return pe.isNode()&&pe.selected()&&r.nodeIsGrabbable(pe)});y(we,{addToList:ie}),Y.emit(ve("grabon")),we.forEach(be)}r.redrawHint("eles",!0),r.redrawHint("drag",!0)}r.hoverData.down=Y,r.hoverData.downs=ne,r.hoverData.downTime=new Date().getTime()}n(Y,["mousedown","tapstart","vmousedown"],T,{x:F[0],y:F[1]}),Y==null?(V[4]=1,r.data.bgActivePosistion={x:F[0],y:F[1]},r.redrawHint("select",!0),r.redraw()):Y.pannable()&&(V[4]=1),ce()}V[0]=V[2]=F[0],V[1]=V[3]=F[1]}},!1);var D=a(r.container);r.registerBinding([e,D],"mousemove",function(T){var q=r.hoverData.capture;if(!(!q&&!A(T))){var U=!1,F=r.cy,V=F.zoom(),ne=[T.clientX,T.clientY],Y=r.projectIntoViewport(ne[0],ne[1]),ie=r.hoverData.mdownPos,ce=r.hoverData.mdownGPos,Ee=r.selection,ve=null;!r.hoverData.draggingEles&&!r.hoverData.dragging&&!r.hoverData.selecting&&(ve=r.findNearestElement(Y[0],Y[1],!0,!1));var be=r.hoverData.last,we=r.hoverData.down,pe=[Y[0]-Ee[2],Y[1]-Ee[3]],Oe=r.dragData.possibleDragElements,qe;if(ce){var yr=ne[0]-ce[0],mr=yr*yr,He=ne[1]-ce[1],Xe=He*He,Ze=mr+Xe;r.hoverData.isOverThresholdDrag=qe=Ze>=r.desktopTapThreshold2}var vr=i(T);qe&&(r.hoverData.tapholdCancelled=!0);var fr=function(){var Lr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Lr.length===0?(Lr.push(pe[0]),Lr.push(pe[1])):(Lr[0]+=pe[0],Lr[1]+=pe[1])};U=!0,n(ve,["mousemove","vmousemove","tapdrag"],T,{x:Y[0],y:Y[1]});var Rr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||F.emit({originalEvent:T,type:"boxstart",position:{x:Y[0],y:Y[1]}}),Ee[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(qe){var wr={originalEvent:T,type:"cxtdrag",position:{x:Y[0],y:Y[1]}};we?we.emit(wr):F.emit(wr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||ve!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:Y[0],y:Y[1]}}),r.hoverData.cxtOver=ve,ve&&ve.emit({originalEvent:T,type:"cxtdragover",position:{x:Y[0],y:Y[1]}}))}}else if(r.hoverData.dragging){if(U=!0,F.panningEnabled()&&F.userPanningEnabled()){var Mr;if(r.hoverData.justStartedPan){var Vr=r.hoverData.mdownPos;Mr={x:(Y[0]-Vr[0])*V,y:(Y[1]-Vr[1])*V},r.hoverData.justStartedPan=!1}else Mr={x:pe[0]*V,y:pe[1]*V};F.panBy(Mr),F.emit("dragpan"),r.hoverData.dragged=!0}Y=r.projectIntoViewport(T.clientX,T.clientY)}else if(Ee[4]==1&&(we==null||we.pannable())){if(qe){if(!r.hoverData.dragging&&F.boxSelectionEnabled()&&(vr||!F.panningEnabled()||!F.userPanningEnabled()))Rr();else if(!r.hoverData.selecting&&F.panningEnabled()&&F.userPanningEnabled()){var _r=o(we,r.hoverData.downs);_r&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,Ee[4]=0,r.data.bgActivePosistion=Lt(ie),r.redrawHint("select",!0),r.redraw())}we&&we.pannable()&&we.active()&&we.unactivate()}}else{if(we&&we.pannable()&&we.active()&&we.unactivate(),(!we||!we.grabbed())&&ve!=be&&(be&&n(be,["mouseout","tapdragout"],T,{x:Y[0],y:Y[1]}),ve&&n(ve,["mouseover","tapdragover"],T,{x:Y[0],y:Y[1]}),r.hoverData.last=ve),we)if(qe){if(F.boxSelectionEnabled()&&vr)we&&we.grabbed()&&(p(Oe),we.emit("freeon"),Oe.emit("free"),r.dragData.didDrag&&(we.emit("dragfreeon"),Oe.emit("dragfree"))),Rr();else if(we&&we.grabbed()&&r.nodeIsDraggable(we)){var or=!r.dragData.didDrag;or&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||y(Oe,{inDragLayer:!0});var Qe={x:0,y:0};if(ae(pe[0])&&ae(pe[1])&&(Qe.x+=pe[0],Qe.y+=pe[1],or)){var dr=r.hoverData.dragDelta;dr&&ae(dr[0])&&ae(dr[1])&&(Qe.x+=dr[0],Qe.y+=dr[1])}r.hoverData.draggingEles=!0,Oe.silentShift(Qe).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else fr();U=!0}if(Ee[2]=Y[0],Ee[3]=Y[1],U)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var B,P,R;r.registerBinding(e,"mouseup",function(T){if(!(r.hoverData.which===1&&T.which!==1&&r.hoverData.capture)){var q=r.hoverData.capture;if(q){r.hoverData.capture=!1;var U=r.cy,F=r.projectIntoViewport(T.clientX,T.clientY),V=r.selection,ne=r.findNearestElement(F[0],F[1],!0,!1),Y=r.dragData.possibleDragElements,ie=r.hoverData.down,ce=i(T);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,ie&&ie.unactivate(),r.hoverData.which===3){var Ee={originalEvent:T,type:"cxttapend",position:{x:F[0],y:F[1]}};if(ie?ie.emit(Ee):U.emit(Ee),!r.hoverData.cxtDragged){var ve={originalEvent:T,type:"cxttap",position:{x:F[0],y:F[1]}};ie?ie.emit(ve):U.emit(ve)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(n(ne,["mouseup","tapend","vmouseup"],T,{x:F[0],y:F[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(n(ie,["click","tap","vclick"],T,{x:F[0],y:F[1]}),P=!1,T.timeStamp-R<=U.multiClickDebounceTime()?(B&&clearTimeout(B),P=!0,R=null,n(ie,["dblclick","dbltap","vdblclick"],T,{x:F[0],y:F[1]})):(B=setTimeout(function(){P||n(ie,["oneclick","onetap","voneclick"],T,{x:F[0],y:F[1]})},U.multiClickDebounceTime()),R=T.timeStamp)),ie==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!i(T)&&(U.$(t).unselect(["tapunselect"]),Y.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=Y=U.collection()),ne==ie&&!r.dragData.didDrag&&!r.hoverData.selecting&&ne!=null&&ne._private.selectable&&(r.hoverData.dragging||(U.selectionType()==="additive"||ce?ne.selected()?ne.unselect(["tapunselect"]):ne.select(["tapselect"]):ce||(U.$(t).unmerge(ne).unselect(["tapunselect"]),ne.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var be=U.collection(r.getAllInBox(V[0],V[1],V[2],V[3]));r.redrawHint("select",!0),be.length>0&&r.redrawHint("eles",!0),U.emit({type:"boxend",originalEvent:T,position:{x:F[0],y:F[1]}});var we=function(qe){return qe.selectable()&&!qe.selected()};U.selectionType()==="additive"||ce||U.$(t).unmerge(be).unselect(),be.emit("box").stdFilter(we).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!V[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var pe=ie&&ie.grabbed();p(Y),pe&&(ie.emit("freeon"),Y.emit("free"),r.dragData.didDrag&&(ie.emit("dragfreeon"),Y.emit("dragfree")))}}V[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var L=function(T){if(!r.scrollingPage){var q=r.cy,U=q.zoom(),F=q.pan(),V=r.projectIntoViewport(T.clientX,T.clientY),ne=[V[0]*U+F.x,V[1]*U+F.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||k()){T.preventDefault();return}if(q.panningEnabled()&&q.userPanningEnabled()&&q.zoomingEnabled()&&q.userZoomingEnabled()){T.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var Y;T.deltaY!=null?Y=T.deltaY/-250:T.wheelDeltaY!=null?Y=T.wheelDeltaY/1e3:Y=T.wheelDelta/1e3,Y=Y*r.wheelSensitivity;var ie=T.deltaMode===1;ie&&(Y*=33);var ce=q.zoom()*Math.pow(10,Y);T.type==="gesturechange"&&(ce=r.gestureStartZoom*T.scale),q.zoom({level:ce,renderedPosition:{x:ne[0],y:ne[1]}}),q.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",L,!0),r.registerBinding(e,"scroll",function(T){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(T){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||T.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(j){r.hasTouchStarted||L(j)},!0),r.registerBinding(r.container,"mouseout",function(T){var q=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseout",position:{x:q[0],y:q[1]}})},!1),r.registerBinding(r.container,"mouseover",function(T){var q=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseover",position:{x:q[0],y:q[1]}})},!1);var I,M,O,_,H,z,G,W,X,Z,Q,ee,re,K=function(T,q,U,F){return Math.sqrt((U-T)*(U-T)+(F-q)*(F-q))},N=function(T,q,U,F){return(U-T)*(U-T)+(F-q)*(F-q)},$;r.registerBinding(r.container,"touchstart",$=function(T){if(r.hasTouchStarted=!0,!!A(T)){b(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var q=r.cy,U=r.touchData.now,F=r.touchData.earlier;if(T.touches[0]){var V=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);U[0]=V[0],U[1]=V[1]}if(T.touches[1]){var V=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);U[2]=V[0],U[3]=V[1]}if(T.touches[2]){var V=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);U[4]=V[0],U[5]=V[1]}if(T.touches[1]){r.touchData.singleTouchMoved=!0,p(r.dragData.touchDragEles);var ne=r.findContainerClientCoords();X=ne[0],Z=ne[1],Q=ne[2],ee=ne[3],I=T.touches[0].clientX-X,M=T.touches[0].clientY-Z,O=T.touches[1].clientX-X,_=T.touches[1].clientY-Z,re=0<=I&&I<=Q&&0<=O&&O<=Q&&0<=M&&M<=ee&&0<=_&&_<=ee;var Y=q.pan(),ie=q.zoom();H=K(I,M,O,_),z=N(I,M,O,_),G=[(I+O)/2,(M+_)/2],W=[(G[0]-Y.x)/ie,(G[1]-Y.y)/ie];var ce=200,Ee=ce*ce;if(z<Ee&&!T.touches[2]){var ve=r.findNearestElement(U[0],U[1],!0,!0),be=r.findNearestElement(U[2],U[3],!0,!0);ve&&ve.isNode()?(ve.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:U[0],y:U[1]}}),r.touchData.start=ve):be&&be.isNode()?(be.activate().emit({originalEvent:T,type:"cxttapstart",position:{x:U[0],y:U[1]}}),r.touchData.start=be):q.emit({originalEvent:T,type:"cxttapstart",position:{x:U[0],y:U[1]}}),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!0,r.touchData.cxtDragged=!1,r.data.bgActivePosistion=void 0,r.redraw();return}}if(T.touches[2])q.boxSelectionEnabled()&&T.preventDefault();else if(!T.touches[1]){if(T.touches[0]){var we=r.findNearestElements(U[0],U[1],!0,!0),pe=we[0];if(pe!=null&&(pe.activate(),r.touchData.start=pe,r.touchData.starts=we,r.nodeIsGrabbable(pe))){var Oe=r.dragData.touchDragEles=q.collection(),qe=null;r.redrawHint("eles",!0),r.redrawHint("drag",!0),pe.selected()?(qe=q.$(function(Ze){return Ze.selected()&&r.nodeIsGrabbable(Ze)}),y(qe,{addToList:Oe})):g(pe,{addToList:Oe}),f(pe);var yr=function(vr){return{originalEvent:T,type:vr,position:{x:U[0],y:U[1]}}};pe.emit(yr("grabon")),qe?qe.forEach(function(Ze){Ze.emit(yr("grab"))}):pe.emit(yr("grab"))}n(pe,["touchstart","tapstart","vmousedown"],T,{x:U[0],y:U[1]}),pe==null&&(r.data.bgActivePosistion={x:V[0],y:V[1]},r.redrawHint("select",!0),r.redraw()),r.touchData.singleTouchMoved=!1,r.touchData.singleTouchStartTime=+new Date,clearTimeout(r.touchData.tapholdTimeout),r.touchData.tapholdTimeout=setTimeout(function(){r.touchData.singleTouchMoved===!1&&!r.pinching&&!r.touchData.selecting&&n(r.touchData.start,["taphold"],T,{x:U[0],y:U[1]})},r.tapholdDuration)}}if(T.touches.length>=1){for(var mr=r.touchData.startPosition=[null,null,null,null,null,null],He=0;He<U.length;He++)mr[He]=F[He]=U[He];var Xe=T.touches[0];r.touchData.startGPosition=[Xe.clientX,Xe.clientY]}}},!1);var J;r.registerBinding(e,"touchmove",J=function(T){var q=r.touchData.capture;if(!(!q&&!A(T))){var U=r.selection,F=r.cy,V=r.touchData.now,ne=r.touchData.earlier,Y=F.zoom();if(T.touches[0]){var ie=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);V[0]=ie[0],V[1]=ie[1]}if(T.touches[1]){var ie=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);V[2]=ie[0],V[3]=ie[1]}if(T.touches[2]){var ie=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);V[4]=ie[0],V[5]=ie[1]}var ce=r.touchData.startGPosition,Ee;if(q&&T.touches[0]&&ce){for(var ve=[],be=0;be<V.length;be++)ve[be]=V[be]-ne[be];var we=T.touches[0].clientX-ce[0],pe=we*we,Oe=T.touches[0].clientY-ce[1],qe=Oe*Oe,yr=pe+qe;Ee=yr>=r.touchTapThreshold2}if(q&&r.touchData.cxt){T.preventDefault();var mr=T.touches[0].clientX-X,He=T.touches[0].clientY-Z,Xe=T.touches[1].clientX-X,Ze=T.touches[1].clientY-Z,vr=N(mr,He,Xe,Ze),fr=vr/z,Rr=150,wr=Rr*Rr,Mr=1.5,Vr=Mr*Mr;if(fr>=Vr||vr>=wr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var _r={originalEvent:T,type:"cxttapend",position:{x:V[0],y:V[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(_r),r.touchData.start=null):F.emit(_r)}}if(q&&r.touchData.cxt){var _r={originalEvent:T,type:"cxtdrag",position:{x:V[0],y:V[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(_r):F.emit(_r),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var or=r.findNearestElement(V[0],V[1],!0,!0);(!r.touchData.cxtOver||or!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:V[0],y:V[1]}}),r.touchData.cxtOver=or,or&&or.emit({originalEvent:T,type:"cxtdragover",position:{x:V[0],y:V[1]}}))}else if(q&&T.touches[2]&&F.boxSelectionEnabled())T.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||F.emit({originalEvent:T,type:"boxstart",position:{x:V[0],y:V[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,U[4]=1,!U||U.length===0||U[0]===void 0?(U[0]=(V[0]+V[2]+V[4])/3,U[1]=(V[1]+V[3]+V[5])/3,U[2]=(V[0]+V[2]+V[4])/3+1,U[3]=(V[1]+V[3]+V[5])/3+1):(U[2]=(V[0]+V[2]+V[4])/3,U[3]=(V[1]+V[3]+V[5])/3),r.redrawHint("select",!0),r.redraw();else if(q&&T.touches[1]&&!r.touchData.didSelect&&F.zoomingEnabled()&&F.panningEnabled()&&F.userZoomingEnabled()&&F.userPanningEnabled()){T.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Qe=r.dragData.touchDragEles;if(Qe){r.redrawHint("drag",!0);for(var dr=0;dr<Qe.length;dr++){var Oa=Qe[dr]._private;Oa.grabbed=!1,Oa.rscratch.inDragLayer=!1}}var Lr=r.touchData.start,mr=T.touches[0].clientX-X,He=T.touches[0].clientY-Z,Xe=T.touches[1].clientX-X,Ze=T.touches[1].clientY-Z,as=K(mr,He,Xe,Ze),Pf=as/H;if(re){var Af=mr-I,Bf=He-M,Rf=Xe-O,Mf=Ze-_,Lf=(Af+Rf)/2,If=(Bf+Mf)/2,Jt=F.zoom(),qn=Jt*Pf,Na=F.pan(),ns=W[0]*Jt+Na.x,is=W[1]*Jt+Na.y,Of={x:-qn/Jt*(ns-Na.x-Lf)+ns,y:-qn/Jt*(is-Na.y-If)+is};if(Lr&&Lr.active()){var Qe=r.dragData.touchDragEles;p(Qe),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Lr.unactivate().emit("freeon"),Qe.emit("free"),r.dragData.didDrag&&(Lr.emit("dragfreeon"),Qe.emit("dragfree"))}F.viewport({zoom:qn,pan:Of,cancelOnFailedZoom:!0}),F.emit("pinchzoom"),H=as,I=mr,M=He,O=Xe,_=Ze,r.pinching=!0}if(T.touches[0]){var ie=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);V[0]=ie[0],V[1]=ie[1]}if(T.touches[1]){var ie=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);V[2]=ie[0],V[3]=ie[1]}if(T.touches[2]){var ie=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);V[4]=ie[0],V[5]=ie[1]}}else if(T.touches[0]&&!r.touchData.didSelect){var Sr=r.touchData.start,Vn=r.touchData.last,or;if(!r.hoverData.draggingEles&&!r.swipePanning&&(or=r.findNearestElement(V[0],V[1],!0,!0)),q&&Sr!=null&&T.preventDefault(),q&&Sr!=null&&r.nodeIsDraggable(Sr))if(Ee){var Qe=r.dragData.touchDragEles,os=!r.dragData.didDrag;os&&y(Qe,{inDragLayer:!0}),r.dragData.didDrag=!0;var jt={x:0,y:0};if(ae(ve[0])&&ae(ve[1])&&(jt.x+=ve[0],jt.y+=ve[1],os)){r.redrawHint("eles",!0);var Dr=r.touchData.dragDelta;Dr&&ae(Dr[0])&&ae(Dr[1])&&(jt.x+=Dr[0],jt.y+=Dr[1])}r.hoverData.draggingEles=!0,Qe.silentShift(jt).emit("position drag"),r.redrawHint("drag",!0),r.touchData.startPosition[0]==ne[0]&&r.touchData.startPosition[1]==ne[1]&&r.redrawHint("eles",!0),r.redraw()}else{var Dr=r.touchData.dragDelta=r.touchData.dragDelta||[];Dr.length===0?(Dr.push(ve[0]),Dr.push(ve[1])):(Dr[0]+=ve[0],Dr[1]+=ve[1])}if(n(Sr||or,["touchmove","tapdrag","vmousemove"],T,{x:V[0],y:V[1]}),(!Sr||!Sr.grabbed())&&or!=Vn&&(Vn&&Vn.emit({originalEvent:T,type:"tapdragout",position:{x:V[0],y:V[1]}}),or&&or.emit({originalEvent:T,type:"tapdragover",position:{x:V[0],y:V[1]}})),r.touchData.last=or,q)for(var dr=0;dr<V.length;dr++)V[dr]&&r.touchData.startPosition[dr]&&Ee&&(r.touchData.singleTouchMoved=!0);if(q&&(Sr==null||Sr.pannable())&&F.panningEnabled()&&F.userPanningEnabled()){var Nf=o(Sr,r.touchData.starts);Nf&&(T.preventDefault(),r.data.bgActivePosistion||(r.data.bgActivePosistion=Lt(r.touchData.startPosition)),r.swipePanning?(F.panBy({x:ve[0]*Y,y:ve[1]*Y}),F.emit("dragpan")):Ee&&(r.swipePanning=!0,F.panBy({x:we*Y,y:Oe*Y}),F.emit("dragpan"),Sr&&(Sr.unactivate(),r.redrawHint("select",!0),r.touchData.start=null)));var ie=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);V[0]=ie[0],V[1]=ie[1]}}for(var be=0;be<V.length;be++)ne[be]=V[be];q&&T.touches.length>0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var te;r.registerBinding(e,"touchcancel",te=function(T){var q=r.touchData.start;r.touchData.capture=!1,q&&q.unactivate()});var le,xe,Ie,Ae;if(r.registerBinding(e,"touchend",le=function(T){var q=r.touchData.start,U=r.touchData.capture;if(U)T.touches.length===0&&(r.touchData.capture=!1),T.preventDefault();else return;var F=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var V=r.cy,ne=V.zoom(),Y=r.touchData.now,ie=r.touchData.earlier;if(T.touches[0]){var ce=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Y[0]=ce[0],Y[1]=ce[1]}if(T.touches[1]){var ce=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Y[2]=ce[0],Y[3]=ce[1]}if(T.touches[2]){var ce=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Y[4]=ce[0],Y[5]=ce[1]}q&&q.unactivate();var Ee;if(r.touchData.cxt){if(Ee={originalEvent:T,type:"cxttapend",position:{x:Y[0],y:Y[1]}},q?q.emit(Ee):V.emit(Ee),!r.touchData.cxtDragged){var ve={originalEvent:T,type:"cxttap",position:{x:Y[0],y:Y[1]}};q?q.emit(ve):V.emit(ve)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!T.touches[2]&&V.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var be=V.collection(r.getAllInBox(F[0],F[1],F[2],F[3]));F[0]=void 0,F[1]=void 0,F[2]=void 0,F[3]=void 0,F[4]=0,r.redrawHint("select",!0),V.emit({type:"boxend",originalEvent:T,position:{x:Y[0],y:Y[1]}});var we=function(wr){return wr.selectable()&&!wr.selected()};be.emit("box").stdFilter(we).select().emit("boxselect"),be.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(q!=null&&q.unactivate(),T.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var pe=r.dragData.touchDragEles;if(q!=null){var Oe=q._private.grabbed;p(pe),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Oe&&(q.emit("freeon"),pe.emit("free"),r.dragData.didDrag&&(q.emit("dragfreeon"),pe.emit("dragfree"))),n(q,["touchend","tapend","vmouseup","tapdragout"],T,{x:Y[0],y:Y[1]}),q.unactivate(),r.touchData.start=null}else{var qe=r.findNearestElement(Y[0],Y[1],!0,!0);n(qe,["touchend","tapend","vmouseup","tapdragout"],T,{x:Y[0],y:Y[1]})}var yr=r.touchData.startPosition[0]-Y[0],mr=yr*yr,He=r.touchData.startPosition[1]-Y[1],Xe=He*He,Ze=mr+Xe,vr=Ze*ne*ne;r.touchData.singleTouchMoved||(q||V.$(":selected").unselect(["tapunselect"]),n(q,["tap","vclick"],T,{x:Y[0],y:Y[1]}),xe=!1,T.timeStamp-Ae<=V.multiClickDebounceTime()?(Ie&&clearTimeout(Ie),xe=!0,Ae=null,n(q,["dbltap","vdblclick"],T,{x:Y[0],y:Y[1]})):(Ie=setTimeout(function(){xe||n(q,["onetap","voneclick"],T,{x:Y[0],y:Y[1]})},V.multiClickDebounceTime()),Ae=T.timeStamp)),q!=null&&!r.dragData.didDrag&&q._private.selectable&&vr<r.touchTapThreshold2&&!r.pinching&&(V.selectionType()==="single"?(V.$(t).unmerge(q).unselect(["tapunselect"]),q.select(["tapselect"])):q.selected()?q.unselect(["tapunselect"]):q.select(["tapselect"]),r.redrawHint("eles",!0)),r.touchData.singleTouchMoved=!0}}}for(var fr=0;fr<Y.length;fr++)ie[fr]=Y[fr];r.dragData.didDrag=!1,T.touches.length===0&&(r.touchData.dragDelta=[],r.touchData.startPosition=[null,null,null,null,null,null],r.touchData.startGPosition=null,r.touchData.didSelect=!1),T.touches.length<2&&(T.touches.length===1&&(r.touchData.startGPosition=[T.touches[0].clientX,T.touches[0].clientY]),r.pinching=!1,r.redrawHint("eles",!0),r.redraw())},!1),typeof TouchEvent>"u"){var oe=[],ue=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},he=function(T){return{event:T,touch:ue(T)}},ye=function(T){oe.push(he(T))},de=function(T){for(var q=0;q<oe.length;q++){var U=oe[q];if(U.event.pointerId===T.pointerId){oe.splice(q,1);return}}},me=function(T){var q=oe.filter(function(U){return U.event.pointerId===T.pointerId})[0];q.event=T,q.touch=ue(T)},Ce=function(T){T.touches=oe.map(function(q){return q.touch})},Se=function(T){return T.pointerType==="mouse"||T.pointerType===4};r.registerBinding(r.container,"pointerdown",function(j){Se(j)||(j.preventDefault(),ye(j),Ce(j),$(j))}),r.registerBinding(r.container,"pointerup",function(j){Se(j)||(de(j),Ce(j),le(j))}),r.registerBinding(r.container,"pointercancel",function(j){Se(j)||(de(j),Ce(j),te(j))}),r.registerBinding(r.container,"pointermove",function(j){Se(j)||(j.preventDefault(),me(j),Ce(j),J(j))})}};var Wr={};Wr.generatePolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,draw:function(a,n,i,o,s,l){this.renderer.nodeShapeImpl("polygon",a,n,i,o,s,this.points)},intersectLine:function(a,n,i,o,s,l,u,v){return ya(s,l,this.points,a,n,i/2,o/2,u)},checkPoint:function(a,n,i,o,s,l,u,v){return Ur(a,n,this.points,l,u,o,s,[0,-1],i)}}};Wr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,o,s,l){return yh(i,o,e,t,a/2+s,n/2+s)},checkPoint:function(e,t,a,n,i,o,s,l){return pt(e,t,n,i,o,s,a)}}};Wr.generateRoundPolygon=function(r,e){return this.nodeShapes[r]={renderer:this,name:r,points:e,getOrCreateCorners:function(a,n,i,o,s,l,u){if(l[u]!==void 0&&l[u+"-cx"]===a&&l[u+"-cy"]===n)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=a,l[u+"-cy"]=n;var v=i/2,f=o/2;s=s==="auto"?ov(i,o):s;for(var c=new Array(e.length/2),d=0;d<e.length/2;d++)c[d]={x:a+v*e[d*2],y:n+f*e[d*2+1]};var h,y,g,p,m=c.length;for(y=c[m-1],h=0;h<m;h++)g=c[h%m],p=c[(h+1)%m],l[u][h]=Jo(y,g,p,s),y=g,g=p;return l[u]},draw:function(a,n,i,o,s,l,u){this.renderer.nodeShapeImpl("round-polygon",a,n,i,o,s,this.points,this.getOrCreateCorners(n,i,o,s,l,u,"drawCorners"))},intersectLine:function(a,n,i,o,s,l,u,v,f){return mh(s,l,this.points,a,n,i,o,u,this.getOrCreateCorners(a,n,i,o,v,f,"corners"))},checkPoint:function(a,n,i,o,s,l,u,v,f){return ph(a,n,this.points,l,u,o,s,this.getOrCreateCorners(l,u,o,s,v,f,"corners"))}}};Wr.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:cr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,o)},intersectLine:function(e,t,a,n,i,o,s,l){return nv(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){var u=n/2,v=i/2;l=l==="auto"?mt(n,i):l,l=Math.min(u,v,l);var f=l*2;return!!(Ur(e,t,this.points,o,s,n,i-f,[0,-1],a)||Ur(e,t,this.points,o,s,n-f,i,[0,-1],a)||pt(e,t,f,f,o-u+l,s-v+l,a)||pt(e,t,f,f,o+u-l,s-v+l,a)||pt(e,t,f,f,o+u-l,s+v-l,a)||pt(e,t,f,f,o-u+l,s+v-l,a))}}};Wr.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:_o(),points:cr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,null,o)},generateCutTrianglePts:function(e,t,a,n,i){var o=i==="auto"?this.cornerLength:i,s=t/2,l=e/2,u=a-l,v=a+l,f=n-s,c=n+s;return{topLeft:[u,f+o,u+o,f,u+o,f+o],topRight:[v-o,f,v,f+o,v-o,f+o],bottomRight:[v,c-o,v-o,c,v-o,c-o],bottomLeft:[u+o,c,u,c-o,u+o,c-o]}},intersectLine:function(e,t,a,n,i,o,s,l){var u=this.generateCutTrianglePts(a+2*s,n+2*s,e,t,l),v=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return ya(i,o,v,e,t)},checkPoint:function(e,t,a,n,i,o,s,l){var u=l==="auto"?this.cornerLength:l;if(Ur(e,t,this.points,o,s,n,i-2*u,[0,-1],a)||Ur(e,t,this.points,o,s,n-2*u,i,[0,-1],a))return!0;var v=this.generateCutTrianglePts(n,i,o,s);return gr(e,t,v.topLeft)||gr(e,t,v.topRight)||gr(e,t,v.bottomRight)||gr(e,t,v.bottomLeft)}}};Wr.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:cr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i)},intersectLine:function(e,t,a,n,i,o,s,l){var u=.15,v=.5,f=.85,c=this.generateBarrelBezierPts(a+2*s,n+2*s,e,t),d=function(g){var p=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},u),m=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},v),b=Nt({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f);return[g[0],g[1],p.x,p.y,m.x,m.y,b.x,b.y,g[4],g[5]]},h=[].concat(d(c.topLeft),d(c.topRight),d(c.bottomRight),d(c.bottomLeft));return ya(i,o,h,e,t)},generateBarrelBezierPts:function(e,t,a,n){var i=t/2,o=e/2,s=a-o,l=a+o,u=n-i,v=n+i,f=go(e,t),c=f.heightOffset,d=f.widthOffset,h=f.ctrlPtOffsetPct*e,y={topLeft:[s,u+c,s+h,u,s+d,u],topRight:[l-d,u,l-h,u,l,u+c],bottomRight:[l,v-c,l-h,v,l-d,v],bottomLeft:[s+d,v,s+h,v,s,v-c]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,t,a,n,i,o,s,l){var u=go(n,i),v=u.heightOffset,f=u.widthOffset;if(Ur(e,t,this.points,o,s,n,i-2*v,[0,-1],a)||Ur(e,t,this.points,o,s,n-2*f,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,o,s),d=function(S,k,A){var D=A[4],B=A[2],P=A[0],R=A[5],L=A[1],I=Math.min(D,P),M=Math.max(D,P),O=Math.min(R,L),_=Math.max(R,L);if(I<=S&&S<=M&&O<=k&&k<=_){var H=bh(D,B,P),z=ch(H[0],H[1],H[2],S),G=z.filter(function(W){return 0<=W&&W<=1});if(G.length>0)return G[0]}return null},h=Object.keys(c),y=0;y<h.length;y++){var g=h[y],p=c[g],m=d(e,t,p);if(m!=null){var b=p[5],w=p[3],E=p[1],C=Je(b,w,E,m);if(p.isTop&&C<=t||p.isBottom&&t<=C)return!0}}return!1}}};Wr.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:cr(4,0),draw:function(e,t,a,n,i,o){this.renderer.nodeShapeImpl(this.name,e,t,a,n,i,this.points,o)},intersectLine:function(e,t,a,n,i,o,s,l){var u=e-(a/2+s),v=t-(n/2+s),f=v,c=e+(a/2+s),d=Jr(i,o,e,t,u,v,c,f,!1);return d.length>0?d:nv(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){l=l==="auto"?mt(n,i):l;var u=2*l;if(Ur(e,t,this.points,o,s,n,i-u,[0,-1],a)||Ur(e,t,this.points,o,s,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[o-v,s-f,o-v,s,o+v,s,o+v,s-f];return!!(gr(e,t,c)||pt(e,t,u,u,o+n/2-l,s+i/2-l,a)||pt(e,t,u,u,o-n/2+l,s+i/2-l,a))}}};Wr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",cr(3,0)),this.generateRoundPolygon("round-triangle",cr(3,0)),this.generatePolygon("rectangle",cr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",cr(5,0)),this.generateRoundPolygon("round-pentagon",cr(5,0)),this.generatePolygon("hexagon",cr(6,0)),this.generateRoundPolygon("round-hexagon",cr(6,0)),this.generatePolygon("heptagon",cr(7,0)),this.generateRoundPolygon("round-heptagon",cr(7,0)),this.generatePolygon("octagon",cr(8,0)),this.generateRoundPolygon("round-octagon",cr(8,0));var a=new Array(20);{var n=ho(5,0),i=ho(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s<i.length/2;s++)i[s*2]*=o,i[s*2+1]*=o;for(var s=0;s<20/4;s++)a[s*4]=n[s*2],a[s*4+1]=n[s*2+1],a[s*4+2]=i[s*2],a[s*4+3]=i[s*2+1]}a=iv(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}r.makePolygon=function(u){var v=u.join("$"),f="polygon-"+v,c;return(c=this[f])?c:e.generatePolygon(f,u)}};var La={};La.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};La.redraw=function(r){r=r||jl();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=r};La.beforeRender=function(r,e){if(!this.destroyed){e==null&&Ve("Priority is not optional for beforeRender");var t=this.beforeRenderCallbacks;t.push({fn:r,priority:e}),t.sort(function(a,n){return n.priority-a.priority})}};var yl=function(e,t,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(t,a)};La.startRenderLoop=function(){var r=this,e=r.cy;if(!r.renderLoopStarted){r.renderLoopStarted=!0;var t=function(n){if(!r.destroyed){if(!e.batching())if(r.requestedFrame&&!r.skipFrame){yl(r,!0,n);var i=$r();r.render(r.renderOptions);var o=r.lastDrawTime=$r();r.averageRedrawTime===void 0&&(r.averageRedrawTime=o-i),r.redrawCount===void 0&&(r.redrawCount=0),r.redrawCount++,r.redrawTotalTime===void 0&&(r.redrawTotalTime=0);var s=o-i;r.redrawTotalTime+=s,r.lastRedrawTime=s,r.averageRedrawTime=r.averageRedrawTime/2+s/2,r.requestedFrame=!1}else yl(r,!1,n);r.skipFrame=!1,ln(t)}};ln(t)}};var Op=function(e){this.init(e)},of=Op,Zt=of.prototype;Zt.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Zt.init=function(r){var e=this;e.options=r,e.cy=r.cy;var t=e.container=r.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=n.getElementById(o)!=null;if(t.className.indexOf(s)<0&&(t.className=(t.className||"")+" "+s),!l){var u=n.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",i.insertBefore(u,i.children[0])}var v=a.getComputedStyle(t),f=v.getPropertyValue("position");f==="static"&&Re("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},e.redraws=0,e.showFps=r.showFps,e.debug=r.debug,e.webgl=r.webgl,e.hideEdgesOnViewport=r.hideEdgesOnViewport,e.textureOnViewport=r.textureOnViewport,e.wheelSensitivity=r.wheelSensitivity,e.motionBlurEnabled=r.motionBlur,e.forcedPixelRatio=ae(r.pixelRatio)?r.pixelRatio:null,e.motionBlur=r.motionBlur,e.motionBlurOpacity=r.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=r.desktopTapThreshold,e.desktopTapThreshold2=r.desktopTapThreshold*r.desktopTapThreshold,e.touchTapThreshold=r.touchTapThreshold,e.touchTapThreshold2=r.touchTapThreshold*r.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Zt.notify=function(r,e){var t=this,a=t.cy;if(!this.destroyed){if(r==="init"){t.load();return}if(r==="destroy"){t.destroy();return}(r==="add"||r==="remove"||r==="move"&&a.hasCompoundNodes()||r==="load"||r==="zorder"||r==="mount")&&t.invalidateCachedZSortedEles(),r==="viewport"&&t.redrawHint("select",!0),r==="gc"&&t.redrawHint("gc",!0),(r==="load"||r==="resize"||r==="mount")&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container)),t.redrawHint("eles",!0),t.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Zt.destroy=function(){var r=this;r.destroyed=!0,r.cy.stopAnimationLoop();for(var e=0;e<r.bindings.length;e++){var t=r.bindings[e],a=t,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(r.bindings=[],r.beforeRenderCallbacks=[],r.onUpdateEleCalcsFns=[],r.removeObserver&&r.removeObserver.disconnect(),r.styleObserver&&r.styleObserver.disconnect(),r.resizeObserver&&r.resizeObserver.disconnect(),r.labelCalcDiv)try{document.body.removeChild(r.labelCalcDiv)}catch{}};Zt.isHeadless=function(){return!1};[Qo,af,nf,Xt,Wr,La].forEach(function(r){ge(Zt,r)});var so=1e3/60,sf={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=Pa(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),o=function(u,v){var f=$r(),c=n.averageRedrawTime,d=n.lastRedrawTime,h=[],y=n.cy.extent(),g=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var p=$r(),m=p-f,b=p-v;if(d<so){var w=so-(u?c:0);if(b>=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*d||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*so)break;var E=e.deq(a,g,y);if(E.length>0)for(var C=0;C<E.length;C++)h.push(E[C]);else break}h.length>0&&(e.onDeqd(a,h),!u&&e.shouldRedraw(a,h,g,y)&&i())},s=e.priority||zo;n.beforeRender(o,s(a))}}}},Np=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vn;st(this,r),this.idsByKey=new Kr,this.keyForId=new Kr,this.cachesByLvl=new Kr,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return ut(r,[{key:"getIdsFor",value:function(t){t==null&&Ve("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new $t,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Kr,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}])}(),ml=25,Ya=50,on=-4,Po=3,uf=7.99,zp=8,Fp=1024,qp=1024,Vp=1024,_p=.2,Gp=.8,Hp=10,Kp=.15,$p=.1,Up=.9,Wp=.9,Yp=100,Xp=1,Ot={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Zp=We({getKey:null,doesEleInvalidateKey:vn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Zl,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),la=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=Zp(t);ge(a,n),a.lookup=new Np(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ye=la.prototype;Ye.reasons=Ot;Ye.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ye.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ye.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Aa(function(t,a){return a.reqs-t.reqs});return e};Ye.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ye.getElement=function(r,e,t,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(qo(s*t))),a<on)a=on;else if(s>=uf||a>Po)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=o.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var d=l.get(r,a);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var h;if(v<=ml?h=ml:v<=Ya?h=Ya:h=Math.ceil(v/Ya)*Ya,v>Vp||f>qp)return null;var y=i.getTextureQueue(h),g=y[y.length-2],p=function(){return i.recycleTexture(h,f)||i.addTexture(h,f)};g||(g=y[y.length-1]),g||(g=p()),g.width-g.usedWidth<f&&(g=p());for(var m=function(I){return I&&I.scaledLabelShown===c},b=n&&n===Ot.dequeue,w=n&&n===Ot.highQuality,E=n&&n===Ot.downscale,C,x=a+1;x<=Po;x++){var S=l.get(r,x);if(S){C=S;break}}var k=C&&C.level===a+1?C:null,A=function(){g.context.drawImage(k.texture.canvas,k.x,0,k.width,k.height,g.usedWidth,0,f,v)};if(g.context.setTransform(1,0,0,1,0,0),g.context.clearRect(g.usedWidth,0,f,h),m(k))A();else if(m(C))if(w){for(var D=C.level;D>a;D--)k=i.getElement(r,e,t,D,Ot.downscale);A()}else return i.queueElement(r,C.level-1),C;else{var B;if(!b&&!w&&!E)for(var P=a-1;P>=on;P--){var R=l.get(r,P);if(R){B=R;break}}if(m(B))return i.queueElement(r,a),B;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,r,e,c,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return d={x:g.usedWidth,texture:g,level:a,scale:u,width:f,height:v,scaledLabelShown:c},g.usedWidth+=Math.ceil(f+zp),g.eleCaches.push(d),l.set(r,a,d),i.checkTextureFullness(g),d};Ye.invalidateElements=function(r){for(var e=0;e<r.length;e++)this.invalidateElement(r[e])};Ye.invalidateElement=function(r){var e=this,t=e.lookup,a=[],n=t.isInvalid(r);if(n){for(var i=on;i<=Po;i++){var o=t.getForCachedKey(r,i);o&&a.push(o)}var s=t.invalidate(r);if(s)for(var l=0;l<a.length;l++){var u=a[l],v=u.texture;v.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(v)}e.removeFromQueue(r)}};Ye.checkTextureUtility=function(r){r.invalidatedWidth>=_p*r.width&&this.retireTexture(r)};Ye.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Gp&&r.fullnessChecks>=Hp?at(t,r):r.fullnessChecks++};Ye.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;at(a,r),r.retired=!0;for(var i=r.eleCaches,o=0;o<i.length;o++){var s=i[o];n.deleteCache(s.key,s.level)}Fo(i);var l=e.getRetiredTextureQueue(t);l.push(r)};Ye.addTexture=function(r,e){var t=this,a=t.getTextureQueue(r),n={};return a.push(n),n.eleCaches=[],n.height=r,n.width=Math.max(Fp,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=t.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};Ye.recycleTexture=function(r,e){for(var t=this,a=t.getTextureQueue(r),n=t.getRetiredTextureQueue(r),i=0;i<n.length;i++){var o=n[i];if(o.width>=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Fo(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),at(n,o),a.push(o),o}};Ye.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,a.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(s),n[i]=s}};Ye.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o<Xp&&t.size()>0;o++){var s=t.pop(),l=s.key,u=s.eles[0],v=i.hasCache(u,s.level);if(a[l]=null,v)continue;n.push(s);var f=e.getBoundingBox(u);e.getElement(u,f,r,s.level,Ot.dequeue)}return n};Ye.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=No,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ye.onDequeue=function(r){this.onDequeues.push(r)};Ye.offDequeue=function(r){at(this.onDequeues,r)};Ye.setupDequeueing=sf.setupDequeueing({deqRedrawThreshold:Yp,deqCost:Kp,deqAvgCost:$p,deqNoDrawCost:Up,deqFastCost:Wp,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(t)}},shouldRedraw:function(e,t,a,n){for(var i=0;i<t.length;i++)for(var o=t[i].eles,s=0;s<o.length;s++){var l=o[s].boundingBox();if(Vo(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Qp=1,fa=-4,mn=2,Jp=3.99,jp=50,ey=50,ry=.15,ty=.1,ay=.9,ny=.9,iy=1,bl=250,oy=4e3*4e3,wl=32767,sy=!0,lf=function(e){var t=this,a=t.renderer=e,n=a.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=$r()-2*bl,t.skipping=!1,t.eleTxrDeqs=n.collection(),t.scheduleElementRefinement=Pa(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},ey),a.beforeRender(function(o,s){s-t.lastInvalidationTime<=bl?t.skipping=!0:t.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(s,l){return l.reqs-s.reqs};t.layersQueue=new Aa(i),t.setupDequeueing()},ir=lf.prototype,xl=0,uy=Math.pow(2,53)-1;ir.makeLayer=function(r,e){var t=Math.pow(2,e),a=Math.ceil(r.w*t),n=Math.ceil(r.h*t),i=this.renderer.makeOffscreenCanvas(a,n),o={id:xl=++xl%uy,bb:r,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=o.context,l=-o.bb.x1,u=-o.bb.y1;return s.scale(t,t),s.translate(l,u),o};ir.getLayers=function(r,e,t){var a=this,n=a.renderer,i=n.cy,o=i.zoom(),s=a.firstGet;if(a.firstGet=!1,t==null){if(t=Math.ceil(qo(o*e)),t<fa)t=fa;else if(o>=Jp||t>mn)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[],f,c=a.levelIsComplete(t,r),d,h=function(){var A=function(L){if(a.validateLayersElesOrdering(L,r),a.levelIsComplete(L,r))return d=l[L],!0},D=function(L){if(!d)for(var I=t+L;fa<=I&&I<=mn&&!A(I);I+=L);};D(1),D(-1);for(var B=v.length-1;B>=0;B--){var P=v[B];P.invalid&&at(v,P)}};if(!c)h();else return v;var y=function(){if(!f){f=pr();for(var A=0;A<r.length;A++)tv(f,r[A].boundingBox())}return f},g=function(A){A=A||{};var D=A.after;y();var B=Math.ceil(f.w*u),P=Math.ceil(f.h*u);if(B>wl||P>wl)return null;var R=B*P;if(R>oy)return null;var L=a.makeLayer(f,t);if(D!=null){var I=v.indexOf(D)+1;v.splice(I,0,L)}else(A.insert===void 0||A.insert)&&v.unshift(L);return L};if(a.skipping&&!s)return null;for(var p=null,m=r.length/Qp,b=!s,w=0;w<r.length;w++){var E=r[w],C=E._private.rscratch,x=C.imgLayerCaches=C.imgLayerCaches||{},S=x[t];if(S){p=S;continue}if((!p||p.eles.length>=m||!av(p.bb,E.boundingBox()))&&(p=g({insert:!0,after:p}),!p))return null;d||b?a.queueLayer(p,E):a.drawEleInLayer(p,E,t,e),p.eles.push(E),x[t]=p}return d||(b?null:v)};ir.getEleLevelForLayerLevel=function(r,e){return r};ir.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,sy),i.setImgSmoothing(o,!0))};ir.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var o=a[i];if(o.reqs>0||o.invalid)return!1;n+=o.eles.length}return n===e.length};ir.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a<t.length;a++){for(var n=t[a],i=-1,o=0;o<e.length;o++)if(n.eles[0]===e[o]){i=o;break}if(i<0){this.invalidateLayer(n);continue}for(var s=i,o=0;o<n.eles.length;o++)if(n.eles[o]!==e[s+o]){this.invalidateLayer(n);break}}};ir.updateElementsInLayers=function(r,e){for(var t=this,a=Ta(r[0]),n=0;n<r.length;n++)for(var i=a?null:r[n],o=a?r[n]:r[n].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=fa;u<=mn;u++){var v=l[u];v&&(i&&t.getEleLevelForLayerLevel(v.level)!==i.level||e(v,o,i))}};ir.haveLayers=function(){for(var r=this,e=!1,t=fa;t<=mn;t++){var a=r.layersByLevel[t];if(a&&a.length>0){e=!0;break}}return e};ir.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=$r(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};ir.invalidateLayer=function(r){if(this.lastInvalidationTime=$r(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];at(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n<t.length;n++){var i=t[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};ir.refineElementTextures=function(r){var e=this;e.updateElementsInLayers(r,function(a,n,i){var o=a.replacement;if(o||(o=a.replacement=e.makeLayer(a.bb,a.level),o.replaces=a,o.eles=a.eles),!o.reqs)for(var s=0;s<o.eles.length;s++)e.queueLayer(o,o.eles[s])})};ir.enqueueElementRefinement=function(r){this.eleTxrDeqs.merge(r),this.scheduleElementRefinement()};ir.queueLayer=function(r,e){var t=this,a=t.layersQueue,n=r.elesQueue,i=n.hasId=n.hasId||{};if(!r.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}r.reqs?(r.reqs++,a.updateItem(r)):(r.reqs=1,a.push(r))}};ir.dequeue=function(r){for(var e=this,t=e.layersQueue,a=[],n=0;n<iy&&t.size()!==0;){var i=t.peek();if(i.replacement){t.pop();continue}if(i.replaces&&i!==i.replaces.replacement){t.pop();continue}if(i.invalid){t.pop();continue}var o=i.elesQueue.shift();o&&(e.drawEleInLayer(i,o,i.level,r),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(t.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};ir.applyLayerReplacement=function(r){var e=this,t=e.layersByLevel[r.level],a=r.replaces,n=t.indexOf(a);if(!(n<0||a.invalid)){t[n]=r;for(var i=0;i<r.eles.length;i++){var o=r.eles[i]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[r.level]=r)}e.requestRedraw()}};ir.requestRedraw=Pa(function(){var r=this.renderer;r.redrawHint("eles",!0),r.redrawHint("drag",!0),r.redraw()},100);ir.setupDequeueing=sf.setupDequeueing({deqRedrawThreshold:jp,deqCost:ry,deqAvgCost:ty,deqNoDrawCost:ay,deqFastCost:ny,deq:function(e,t){return e.dequeue(t)},onDeqd:zo,shouldRedraw:Zl,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var vf={},El;function ly(r,e){for(var t=0;t<e.length;t++){var a=e[t];r.lineTo(a.x,a.y)}}function vy(r,e,t){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),r.lineTo(i.x,i.y)}r.quadraticCurveTo(t.x,t.y,a.x,a.y)}function Cl(r,e,t){r.beginPath&&r.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];r.lineTo(i.x,i.y)}var o=t,s=t[0];r.moveTo(s.x,s.y);for(var n=1;n<o.length;n++){var i=o[n];r.lineTo(i.x,i.y)}r.closePath&&r.closePath()}function fy(r,e,t,a,n){r.beginPath&&r.beginPath(),r.arc(t,a,n,0,Math.PI*2,!1);var i=e,o=i[0];r.moveTo(o.x,o.y);for(var s=0;s<i.length;s++){var l=i[s];r.lineTo(l.x,l.y)}r.closePath&&r.closePath()}function cy(r,e,t,a){r.arc(e,t,a,0,Math.PI*2,!1)}vf.arrowShapeImpl=function(r){return(El||(El={polygon:ly,"triangle-backcurve":vy,"triangle-tee":Cl,"circle-triangle":fy,"triangle-cross":Cl,circle:cy}))[r]};var qr={};qr.drawElement=function(r,e,t,a,n,i){var o=this;e.isNode()?o.drawNode(r,e,t,a,n,i):o.drawEdge(r,e,t,a,n,i)};qr.drawElementOverlay=function(r,e){var t=this;e.isNode()?t.drawNodeOverlay(r,e):t.drawEdgeOverlay(r,e)};qr.drawElementUnderlay=function(r,e){var t=this;e.isNode()?t.drawNodeUnderlay(r,e):t.drawEdgeUnderlay(r,e)};qr.drawCachedElementPortion=function(r,e,t,a,n,i,o,s){var l=this,u=t.getBoundingBox(e);if(!(u.w===0||u.h===0)){var v=t.getElement(e,u,a,n,i);if(v!=null){var f=s(l,e);if(f===0)return;var c=o(l,e),d=u.x1,h=u.y1,y=u.w,g=u.h,p,m,b,w,E;if(c!==0){var C=t.getRotationPoint(e);b=C.x,w=C.y,r.translate(b,w),r.rotate(c),E=l.getImgSmoothing(r),E||l.setImgSmoothing(r,!0);var x=t.getRotationOffset(e);p=x.x,m=x.y}else p=d,m=h;var S;f!==1&&(S=r.globalAlpha,r.globalAlpha=S*f),r.drawImage(v.texture.canvas,v.x,0,v.width,v.height,p,m,y,g),f!==1&&(r.globalAlpha=S),c!==0&&(r.rotate(-c),r.translate(-b,-w),E||l.setImgSmoothing(r,!1))}else t.drawElement(r,e)}};var hy=function(){return 0},dy=function(e,t){return e.getTextAngle(t,null)},gy=function(e,t){return e.getTextAngle(t,"source")},py=function(e,t){return e.getTextAngle(t,"target")},yy=function(e,t){return t.effectiveOpacity()},uo=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};qr.drawCachedElement=function(r,e,t,a,n,i){var o=this,s=o.data,l=s.eleTxrCache,u=s.lblTxrCache,v=s.slbTxrCache,f=s.tlbTxrCache,c=e.boundingBox(),d=i===!0?l.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||Vo(c,a))){var h=e.isEdge(),y=e.element()._private.rscratch.badLine;o.drawElementUnderlay(r,e),o.drawCachedElementPortion(r,e,l,t,n,d,hy,yy),(!h||!y)&&o.drawCachedElementPortion(r,e,u,t,n,d,dy,uo),h&&!y&&(o.drawCachedElementPortion(r,e,v,t,n,d,gy,uo),o.drawCachedElementPortion(r,e,f,t,n,d,py,uo)),o.drawElementOverlay(r,e)}};qr.drawElements=function(r,e){for(var t=this,a=0;a<e.length;a++){var n=e[a];t.drawElement(r,n)}};qr.drawCachedElements=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];n.drawCachedElement(r,o,t,a)}};qr.drawCachedNodes=function(r,e,t,a){for(var n=this,i=0;i<e.length;i++){var o=e[i];o.isNode()&&n.drawCachedElement(r,o,t,a)}};qr.drawLayeredElements=function(r,e,t,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,t);if(i)for(var o=0;o<i.length;o++){var s=i[o],l=s.bb;l.w===0||l.h===0||r.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(r,e,t,a)};var Yr={};Yr.drawEdge=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,h=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,p=u*v,m=u*v,b=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;f==="straight-triangle"?(o.eleStrokeStyle(r,e,L),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=d,r.lineCap=h,o.eleStrokeStyle(r,e,L),o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},w=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;if(r.lineWidth=d+y,r.lineCap=h,y>0)o.colorStrokeStyle(r,g[0],g[1],g[2],L);else{r.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},E=function(){n&&o.drawEdgeOverlay(r,e)},C=function(){n&&o.drawEdgeUnderlay(r,e)},x=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(r,e,L)},S=function(){o.drawElementText(r,e,null,a)};r.lineJoin="round";var k=e.pstyle("ghost").value==="yes";if(k){var A=e.pstyle("ghost-offset-x").pfValue,D=e.pstyle("ghost-offset-y").pfValue,B=e.pstyle("ghost-opacity").value,P=p*B;r.translate(A,D),b(P),x(P),r.translate(-A,-D)}else w();C(),b(),x(),E(),S(),t&&r.translate(l.x1,l.y1)}};var ff=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,s.allpts,"solid")}}}};Yr.drawEdgeOverlay=ff("overlay");Yr.drawEdgeUnderlay=ff("underlay");Yr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,o,s=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=f,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<t.length;d+=4)e.quadraticCurveTo(t[d],t[d+1],t[d+2],t[d+3]);break;case"straight":case"haystack":for(var h=2;h+1<t.length;h+=2)e.lineTo(t[h],t[h+1]);break;case"segments":if(n.isRound){var y=Pr(n.roundCorners),g;try{for(y.s();!(g=y.n()).done;){var p=g.value;Jv(e,p)}}catch(b){y.e(b)}finally{y.f()}e.lineTo(t[t.length-2],t[t.length-1])}else for(var m=2;m+1<t.length;m+=2)e.lineTo(t[m],t[m+1]);break}e=i,l?e.stroke(o):e.stroke(),e.setLineDash&&e.setLineDash([])};Yr.drawEdgeTrianglePath=function(r,e,t){e.fillStyle=e.strokeStyle;for(var a=r.pstyle("width").pfValue,n=0;n+1<t.length;n+=2){var i=[t[n+2]-t[n],t[n+3]-t[n+1]],o=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=[i[1]/o,-i[0]/o],l=[s[0]*a/2,s[1]*a/2];e.beginPath(),e.moveTo(t[n]-l[0],t[n+1]-l[1]),e.lineTo(t[n]+l[0],t[n+1]+l[1]),e.lineTo(t[n+2],t[n+3]),e.closePath(),e.fill()}};Yr.drawArrowheads=function(r,e,t){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(r,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,t),this.drawArrowhead(r,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,t),this.drawArrowhead(r,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,t),n||this.drawArrowhead(r,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,t)};Yr.drawArrowhead=function(r,e,t,a,n,i,o){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var s=this,l=e.pstyle(t+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(t+"-arrow-fill").value==="hollow"?"both":"filled",v=e.pstyle(t+"-arrow-fill").value,f=e.pstyle("width").pfValue,c=e.pstyle(t+"-arrow-width"),d=c.value==="match-line"?f:c.pfValue;c.units==="%"&&(d*=f);var h=e.pstyle("opacity").value;o===void 0&&(o=h);var y=r.globalCompositeOperation;(o!==1||v==="hollow")&&(r.globalCompositeOperation="destination-out",s.colorFillStyle(r,255,255,255,1),s.colorStrokeStyle(r,255,255,255,1),s.drawArrowShape(e,r,u,f,l,d,a,n,i),r.globalCompositeOperation=y);var g=e.pstyle(t+"-arrow-color").value;s.colorFillStyle(r,g[0],g[1],g[2],o),s.colorStrokeStyle(r,g[0],g[1],g[2],o),s.drawArrowShape(e,r,v,f,l,d,a,n,i)}}};Yr.drawArrowShape=function(r,e,t,a,n,i,o,s,l){var u=this,v=this.usePaths()&&n!=="triangle-cross",f=!1,c,d=e,h={x:o,y:s},y=r.pstyle("arrow-scale").value,g=this.getArrowWidth(a,y),p=u.arrowShapes[n];if(v){var m=u.arrowPathCache=u.arrowPathCache||[],b=tt(n),w=m[b];w!=null?(c=e=w,f=!0):(c=e=new Path2D,m[b]=c)}f||(e.beginPath&&e.beginPath(),v?p.draw(e,1,0,{x:0,y:0},1):p.draw(e,g,l,h,a),e.closePath&&e.closePath()),e=d,v&&(e.translate(o,s),e.rotate(l),e.scale(g,g)),(t==="filled"||t==="both")&&(v?e.fill(c):e.fill()),(t==="hollow"||t==="both")&&(e.lineWidth=i/(v?g:1),e.lineJoin="miter",v?e.stroke(c):e.stroke()),v&&(e.scale(1/g,1/g),e.rotate(-l),e.translate(-o,-s))};var es={};es.safeDrawImage=function(r,e,t,a,n,i,o,s,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{r.drawImage(e,t,a,n,i,o,s,l,u)}catch(v){Re(v)}};es.drawInscribedImage=function(r,e,t,a,n){var i=this,o=t.position(),s=o.x,l=o.y,u=t.cy().style(),v=u.getIndexedStyle.bind(u),f=v(t,"background-fit","value",a),c=v(t,"background-repeat","value",a),d=t.width(),h=t.height(),y=t.padding()*2,g=d+(v(t,"background-width-relative-to","value",a)==="inner"?0:y),p=h+(v(t,"background-height-relative-to","value",a)==="inner"?0:y),m=t._private.rscratch,b=v(t,"background-clip","value",a),w=b==="node",E=v(t,"background-image-opacity","value",a)*n,C=v(t,"background-image-smoothing","value",a),x=t.pstyle("corner-radius").value;x!=="auto"&&(x=t.pstyle("corner-radius").pfValue);var S=e.width||e.cachedW,k=e.height||e.cachedH;(S==null||k==null)&&(document.body.appendChild(e),S=e.cachedW=e.width||e.offsetWidth,k=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var A=S,D=k;if(v(t,"background-width","value",a)!=="auto"&&(v(t,"background-width","units",a)==="%"?A=v(t,"background-width","pfValue",a)*g:A=v(t,"background-width","pfValue",a)),v(t,"background-height","value",a)!=="auto"&&(v(t,"background-height","units",a)==="%"?D=v(t,"background-height","pfValue",a)*p:D=v(t,"background-height","pfValue",a)),!(A===0||D===0)){if(f==="contain"){var B=Math.min(g/A,p/D);A*=B,D*=B}else if(f==="cover"){var B=Math.max(g/A,p/D);A*=B,D*=B}var P=s-g/2,R=v(t,"background-position-x","units",a),L=v(t,"background-position-x","pfValue",a);R==="%"?P+=(g-A)*L:P+=L;var I=v(t,"background-offset-x","units",a),M=v(t,"background-offset-x","pfValue",a);I==="%"?P+=(g-A)*M:P+=M;var O=l-p/2,_=v(t,"background-position-y","units",a),H=v(t,"background-position-y","pfValue",a);_==="%"?O+=(p-D)*H:O+=H;var z=v(t,"background-offset-y","units",a),G=v(t,"background-offset-y","pfValue",a);z==="%"?O+=(p-D)*G:O+=G,m.pathCache&&(P-=s,O-=l,s=0,l=0);var W=r.globalAlpha;r.globalAlpha=E;var X=i.getImgSmoothing(r),Z=!1;if(C==="no"&&X?(i.setImgSmoothing(r,!1),Z=!0):C==="yes"&&!X&&(i.setImgSmoothing(r,!0),Z=!0),c==="no-repeat")w&&(r.save(),m.pathCache?r.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(t)].draw(r,s,l,g,p,x,m),r.clip())),i.safeDrawImage(r,e,0,0,S,k,P,O,A,D),w&&r.restore();else{var Q=r.createPattern(e,c);r.fillStyle=Q,i.nodeShapes[i.getNodeShape(t)].draw(r,s,l,g,p,x,m),r.translate(P,O),r.fill(),r.translate(-P,-O)}r.globalAlpha=W,Z&&i.setImgSmoothing(r,X)}};var Ct={};Ct.eleTextBiggerThanMin=function(r,e){if(!e){var t=r.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(qo(t*a));e=Math.pow(2,n)}var i=r.pstyle("font-size").pfValue*e,o=r.pstyle("min-zoomed-font-size").pfValue;return!(i<o)};Ct.drawElementText=function(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var d=!t,h;t&&(h=t,r.translate(-h.x1,-h.y1)),n==null?(o.drawText(r,e,null,d,i),e.isEdge()&&(o.drawText(r,e,"source",d,i),o.drawText(r,e,"target",d,i))):o.drawText(r,e,n,d,i),t&&r.translate(h.x1,h.y1)};Ct.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t<this.fontCaches.length;t++)if(e=this.fontCaches[t],e.context===r)return e;return e={context:r},this.fontCaches.push(e),e};Ct.setupTextStyle=function(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*s,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+o+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],s),this.colorStrokeStyle(r,v[0],v[1],v[2],l)};function lo(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),o?r.stroke():r.fill()}Ct.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation");if(o.strValue==="autorotate"){var s=Er(n,"labelAngle",e);t=r.isEdge()?s:0}else o.strValue==="none"?t=0:t=o.pfValue;return t};Ct.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var l=Er(o,"labelX",t),u=Er(o,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var d=t?t+"-":"",h=Er(o,"labelWidth",t),y=Er(o,"labelHeight",t),g=e.pstyle(d+"text-margin-x").pfValue,p=e.pstyle(d+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),l+=g,u+=p;var E;switch(a?E=this.getTextAngle(e,t):E=0,E!==0&&(v=l,f=u,r.translate(v,f),r.rotate(E),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var C=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,S=e.pstyle("text-border-width").pfValue,k=e.pstyle("text-background-padding").pfValue,A=e.pstyle("text-background-shape").strValue,D=A.indexOf("round")===0,B=2;if(C>0||S>0&&x>0){var P=l-k;switch(b){case"left":P-=h;break;case"center":P-=h/2;break}var R=u-y-k,L=h+2*k,I=y+2*k;if(C>0){var M=r.fillStyle,O=e.pstyle("text-background-color").value;r.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+C*s+")",D?lo(r,P,R,L,I,B):r.fillRect(P,R,L,I),r.fillStyle=M}if(S>0&&x>0){var _=r.strokeStyle,H=r.lineWidth,z=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+x*s+")",r.lineWidth=S,r.setLineDash)switch(G){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=S/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(D?lo(r,P,R,L,I,B,"stroke"):r.strokeRect(P,R,L,I),G==="double"){var W=S/2;D?lo(r,P+W,R+W,L-W*2,I-W*2,B,"stroke"):r.strokeRect(P+W,R+W,L-W*2,I-W*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=H,r.strokeStyle=_}}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(r.lineWidth=X),e.pstyle("text-wrap").value==="wrap"){var Z=Er(o,"labelWrapCachedLines",t),Q=Er(o,"labelLineHeight",t),ee=h/2,re=this.getLabelJustification(e);switch(re==="auto"||(b==="left"?re==="left"?l+=-h:re==="center"&&(l+=-ee):b==="center"?re==="left"?l+=-ee:re==="right"&&(l+=ee):b==="right"&&(re==="center"?l+=ee:re==="right"&&(l+=h))),w){case"top":u-=(Z.length-1)*Q;break;case"center":case"bottom":u-=(Z.length-1)*Q;break}for(var K=0;K<Z.length;K++)X>0&&r.strokeText(Z[K],l,u),r.fillText(Z[K],l,u),u+=Q}else X>0&&r.strokeText(c,l,u),r.fillText(c,l,u);E!==0&&(r.rotate(-E),r.translate(-v,-f))}}};var Qt={};Qt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,l,u=e._private,v=u.rscratch,f=e.position();if(!(!ae(f.x)||!ae(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,d=o.usePaths(),h,y=!1,g=e.padding();s=e.width()+2*g,l=e.height()+2*g;var p;t&&(p=t,r.translate(-p.x1,-p.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),E=new Array(b.length),C=0,x=0;x<b.length;x++){var S=b[x],k=w[x]=S!=null&&S!=="none";if(k){var A=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",x);C++,E[x]=o.getCachedImage(S,A,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var D=e.pstyle("background-blacken").value,B=e.pstyle("border-width").pfValue,P=e.pstyle("background-opacity").value*c,R=e.pstyle("border-color").value,L=e.pstyle("border-style").value,I=e.pstyle("border-join").value,M=e.pstyle("border-cap").value,O=e.pstyle("border-position").value,_=e.pstyle("border-dash-pattern").pfValue,H=e.pstyle("border-dash-offset").pfValue,z=e.pstyle("border-opacity").value*c,G=e.pstyle("outline-width").pfValue,W=e.pstyle("outline-color").value,X=e.pstyle("outline-style").value,Z=e.pstyle("outline-opacity").value*c,Q=e.pstyle("outline-offset").value,ee=e.pstyle("corner-radius").value;ee!=="auto"&&(ee=e.pstyle("corner-radius").pfValue);var re=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:P;o.eleFillStyle(r,e,F)},K=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;o.colorStrokeStyle(r,R[0],R[1],R[2],F)},N=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Z;o.colorStrokeStyle(r,W[0],W[1],W[2],F)},$=function(F,V,ne,Y){var ie=o.nodePathCache=o.nodePathCache||[],ce=Xl(ne==="polygon"?ne+","+Y.join(","):ne,""+V,""+F,""+ee),Ee=ie[ce],ve,be=!1;return Ee!=null?(ve=Ee,be=!0,v.pathCache=ve):(ve=new Path2D,ie[ce]=v.pathCache=ve),{path:ve,cacheHit:be}},J=e.pstyle("shape").strValue,te=e.pstyle("shape-polygon-points").pfValue;if(d){r.translate(f.x,f.y);var le=$(s,l,J,te);h=le.path,y=le.cacheHit}var xe=function(){if(!y){var F=f;d&&(F={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(h||r,F.x,F.y,s,l,ee,v)}d?r.fill(h):r.fill()},Ie=function(){for(var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,ne=u.backgrounding,Y=0,ie=0;ie<E.length;ie++){var ce=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ie);if(V&&ce==="over"||!V&&ce==="inside"){Y++;continue}w[ie]&&E[ie].complete&&!E[ie].error&&(Y++,o.drawInscribedImage(r,E[ie],e,ie,F))}u.backgrounding=Y!==C,ne!==u.backgrounding&&e.updateStyle(!1)},Ae=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(r,e,V),F&&(d||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,l,ee,v)))},oe=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,V=(D>0?D:-D)*F,ne=D>0?0:255;D!==0&&(o.colorFillStyle(r,ne,ne,ne,V),d?r.fill(h):r.fill())},ue=function(){if(B>0){if(r.lineWidth=B,r.lineCap=M,r.lineJoin=I,r.setLineDash)switch(L){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(_),r.lineDashOffset=H;break;case"solid":case"double":r.setLineDash([]);break}if(O!=="center"){if(r.save(),r.lineWidth*=2,O==="inside")d?r.clip(h):r.clip();else{var F=new Path2D;F.rect(-s/2-B,-l/2-B,s+2*B,l+2*B),F.addPath(h),r.clip(F,"evenodd")}d?r.stroke(h):r.stroke(),r.restore()}else d?r.stroke(h):r.stroke();if(L==="double"){r.lineWidth=B/3;var V=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",d?r.stroke(h):r.stroke(),r.globalCompositeOperation=V}r.setLineDash&&r.setLineDash([])}},he=function(){if(G>0){if(r.lineWidth=G,r.lineCap="butt",r.setLineDash)switch(X){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var F=f;d&&(F={x:0,y:0});var V=o.getNodeShape(e),ne=B;O==="inside"&&(ne=0),O==="outside"&&(ne*=2);var Y=(s+ne+(G+Q))/s,ie=(l+ne+(G+Q))/l,ce=s*Y,Ee=l*ie,ve=o.nodeShapes[V].points,be;if(d){var we=$(ce,Ee,V,ve);be=we.path}if(V==="ellipse")o.drawEllipsePath(be||r,F.x,F.y,ce,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(V)){var pe=0,Oe=0,qe=0;V==="round-diamond"?pe=(ne+Q+G)*1.4:V==="round-heptagon"?(pe=(ne+Q+G)*1.075,qe=-(ne/2+Q+G)/35):V==="round-hexagon"?pe=(ne+Q+G)*1.12:V==="round-pentagon"?(pe=(ne+Q+G)*1.13,qe=-(ne/2+Q+G)/15):V==="round-tag"?(pe=(ne+Q+G)*1.12,Oe=(ne/2+G+Q)*.07):V==="round-triangle"&&(pe=(ne+Q+G)*(Math.PI/2),qe=-(ne+Q/2+G)/Math.PI),pe!==0&&(Y=(s+pe)/s,ce=s*Y,["round-hexagon","round-tag"].includes(V)||(ie=(l+pe)/l,Ee=l*ie)),ee=ee==="auto"?ov(ce,Ee):ee;for(var yr=ce/2,mr=Ee/2,He=ee+(ne+G+Q)/2,Xe=new Array(ve.length/2),Ze=new Array(ve.length/2),vr=0;vr<ve.length/2;vr++)Xe[vr]={x:F.x+Oe+yr*ve[vr*2],y:F.y+qe+mr*ve[vr*2+1]};var fr,Rr,wr,Mr,Vr=Xe.length;for(Rr=Xe[Vr-1],fr=0;fr<Vr;fr++)wr=Xe[fr%Vr],Mr=Xe[(fr+1)%Vr],Ze[fr]=Jo(Rr,wr,Mr,He),Rr=wr,wr=Mr;o.drawRoundPolygonPath(be||r,F.x+Oe,F.y+qe,s*Y,l*ie,ve,Ze)}else if(["roundrectangle","round-rectangle"].includes(V))ee=ee==="auto"?mt(ce,Ee):ee,o.drawRoundRectanglePath(be||r,F.x,F.y,ce,Ee,ee+(ne+G+Q)/2);else if(["cutrectangle","cut-rectangle"].includes(V))ee=ee==="auto"?_o():ee,o.drawCutRectanglePath(be||r,F.x,F.y,ce,Ee,null,ee+(ne+G+Q)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(V))ee=ee==="auto"?mt(ce,Ee):ee,o.drawBottomRoundRectanglePath(be||r,F.x,F.y,ce,Ee,ee+(ne+G+Q)/2);else if(V==="barrel")o.drawBarrelPath(be||r,F.x,F.y,ce,Ee);else if(V.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(V)){var _r=(ne+G+Q)/s;ve=fn(cn(ve,_r)),o.drawPolygonPath(be||r,F.x,F.y,s,l,ve)}else{var or=(ne+G+Q)/s;ve=fn(cn(ve,-or)),o.drawPolygonPath(be||r,F.x,F.y,s,l,ve)}if(d?r.stroke(be):r.stroke(),X==="double"){r.lineWidth=ne/3;var Qe=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",d?r.stroke(be):r.stroke(),r.globalCompositeOperation=Qe}r.setLineDash&&r.setLineDash([])}},ye=function(){n&&o.drawNodeOverlay(r,e,f,s,l)},de=function(){n&&o.drawNodeUnderlay(r,e,f,s,l)},me=function(){o.drawElementText(r,e,null,a)},Ce=e.pstyle("ghost").value==="yes";if(Ce){var Se=e.pstyle("ghost-offset-x").pfValue,j=e.pstyle("ghost-offset-y").pfValue,T=e.pstyle("ghost-opacity").value,q=T*c;r.translate(Se,j),N(),he(),re(T*P),xe(),Ie(q,!0),K(T*z),ue(),Ae(D!==0||B!==0),Ie(q,!1),oe(q),r.translate(-Se,-j)}d&&r.translate(-f.x,-f.y),de(),d&&r.translate(f.x,f.y),N(),he(),re(),xe(),Ie(c,!0),K(),ue(),Ae(D!==0||B!==0),Ie(c,!1),oe(),d&&r.translate(-f.x,-f.y),me(),ye(),t&&r.translate(p.x1,p.y1)}};var cf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a,n,i,o){var s=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,v=a.pstyle("".concat(e,"-color")).value,f=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||a.position(),i==null||o==null){var d=a.padding();i=a.width()+2*d,o=a.height()+2*d}s.colorFillStyle(t,v[0],v[1],v[2],u),s.nodeShapes[f].draw(t,n.x,n.y,i+l*2,o+l*2,c),t.fill()}}}};Qt.drawNodeOverlay=cf("overlay");Qt.drawNodeUnderlay=cf("underlay");Qt.hasPie=function(r){return r=r[0],r._private.hasPie};Qt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=a.x,s=a.y,l=e.width(),u=e.height(),v=Math.min(l,u)/2,f=0,c=this.usePaths();c&&(o=0,s=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2);for(var d=1;d<=n.pieBackgroundN;d++){var h=e.pstyle("pie-"+d+"-background-size").value,y=e.pstyle("pie-"+d+"-background-color").value,g=e.pstyle("pie-"+d+"-background-opacity").value*t,p=h/100;p+f>1&&(p=1-f);var m=1.5*Math.PI+2*Math.PI*f,b=2*Math.PI*p,w=m+b;h===0||f>=1||f+p>1||(r.beginPath(),r.moveTo(o,s),r.arc(o,s,v,m,w),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],g),r.fill(),f+=p)}};var hr={},my=100;hr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};hr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===r){t=!1;break}return t&&(a={context:r},e.push(a)),a};hr.createGradientStyleFor=function(r,e,t,a,n){var i,o=this.usePaths(),s=t.pstyle(e+"-gradient-stop-colors").value,l=t.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(t.isEdge()){var u=t.sourceEndpoint(),v=t.targetEndpoint(),f=t.midpoint(),c=yt(u,f),d=yt(v,f);i=r.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(c,d))}else{var h=o?{x:0,y:0}:t.position(),y=t.paddedWidth(),g=t.paddedHeight();i=r.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(y,g))}else if(t.isEdge()){var p=t.sourceEndpoint(),m=t.targetEndpoint();i=r.createLinearGradient(p.x,p.y,m.x,m.y)}else{var b=o?{x:0,y:0}:t.position(),w=t.paddedWidth(),E=t.paddedHeight(),C=w/2,x=E/2,S=t.pstyle("background-gradient-direction").value;switch(S){case"to-bottom":i=r.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":i=r.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":i=r.createLinearGradient(b.x+C,b.y,b.x-C,b.y);break;case"to-right":i=r.createLinearGradient(b.x-C,b.y,b.x+C,b.y);break;case"to-bottom-right":case"to-right-bottom":i=r.createLinearGradient(b.x-C,b.y-x,b.x+C,b.y+x);break;case"to-top-right":case"to-right-top":i=r.createLinearGradient(b.x-C,b.y+x,b.x+C,b.y-x);break;case"to-bottom-left":case"to-left-bottom":i=r.createLinearGradient(b.x+C,b.y-x,b.x-C,b.y+x);break;case"to-top-left":case"to-left-top":i=r.createLinearGradient(b.x+C,b.y+x,b.x-C,b.y-x);break}}if(!i)return null;for(var k=l.length===s.length,A=s.length,D=0;D<A;D++)i.addColorStop(k?l[D]:D/(A-1),"rgba("+s[D][0]+","+s[D][1]+","+s[D][2]+","+n+")");return i};hr.gradientFillStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"background",e,t,a);if(!n)return null;r.fillStyle=n};hr.colorFillStyle=function(r,e,t,a,n){r.fillStyle="rgba("+e+","+t+","+a+","+n+")"};hr.eleFillStyle=function(r,e,t){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(r,e,a,t);else{var n=e.pstyle("background-color").value;this.colorFillStyle(r,n[0],n[1],n[2],t)}};hr.gradientStrokeStyle=function(r,e,t,a){var n=this.createGradientStyleFor(r,"line",e,t,a);if(!n)return null;r.strokeStyle=n};hr.colorStrokeStyle=function(r,e,t,a,n){r.strokeStyle="rgba("+e+","+t+","+a+","+n+")"};hr.eleStrokeStyle=function(r,e,t){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(r,e,a,t);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(r,n[0],n[1],n[2],t)}};hr.matchCanvasSize=function(r){var e=this,t=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],o=e.getPixelRatio(),s=e.motionBlurPxRatio;(r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||r===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(o=s);var l=n*o,u=i*o,v;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var f=t.canvasContainer;f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)v=t.canvases[c],v.width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)v=t.bufferCanvases[c],v.width=l,v.height=u,v.style.width=n+"px",v.style.height=i+"px";e.textureMult=1,o<=1&&(v=t.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,v.width=l*e.textureMult,v.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u,e.pixelRatio=o}};hr.renderTo=function(r,e,t,a){this.render({forcedContext:r,forcedZoom:e,forcedPan:t,drawAllLayers:!0,forcedPxRatio:a})};hr.clearCanvas=function(){var r=this,e=r.data;function t(a){a.clearRect(0,0,r.canvasWidth,r.canvasHeight)}t(e.contexts[r.NODE]),t(e.contexts[r.DRAG])};hr.render=function(r){var e=this;r=r||jl();var t=e.cy,a=r.forcedContext,n=r.drawAllLayers,i=r.drawOnlyNodeLayer,o=r.forcedZoom,s=r.forcedPan,l=r.forcedPxRatio===void 0?this.getPixelRatio():r.forcedPxRatio,u=e.data,v=u.canvasNeedsRedraw,f=e.textureOnViewport&&!a&&(e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming),c=r.motionBlur!==void 0?r.motionBlur:e.motionBlur,d=e.motionBlurPxRatio,h=t.hasCompoundNodes(),y=e.hoverData.draggingEles,g=!!(e.hoverData.selecting||e.touchData.selecting);c=c&&!a&&e.motionBlurEnabled&&!g;var p=c;a||(e.prevPxRatio!==l&&(e.invalidateContainerClientCoordsCache(),e.matchCanvasSize(e.container),e.redrawHint("eles",!0),e.redrawHint("drag",!0)),e.prevPxRatio=l),!a&&e.motionBlurTimeout&&clearTimeout(e.motionBlurTimeout),c&&(e.mbFrames==null&&(e.mbFrames=0),e.mbFrames++,e.mbFrames<3&&(p=!1),e.mbFrames>e.minMbLowQualFrames&&(e.motionBlurPxRatio=e.mbPxRBlurry)),e.clearingMotionBlur&&(e.motionBlurPxRatio=1),e.textureDrawLastFrame&&!f&&(v[e.NODE]=!0,v[e.SELECT_BOX]=!0);var m=t.style(),b=t.zoom(),w=o!==void 0?o:b,E=t.pan(),C={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},S=e.prevViewport,k=S===void 0||x.zoom!==S.zoom||x.pan.x!==S.pan.x||x.pan.y!==S.pan.y;!k&&!(y&&!h)&&(e.motionBlurPxRatio=1),s&&(C=s),w*=l,C.x*=l,C.y*=l;var A=e.getCachedZSortedEles();function D(K,N,$,J,te){var le=K.globalCompositeOperation;K.globalCompositeOperation="destination-out",e.colorFillStyle(K,255,255,255,e.motionBlurTransparency),K.fillRect(N,$,J,te),K.globalCompositeOperation=le}function B(K,N){var $,J,te,le;!e.clearingMotionBlur&&(K===u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]||K===u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG])?($={x:E.x*d,y:E.y*d},J=b*d,te=e.canvasWidth*d,le=e.canvasHeight*d):($=C,J=w,te=e.canvasWidth,le=e.canvasHeight),K.setTransform(1,0,0,1,0,0),N==="motionBlur"?D(K,0,0,te,le):!a&&(N===void 0||N)&&K.clearRect(0,0,te,le),n||(K.translate($.x,$.y),K.scale(J,J)),s&&K.translate(s.x,s.y),o&&K.scale(o,o)}if(f||(e.textureDrawLastFrame=!1),f){if(e.textureDrawLastFrame=!0,!e.textureCache){e.textureCache={},e.textureCache.bb=t.mutableElements().boundingBox(),e.textureCache.texture=e.data.bufferCanvases[e.TEXTURE_BUFFER];var P=e.data.bufferContexts[e.TEXTURE_BUFFER];P.setTransform(1,0,0,1,0,0),P.clearRect(0,0,e.canvasWidth*e.textureMult,e.canvasHeight*e.textureMult),e.render({forcedContext:P,drawOnlyNodeLayer:!0,forcedPxRatio:l*e.textureMult});var x=e.textureCache.viewport={zoom:t.zoom(),pan:t.pan(),width:e.canvasWidth,height:e.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[e.DRAG]=!1,v[e.NODE]=!1;var R=u.contexts[e.NODE],L=e.textureCache.texture,x=e.textureCache.viewport;R.setTransform(1,0,0,1,0,0),c?D(R,0,0,x.width,x.height):R.clearRect(0,0,x.width,x.height);var I=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;e.colorFillStyle(R,I[0],I[1],I[2],M),R.fillRect(0,0,x.width,x.height);var b=t.zoom();B(R,!1),R.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l),R.drawImage(L,x.mpan.x,x.mpan.y,x.width/x.zoom/l,x.height/x.zoom/l)}else e.textureOnViewport&&!a&&(e.textureCache=null);var O=t.extent(),_=e.pinching||e.hoverData.dragging||e.swipePanning||e.data.wheelZooming||e.hoverData.draggingEles||e.cy.animated(),H=e.hideEdgesOnViewport&&_,z=[];if(z[e.NODE]=!v[e.NODE]&&c&&!e.clearedForMotionBlur[e.NODE]||e.clearingMotionBlur,z[e.NODE]&&(e.clearedForMotionBlur[e.NODE]=!0),z[e.DRAG]=!v[e.DRAG]&&c&&!e.clearedForMotionBlur[e.DRAG]||e.clearingMotionBlur,z[e.DRAG]&&(e.clearedForMotionBlur[e.DRAG]=!0),v[e.NODE]||n||i||z[e.NODE]){var G=c&&!z[e.NODE]&&d!==1,R=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE]:u.contexts[e.NODE]),W=c&&!G?"motionBlur":void 0;B(R,W),H?e.drawCachedNodes(R,A.nondrag,l,O):e.drawLayeredElements(R,A.nondrag,l,O),e.debug&&e.drawDebugPoints(R,A.nondrag),!n&&!c&&(v[e.NODE]=!1)}if(!i&&(v[e.DRAG]||n||z[e.DRAG])){var G=c&&!z[e.DRAG]&&d!==1,R=a||(G?e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]:u.contexts[e.DRAG]);B(R,c&&!G?"motionBlur":void 0),H?e.drawCachedNodes(R,A.drag,l,O):e.drawCachedElements(R,A.drag,l,O),e.debug&&e.drawDebugPoints(R,A.drag),!n&&!c&&(v[e.DRAG]=!1)}if(this.drawSelectionRectangle(r,B),c&&d!==1){var X=u.contexts[e.NODE],Z=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE],Q=u.contexts[e.DRAG],ee=e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG],re=function(N,$,J){N.setTransform(1,0,0,1,0,0),J||!p?N.clearRect(0,0,e.canvasWidth,e.canvasHeight):D(N,0,0,e.canvasWidth,e.canvasHeight);var te=d;N.drawImage($,0,0,e.canvasWidth*te,e.canvasHeight*te,0,0,e.canvasWidth,e.canvasHeight)};(v[e.NODE]||z[e.NODE])&&(re(X,Z,z[e.NODE]),v[e.NODE]=!1),(v[e.DRAG]||z[e.DRAG])&&(re(Q,ee,z[e.DRAG]),v[e.DRAG]=!1)}e.prevViewport=x,e.clearingMotionBlur&&(e.clearingMotionBlur=!1,e.motionBlurCleared=!0,e.motionBlur=!0),c&&(e.motionBlurTimeout=setTimeout(function(){e.motionBlurTimeout=null,e.clearedForMotionBlur[e.NODE]=!1,e.clearedForMotionBlur[e.DRAG]=!1,e.motionBlur=!1,e.clearingMotionBlur=!f,e.mbFrames=0,v[e.NODE]=!0,v[e.DRAG]=!0,e.redraw()},my)),a||t.emit("render")};var na;hr.drawSelectionRectangle=function(r,e){var t=this,a=t.cy,n=t.data,i=a.style(),o=r.drawOnlyNodeLayer,s=r.drawAllLayers,l=n.canvasNeedsRedraw,u=r.forcedContext;if(t.showFps||!o&&l[t.SELECT_BOX]&&!s){var v=u||n.contexts[t.SELECT_BOX];if(e(v),t.selection[4]==1&&(t.hoverData.selecting||t.touchData.selecting)){var f=t.cy.zoom(),c=i.core("selection-box-border-width").value/f;v.lineWidth=c,v.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",v.fillRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]),c>0&&(v.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",v.strokeRect(t.selection[0],t.selection[1],t.selection[2]-t.selection[0],t.selection[3]-t.selection[1]))}if(n.bgActivePosistion&&!t.hoverData.selecting){var f=t.cy.zoom(),d=n.bgActivePosistion;v.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",v.beginPath(),v.arc(d.x,d.y,i.core("active-bg-size").pfValue/f,0,2*Math.PI),v.fill()}var h=t.lastRedrawTime;if(t.showFps&&h){h=Math.round(h);var y=Math.round(1e3/h),g="1 frame = "+h+" ms = "+y+" fps";if(v.setTransform(1,0,0,1,0,0),v.fillStyle="rgba(255, 0, 0, 0.75)",v.strokeStyle="rgba(255, 0, 0, 0.75)",v.font="30px Arial",!na){var p=v.measureText(g);na=p.actualBoundingBoxAscent}v.fillText(g,0,na);var m=60;v.strokeRect(0,na+10,250,20),v.fillRect(0,na+10,250*Math.min(y/m,1),20)}s||(l[t.SELECT_BOX]=!1)}};function Tl(r,e,t){var a=r.createShader(e);if(r.shaderSource(a,t),r.compileShader(a),!r.getShaderParameter(a,r.COMPILE_STATUS))throw new Error(r.getShaderInfoLog(a));return a}function by(r,e,t){var a=Tl(r,r.VERTEX_SHADER,e),n=Tl(r,r.FRAGMENT_SHADER,t),i=r.createProgram();if(r.attachShader(i,a),r.attachShader(i,n),r.linkProgram(i),!r.getProgramParameter(i,r.LINK_STATUS))throw new Error("Could not initialize shaders");return i}function wy(r,e,t){t===void 0&&(t=e);var a=r.makeOffscreenCanvas(e,t),n=a.context=a.getContext("2d");return a.clear=function(){return n.clearRect(0,0,a.width,a.height)},a.clear(),a}function rs(r){var e=r.pixelRatio,t=r.cy.zoom(),a=r.cy.pan();return{zoom:t*e,pan:{x:a.x*e,y:a.y*e}}}function xy(r,e,t,a,n){var i=a*t+e.x,o=n*t+e.y;return o=Math.round(r.canvasHeight-o),[i,o]}function ia(r,e,t){var a=r[0]/255,n=r[1]/255,i=r[2]/255,o=e,s=t||new Array(4);return s[0]=a*o,s[1]=n*o,s[2]=i*o,s[3]=o,s}function At(r,e){var t=e||new Array(4);return t[0]=(r>>0&255)/255,t[1]=(r>>8&255)/255,t[2]=(r>>16&255)/255,t[3]=(r>>24&255)/255,t}function Ey(r){return r[0]+(r[1]<<8)+(r[2]<<16)+(r[3]<<24)}function Cy(r,e){var t=r.createTexture();return t.buffer=function(a){r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_NEAREST),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,a),r.generateMipmap(r.TEXTURE_2D),r.bindTexture(r.TEXTURE_2D,null)},t.deleteTexture=function(){r.deleteTexture(t)},t}function hf(r,e){switch(e){case"float":return[1,r.FLOAT,4];case"vec2":return[2,r.FLOAT,4];case"vec3":return[3,r.FLOAT,4];case"vec4":return[4,r.FLOAT,4];case"int":return[1,r.INT,4];case"ivec2":return[2,r.INT,4]}}function df(r,e,t){switch(e){case r.FLOAT:return new Float32Array(t);case r.INT:return new Int32Array(t)}}function Ty(r,e,t,a,n,i){switch(e){case r.FLOAT:return new Float32Array(t.buffer,i*a,n);case r.INT:return new Int32Array(t.buffer,i*a,n)}}function Sy(r,e,t,a){var n=hf(r,e),i=je(n,2),o=i[0],s=i[1],l=df(r,s,a),u=r.createBuffer();return r.bindBuffer(r.ARRAY_BUFFER,u),r.bufferData(r.ARRAY_BUFFER,l,r.STATIC_DRAW),s===r.FLOAT?r.vertexAttribPointer(t,o,s,!1,0,0):s===r.INT&&r.vertexAttribIPointer(t,o,s,0,0),r.enableVertexAttribArray(t),r.bindBuffer(r.ARRAY_BUFFER,null),u}function Qr(r,e,t,a){var n=hf(r,t),i=je(n,3),o=i[0],s=i[1],l=i[2],u=df(r,s,e*o),v=o*l,f=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,e*v,r.DYNAMIC_DRAW),r.enableVertexAttribArray(a),s===r.FLOAT?r.vertexAttribPointer(a,o,s,!1,v,0):s===r.INT&&r.vertexAttribIPointer(a,o,s,v,0),r.vertexAttribDivisor(a,1),r.bindBuffer(r.ARRAY_BUFFER,null);for(var c=new Array(e),d=0;d<e;d++)c[d]=Ty(r,s,u,v,o,d);return f.dataArray=u,f.stride=v,f.size=o,f.getView=function(h){return c[h]},f.setPoint=function(h,y,g){var p=c[h];p[0]=y,p[1]=g},f.bufferSubData=function(h){r.bindBuffer(r.ARRAY_BUFFER,f),h?r.bufferSubData(r.ARRAY_BUFFER,0,u,0,h*o):r.bufferSubData(r.ARRAY_BUFFER,0,u)},f}function Dy(r,e,t){for(var a=9,n=new Float32Array(e*a),i=new Array(e),o=0;o<e;o++){var s=o*a*4;i[o]=new Float32Array(n.buffer,s,a)}var l=r.createBuffer();r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferData(r.ARRAY_BUFFER,n.byteLength,r.DYNAMIC_DRAW);for(var u=0;u<3;u++){var v=t+u;r.enableVertexAttribArray(v),r.vertexAttribPointer(v,3,r.FLOAT,!1,3*12,u*12),r.vertexAttribDivisor(v,1)}return r.bindBuffer(r.ARRAY_BUFFER,null),l.getMatrixView=function(f){return i[f]},l.setData=function(f,c){i[c].set(f,0)},l.bufferSubData=function(){r.bindBuffer(r.ARRAY_BUFFER,l),r.bufferSubData(r.ARRAY_BUFFER,0,n)},l}function ky(r){var e=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,e);var t=r.createTexture();return r.bindTexture(r.TEXTURE_2D,t),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),r.bindFramebuffer(r.FRAMEBUFFER,null),e.setFramebufferAttachmentSizes=function(a,n){r.bindTexture(r.TEXTURE_2D,t),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a,n,0,r.RGBA,r.UNSIGNED_BYTE,null)},e}var Sl=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});function sn(){var r=new Sl(9);return Sl!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function gf(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Py(r,e,t){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=t[0],d=t[1],h=t[2],y=t[3],g=t[4],p=t[5],m=t[6],b=t[7],w=t[8];return r[0]=c*a+d*o+h*u,r[1]=c*n+d*s+h*v,r[2]=c*i+d*l+h*f,r[3]=y*a+g*o+p*u,r[4]=y*n+g*s+p*v,r[5]=y*i+g*l+p*f,r[6]=m*a+b*o+w*u,r[7]=m*n+b*s+w*v,r[8]=m*i+b*l+w*f,r}function bn(r,e,t){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=t[0],d=t[1];return r[0]=a,r[1]=n,r[2]=i,r[3]=o,r[4]=s,r[5]=l,r[6]=c*a+d*o+u,r[7]=c*n+d*s+v,r[8]=c*i+d*l+f,r}function pf(r,e,t){var a=e[0],n=e[1],i=e[2],o=e[3],s=e[4],l=e[5],u=e[6],v=e[7],f=e[8],c=Math.sin(t),d=Math.cos(t);return r[0]=d*a+c*o,r[1]=d*n+c*s,r[2]=d*i+c*l,r[3]=d*o-c*a,r[4]=d*s-c*n,r[5]=d*l-c*i,r[6]=u,r[7]=v,r[8]=f,r}function ts(r,e,t){var a=t[0],n=t[1];return r[0]=a*e[0],r[1]=a*e[1],r[2]=a*e[2],r[3]=n*e[3],r[4]=n*e[4],r[5]=n*e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r}function Ay(r,e,t){return r[0]=2/e,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/t,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}var ca={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},Dl=We({texRows:24}),Bt=We({collection:"default",getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:function(){return!0},getPadding:0}),By=function(){function r(e,t,a,n){st(this,r),this.debugID=Math.floor(Math.random()*1e4),this.r=e,this.texSize=t,this.texRows=a,this.texHeight=Math.floor(t/a),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=n(e,t,t),this.scratch=n(e,t,this.texHeight,"scratch")}return ut(r,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(t){var a=t.w,n=t.h,i=this.texHeight,o=this.texSize,s=i/n,l=a*s,u=n*s;return l>o&&(s=o/a,l=a*s,u=n*s),{scale:s,texW:l,texH:u}}},{key:"draw",value:function(t,a,n){var i=this;if(this.locked)throw new Error("can't draw, atlas is locked");var o=this.texSize,s=this.texRows,l=this.texHeight,u=this.getScale(a),v=u.scale,f=u.texW,c=u.texH,d=[null,null],h=function(b,w){if(n&&w){var E=w.context,C=b.x,x=b.row,S=C,k=l*x;E.save(),E.translate(S,k),E.scale(v,v),n(E,a),E.restore()}},y=function(){h(i.freePointer,i.canvas),d[0]={x:i.freePointer.x,y:i.freePointer.row*l,w:f,h:c},d[1]={x:i.freePointer.x+f,y:i.freePointer.row*l,w:0,h:c},i.freePointer.x+=f,i.freePointer.x==o&&(i.freePointer.x=0,i.freePointer.row++)},g=function(){var b=i.scratch,w=i.canvas;b.clear(),h({x:0,row:0},b);var E=o-i.freePointer.x,C=f-E,x=l;{var S=i.freePointer.x,k=i.freePointer.row*l,A=E;w.context.drawImage(b,0,0,A,x,S,k,A,x),d[0]={x:S,y:k,w:A,h:c}}{var D=E,B=(i.freePointer.row+1)*l,P=C;w&&w.context.drawImage(b,D,0,P,x,0,B,P,x),d[1]={x:0,y:B,w:P,h:c}}i.freePointer.x=C,i.freePointer.row++},p=function(){i.freePointer.x=0,i.freePointer.row++};if(this.freePointer.x+f<=o)y();else{if(this.freePointer.row>=s-1)return!1;this.freePointer.x===o?(p(),y()):this.enableWrapping?g():(p(),y())}return this.keyToLocation.set(t,d),this.needsBuffer=!0,d}},{key:"getOffsets",value:function(t){return this.keyToLocation.get(t)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(t){if(this.locked)return!1;var a=this.texSize,n=this.texRows,i=this.getScale(t),o=i.texW;return this.freePointer.x+o>a?this.freePointer.row<n-1:!0}},{key:"bufferIfNeeded",value:function(t){this.texture||(this.texture=Cy(t,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}}])}(),Ry=function(){function r(e,t,a,n){st(this,r),this.r=e,this.texSize=t,this.texRows=a,this.createTextureCanvas=n,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return ut(r,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas;return new By(t,a,n,i)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var t=this.r,a=this.texSize,n=this.texRows,i=this.createTextureCanvas,o=Math.floor(a/n);this.scratch=i(t,a,o,"scratch")}return this.scratch}},{key:"draw",value:function(t,a,n){var i=this.styleKeyToAtlas.get(t);return i||(i=this.atlases[this.atlases.length-1],(!i||!i.canFit(a))&&(i&&i.lock(),i=this._createAtlas(),this.atlases.push(i)),i.draw(t,a,n),this.styleKeyToAtlas.set(t,i)),i}},{key:"getAtlas",value:function(t){return this.styleKeyToAtlas.get(t)}},{key:"hasAtlas",value:function(t){return this.styleKeyToAtlas.has(t)}},{key:"markKeyForGC",value:function(t){this.markedKeys.add(t)}},{key:"gc",value:function(){var t=this,a=this.markedKeys;if(a.size===0){console.log("nothing to garbage collect");return}var n=[],i=new Map,o=null,s=Pr(this.atlases),l;try{var u=function(){var f=l.value,c=f.getKeys(),d=My(a,c);if(d.size===0)return n.push(f),c.forEach(function(E){return i.set(E,f)}),1;o||(o=t._createAtlas(),n.push(o));var h=Pr(c),y;try{for(h.s();!(y=h.n()).done;){var g=y.value;if(!d.has(g)){var p=f.getOffsets(g),m=je(p,2),b=m[0],w=m[1];o.canFit({w:b.w+w.w,h:b.h})||(o.lock(),o=t._createAtlas(),n.push(o)),t._copyTextureToNewAtlas(g,f,o),i.set(g,o)}}}catch(E){h.e(E)}finally{h.f()}f.dispose()};for(s.s();!(l=s.n()).done;)u()}catch(v){s.e(v)}finally{s.f()}this.atlases=n,this.styleKeyToAtlas=i,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(t,a,n){var i=a.getOffsets(t),o=je(i,2),s=o[0],l=o[1];if(l.w===0)n.draw(t,s,function(c){c.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h)});else{var u=this._getScratchCanvas();u.clear(),u.context.drawImage(a.canvas,s.x,s.y,s.w,s.h,0,0,s.w,s.h),u.context.drawImage(a.canvas,l.x,l.y,l.w,l.h,s.w,0,l.w,l.h);var v=s.w+l.w,f=s.h;n.draw(t,{w:v,h:f},function(c){c.drawImage(u,0,0,v,f,0,0,v,f)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function My(r,e){return r.intersection?r.intersection(e):new Set(Ol(r).filter(function(t){return e.has(t)}))}var Ly=function(){function r(e,t){st(this,r),this.r=e,this.globalOptions=t,this.atlasSize=t.webglTexSize,this.maxAtlasesPerBatch=t.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map,this.batchAtlases=[]}return ut(r,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"addAtlasCollection",value:function(t,a){var n=this.globalOptions,i=n.webglTexSize,o=n.createTextureCanvas,s=a.texRows,l=this._cacheScratchCanvas(o),u=new Ry(this.r,i,s,l);this.collections.set(t,u)}},{key:"addRenderType",value:function(t,a){var n=a.collection;if(!this.collections.has(n))throw new Error("invalid atlas collection name '".concat(n,"'"));var i=this.collections.get(n),o=ge({type:t,atlasCollection:i},a);this.renderTypes.set(t,o)}},{key:"getRenderTypeOpts",value:function(t){return this.renderTypes.get(t)}},{key:"getAtlasCollection",value:function(t){return this.collections.get(t)}},{key:"_cacheScratchCanvas",value:function(t){var a=-1,n=-1,i=null;return function(o,s,l,u){return u?((!i||s!=a||l!=n)&&(a=s,n=l,i=t(o,s,l)),i):t(o,s,l)}}},{key:"_key",value:function(t,a){return"".concat(t,"-").concat(a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.forceRedraw,i=n===void 0?!1:n,o=a.filterEle,s=o===void 0?function(){return!0}:o,l=a.filterType,u=l===void 0?function(){return!0}:l,v=!1,f=!1,c=Pr(t),d;try{for(c.s();!(d=c.n()).done;){var h=d.value;if(s(h)){var y=Pr(this.renderTypes.values()),g;try{for(y.s();!(g=y.n()).done;){var p=g.value,m=p.type;if(u(m)){var b=p.getKey(h),w=this.collections.get(p.collection);if(i)w.markKeyForGC(b),f=!0;else{var E=p.getID?p.getID(h):h.id(),C=this._key(m,E),x=this.typeAndIdToKey.get(C);x!==void 0&&x!==b&&(this.typeAndIdToKey.delete(C),w.markKeyForGC(x),v=!0)}}}}catch(S){y.e(S)}finally{y.f()}}}}catch(S){c.e(S)}finally{c.f()}return f&&(this.gc(),v=!1),v}},{key:"gc",value:function(){var t=Pr(this.collections.values()),a;try{for(t.s();!(a=t.n()).done;){var n=a.value;n.gc()}}catch(i){t.e(i)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(t,a,n){var i=this.renderTypes.get(a),o=i.getKey(t);n||(n=i.getBoundingBox(t));var s=this.collections.get(i.collection),l=!1,u=s.draw(o,n,function(c){i.drawElement(c,t,n,!0,!0),l=!0});if(l){var v=i.getID?i.getID(t):t.id(),f=this._key(a,v);this.typeAndIdToKey.set(f,o)}return u}},{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(t,a){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(a),i=n.getKey(t),o=this.collections.get(n.collection),s=o.getAtlas(i);return!!s&&this.batchAtlases.includes(s)}return!0}},{key:"getAtlasIndexForBatch",value:function(t){var a=this.batchAtlases.indexOf(t);if(a<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(t),a=this.batchAtlases.length-1}return a}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(t,a){return a})}},{key:"getAtlasInfo",value:function(t,a){var n=this.renderTypes.get(a),i=n.getBoundingBox(t),o=this.getOrCreateAtlas(t,a,i),s=this.getAtlasIndexForBatch(o);if(s!==void 0){var l=n.getKey(t),u=o.getOffsets(l),v=je(u,2),f=v[0],c=v[1];return{index:s,tex1:f,tex2:c,bb:i}}}},{key:"setTransformMatrix",value:function(t,a,n,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=this.getRenderTypeOpts(n),l=s.getPadding?s.getPadding(t):0;if(i){var u=i.bb,v=i.tex1,f=i.tex2,c=v.w/(v.w+f.w);o||(c=1-c);var d=this.getAdjustedBB(u,l,o,c);this._applyTransformMatrix(a,d,s,t)}else{var h=s.getBoundingBox(t),y=this.getAdjustedBB(h,l,!0,1);this._applyTransformMatrix(a,y,s,t)}}},{key:"_applyTransformMatrix",value:function(t,a,n,i){var o,s;gf(t);var l=n.getRotation?n.getRotation(i):0;if(l!==0){var u=n.getRotationPoint(i),v=u.x,f=u.y;bn(t,t,[v,f]),pf(t,t,l);var c=n.getRotationOffset(i);o=c.x+a.xOffset,s=c.y}else o=a.x1,s=a.y1;bn(t,t,[o,s]),ts(t,t,[a.w,a.h])}},{key:"getAdjustedBB",value:function(t,a,n,i){var o=t.x1,s=t.y1,l=t.w,u=t.h;a&&(o-=a,s-=a,l+=2*a,u+=2*a);var v=0,f=l*i;return n&&i<1?l=f:!n&&i<1&&(v=l-f,o+=v,l=f),{x1:o,y1:s,w:l,h:u,xOffset:v}}},{key:"getDebugInfo",value:function(){var t=[],a=Pr(this.collections),n;try{for(a.s();!(n=a.n()).done;){var i=je(n.value,2),o=i[0],s=i[1],l=s.getCounts(),u=l.keyCount,v=l.atlasCount;t.push({type:o,keyCount:u,atlasCount:v})}}catch(f){a.e(f)}finally{a.f()}return t}}])}(),Xa=0,kl=1,Pl=2,vo=3,Al=4,Iy=function(){function r(e,t,a){st(this,r),this.r=e,this.gl=t,this.maxInstances=a.webglBatchSize,this.atlasSize=a.webglTexSize,this.bgColor=a.bgColor,this.debug=a.webglDebug,this.batchDebugInfo=[],a.enableWrapping=!0,a.createTextureCanvas=wy,this.atlasManager=new Ly(e,a),this.program=this.createShaderProgram(ca.SCREEN),this.pickingProgram=this.createShaderProgram(ca.PICKING),this.vao=this.createVAO()}return ut(r,[{key:"addAtlasCollection",value:function(t,a){this.atlasManager.addAtlasCollection(t,a)}},{key:"addAtlasRenderType",value:function(t,a){this.atlasManager.addRenderType(t,a)}},{key:"invalidate",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=a.type,i=this.atlasManager;return n?i.invalidate(t,{filterType:function(s){return s===n},forceRedraw:!0}):i.invalidate(t)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(t){var a=this.gl,n=`#version 300 es
18
- precision highp float;
19
-
20
- uniform mat3 uPanZoomMatrix;
21
- uniform int uAtlasSize;
22
-
23
- // instanced
24
- in vec2 aPosition;
25
-
26
- in mat3 aTransform;
27
-
28
- // what are we rendering?
29
- in int aVertType;
30
-
31
- // for picking
32
- in vec4 aIndex;
33
-
34
- // For textures
35
- in int aAtlasId; // which shader unit/atlas to use
36
- in vec4 aTex; // x/y/w/h of texture in atlas
37
-
38
- // for edges
39
- in vec4 aPointAPointB;
40
- in vec4 aPointCPointD;
41
- in float aLineWidth;
42
- in vec4 aColor;
43
-
44
- out vec2 vTexCoord;
45
- out vec4 vColor;
46
- flat out int vAtlasId;
47
- flat out vec4 vIndex;
48
- flat out int vVertType;
49
-
50
- void main(void) {
51
- int vid = gl_VertexID;
52
- vec2 position = aPosition;
53
-
54
- if(aVertType == `.concat(Xa,`) {
55
- float texX = aTex.x;
56
- float texY = aTex.y;
57
- float texW = aTex.z;
58
- float texH = aTex.w;
59
-
60
- int vid = gl_VertexID;
61
-
62
- if(vid == 1 || vid == 2 || vid == 4) {
63
- texX += texW;
64
- }
65
- if(vid == 2 || vid == 4 || vid == 5) {
66
- texY += texH;
67
- }
68
-
69
- float d = float(uAtlasSize);
70
- vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1
71
-
72
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
73
- }
74
- else if(aVertType == `).concat(Al,`) {
75
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
76
- vColor = aColor;
77
- }
78
- else if(aVertType == `).concat(kl,`) {
79
- vec2 source = aPointAPointB.xy;
80
- vec2 target = aPointAPointB.zw;
81
-
82
- // adjust the geometry so that the line is centered on the edge
83
- position.y = position.y - 0.5;
84
-
85
- vec2 xBasis = target - source;
86
- vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
87
- vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;
88
-
89
- gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
90
- vColor = aColor;
91
- }
92
- else if(aVertType == `).concat(Pl,`) {
93
- vec2 pointA = aPointAPointB.xy;
94
- vec2 pointB = aPointAPointB.zw;
95
- vec2 pointC = aPointCPointD.xy;
96
- vec2 pointD = aPointCPointD.zw;
97
-
98
- // adjust the geometry so that the line is centered on the edge
99
- position.y = position.y - 0.5;
100
-
101
- vec2 p0 = pointA;
102
- vec2 p1 = pointB;
103
- vec2 p2 = pointC;
104
- vec2 pos = position;
105
- if(position.x == 1.0) {
106
- p0 = pointD;
107
- p1 = pointC;
108
- p2 = pointB;
109
- pos = vec2(0.0, -position.y);
110
- }
111
-
112
- vec2 p01 = p1 - p0;
113
- vec2 p12 = p2 - p1;
114
- vec2 p21 = p1 - p2;
115
-
116
- // Find the normal vector.
117
- vec2 tangent = normalize(normalize(p12) + normalize(p01));
118
- vec2 normal = vec2(-tangent.y, tangent.x);
119
-
120
- // Find the vector perpendicular to p0 -> p1.
121
- vec2 p01Norm = normalize(vec2(-p01.y, p01.x));
122
-
123
- // Determine the bend direction.
124
- float sigma = sign(dot(p01 + p21, normal));
125
- float width = aLineWidth;
126
-
127
- if(sign(pos.y) == -sigma) {
128
- // This is an intersecting vertex. Adjust the position so that there's no overlap.
129
- vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
130
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
131
- } else {
132
- // This is a non-intersecting vertex. Treat it like a mitre join.
133
- vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
134
- gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
135
- }
136
-
137
- vColor = aColor;
138
- }
139
- else if(aVertType == `).concat(vo,` && vid < 3) {
140
- // massage the first triangle into an edge arrow
141
- if(vid == 0)
142
- position = vec2(-0.15, -0.3);
143
- if(vid == 1)
144
- position = vec2( 0.0, 0.0);
145
- if(vid == 2)
146
- position = vec2( 0.15, -0.3);
147
-
148
- gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
149
- vColor = aColor;
150
- }
151
- else {
152
- gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
153
- }
154
-
155
- vAtlasId = aAtlasId;
156
- vIndex = aIndex;
157
- vVertType = aVertType;
158
- }
159
- `),i=this.atlasManager.getIndexArray(),o=`#version 300 es
160
- precision highp float;
161
-
162
- // define texture unit for each node in the batch
163
- `.concat(i.map(function(u){return"uniform sampler2D uTexture".concat(u,";")}).join(`
164
- `),`
165
-
166
- uniform vec4 uBGColor;
167
-
168
- in vec2 vTexCoord;
169
- in vec4 vColor;
170
- flat in int vAtlasId;
171
- flat in vec4 vIndex;
172
- flat in int vVertType;
173
-
174
- out vec4 outColor;
175
-
176
- void main(void) {
177
- if(vVertType == `).concat(Xa,`) {
178
- `).concat(i.map(function(u){return"if(vAtlasId == ".concat(u,") outColor = texture(uTexture").concat(u,", vTexCoord);")}).join(`
179
- else `),`
180
- } else if(vVertType == `).concat(vo,`) {
181
- // blend arrow color with background (using premultiplied alpha)
182
- outColor.rgb = vColor.rgb + (uBGColor.rgb * (1.0 - vColor.a));
183
- outColor.a = 1.0; // make opaque, masks out line under arrow
184
- } else {
185
- outColor = vColor;
186
- }
187
-
188
- `).concat(t.picking?`if(outColor.a == 0.0) discard;
189
- else outColor = vIndex;`:"",`
190
- }
191
- `),s=by(a,n,o);s.aPosition=a.getAttribLocation(s,"aPosition"),s.aIndex=a.getAttribLocation(s,"aIndex"),s.aVertType=a.getAttribLocation(s,"aVertType"),s.aTransform=a.getAttribLocation(s,"aTransform"),s.aAtlasId=a.getAttribLocation(s,"aAtlasId"),s.aTex=a.getAttribLocation(s,"aTex"),s.aPointAPointB=a.getAttribLocation(s,"aPointAPointB"),s.aPointCPointD=a.getAttribLocation(s,"aPointCPointD"),s.aLineWidth=a.getAttribLocation(s,"aLineWidth"),s.aColor=a.getAttribLocation(s,"aColor"),s.uPanZoomMatrix=a.getUniformLocation(s,"uPanZoomMatrix"),s.uAtlasSize=a.getUniformLocation(s,"uAtlasSize"),s.uBGColor=a.getUniformLocation(s,"uBGColor"),s.uTextures=[];for(var l=0;l<this.atlasManager.getMaxAtlasesPerBatch();l++)s.uTextures.push(a.getUniformLocation(s,"uTexture".concat(l)));return s}},{key:"createVAO",value:function(){var t=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=t.length/2;var a=this.maxInstances,n=this.gl,i=this.program,o=n.createVertexArray();return n.bindVertexArray(o),Sy(n,"vec2",i.aPosition,t),this.transformBuffer=Dy(n,a,i.aTransform),this.indexBuffer=Qr(n,a,"vec4",i.aIndex),this.vertTypeBuffer=Qr(n,a,"int",i.aVertType),this.atlasIdBuffer=Qr(n,a,"int",i.aAtlasId),this.texBuffer=Qr(n,a,"vec4",i.aTex),this.pointAPointBBuffer=Qr(n,a,"vec4",i.aPointAPointB),this.pointCPointDBuffer=Qr(n,a,"vec4",i.aPointCPointD),this.lineWidthBuffer=Qr(n,a,"float",i.aLineWidth),this.colorBuffer=Qr(n,a,"vec4",i.aColor),n.bindVertexArray(null),o}},{key:"buffers",get:function(){var t=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(a){return a.endsWith("Buffer")}).map(function(a){return t[a]})),this._buffers}},{key:"startFrame",value:function(t){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ca.SCREEN;this.panZoomMatrix=t,this.renderTarget=a,this.batchDebugInfo=[],this.wrappedCount=0,this.rectangleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||sn()}},{key:"drawTexture",value:function(t,a,n){var i=this.atlasManager;if(t.visible()&&i.getRenderTypeOpts(n).isVisible(t)){i.canAddToCurrentBatch(t,n)||this.endBatch(),this.instanceCount+1>=this.maxInstances&&this.endBatch();var o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Xa;var s=this.indexBuffer.getView(o);At(a,s);var l=i.getAtlasInfo(t,n),u=l.index,v=l.tex1,f=l.tex2;f.w>0&&this.wrappedCount++;for(var c=!0,d=0,h=[v,f];d<h.length;d++){var y=h[d];if(y.w!=0){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=Xa;var p=this.indexBuffer.getView(g);At(a,p);var m=this.atlasIdBuffer.getView(g);m[0]=u;var b=this.texBuffer.getView(g);b[0]=y.x,b[1]=y.y,b[2]=y.w,b[3]=y.h;var w=this.transformBuffer.getMatrixView(g);i.setTransformMatrix(t,w,n,l,c),this.instanceCount++}c=!1}this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawSimpleRectangle",value:function(t,a,n){if(t.visible()){var i=this.atlasManager,o=this.instanceCount;this.vertTypeBuffer.getView(o)[0]=Al;var s=this.indexBuffer.getView(o);At(a,s);var l=t.pstyle("background-color").value,u=t.pstyle("background-opacity").value,v=this.colorBuffer.getView(o);ia(l,u,v);var f=this.transformBuffer.getMatrixView(o);i.setTransformMatrix(t,f,n),this.rectangleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(t,a,n){if(t.visible()){var i=t._private.rscratch,o,s,l;if(n==="source"?(o=i.arrowStartX,s=i.arrowStartY,l=i.srcArrowAngle):(o=i.arrowEndX,s=i.arrowEndY,l=i.tgtArrowAngle),!(isNaN(o)||o==null||isNaN(s)||s==null||isNaN(l)||l==null)){var u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var v=t.pstyle(n+"-arrow-color").value,f=t.pstyle("opacity").value,c=t.pstyle("line-opacity").value,d=f*c,h=t.pstyle("width").pfValue,y=t.pstyle("arrow-scale").value,g=this.r.getArrowWidth(h,y),p=this.instanceCount,m=this.transformBuffer.getMatrixView(p);gf(m),bn(m,m,[o,s]),ts(m,m,[g,g]),pf(m,m,l),this.vertTypeBuffer.getView(p)[0]=vo;var b=this.indexBuffer.getView(p);At(a,b);var w=this.colorBuffer.getView(p);ia(v,d,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(t,a){if(t.visible()){var n=this.getEdgePoints(t);if(n){var i=t.pstyle("opacity").value,o=t.pstyle("line-opacity").value,s=t.pstyle("width").pfValue,l=t.pstyle("line-color").value,u=i*o;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),n.length==4){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=kl;var f=this.indexBuffer.getView(v);At(a,f);var c=this.colorBuffer.getView(v);ia(l,u,c);var d=this.lineWidthBuffer.getView(v);d[0]=s;var h=this.pointAPointBBuffer.getView(v);h[0]=n[0],h[1]=n[1],h[2]=n[2],h[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var y=0;y<n.length-2;y+=2){var g=this.instanceCount;this.vertTypeBuffer.getView(g)[0]=Pl;var p=this.indexBuffer.getView(g);At(a,p);var m=this.colorBuffer.getView(g);ia(l,u,m);var b=this.lineWidthBuffer.getView(g);b[0]=s;var w=n[y-2],E=n[y-1],C=n[y],x=n[y+1],S=n[y+2],k=n[y+3],A=n[y+4],D=n[y+5];y==0&&(w=2*C-S+.001,E=2*x-k+.001),y==n.length-4&&(A=2*S-C+.001,D=2*k-x+.001);var B=this.pointAPointBBuffer.getView(g);B[0]=w,B[1]=E,B[2]=C,B[3]=x;var P=this.pointCPointDBuffer.getView(g);P[0]=S,P[1]=k,P[2]=A,P[3]=D,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"getEdgePoints",value:function(t){var a=t._private.rscratch;if(!(a.badLine||a.allpts==null||isNaN(a.allpts[0]))){var n=a.allpts;if(n.length==4)return n;var i=this.getNumSegments(t);return this.getCurveSegmentPoints(n,i)}}},{key:"getNumSegments",value:function(t){var a=15;return Math.min(Math.max(a,5),this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(t,a){if(t.length==4)return t;for(var n=Array((a+1)*2),i=0;i<=a;i++)if(i==0)n[0]=t[0],n[1]=t[1];else if(i==a)n[i*2]=t[t.length-2],n[i*2+1]=t[t.length-1];else{var o=i/a;this.setCurvePoint(t,o,n,i*2)}return n}},{key:"setCurvePoint",value:function(t,a,n,i){if(t.length<=2)n[i]=t[0],n[i+1]=t[1];else{for(var o=Array(t.length-2),s=0;s<o.length;s+=2){var l=(1-a)*t[s]+a*t[s+2],u=(1-a)*t[s+1]+a*t[s+3];o[s]=l,o[s+1]=u}return this.setCurvePoint(o,a,n,i)}}},{key:"endBatch",value:function(){var t=this.gl,a=this.vao,n=this.vertexCount,i=this.instanceCount;if(i!==0){var o=this.renderTarget.picking?this.pickingProgram:this.program;t.useProgram(o),t.bindVertexArray(a);var s=Pr(this.buffers),l;try{for(s.s();!(l=s.n()).done;){var u=l.value;u.bufferSubData(i)}}catch(h){s.e(h)}finally{s.f()}for(var v=this.atlasManager.getAtlases(),f=0;f<v.length;f++)v[f].bufferIfNeeded(t);for(var c=0;c<v.length;c++)t.activeTexture(t.TEXTURE0+c),t.bindTexture(t.TEXTURE_2D,v[c].texture),t.uniform1i(o.uTextures[c],c);t.uniformMatrix3fv(o.uPanZoomMatrix,!1,this.panZoomMatrix),t.uniform1i(o.uAtlasSize,this.atlasManager.getAtlasSize());var d=ia(this.bgColor,1);t.uniform4fv(o.uBGColor,d),t.drawArraysInstanced(t.TRIANGLES,0,n,i),t.bindVertexArray(null),t.bindTexture(t.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:i,atlasCount:v.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var t=this.atlasManager.getDebugInfo(),a=t.reduce(function(o,s){return o+s.atlasCount},0),n=this.batchDebugInfo,i=n.reduce(function(o,s){return o+s.count},0);return{atlasInfo:t,totalAtlases:a,wrappedCount:this.wrappedCount,rectangleCount:this.rectangleCount,batchCount:n.length,batchInfo:n,totalInstances:i}}}])}();function Bl(r,e){return"rgba(".concat(r[0],", ").concat(r[1],", ").concat(r[2],", ").concat(e,")")}var Oy=function(){function r(e){st(this,r),this.r=e}return ut(r,[{key:"getStyleKey",value:function(t,a){var n=this.getStyle(t,a),i=n.shape,o=n.opacity,s=n.color;if(!i)return null;var l=a.width(),u=a.height(),v=Bl(s,o);return tt("".concat(i,"-").concat(l,"-").concat(u,"-").concat(v))}},{key:"isVisible",value:function(t,a){var n=a.pstyle("".concat(t,"-opacity")).value;return n>0}},{key:"getStyle",value:function(t,a){var n=a.pstyle("".concat(t,"-opacity")).value,i=a.pstyle("".concat(t,"-color")).value,o=a.pstyle("".concat(t,"-shape")).value;return{opacity:n,color:i,shape:o}}},{key:"getPadding",value:function(t,a){return a.pstyle("".concat(t,"-padding")).pfValue}},{key:"draw",value:function(t,a,n,i){if(this.isVisible(t,n)){var o=this.r,s=i.w,l=i.h,u=s/2,v=l/2,f=this.getStyle(t,n),c=f.shape,d=f.color,h=f.opacity;a.save(),a.fillStyle=Bl(d,h),c==="round-rectangle"||c==="roundrectangle"?o.drawRoundRectanglePath(a,u,v,s,l,"auto"):c==="ellipse"&&o.drawEllipsePath(a,u,v,s,l),a.fill(),a.restore()}}}])}(),yf={};yf.initWebgl=function(r,e){var t=this,a=t.data.contexts[t.WEBGL];r.bgColor=Ny(t),r.webglTexSize=Math.min(r.webglTexSize,a.getParameter(a.MAX_TEXTURE_SIZE)),r.webglTexRows=Math.min(r.webglTexRows,54),r.webglTexRowsNodes=Math.min(r.webglTexRowsNodes,54),r.webglBatchSize=Math.min(r.webglBatchSize,16384),r.webglTexPerBatch=Math.min(r.webglTexPerBatch,a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)),t.webglDebug=r.webglDebug,t.webglDebugShowAtlases=r.webglDebugShowAtlases,t.pickingFrameBuffer=ky(a),t.pickingFrameBuffer.needsDraw=!0;var n=function(u){return function(v){return t.getTextAngle(v,u)}},i=function(u){return function(v){var f=v.pstyle(u);return f&&f.value}};t.drawing=new Iy(t,a,r);var o=new Oy(t);t.drawing.addAtlasCollection("node",Dl({texRows:r.webglTexRowsNodes})),t.drawing.addAtlasCollection("label",Dl({texRows:r.webglTexRows})),t.drawing.addAtlasRenderType("node-body",Bt({collection:"node",getKey:e.getStyleKey,getBoundingBox:e.getElementBox,drawElement:e.drawElement})),t.drawing.addAtlasRenderType("label",Bt({collection:"label",getKey:e.getLabelKey,getBoundingBox:e.getLabelBox,drawElement:e.drawLabel,getRotation:n(null),getRotationPoint:e.getLabelRotationPoint,getRotationOffset:e.getLabelRotationOffset,isVisible:i("label")})),t.drawing.addAtlasRenderType("node-overlay",Bt({collection:"node",getBoundingBox:e.getElementBox,getKey:function(u){return o.getStyleKey("overlay",u)},drawElement:function(u,v,f){return o.draw("overlay",u,v,f)},isVisible:function(u){return o.isVisible("overlay",u)},getPadding:function(u){return o.getPadding("overlay",u)}})),t.drawing.addAtlasRenderType("node-underlay",Bt({collection:"node",getBoundingBox:e.getElementBox,getKey:function(u){return o.getStyleKey("underlay",u)},drawElement:function(u,v,f){return o.draw("underlay",u,v,f)},isVisible:function(u){return o.isVisible("underlay",u)},getPadding:function(u){return o.getPadding("underlay",u)}})),t.drawing.addAtlasRenderType("edge-source-label",Bt({collection:"label",getKey:e.getSourceLabelKey,getBoundingBox:e.getSourceLabelBox,drawElement:e.drawSourceLabel,getRotation:n("source"),getRotationPoint:e.getSourceLabelRotationPoint,getRotationOffset:e.getSourceLabelRotationOffset,isVisible:i("source-label")})),t.drawing.addAtlasRenderType("edge-target-label",Bt({collection:"label",getKey:e.getTargetLabelKey,getBoundingBox:e.getTargetLabelBox,drawElement:e.drawTargetLabel,getRotation:n("target"),getRotationPoint:e.getTargetLabelRotationPoint,getRotationOffset:e.getTargetLabelRotationOffset,isVisible:i("target-label")}));var s=Pa(function(){console.log("garbage collect flag set"),t.data.gc=!0},1e4);t.onUpdateEleCalcs(function(l,u){var v=!1;u&&u.length>0&&(v|=t.drawing.invalidate(u)),v&&s()}),zy(t)};function Ny(r){var e=r.cy.container(),t=e&&e.style&&e.style.backgroundColor||"white";return Gl(t)}function zy(r){{var e=r.render;r.render=function(i){i=i||{};var o=r.cy;r.webgl&&(o.zoom()>uf?(Fy(r),e.call(r,i)):(qy(r),bf(r,i,ca.SCREEN)))}}{var t=r.matchCanvasSize;r.matchCanvasSize=function(i){t.call(r,i),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0}}r.findNearestElements=function(i,o,s,l){return $y(r,i,o)};{var a=r.invalidateCachedZSortedEles;r.invalidateCachedZSortedEles=function(){a.call(r),r.pickingFrameBuffer.needsDraw=!0}}{var n=r.notify;r.notify=function(i,o){n.call(r,i,o),i==="viewport"||i==="bounds"?r.pickingFrameBuffer.needsDraw=!0:i==="background"&&r.drawing.invalidate(o,{type:"node-body"})}}}function Fy(r){var e=r.data.contexts[r.WEBGL];e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)}function qy(r){var e=function(a){a.save(),a.setTransform(1,0,0,1,0,0),a.clearRect(0,0,r.canvasWidth,r.canvasHeight),a.restore()};e(r.data.contexts[r.NODE]),e(r.data.contexts[r.DRAG])}function Vy(r){var e=r.canvasWidth,t=r.canvasHeight,a=rs(r),n=a.pan,i=a.zoom,o=sn();bn(o,o,[n.x,n.y]),ts(o,o,[i,i]);var s=sn();Ay(s,e,t);var l=sn();return Py(l,s,o),l}function mf(r,e){var t=r.canvasWidth,a=r.canvasHeight,n=rs(r),i=n.pan,o=n.zoom;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t,a),e.translate(i.x,i.y),e.scale(o,o)}function _y(r,e){r.drawSelectionRectangle(e,function(t){return mf(r,t)})}function Gy(r){var e=r.data.contexts[r.NODE];e.save(),mf(r,e),e.strokeStyle="rgba(0, 0, 0, 0.3)",e.beginPath(),e.moveTo(-1e3,0),e.lineTo(1e3,0),e.stroke(),e.beginPath(),e.moveTo(0,-1e3),e.lineTo(0,1e3),e.stroke(),e.restore()}function Hy(r){var e=function(n,i,o){for(var s=n.atlasManager.getAtlasCollection(i),l=r.data.contexts[r.NODE],u=.125,v=s.atlases,f=0;f<v.length;f++){var c=v[f],d=c.canvas;if(d){var h=d.width,y=d.height,g=h*f,p=d.height*o;l.save(),l.scale(u,u),l.drawImage(d,g,p),l.strokeStyle="black",l.rect(g,p,h,y),l.stroke(),l.restore()}}},t=0;e(r.drawing,"node",t++),e(r.drawing,"label",t++)}function Ky(r,e,t,a,n){var i,o,s,l,u=rs(r),v=u.pan,f=u.zoom;{var c=xy(r,v,f,e,t),d=je(c,2),h=d[0],y=d[1],g=6;i=h-g/2,o=y-g/2,s=g,l=g}if(s===0||l===0)return[];var p=r.data.contexts[r.WEBGL];p.bindFramebuffer(p.FRAMEBUFFER,r.pickingFrameBuffer),r.pickingFrameBuffer.needsDraw&&(p.viewport(0,0,p.canvas.width,p.canvas.height),bf(r,null,ca.PICKING),r.pickingFrameBuffer.needsDraw=!1);var m=s*l,b=new Uint8Array(m*4);p.readPixels(i,o,s,l,p.RGBA,p.UNSIGNED_BYTE,b),p.bindFramebuffer(p.FRAMEBUFFER,null);for(var w=new Set,E=0;E<m;E++){var C=b.slice(E*4,E*4+4),x=Ey(C)-1;x>=0&&w.add(x)}return w}function $y(r,e,t){var a=Ky(r,e,t),n=r.getCachedZSortedEles(),i,o,s=Pr(a),l;try{for(s.s();!(l=s.n()).done;){var u=l.value,v=n[u];if(!i&&v.isNode()&&(i=v),!o&&v.isEdge()&&(o=v),i&&o)break}}catch(f){s.e(f)}finally{s.f()}return[i,o].filter(Boolean)}function Uy(r){return r.pstyle("shape").value==="rectangle"&&r.pstyle("background-fill").value==="solid"&&r.pstyle("border-width").pfValue===0&&r.pstyle("background-image").strValue==="none"}function fo(r,e,t){var a=r.drawing;e+=1,t.isNode()?(a.drawTexture(t,e,"node-underlay"),Uy(t)?a.drawSimpleRectangle(t,e,"node-body"):a.drawTexture(t,e,"node-body"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"node-overlay")):(a.drawEdgeLine(t,e),a.drawEdgeArrow(t,e,"source"),a.drawEdgeArrow(t,e,"target"),a.drawTexture(t,e,"label"),a.drawTexture(t,e,"edge-source-label"),a.drawTexture(t,e,"edge-target-label"))}function bf(r,e,t){var a;r.webglDebug&&(a=performance.now());var n=r.drawing,i=0;if(t.screen&&r.data.canvasNeedsRedraw[r.SELECT_BOX]&&_y(r,e),r.data.canvasNeedsRedraw[r.NODE]||t.picking){var o=r.data.contexts[r.WEBGL];t.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=Vy(r),l=r.getCachedZSortedEles();if(i=l.length,n.startFrame(s,t),t.screen){for(var u=0;u<l.nondrag.length;u++)fo(r,u,l.nondrag[u]);for(var v=0;v<l.drag.length;v++)fo(r,v,l.drag[v])}else if(t.picking)for(var f=0;f<l.length;f++)fo(r,f,l[f]);n.endFrame(),t.screen&&r.webglDebugShowAtlases&&(Gy(r),Hy(r)),r.data.canvasNeedsRedraw[r.NODE]=!1,r.data.canvasNeedsRedraw[r.DRAG]=!1}if(r.webglDebug){var c=performance.now(),d=!1,h=Math.ceil(c-a),y=n.getDebugInfo(),g=["".concat(i," elements"),"".concat(y.totalInstances," instances"),"".concat(y.batchCount," batches"),"".concat(y.totalAtlases," atlases"),"".concat(y.wrappedCount," wrapped textures"),"".concat(y.rectangleCount," simple rectangles")].join(", ");if(d)console.log("WebGL (".concat(t.name,") - time ").concat(h,"ms, ").concat(g));else{console.log("WebGL (".concat(t.name,") - frame time ").concat(h,"ms")),console.log("Totals:"),console.log(" ".concat(g)),console.log("Texture Atlases Used:");var p=y.atlasInfo,m=Pr(p),b;try{for(m.s();!(b=m.n()).done;){var w=b.value;console.log(" ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(E){m.e(E)}finally{m.f()}console.log("")}}r.data.gc&&(console.log("Garbage Collect!"),r.data.gc=!1,n.gc())}var vt={};vt.drawPolygonPath=function(r,e,t,a,n,i){var o=a/2,s=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var l=1;l<i.length/2;l++)r.lineTo(e+o*i[l*2],t+s*i[l*2+1]);r.closePath()};vt.drawRoundPolygonPath=function(r,e,t,a,n,i,o){o.forEach(function(s){return Jv(r,s)}),r.closePath()};vt.drawRoundRectanglePath=function(r,e,t,a,n,i){var o=a/2,s=n/2,l=i==="auto"?mt(a,n):Math.min(i,s,o);r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.arcTo(e+o,t-s,e+o,t,l),r.arcTo(e+o,t+s,e,t+s,l),r.arcTo(e-o,t+s,e-o,t,l),r.arcTo(e-o,t-s,e,t-s,l),r.lineTo(e,t-s),r.closePath()};vt.drawBottomRoundRectanglePath=function(r,e,t,a,n,i){var o=a/2,s=n/2,l=i==="auto"?mt(a,n):i;r.beginPath&&r.beginPath(),r.moveTo(e,t-s),r.lineTo(e+o,t-s),r.lineTo(e+o,t),r.arcTo(e+o,t+s,e,t+s,l),r.arcTo(e-o,t+s,e-o,t,l),r.lineTo(e-o,t-s),r.lineTo(e,t-s),r.closePath()};vt.drawCutRectanglePath=function(r,e,t,a,n,i,o){var s=a/2,l=n/2,u=o==="auto"?_o():o;r.beginPath&&r.beginPath(),r.moveTo(e-s+u,t-l),r.lineTo(e+s-u,t-l),r.lineTo(e+s,t-l+u),r.lineTo(e+s,t+l-u),r.lineTo(e+s-u,t+l),r.lineTo(e-s+u,t+l),r.lineTo(e-s,t+l-u),r.lineTo(e-s,t-l+u),r.closePath()};vt.drawBarrelPath=function(r,e,t,a,n){var i=a/2,o=n/2,s=e-i,l=e+i,u=t-o,v=t+o,f=go(a,n),c=f.widthOffset,d=f.heightOffset,h=f.ctrlPtOffsetPct*c;r.beginPath&&r.beginPath(),r.moveTo(s,u+d),r.lineTo(s,v-d),r.quadraticCurveTo(s+h,v,s+c,v),r.lineTo(l-c,v),r.quadraticCurveTo(l-h,v,l,v-d),r.lineTo(l,u+d),r.quadraticCurveTo(l-h,u,l-c,u),r.lineTo(s+c,u),r.quadraticCurveTo(s+h,u,s,u+d),r.closePath()};var Rl=Math.sin(0),Ml=Math.cos(0),Ao={},Bo={},wf=Math.PI/40;for(var Rt=0*Math.PI;Rt<2*Math.PI;Rt+=wf)Ao[Rt]=Math.sin(Rt),Bo[Rt]=Math.cos(Rt);vt.drawEllipsePath=function(r,e,t,a,n){if(r.beginPath&&r.beginPath(),r.ellipse)r.ellipse(e,t,a/2,n/2,0,0,2*Math.PI);else for(var i,o,s=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=wf)i=e-s*Ao[u]*Rl+s*Bo[u]*Ml,o=t+l*Bo[u]*Rl+l*Ao[u]*Ml,u===0?r.moveTo(i,o):r.lineTo(i,o);r.closePath()};var Ia={};Ia.createBuffer=function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,[t,t.getContext("2d")]};Ia.bufferCanvasImage=function(r){var e=this.cy,t=e.mutableElements(),a=t.boundingBox(),n=this.findContainerClientCoords(),i=r.full?Math.ceil(a.w):n[2],o=r.full?Math.ceil(a.h):n[3],s=ae(r.maxWidth)||ae(r.maxHeight),l=this.getPixelRatio(),u=1;if(r.scale!==void 0)i*=r.scale,o*=r.scale,u=r.scale;else if(s){var v=1/0,f=1/0;ae(r.maxWidth)&&(v=u*r.maxWidth/i),ae(r.maxHeight)&&(f=u*r.maxHeight/o),u=Math.min(v,f),i*=u,o*=u}s||(i*=l,o*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=o,c.style.width=i+"px",c.style.height=o+"px";var d=c.getContext("2d");if(i>0&&o>0){d.clearRect(0,0,i,o),d.globalCompositeOperation="source-over";var h=this.getCachedZSortedEles();if(r.full)d.translate(-a.x1*u,-a.y1*u),d.scale(u,u),this.drawElements(d,h),d.scale(1/u,1/u),d.translate(a.x1*u,a.y1*u);else{var y=e.pan(),g={x:y.x*u,y:y.y*u};u*=e.zoom(),d.translate(g.x,g.y),d.scale(u,u),this.drawElements(d,h),d.scale(1/u,1/u),d.translate(-g.x,-g.y)}r.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=r.bg,d.rect(0,0,i,o),d.fill())}return c};function Wy(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new Blob([a],{type:e})}function Ll(r){var e=r.indexOf(",");return r.substr(e+1)}function xf(r,e,t){var a=function(){return e.toDataURL(t,r.quality)};switch(r.output){case"blob-promise":return new Ut(function(n,i){try{e.toBlob(function(o){o!=null?n(o):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},t,r.quality)}catch(o){i(o)}});case"blob":return Wy(Ll(a()),t);case"base64":return Ll(a());case"base64uri":default:return a()}}Ia.png=function(r){return xf(r,this.bufferCanvasImage(r),"image/png")};Ia.jpg=function(r){return xf(r,this.bufferCanvasImage(r),"image/jpeg")};var Ef={};Ef.nodeShapeImpl=function(r,e,t,a,n,i,o,s){switch(r){case"ellipse":return this.drawEllipsePath(e,t,a,n,i);case"polygon":return this.drawPolygonPath(e,t,a,n,i,o);case"round-polygon":return this.drawRoundPolygonPath(e,t,a,n,i,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,t,a,n,i,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,t,a,n,i,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,t,a,n,i,s);case"barrel":return this.drawBarrelPath(e,t,a,n,i)}};var Yy=Cf,Te=Cf.prototype;Te.CANVAS_LAYERS=3;Te.SELECT_BOX=0;Te.DRAG=1;Te.NODE=2;Te.WEBGL=3;Te.CANVAS_TYPES=["2d","2d","2d","webgl2"];Te.BUFFER_COUNT=3;Te.TEXTURE_BUFFER=0;Te.MOTIONBLUR_BUFFER_NODE=1;Te.MOTIONBLUR_BUFFER_DRAG=2;function Cf(r){var e=this,t=e.cy.window(),a=t.document;r.webgl&&(Te.CANVAS_LAYERS=e.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),e.data={canvases:new Array(Te.CANVAS_LAYERS),contexts:new Array(Te.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Te.CANVAS_LAYERS),bufferCanvases:new Array(Te.BUFFER_COUNT),bufferContexts:new Array(Te.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";e.data.canvasContainer=a.createElement("div");var o=e.data.canvasContainer.style;e.data.canvasContainer.style[n]=i,o.position="relative",o.zIndex="0",o.overflow="hidden";var s=r.cy.container();s.appendChild(e.data.canvasContainer),s.style[n]=i;var l={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};ec()&&(l["-ms-touch-action"]="none",l["touch-action"]="none");for(var u=0;u<Te.CANVAS_LAYERS;u++){var v=e.data.canvases[u]=a.createElement("canvas"),f=Te.CANVAS_TYPES[u];e.data.contexts[u]=v.getContext(f),e.data.contexts[u]||Ve("Could not create canvas of type "+f),Object.keys(l).forEach(function(K){v.style[K]=l[K]}),v.style.position="absolute",v.setAttribute("data-id","layer"+u),v.style.zIndex=String(Te.CANVAS_LAYERS-u),e.data.canvasContainer.appendChild(v),e.data.canvasNeedsRedraw[u]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Te.NODE].setAttribute("data-id","layer"+Te.NODE+"-node"),e.data.canvases[Te.SELECT_BOX].setAttribute("data-id","layer"+Te.SELECT_BOX+"-selectbox"),e.data.canvases[Te.DRAG].setAttribute("data-id","layer"+Te.DRAG+"-drag"),e.data.canvases[Te.WEBGL]&&e.data.canvases[Te.WEBGL].setAttribute("data-id","layer"+Te.WEBGL+"-webgl");for(var u=0;u<Te.BUFFER_COUNT;u++)e.data.bufferCanvases[u]=a.createElement("canvas"),e.data.bufferContexts[u]=e.data.bufferCanvases[u].getContext("2d"),e.data.bufferCanvases[u].style.position="absolute",e.data.bufferCanvases[u].setAttribute("data-id","buffer"+u),e.data.bufferCanvases[u].style.zIndex=String(-u-1),e.data.bufferCanvases[u].style.visibility="hidden";e.pathsEnabled=!0;var c=pr(),d=function(N){return{x:(N.x1+N.x2)/2,y:(N.y1+N.y2)/2}},h=function(N){return{x:-N.w/2,y:-N.h/2}},y=function(N){var $=N[0]._private,J=$.oldBackgroundTimestamp===$.backgroundTimestamp;return!J},g=function(N){return N[0]._private.nodeKey},p=function(N){return N[0]._private.labelStyleKey},m=function(N){return N[0]._private.sourceLabelStyleKey},b=function(N){return N[0]._private.targetLabelStyleKey},w=function(N,$,J,te,le){return e.drawElement(N,$,J,!1,!1,le)},E=function(N,$,J,te,le){return e.drawElementText(N,$,J,te,"main",le)},C=function(N,$,J,te,le){return e.drawElementText(N,$,J,te,"source",le)},x=function(N,$,J,te,le){return e.drawElementText(N,$,J,te,"target",le)},S=function(N){return N.boundingBox(),N[0]._private.bodyBounds},k=function(N){return N.boundingBox(),N[0]._private.labelBounds.main||c},A=function(N){return N.boundingBox(),N[0]._private.labelBounds.source||c},D=function(N){return N.boundingBox(),N[0]._private.labelBounds.target||c},B=function(N,$){return $},P=function(N){return d(S(N))},R=function(N,$,J){var te=N?N+"-":"";return{x:$.x+J.pstyle(te+"text-margin-x").pfValue,y:$.y+J.pstyle(te+"text-margin-y").pfValue}},L=function(N,$,J){var te=N[0]._private.rscratch;return{x:te[$],y:te[J]}},I=function(N){return R("",L(N,"labelX","labelY"),N)},M=function(N){return R("source",L(N,"sourceLabelX","sourceLabelY"),N)},O=function(N){return R("target",L(N,"targetLabelX","targetLabelY"),N)},_=function(N){return h(S(N))},H=function(N){return h(A(N))},z=function(N){return h(D(N))},G=function(N){var $=k(N),J=h(k(N));if(N.isNode()){switch(N.pstyle("text-halign").value){case"left":J.x=-$.w-($.leftPad||0);break;case"right":J.x=-($.rightPad||0);break}switch(N.pstyle("text-valign").value){case"top":J.y=-$.h-($.topPad||0);break;case"bottom":J.y=-($.botPad||0);break}}return J},W=e.data.eleTxrCache=new la(e,{getKey:g,doesEleInvalidateKey:y,drawElement:w,getBoundingBox:S,getRotationPoint:P,getRotationOffset:_,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),X=e.data.lblTxrCache=new la(e,{getKey:p,drawElement:E,getBoundingBox:k,getRotationPoint:I,getRotationOffset:G,isVisible:B}),Z=e.data.slbTxrCache=new la(e,{getKey:m,drawElement:C,getBoundingBox:A,getRotationPoint:M,getRotationOffset:H,isVisible:B}),Q=e.data.tlbTxrCache=new la(e,{getKey:b,drawElement:x,getBoundingBox:D,getRotationPoint:O,getRotationOffset:z,isVisible:B}),ee=e.data.lyrTxrCache=new lf(e);e.onUpdateEleCalcs(function(N,$){W.invalidateElements($),X.invalidateElements($),Z.invalidateElements($),Q.invalidateElements($),ee.invalidateElements($);for(var J=0;J<$.length;J++){var te=$[J]._private;te.oldBackgroundTimestamp=te.backgroundTimestamp}});var re=function(N){for(var $=0;$<N.length;$++)ee.enqueueElementRefinement(N[$].ele)};W.onDequeue(re),X.onDequeue(re),Z.onDequeue(re),Q.onDequeue(re),r.webgl&&e.initWebgl(r,{getStyleKey:g,getLabelKey:p,getSourceLabelKey:m,getTargetLabelKey:b,drawElement:w,drawLabel:E,drawSourceLabel:C,drawTargetLabel:x,getElementBox:S,getLabelBox:k,getSourceLabelBox:A,getTargetLabelBox:D,getElementRotationPoint:P,getElementRotationOffset:_,getLabelRotationPoint:I,getSourceLabelRotationPoint:M,getTargetLabelRotationPoint:O,getLabelRotationOffset:G,getSourceLabelRotationOffset:H,getTargetLabelRotationOffset:z})}Te.redrawHint=function(r,e){var t=this;switch(r){case"eles":t.data.canvasNeedsRedraw[Te.NODE]=e;break;case"drag":t.data.canvasNeedsRedraw[Te.DRAG]=e;break;case"select":t.data.canvasNeedsRedraw[Te.SELECT_BOX]=e;break;case"gc":t.data.gc=!0;break}};var Xy=typeof Path2D<"u";Te.path2dEnabled=function(r){if(r===void 0)return this.pathsEnabled;this.pathsEnabled=!!r};Te.usePaths=function(){return Xy&&this.pathsEnabled};Te.setImgSmoothing=function(r,e){r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled=e:(r.webkitImageSmoothingEnabled=e,r.mozImageSmoothingEnabled=e,r.msImageSmoothingEnabled=e)};Te.getImgSmoothing=function(r){return r.imageSmoothingEnabled!=null?r.imageSmoothingEnabled:r.webkitImageSmoothingEnabled||r.mozImageSmoothingEnabled||r.msImageSmoothingEnabled};Te.makeOffscreenCanvas=function(r,e){var t;if((typeof OffscreenCanvas>"u"?"undefined":Ue(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[vf,qr,Yr,es,Ct,Qt,hr,yf,vt,Ia,Ef].forEach(function(r){ge(Te,r)});var Zy=[{name:"null",impl:Xv},{name:"base",impl:of},{name:"canvas",impl:Yy}],Qy=[{type:"layout",extensions:Ap},{type:"renderer",extensions:Zy}],Tf={},Sf={};function Df(r,e,t){var a=t,n=function(S){Re("Can not register `"+e+"` for `"+r+"` since `"+S+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(xa.prototype[e])return n(e);xa.prototype[e]=t}else if(r==="collection"){if(nr.prototype[e])return n(e);nr.prototype[e]=t}else if(r==="layout"){for(var i=function(S){this.options=S,t.call(this,S),ke(this._private)||(this._private={}),this._private.cy=S.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var v=t.prototype.stop;o.stop=function(){var x=this.options;if(x&&x.animate){var S=this.animations;if(S)for(var k=0;k<S.length;k++)S[k].stop()}return v?v.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var f=function(S){return S._private.cy},c={addEventFields:function(S,k){k.layout=S,k.cy=f(S),k.target=S},bubble:function(){return!0},parent:function(S){return f(S)}};ge(o,{createEmitter:function(){return this._private.emitter=new Rn(c,this),this},emitter:function(){return this._private.emitter},on:function(S,k){return this.emitter().on(S,k),this},one:function(S,k){return this.emitter().one(S,k),this},once:function(S,k){return this.emitter().one(S,k),this},removeListener:function(S,k){return this.emitter().removeListener(S,k),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(S,k){return this.emitter().emit(S,k),this}}),Be.eventAliasesOn(o),a=i}else if(r==="renderer"&&e!=="null"&&e!=="base"){var d=kf("renderer","base"),h=d.prototype,y=t,g=t.prototype,p=function(){d.apply(this,arguments),y.apply(this,arguments)},m=p.prototype;for(var b in h){var w=h[b],E=g[b]!=null;if(E)return n(b);m[b]=w}for(var C in g)m[C]=g[C];h.clientFunctions.forEach(function(x){m[x]=m[x]||function(){Ve("Renderer does not implement `renderer."+x+"()` on its prototype")}}),a=p}else if(r==="__proto__"||r==="constructor"||r==="prototype")return Ve(r+" is an illegal type to be registered, possibly lead to prototype pollutions");return Hl({map:Tf,keys:[r,e],value:a})}function kf(r,e){return Kl({map:Tf,keys:[r,e]})}function Jy(r,e,t,a,n){return Hl({map:Sf,keys:[r,e,t,a],value:n})}function jy(r,e,t,a){return Kl({map:Sf,keys:[r,e,t,a]})}var Ro=function(){if(arguments.length===2)return kf.apply(null,arguments);if(arguments.length===3)return Df.apply(null,arguments);if(arguments.length===4)return jy.apply(null,arguments);if(arguments.length===5)return Jy.apply(null,arguments);Ve("Invalid extension access syntax")};xa.prototype.extension=Ro;Qy.forEach(function(r){r.extensions.forEach(function(e){Df(r.type,e.name,e.impl)})});var wn=function(){if(!(this instanceof wn))return new wn;this.length=0},xt=wn.prototype;xt.instanceString=function(){return"stylesheet"};xt.selector=function(r){var e=this.length++;return this[e]={selector:r,properties:[]},this};xt.css=function(r,e){var t=this.length-1;if(fe(r))this[t].properties.push({name:r,value:e});else if(ke(r))for(var a=r,n=Object.keys(a),i=0;i<n.length;i++){var o=n[i],s=a[o];if(s!=null){var l=er.properties[o]||er.properties[xn(o)];if(l!=null){var u=l.name,v=s;this[t].properties.push({name:u,value:v})}}}return this};xt.style=xt.css;xt.generateStyle=function(r){var e=new er(r);return this.appendToStyle(e)};xt.appendToStyle=function(r){for(var e=0;e<this.length;e++){var t=this[e],a=t.selector,n=t.properties;r.selector(a);for(var i=0;i<n.length;i++){var o=n[i];r.css(o.name,o.value)}}return r};var em="3.31.2",Kt=function(e){if(e===void 0&&(e={}),ke(e))return new xa(e);if(fe(e))return Ro.apply(Ro,arguments)};Kt.use=function(r){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Kt),r.apply(null,e),this};Kt.warnings=function(r){return Ql(r)};Kt.version=em;Kt.stylesheet=Kt.Stylesheet=wn;export{Kt as c};